com.arsdigita.domain
Class SimpleDomainObjectTraversalAdapter

java.lang.Object
  extended bycom.arsdigita.domain.SimpleDomainObjectTraversalAdapter
All Implemented Interfaces:
DomainObjectTraversalAdapter

public class SimpleDomainObjectTraversalAdapter
extends Object
implements DomainObjectTraversalAdapter

This is a general purpose traversal adaptor that allows/denies processing of a property based on the path to the property, and its presence in an inclusion/exclusion set. Instances of this class can be configured using the DomainObjectTraversalInitializer

See com.arsdigita.cms.installer.DomainObjectTraversalInitializer.


Field Summary
static int RULE_EXCLUDE
          Rule that indicates the set of properties should be treated as an exclusion list.
static int RULE_INCLUDE
          Rule that indicates the set of properties should be treated as an inclusion list.
 
Constructor Summary
SimpleDomainObjectTraversalAdapter()
          Creates a new traversal adapter, with no parent delegate.
SimpleDomainObjectTraversalAdapter(SimpleDomainObjectTraversalAdapter parent)
          Creates a new traversal adapter, extending the rules defined by a parent.
 
Method Summary
 void addAssociationProperty(String prop)
          Add a property to the association property set.
 void addAttributeProperty(String prop)
          Add a property to the attribute property set.
 boolean processProperty(DomainObject obj, String path, Property prop, String context)
          Determines whether or not to allow processing of a property, based on the property set and the processing rule
 void setAssociationRule(int rule)
          Set the rule for processing associations
 void setAttributeRule(int rule)
          Set the rule for processing attributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RULE_INCLUDE

public static final int RULE_INCLUDE
Rule that indicates the set of properties should be treated as an inclusion list. ie, don't allow any properties except those listed. This is the default for associations

See Also:
Constant Field Values

RULE_EXCLUDE

public static final int RULE_EXCLUDE
Rule that indicates the set of properties should be treated as an exclusion list. ie, allow through all properties, except those listed. This is the default for attributes.

See Also:
Constant Field Values
Constructor Detail

SimpleDomainObjectTraversalAdapter

public SimpleDomainObjectTraversalAdapter()
Creates a new traversal adapter, with no parent delegate. If no explicit rule is present it will return false if RULE_INCLUDE is set, or true if RULE_EXCLUDE is set.


SimpleDomainObjectTraversalAdapter

public SimpleDomainObjectTraversalAdapter(SimpleDomainObjectTraversalAdapter parent)
Creates a new traversal adapter, extending the rules defined by a parent. If there is no explicit rule for the property questioned, it will delegate the query to the parent.

Parameters:
parent - the parent adapter to delegate to
Method Detail

setAttributeRule

public void setAttributeRule(int rule)
Set the rule for processing attributes

Parameters:
rule - the new processing rule

setAssociationRule

public void setAssociationRule(int rule)
Set the rule for processing associations

Parameters:
rule - the new processing rule

addAttributeProperty

public void addAttributeProperty(String prop)
Add a property to the attribute property set.


addAssociationProperty

public void addAssociationProperty(String prop)
Add a property to the association property set.


processProperty

public boolean processProperty(DomainObject obj,
                               String path,
                               Property prop,
                               String context)
Determines whether or not to allow processing of a property, based on the property set and the processing rule

Specified by:
processProperty in interface DomainObjectTraversalAdapter
Parameters:
obj - the domain object currently being processed
path - the path to the current domain object from the root object being traversed
prop - the property about to be processed
context - the context in which the object is traversed
Returns:
true if the property should be processed


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC