Package railo.runtime.type

Examples of railo.runtime.type.QueryImpl


              }
              else {
                k=KeyConstants._id;
                    Key[] cols = new Key[]{k};
                    String[] types = new String[]{"VARCHAR"};
                qv=new QueryImpl(cols,types, 1,"query");
                qv.setAtEL(k, 1, key);
              }
           
           
           
View Full Code Here


            "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;
View Full Code Here

    private Query toCFMLObject(ASRecordSet rs) throws PageException {
        String[] columns = rs.getColumnNames();
        List rows = rs.rows();
        int len=0;
        if(rows.size()>0) len=((List)rows.get(0)).size();
        Query qry=new QueryImpl(columns,len,"query");
       
        List row;
        for(int iCol=0;iCol<columns.length;iCol++) {
            row=(List) rows.get(iCol);
            QueryColumn column = qry.getColumn(columns[iCol]);
           
            for(int iRow=0;iRow<row.size();iRow++) {
                column.set(iRow+1,toCFMLObject(row.get(iRow)));
            }
        }
View Full Code Here

       

        InitialLdapContext context = new InitialLdapContext(env, null);
       
        // Search
        Query qry=new QueryImpl(attributes,0,"query");
        try {
            NamingEnumeration results = context.search(start, filter, controls);
           
            // Fill result
            int row=1;
            if(!attEQAsterix) {
                while(results.hasMoreElements()) {
                    SearchResult resultRow = (SearchResult)results.next();
                    if(row++<startrow)continue;
                   
                    int len=qry.addRow();
                    NamingEnumeration rowEnum = resultRow.getAttributes().getAll();
                    String dn = resultRow.getNameInNamespace();
                    qry.setAtEL("dn",len,dn);
                    while(rowEnum.hasMore()) {
                        Attribute attr = (Attribute)rowEnum.next();
                        Collection.Key key = KeyImpl.init(attr.getID());
                        Enumeration values = attr.getAll();
                        Object value;
                        String existing,strValue;
                        while(values.hasMoreElements()) {
                            value = values.nextElement();
                            strValue=Caster.toString(value,null);
                            existing=Caster.toString(qry.getAt(key, len,null),null);
                            if(!StringUtil.isEmpty(existing) && !StringUtil.isEmpty(strValue)) {
                              value = existing + separator + strValue;
                           }
                            else if(!StringUtil.isEmpty(existing))
                              value = existing;
                           
                           qry.setAtEL(key,len,value);
                        }           
                    }
                    if(maxrows>0 && len>=maxrows)break;
                }
            }
            else {
               
                outer:while(results.hasMoreElements()) {
                    SearchResult resultRow = (SearchResult)results.next();
                    if(row++<startrow)continue;
                   
                    Attributes attributesRow = resultRow.getAttributes();
                    NamingEnumeration rowEnum = attributesRow.getIDs();
                    while(rowEnum.hasMoreElements()) {
                        int len=qry.addRow();
                        String name = Caster.toString(rowEnum.next());
                        Object value=null;
                       
                        try {
                            value=attributesRow.get(name).get();
                        }catch(Exception e) {}
                       
                        qry.setAtEL("name",len,name);
                        qry.setAtEL("value",len,value);
                        if(maxrows>0 && len>=maxrows)break outer;
                    }
                    qry.setAtEL("name",qry.size(),"dn");
                }
            }
        }
        finally {
            context.close();
        }
        // Sort
        if(sort!=null && sort.length>0) {
            int order = sortDirection==SORT_DIRECTION_ASC ? Query.ORDER_ASC : Query.ORDER_DESC;
            for(int i=sort.length-1;i>=0;i--) {
                String item=sort[i];
                if(item.indexOf(' ')!=-1)item=ListUtil.first(item," ",true);
                qry.sort(KeyImpl.getInstance(item),order);
                //keys[i] = new SortKey(item);
            }
        }   
        return qry;
    }
View Full Code Here

    required("name",name);
   
   
   
   
    railo.runtime.type.Query query=new QueryImpl(
                new String[]{"name","size","type","dateLastModified","directory","crc","compressedSize","comment"},
                0,"query");
    pageContext.setVariable(name, query);
       
    ZipFile zip = getZip(file);
    Enumeration entries = zip.entries();
   
        try {
          String path,name,dir;
            ZipEntry ze;
            int row=0,index;
            while(entries.hasMoreElements()) {
              ze = (ZipEntry)entries.nextElement();
              if(!showDirectory && ze.isDirectory()) continue;
             
                path = ze.getName().replace('\\', '/');
              index=path.lastIndexOf('/');
              if(!recurse && index>0) continue;
             
              dir=index==-1?"":path.substring(0,index);
              name=path.substring(index+1);
                           
              if(filter!=null && !filter.accept(null, name)) continue;
             
             
              if(!entryPathMatch(dir)) continue;
              //if(entryPath!=null && !(dir.equalsIgnoreCase(entryPath) || StringUtil.startsWithIgnoreCase(dir,entryPath+"/"))) ;///continue;
             
              row++;
              query.addRow();
              query.setAt("name", row, path);
              query.setAt("size", row, Caster.toDouble(ze.getSize()));
              query.setAt("type", row, ze.isDirectory()?"Directory":"File");
              query.setAt("dateLastModified", row, new DateTimeImpl(pageContext,ze.getTime(),false));
              query.setAt("crc", row, Caster.toDouble(ze.getCrc()));
              query.setAt("compressedSize", row, Caster.toDouble(ze.getCompressedSize()));
              query.setAt("comment", row, ze.getComment());
              query.setAt("directory", row, dir);
              //zis.closeEntry();
               
            }
        }
        finally {
View Full Code Here

TOP

Related Classes of railo.runtime.type.QueryImpl

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.