Package de.hybris.platform.util
Class EJBTools
- java.lang.Object
-
- de.hybris.platform.util.EJBTools
-
public abstract class EJBTools extends java.lang.Objecttools that are useful when writing own EJBs for the hybris system.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEMPTY_PK_COLLECTION_STRINGstatic java.lang.StringITEMCOLLECTION_TYPE_MARKER
-
Constructor Summary
Constructors Constructor Description EJBTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringaddPKToPKCollectionString(java.lang.String pkCollectionString, PK pk)static java.lang.ObjectconvertEntityFinderResult(java.lang.Object finderResult, SystemEJB sys)converts the result of a EJBHome finder method (findXY) froms to real Entities static java.lang.StringconvertFromDatabase(java.lang.String databaseString)utility function to cope with behaviour of Oracle, with cannot distinguish between null and empty stringsstatic java.lang.StringconvertToDatabase(java.lang.String realString)utility function to cope with behaviour of Oracle, with cannot distinguish between null and empty stringsstatic ItemPropertyValuecreateItemPropertyValue(ItemRemote item)static ItemPropertyValueCollectiongetCollectionFromString(java.lang.String value)static PKgetPK(ItemRemote remote)static java.util.List<java.lang.String>getPKCollection(java.lang.String pks)static java.lang.StringgetPKCollectionString(java.util.Collection items)Converts a collection of Items to a String with comma-seperated PKs.static java.lang.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 java.util.ListinstantiateCommaSeparatedPKString(java.lang.String pks)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 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 java.util.ListinstantiateCommaSeparatedPKString(java.lang.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 ItemRemoteinstantiateItemPropertyValue(ItemPropertyValue ipv)static java.util.CollectioninstantiateItemPropertyValueCollection(java.util.Collection ipvs)static ItemRemoteinstantiatePK(PK pk)static java.util.ListinstantiatePKCollection(java.util.Collection<PK> pks)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 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(java.lang.String tablename)static voidremoveBeanCollection(java.util.Collection<? extends ItemRemote> c)Removes a collection of ItemRemotes.static java.util.List<PK>toPKList(java.util.Collection items)Converts a collection of Items, ItemRemotes or ItemPropertyValues to a Collection of PKs.
-
-
-
Method Detail
-
removeBeanCollection
public static void removeBeanCollection(java.util.Collection<? extends ItemRemote> c)
Removes a collection of ItemRemotes.
-
removeAllRowsFromTable
public static void removeAllRowsFromTable(java.lang.String tablename)
-
instantiatePK
public static final ItemRemote instantiatePK(PK pk)
-
instantiateItemPropertyValue
public static ItemRemote instantiateItemPropertyValue(ItemPropertyValue ipv)
- Parameters:
ipv- may be null, will return null
-
instantiateItemPropertyValueCollection
public static java.util.Collection instantiateItemPropertyValueCollection(java.util.Collection ipvs)
-
createItemPropertyValue
public static ItemPropertyValue createItemPropertyValue(ItemRemote item)
- Parameters:
item- may be null, will return null
-
instantiatePKCollection
public static java.util.List instantiatePKCollection(java.util.Collection<PK> pks)
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
public static java.util.List instantiateCommaSeparatedPKString(java.lang.String pks)
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
public static java.util.List instantiateCommaSeparatedPKString(java.lang.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 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
public static PK getPK(ItemRemote remote)
-
getPKInLIKEFragment
public static java.lang.String getPKInLIKEFragment(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)}.
-
toPKList
public static java.util.List<PK> toPKList(java.util.Collection items)
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
public static java.lang.String getPKCollectionString(java.util.Collection items)
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
public static java.lang.String addPKToPKCollectionString(java.lang.String pkCollectionString, PK pk)
-
getPKCollection
public static java.util.List<java.lang.String> getPKCollection(java.lang.String pks)
- Returns:
- A collection of primary key strings, which has been build from a comma separated list in parameter pks.
-
getCollectionFromString
public static ItemPropertyValueCollection getCollectionFromString(java.lang.String value)
-
convertToDatabase
public static java.lang.String convertToDatabase(java.lang.String realString)
utility function to cope with behaviour of Oracle, with cannot distinguish between null and empty strings- See Also:
convertFromDatabase(java.lang.String)
-
convertFromDatabase
public static java.lang.String convertFromDatabase(java.lang.String databaseString)
utility function to cope with behaviour of Oracle, with cannot distinguish between null and empty strings- See Also:
convertToDatabase(java.lang.String)
-
convertEntityFinderResult
public static java.lang.Object convertEntityFinderResult(java.lang.Object finderResult, SystemEJB sys) throws YFinderExceptionconverts 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
-
-