Package org.alfresco.repo.attributes
Class AttributeServiceImpl
java.lang.Object
org.alfresco.repo.attributes.AttributeServiceImpl
- All Implemented Interfaces:
AttributeService
Layers on the storage of property values to provide generic attribute storage
- Author:
- Derek Hulley
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.alfresco.service.cmr.attributes.AttributeService
AttributeService.AttributeQueryCallback -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateAttribute(Serializable value, Serializable... keys) Create an attribute with an optional value, assuming there is no existing attribute using the same keys.booleanexists(Serializable... keys) Determine if a particular attribute exists.getAttribute(Serializable... keys) Get an attribute using a list of unique keysvoidgetAttributes(AttributeService.AttributeQueryCallback callback, Serializable... keys) Get all attributes that share the starter keys provided.voidremoveAttribute(Serializable... keys) Remove a specific attribute.voidremoveAttributes(Serializable... keys) Remove all attributes that share a set of keys (in order)voidsetAttribute(Serializable value, Serializable... keys) Set an attribute, overwriting its prior value if it already existed.voidsetPropertyValueDAO(PropertyValueDAO propertyValueDAO) Set the DAO that handles the unique property persistencevoidupdateOrCreateAttribute(Serializable keyBefore1, Serializable keyBefore2, Serializable keyBefore3, Serializable keyAfter1, Serializable keyAfter2, Serializable keyAfter3) Update an attribute key whilst preserving the associated value (if any).
-
Constructor Details
-
AttributeServiceImpl
public AttributeServiceImpl()
-
-
Method Details
-
setPropertyValueDAO
Set the DAO that handles the unique property persistence -
exists
Determine if a particular attribute exists.- Specified by:
existsin interfaceAttributeService- Parameters:
keys- List of 1 to 3 keys to uniquely identify the attribute- Returns:
- true if the attribute exists (regardless of its value) or false if it doesn't exist
-
getAttribute
Get an attribute using a list of unique keys- Specified by:
getAttributein interfaceAttributeService- Parameters:
keys- List of 1 to 3 keys to uniquely identify the attribute- Returns:
- The attribute value or null
-
getAttributes
Get all attributes that share the starter keys provided. If 3 key values are given, there can be, at most, one result.- Specified by:
getAttributesin interfaceAttributeService- Parameters:
callback- the callback that handles the resultskeys- 0 to 3 key values to search against
-
setAttribute
Set an attribute, overwriting its prior value if it already existed. null values are treated as unique i.e. if the value set is null thenAttributeService.exists(Serializable...)will still return true. If the attribute doesn't exist, it will be created otherwise it will be modified.- Specified by:
setAttributein interfaceAttributeService- Parameters:
value- The value to store (can be a collection or null)keys- List of 1 to 3 keys to uniquely identify the attribute
-
createAttribute
Create an attribute with an optional value, assuming there is no existing attribute using the same keys.- Specified by:
createAttributein interfaceAttributeService- Parameters:
value- The value to store (can be a collection or null)keys- List of 1 to 3 keys to uniquely identify the attribute
-
updateOrCreateAttribute
public void updateOrCreateAttribute(Serializable keyBefore1, Serializable keyBefore2, Serializable keyBefore3, Serializable keyAfter1, Serializable keyAfter2, Serializable keyAfter3) Update an attribute key whilst preserving the associated value (if any). If there is no existing key matching the original value, then nothing will happen.- Specified by:
updateOrCreateAttributein interfaceAttributeService- Parameters:
keyBefore1- the first part of the original unique key (never null)keyBefore2- the second part of the original unique key (null allowed)keyBefore3- the third part of the original unique key (null allowed)keyAfter1- the first part of the new unique key (never null)keyAfter2- the second part of the new unique key (null allowed)keyAfter3- the third part of the new unique key (null allowed)
-
removeAttribute
Remove a specific attribute.- Specified by:
removeAttributein interfaceAttributeService- Parameters:
keys- up to 3 keys to uniquely identify the attribute
-
removeAttributes
Remove all attributes that share a set of keys (in order)- Specified by:
removeAttributesin interfaceAttributeService- Parameters:
keys- up to 3 keys to identify attributes to remove
-