Package com.emc.d2fs.utils

# Class AttributeUtils

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

public class AttributeUtils extends Object

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DF_BOOLEAN`
  DfType Boolean : 0
  `static final int`
  `DF_DOUBLE`
  DfType Double : 5
  `static final int`
  `DF_ID`
  DfType Id : 3
  `static final int`
  `DF_INTEGER`
  DfType Integer : 1
  `static final int`
  `DF_STRING`
  DfType String : 2
  `static final int`
  `DF_TIME`
  DfType Time : 4
  `static final int`
  `DF_UNDEFINED`
  DfType Undefined : 6
  `static final int`
  `DM_CABINET`
  `static final int`
  `DM_DOCUMENT`
  `static final int`
  `DM_FOLDER`
  `static final String`
  `PREFIX_PACKAGE_NAME`
  `static final String`
  `PREFIX_PV_NAME`
  `static final String`
  `SEPARATOR_VALUE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AttributeUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Map<String,String>`
  `convertAttributesToMap(List<Attribute> attributes, List<String> filterAttributes)`
  Convert the list of attributes into a map.
  `static List<Attribute>`
  `convertMapToAttributes(Map<String,String> map)`
  Convert the map of value into list of attributes.
  `static List<Attribute>`
  `convertModelMapToAttributes(Map<String,Object> map)`
  Convert the data from a model into list of attributes.
  `static Attribute`
  `createAttribute(Attribute attribute)`
  Create an Attribute with the value of another Attribute ( it's called cloning too )
  `static Attribute`
  `createAttribute(String name, Boolean value)`
  Create an Attribute with the name and the value passing in parameter.
  `static Attribute`
  `createAttribute(String name, Double value)`
  Create an Attribute with the name and the value passing in parameter.
  `static Attribute`
  `createAttribute(String name, Integer value)`
  Create an Attribute with the name and the value passing in parameter.
  `static Attribute`
  `createAttribute(String name, String value)`
  Create an Attribute with the name and the value passing in parameter.
  `static Attribute`
  `createAttribute(String name, String value, int type)`
  Create an Attribute with the name and the value passing in parameter.
  `static Attribute`
  `createAttribute(String name, String value, int type, Boolean isAttrRepeating)`
  Create an Attribute with the name and the value passing in parameter.
  `static Attribute`
  `getAttributeFromList(List<Attribute> attributes, String attributeName)`
  Search in the list the attribute with the name given in parameter.
  `static boolean`
  `getBooleanValueFromList(List<Attribute> attributes, String attributeName, boolean defaultValue)`
  `static List<Attribute>`
  `getCloneOfAttrList(List<Attribute> generalAttributes)`
  Search in the list the attribute with the name given in parameter.
  `static String`
  `getFileName(String filePath)`
  `static RenderingOption`
  `getRenderingOptionFromList(List<RenderingOption> renderingOptions, String attributeName)`
  Search in the list the renderingOption with the name given in parameter.
  `static int`
  `getTypePart(String id)`
  `static String`
  `getValueFromList(List<Attribute> attributes, String attributeName)`
  Search in the list the value of the attribute with the name given in parameter.
  `static String`
  `getValueFromList(List<Attribute> attributes, String attributeName, String defaultValue)`
  `static boolean`
  `hasAttributeInList(List<Attribute> attributes, String attributeName)`
  Search in the list the attribute with the name given in parameter.
  `static boolean`
  `isCabinet(String id)`
  `static boolean`
  `isDocument(String id)`
  `static boolean`
  `isFolder(String id)`
  `static boolean`
  `isFolderOrCabinet(String id)`
  `static boolean`
  `isFolderOrCabinetOrWorkspace(String id)`
  `static boolean`
  `isValidFilename(AllowedFiles allowedFiles, String fileNamePath)`
  Check the ending of the file name against the list of allowed or disallowed endings
  `static boolean`
  `isValidFileSize(AllowedFiles allowedFiles, Long fileSize)`
  Check the file size against the max size
  `static boolean`
  `isWorkspace(String id)`
  `static boolean`
  `removeAttributeFromList(List<Attribute> attributes, String name)`
  Removes all attributes with the specified name from the list
  `static void`
  `updateListAndResetValues(List<Attribute> attributes, List<Attribute> attributesToAdd, boolean override)`
  Merges the first Attribute list with the Second Attribute list.
  `static List<Attribute>`
  `updateListWithAttribute(List<Attribute> attributes, Attribute attribute)`
  Add the Attribute given in parameter in the Attribute List.
  `static List<Attribute>`
  `updateListWithList(List<Attribute> attributes, List<Attribute> attributesToAdd)`
  Merge the first Attribute list with the Second Attribute list into a new list.
  `static void`
  `updateListWithList(List<Attribute> attributes, List<Attribute> attributesToAdd, boolean override)`
  Merge the first Attribute list with the Second Attribute list.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SEPARATOR_VALUE

    public static final String SEPARATOR_VALUE
    See Also:
      - Constant Field Values

  - ### PREFIX_PV_NAME

    public static final String PREFIX_PV_NAME
    See Also:
      - Constant Field Values

  - ### PREFIX_PACKAGE_NAME

    public static final String PREFIX_PACKAGE_NAME
    See Also:
      - Constant Field Values

  - ### DF_BOOLEAN

    public static final int DF_BOOLEAN
    DfType Boolean : 0
    See Also:
      - Constant Field Values

  - ### DF_INTEGER

    public static final int DF_INTEGER
    DfType Integer : 1
    See Also:
      - Constant Field Values

  - ### DF_STRING

    public static final int DF_STRING
    DfType String : 2
    See Also:
      - Constant Field Values

  - ### DF_ID

    public static final int DF_ID
    DfType Id : 3
    See Also:
      - Constant Field Values

  - ### DF_TIME

    public static final int DF_TIME
    DfType Time : 4
    See Also:
      - Constant Field Values

  - ### DF_DOUBLE

    public static final int DF_DOUBLE
    DfType Double : 5
    See Also:
      - Constant Field Values

  - ### DF_UNDEFINED

    public static final int DF_UNDEFINED
    DfType Undefined : 6
    See Also:
      - Constant Field Values

  - ### DM_DOCUMENT

    public static final int DM_DOCUMENT
    See Also:
      - Constant Field Values

  - ### DM_FOLDER

    public static final int DM_FOLDER
    See Also:
      - Constant Field Values

  - ### DM_CABINET

    public static final int DM_CABINET
    See Also:
      - Constant Field Values

- ## 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)

  - ### isWorkspace

    public static boolean isWorkspace(String id)

  - ### isFolderOrCabinetOrWorkspace

    public static boolean isFolderOrCabinetOrWorkspace(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)