Package org.cristalise.kernel.property
Class PropertyUtility
java.lang.Object
org.cristalise.kernel.property.PropertyUtility
Utility class to handle operations of ItemProperties and their description
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckProperty(ItemPath item, String name, TransactionKey transactionKey) static booleancheckProperty(ItemPath item, BuiltInItemProperties prop, TransactionKey transactionKey) static CastorHashMapConverts transitive PropertyDescriptions to VertexProprties (CastorHashMap).static StringgetClassIdNames(ArrayList<PropertyDescription> pdlist) static StringgetDefaultValue(List<PropertyDescription> pdlist, String name) Reads the default value of the Propertystatic StringgetNames(ArrayList<PropertyDescription> pdlist) static PropertygetProperty(ItemPath itemPath, String propName, TransactionKey transactionKey) static PropertygetProperty(ItemPath itemPath, BuiltInItemProperties prop, TransactionKey transactionKey) static PropertyDescriptionListgetPropertyDescriptionOutcome(ItemPath itemPath, String descVer, TransactionKey transactionKey) Reads the PropertyDescriptionList either from a built-in type of Item using LocalObjectLoader or from the 'last' Viewpoint of the 'PropertyDescription' Outcome in the Item (very likely a Factory Item).static StringgetPropertyValue(ItemPath item, String name, String defaultValue, TransactionKey transactionKey) static StringgetPropertyValue(ItemPath item, BuiltInItemProperties prop, String defaultValue, TransactionKey transactionKey) static StringgetValue(ArrayList<PropertyDescription> pdlist, String name) Deprecated.Badly named method, use getDefaultValue() insteadstatic booleanpropertyExists(ItemPath itemPath, String propName, TransactionKey transactionKey) static voidwriteProperty(ItemPath item, String name, String value, TransactionKey transactionKey) Updates (writes) the value of an existing Propertystatic voidwriteProperty(ItemPath item, BuiltInItemProperties prop, String value, TransactionKey transactionKey) Updates (writes) the value of an existing Property
-
Constructor Details
-
PropertyUtility
public PropertyUtility()
-
-
Method Details
-
getValue
Deprecated.Badly named method, use getDefaultValue() insteadReads the default value of the Property- Parameters:
pdlist- the list of Properties to searchname- name of the Property to search for- Returns:
- the defeult value of the property. Can be null.
-
getDefaultValue
Reads the default value of the Property- Parameters:
pdlist- the list of Properties to searchname- name of the Property to search for- Returns:
- the defeult value of the property. Can be null.
-
propertyExists
public static boolean propertyExists(ItemPath itemPath, String propName, TransactionKey transactionKey) - Parameters:
itemPath-propName-transactionKey-- Returns:
-
getProperty
public static Property getProperty(ItemPath itemPath, BuiltInItemProperties prop, TransactionKey transactionKey) throws ObjectNotFoundException - Parameters:
itemPath-prop-transactionKey-- Returns:
- Throws:
ObjectNotFoundException
-
getProperty
public static Property getProperty(ItemPath itemPath, String propName, TransactionKey transactionKey) throws ObjectNotFoundException - Parameters:
itemPath-propName-transactionKey-- Returns:
- Throws:
ObjectNotFoundException
-
getNames
- Parameters:
pdlist-- Returns:
-
getClassIdNames
- Parameters:
pdlist-- Returns:
-
getPropertyDescriptionOutcome
public static PropertyDescriptionList getPropertyDescriptionOutcome(ItemPath itemPath, String descVer, TransactionKey transactionKey) throws ObjectNotFoundException Reads the PropertyDescriptionList either from a built-in type of Item using LocalObjectLoader or from the 'last' Viewpoint of the 'PropertyDescription' Outcome in the Item (very likely a Factory Item).- Parameters:
itemPath- the Item containing the PropertyDescriptionListdescVer- the version of the PropertyDescriptionListtransactionKey- transaction key- Returns:
- the PropertyDescriptionList
- Throws:
ObjectNotFoundException- PropertyDescriptionList cannot be retrieved
-
convertTransitiveProperties
Converts transitive PropertyDescriptions to VertexProprties (CastorHashMap). ClassIdentifiers are transitive by default.- Parameters:
pdList- the PropertyDescriptions to be used- Returns:
- the initialised CastorHashMap
-
writeProperty
public static void writeProperty(ItemPath item, BuiltInItemProperties prop, String value, TransactionKey transactionKey) throws PersistencyException, ObjectCannotBeUpdated, ObjectNotFoundException Updates (writes) the value of an existing Property- Parameters:
item- the Path (UUID) of actual Itemprop- the BuiltIn ItemProperty to writevalue- the value of the PropertytransactionKey- transaction key- Throws:
PersistencyException- something went wrong updating the databaseObjectCannotBeUpdated- the Property is immutableObjectNotFoundException- there is no Property with the given name
-
writeProperty
public static void writeProperty(ItemPath item, String name, String value, TransactionKey transactionKey) throws PersistencyException, ObjectCannotBeUpdated, ObjectNotFoundException Updates (writes) the value of an existing Property- Parameters:
item- the Path (UUID) of actual Itemname- the name of the Property to writevalue- the value of the PropertytransactionKey- transaction key- Throws:
PersistencyException- something went wrong updating the databaseObjectCannotBeUpdated- the Property is immutableObjectNotFoundException- there is no Property with the given name
-
checkProperty
public static boolean checkProperty(ItemPath item, BuiltInItemProperties prop, TransactionKey transactionKey) - Parameters:
item-prop-transactionKey-- Returns:
-
checkProperty
- Parameters:
item-name-transactionKey-- Returns:
-
getPropertyValue
public static String getPropertyValue(ItemPath item, BuiltInItemProperties prop, String defaultValue, TransactionKey transactionKey) - Parameters:
item-prop-defaultValue-transactionKey-- Returns:
-
getPropertyValue
public static String getPropertyValue(ItemPath item, String name, String defaultValue, TransactionKey transactionKey) - Parameters:
item-name-defaultValue-transactionKey-- Returns:
-