/** Gets the helper name that corresponds to this delegator and the specified entity *@param entity The entity to get the helper for *@return String with the helper name that corresponds to this delegator and the specified entity */ public String getEntityHelperName(ModelEntity entity) { if (entity == null) return null; return getEntityHelperName(entity.getEntityName()); }
/** Gets the helper name that corresponds to this delegator and the specified entity *@param entity The entity to get the helper for *@return String with the helper name that corresponds to this delegator and the specified entity */ public String getEntityHelperName(ModelEntity entity) { if (entity == null) return null; return getEntityHelperName(entity.getEntityName()); }
/** Gets the an instance of helper that corresponds to this delegator and the specified entityName *@param entityName The name of the entity to get the helper for *@return GenericHelper that corresponds to this delegator and the specified entityName */ public GenericHelper getEntityHelper(String entityName) throws GenericEntityException { String helperName = getEntityHelperName(entityName); if (helperName != null && helperName.length() > 0) return GenericHelperFactory.getHelper(helperName); else throw new GenericEntityException("Helper name not found for entity " + entityName); }
/** Gets the an instance of helper that corresponds to this delegator and the specified entityName *@param entityName The name of the entity to get the helper for *@return GenericHelper that corresponds to this delegator and the specified entityName */ public GenericHelper getEntityHelper(String entityName) throws GenericEntityException { String helperName = getEntityHelperName(entityName); if (helperName != null && helperName.length() > 0) return GenericHelperFactory.getHelper(helperName); else throw new GenericEntityException("Helper name not found for entity " + entityName); }
/** * Gets the helper name that corresponds to this delegator and the specified entity. * * @param entity the entity for which to get the helper (can be null) * @return String with the helper name that corresponds to this delegator and the specified entity */ public String getEntityHelperName(final ModelEntity entity) { checkIfLocked(); if (entity == null) { return null; } return getEntityHelperName(entity.getEntityName()); }
String helperName = this.getEntityHelperName(curPK.getEntityName()); List pks = (List) pksPerHelper.get(helperName);
String helperName = this.getEntityHelperName(curPK.getEntityName()); List pks = (List) pksPerHelper.get(helperName);
/** * Gets the helper that corresponds to this delegator and the specified entityName. * * @param entityName The name of the entity to get the helper for * @return GenericHelper that corresponds to this delegator and the specified entityName */ public GenericHelper getEntityHelper(final String entityName) throws GenericEntityException { checkIfLocked(); final String helperName = getEntityHelperName(entityName); if (helperName != null && helperName.length() > 0) { return GenericHelperFactory.getHelper(helperName); } throw new GenericEntityException("Helper name not found for entity " + entityName); }
String helperName = getEntityHelperName(primaryKey.getEntityName()); List<GenericPK> pks = pksPerHelper.get(helperName);
/** Gets field type names from the helper that corresponds to the specified entity *@param entity The entity *@return Collection of field type names from the helper that corresponds to the specified entity */ public Collection getEntityFieldTypeNames(ModelEntity entity) throws GenericEntityException { String helperName = getEntityHelperName(entity); if (helperName == null || helperName.length() <= 0) return null; ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); if (modelFieldTypeReader == null) { throw new GenericEntityException("ModelFieldTypeReader not found for entity " + entity.getEntityName() + " with helper name " + helperName); } return modelFieldTypeReader.getFieldTypeNames(); }
@Override public Long getNextSeqId(String seqName, boolean clusterMode) { checkIfLocked(); if (sequencer == null) { synchronized (this) { if (sequencer == null) { String helperName = getEntityHelperName("SequenceValueItem"); ModelEntity seqEntity = getModelEntity("SequenceValueItem"); sequencer = new SequenceUtil( helperName, seqEntity, "seqName", "seqId", clusterMode || ofNullable(getDelegatorInfo()).map(info -> info.useDistributedCacheClear).orElse(false) ); } } } return sequencer.getNextSeqId(seqName); }
/** Gets field type names from the helper that corresponds to the specified entity *@param entity The entity *@return Collection of field type names from the helper that corresponds to the specified entity */ public Collection getEntityFieldTypeNames(ModelEntity entity) throws GenericEntityException { String helperName = getEntityHelperName(entity); if (helperName == null || helperName.length() <= 0) return null; ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); if (modelFieldTypeReader == null) { throw new GenericEntityException("ModelFieldTypeReader not found for entity " + entity.getEntityName() + " with helper name " + helperName); } return modelFieldTypeReader.getFieldTypeNames(); }
/** Gets a field type instance by name from the helper that corresponds to the specified entity *@param entity The entity *@param type The name of the type *@return ModelFieldType instance for the named type from the helper that corresponds to the specified entity */ public ModelFieldType getEntityFieldType(ModelEntity entity, String type) throws GenericEntityException { String helperName = getEntityHelperName(entity); if (helperName == null || helperName.length() <= 0) return null; ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); if (modelFieldTypeReader == null) { throw new GenericEntityException("ModelFieldTypeReader not found for entity " + entity.getEntityName() + " with helper name " + helperName); } return modelFieldTypeReader.getModelFieldType(type); }
/** Gets a field type instance by name from the helper that corresponds to the specified entity *@param entity The entity *@param type The name of the type *@return ModelFieldType instance for the named type from the helper that corresponds to the specified entity */ public ModelFieldType getEntityFieldType(ModelEntity entity, String type) throws GenericEntityException { String helperName = getEntityHelperName(entity); if (helperName == null || helperName.length() <= 0) return null; ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); if (modelFieldTypeReader == null) { throw new GenericEntityException("ModelFieldTypeReader not found for entity " + entity.getEntityName() + " with helper name " + helperName); } return modelFieldTypeReader.getModelFieldType(type); }
/** Get the next guaranteed unique seq id from the sequence with the given sequence name; * if the named sequence doesn't exist, it will be created *@param seqName The name of the sequence to get the next seq id from *@return Long with the next seq id for the given sequence name */ public Long getNextSeqId(String seqName) { if (sequencer == null) { synchronized (this) { if (sequencer == null) { String helperName = this.getEntityHelperName("SequenceValueItem"); ModelEntity seqEntity = this.getModelEntity("SequenceValueItem"); sequencer = new SequenceUtil(helperName, seqEntity, "seqName", "seqId"); } } } if (sequencer != null) { return sequencer.getNextSeqId(seqName); } else { return null; } }
/** Get the next guaranteed unique seq id from the sequence with the given sequence name; * if the named sequence doesn't exist, it will be created *@param seqName The name of the sequence to get the next seq id from *@return Long with the next seq id for the given sequence name */ public Long getNextSeqId(String seqName) { if (sequencer == null) { synchronized (this) { if (sequencer == null) { String helperName = this.getEntityHelperName("SequenceValueItem"); ModelEntity seqEntity = this.getModelEntity("SequenceValueItem"); sequencer = new SequenceUtil(helperName, seqEntity, "seqName", "seqId"); } } } if (sequencer != null) { return sequencer.getNextSeqId(seqName); } else { return null; } }
/** * Gets a field type instance by name from the helper that corresponds to the specified entity. * * @param entity The entity * @param type The name of the type * @return ModelFieldType instance for the named type from the helper that corresponds to the specified entity */ public ModelFieldType getEntityFieldType(final ModelEntity entity, final String type) throws GenericEntityException { checkIfLocked(); final String helperName = getEntityHelperName(entity); if (helperName == null || helperName.length() == 0) { return null; } ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); if (modelFieldTypeReader == null) { throw new GenericEntityException("ModelFieldTypeReader not found for entity " + entity.getEntityName() + " with helper name " + helperName); } return modelFieldTypeReader.getModelFieldType(type); }
/** * Gets field type names from the helper that corresponds to the specified entity. * * @param entity The entity * @return Collection of field type names from the helper that corresponds to the specified entity */ public Collection<String> getEntityFieldTypeNames(final ModelEntity entity) throws GenericEntityException { checkIfLocked(); final String helperName = getEntityHelperName(entity); if (helperName == null || helperName.length() == 0) { return null; } ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); if (modelFieldTypeReader == null) { throw new GenericEntityException("ModelFieldTypeReader not found for entity " + entity.getEntityName() + " with helper name " + helperName); } return modelFieldTypeReader.getFieldTypeNames(); }
public static void setupMockSequenceUtil() { String helperName = CoreFactory.getGenericDelegator().getEntityHelperName("SequenceValueItem"); ModelEntity seqEntity = CoreFactory.getGenericDelegator().getModelEntity("SequenceValueItem"); CoreFactory.getGenericDelegator().setSequencer(new MockSequenceUtil(helperName, seqEntity, "seqName", "seqId")); }
public static void cleanOFBiz() { MemoryHelper.clearCache(); final String helperName = CoreFactory.getGenericDelegator().getEntityHelperName("SequenceValueItem"); final ModelEntity seqEntity = CoreFactory.getGenericDelegator().getModelEntity("SequenceValueItem"); CoreFactory.getGenericDelegator().setSequencer(new MockSequenceUtil(helperName, seqEntity, "seqName", "seqId")); }