Package railo.runtime.type

Examples of railo.runtime.type.Array


  public long getPageContextsSize() {
    return SizeOf.size(pcs);
  }
 
  public Array getInfo() {
    Array info=new ArrayImpl();
   
    synchronized (runningPcs) {
            //int len=runningPcs.size();
      Iterator<Key> it = runningPcs.keyIterator();
            PageContextImpl pc;
            Struct data,sctThread,scopes;
        Collection.Key key;
            Thread thread;
        while(it.hasNext()) {
              data=new StructImpl();
              sctThread=new StructImpl();
              scopes=new StructImpl();
              data.setEL("thread", sctThread);
                data.setEL("scopes", scopes);
               
             
              key=KeyImpl.toKey(it.next(),null);
                //print.out("key:"+key);
                pc=(PageContextImpl) runningPcs.get(key,null);
                if(pc==null || pc.isGatewayContext()) continue;
                thread=pc.getThread();
                if(thread==Thread.currentThread()) continue;

               
                thread=pc.getThread();
                if(thread==Thread.currentThread()) continue;
               
              
               
                data.setEL("startTime", new DateTimeImpl(pc.getStartTime(),false));
                data.setEL("endTime", new DateTimeImpl(pc.getStartTime()+pc.getRequestTimeout(),false));
                data.setEL(KeyConstants._timeout,new Double(pc.getRequestTimeout()));

               
                // thread
                sctThread.setEL(KeyConstants._name,thread.getName());
                sctThread.setEL("priority",Caster.toDouble(thread.getPriority()));
                data.setEL("TagContext",PageExceptionImpl.getTagContext(pc.getConfig(),thread.getStackTrace() ));

                data.setEL("urlToken", pc.getURLToken());
                try {
          if(pc.getConfig().debug())data.setEL("debugger", pc.getDebugger().getDebuggingData(pc));
        } catch (PageException e2) {}

                try {
          data.setEL("id", Hash.call(pc, pc.getId()+":"+pc.getStartTime()));
        } catch (PageException e1) {}
                data.setEL("requestid", pc.getId());

                // Scopes
                scopes.setEL(KeyConstants._name, pc.getApplicationContext().getName());
                try {
          scopes.setEL(KeyConstants._application, pc.applicationScope());
        } catch (PageException e) {}

                try {
          scopes.setEL(KeyConstants._session, pc.sessionScope());
        } catch (PageException e) {}
               
                try {
          scopes.setEL(KeyConstants._client, pc.clientScope());
        } catch (PageException e) {}
                scopes.setEL(KeyConstants._cookie, pc.cookieScope());
                scopes.setEL(KeyConstants._variables, pc.variablesScope());
                if(!(pc.localScope() instanceof LocalNotSupportedScope)){
                  scopes.setEL(KeyConstants._local, pc.localScope());
                  scopes.setEL(KeyConstants._arguments, pc.argumentsScope());
                }
                scopes.setEL(KeyConstants._cgi, pc.cgiScope());
                scopes.setEL(KeyConstants._form, pc.formScope());
                scopes.setEL(KeyConstants._url, pc.urlScope());
                scopes.setEL(KeyConstants._request, pc.requestScope());
               
                info.appendEL(data);
            }
            return info;
        }
  }
View Full Code Here


      qry.rename(COLUMN_DEFAULT,COLUMN_DEFAULT_VALUE);
   
    // make sure decimal digits exists
    QueryColumn col = qry.getColumn(DECIMAL_DIGITS,null);
    if(col==null){
      Array arr=new ArrayImpl();
      for(int i=1;i<=len;i++) {
        arr.append(railo.runtime.op.Constants.DOUBLE_ZERO);
      }
      qry.addColumn(DECIMAL_DIGITS, arr);
    }
   
   
    // add is primary
    Map primaries = new HashMap();
    String tblName;
    Array isPrimary=new ArrayImpl();
    Set set;
    Object o;
    for(int i=1;i<=len;i++) {
     
      // decimal digits
      o=qry.getAt(DECIMAL_DIGITS, i,null);
      if(o==null)qry.setAtEL(DECIMAL_DIGITS, i,railo.runtime.op.Constants.DOUBLE_ZERO);
     
      set=(Set) primaries.get(tblName=(String) qry.getAt(TABLE_NAME, i));
      if(set==null) {
        set=toSet(metaData.getPrimaryKeys(dbname, null, tblName),true,"COLUMN_NAME");
        primaries.put(tblName,set);
      }
      isPrimary.append(set.contains(qry.getAt(COLUMN_NAME, i))?"YES":"NO");
    }
    qry.addColumn(IS_PRIMARYKEY, isPrimary);
   
    // add is foreignkey
    Map foreigns = new HashMap();
    Array isForeign=new ArrayImpl();
    Array refPrim=new ArrayImpl();
    Array refPrimTbl=new ArrayImpl();
    //Map map,inner;
    Map<String, Map<String, SVArray>> map;
    Map<String, SVArray> inner;
    for(int i=1;i<=len;i++) {
      map=(Map) foreigns.get(tblName=(String) qry.getAt(TABLE_NAME, i));
      if(map==null) {
        map=toMap(
            metaData.getImportedKeys(dbname, schema, table),
            true,
            "FKCOLUMN_NAME",
            new String[]{"PKCOLUMN_NAME","PKTABLE_NAME"});
        foreigns.put(tblName, map);
      }
      inner = map.get(qry.getAt(COLUMN_NAME, i));
      if(inner!=null) {
        isForeign.append("YES");
        refPrim.append(inner.get("PKCOLUMN_NAME"));
        refPrimTbl.append(inner.get("PKTABLE_NAME"));
      }
      else {
        isForeign.append("NO");
        refPrim.append("N/A");
        refPrimTbl.append("N/A");     
      }
    }
    qry.addColumn(IS_FOREIGNKEY, isForeign);
    qry.addColumn(REFERENCED_PRIMARYKEY, refPrim);
    qry.addColumn(REFERENCED_PRIMARYKEY_TABLE, refPrimTbl);
View Full Code Here

      }
     
      // sqlparameters
      SQLItem[] params = sql.getItems();
      if(params!=null && params.length>0) {
        Array arr=new ArrayImpl();
        sct.setEL(SQL_PARAMETERS, arr);
        for(int i=0;i<params.length;i++) {
          arr.append(params[i].getValue());
         
        }
      }
      pageContext.setVariable(result, sct);
    }
View Full Code Here

  private Object executeORM(SQL sql, int returnType, Struct ormoptions) throws PageException {
    ORMSession session=ORMUtil.getSession(pageContext);
   
    // params
    SQLItem[] _items = sql.getItems();
    Array params=new ArrayImpl();
    for(int i=0;i<_items.length;i++){
      params.appendEL(_items[i]);
    }
   
    // query options
    if(maxrows!=-1 && !ormoptions.containsKey(MAX_RESULTS)) ormoptions.setEL(MAX_RESULTS, new Double(maxrows));
    if(timeout!=-1 && !ormoptions.containsKey(TIMEOUT)) ormoptions.setEL(TIMEOUT, new Double(timeout));
View Full Code Here

  public static Array call(PageContext pc, Query query, String strColumn) throws PageException {
        return toArray(query.removeColumn(KeyImpl.init(strColumn)));
    }
   
    public static Array toArray(QueryColumn column) throws PageException {
        Array clone=new ArrayImpl();
        int len=column.size();
        clone.resize(len);
       
        for(int i=1;i<=len;i++) {
            clone.setE(i,QueryUtil.getValue(column,i));
        }
        return clone;
    }
View Full Code Here

public class ValueArray extends BIF {
 
  private static final long serialVersionUID = -1810991362001086246L;

  public static Array call(PageContext pc , QueryColumn column) throws PageException {
    Array arr=new ArrayImpl();
      int size=column.size();
    for(int i=1;i<=size;i++) {
      arr.append(Caster.toString(column.get(i,null)));
    }
    return arr; 
  }
View Full Code Here

    if(StringUtil.isEmpty(columnTypeList)) return call(pc, columnList);
    return new QueryImpl(ListUtil.listToArrayTrim(columnList,","),ListUtil.listToArrayTrim(columnTypeList,","),0,"query");
  }
 
  public static railo.runtime.type.Query call(PageContext pc , String strColumnList, String strColumnTypeList, Object data) throws PageException {
    Array columnList = ListUtil.listToArrayTrim(strColumnList,",");
    railo.runtime.type.Query qry;
    if(StringUtil.isEmpty(strColumnTypeList))
      qry= new QueryImpl(columnList,0,"query");
    else
      qry= new QueryImpl(columnList,ListUtil.listToArrayTrim(strColumnTypeList,","),0,"query");
View Full Code Here

 
  private static Query _populate(PageContext pc, Query qry,Struct data) throws PageException {
    Iterator<Entry<Key, Object>> it = data.entryIterator();
    Entry<Key, Object> e;
    Object v;
    Array arr;
    int rows = qry.getRecordcount();
    while(it.hasNext()){
      e = it.next();
      if(qry.getColumn(e.getKey(),null)!=null) {
        v=e.getValue();
View Full Code Here

   
    Query qp = Caster.toQuery(query,null);
    if(qp!=null) qp.rename(src, trg);
    else {
      QueryColumn qc = query.removeColumn(src);
      Array content=new ArrayImpl();
      int len=qc.size();
      for(int i=1;i<=len;i++){
        content.setE(i, qc.get(i,null));
      }
      query.addColumn(trg, content, qc.getType());
    }
    return null;
  }
View Full Code Here

  public static Array call(PageContext pc, Query query, String columnName) throws PageException {
    return call(pc, query, columnName, null);
  }
  public static Array call(PageContext pc, Query query, String columnName,  UDF udf) throws PageException {
    Array arr=new ArrayImpl();
    QueryColumn column = query.getColumn(KeyImpl.init(columnName));
      Iterator<Object> it = column.valueIterator();
      Object value;
    while(it.hasNext()) {
      value=it.next();
      if(!NullSupportHelper.full() && value==null) value="";
      if(udf!=null)arr.append(udf.call(pc, new Object[]{value}, true));
      else arr.append(value);
    }
    return arr;   
  }
View Full Code Here

TOP

Related Classes of railo.runtime.type.Array

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.