Package tools.util

Examples of tools.util.NameValuePairs


    String ps = config.getServletContext().getRealPath("/WEB-INF/jiql.properties");
    if (!new File(ps).exists())
        {
      return;
    }
     NameValuePairs p = new NameValuePairs(ps);
     theUser = (String)p.get("user");
    thePassword = (String)p.get("password");
    if (p.getInt("maxUpload") > 0)
      mU = p.getInt("maxUpload");

    }catch (Exception e){
      tools.util.LogMgr.err("JiqlServlet.init " + e.toString());
      e.printStackTrace(System.out);
    }
View Full Code Here


    }
      //throw new ServletException("Invalid User OR Password");
      if (sql == null)
      sql = req.getParameter("query");
      //( "THE SQL " + sql);
NameValuePairs nvp = new NameValuePairs();
if (dfo == null)
dfo = req.getParameter("date.format");
if (dfo != null)
nvp.put("date.format",dfo);

if (enc == null)
enc = req.getParameter("encoding");
if (enc != null)
nvp.put("encoding",enc);

Conn = get(nvp);
org.jiql.jdbc.Statement Stmt = (org.jiql.jdbc.Statement)Conn.createStatement();
Stmt.setDirectValues(dv);
View Full Code Here

        //if (h == null) return null;
        //if (incl == null || incl.size() < 1)return h;
       
       
       
        NameValuePairs sh = new NameValuePairs();
        //Hashtable sh = new Hashtable();
        String id = null;
        NameValuePairs row = null;
        Object nvo = null;
        boolean add = false;
        ColumnInfo ci = null;
        TableInfo ti = null;
        if (sqp != null)
          ti = sqp.getTableInfo();
        if(ti == null)
        ti = readTableInfo(t,sqp);
        jiqlCellValue c1 = null;
        jiqlCellValue c2 = null;
        int typ = 0;
       
   
   
          NameValuePairs h2 = new NameValuePairs();

              Criteria cr = (Criteria)incl.elementAt(0);

        incl = (Vector)incl.clone();
        incl.removeElementAt(0);
          String crn = cr.getRealName();

            if (cr.getCompareOperator().equals("="))
            {
             
            h = readTableValueWhereEqual(sqp,t,crn,cr.getValue());

                         
            }
            else if (cr.getCompareOperator().equals(">"))
            {
              h = readTableValueWhereGreaterThan(sqp,t,crn,cr.getValue());


            }
            else if (cr.getCompareOperator().equals("<"))
            {
              h = readTableValueWhereLessThan(sqp,t,crn,cr.getValue());

            }

            else if (cr.getCompareOperator().equals(">="))
            {
              h = readTableValueWhereGreaterThanOrEqual(sqp,t,crn,cr.getValue());

            }
            else if (cr.getCompareOperator().equals("!="))
            {
              h = readTableValueWhereGreaterThan(sqp,t,crn,cr.getValue());
            if (h != null)
            h2.merge(h);
              h = readTableValueWhereLessThan(sqp,t,crn,cr.getValue());
            if (h != null)
            h2.merge(h);
            h = (Hashtable)h2;
            }
            else if (cr.getCompareOperator().equals("<="))
            {
              h = readTableValueWhereLessThanOrEqual(sqp,t,crn,cr.getValue());
            }
            else if (cr.getCompareOperator().equals("in"))
            {
              Vector ic = cr.getInClause();
              for (int cit  =0;cit < ic.size();cit++)
              {
                 h = readTableValueWhereEqual(sqp,t,crn,ic.elementAt(cit));
            if (h != null)
            h2.merge(h);             
              }
              h = (Hashtable)h2;
             
            }
            else if (cr.getCompareOperator().equals("is"))
View Full Code Here

//          if (incl.size() < 1)
//        return h;
        Enumeration en = h.keys();
        Hashtable sh = new Hashtable();
        String id = null;
        NameValuePairs row = null;
        //int typ = 0;
      //Criteria cr = null;
        jiqlCellValue c1 = null;
        jiqlCellValue c2 = null;
        Object nvo = null;
        boolean add = false;

        while (en.hasMoreElements())
        {
          id = en.nextElement().toString();
          row = (NameValuePairs)h.get(id);
          //for (int ct = 0;ct < incl.size();ct++){
            //add = false;
            //cr = (Criteria)incl.elementAt(ct);
          //  if (cr.getCompareOperator().equals("="))
          //  {
              nvo = row.get(rn);
              //(nvo + " CMPR 1 " + id + ":" + h + ":" + rn + ":" + v);

              if (nvo == null)continue;
          //typ = ti.get (cr.getName()).getColumnType();
              c1 = new jiqlCellValue(nvo,typ,null);
View Full Code Here

    throw JGException.get("incompatible_join_criteria",n + " Incompatible join criteria " + tt);
}

  //Hashtable  (String rn,Hashtable h,int typ,Object v)
  Vector vr = new Vector();
     NameValuePairs row = null;
  h = null;


  String n2 = null;
  String tt2 = null;
  Vector joined = new Vector();
  Vector j1 = null;
  Vector j2 = null;
    EZArrayList nvr = new EZArrayList();
    Vector vt = null;
    Object val = null;
    NameValuePairs ref = null;

 
 
    for (int ct = 0;ct < jincludealllist.size();ct++)
  {
    c = (Criteria)jincludealllist.elementAt(ct);
    n = c.getName();
    tt = findTable(n);
    //("************TT1 " + tt);
    if (sqp.getTableInfo().getColumnInfo(sqp.getRealColName(n)) != null)
      tt = sqp.getTable();
    //("************TT2 " + tt);

    n2 = c.getValueString();
    tt2 = findTable(n2);
    if (sqp.getTableInfo().getColumnInfo(sqp.getRealColName(n2)) != null && !tt.equals(sqp.getTable()))
      tt2 = sqp.getTable();
  //role.realm_username Cannot join the same table realm_user1:realm_user1
    if (tt.equals(tt2))
      tt = findTable(n);
    //("************TT3 " + tt);

    if (tt.equals(tt2))
     throw JGException.get("cannot_join_same_table",n + " Cannot join the same table " + tt + ":" + tt2);
   
    if (joined.contains(tt) && joined.contains(tt2))
     throw JGException.get("at_least_1_table_must_not_be_joined",n + " Trying to Join 2 tables already joined. At least 1 table must not be joined " + tt + ":" + tt2);
    if (joined.contains(tt))
      j1 = vr;
    else{
      if (tt.equals(sqp.getTable()))
        j1 = r;
      else
        j1 = new EZArrayList(getSQLParser(tt).getResultsTable().elements());
    }


    if (joined.contains(tt2))
    {
      j2 = vr;
    //("j2 1 " + j2);

    }
    else{
      if (tt2.equals(sqp.getTable())){
     
        j2 = r;
          //("j2 2 " + j2);

      }
      else{
     
        j2 = new EZArrayList(getSQLParser(tt2).getResultsTable().elements());
          //("j2 3 " + j2);

      }
    }
    nvr = new EZArrayList();
    vt = null;
    val = null;
    ref = null;
      for (int ct1 = 0; ct1 < j1.size(); ct1++){
      ref = (NameValuePairs)j1.elementAt(ct1);
      val = ref.get(n);
      if (val == null)continue;
      vt = joinTable(n2,j2,type,val,ref);
      if (vt.size() > 0)
        nvr.addEnumeration(vt.elements(),nvr);

View Full Code Here

TOP

Related Classes of tools.util.NameValuePairs

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.