public void checkCondition(final ModelEntity modelEntity) throws GenericModelException { condition.checkCondition(modelEntity); } }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); for (EntityCondition condition : conditionList) { condition.checkCondition(modelEntity); } }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); Iterator exprIter = conditionList.iterator(); while (exprIter.hasNext()) { EntityCondition entityCondition = (EntityCondition) exprIter.next(); entityCondition.checkCondition(modelEntity); } }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); Iterator exprIter = conditionList.iterator(); while (exprIter.hasNext()) { EntityCondition entityCondition = (EntityCondition) exprIter.next(); entityCondition.checkCondition(modelEntity); } }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); if (lhs instanceof String) { if (modelEntity.getField((String) lhs) == null) { throw new GenericModelException("Field with name " + lhs + " not found in the " + modelEntity.getEntityName() + " Entity"); } } else if (lhs instanceof EntityCondition) { ((EntityCondition) lhs).checkCondition(modelEntity); ((EntityCondition) rhs).checkCondition(modelEntity); } }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); if (lhs instanceof String) { if (modelEntity.getField((String) lhs) == null) { throw new GenericModelException("Field with name " + lhs + " not found in the " + modelEntity.getEntityName() + " Entity"); } } else if (lhs instanceof EntityCondition) { ((EntityCondition) lhs).checkCondition(modelEntity); ((EntityCondition) rhs).checkCondition(modelEntity); } }
public void checkCondition(ModelEntity modelEntity) throws GenericModelException { // if (Debug.verboseOn()) Debug.logVerbose("checkCondition for entity " + modelEntity.getEntityName()); if (lhs instanceof String) { if (modelEntity.getField((String) lhs) == null) { throw new GenericModelException("Field with name " + lhs + " not found in the " + modelEntity.getEntityName() + " Entity"); } } else if (lhs instanceof EntityCondition) { ((EntityCondition) lhs).checkCondition(modelEntity); ((EntityCondition) rhs).checkCondition(modelEntity); } }
final ModelEntity modelEntity = getModelReader().getModelEntity(entityName); if (whereEntityCondition != null) { whereEntityCondition.checkCondition(modelEntity); havingEntityCondition.checkCondition(modelEntity);
/** * Returns the count of the results that match any of the specified expressions (ie: combined using OR). * * @param entityName The Name of the Entity as defined in the entity model XML file * @param fieldName The field of the named entity to count, if null this is equivalent to count(*) * @param entityCondition The EntityCondition object that specifies how to * constrain this query The expressions to use for the lookup, each * consisting of at least a field name, an EntityOperator, and a value to * compare to * @param findOptions An instance of EntityFindOptions that specifies * advanced query options. The only option that is used is distinct, in * which case a select (distinct fieldname) is issued.<p>If you issue a * distinct without a fieldName, it will be ignored as <code>select count * (distinct *)</code> makes no sense * @return the number of rows that match the query */ public int countByCondition(final String entityName, final String fieldName, final EntityCondition entityCondition, final EntityFindOptions findOptions) throws GenericEntityException { checkIfLocked(); ModelEntity modelEntity = getModelReader().getModelEntity(entityName); if (entityCondition != null) { entityCondition.checkCondition(modelEntity); } GenericHelper helper = getEntityHelper(entityName); return helper.count(modelEntity, fieldName, entityCondition, findOptions); }
/** Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details. *@param modelEntity The ModelEntity of the Entity as defined in the entity XML file *@param whereEntityCondition The EntityCondition object that specifies how to constrain this query before any groupings are done (if this is a view entity with group-by aliases) *@param havingEntityCondition The EntityCondition object that specifies how to constrain this query after any groupings are done (if this is a view entity with group-by aliases) *@param fieldsToSelect The fields of the named entity to get from the database; if empty or null all fields will be retreived *@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending *@param findOptions An instance of EntityFindOptions that specifies advanced query options. See the EntityFindOptions JavaDoc for more details. *@return EntityListIterator representing the result of the query: NOTE THAT THIS MUST BE CLOSED WHEN YOU ARE * DONE WITH IT, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION. */ public EntityListIterator findListIteratorByCondition(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection fieldsToSelect, List orderBy, EntityFindOptions findOptions) throws GenericEntityException { ModelEntity modelEntity = getModelReader().getModelEntity(entityName); GenericValue dummyValue = new GenericValue(modelEntity); Map ecaEventMap = this.getEcaEntityEventMap(entityName); this.evalEcaRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); if (whereEntityCondition != null) whereEntityCondition.checkCondition(modelEntity); if (havingEntityCondition != null) havingEntityCondition.checkCondition(modelEntity); this.evalEcaRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); GenericHelper helper = getEntityHelper(entityName); EntityListIterator eli = helper.findListIteratorByCondition(modelEntity, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderBy, findOptions); eli.setDelegator(this); this.evalEcaRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); return eli; }
/** Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details. *@param modelEntity The ModelEntity of the Entity as defined in the entity XML file *@param whereEntityCondition The EntityCondition object that specifies how to constrain this query before any groupings are done (if this is a view entity with group-by aliases) *@param havingEntityCondition The EntityCondition object that specifies how to constrain this query after any groupings are done (if this is a view entity with group-by aliases) *@param fieldsToSelect The fields of the named entity to get from the database; if empty or null all fields will be retreived *@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending *@param findOptions An instance of EntityFindOptions that specifies advanced query options. See the EntityFindOptions JavaDoc for more details. *@return EntityListIterator representing the result of the query: NOTE THAT THIS MUST BE CLOSED WHEN YOU ARE * DONE WITH IT, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION. */ public EntityListIterator findListIteratorByCondition(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection fieldsToSelect, List orderBy, EntityFindOptions findOptions) throws GenericEntityException { ModelEntity modelEntity = getModelReader().getModelEntity(entityName); GenericValue dummyValue = new GenericValue(modelEntity); Map ecaEventMap = this.getEcaEntityEventMap(entityName); this.evalEcaRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); if (whereEntityCondition != null) whereEntityCondition.checkCondition(modelEntity); if (havingEntityCondition != null) havingEntityCondition.checkCondition(modelEntity); this.evalEcaRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); GenericHelper helper = getEntityHelper(entityName); EntityListIterator eli = helper.findListIteratorByCondition(modelEntity, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderBy, findOptions); eli.setDelegator(this); this.evalEcaRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); return eli; }
/** * Finds any GenericValues matching the given conditions. * * @param entityName The Name of the Entity as defined in the entity model XML file * @param entityCondition The EntityCondition object that specifies how to constrain this query * @param fieldsToSelect The fields of the named entity to get from the * database; if empty or null all fields will be retreived * @param orderBy The fields of the named entity by which to order the * query; optionally add " ASC" for ascending or " DESC" for descending * @return any matching values */ public List<GenericValue> findByCondition(final String entityName, final EntityCondition entityCondition, final Collection<String> fieldsToSelect, final List<String> orderBy) throws GenericEntityException { checkIfLocked(); final ModelEntity modelEntity = getModelReader().getModelEntity(entityName); if (entityCondition != null) { entityCondition.checkCondition(modelEntity); } final GenericHelper helper = getEntityHelper(entityName); final List<GenericValue> list = helper.findByCondition(modelEntity, entityCondition, fieldsToSelect, orderBy); absorbList(list); return list; }
/** Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details. *@param entityName The Name of the Entity as defined in the entity model XML file *@param entityCondition The EntityCondition object that specifies how to constrain this query *@param fieldsToSelect The fields of the named entity to get from the database; if empty or null all fields will be retreived *@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending *@return List of GenericValue objects representing the result */ public List findByCondition(String entityName, EntityCondition entityCondition, Collection fieldsToSelect, List orderBy) throws GenericEntityException { ModelEntity modelEntity = getModelReader().getModelEntity(entityName); GenericValue dummyValue = new GenericValue(modelEntity); Map ecaEventMap = this.getEcaEntityEventMap(entityName); this.evalEcaRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); if (entityCondition != null) entityCondition.checkCondition(modelEntity); this.evalEcaRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); GenericHelper helper = getEntityHelper(entityName); List list = null; list = helper.findByCondition(modelEntity, entityCondition, fieldsToSelect, orderBy); this.evalEcaRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); absorbList(list); return list; }
/** Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details. *@param entityName The Name of the Entity as defined in the entity model XML file *@param entityCondition The EntityCondition object that specifies how to constrain this query *@param fieldsToSelect The fields of the named entity to get from the database; if empty or null all fields will be retreived *@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending *@return List of GenericValue objects representing the result */ public List findByCondition(String entityName, EntityCondition entityCondition, Collection fieldsToSelect, List orderBy) throws GenericEntityException { ModelEntity modelEntity = getModelReader().getModelEntity(entityName); GenericValue dummyValue = new GenericValue(modelEntity); Map ecaEventMap = this.getEcaEntityEventMap(entityName); this.evalEcaRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); if (entityCondition != null) entityCondition.checkCondition(modelEntity); this.evalEcaRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); GenericHelper helper = getEntityHelper(entityName); List list = null; list = helper.findByCondition(modelEntity, entityCondition, fieldsToSelect, orderBy); this.evalEcaRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_FIND, dummyValue, ecaEventMap, (ecaEventMap == null), false); absorbList(list); return list; }