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 voidaddInfo(Netlicensing netlicensing, String id, InfoEnum type, String value) Creates and addsInfoobject toNetlicensingobjectstatic PropertyentityPropertyByName(Map<String, String> properties, String name) static ItemfindItemByProperty(Netlicensing.Items items, String propertyName, String propertyValue) GetItemby existing property value.static ListfindListByName(Item item, String listName) static booleanhasErrorInfos(Netlicensing entity) Check ifNetlicensingobject contains service errors.static StringinfosToMessage(Netlicensing response) Transform service infos to a string message.static PropertypropertyByName(List<Property> properties, String name) GetPropertyby name.static PropertypropertyByName(List<Property> properties, String name, String defaultValue) GetPropertyby name.static StringpropertyEncodedValueByName(List<Property> properties, String name) Get url-encoded Property value by name.
-
Method Details
-
propertyByName
GetPropertyby name. Property name is not case-sensitive!- Parameters:
properties- properties collectionname- property name- Returns:
Propertyobject or "null"-property (w/o value) if no property with the given name is present
-
propertyByName
GetPropertyby 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:
Propertyobject 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
GetPropertyderivative 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:
Propertyobject with found or empty value
-
findItemByProperty
public static Item findItemByProperty(Netlicensing.Items items, String propertyName, String propertyValue) GetItemby existing property value. Comparison is not case-sensitive!- Parameters:
items- items collectionpropertyName- property namepropertyValue- property value- Returns:
Itemobject 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:
Listobject or "null" if no list with the given name is present
-
addInfo
Creates and addsInfoobject toNetlicensingobject- Parameters:
netlicensing-Netlicensingobjectid-Infoobject identifiertype-Infoobject typevalue-Infoobject value
-
hasErrorInfos
Check ifNetlicensingobject contains service errors.- Parameters:
entity-Netlicensingobject 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
-