Package com.labs64.netlicensing.schema
Class SchemaFunction
java.lang.Object
com.labs64.netlicensing.schema.SchemaFunction
SchemaFunction defines utility functions for the schema classes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addInfo
(Netlicensing netlicensing, String id, InfoEnum type, String value) Creates and addsInfo
object toNetlicensing
objectstatic Property
entityPropertyByName
(Map<String, String> properties, String name) static Item
findItemByProperty
(Netlicensing.Items items, String propertyName, String propertyValue) GetItem
by existing property value.static List
findListByName
(Item item, String listName) static boolean
hasErrorInfos
(Netlicensing entity) Check ifNetlicensing
object contains service errors.static String
infosToMessage
(Netlicensing response) Transform service infos to a string message.static Property
propertyByName
(List<Property> properties, String name) GetProperty
by name.static Property
propertyByName
(List<Property> properties, String name, String defaultValue) GetProperty
by name.static String
propertyEncodedValueByName
(List<Property> properties, String name) Get url-encoded Property value by name.
-
Method Details
-
propertyByName
GetProperty
by name. Property name is not case-sensitive!- Parameters:
properties
- properties collectionname
- property name- Returns:
Property
object or "null"-property (w/o value) if no property with the given name is present
-
propertyByName
GetProperty
by name. Property name is not case-sensitive! If property with the given name is not found, a property with provided default value is returned.- Parameters:
properties
- properties collectionname
- property namedefaultValue
- default value to be used if no property found- Returns:
Property
object with found or default value
-
propertyEncodedValueByName
Get url-encoded Property value by name. Property name is not case-sensitive!- Parameters:
properties
- properties collectionname
- property name- Returns:
- {String} value or "null"-String if no property with the given name is present
-
entityPropertyByName
GetProperty
derivative by name, converting it toProperty
. Property name is not case-sensitive! If property with the given name is not found, a property with empty value is returned.- Parameters:
properties
- properties collectionname
- property name- Returns:
Property
object with found or empty value
-
findItemByProperty
public static Item findItemByProperty(Netlicensing.Items items, String propertyName, String propertyValue) GetItem
by existing property value. Comparison is not case-sensitive!- Parameters:
items
- items collectionpropertyName
- property namepropertyValue
- property value- Returns:
Item
object or "null" if no property with the given name is present
-
findListByName
- Parameters:
item
- item containing (multiple) listslistName
- the value of the list "name" attribute- Returns:
List
object or "null" if no list with the given name is present
-
addInfo
Creates and addsInfo
object toNetlicensing
object- Parameters:
netlicensing
-Netlicensing
objectid
-Info
object identifiertype
-Info
object typevalue
-Info
object value
-
hasErrorInfos
Check ifNetlicensing
object contains service errors.- Parameters:
entity
-Netlicensing
object to be checked- Returns:
- true if any error have been found, otherwise false
-
infosToMessage
Transform service infos to a string message.- Parameters:
response
- service response (containing the infos)- Returns:
- message string
-