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

Implementation of the AttributeService interface.


Constructor Summary
AttributeServiceImpl()
           
 
Method Summary
 void addAttribute(java.util.List keys, Attribute value)
          Add an attribute to a list.
 void addAttribute(java.lang.String path, Attribute value)
          Add an attribute to a list.
 void addAttributes(java.util.List keys, java.util.List values)
          Add a list of attributes to the end of a list.
 void addAttributes(java.lang.String path, java.util.List values)
          Add a list of attributes to the end of a list.
 boolean exists(java.util.List keys)
          Does an attribute exist.
 boolean exists(java.lang.String path)
          Does an attribute exist.
 Attribute getAttribute(java.util.List keys)
          Get an attribute using a list of keys.
 Attribute getAttribute(java.lang.String path)
          Get an Attribute using a path.
 int getCount(java.util.List keys)
          Get the size of a map or list.
 int getCount(java.lang.String path)
          Get the size of a map or list.
 java.util.List getKeys(java.util.List keys)
          Get all the keys at a given attribute path as specified by a list of path components.
 java.util.List getKeys(java.lang.String path)
          Get all the keys at a given attribute path.
 java.util.List query(java.util.List keys, AttrQuery query)
          Query for a list of attributes which are contained in a map defined by the given path and meet the query criteria.
 java.util.List query(java.lang.String path, AttrQuery query)
          Query for the list of attributes that is contained in the map defined by the given path and meet the query criteria.
 void removeAttribute(java.util.List keys, int index)
          Remove an attribute from a list.
 void removeAttribute(java.util.List keys, java.lang.String name)
          Remove an Attribute.
 void removeAttribute(java.lang.String path, int index)
          Remove an attribute from a list.
 void removeAttribute(java.lang.String path, java.lang.String name)
          Remove an Attribute.
 void removeEntries(java.util.List keys, AttrQuery query)
          Remove entries from the designated map which match the given query.
 void removeEntries(java.lang.String path, AttrQuery query)
          Remove entries from the designated map which match the given query.
 void setAttribute(java.util.List keys, int index, Attribute value)
          Set an attribute in a list.
 void setAttribute(java.util.List keys, java.lang.String name, Attribute value)
          Set an attribute, overwriting its prior value if it already existed.
 void setAttribute(java.lang.String path, int index, Attribute value)
          Set an attribute in a list.
 void setAttribute(java.lang.String path, java.lang.String name, Attribute value)
          Set an attribute, overwriting its prior value if it already existed.
 void setAttributeConverter(AttributeConverter converter)
           
 void setAttributeDao(AttributeDAO dao)
           
 void setAttributes(java.util.List keys, java.util.Map entries)
          Set a set of attributes on a map.
 void setAttributes(java.lang.String path, java.util.Map entries)
          Set a set of attributes on a map.
 void setGlobalAttributeEntryDao(GlobalAttributeEntryDAO dao)
           
 
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

setGlobalAttributeEntryDao

public void setGlobalAttributeEntryDao(GlobalAttributeEntryDAO dao)

setAttributeDao

public void setAttributeDao(AttributeDAO dao)

setAttributeConverter

public void setAttributeConverter(AttributeConverter converter)

getAttribute

public Attribute getAttribute(java.lang.String path)
Description copied from interface: AttributeService
Get an Attribute using a path.

Specified by:
getAttribute in interface AttributeService
Parameters:
path - The path of the Attribute
Returns:
The value of the attribute or null.

query

public java.util.List query(java.lang.String path,
                            AttrQuery query)
Description copied from interface: AttributeService
Query for the list of attributes that is contained in the map defined by the given path and meet the query criteria.

Example 1:
Find all attributes within the nested namespace "a/b" that are lexically greater than or equal to the string "v":

          query("a/b", new AttrQueryGTE("v"))
 

Example 2:
Find all attributes within the namespace "xyz" that are either lexically less than the string "d" or greater than the string "w":

           query("xyz", new AttrOrQuery(new AttrQueryLT("d"),
                                        new AttrQueryGT("w")))
 

Specified by:
query in interface AttributeService
Returns:
A List of matching attributes.

removeAttribute

public void removeAttribute(java.lang.String path,
                            java.lang.String name)
Description copied from interface: AttributeService
Remove an Attribute.

Specified by:
removeAttribute in interface AttributeService
name - The name of the Attribute.

setAttribute

public void setAttribute(java.lang.String path,
                         java.lang.String name,
                         Attribute value)
Description copied from interface: AttributeService
Set an attribute, overwriting its prior value if it already existed.

Specified by:
setAttribute in interface AttributeService
name - The name of the Attribute.
value - The value to set.

getKeys

public java.util.List getKeys(java.lang.String path)
Description copied from interface: AttributeService
Get all the keys at a given attribute path. When prior call to setAttribute has associated a path with a MAP, you can fetch the keys for that map via this function.

Example:
Suppose AttribSvc is an attribute service object:


   MapAttribute x = new MapAttributeValue();
   x.put("cow",  new StringAttributeValue("moo");
   x.put("bird", new StringAttributeValue("tweet");
  
   MapAttribute y = new MapAttributeValue();
   y.put("pekingese",    new StringAttributeValue("yip-yip-yip");
   y.put("blood hound",  new StringAttributeValue("Aroooooooooooo");
   y.put("labrador",     new StringAttributeValue("Hello, kind stranger!");

   AttribSvc.setAttribute("",  "x", x);
   AttribSvc.setAttribute("x", "y", y);

   List<String> x_keys  = AttribSvc.getKeys("x");    // cow, bird
   List<String> y_keys  = AttribSvc.getKeys("x/y");  // pekingese, blood hound, labrador
 

Specified by:
getKeys in interface AttributeService
Parameters:
path - The attribute path.
Returns:
A list of all keys.

getAttribute

public Attribute getAttribute(java.util.List keys)
Description copied from interface: AttributeService
Get an attribute using a list of keys.

Specified by:
getAttribute in interface AttributeService
Parameters:
keys - List of attribute path keys (path components).
Returns:
The value of the attribute or null.

getKeys

public java.util.List getKeys(java.util.List keys)
Description copied from interface: AttributeService
Get all the keys at a given attribute path as specified by a list of path components.

Specified by:
getKeys in interface AttributeService
Parameters:
keys - List of attribute path keys (path components).
Returns:
A list of all keys at the specified Attribute location

setAttribute

public void setAttribute(java.util.List keys,
                         java.lang.String name,
                         Attribute value)
Description copied from interface: AttributeService
Set an attribute, overwriting its prior value if it already existed.

Specified by:
setAttribute in interface AttributeService
Parameters:
keys - List of attribute path keys (path components).
name - The name of the attribute to set.
value - The Attribute to set.

query

public java.util.List query(java.util.List keys,
                            AttrQuery query)
Description copied from interface: AttributeService
Query for a list of attributes which are contained in a map defined by the given path and meet the query criteria.

Specified by:
query in interface AttributeService
Parameters:
keys - List of attribute path keys (path components).
Returns:
A list of matching attributes.

removeAttribute

public void removeAttribute(java.util.List keys,
                            java.lang.String name)
Description copied from interface: AttributeService
Remove an Attribute.

Specified by:
removeAttribute in interface AttributeService
Parameters:
keys - List of attribute path keys (path components).
name - The name of the attribute to remove.

addAttribute

public void addAttribute(java.util.List keys,
                         Attribute value)
Description copied from interface: AttributeService
Add an attribute to a list.

Specified by:
addAttribute in interface AttributeService
Parameters:
keys - List of attribute path keys (path components).
value - The Attribute to add to the ListAttribute

addAttribute

public void addAttribute(java.lang.String path,
                         Attribute value)
Description copied from interface: AttributeService
Add an attribute to a list.

Specified by:
addAttribute in interface AttributeService
Parameters:
path - The path to the list.
value - The Attribute to add to the ListAttribute

removeAttribute

public void removeAttribute(java.util.List keys,
                            int index)
Description copied from interface: AttributeService
Remove an attribute from a list.

Specified by:
removeAttribute in interface AttributeService
Parameters:
keys - List of attribute path keys (path components).
index - The index to remove from the ListAttribute

removeAttribute

public void removeAttribute(java.lang.String path,
                            int index)
Description copied from interface: AttributeService
Remove an attribute from a list.

Specified by:
removeAttribute in interface AttributeService
Parameters:
path - The path to the list.
index - The index to remove from the ListAttribute

removeEntries

public void removeEntries(java.util.List keys,
                          AttrQuery query)
Description copied from interface: AttributeService
Remove entries from the designated map which match the given query.

Specified by:
removeEntries in interface AttributeService
Parameters:
keys - The list of attribute path entries.
query - The attribute query.

removeEntries

public void removeEntries(java.lang.String path,
                          AttrQuery query)
Description copied from interface: AttributeService
Remove entries from the designated map which match the given query.

Specified by:
removeEntries in interface AttributeService
Parameters:
path - The path to the map.
query - The attribute query.

setAttribute

public void setAttribute(java.util.List keys,
                         int index,
                         Attribute value)
Description copied from interface: AttributeService
Set an attribute in a list.

Specified by:
setAttribute in interface AttributeService
Parameters:
keys - List of attribute path keys (path components).
index - The list index.
value - The Attribute to set within the ListAttribute

setAttribute

public void setAttribute(java.lang.String path,
                         int index,
                         Attribute value)
Description copied from interface: AttributeService
Set an attribute in a list.

Specified by:
setAttribute in interface AttributeService
Parameters:
path - The path to the ListAttribute.
index - The list index.
value - The Attribute to set.

exists

public boolean exists(java.util.List keys)
Description copied from interface: AttributeService
Does an attribute exist.

Specified by:
exists in interface AttributeService
Parameters:
keys - List of attribute path keys.
Returns:
Whether the attribute exists.

exists

public boolean exists(java.lang.String path)
Description copied from interface: AttributeService
Does an attribute exist.

Specified by:
exists in interface AttributeService
Parameters:
path - The path to the attribute.
Returns:
Whether the attribute exists.

getCount

public int getCount(java.util.List keys)
Description copied from interface: AttributeService
Get the size of a map or list.

Specified by:
getCount in interface AttributeService
Parameters:
keys - List of attribute path keys.
Returns:
The size of of the list or map.

getCount

public int getCount(java.lang.String path)
Description copied from interface: AttributeService
Get the size of a map or list.

Specified by:
getCount in interface AttributeService
Parameters:
path - The path to the map or list.
Returns:
The size of the list or map.

addAttributes

public void addAttributes(java.util.List keys,
                          java.util.List values)
Description copied from interface: AttributeService
Add a list of attributes to the end of a list.

Specified by:
addAttributes in interface AttributeService
Parameters:
keys - The List of path keys to the list.
values - The values to add.

addAttributes

public void addAttributes(java.lang.String path,
                          java.util.List values)
Description copied from interface: AttributeService
Add a list of attributes to the end of a list.

Specified by:
addAttributes in interface AttributeService
Parameters:
path - The path to the list.
values - The values to add.

setAttributes

public void setAttributes(java.util.List keys,
                          java.util.Map entries)
Description copied from interface: AttributeService
Set a set of attributes on a map.

Specified by:
setAttributes in interface AttributeService
Parameters:
keys - The List of path keys to the map.
entries - The entries to set.

setAttributes

public void setAttributes(java.lang.String path,
                          java.util.Map entries)
Description copied from interface: AttributeService
Set a set of attributes on a map.

Specified by:
setAttributes in interface AttributeService
Parameters:
path - The path to the map.
entries - The entries to set.


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