Class PropertyJDBC
- java.lang.Object
-
- de.hybris.platform.persistence.property.PropertyJDBC
-
public final class PropertyJDBC extends java.lang.Object
this class reads and writes new style (typed) properties via JDBC
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ITEMPK
static java.lang.String
ITEMTYPEPK
static java.lang.String
LANGPK
static java.lang.String
REAL_PK
static java.lang.String
REAL_TYPEPK
-
Constructor Summary
Constructors Constructor Description PropertyJDBC()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EJBPropertyRowCache
createProperties(TypeInfoMap infoMap, PK itemPK, PK typePK, PK langPK, long timestamp)
static java.lang.String
cutStringToByteLength(java.lang.String str, int max)
truncates a string to a certain byte length.static java.util.List<java.lang.Object>[]
getChangeData(java.sql.Connection con, TypeInfoMap infoMap, EJBPropertyRowCache prc, boolean localized)
for a modified property cache this puts together the list of columns, values and value classes.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.static void
preloadLocalizedProperties(java.util.Set<PK> langPKs, java.util.Collection<LocalizableItemRemote> _items)
static EJBPropertyRowCache
readPropertyRow(java.sql.ResultSet rs, PK itemPK, PK itemTypePK, PK langPK, long timestamp, TypeInfoMap infoMap)
static void
removeAllPropertyData(PK itemPK, PK typePK)
removes all property rows for a item.static void
updatePropertyTypePKs(TypeInfoMap infoMap, PK itemPK, PK newTypePK)
changes all property data rows of one item to the new type pk.static void
writeProperties(EJBPropertyRowCache prc, PK itemPK, PK typePK, TypeInfoMap infoMap, boolean localized)
saves all changed properties of one property cache.
-
-
-
Field Detail
-
REAL_PK
public static final java.lang.String REAL_PK
- See Also:
- Constant Field Values
-
REAL_TYPEPK
public static final java.lang.String REAL_TYPEPK
- See Also:
- Constant Field Values
-
ITEMPK
public static final java.lang.String ITEMPK
- See Also:
- Constant Field Values
-
LANGPK
public static final java.lang.String LANGPK
- See Also:
- Constant Field Values
-
ITEMTYPEPK
public static final java.lang.String ITEMTYPEPK
- See Also:
- Constant Field Values
-
-
Method Detail
-
cutStringToByteLength
public static java.lang.String cutStringToByteLength(java.lang.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(java.util.Set<PK> langPKs, java.util.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 totypePK
- the item type - this is needed to get the correctTypeInfoMap
langPK
- the language PK of the properties, ornull
for unlocalized propertiestimestamp
- 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 cacheinfoMap
- provides the correct columns and value classes for these properties
-
getChangeData
public static java.util.List<java.lang.Object>[] getChangeData(java.sql.Connection con, TypeInfoMap infoMap, EJBPropertyRowCache prc, boolean localized) throws java.sql.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 propertiesprc
- the modified property cachelocalized
- tells if localized or unlocalized properties should be written - used for checking correctness of datacon
- the database connection- Returns:
- ([column - name, value, ValueWriter ])
- Throws:
java.sql.SQLException
-
removeAllPropertyData
public static void removeAllPropertyData(PK itemPK, PK typePK)
removes all property rows for a item.- Parameters:
itemPK
- the item to remove properties fortypePK
- used for getting the correctTypeInfoMap
-
readPropertyRow
public static EJBPropertyRowCache readPropertyRow(java.sql.ResultSet rs, PK itemPK, PK itemTypePK, PK langPK, long timestamp, TypeInfoMap infoMap) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-