Class AttributeUtils

java.lang.Object
com.emc.d2fs.utils.AttributeUtils

public class AttributeUtils extends Object
  • Field Details

  • Constructor Details

    • AttributeUtils

      public AttributeUtils()
  • Method Details

    • getRenderingOptionFromList

      public static RenderingOption getRenderingOptionFromList(List<RenderingOption> renderingOptions, String attributeName)
      Search in the list the renderingOption with the name given in parameter.
      Parameters:
      renderingOptions - a List of RenderingOptions.
      attributeName - the key of the renderingOption to find in the list.
      Returns:
      the renderingOption found or null
    • getAttributeFromList

      public static Attribute getAttributeFromList(List<Attribute> attributes, String attributeName)
      Search in the list the attribute with the name given in parameter.
      Parameters:
      attributes - a List of Attributes.
      attributeName - the name of the attribute to find in the list.
      Returns:
      the attribute found or null
    • getCloneOfAttrList

      public static List<Attribute> getCloneOfAttrList(List<Attribute> generalAttributes)
      Search in the list the attribute with the name given in parameter.
      Parameters:
      List - of Attributes a List of Attributes.
      Returns:
      List of encrypted Attributes
    • hasAttributeInList

      public static boolean hasAttributeInList(List<Attribute> attributes, String attributeName)
      Search in the list the attribute with the name given in parameter.
      Parameters:
      attributes - a List of Attributes.
      attributeName - the name of the attribute to find in the list.
      Returns:
      the attribute found or null
    • getValueFromList

      public static String getValueFromList(List<Attribute> attributes, String attributeName)
      Search in the list the value of the attribute with the name given in parameter.
      Parameters:
      attributes - a List of Attributes.
      attributeName - the name of the attribute to find in the list.
      Returns:
      String the value of the attribute found or null
    • getValueFromList

      public static String getValueFromList(List<Attribute> attributes, String attributeName, String defaultValue)
    • getBooleanValueFromList

      public static boolean getBooleanValueFromList(List<Attribute> attributes, String attributeName, boolean defaultValue)
    • updateListAndResetValues

      public static void updateListAndResetValues(List<Attribute> attributes, List<Attribute> attributesToAdd, boolean override)
      Merges the first Attribute list with the Second Attribute list. Elements removed from attributesToAdd are also removed from source list.
      Parameters:
      attributes - The Attribute List to Update.
      attributesToAdd - The Attribute List to add to the source list.
      override - if true, any similar attribute will be overridden
    • updateListWithList

      public static List<Attribute> updateListWithList(List<Attribute> attributes, List<Attribute> attributesToAdd)
      Merge the first Attribute list with the Second Attribute list into a new list. THIS WILL NOT ACTUALLY UPDATE THE INITIAL LIST
      Parameters:
      attributes - The Attribute List to Update.
      attributesToAdd - The Attribute List to add to the source list.
      Returns:
      The Attribute List updated.
    • updateListWithList

      public static void updateListWithList(List<Attribute> attributes, List<Attribute> attributesToAdd, boolean override)
      Merge the first Attribute list with the Second Attribute list.
      Parameters:
      attributes - The Attribute List to Update.
      attributesToAdd - The Attribute List to add to the source list.
      override - if true, any similar attribute will be overridden
    • updateListWithAttribute

      public static List<Attribute> updateListWithAttribute(List<Attribute> attributes, Attribute attribute)
      Add the Attribute given in parameter in the Attribute List. If Attribute exist in the list, just update values.
      Parameters:
      attributes - a List of Attribute
      attribute - The Attribute to add or Update to the list.
      Returns:
      The Attribute List updated.
    • convertMapToAttributes

      public static List<Attribute> convertMapToAttributes(Map<String,String> map)
      Convert the map of value into list of attributes.
      Parameters:
      map -
      Returns:
      List of Attribute objects
    • convertModelMapToAttributes

      public static List<Attribute> convertModelMapToAttributes(Map<String,Object> map)
      Convert the data from a model into list of attributes.
      Parameters:
      map -
      Returns:
      List of Attribute objects
    • convertAttributesToMap

      public static Map<String,String> convertAttributesToMap(List<Attribute> attributes, List<String> filterAttributes)
      Convert the list of attributes into a map.
      Parameters:
      attributes - a List of Attributes.
      filterAttributes - the name of the attribute to keep in the mapping. if filter list is empty or null, all attributes will be mapped
      Returns:
      mapping
    • createAttribute

      public static Attribute createAttribute(String name, String value, int type, Boolean isAttrRepeating)
      Create an Attribute with the name and the value passing in parameter. with the type number correctly set.
      Parameters:
      name - String the name of the Attribute
      value - String The value of the Attribute
      type - int the Df type of the value.
      type - Boolean the Df type of the value.
      Returns:
      New Attribute object
    • createAttribute

      public static Attribute createAttribute(String name, String value, int type)
      Create an Attribute with the name and the value passing in parameter. with the type number correctly set.
      Parameters:
      name - String the name of the Attribute
      value - String The value of the Attribute
      type - int the Df type of the value.
      Returns:
      New Attribute object
    • createAttribute

      public static Attribute createAttribute(String name, String value)
      Create an Attribute with the name and the value passing in parameter. with the type number correctly set.
      Parameters:
      name - String the name of the Attribute
      value - String The value of the Attribute
      Returns:
      New Attribute object
    • createAttribute

      public static Attribute createAttribute(String name, Boolean value)
      Create an Attribute with the name and the value passing in parameter. with the type number correctly set.
      Parameters:
      name - String the name of the Attribute
      value - a Boolean or boolean. The value of the Attribute
      Returns:
      New Attribute object
    • createAttribute

      public static Attribute createAttribute(String name, Integer value)
      Create an Attribute with the name and the value passing in parameter. with the type number correctly set.
      Parameters:
      name - String the name of the Attribute
      value - an Interger or int. The value of the Attribute
      Returns:
      New Attribute object
    • createAttribute

      public static Attribute createAttribute(String name, Double value)
      Create an Attribute with the name and the value passing in parameter. with the type number correctly set.
      Parameters:
      name - String the name of the Attribute
      value - an Double or double. The value of the Attribute
      Returns:
      New Attribute object
    • removeAttributeFromList

      public static boolean removeAttributeFromList(List<Attribute> attributes, String name)
      Removes all attributes with the specified name from the list
      Parameters:
      attributes -
      name -
      Returns:
      true if any element has been removed
    • createAttribute

      public static Attribute createAttribute(Attribute attribute)
      Create an Attribute with the value of another Attribute ( it's called cloning too )
      Parameters:
      attribute - - Attribute to clone
      Returns:
      New Attribute object
    • getTypePart

      public static int getTypePart(String id)
    • isDocument

      public static boolean isDocument(String id)
    • isFolder

      public static boolean isFolder(String id)
    • isCabinet

      public static boolean isCabinet(String id)
    • isFolderOrCabinet

      public static boolean isFolderOrCabinet(String id)
    • isValidFileSize

      public static boolean isValidFileSize(AllowedFiles allowedFiles, Long fileSize)
      Check the file size against the max size
      Parameters:
      allowedFiles -
      fileName -
      Returns:
    • isValidFilename

      public static boolean isValidFilename(AllowedFiles allowedFiles, String fileNamePath)
      Check the ending of the file name against the list of allowed or disallowed endings
      Parameters:
      allowedFiles -
      fileNamePath - - the file to check, may include the full path
      Returns:
    • getFileName

      public static String getFileName(String filePath)