Package org.ofbiz.core.entity
Class EntityUtil
java.lang.Object
org.ofbiz.core.entity.EntityUtil
Helper methods when dealing with Entities, especially ones that follow certain conventions
Created Tue Aug 07 01:10:32 MDT 2001
- Version:
- 1.0
- Author:
- Eric Pabst
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends GenericEntity>
List<T>filterByAnd(List<? extends T> values, Map<String, ?> fields) returns the values that match the values in fieldsstatic <T extends GenericValue>
List<T>filterByAnd(List<T> values, List<? extends EntityExpr> exprs) returns the values that match the exprs in liststatic <T extends GenericEntity>
List<T>filterByDate(List<T> datedValues) returns the values that are currently active.static <T extends GenericEntity>
List<T>filterByDate(List<T> datedValues, boolean allAreSame) returns the values that are currently active.static <T extends GenericEntity>
List<T>filterByDate(List<T> datedValues, Timestamp moment) returns the values that are active at the moment.static <T extends GenericEntity>
List<T>filterByDate(List<T> datedValues, Timestamp moment, String fromDateName, String thruDateName, boolean allAreSame) returns the values that are active at the moment.static <T extends GenericEntity>
List<T>filterByDate(List<T> datedValues, Date moment) returns the values that are active at the moment.static GenericValuegetFirst(List<? extends GenericValue> values) static GenericValuegetOnly(List<? extends GenericValue> values) static List<GenericValue>getRelated(String relationName, List<? extends GenericValue> values) static List<GenericValue>getRelatedByAnd(String relationName, Map<String, ?> fields, List<? extends GenericValue> values) static List<GenericValue>getRelatedCache(String relationName, List<? extends GenericValue> values) static <T extends GenericValue>
List<T>returns the values in the order specified
-
Constructor Details
-
EntityUtil
public EntityUtil()
-
-
Method Details
-
getFirst
-
getOnly
-
filterByDate
returns the values that are currently active.- Parameters:
datedValues- GenericValue's that have "fromDate" and "thruDate" fields- Returns:
- List of GenericValue's that are currently active
-
filterByDate
public static <T extends GenericEntity> List<T> filterByDate(List<T> datedValues, boolean allAreSame) returns the values that are currently active.- Parameters:
datedValues- GenericValue's that have "fromDate" and "thruDate" fieldsallAreSame- Specifies whether all values in the List are of the same entity; this can help speed things up a fair amount since we only have to see if the from and thru date fields are valid once- Returns:
- List of GenericValue's that are currently active
-
filterByDate
returns the values that are active at the moment.- Parameters:
datedValues- GenericValue's that have "fromDate" and "thruDate" fieldsmoment- the moment in question- Returns:
- List of GenericValue's that are active at the moment
-
filterByDate
returns the values that are active at the moment.- Parameters:
datedValues- GenericValue's that have "fromDate" and "thruDate" fieldsmoment- the moment in question- Returns:
- List of GenericValue's that are active at the moment
-
filterByDate
public static <T extends GenericEntity> List<T> filterByDate(List<T> datedValues, Timestamp moment, String fromDateName, String thruDateName, boolean allAreSame) returns the values that are active at the moment.- Parameters:
datedValues- GenericValue's that have "fromDate" and "thruDate" fieldsmoment- the moment in questionallAreSame- Specifies whether all values in the List are of the same entity; this can help speed things up a fair amount since we only have to see if the from and thru date fields are valid once- Returns:
- List of GenericValue's that are active at the moment
-
filterByAnd
public static <T extends GenericEntity> List<T> filterByAnd(List<? extends T> values, Map<String, ?> fields) returns the values that match the values in fields- Parameters:
values- List of GenericValuesfields- the field-name/value pairs that must match- Returns:
- List of GenericValue's that match the values in fields
-
filterByAnd
public static <T extends GenericValue> List<T> filterByAnd(List<T> values, List<? extends EntityExpr> exprs) returns the values that match the exprs in list- Parameters:
values- List of GenericValuesexprs- the expressions that must validate to true- Returns:
- List of GenericValue's that match the values in fields
-
orderBy
returns the values in the order specified- Parameters:
values- List of GenericValuesorderBy- The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending- Returns:
- List of GenericValue's in the proper order
-
getRelated
public static List<GenericValue> getRelated(String relationName, List<? extends GenericValue> values) throws GenericEntityException - Throws:
GenericEntityException
-
getRelatedCache
public static List<GenericValue> getRelatedCache(String relationName, List<? extends GenericValue> values) throws GenericEntityException - Throws:
GenericEntityException
-
getRelatedByAnd
public static List<GenericValue> getRelatedByAnd(String relationName, Map<String, ?> fields, List<? extends GenericValue> values) throws GenericEntityException- Throws:
GenericEntityException
-