Package railo.runtime.type

Examples of railo.runtime.type.Query


  // FUTURE
  public Object getIndexesAsQuery() {
    Iterator<Entry<String, SearchIndex>> it = indexes.entrySet().iterator();
   
    final String v="VARCHAR";
        Query query=null;
        String[] cols = new String[]{
            "categories","categoryTree","custom1","custom2","custom3","custom4","extensions",
            "key","language","query","title","urlpath","type"};
        String[] types = new String[]{
            v,v,v,v,v,v,v,
            v,v,v,v,v,v};
        try {
            query=new QueryImpl(cols,types, 0,"query");
        } catch (DatabaseException e) {
            query=new QueryImpl(cols, 0,"query");
        }
       
        Entry<String, SearchIndex> entry;
        SearchIndex index;
        int row=0;
    while(it.hasNext()) {
      query.addRow();
      row++;
          entry = it.next();
          index=entry.getValue();
          if(index==null)continue;
          try {
           
                query.setAt("categories",row,ListUtil.arrayToList(index.getCategories(),""));
                query.setAt("categoryTree",row,index.getCategoryTree());
               
                query.setAt(KeyConstants._custom1,row,index.getCustom1());
                query.setAt(KeyConstants._custom2,row,index.getCustom2());
                query.setAt(KeyConstants._custom3,row,index.getCustom3());
                query.setAt(KeyConstants._custom4,row,index.getCustom4());
               
                query.setAt(KeyConstants._extensions,row,ListUtil.arrayToList(index.getExtensions(),","));
                query.setAt(KeyConstants._key,row,index.getKey());
                query.setAt(KeyConstants._language,row,index.getLanguage());
                query.setAt(KeyConstants._query,row,index.getQuery());
                query.setAt(KeyConstants._title,row,index.getTitle());
                query.setAt("urlpath",row,index.getUrlpath());
                query.setAt(KeyConstants._type,row,SearchIndex.toStringTypeEL(index.getType()));
               
          }
        catch(PageException pe) {}
      }
    return query;
View Full Code Here


  }
   
    private void doGetLogSetting() throws PageException {
      String name=getString("admin", "GetLogSetting", "name");
      name=name.trim().toLowerCase();
      Query qry=_doGetLogSettings();
       
      int records = qry.getRecordcount();
      for(int row=1;row<=records;row++){
        String n = Caster.toString(qry.getAt("name", row, null),null);
        if(!StringUtil.isEmpty(n) && n.trim().equalsIgnoreCase(name)) {
          Struct sct=new StructImpl();
          String returnVariable=getString("admin",action,"returnVariable");
          pageContext.setVariable(returnVariable,sct);

          sct.setEL(KeyConstants._name, qry.getAt(KeyConstants._name, row, ""));
          sct.setEL(KeyConstants._level, qry.getAt(KeyConstants._level, row, ""));
          sct.setEL("virtualpath", qry.getAt("virtualpath", row, ""));
          sct.setEL(KeyConstants._class, qry.getAt(KeyConstants._class, row, ""));
          sct.setEL("maxFile", qry.getAt("maxFile", row, ""));
          sct.setEL("maxFileSize", qry.getAt("maxFileSize", row, ""));
          sct.setEL(KeyConstants._path, qry.getAt(KeyConstants._path, row, ""));
         
          return;
        }
      }
      throw new ApplicationException("invalig log name ["+name+"]");
View Full Code Here

      String returnVariable=getString("admin",action,"returnVariable");
    pageContext.setVariable(returnVariable,_doGetLogSettings());
    }
   
    private Query _doGetLogSettings() throws  PageException {
      Query qry=new QueryImpl(
        new String[]{"name","level","path","virtualpath","class","maxFile","maxFileSize"},
        new String[]{"varchar","varchar","varchar","varchar","varchar","varchar","varchar"},
        0,railo.runtime.type.util.ListUtil.last("logs", '.'));
        int row=0;
       
View Full Code Here

      if(startrow <1) startrow=1;
      int maxrow = getInt("maxrow",-1);
      String result=getString("result", null);
      SpoolerEngineImpl engine = (SpoolerEngineImpl) config.getSpoolerEngine();
     
      Query qry = engine.getAllTasksAsQuery(startrow,maxrow);
      pageContext.setVariable(getString("admin",action,"returnVariable"),qry);
    if(!StringUtil.isEmpty(result)){
      Struct sct=new StructImpl();
      pageContext.setVariable(result,sct);
      sct.setEL("open", engine.getOpenTaskCount());
View Full Code Here

      throw Caster.toPageException(e);
    }
      X509Certificate[] certs = installer.getCertificates();
      X509Certificate cert;
     
      Query qry=new QueryImpl(new String[]{"subject","issuer"},certs.length,"certificates");
      for(int i=0;i<certs.length;i++){
        cert=certs[i];
        qry.setAtEL("subject",i+1, cert.getSubjectDN().getName());
        qry.setAtEL("issuer",i+1, cert.getIssuerDN().getName());
      }
      return qry;
    }
View Full Code Here

      }
      return obj;
    }
   
    private static QueryBean toQueryBean(TypeMapping tm,Object value, Class targetClass, Set<Object> done) throws PageException {
      Query query = Caster.toQuery(value);
    int recordcount=query.getRecordcount();
        String[] columnList = query.getColumns();
        QueryColumn[] columns=new QueryColumn[columnList.length];
        Object[][] data = new Object[recordcount][columnList.length];
       
        for(int i=0;i<columnList.length;i++) {
          columns[i]=query.getColumn(columnList[i]);
        }
       
        int row;
        for(row=1;row<=recordcount;row++) {
            for(int i=0;i<columns.length;i++) {
View Full Code Here

        if(isQueryBean(value)) {
          QueryBean qb = (QueryBean) value;
            String[] strColumns = qb.getColumnList();
            Object[][] data = qb.getData();
            int recorcount=data.length;
            Query qry=new QueryImpl(strColumns,recorcount,"QueryBean");
            QueryColumn[] columns=new QueryColumn[strColumns.length];
            for(int i=0;i<columns.length;i++) {
              columns[i]=qry.getColumn(strColumns[i]);
            }
           
            int row;
            for(row=1;row<=recorcount;row++) {
              for(int i=0;i<columns.length;i++) {
                columns[i].set(row,toRailoType(pc,data[row-1][i]));
                }
            }
            return qry;
        }
        if(Decision.isQuery(value)) {
            Query q = Caster.toQuery(value);
            int recorcount=q.getRecordcount();
            String[] strColumns = q.getColumns();
           
            QueryColumn col;
            int row;
            for(int i=0;i<strColumns.length;i++) {
                col=q.getColumn(strColumns[i]);
                for(row=1;row<=recorcount;row++) {
                    col.set(row,toRailoType(pc,col.get(row,null)));
                }
            }
            return q;
View Full Code Here

    }
   
   
    DumpRow[] drs = dt.getRows();
    DumpRow dr;
    Query qry=null;
    DumpData[] items;
    for(int r=0;r<drs.length;r++){
      dr=drs[r];
      items = dr.getItems();
      if(qry==null)qry=new QueryImpl(toColumns(items),drs.length,"data");
      for(int c=1;c<=items.length;c++){
        qry.setAtEL("data"+c, r+1, toCFML(items[c-1],object,hasReference));
      }
      qry.setAtEL("highlight", r+1, new Double(dr.getHighlightType()));
     
    }
    if(qry!=null)sct.setEL(KeyConstants._data, qry);
    return sct;
  }
View Full Code Here

     * @return all messages from inbox
     * @throws MessagingException
     * @throws IOException
     */
    public Query getMails(String[] messageNumbers, String[] uids, boolean all) throws MessagingException, IOException {
    Query qry = new QueryImpl(all ? _fldnew : _flddo, 0, "query");
    Folder folder = _fldelse.getFolder("INBOX");
    folder.open(Folder.READ_ONLY);
    try {
      getMessages(qry,folder, uids, messageNumbers, startrow, maxrows,all);
    }
View Full Code Here

        if(!ArrayUtil.isEmpty(locks))
          strLocks=" open locks at this time ("+List.arrayToList(locks, ", ")+").";
    */
   
    // Requests
    Query req=new QueryImpl(new Collection.Key[]{KeyConstants._web,KeyConstants._uri,START_TIME,KeyConstants._timeout}, 0, "requests");
    sct.setEL(KeyConstants._requests, req);
   
    // Template Cache
    Query tc=new QueryImpl(new Collection.Key[]{KeyConstants._web,ELEMENTS,KeyConstants._size}, 0, "templateCache");
    sct.setEL(KeyImpl.init("templateCache"), tc);
   
    // Scopes
    Struct scopes=new StructImpl();
    sct.setEL(KeyConstants._scopes, scopes);
    Query app=new QueryImpl(new Collection.Key[]{KeyConstants._web,KeyConstants._application,ELEMENTS,KeyConstants._size}, 0, "templateCache");
    scopes.setEL(KeyConstants._application, app);
    Query sess=new QueryImpl(new Collection.Key[]{KeyConstants._web,KeyConstants._application,USERS,ELEMENTS,KeyConstants._size}, 0, "templateCache");
    scopes.setEL(KeyConstants._session, sess);

    // Query
    Query qry=new QueryImpl(new Collection.Key[]{KeyConstants._web,KeyConstants._application,START_TIME,KeyConstants._sql}, 0, "requests");
    sct.setEL(QUERIES, qry);
   
    // Locks
    Query lck=new QueryImpl(new Collection.Key[]{KeyConstants._web,KeyConstants._application,KeyConstants._name,START_TIME,KeyConstants._timeout,KeyConstants._type}, 0, "requests");
    sct.setEL(LOCKS, lck);

    // Loop webs
    ConfigWebImpl web;
    Struct pcs;
    PageContextImpl _pc;
    int row,openConnections=0;
    CFMLFactoryImpl factory;
    ActiveQuery[] queries;
    ActiveQuery aq;
    ActiveLock[] locks;
    ActiveLock al;
    for(int i=0;i<webs.length;i++){
     
      // Loop requests
      web=(ConfigWebImpl) webs[i];
      factory=(CFMLFactoryImpl)web.getFactory();
      pcs = factory.getRunningPageContexts();
      Iterator<Object> it = pcs.valueIterator();
      while(it.hasNext()){
        _pc = (PageContextImpl) it.next();
        if(_pc.isGatewayContext()) continue;
       
        // Request
        row = req.addRow();
        req.setAt(KeyConstants._web, row, web.getLabel());
        req.setAt(KeyConstants._uri, row, getPath(_pc.getHttpServletRequest()));
        req.setAt(START_TIME, row, new DateTimeImpl(pc.getStartTime(),false));
        req.setAt(KeyConstants._timeout, row, new Double(pc.getRequestTimeout()));
       
        // Query
        queries = _pc.getActiveQueries();
        if(queries!=null) {
          for(int y=0;y<queries.length;y++){
            aq=queries[y];
            row = qry.addRow();
            qry.setAt(KeyConstants._web, row, web.getLabel());
            qry.setAt(KeyConstants._application, row, _pc.getApplicationContext().getName());
            qry.setAt(START_TIME, row, new DateTimeImpl(web,aq.startTime,true));
            qry.setAt(KeyConstants._sql, row, aq.sql);
          }
        }
       
        // Lock
        locks = _pc.getActiveLocks();
        if(locks!=null) {
          for(int y=0;y<locks.length;y++){
            al=locks[y];
            row = lck.addRow();
            lck.setAt(KeyConstants._web, row, web.getLabel());
            lck.setAt(KeyConstants._application, row, _pc.getApplicationContext().getName());
            lck.setAt(KeyConstants._name, row, al.name);
            lck.setAt(START_TIME, row, new DateTimeImpl(web,al.startTime,true));
            lck.setAt(KeyConstants._timeout, row, Caster.toDouble(al.timeoutInMillis/1000));
            lck.setAt(KeyConstants._type, row, al.type==LockManager.TYPE_EXCLUSIVE?"exclusive":"readonly");
          }
        }
      }
      openConnections+=web.getDatasourceConnectionPool().openConnections();

View Full Code Here

TOP

Related Classes of railo.runtime.type.Query

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.