Class PropertyHelper
java.lang.Object
org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper
PropertyHelper is used by the governance actions services to manage the contents of the ElementProperties structure.
It is a stateless object and so there are no threading concerns with declaring it as a static variable.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBooleanProperty
(ElementProperties properties, String propertyName, boolean propertyValue) Add the supplied property to an element properties object.addDateProperty
(ElementProperties properties, String propertyName, Date propertyValue) Add the supplied property to an element properties object.addEnumProperty
(ElementProperties properties, String propertyName, String propertyType, String symbolicName) Add the supplied property to an element properties object.addFloatProperty
(ElementProperties properties, String propertyName, float propertyValue) Add the supplied property to an element properties object.addIntProperty
(ElementProperties properties, String propertyName, int propertyValue) Add the supplied property to an element properties object.addLongProperty
(ElementProperties properties, String propertyName, long propertyValue) Add the supplied property to an element properties object.addMapProperty
(ElementProperties properties, String propertyName, Map<String, Object> mapValues) Add the supplied map property to an element properties object.addPropertyMap
(ElementProperties properties, Map<String, Object> mapValues) Add the supplied property map to an element properties object.addStringArrayProperty
(ElementProperties properties, String propertyName, List<String> arrayValues) Add the supplied array property to an element properties object.addStringMapProperty
(ElementProperties properties, String propertyName, Map<String, String> mapValues) Add the supplied map property to an element properties object.addStringProperty
(ElementProperties properties, String propertyName, String propertyValue) Add the supplied property to an element properties object.addStringPropertyMap
(ElementProperties properties, Map<String, String> mapValues) Add the supplied property map to an element properties object.getBooleanMapFromProperty
(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.boolean
getBooleanProperty
(String sourceName, String propertyName, ElementProperties properties, String methodName) Return the requested property or false if property is not found.getDateProperty
(String sourceName, String propertyName, ElementProperties properties, String methodName) Return the requested property or null if property is not found.getElementPropertiesAsMap
(ElementProperties properties) Convert an element properties object into a map.getIntegerMapFromProperty
(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.int
getIntProperty
(String sourceName, String propertyName, ElementProperties properties, String methodName) Return the requested property or 0 if property is not found.getLongMapFromProperty
(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.getMapFromProperty
(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.getSearchProperties
(ElementProperties properties, MatchCriteria matchCriteria) Convert the provided instance properties and match criteria into an equivalent SearchProperties object.getStringMapFromProperty
(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.getStringProperty
(String sourceName, String propertyName, ElementProperties properties, String methodName) Return the requested property or null if property is not found.void
validateGUID
(String guid, String guidParameter, String methodName) Throw an exception if the supplied GUID is nullvoid
validateMandatoryName
(String name, String nameParameter, String methodName) Throw an exception if the supplied name is null
-
Constructor Details
-
PropertyHelper
public PropertyHelper()
-
-
Method Details
-
validateGUID
public void validateGUID(String guid, String guidParameter, String methodName) throws InvalidParameterException Throw an exception if the supplied GUID is null- Parameters:
guid
- unique identifier to validateguidParameter
- name of the parameter that passed the guid.methodName
- name of the method making the call.- Throws:
InvalidParameterException
- the guid is null
-
validateMandatoryName
public void validateMandatoryName(String name, String nameParameter, String methodName) throws InvalidParameterException Throw an exception if the supplied name is null- Parameters:
name
- unique name to validatenameParameter
- name of the parameter that passed the name.methodName
- name of the method making the call.- Throws:
InvalidParameterException
- the name is null
-
addStringProperty
public ElementProperties addStringProperty(ElementProperties properties, String propertyName, String propertyValue) Add the supplied property to an element properties object. If the element property object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add property to, may be null.propertyName
- name of propertypropertyValue
- value of property- Returns:
- element properties object.
-
addIntProperty
public ElementProperties addIntProperty(ElementProperties properties, String propertyName, int propertyValue) Add the supplied property to an element properties object. If the element property object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add property to, may be null.propertyName
- name of propertypropertyValue
- value of property- Returns:
- resulting element properties object
-
addLongProperty
public ElementProperties addLongProperty(ElementProperties properties, String propertyName, long propertyValue) Add the supplied property to an element properties object. If the element property object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add. Property may be null.propertyName
- name of propertypropertyValue
- value of property- Returns:
- resulting element properties object
-
addFloatProperty
public ElementProperties addFloatProperty(ElementProperties properties, String propertyName, float propertyValue) Add the supplied property to an element properties object. If the element property object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add. Property may be null.propertyName
- name of propertypropertyValue
- value of property- Returns:
- resulting element properties object
-
addDateProperty
public ElementProperties addDateProperty(ElementProperties properties, String propertyName, Date propertyValue) Add the supplied property to an element properties object. If the element property object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add. Property may be null.propertyName
- name of propertypropertyValue
- value of property- Returns:
- resulting element properties object
-
addBooleanProperty
public ElementProperties addBooleanProperty(ElementProperties properties, String propertyName, boolean propertyValue) Add the supplied property to an element properties object. If the element property object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add property to, may be null.propertyName
- name of propertypropertyValue
- value of property- Returns:
- resulting element properties object
-
addEnumProperty
public ElementProperties addEnumProperty(ElementProperties properties, String propertyName, String propertyType, String symbolicName) Add the supplied property to an element properties object. If the element property object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add property to, may be null.propertyName
- name of propertypropertyType
- type of enumsymbolicName
- symbol name value of property- Returns:
- resulting element properties object
-
addStringArrayProperty
public ElementProperties addStringArrayProperty(ElementProperties properties, String propertyName, List<String> arrayValues) Add the supplied array property to an element properties object. The supplied array is stored as a single property in the instances properties. If the element properties object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add property to, may be null.propertyName
- name of propertyarrayValues
- contents of the array- Returns:
- resulting element properties object
-
addMapProperty
public ElementProperties addMapProperty(ElementProperties properties, String propertyName, Map<String, Object> mapValues) Add the supplied map property to an element properties object. The supplied map is stored as a single property in the instances properties. If the element properties object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add property to, may be null.propertyName
- name of propertymapValues
- contents of the map- Returns:
- resulting element properties object
-
addPropertyMap
Add the supplied property map to an element properties object. Each of the entries in the map is added as a separate property in element properties. If the element properties object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add property to, may be null.mapValues
- contents of the map- Returns:
- instance properties object.
-
addStringMapProperty
public ElementProperties addStringMapProperty(ElementProperties properties, String propertyName, Map<String, String> mapValues) Add the supplied map property to an element properties object. The supplied map is stored as a single property in the instances properties. If the element properties object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add property to, may be null.propertyName
- name of propertymapValues
- contents of the map- Returns:
- resulting element properties object
-
addStringPropertyMap
public ElementProperties addStringPropertyMap(ElementProperties properties, Map<String, String> mapValues) Add the supplied property map to an element properties object. Each of the entries in the map is added as a separate property in element properties. If the element properties object supplied is null, a new element properties object is created.- Parameters:
properties
- properties object to add property to, may be null.mapValues
- contents of the map- Returns:
- resulting element properties object
-
getStringMapFromProperty
public Map<String,String> getStringMapFromProperty(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.- Parameters:
sourceName
- source of callpropertyName
- name of requested map propertyproperties
- values of the propertymethodName
- method of caller- Returns:
- map property value or null
-
getBooleanMapFromProperty
public Map<String,Boolean> getBooleanMapFromProperty(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.- Parameters:
sourceName
- source of callpropertyName
- name of requested map propertyproperties
- values of the propertymethodName
- method of caller- Returns:
- map property value or null
-
getLongMapFromProperty
public Map<String,Long> getLongMapFromProperty(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.- Parameters:
sourceName
- source of callpropertyName
- name of requested map propertyproperties
- values of the propertymethodName
- method of caller- Returns:
- map property value or null
-
getIntegerMapFromProperty
public Map<String,Integer> getIntegerMapFromProperty(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.- Parameters:
sourceName
- source of callpropertyName
- name of requested map propertyproperties
- values of the propertymethodName
- method of caller- Returns:
- map property value or null
-
getMapFromProperty
public Map<String,Object> getMapFromProperty(String sourceName, String propertyName, ElementProperties properties, String methodName) Locates and extracts a property from an instance that is of type map and then converts its values into a Java map.- Parameters:
sourceName
- source of callpropertyName
- name of requested map propertyproperties
- all the properties of the instancemethodName
- method of caller- Returns:
- map property value or null
-
getElementPropertiesAsMap
Convert an element properties object into a map.- Parameters:
properties
- packed properties- Returns:
- properties stored in Java map
-
getStringProperty
public String getStringProperty(String sourceName, String propertyName, ElementProperties properties, String methodName) Return the requested property or null if property is not found. If the property is not a string property then a logic exception is thrown- Parameters:
sourceName
- source of callpropertyName
- name of requested propertyproperties
- properties from the instance.methodName
- method of caller- Returns:
- string property value or null
-
getIntProperty
public int getIntProperty(String sourceName, String propertyName, ElementProperties properties, String methodName) Return the requested property or 0 if property is not found. If the property is not an int property then a logic exception is thrown.- Parameters:
sourceName
- source of callpropertyName
- name of requested propertyproperties
- properties from the instance.methodName
- method of caller- Returns:
- string property value or null
-
getDateProperty
public Date getDateProperty(String sourceName, String propertyName, ElementProperties properties, String methodName) Return the requested property or null if property is not found. If the property is not a date property then a logic exception is thrown.- Parameters:
sourceName
- source of callpropertyName
- name of requested propertyproperties
- properties from the instance.methodName
- method of caller- Returns:
- string property value or null
-
getBooleanProperty
public boolean getBooleanProperty(String sourceName, String propertyName, ElementProperties properties, String methodName) Return the requested property or false if property is not found. If the property is not a boolean property then a logic exception is thrown- Parameters:
sourceName
- source of callpropertyName
- name of requested propertyproperties
- properties from the instance.methodName
- method of caller- Returns:
- string property value or null
-
getSearchProperties
public SearchProperties getSearchProperties(ElementProperties properties, MatchCriteria matchCriteria) Convert the provided instance properties and match criteria into an equivalent SearchProperties object.- Parameters:
properties
- properties object to convertmatchCriteria
- match criteria to apply- Returns:
- SearchProperties object.
-