public void putInAndCache(String entityName, Map fields, List values) { if (entityName == null || fields == null || values == null) return; ModelEntity entity = this.getModelEntity(entityName); putInAndCache(entity, fields, values); }
public void putInAndCache(String entityName, Map fields, List values) { if (entityName == null || fields == null || values == null) return; ModelEntity entity = this.getModelEntity(entityName); putInAndCache(entity, fields, values); }
public void putInAndCache( final String entityName, final Map<String, ?> fields, final List<? extends GenericValue> values) { checkIfLocked(); if (entityName == null || fields == null || values == null) { return; } final ModelEntity entity = getModelEntity(entityName); putInAndCache(entity, fields, values); }
/** * Finds Generic Entity records by all of the specified fields (i.e. * combined using AND), looking first in the cache; uses orderBy for * lookup, but only keys results on the entityName and fields. * * @param entityName The Name of the Entity as defined in the entity XML file * @param fields The fields of the named entity to query by with their corresponging values * @param orderBy The fields of the named entity to order the query by; * optionally add " ASC" for ascending or " DESC" for descending * @return List of GenericValue instances that match the query */ public List<GenericValue> findByAndCache( final String entityName, final Map<String, ?> fields, final List<String> orderBy) throws GenericEntityException { checkIfLocked(); final ModelEntity modelEntity = getModelReader().getModelEntity(entityName); List<GenericValue> lst = getFromAndCache(modelEntity, fields); if (lst == null) { lst = findByAnd(modelEntity, fields, orderBy); if (lst != null) { putInAndCache(modelEntity, fields, lst); } } return lst; }
/** Finds Generic Entity records by all of the specified fields (ie: combined using AND), looking first in the cache; uses orderBy for lookup, but only keys results on the entityName and fields *@param entityName The Name of the Entity as defined in the entity XML file *@param fields The fields of the named entity to query by with their corresponging values *@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 instances that match the query */ public List findByAndCache(String entityName, Map fields, List orderBy) throws GenericEntityException { ModelEntity modelEntity = getModelReader().getModelEntity(entityName); GenericValue dummyValue = new GenericValue(modelEntity); Map ecaEventMap = this.getEcaEntityEventMap(modelEntity.getEntityName()); this.evalEcaRules(EntityEcaHandler.EV_CACHE_CHECK, EntityEcaHandler.OP_FIND, dummyValue, null, false, false); List lst = this.getFromAndCache(modelEntity, fields); if (lst == null) { lst = findByAnd(modelEntity, fields, orderBy); if (lst != null) { this.evalEcaRules(EntityEcaHandler.EV_CACHE_PUT, EntityEcaHandler.OP_FIND, dummyValue, null, false, false); this.putInAndCache(modelEntity, fields, lst); } } return lst; }
/** Finds Generic Entity records by all of the specified fields (ie: combined using AND), looking first in the cache; uses orderBy for lookup, but only keys results on the entityName and fields *@param entityName The Name of the Entity as defined in the entity XML file *@param fields The fields of the named entity to query by with their corresponging values *@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 instances that match the query */ public List findByAndCache(String entityName, Map fields, List orderBy) throws GenericEntityException { ModelEntity modelEntity = getModelReader().getModelEntity(entityName); GenericValue dummyValue = new GenericValue(modelEntity); Map ecaEventMap = this.getEcaEntityEventMap(modelEntity.getEntityName()); this.evalEcaRules(EntityEcaHandler.EV_CACHE_CHECK, EntityEcaHandler.OP_FIND, dummyValue, null, false, false); List lst = this.getFromAndCache(modelEntity, fields); if (lst == null) { lst = findByAnd(modelEntity, fields, orderBy); if (lst != null) { this.evalEcaRules(EntityEcaHandler.EV_CACHE_PUT, EntityEcaHandler.OP_FIND, dummyValue, null, false, false); this.putInAndCache(modelEntity, fields, lst); } } return lst; }