Package com.emc.d2fs.utils
Class AttributeUtils
java.lang.Object
com.emc.d2fs.utils.AttributeUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDfType Boolean : 0static final intDfType Double : 5static final intDfType Id : 3static final intDfType Integer : 1static final intDfType String : 2static final intDfType Time : 4static final intDfType Undefined : 6static final intstatic final intstatic final intstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertAttributesToMap(List<Attribute> attributes, List<String> filterAttributes) Convert the list of attributes into a map.Convert the map of value into list of attributes.Convert the data from a model into list of attributes.static AttributecreateAttribute(Attribute attribute) Create an Attribute with the value of another Attribute ( it's called cloning too )static AttributecreateAttribute(String name, Boolean value) Create an Attribute with the name and the value passing in parameter.static AttributecreateAttribute(String name, Double value) Create an Attribute with the name and the value passing in parameter.static AttributecreateAttribute(String name, Integer value) Create an Attribute with the name and the value passing in parameter.static AttributecreateAttribute(String name, String value) Create an Attribute with the name and the value passing in parameter.static AttributecreateAttribute(String name, String value, int type) Create an Attribute with the name and the value passing in parameter.static AttributecreateAttribute(String name, String value, int type, Boolean isAttrRepeating) Create an Attribute with the name and the value passing in parameter.static AttributegetAttributeFromList(List<Attribute> attributes, String attributeName) Search in the list the attribute with the name given in parameter.static booleangetBooleanValueFromList(List<Attribute> attributes, String attributeName, boolean defaultValue) getCloneOfAttrList(List<Attribute> generalAttributes) Search in the list the attribute with the name given in parameter.static StringgetFileName(String filePath) static RenderingOptiongetRenderingOptionFromList(List<RenderingOption> renderingOptions, String attributeName) Search in the list the renderingOption with the name given in parameter.static intgetTypePart(String id) static StringgetValueFromList(List<Attribute> attributes, String attributeName) Search in the list the value of the attribute with the name given in parameter.static StringgetValueFromList(List<Attribute> attributes, String attributeName, String defaultValue) static booleanhasAttributeInList(List<Attribute> attributes, String attributeName) Search in the list the attribute with the name given in parameter.static booleanstatic booleanisDocument(String id) static booleanstatic booleanstatic booleanstatic booleanisValidFilename(AllowedFiles allowedFiles, String fileNamePath) Check the ending of the file name against the list of allowed or disallowed endingsstatic booleanisValidFileSize(AllowedFiles allowedFiles, Long fileSize) Check the file size against the max sizestatic booleanisWorkspace(String id) static booleanremoveAttributeFromList(List<Attribute> attributes, String name) Removes all attributes with the specified name from the liststatic voidupdateListAndResetValues(List<Attribute> attributes, List<Attribute> attributesToAdd, boolean override) Merges the first Attribute list with the Second Attribute list.updateListWithAttribute(List<Attribute> attributes, Attribute attribute) Add the Attribute given in parameter in the Attribute List.updateListWithList(List<Attribute> attributes, List<Attribute> attributesToAdd) Merge the first Attribute list with the Second Attribute list into a new list.static voidupdateListWithList(List<Attribute> attributes, List<Attribute> attributesToAdd, boolean override) Merge the first Attribute list with the Second Attribute list.
-
Field Details
-
SEPARATOR_VALUE
- See Also:
-
PREFIX_PV_NAME
- See Also:
-
PREFIX_PACKAGE_NAME
- See Also:
-
DF_BOOLEAN
public static final int DF_BOOLEANDfType Boolean : 0- See Also:
-
DF_INTEGER
public static final int DF_INTEGERDfType Integer : 1- See Also:
-
DF_STRING
public static final int DF_STRINGDfType String : 2- See Also:
-
DF_ID
public static final int DF_IDDfType Id : 3- See Also:
-
DF_TIME
public static final int DF_TIMEDfType Time : 4- See Also:
-
DF_DOUBLE
public static final int DF_DOUBLEDfType Double : 5- See Also:
-
DF_UNDEFINED
public static final int DF_UNDEFINEDDfType Undefined : 6- See Also:
-
DM_DOCUMENT
public static final int DM_DOCUMENT- See Also:
-
DM_FOLDER
public static final int DM_FOLDER- See Also:
-
DM_CABINET
public static final int DM_CABINET- See Also:
-
-
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
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
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
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
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
-
getBooleanValueFromList
-
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 Attributeattribute- The Attribute to add or Update to the list.- Returns:
- The Attribute List updated.
-
convertMapToAttributes
Convert the map of value into list of attributes.- Parameters:
map-- Returns:
- List of Attribute objects
-
convertModelMapToAttributes
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 Attributevalue- String The value of the Attributetype- int the Df type of the value.type- Boolean the Df type of the value.- Returns:
- New Attribute object
-
createAttribute
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 Attributevalue- String The value of the Attributetype- int the Df type of the value.- Returns:
- New Attribute object
-
createAttribute
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 Attributevalue- String The value of the Attribute- Returns:
- New Attribute object
-
createAttribute
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 Attributevalue- a Boolean or boolean. The value of the Attribute- Returns:
- New Attribute object
-
createAttribute
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 Attributevalue- an Interger or int. The value of the Attribute- Returns:
- New Attribute object
-
createAttribute
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 Attributevalue- an Double or double. The value of the Attribute- Returns:
- New Attribute object
-
removeAttributeFromList
Removes all attributes with the specified name from the list- Parameters:
attributes-name-- Returns:
- true if any element has been removed
-
createAttribute
Create an Attribute with the value of another Attribute ( it's called cloning too )- Parameters:
attribute- - Attribute to clone- Returns:
- New Attribute object
-
getTypePart
-
isDocument
-
isFolder
-
isCabinet
-
isFolderOrCabinet
-
isWorkspace
-
isFolderOrCabinetOrWorkspace
-
isValidFileSize
Check the file size against the max size- Parameters:
allowedFiles-fileName-- Returns:
-
isValidFilename
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
-