public class

JiraEntityUtils

extends Object
java.lang.Object
   ↳ com.atlassian.jira.util.JiraEntityUtils

Summary

Fields
public static final Transformer GENERIC_VALUE_TO_ID_TRANSFORMER Transformer for turning GenericValue objects into thier Long ids.
public static final Transformer GV_TO_ID_TRANSFORMER
Public Methods
static Map<ObjectObject> createEntityMap(List<GenericValue> entities, String key, String value)
Convert any list of entities into a sequenced hash map with two fields.
static GenericValue getProject(GenericValue entity)
This method is deprecated. Work with Project, Issue and Comment objects instead. Since v5.0.
static Collection transforToIdsCollection(Collection genericValues)
Creates a new collection of IDs from given collection of generic values.
static List updateDependentEntities(GenericValue issue, Collection newEntities, String relationType, String changeItemField)
This method is deprecated. please use updateDependentEntitiesCheckId(org.ofbiz.core.entity.GenericValue, java.util.Collection, String, String) instead, as it compares ids rather than org.ofbiz.core.entity.GenericValue GenericValues
static List updateDependentEntitiesCheckId(GenericValue issue, Collection newEntities, String relationType, String changeItemField)
Slightly changed from updateDependentEntities(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.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final Transformer GENERIC_VALUE_TO_ID_TRANSFORMER

Transformer for turning GenericValue objects into thier Long ids. Use with collect(java.util.Collection, org.apache.commons.collections.Transformer) etc.

public static final Transformer GV_TO_ID_TRANSFORMER

Public Methods

public static Map<ObjectObject> createEntityMap (List<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 of org.ofbiz.core.entity.GenericValue GenericValues
key the element to use as the key
value 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

public static GenericValue getProject (GenericValue entity)

This method is deprecated.
Work with Project, Issue and Comment objects instead. Since v5.0.

This method will return the project relevant to a given entity.

For example if you pass in an issue, it will get the related project. If you pass in an action, it will find the issue, and then get the project for it.

Parameters
entity Entity to determine the project from
Returns
  • Project org.ofbiz.core.entity.GenericValue if it can be found, otherwise null
Throws
DataAccessException in the event of some datalayer problem.

public static Collection transforToIdsCollection (Collection genericValues)

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]

public static List updateDependentEntities (GenericValue issue, Collection newEntities, String relationType, String changeItemField)

This method is deprecated.
please use updateDependentEntitiesCheckId(org.ofbiz.core.entity.GenericValue, java.util.Collection, String, String) instead, as it compares ids rather than org.ofbiz.core.entity.GenericValue GenericValues

Update the dependent entities of this issue (for example versions, fix versions or components)

Parameters
issue The issue to update entities for
newEntities The list of new dependent entities
relationType The dependency (association) type to look at, from IssueRelationConstants
changeItemField The fieldname of the change items generated
Returns
  • A list of change items or an empty list if nothing was changed
Throws
GenericEntityException If something real bad happens

public static List updateDependentEntitiesCheckId (GenericValue issue, Collection newEntities, String relationType, String changeItemField)

Slightly changed from updateDependentEntities(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-12130 Update the dependent entities of this issue (for example versions, fix versions or components)

Parameters
issue The issue to update entities for
newEntities The list of new dependent entities (GenericValue's)
relationType The dependency (association) type to look at, from IssueRelationConstants
changeItemField The fieldname of the change items generated
Returns
  • A list of change items or an empty list if nothing was changed
Throws
GenericEntityException If something real bad happens