Class PropertyJDBC

java.lang.Object
de.hybris.platform.persistence.property.PropertyJDBC

public final class PropertyJDBC extends Object
this class reads and writes new style (typed) properties via JDBC
  • Field Details

  • Constructor Details

    • PropertyJDBC

      public PropertyJDBC()
  • Method Details

    • cutStringToByteLength

      public static String cutStringToByteLength(String str, int max)
      truncates a string to a certain byte length. is assumes that each non-ascii character takes 2 bytes space which is considered for how much has to be cut off.
      Parameters:
      max - the allowed max byte length
    • preloadLocalizedProperties

      public static void preloadLocalizedProperties(Set<PK> langPKs, Collection<LocalizableItemRemote> _items)
    • createProperties

      public static EJBPropertyRowCache createProperties(TypeInfoMap infoMap, PK itemPK, PK typePK, PK langPK, long timestamp)
    • getProperties

      public static EJBPropertyRowCache getProperties(TypeInfoMap infoMap, PK itemPK, PK typePK, PK langPK, long timestamp)
      reads all unlocalized or localized properties of one language for a specified item in a property cache object.
      Parameters:
      itemPK - the PK of the item these properties belong to
      typePK - the item type - this is needed to get the correct TypeInfoMap
      langPK - the language PK of the properties, or null for unlocalized properties
      timestamp - the property timestamp of the item - the propert cache uses this to check later if it is uptodate
    • updatePropertyTypePKs

      public static void updatePropertyTypePKs(TypeInfoMap infoMap, PK itemPK, PK newTypePK)
      changes all property data rows of one item to the new type pk. this will not invalidate any of its property caches - so make sure they are reloaded when the type has changed
    • writeProperties

      public static void writeProperties(EJBPropertyRowCache prc, PK itemPK, PK typePK, TypeInfoMap infoMap, boolean localized)
      saves all changed properties of one property cache.
      Parameters:
      prc - the (modified) property cache
      infoMap - provides the correct columns and value classes for these properties
    • getChangeData

      public static List<Object>[] getChangeData(Connection con, TypeInfoMap infoMap, EJBPropertyRowCache prc, boolean localized) throws SQLException
      for a modified property cache this puts together the list of columns, values and value classes. use these to build and fill you SQL statements.
      Parameters:
      infoMap - provides column names and value classes for properties
      prc - the modified property cache
      localized - tells if localized or unlocalized properties should be written - used for checking correctness of data
      con - the database connection
      Returns:
      ([column - name, value, ValueWriter ])
      Throws:
      SQLException
    • removeAllPropertyData

      public static void removeAllPropertyData(PK itemPK, PK typePK)
      removes all property rows for a item.
      Parameters:
      itemPK - the item to remove properties for
      typePK - used for getting the correct TypeInfoMap
    • readPropertyRow

      public static EJBPropertyRowCache readPropertyRow(ResultSet rs, PK itemPK, PK itemTypePK, PK langPK, long timestamp, TypeInfoMap infoMap) throws SQLException
      Throws:
      SQLException