Examples of QueryImpl


Examples of org.xorm.query.QueryImpl

            //logger.fine("Class Mapping Table: " + classMapping.getTable().getName());
            Class filterTargetClass = classMapping.getMappedClass();
            //logger.fine("Filter Target Class: " + filterTargetClass.getName());
           
            QueryImpl query = new QueryImpl(mgr);
            query.setClass(filterTargetClass);
            query.setFilter(mapping.getFilter());

            // We support the implicit "owner" parameter in filters.
            // The owner refers to the object instance off which the
            // collection field getter is being called.  We need to add
            // it to the parameters that we set on the query.
            String parameters = mapping.getParameters();
            ClassMapping ownerClassMapping = owner.getClassMapping();
            Class ownerClass = ownerClassMapping.getMappedClass();
            String ownerClassName = ownerClass.getName();
            //ownerClassName = ownerClassName.substring(ownerClassName.lastIndexOf('.') + 1);
            //logger.fine("OwnerClassName: " + ownerClassName);

            if (mapping.getImports() != null) {
                query.declareImports(mapping.getImports());
            }
            if (parameters == null || parameters.equals("")) {
                // No parameters, just this owner param
                parameters = ownerClassName + " owner";
            }
            else {
                // Append this owner param to the existing parameters
                parameters += ", " + ownerClassName + " owner";
            }
            logger.fine("Modified Parameters: " + parameters);
            query.declareParameters(parameters);

            if (mapping.getVariables() != null) {
                query.declareVariables(mapping.getVariables());
            }

            if (mapping.getOrdering() != null) {
                query.setOrdering(mapping.getOrdering());
            }

            query.compile();
            //logger.fine("Filter Query: " + query);

            BoundExpression bound = query.getBoundExpression();
            int paramCount = 0;
            if (args != null) {
                while (paramCount < args.length) {
                    bound.bindParameter(paramCount, args[paramCount]);
                    ++paramCount;
View Full Code Here

Examples of org.xorm.query.QueryImpl

    }

    /** Returns a query built using JDOQL. */
    public Query newQuery(Class clazz, String filter) {
        assertNotClosed();
        Query q = new QueryImpl(this);
        q.setClass(clazz);
        q.setFilter(filter);
        return q;
    }
View Full Code Here

Examples of org.xorm.query.QueryImpl

     * Returns a query for the specified class.  Without user
     * modification, when executed, returns all instances of the class.
     */
    public Query newQuery(Class clazz) {
        assertNotClosed();
        QueryImpl query = new QueryImpl(this);
        query.setClass(clazz);
        return query;
    }
View Full Code Here

Examples of org.xorm.query.QueryImpl

     * modification, when executed, returns all instances of the class.
     * Note that XORM does not support subclasses at this time.
     */
    public Query newQuery(Extent extent) {
        assertNotClosed();
        QueryImpl query = new QueryImpl(this);
        query.setClass(extent.getCandidateClass());
        return query;
    }
View Full Code Here

Examples of org.xorm.query.QueryImpl

     * that match the query filter (JDOQL expression).  Note that XORM
     * does not support subclasses at this time. 
     */
    public Query newQuery(Extent extent, String filter) {
        assertNotClosed();
        QueryImpl query = new QueryImpl(this);
        query.setClass(extent.getCandidateClass());
        query.setFilter(filter);
        return query;
    }
View Full Code Here

Examples of org.xorm.query.QueryImpl

     * Creates a new query that the user must set values on
     * using the Query interface.
     */
    public Query newQuery() {
        assertNotClosed();
        return new QueryImpl(this);
    }
View Full Code Here

Examples of org.xorm.query.QueryImpl

    /** Constructs a query by copying data from a previous query. */
    public Query newQuery(Object compiled) {
        assertNotClosed();
        if (compiled instanceof QueryImpl) {
            return new QueryImpl(this, (QueryImpl) compiled);
        }
        throw new UnsupportedOperationException();
    }
View Full Code Here

Examples of org.xorm.query.QueryImpl

     * QueryLanguage.LANGUAGE.
     */
    public Query newQuery(String language, Object query) {
        assertNotClosed();
        if (QueryLanguage.LANGUAGE.equals(language)) {
            return new QueryImpl(this, (QueryLanguage) query);
        } else if (JDOQL_LANGUAGE.equals(language)) {
            return newQuery((Class) null, (String) query);
        } else if (CodeQuery.LANGUAGE.equals(language)) {
            // First try to get Expression directly.
            try {
                return new QueryImpl(this, new CodeParser((Class) query));
            } catch (Throwable e) {
                // Code could not be turned into JDOQL.
                return new CodeQuery(this, (Class) query);
            }
        }
View Full Code Here

Examples of railo.runtime.type.QueryImpl

  public static Query getMemoryUsageAsQuery(int type) throws DatabaseException {
   
   
    java.util.List<MemoryPoolMXBean> manager = ManagementFactory.getMemoryPoolMXBeans();
    Iterator<MemoryPoolMXBean> it = manager.iterator();
    Query qry=new QueryImpl(new Collection.Key[]{
        KeyConstants._name,
        KeyConstants._type,
        KeyConstants._used,
        KeyConstants._max,
        KeyConstants._init
    },0,"memory");
   
    int row=0;
    MemoryPoolMXBean bean;
    MemoryUsage usage;
    MemoryType _type;
    while(it.hasNext()){
      bean = it.next();
      usage = bean.getUsage();
      _type = bean.getType();
      if(type==MEMORY_TYPE_HEAP && _type!=MemoryType.HEAP)continue;
      if(type==MEMORY_TYPE_NON_HEAP && _type!=MemoryType.NON_HEAP)continue;
       
      row++;
      qry.addRow();
      qry.setAtEL(KeyConstants._name, row, bean.getName());
      qry.setAtEL(KeyConstants._type, row, _type.name());
      qry.setAtEL(KeyConstants._max, row, Caster.toDouble(usage.getMax()));
      qry.setAtEL(KeyConstants._used, row, Caster.toDouble(usage.getUsed()));
      qry.setAtEL(KeyConstants._init, row, Caster.toDouble(usage.getInit()));
     
    }
    return qry;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.