public interface GenericHelper
| Modifier and Type | Method and Description |
|---|---|
void |
checkDataSource(Map<String,? extends ModelEntity> modelEntities,
Collection<String> messages,
boolean addMissing)
Check the datasource to make sure the entity definitions are correct, optionally adding missing entities or
fields on the server
|
int |
count(ModelEntity modelEntity,
String fieldName,
EntityCondition entityCondition,
EntityFindOptions findOptions)
Returns the count of the results that matches the specified condition
|
GenericValue |
create(GenericValue value)
Creates a Entity in the form of a GenericValue and write it to the database
|
List<GenericValue> |
findAllByPrimaryKeys(List<? extends GenericPK> primaryKeys)
Find a number of Generic Value objects by their Primary Keys, all at once
|
List<GenericValue> |
findByAnd(ModelEntity modelEntity,
Map<String,?> fields,
List<String> orderBy)
Finds Generic Entity records by all of the specified fields (ie: combined using AND)
|
List<GenericValue> |
findByCondition(ModelEntity modelEntity,
EntityCondition entityCondition,
Collection<String> fieldsToSelect,
List<String> orderBy)
Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc
for more details.
|
List<GenericValue> |
findByMultiRelation(GenericValue value,
ModelRelation modelRelationOne,
ModelEntity modelEntityOne,
ModelRelation modelRelationTwo,
ModelEntity modelEntityTwo,
List<String> orderBy) |
List<GenericValue> |
findByOr(ModelEntity modelEntity,
Map<String,?> fields,
List<String> orderBy)
Finds Generic Entity records by all of the specified fields (ie: combined using OR)
|
GenericValue |
findByPrimaryKey(GenericPK primaryKey)
Find a Generic Entity by its Primary Key
|
GenericValue |
findByPrimaryKeyPartial(GenericPK primaryKey,
Set<String> keys)
Find a Generic Entity by its Primary Key and only returns the values requested by the passed keys (names)
|
EntityListIterator |
findListIteratorByCondition(ModelEntity modelEntity,
EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition,
Collection<String> fieldsToSelect,
List<String> orderBy,
EntityFindOptions findOptions)
Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc
for more details.
|
String |
getHelperName()
Gets the name of the server configuration that corresponds to this helper
|
int |
removeAll(List<? extends GenericEntity> dummyPKs)
Remove the Entities from the List from the persistent store.
|
int |
removeByAnd(ModelEntity modelEntity,
Map<String,?> fields)
Removes/deletes Generic Entity records found by all of the specified fields (ie: combined using AND)
|
int |
removeByCondition(ModelEntity modelEntity,
EntityCondition whereCondition)
Removes/deletes Generic Entity records found by all of the specified fields (ie: combined using AND)
|
int |
removeByPrimaryKey(GenericPK primaryKey)
Remove a Generic Entity corresponding to the primaryKey
|
int |
store(GenericValue value)
Store the Entity from the GenericValue to the persistent store
|
int |
storeAll(List<? extends GenericValue> values)
Store the Entities from the List GenericValue instances to the persistent store.
|
List<GenericValue> |
transform(ModelEntity modelEntity,
EntityCondition entityCondition,
List<String> orderBy,
String lockField,
Transformation transformation)
Applies the given transformation to any entities matching the given condition.
|
String getHelperName()
GenericValue create(GenericValue value) throws GenericEntityException
GenericEntityExceptionGenericValue findByPrimaryKey(GenericPK primaryKey) throws GenericEntityException
primaryKey - The primary key to find by.GenericEntityExceptionGenericValue findByPrimaryKeyPartial(GenericPK primaryKey, Set<String> keys) throws GenericEntityException
primaryKey - The primary key to find by.keys - The keys, or names, of the values to retrieve; only these values will be retrievedGenericEntityExceptionList<GenericValue> findAllByPrimaryKeys(List<? extends GenericPK> primaryKeys) throws GenericEntityException
primaryKeys - A List of primary keys to find by.GenericEntityExceptionint removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException
primaryKey - The primary key of the entity to remove.GenericEntityExceptionList<GenericValue> findByAnd(ModelEntity modelEntity, Map<String,?> fields, List<String> orderBy) throws GenericEntityException
modelEntity - The ModelEntity of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesorderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or "
DESC" for descendingGenericEntityExceptionList<GenericValue> findByOr(ModelEntity modelEntity, Map<String,?> fields, List<String> orderBy) throws GenericEntityException
modelEntity - The ModelEntity of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesorderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or "
DESC" for descendingGenericEntityExceptionList<GenericValue> findByCondition(ModelEntity modelEntity, EntityCondition entityCondition, Collection<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException
modelEntity - The ModelEntity of the Entity as defined in the entity XML fileentityCondition - The EntityCondition object that specifies how to constrain this queryfieldsToSelect - The fields of the named entity to get from the database; if empty or null all fields will
be retreivedorderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or "
DESC" for descendingGenericEntityExceptionList<GenericValue> findByMultiRelation(GenericValue value, ModelRelation modelRelationOne, ModelEntity modelEntityOne, ModelRelation modelRelationTwo, ModelEntity modelEntityTwo, List<String> orderBy) throws GenericEntityException
GenericEntityExceptionEntityListIterator findListIteratorByCondition(ModelEntity modelEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException
modelEntity - The ModelEntity of the Entity as defined in the entity XML filewhereEntityCondition - 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)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)fieldsToSelect - The fields of the named entity to get from the database; if empty or null all fields will
be retreivedorderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or "
DESC" for descendingfindOptions - An instance of EntityFindOptions that specifies advanced query options. See the
EntityFindOptions JavaDoc for more details.GenericEntityExceptionint removeByAnd(ModelEntity modelEntity, Map<String,?> fields) throws GenericEntityException
modelEntity - The ModelEntity of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesGenericEntityExceptionint removeByCondition(ModelEntity modelEntity, EntityCondition whereCondition) throws GenericEntityException
modelEntity - The ModelEntity of the Entity as defined in the entity XML filewhereCondition - The EntityCondition object that specifies how to constrain this queryGenericEntityExceptionint store(GenericValue value) throws GenericEntityException
value - GenericValue instance containing the entityGenericEntityExceptionint storeAll(List<? extends GenericValue> values) throws GenericEntityException
values - List of GenericValue instances containing the entities to storeGenericEntityExceptionint removeAll(List<? extends GenericEntity> dummyPKs) throws GenericEntityException
dummyPKs - List of GenericEntity instances containing the entities or by and fields to removeGenericEntityExceptionvoid checkDataSource(Map<String,? extends ModelEntity> modelEntities, Collection<String> messages, boolean addMissing) throws GenericEntityException
modelEntities - Map of entityName names and ModelEntity valuesmessages - Collection to put any result messages inaddMissing - Flag indicating whether or not to add missing entities and fields on the serverGenericEntityExceptionint count(ModelEntity modelEntity, String fieldName, EntityCondition entityCondition, EntityFindOptions findOptions) throws GenericEntityException
modelEntity - The ModelEntity of the Entity as defined in the entity XML filefieldName - The field of the named entity to count, if null this is equivalent to count(*)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 tofindOptions - 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. If you issue a distinct without a fieldName it will be ignored as select count (distinct *) makes no sense
GenericEntityExceptionList<GenericValue> transform(ModelEntity modelEntity, EntityCondition entityCondition, List<String> orderBy, String lockField, Transformation transformation) throws GenericEntityException
modelEntity - the type of entity to transform (required)entityCondition - the condition that selects the entities to transform (null means transform all)orderBy - the order in which the entities should be selected for updating (null means no ordering)lockField - the entity field to use for optimistic locking; the value of this field will be read
between the SELECT and the UPDATE to determine whether another process has updated one of the target records in
the meantime; if so, the transformation will be reapplied and another UPDATE attemptedtransformation - the transformation to apply (required)GenericEntityExceptionCopyright © 2024 Atlassian. All rights reserved.