Package de.hybris.platform.util
Class EJBTools
java.lang.Object
de.hybris.platform.util.EJBTools
tools that are useful when writing own EJBs for the hybris system.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddPKToPKCollectionString(String pkCollectionString, PK pk) static ObjectconvertEntityFinderResult(Object finderResult, SystemEJB sys) converts the result of a EJBHome finder method (findXY) froms to real Entities static StringconvertFromDatabase(String databaseString) utility function to cope with behaviour of Oracle, with cannot distinguish between null and empty stringsstatic StringconvertToDatabase(String realString) utility function to cope with behaviour of Oracle, with cannot distinguish between null and empty stringsstatic ItemPropertyValuestatic ItemPropertyValueCollectiongetCollectionFromString(String value) static PKgetPK(ItemRemote remote) getPKCollection(String pks) static StringgetPKCollectionString(Collection items) Converts a collection of Items to a String with comma-seperated PKs.static StringgetPKInLIKEFragment(ItemRemote remote) Returns a SQL LIKE fragment which should be used to find a single remote object within a pk collection string (@see #getPKCollectionString(Collection)}.static ListCreates a Collection of EJBObject from a given String with comma seperated PKs.
Use this method from inside a bean if you want to get a List of existing EJBObjects from a comma seperated PK String.
If the String wasnull, anullis returned If the String was en empty string, an empty collection is returned if one of the EJBObjects could not be found, a warning is printed to the System.err stream and the resulting collection will not contain this EJBObject.static ListinstantiateCommaSeparatedPKString(String pks, boolean ignoreNull) Creates a Collection of EJBObject from a given String with comma seperated PKs.
Use this method from inside a bean if you want to get a List of existing EJBObjects from a comma seperated PK String.
If the String wasnull, anullis returned or an empty collection ifignoreNullwas set totrue.static ItemRemotestatic Collectionstatic final ItemRemoteinstantiatePK(PK pk) static ListCreates a Collection of EJBObject from a given Collection of EJB PK String.
Use this method from inside a bean if you want to get a List of existing EJBObjects from a given Collection of PK.
If the PK-Collection wasnull, anullis returned if one of the EJBObjects could not be found, a warning is printed to the System.err stream and the resulting collection will not contain this EJBObject.static voidremoveAllRowsFromTable(String tablename) static voidremoveBeanCollection(Collection<? extends ItemRemote> c) Removes a collection of ItemRemotes.toPKList(Collection items) Converts a collection of Items, ItemRemotes or ItemPropertyValues to a Collection of PKs.
-
Field Details
-
ITEMCOLLECTION_TYPE_MARKER
-
EMPTY_PK_COLLECTION_STRING
-
-
Constructor Details
-
EJBTools
public EJBTools()
-
-
Method Details
-
removeBeanCollection
Removes a collection of ItemRemotes. -
removeAllRowsFromTable
-
instantiatePK
-
instantiateItemPropertyValue
- Parameters:
ipv- may be null, will return null
-
instantiateItemPropertyValueCollection
-
createItemPropertyValue
- Parameters:
item- may be null, will return null
-
instantiatePKCollection
Creates a Collection of EJBObject from a given Collection of EJB PK String.
Use this method from inside a bean if you want to get a List of existing EJBObjects from a given Collection of PK.
- If the PK-Collection was
null, anullis returned - if one of the EJBObjects could not be found, a warning is printed to the System.err stream and the resulting collection will not contain this EJBObject.
- If the PK-Collection was
-
instantiateCommaSeparatedPKString
Creates a Collection of EJBObject from a given String with comma seperated PKs.
Use this method from inside a bean if you want to get a List of existing EJBObjects from a comma seperated PK String.
- If the String was
null, anullis returned - If the String was en empty string, an empty collection is returned
- if one of the EJBObjects could not be found, a warning is printed to the System.err stream and the resulting collection will not contain this EJBObject.
- If the String was
-
instantiateCommaSeparatedPKString
Creates a Collection of EJBObject from a given String with comma seperated PKs.
Use this method from inside a bean if you want to get a List of existing EJBObjects from a comma seperated PK String.
- If the String was
null, anullis returned or an empty collection ifignoreNullwas set totrue. - If the String was en empty string, an empty collection is returned
- if one of the EJBObjects could not be found, a warning is printed to the System.err stream and the resulting collection will not contain this EJBObject.
- If the String was
-
getPK
-
getPKInLIKEFragment
Returns a SQL LIKE fragment which should be used to find a single remote object within a pk collection string (@see #getPKCollectionString(Collection)}. -
toPKList
Converts a collection of Items, ItemRemotes or ItemPropertyValues to a Collection of PKs.- if the collection is null, a null is returned.
- If the collection is empty, an empty collection is returned.
- If a pk could not be retrieved due to an exception in
getPrimaryKey()a EJBSystemException is thrown.
- if the collection is null, a null is returned.
-
getPKCollectionString
Converts a collection of Items to a String with comma-seperated PKs.- If the collection is null, a null is returned.
- If the collection is empty, the string "," is returned.
- If a pk could not be retrieved due to an exception in
getPrimaryKey()a EJBSystemException is thrown.
- If the collection is null, a null is returned.
-
addPKToPKCollectionString
-
getPKCollection
- Returns:
- A collection of primary key strings, which has been build from a comma separated list in parameter pks.
-
getCollectionFromString
-
convertToDatabase
utility function to cope with behaviour of Oracle, with cannot distinguish between null and empty strings- See Also:
-
convertFromDatabase
utility function to cope with behaviour of Oracle, with cannot distinguish between null and empty strings- See Also:
-
convertEntityFinderResult
public static Object convertEntityFinderResult(Object finderResult, SystemEJB sys) throws YFinderException converts the result of a EJBHome finder method (findXY) froms to real Entities - Parameters:
finderResult- the finder result- Returns:
- the entity or collection of entities
- Throws:
YFinderException
-