com.ibm.pim.attribute
Interface AttributeCollection


public interface AttributeCollection

An AttributeCollection is a collection of Attribute Definitions. These attribute definitions can be specified individually, or a Spec can be imported as a dynamic source of Attribute Definitions, so that if the Spec changes, the AttributeCollection will automatically reflect the changes. Attribute Collections are typically used in the following places:

  1. To define the Attributes to Validate on Workflow Steps
  2. To define Views
  3. To specify Attribute Collection Privileges for a Catalog/Hierarchy and Role

See Also:
WorkflowStep, Catalog, Hierarchy, Role, An Attribute Collection can be restricted to a certain set of locales. By default, there is no locale restriction in effect.

Field Summary
static java.lang.String copyright
           
 
Method Summary
 void addAllAttributes(java.util.Collection<AttributeDefinition> attributeDefinitions)
          Adds all attribute defintions in a collection of AttributeDefinitions to this AttributeCollection, All attribute definitions of the collection will be added to the attribute collection.
 void addAllAttributes(Spec spec)
          Adds all the attribute definitions from a Spec to the attribute collection.
 void addAttribute(AttributeDefinition attributeDefinition)
          Adds an attribute to the attribute collection by specifying a AttributeDefinition.
 void addAttribute(java.lang.String attributeDefinitionPath)
          Adds an attribute to the attribute collection by specifying the path to the AttributeDefinition.
 void addLocaleRestriction(java.util.Locale locale)
          Adds a locale as a restricted locale for this attribute collection.
 void addSpec(Spec spec)
          Adds a Spec to the attribute collection as a dynamic source of attributes.
 boolean contains(AttributeDefinition attributeDefinition)
          Checks if an attribute definition is present in this attribute collection.
 boolean contains(java.lang.String attributeDefinitionPath)
          Checks if an attribute definition is present in this attribute collection.
 void delete()
          Deletes the attribute collection.
 java.util.Collection<AttributeDefinition> getAttributes()
          Returns all current list of attributes in this attribute collection.
 java.lang.String getDescription()
          Returns the description of this attribute collection.
 java.util.Collection<java.util.Locale> getLocaleRestrictions()
          Returns the locales to which this attribute collection is restricted.
 java.lang.String getName()
          Returns the name of this attribute collection.
 java.util.Collection<Spec> getSpecs()
          Get all of the specs associated with this attribute collection as dynamic sources of attributes.
 boolean isGenerated()
          Identifies whether this is a generated attribute collection
 void removeAllAttributes(Spec specWithAttributesToRemove)
          Removes all the attributes of the spec from this attribute collection.
 void removeAttribute(AttributeDefinition attributeDefinition)
          Removes an attribute from the attribute collection by specifying the AttributeDefinition.
 void removeAttribute(java.lang.String attributeDefinitionPath)
          Removes an attribute from the attribute collection by specifying the path to the AttributeDefinition.
 void removeLocaleRestriction(java.util.Locale locale)
          Removes a locale as a restricted locale for this attribute collection.
 void removeSpec(Spec specToRemove)
          Removes a spec from this attribute collections list of dynamic attribute sources.
 void save()
          Saves the attribute collection.
 void setDescription(java.lang.String description)
          Sets or changes the description of this attribute collection.
 void setLocaleRestrictions(java.util.Collection<java.util.Locale> locales)
          Sets the locale restrictions for this attribute collection.
 

Field Detail

copyright

static final java.lang.String copyright
See Also:
Constant Field Values
Method Detail

isGenerated

boolean isGenerated()
Identifies whether this is a generated attribute collection

Returns:
true if this is a generated attribute collection, false otherwise
Throws:
PIMInternalException - if an internal error occurs
java.lang.IllegalStateException - if the AttributeCollection has not been saved

contains

boolean contains(java.lang.String attributeDefinitionPath)
Checks if an attribute definition is present in this attribute collection. Note that if the attribute definition is present by virtue of being in a dynamic spec source, and is later removed from that spec, this result will become invalid (equally it could be not present now, but could be added to the spec later)

Parameters:
attributeDefinitionPath - the path of the attribute definition to check for
Returns:
true if the attribute definition is present, false otherwise
Throws:
java.lang.IllegalArgumentException - if attributeDefinitionPath is null or invalid
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or the identified AttributeDefinition belongs to a Spec which has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists

contains

boolean contains(AttributeDefinition attributeDefinition)
Checks if an attribute definition is present in this attribute collection. Note that if the attribute definition is present by virtue of being in a dynamic spec source, and is later removed from that spec, this result will become invalid (equally it could be not present now, but could be added to the spec later)

Parameters:
attributeDefinition - the attribute definition to check for
Returns:
true if the attribute definition is present, false otherwise
Throws:
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or attributeDefinition belongs to a Spec which has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists

addAttribute

void addAttribute(AttributeDefinition attributeDefinition)
Adds an attribute to the attribute collection by specifying a AttributeDefinition. This cannot be used on generated attribute collections.

Parameters:
attributeDefinition - the AttributeDefinition describing the attribute to be added.
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if the AttributeDefinition is already present in this AttributeCollection
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or attributeDefinition belongs to a Spec which has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

addAttribute

void addAttribute(java.lang.String attributeDefinitionPath)
Adds an attribute to the attribute collection by specifying the path to the AttributeDefinition. This cannot be used on generated attribute collections.

Parameters:
attributeDefinitionPath - the path to an existing AttributeDefinition which is to be added
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if attributeDefinitionPath is null or invalid, or if the identified AttributeDefinition is already present in this AttributeCollection
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or the identified AttributeDefinition belongs to a Spec which has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

removeAttribute

void removeAttribute(AttributeDefinition attributeDefinition)
Removes an attribute from the attribute collection by specifying the AttributeDefinition. This cannot be used on generated attribute collections.

Parameters:
attributeDefinition - the AttributeDefinition describing the attribute to be removed
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if attributeDefinition is not present in this AttributeCollection
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or attributeDefinition belongs to a Spec which has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

removeAttribute

void removeAttribute(java.lang.String attributeDefinitionPath)
Removes an attribute from the attribute collection by specifying the path to the AttributeDefinition. This cannot be used on generated attribute collections.

Parameters:
attributeDefinitionPath - path to an existing attribute which has been added.
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if attributeDefinitionPath is null or invalid, or if the identified AttributeDefinition is not present in this AttributeCollection
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or the identified AttributeDefinition belongs to a Spec which has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

delete

void delete()
Deletes the attribute collection. This cannot be used on generated attribute collections.

Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalStateException - if the AttributeCollection has not been saved
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists, or if delete is not possible (for example, the attribute collection is in use in container access privileges or views)
PIMAuthorizationException - Reserved for future use

save

void save()
Saves the attribute collection. This cannot be used on generated attribute collections.

Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalStateException - if the AttributeCollection has not been saved
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

getName

java.lang.String getName()
Returns the name of this attribute collection.

Returns:
the name of this attribute collection
Throws:
java.lang.IllegalStateException - if the AttributeCollection has not been saved
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists

getDescription

java.lang.String getDescription()
Returns the description of this attribute collection.

Returns:
the name of this attribute collection
Throws:
java.lang.IllegalStateException - if the AttributeCollection has not been saved
PIMInternalException - if an internal error occurs, or the AttributeCollection

setDescription

void setDescription(java.lang.String description)
Sets or changes the description of this attribute collection. Changes must be saved with save() method. This method may be called before the first save() of the attribute collection. This cannot be used on generated attribute collections.

Parameters:
description - the description for this attribute collection, which may be null
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

addSpec

void addSpec(Spec spec)
Adds a Spec to the attribute collection as a dynamic source of attributes. All attribute definitions of the specified Spec will be added to the attribute collection, and any changes to the Spec in future (addition or deletion of AttributeDefinitions) will also cause the Attribute Collection to be updated. If some attributes of this Spec are already present, they will first be removed (ie. no duplication can occur from this method). This cannot be used on generated attribute collections.

Parameters:
spec - the spec to add
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if spec is already present in this AttributeCollection
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or spec has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

addAllAttributes

void addAllAttributes(Spec spec)
Adds all the attribute definitions from a Spec to the attribute collection. All attribute definitions of the specified Spec will be added to the attribute collection. Any additions or modifications to attribute definitions in the spec in future will NOT be reflected in the attribute collection. However if attribute definitions added to this attribute collection are deleted in future, those attribute definitions will also be deleted from this attribute collection. Any attribute definitions already present will not be added (ie. no duplication can occur from this method). If the Spec itself has already been added, an exception will be thrown. This cannot be used on generated attribute collections.

Parameters:
spec - the spec to add
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if spec is already present in this AttributeCollection as a dynamic source of attributes
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or spec has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

addAllAttributes

void addAllAttributes(java.util.Collection<AttributeDefinition> attributeDefinitions)
Adds all attribute defintions in a collection of AttributeDefinitions to this AttributeCollection, All attribute definitions of the collection will be added to the attribute collection. If attribute definitions added to this attribute collection are deleted in future, those attribute definitions will also be deleted from this attribute collection. Any attribute definitions already present will not be added (ie. no duplication can occur from this method). This cannot be used on generated attribute collections.

Parameters:
attributeDefinitions - the collection of AttributeDefinitions to be added
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if attributeDefinitions is null
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or any of the attribute definitions belongs to a spec which has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

getAttributes

java.util.Collection<AttributeDefinition> getAttributes()
Returns all current list of attributes in this attribute collection.

Returns:
a Collection of attribute definitions that are within this attribute collection at the present time. Note that if the attribute collection includes dynamic attribute lists from specs, and those specs change in the future, then at that point the returned list of attributes will no longer be an accurate representation of this attribute collection's contents.
Throws:
java.lang.IllegalStateException - if the AttributeCollection has not been saved
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

getSpecs

java.util.Collection<Spec> getSpecs()
Get all of the specs associated with this attribute collection as dynamic sources of attributes.

Returns:
a Collection of Specs which are currently in use as dynamic attribute sources for this attribute collection
Throws:
java.lang.IllegalStateException - if the AttributeCollection has not been saved
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

removeSpec

void removeSpec(Spec specToRemove)
Removes a spec from this attribute collections list of dynamic attribute sources. This cannot be used on generated attribute collections. When the spec is removed, all attribute definitions within that spec will be removed from this Attribute Collection. Note that if attributes were added individually, the method removeAllAttributes(Spec) must be used instead.

Parameters:
specToRemove - a spec which has been added as Dynamic Attribute Source of attributes, and is to be removed.
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if spec is not present in this AttributeCollection as a dynamic source of attributes
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or spec has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

removeAllAttributes

void removeAllAttributes(Spec specWithAttributesToRemove)
Removes all the attributes of the spec from this attribute collection. This cannot be used on generated attribute collections. This will remove any attribute definitions within the specified spec, that were added individually, from this attribute collection. Note that if the attribute definitions are present by virtue of being part of a spec belonging to this attribute collection, then the method removeSpec(spec) should be used.

Parameters:
specWithAttributesToRemove - a spec whose full list of attributes will be removed from this Attribute collection.
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if spec is present in this AttributeCollection as a dynamic source of attributes
java.lang.IllegalStateException - if the AttributeCollection has not been saved, or spec has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

getLocaleRestrictions

java.util.Collection<java.util.Locale> getLocaleRestrictions()
Returns the locales to which this attribute collection is restricted.

Returns:
a Collection of locales currently set on this attribute collection
Throws:
java.lang.IllegalStateException - if the AttributeCollection has not been saved
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists

addLocaleRestriction

void addLocaleRestriction(java.util.Locale locale)
Adds a locale as a restricted locale for this attribute collection. Changes must be saved with save() method. This cannot be used on generated attribute collections.

Parameters:
locale - the locale to be added
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if locale is already present for this AttributeCollection, or if the locale is not in the list of available locales.
java.lang.IllegalStateException - if the AttributeCollection has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

removeLocaleRestriction

void removeLocaleRestriction(java.util.Locale locale)
Removes a locale as a restricted locale for this attribute collection. Changes must be saved with save() method.

Parameters:
locale - the locale to be removed
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if locale is not present for this AttributeCollection
java.lang.IllegalStateException - if the AttributeCollection has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use

setLocaleRestrictions

void setLocaleRestrictions(java.util.Collection<java.util.Locale> locales)
Sets the locale restrictions for this attribute collection. This will override any previous locale restriction settings for this attribute collection. Changes must be saved with save() method. This cannot be used on generated attribute collections.

Parameters:
locales - a collection of locales to be applied as restrictions to this attribute collection
Throws:
java.lang.UnsupportedOperationException - if the AttributeCollection is generated.
java.lang.IllegalArgumentException - if locales is null
java.lang.IllegalStateException - if the AttributeCollection has not been saved.
PIMInternalException - if an internal error occurs, or the AttributeCollection no longer exists
PIMAuthorizationException - Reserved for future use