Package com.atlassian.jira.util
Class JiraEntityUtils
java.lang.Object
com.atlassian.jira.util.JiraEntityUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.commons.collections.Transformer
Transformer for turning GenericValue objects into thier Long ids.static final org.apache.commons.collections.Transformer
-
Method Summary
Modifier and TypeMethodDescriptioncreateEntityMap
(List<org.ofbiz.core.entity.GenericValue> entities, String key, String value) Convert any list of entities into a sequenced hash map with two fields.static Collection
transforToIdsCollection
(Collection genericValues) Creates a new collection of IDs from given collection of generic values.static List
<ChangeItemBean> updateDependentEntities
(org.ofbiz.core.entity.GenericValue issue, Collection newEntities, String relationType, String changeItemField) Deprecated.static List
<ChangeItemBean> updateDependentEntitiesCheckId
(org.ofbiz.core.entity.GenericValue issue, Collection newEntities, String relationType, String changeItemField) Slightly changed fromupdateDependentEntities(org.ofbiz.core.entity.GenericValue, java.util.Collection, String, String)
to cope with GV components that have different representation of null and empty strings (eg.
-
Field Details
-
GV_TO_ID_TRANSFORMER
public static final org.apache.commons.collections.Transformer GV_TO_ID_TRANSFORMER -
GENERIC_VALUE_TO_ID_TRANSFORMER
public static final org.apache.commons.collections.Transformer GENERIC_VALUE_TO_ID_TRANSFORMERTransformer for turning GenericValue objects into thier Long ids. Use withCollectionUtils.collect(java.util.Collection, org.apache.commons.collections.Transformer)
etc.
-
-
Method Details
-
transforToIdsCollection
Creates a new collection of IDs from given collection of generic values.- Parameters:
genericValues
- a collection of generic values [GenericValue]- Returns:
- a collection of IDs [Long]
-
updateDependentEntitiesCheckId
public static List<ChangeItemBean> updateDependentEntitiesCheckId(org.ofbiz.core.entity.GenericValue issue, Collection newEntities, String relationType, String changeItemField) throws org.ofbiz.core.entity.GenericEntityException Slightly changed fromupdateDependentEntities(org.ofbiz.core.entity.GenericValue, java.util.Collection, String, String)
to cope with GV components that have different representation of null and empty strings (eg. Oracle) - JRA-12130Update the dependent entities of this issue (for example versions, fix versions or components)
- Parameters:
issue
- The issue to update entities fornewEntities
- The list of new dependent entities (GenericValue
's)relationType
- The dependency (association) type to look at, fromIssueRelationConstants
changeItemField
- The fieldname of the change items generated- Returns:
- A list of
change items
or an empty list if nothing was changed - Throws:
org.ofbiz.core.entity.GenericEntityException
- If something real bad happens
-
updateDependentEntities
public static List<ChangeItemBean> updateDependentEntities(org.ofbiz.core.entity.GenericValue issue, Collection newEntities, String relationType, String changeItemField) throws org.ofbiz.core.entity.GenericEntityException Deprecated.please useupdateDependentEntitiesCheckId(org.ofbiz.core.entity.GenericValue, java.util.Collection, String, String)
instead, as it compares ids rather thanGenericValues
Update the dependent entities of this issue (for example versions, fix versions or components)- Parameters:
issue
- The issue to update entities fornewEntities
- The list of new dependent entitiesrelationType
- The dependency (association) type to look at, fromIssueRelationConstants
changeItemField
- The fieldname of the change items generated- Returns:
- A list of change items or an empty list if nothing was changed
- Throws:
org.ofbiz.core.entity.GenericEntityException
- If something real bad happens
-
createEntityMap
public static Map<Object,Object> createEntityMap(List<org.ofbiz.core.entity.GenericValue> entities, String key, String value) Convert any list of entities into a sequenced hash map with two fields.This is most useful for creating ordered maps used to create select boxes in the web interface. (ie createEntityMap(entities, "id", "name") to create an id to name map.
- Parameters:
entities
- list ofGenericValues
key
- the element to use as the keyvalue
- the element to use as the value- Returns:
- Map iterated in the entities order with key and value pairs as defined by key and value parameters
-
updateDependentEntitiesCheckId(org.ofbiz.core.entity.GenericValue, java.util.Collection, String, String)
instead, as it compares ids rather thanGenericValues