Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.service.cmr.attributes
Interface AttributeService

public interface AttributeService
This provides services for reading, writing, and querying global attributes.

Attributes are uniquely identified by up to 3 keys; null keys are themselves treated uniquely i.e. ['a','b'] is equivalent to ['a','b',null] in all cases except where multiple search results are possible. Keys can be any simple Serializable type, typically being convertable using DefaultTypeConverter. The attribute values persisted can be any Serializable (including collections) but the raw values should be convertable by the DefaultTypeConverter for the most efficient persistence.

Since:
3.4
Author:
Derek Hulley

Method Summary
void
createAttribute(Serializable value, Serializable... keys)
          Create an attribute with an optional value, assuming there is no existing attribute using the same keys.
boolean
exists(Serializable... keys)
          Determine if a particular attribute exists.
getAttribute(Serializable... keys)
          Get an attribute using a list of unique keys
void
getAttributes(org.alfresco.service.cmr.attributes.AttributeService.AttributeQueryCallback callback, Serializable... keys)
          Get all attributes that share the starter keys provided.
void
removeAttribute(Serializable... keys)
          Remove a specific attribute.
void
removeAttributes(Serializable... keys)
          Remove all attributes that share a set of keys (in order)
void
setAttribute(Serializable value, Serializable... keys)
          Set an attribute, overwriting its prior value if it already existed.
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).
Method Detail
exists
boolean exists(Serializable... keys)
Determine if a particular attribute exists.
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
Serializable getAttribute(Serializable... keys)
Get an attribute using a list of unique keys
Parameters:
keys - List of 1 to 3 keys to uniquely identify the attribute
Returns:
The attribute value or null

getAttributes
void getAttributes(org.alfresco.service.cmr.attributes.AttributeService.AttributeQueryCallback callback,
                   Serializable... keys)
Get all attributes that share the starter keys provided. If 3 key values are given, there can be, at most, one result.
Parameters:
callback - the callback that handles the results
keys - 0 to 3 key values to search against

setAttribute
void setAttribute(Serializable value,
                  Serializable... keys)
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 then exists(Serializable...) will still return true. If the attribute doesn't exist, it will be created otherwise it will be modified.
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
void createAttribute(Serializable value,
                     Serializable... keys)
Create an attribute with an optional value, assuming there is no existing attribute using the same keys.
Parameters:
value - The value to store (can be a collection or null)
keys - List of 1 to 3 keys to uniquely identify the attribute
Throws:
org.alfresco.service.cmr.attributes.DuplicateAttributeException - if the attribute already exists

updateOrCreateAttribute
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.
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
void removeAttribute(Serializable... keys)
Remove a specific attribute.
Parameters:
keys - up to 3 keys to uniquely identify the attribute

removeAttributes
void removeAttributes(Serializable... keys)
Remove all attributes that share a set of keys (in order)
Parameters:
keys - up to 3 keys to identify attributes to remove

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2016 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.