/** * Clones this GenericPK, this is a shallow clone & uses the default shallow HashMap clone * * @return Object that is a clone of this GenericPK */ public Object clone() { GenericPK newEntity = new GenericPK(this); newEntity.setDelegator(internalDelegator); return newEntity; } }
private int removeFromCache(GenericPK pk) { if (pk == null) { return 0; } Map entityCache = (Map) cache.get(pk.getEntityName()); if (entityCache == null) { return 0; } Object o = entityCache.remove(pk); if (o == null) { return 0; } else { return 1; } }
public List getFromAndCache(ModelEntity entity, Map fields) { if (entity == null || fields == null) return null; GenericPK tempPK = new GenericPK(entity, fields); if (tempPK == null) return null; return (List) andCache.get(tempPK); }
/** * Find a Generic Entity by its Primary Key. * * @param primaryKey The primary key to find by. * @return The GenericValue corresponding to the primaryKey */ public GenericValue findByPrimaryKey(final GenericPK primaryKey) throws GenericEntityException { checkIfLocked(); final GenericHelper helper = getEntityHelper(primaryKey.getEntityName()); if (!primaryKey.isPrimaryKey()) { throw new IllegalArgumentException( "[GenericDelegator.findByPrimaryKey] Passed primary key is not a valid primary key: " + primaryKey); } GenericValue value; try { value = helper.findByPrimaryKey(primaryKey); } catch (GenericEntityNotFoundException e) { value = null; } if (value != null) { value.setDelegator(this); } return value; }
public void clearCacheLine(GenericPK primaryKey, boolean distribute) { if (primaryKey == null) return; //if never cached, then don't bother clearing if (primaryKey.getModelEntity().getNeverCache()) return; // always auto clear the all cache too, since we know it's messed up in any case if (allCache != null) { allCache.remove(primaryKey.getEntityName()); } if (primaryKeyCache != null) { primaryKeyCache.remove(primaryKey); } if (distribute && this.distributedCacheClear != null) { this.distributedCacheClear.distributedClearCacheLine(primaryKey); } }
/** * Remove a Generic Entity corresponding to the primaryKey * * @param primaryKey The primary key of the entity to remove. * @return int representing number of rows effected by this operation */ public int removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException { if (primaryKey == null) return 0; if (Debug.verboseOn()) Debug.logVerbose("Removing GenericPK: " + primaryKey.toString(), module); return genericDAO.delete(primaryKey); }
public List getFromAndCache(ModelEntity entity, Map fields) { if (entity == null || fields == null) return null; GenericPK tempPK = new GenericPK(entity, fields); if (tempPK == null) return null; return (List) andCache.get(tempPK); }
/** * Find a Generic Entity by its Primary Key and only returns the values * requested by the passed keys (names). * * @param primaryKey The primary key to find by. * @param keys The keys, or names, of the values to retrieve; only these values will be retrieved * @return The GenericValue corresponding to the primaryKey */ public GenericValue findByPrimaryKeyPartial(final GenericPK primaryKey, final Set<String> keys) throws GenericEntityException { checkIfLocked(); final GenericHelper helper = getEntityHelper(primaryKey.getEntityName()); if (!primaryKey.isPrimaryKey()) { throw new IllegalArgumentException( "[GenericDelegator.findByPrimaryKey] Passed primary key is not a valid primary key: " + primaryKey); } GenericValue value; try { value = helper.findByPrimaryKeyPartial(primaryKey, keys); } catch (GenericEntityNotFoundException e) { value = null; } if (value != null) { value.setDelegator(this); } return value; }
public void clearCacheLine(GenericPK primaryKey, boolean distribute) { if (primaryKey == null) return; //if never cached, then don't bother clearing if (primaryKey.getModelEntity().getNeverCache()) return; // always auto clear the all cache too, since we know it's messed up in any case if (allCache != null) { allCache.remove(primaryKey.getEntityName()); } if (primaryKeyCache != null) { primaryKeyCache.remove(primaryKey); } if (distribute && this.distributedCacheClear != null) { this.distributedCacheClear.distributedClearCacheLine(primaryKey); } }
/** Remove a Generic Entity corresponding to the primaryKey *@param primaryKey The primary key of the entity to remove. *@return int representing number of rows effected by this operation */ public int removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException { if (primaryKey == null) return 0; if (Debug.verboseOn()) Debug.logVerbose("Removing GenericPK: " + primaryKey.toString(), module); return genericDAO.delete(primaryKey); }
/** Clones this GenericPK, this is a shallow clone & uses the default shallow HashMap clone *@return Object that is a clone of this GenericPK */ public Object clone() { GenericPK newEntity = new GenericPK(this); newEntity.setDelegator(internalDelegator); return newEntity; } }
@Override public GenericPK getPrimaryKey() { return new GenericPK(getModelEntity(), UtilMisc.toMap("id", fields.get("id"))); }
/** Find a Generic Entity by its Primary Key *@param primaryKey The primary key to find by. *@return The GenericValue corresponding to the primaryKey */ public GenericValue findByPrimaryKey(GenericPK primaryKey) throws GenericEntityException { Map ecaEventMap = this.getEcaEntityEventMap(primaryKey.getEntityName()); this.evalEcaRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_FIND, primaryKey, ecaEventMap, (ecaEventMap == null), false); GenericHelper helper = getEntityHelper(primaryKey.getEntityName()); GenericValue value = null; if (!primaryKey.isPrimaryKey()) { throw new IllegalArgumentException("[GenericDelegator.findByPrimaryKey] Passed primary key is not a valid primary key: " + primaryKey); } this.evalEcaRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_FIND, primaryKey, ecaEventMap, (ecaEventMap == null), false); try { value = helper.findByPrimaryKey(primaryKey); } catch (GenericEntityNotFoundException e) { value = null; } if (value != null) value.setDelegator(this); this.evalEcaRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_FIND, primaryKey, ecaEventMap, (ecaEventMap == null), false); return value; }
private int removeFromCache(GenericPK pk) { if (pk == null) { return 0; } Map<GenericEntity, GenericValue> entityCache = cache.get(pk.getEntityName()); if (entityCache == null) { return 0; } Object o = entityCache.remove(pk); if (o == null) { return 0; } else { return 1; } }
public void clearCacheLine(final GenericPK primaryKey, final boolean distribute) { checkIfLocked(); if (primaryKey == null) { return; } // if never cached, then don't bother clearing if (primaryKey.getModelEntity().getNeverCache()) { return; } // always auto clear the all cache too, since we know it's messed up in any case if (allCache != null) { allCache.remove(primaryKey.getEntityName()); } if (primaryKeyCache != null) { primaryKeyCache.remove(primaryKey); } if (distribute && distributedCacheClear != null) { distributedCacheClear.distributedClearCacheLine(primaryKey); } }
/** Remove a Generic Entity corresponding to the primaryKey *@param primaryKey The primary key of the entity to remove. *@return int representing number of rows effected by this operation */ public int removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException { if (primaryKey == null) return 0; if (Debug.verboseOn()) Debug.logVerbose("Removing GenericPK: " + primaryKey.toString(), module); return genericDAO.delete(primaryKey); }
/** Clones this GenericPK, this is a shallow clone & uses the default shallow HashMap clone *@return Object that is a clone of this GenericPK */ public Object clone() { GenericPK newEntity = new GenericPK(this); newEntity.setDelegator(internalDelegator); return newEntity; } }