/** * Clones this expression. * * @since 1.1 */ public Expression deepCopy() { return transform(null); }
/** * Clones this expression. * * @since 1.1 */ public Expression deepCopy() { return transform(null); }
return transform(transformer);
/** * Creates and returns a new Expression instance based on this expression, * but with named parameters substituted with provided values. Any * subexpressions containing parameters not matching the "name" argument * will be pruned. * <p> * Note that if you want matching against nulls to be preserved, you must * place NULL values for the corresponding keys in the map. * * @since 4.0 */ public Expression params(Map<String, ?> parameters) { return transform(new NamedParamTransformer(parameters, true)); }
/** * Transforms Expression rooted in this entity to an analogous expression * rooted in related entity. * * @since 1.1 */ @Override public Expression translateToRelatedEntity(Expression expression, String relationshipPath) { if (expression == null) { return null; } if (relationshipPath == null) { return expression; } return expression.transform(new RelationshipPathConverter(relationshipPath)); }
/** * Creates and returns a new Expression instance based on this expression, * but with named parameters substituted with provided values.If any * subexpressions containing parameters not matching the "name" argument are * found, the behavior depends on "pruneMissing" argument. If it is false an * Exception will be thrown, otherwise subexpressions with missing * parameters will be pruned from the resulting expression. * <p> * Note that if you want matching against nulls to be preserved, you must * place NULL values for the corresponding keys in the map. * * @since 4.0 */ public Expression params(Map<String, ?> parameters, boolean pruneMissing) { return transform(new NamedParamTransformer(parameters, pruneMissing)); }
/** * Transforms Expression rooted in this entity to an analogous expression rooted in * related entity. * * @since 1.1 */ public Expression translateToRelatedEntity( Expression expression, String relationshipPath) { if (expression == null) { return null; } if (relationshipPath == null) { return expression; } return expression.transform(new RelationshipPathConverter(relationshipPath)); }
@Override protected void doAppendPart(Expression rootNode) { if (rootNode == null) { return; } rootNode = rootNode.transform(new INTrimmer()); rootNode.traverse(this); }
@Override protected void doAppendPart(Expression rootNode) { if (rootNode == null) { return; } // IN statements with more than 1500 values are denied in Firebird // so we need to split one big statement on few smaller ones rootNode = rootNode.transform(new OracleQualifierTranslator.INTrimmer()); rootNode.traverse(this); }
/** * Transforms an Expression to an analogous expression in terms of the * underlying DbEntity. * * @since 1.1 */ public Expression translateToDbPath(Expression expression) { if (expression == null) { return null; } if (getDbEntity() == null) { throw new CayenneRuntimeException("Can't translate expression to DB_PATH, no DbEntity for '%s'.", getName()); } // converts all OBJ_PATH expressions to DB_PATH expressions // and pass control to the DB entity return expression.transform(new DBPathConverter()); }
/** * Overrides super to support translation of EO attributes that have no ObjAttributes. * * @since 1.2 */ @Override public Expression translateToDbPath(Expression expression) { if (expression == null) { return null; } if (getDbEntity() == null) { throw new CayenneRuntimeException( "Can't translate expression to DB_PATH, no DbEntity for '" + getName() + "'."); } // converts all OBJ_PATH expressions to DB_PATH expressions // and pass control to the DB entity return expression.transform(new DBPathConverter()); }
/** * Overrides super to support translation of EO attributes that have no ObjAttributes. * * @since 1.2 */ public Expression translateToDbPath(Expression expression) { if (expression == null) { return null; } if (getDbEntity() == null) { throw new CayenneRuntimeException( "Can't translate expression to DB_PATH, no DbEntity for '" + getName() + "'."); } // converts all OBJ_PATH expressions to DB_PATH expressions // and pass control to the DB entity return expression.transform(new DBPathConverter()); }
/** * Transforms an Expression to an analogous expression in terms of the underlying * DbEntity. * * @since 1.1 */ public Expression translateToDbPath(Expression expression) { if (expression == null) { return null; } if (getDbEntity() == null) { throw new CayenneRuntimeException( "Can't translate expression to DB_PATH, no DbEntity for '" + getName() + "'."); } // converts all OBJ_PATH expressions to DB_PATH expressions // and pass control to the DB entity return expression.transform(new DBPathConverter()); }
dbQualifier = dbQualifier.transform(new JoinedDbEntityQualifierTransformer(node));
/** * Transforms an Expression rooted in this entity to an analogous expression * rooted in related entity. * * @since 1.1 */ @Override public Expression translateToRelatedEntity(Expression expression, String relationshipPath) { if (expression == null) { return null; } if (relationshipPath == null) { return expression; } if (getDbEntity() == null) { throw new CayenneRuntimeException("Can't transform expression, no DbEntity for '%s'.", getName()); } // converts all OBJ_PATH expressions to DB_PATH expressions // and pass control to the DB entity DBPathConverter transformer = new DBPathConverter(); String dbPath = transformer.toDbPath(createPathIterator(relationshipPath)); Expression dbClone = expression.transform(transformer); return getDbEntity().translateToRelatedEntity(dbClone, dbPath); }
/** * Transforms an Expression rooted in this entity to an analogous expression rooted in * related entity. * * @since 1.1 */ public Expression translateToRelatedEntity( Expression expression, String relationshipPath) { if (expression == null) { return null; } if (relationshipPath == null) { return expression; } if (getDbEntity() == null) { throw new CayenneRuntimeException( "Can't transform expression, no DbEntity for '" + getName() + "'."); } // converts all OBJ_PATH expressions to DB_PATH expressions // and pass control to the DB entity DBPathConverter transformer = new DBPathConverter(); String dbPath = transformer.toDbPath(resolvePathComponents(relationshipPath)); Expression dbClone = expression.transform(transformer); return getDbEntity().translateToRelatedEntity(dbClone, dbPath); }
protected Expression extractQualifier() { // if additional qualifier is set, use it if(this.qualifier != null) { return this.qualifier; } Query q = queryAssembler.getQuery(); Expression qualifier = ((SelectQuery<?>) q).getQualifier(); // append Entity qualifiers, taking inheritance into account ObjEntity entity = getObjEntity(); if (entity != null) { ClassDescriptor descriptor = queryAssembler.getEntityResolver().getClassDescriptor(entity.getName()); Expression entityQualifier = descriptor.getEntityInheritanceTree().qualifierForEntityAndSubclasses(); if (entityQualifier != null) { qualifier = (qualifier != null) ? qualifier.andExp(entityQualifier) : entityQualifier; } } // Attaching root Db entity's qualifier if (getDbEntity() != null) { Expression dbQualifier = getDbEntity().getQualifier(); if (dbQualifier != null) { dbQualifier = dbQualifier.transform(new DbEntityQualifierTransformer()); qualifier = qualifier == null ? dbQualifier : qualifier.andExp(dbQualifier); } } return qualifier; }