com.atlassian.core.ofbiz.util
Class EntityUtils

java.lang.Object
  extended by com.atlassian.core.ofbiz.util.EntityUtils

public class EntityUtils
extends Object

This was taken from atlassian-ofbiz and placed into its now rightful home of JIRA.

Since:
4.3

Constructor Summary
EntityUtils()
           
 
Method Summary
static boolean contains(Collection<org.ofbiz.core.entity.GenericValue> entities, org.ofbiz.core.entity.GenericValue entity)
          Checks if a collection of entities contains an identical entity to the one provided.
static org.ofbiz.core.entity.GenericValue createValue(String entity, Map<String,?> paramMap)
          Create a new entity.
static List<org.ofbiz.core.entity.GenericValue> filterByAnd(List<org.ofbiz.core.entity.GenericValue> values, List<? extends org.ofbiz.core.entity.EntityExpr> exprs)
          This method is analogous to the OFBiz EntityUtil.filterByAnd method except that theirs does not filter on GT, GTE, LT, LTE yet.
static String getNextStringId(String entityName)
          Calculate a new entity ID (by basically taking one more than the max integer that exists).
static org.ofbiz.core.entity.EntityOperator getOperator(String code)
          Small utility method to get an entity operator from it's code
static boolean identical(org.ofbiz.core.entity.GenericValue v1, org.ofbiz.core.entity.GenericValue v2)
          Compare two GenericValues based on their content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityUtils

public EntityUtils()
Method Detail

getOperator

public static org.ofbiz.core.entity.EntityOperator getOperator(String code)
Small utility method to get an entity operator from it's code


createValue

public static org.ofbiz.core.entity.GenericValue createValue(String entity,
                                                             Map<String,?> paramMap)
                                                      throws org.ofbiz.core.entity.GenericEntityException
Create a new entity. If there is no "id" in the parameter list, one is created using the entity sequence

Throws:
org.ofbiz.core.entity.GenericEntityException

identical

public static boolean identical(org.ofbiz.core.entity.GenericValue v1,
                                org.ofbiz.core.entity.GenericValue v2)
Compare two GenericValues based on their content. This method will check the keys and values of both GenericValues. There is only a single difference between this method and GenericValue.equals(gv2), that is that if one GV has no key of a certain type, and the other has a null value for that key, they are still deemed to be identical (as GenericValue.get(key) always returns null if the key exists or not).

Returns:
true if the issues are the same, false if they are different

contains

public static boolean contains(Collection<org.ofbiz.core.entity.GenericValue> entities,
                               org.ofbiz.core.entity.GenericValue entity)
Checks if a collection of entities contains an identical entity to the one provided.

Parameters:
entities - The list of entities to search
entity - The entity to search for and compare to
Returns:
The matching entity, or null if no matching entity is found

filterByAnd

public static List<org.ofbiz.core.entity.GenericValue> filterByAnd(List<org.ofbiz.core.entity.GenericValue> values,
                                                                   List<? extends org.ofbiz.core.entity.EntityExpr> exprs)
This method is analogous to the OFBiz EntityUtil.filterByAnd method except that theirs does not filter on GT, GTE, LT, LTE yet.

Parameters:
values - A collection of GenericValues
exprs - The expressions that must validate to true
Returns:
Collection of GenericValues that match the expression list

getNextStringId

public static String getNextStringId(String entityName)
                              throws org.ofbiz.core.entity.GenericEntityException
Calculate a new entity ID (by basically taking one more than the max integer that exists). If there are string IDs here, they will not be affected.

Throws:
org.ofbiz.core.entity.GenericEntityException


Copyright © 2002-2012 Atlassian. All Rights Reserved.