org.alfresco.repo.attributes
Class AttributeServiceImpl

java.lang.Object
  extended by org.alfresco.repo.attributes.AttributeServiceImpl
All Implemented Interfaces:
AttributeService

public class AttributeServiceImpl
extends java.lang.Object
implements AttributeService

Layers on the storage of property values to provide generic attribute storage

See Also:
PropertyValueDAO

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.service.cmr.attributes.AttributeService
AttributeService.AttributeQueryCallback
 
Constructor Summary
AttributeServiceImpl()
           
 
Method Summary
 void createAttribute(java.io.Serializable value, java.io.Serializable[] keys)
          Create an attribute with an optional value, assuming there is no existing attribute using the same keys.
 boolean exists(java.io.Serializable[] keys)
          Determine if a particular attribute exists.
 java.io.Serializable getAttribute(java.io.Serializable[] keys)
          Get an attribute using a list of unique keys
 void getAttributes(AttributeService.AttributeQueryCallback callback, java.io.Serializable[] keys)
          Get all attributes that share the starter keys provided.
 void removeAttribute(java.io.Serializable[] keys)
          Remove a specific attribute.
 void removeAttributes(java.io.Serializable[] keys)
          Remove all attributes that share a set of keys (in order)
 void setAttribute(java.io.Serializable value, java.io.Serializable[] keys)
          Set an attribute, overwriting its prior value if it already existed.
 void setPropertyValueDAO(PropertyValueDAO propertyValueDAO)
          Set the DAO that handles the unique property persistence
 void updateOrCreateAttribute(java.io.Serializable keyBefore1, java.io.Serializable keyBefore2, java.io.Serializable keyBefore3, java.io.Serializable keyAfter1, java.io.Serializable keyAfter2, java.io.Serializable keyAfter3)
          Update an attribute key whilst preserving the associated value (if any).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeServiceImpl

public AttributeServiceImpl()
Method Detail

setPropertyValueDAO

public void setPropertyValueDAO(PropertyValueDAO propertyValueDAO)
Set the DAO that handles the unique property persistence


exists

public boolean exists(java.io.Serializable[] keys)
Determine if a particular attribute exists.

Specified by:
exists in interface AttributeService
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

public java.io.Serializable getAttribute(java.io.Serializable[] keys)
Get an attribute using a list of unique keys

Specified by:
getAttribute in interface AttributeService
Parameters:
keys - List of 1 to 3 keys to uniquely identify the attribute
Returns:
The attribute value or null

getAttributes

public void getAttributes(AttributeService.AttributeQueryCallback callback,
                          java.io.Serializable[] keys)
Get all attributes that share the starter keys provided. If 3 key values are given, there can be, at most, one result.

Specified by:
getAttributes in interface AttributeService
Parameters:
callback - the callback that handles the results
keys - 0 to 3 key values to search against

setAttribute

public void setAttribute(java.io.Serializable value,
                         java.io.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(String...) will still return true. If the attribute doesn't exist, it will be created otherwise it will be modified.

Specified by:
setAttribute in interface AttributeService
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

public void createAttribute(java.io.Serializable value,
                            java.io.Serializable[] keys)
Create an attribute with an optional value, assuming there is no existing attribute using the same keys.

Specified by:
createAttribute in interface AttributeService
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(java.io.Serializable keyBefore1,
                                    java.io.Serializable keyBefore2,
                                    java.io.Serializable keyBefore3,
                                    java.io.Serializable keyAfter1,
                                    java.io.Serializable keyAfter2,
                                    java.io.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:
updateOrCreateAttribute in interface AttributeService
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

public void removeAttribute(java.io.Serializable[] keys)
Remove a specific attribute.

Specified by:
removeAttribute in interface AttributeService
Parameters:
keys - up to 3 keys to uniquely identify the attribute

removeAttributes

public void removeAttributes(java.io.Serializable[] keys)
Remove all attributes that share a set of keys (in order)

Specified by:
removeAttributes in interface AttributeService
Parameters:
keys - up to 3 keys to identify attributes to remove


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.