Class SchemaFunction

java.lang.Object
com.labs64.netlicensing.schema.SchemaFunction

public final class SchemaFunction extends Object
SchemaFunction defines utility functions for the schema classes.
  • Method Details

    • propertyByName

      public static Property propertyByName(List<Property> properties, String name)
      Get Property by name. Property name is not case-sensitive!
      Parameters:
      properties - properties collection
      name - property name
      Returns:
      Property object or "null"-property (w/o value) if no property with the given name is present
    • propertyByName

      public static Property propertyByName(List<Property> properties, String name, String defaultValue)
      Get Property 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 collection
      name - property name
      defaultValue - default value to be used if no property found
      Returns:
      Property object with found or default value
    • propertyEncodedValueByName

      public static String propertyEncodedValueByName(List<Property> properties, String name)
      Get url-encoded Property value by name. Property name is not case-sensitive!
      Parameters:
      properties - properties collection
      name - property name
      Returns:
      {String} value or "null"-String if no property with the given name is present
    • entityPropertyByName

      public static Property entityPropertyByName(Map<String,String> properties, String name)
      Get Property derivative by name, converting it to Property. 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 collection
      name - property name
      Returns:
      Property object with found or empty value
    • findItemByProperty

      public static Item findItemByProperty(Netlicensing.Items items, String propertyName, String propertyValue)
      Get Item by existing property value. Comparison is not case-sensitive!
      Parameters:
      items - items collection
      propertyName - property name
      propertyValue - property value
      Returns:
      Item object or "null" if no property with the given name is present
    • findListByName

      public static List findListByName(Item item, String listName)
      Get List by name from Item.
      Parameters:
      item - item containing (multiple) lists
      listName - the value of the list "name" attribute
      Returns:
      List object or "null" if no list with the given name is present
    • addInfo

      public static void addInfo(Netlicensing netlicensing, String id, InfoEnum type, String value)
      Creates and adds Info object to Netlicensing object
      Parameters:
      netlicensing - Netlicensing object
      id - Info object identifier
      type - Info object type
      value - Info object value
    • hasErrorInfos

      public static boolean hasErrorInfos(Netlicensing entity)
      Check if Netlicensing object contains service errors.
      Parameters:
      entity - Netlicensing object to be checked
      Returns:
      true if any error have been found, otherwise false
    • infosToMessage

      public static String infosToMessage(Netlicensing response)
      Transform service infos to a string message.
      Parameters:
      response - service response (containing the infos)
      Returns:
      message string