/** * Allows you to pass a SequenceUtil class (possibly one that overrides the getNextSeqId method); * if null is passed will effectively refresh the sequencer. * * @param sequencer the sequencer to set */ public void setSequencer(final SequenceUtil sequencer) { checkIfLocked(); this.sequencer = sequencer; }
/** * Finds all Generic entities of the given type, optionally sorted. * * @param entityName The Name of the Entity as defined in the entity XML file * @param orderBy the entity fields by which to order the query; optionally * add " ASC" for ascending or " DESC" for descending to each field name * @return List containing all Generic entities */ public List<GenericValue> findAll(final String entityName, final List<String> orderBy) throws GenericEntityException { checkIfLocked(); return findByAnd(entityName, new HashMap<String, Object>(), orderBy); }
/** * Finds all Generic entities of the given type, looking first in the cache. * * @param entityName The Name of the Entity as defined in the entity XML file * @return List containing all Generic entities */ public List<GenericValue> findAllCache(final String entityName) throws GenericEntityException { checkIfLocked(); return findAllCache(entityName, null); }
/** * Remove a Generic Entity corresponding to the primaryKey. * * @param primaryKey The primary key of the entity to remove. * @return int representing number of rows affected by this operation */ public int removeByPrimaryKey(final GenericPK primaryKey) throws GenericEntityException { checkIfLocked(); return removeByPrimaryKey(primaryKey, true); }
/** * Refresh the Entity for the GenericValue from the persistent store. * * @param value GenericValue instance containing the entity to refresh */ public void refresh(final GenericValue value) throws GenericEntityException { checkIfLocked(); refresh(value, true); }
public void clearAllCacheLinesByDummyPK(final Collection<? extends GenericEntity> dummyPKs) { checkIfLocked(); if (dummyPKs == null) { return; } for (final GenericEntity dummyPK : dummyPKs) { clearCacheLineFlexible(dummyPK); } }
public void clearAllCacheLinesByValue(final Collection<? extends GenericValue> values) { checkIfLocked(); if (values == null) return; for (final GenericValue value : values) { clearCacheLine(value); } }
/** * Finds all Generic entities of the given type. * * @param entityName The Name of the Entity as defined in the entity XML file * @return all entities of the given type */ public List<GenericValue> findAll(final String entityName) throws GenericEntityException { checkIfLocked(); return findByAnd(entityName, new HashMap<String, Object>(), null); }
/** * Finds Generic Entity records by any of the specified fields (i.e. combined using OR). * * @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 * @return List of GenericValue instances that match the query */ public List<GenericValue> findByOr(final String entityName, final Map<String, ?> fields) throws GenericEntityException { checkIfLocked(); return findByOr(entityName, fields, null); }
/** * Remove a Generic Value from the database. * * @param value The GenericValue object of the entity to remove. * @return int representing number of rows affected by this operation */ public int removeValue(final GenericValue value) throws GenericEntityException { checkIfLocked(); return removeValue(value, true); }
/** * Remove a CACHED Generic Entity from the cache by its primary key, does NOT * check to see if the passed GenericPK is a complete primary key. * Also tries to clear the corresponding all cache entry. * * @param primaryKey The primary key to clear by. */ public void clearCacheLine(final GenericPK primaryKey) { checkIfLocked(); clearCacheLine(primaryKey, true); }
public void putInAllCache(final String entityName, final List<? extends GenericValue> values) { checkIfLocked(); if (entityName == null || values == null) { return; } final ModelEntity entity = getModelEntity(entityName); putInAllCache(entity, values); }
/** * Gets the helper name that corresponds to this delegator and the specified entityName. * * @param entityName The name of the entity to get the helper for * @return String with the helper name that corresponds to this delegator and the specified entityName */ public String getEntityGroupName(final String entityName) { checkIfLocked(); return getModelGroupReader().getEntityGroupName(entityName); }
/** * Find a Generic Entity by its Primary Key. * * @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 * @return The GenericValue corresponding to the primaryKey */ public GenericValue findByPrimaryKey(final String entityName, final Map<String, ?> fields) throws GenericEntityException { checkIfLocked(); return findByPrimaryKey(makePK(entityName, fields)); }
public List<GenericValue> getFromAndCache(final ModelEntity entity, final Map<String, ?> fields) { checkIfLocked(); if (entity == null || fields == null) { return null; } final GenericPK tempPK = new GenericPK(entity, fields); return andCache.get(tempPK); }
public void putAllInPrimaryKeyCache(final List<? extends GenericValue> values) { checkIfLocked(); if (values == null) { return; } for (final GenericValue value : values) { putInPrimaryKeyCache(value.getPrimaryKey(), value); } }
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); }
/** * Gets the helper that corresponds to this delegator and the specified entity. * * @param entity The entity for which to get the helper (required) * @return GenericHelper that corresponds to this delegator and the specified entity */ public GenericHelper getEntityHelper(final ModelEntity entity) throws GenericEntityException { checkIfLocked(); return getEntityHelper(entity.getEntityName()); }
/** * Gets the helper name that corresponds to this delegator and the specified entityName. * * @param entityName The name of the entity to get the helper name for * @return String with the helper name that corresponds to this delegator and the specified entityName */ public String getEntityHelperName(final String entityName) { checkIfLocked(); final String groupName = getModelGroupReader().getEntityGroupName(entityName); return getGroupHelperName(groupName); }
public void clearAllCaches(boolean distribute) { checkIfLocked(); if (allCache != null) allCache.clear(); if (andCache != null) andCache.clear(); if (andCacheFieldSets != null) andCacheFieldSets.clear(); if (primaryKeyCache != null) primaryKeyCache.clear(); if (distribute && distributedCacheClear != null) { distributedCacheClear.clearAllCaches(); } }