Class EJBTools

java.lang.Object
de.hybris.platform.util.EJBTools

public abstract class EJBTools extends Object
tools that are useful when writing own EJBs for the hybris system.
  • Field Details

    • ITEMCOLLECTION_TYPE_MARKER

      public static final String ITEMCOLLECTION_TYPE_MARKER
    • EMPTY_PK_COLLECTION_STRING

      public static final String EMPTY_PK_COLLECTION_STRING
  • Constructor Details

    • EJBTools

      public EJBTools()
  • Method Details

    • removeBeanCollection

      public static void removeBeanCollection(Collection<? extends ItemRemote> c)
      Removes a collection of ItemRemotes.

    • removeAllRowsFromTable

      public static void removeAllRowsFromTable(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 Collection instantiateItemPropertyValueCollection(Collection ipvs)
    • createItemPropertyValue

      public static ItemPropertyValue createItemPropertyValue(ItemRemote item)
      Parameters:
      item - may be null, will return null
    • instantiatePKCollection

      public static List instantiatePKCollection(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, a null 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.
    • instantiateCommaSeparatedPKString

      public static List instantiateCommaSeparatedPKString(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, a null is 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.
    • instantiateCommaSeparatedPKString

      public static List instantiateCommaSeparatedPKString(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, a null is returned or an empty collection if ignoreNull was set to true .
      • 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.
    • getPK

      public static PK getPK(ItemRemote remote)
    • getPKInLIKEFragment

      public static 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 List<PK> toPKList(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.
    • getPKCollectionString

      public static String getPKCollectionString(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.
    • addPKToPKCollectionString

      public static String addPKToPKCollectionString(String pkCollectionString, PK pk)
    • getPKCollection

      public static List<String> getPKCollection(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(String value)
    • convertToDatabase

      public static String convertToDatabase(String realString)
      utility function to cope with behaviour of Oracle, with cannot distinguish between null and empty strings
      See Also:
    • convertFromDatabase

      public static String convertFromDatabase(String databaseString)
      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) from s to real Entities
      Parameters:
      finderResult - the finder result
      Returns:
      the entity or collection of entities
      Throws:
      YFinderException