lumis.portal.hierarquicalpropertybag
Class HierarquicalPropertyBag

Package class diagram package HierarquicalPropertyBag
java.lang.Object
  extended by lumis.portal.hierarquicalpropertybag.HierarquicalPropertyBag

public class HierarquicalPropertyBag
extends Object

Object that represents a hierarquical property bag.

This is a property bag that contains name value pairs where name is a string that is unique within a property bag and the value is a Property object.

A property bag may have a parent property bag from which it may inherit properties. Properties inherited from a parent property bag may be overridden in the child property bag.

Since:
4.2.0

Method Summary
 void addProperty(Property property)
          Adds a local property to the property bag.
 String getId()
          Returns the identifier of the property bag
 Collection<Property> getLocalProperties()
          Returns all the local properties of the property bag.
 Property getLocalProperty(String propertyName)
          Returns a single local property of the property bag.
 HierarquicalPropertyBag getParentPropertyBag()
          Returns the parent property bag object
 Collection<Property> getProperties()
          Returns the aggregated properties of the property bag.
 Property getProperty(String propertyName)
          Returns a property of the property bag.
protected  Map<String,Property> getPropertyMap()
          Internal method that returns the cumulative property map.
 boolean isInheritProperties()
          Returns true if the property bag is inheriting properties from its parent.
 void removeProperty(String propertyName)
          Removes the property in the property bag with the given name.
 void setInheritProperties(boolean inheritProperties)
          Sets whether the property bag should inherit properties from its parent.
 void setParentPropertyBag(HierarquicalPropertyBag parentPropertyBag)
          Sets the parent property bag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getId

public String getId()
Returns the identifier of the property bag

Returns:
the identifier of the property bag
Since:
4.2.0

getParentPropertyBag

public HierarquicalPropertyBag getParentPropertyBag()
Returns the parent property bag object

Returns:
the parent property bag.
Since:
4.2.0

setParentPropertyBag

public void setParentPropertyBag(HierarquicalPropertyBag parentPropertyBag)
Sets the parent property bag.

Parameters:
parentPropertyBag - the parent property bag
Since:
4.2.0

isInheritProperties

public boolean isInheritProperties()
Returns true if the property bag is inheriting properties from its parent.

Returns:
true if the property bag is inheriting properties, false if not.
Since:
4.2.0

setInheritProperties

public void setInheritProperties(boolean inheritProperties)
Sets whether the property bag should inherit properties from its parent.

Parameters:
inheritProperties - boolean inheritance value.
Since:
4.2.0

getLocalProperties

public Collection<Property> getLocalProperties()
Returns all the local properties of the property bag.

These properties do not take into consideration the properties that may be inherited from the parent property bag. If a property bag is not inheriting properties, the getProperties() method and this method should return the same values.

Returns:
Since:
4.2.0

getLocalProperty

public Property getLocalProperty(String propertyName)
                          throws PortalException
Returns a single local property of the property bag.

Inherited properties are not returned.

Parameters:
propertyName - name of the property to return.
Returns:
Throws:
PortalException
Since:
4.2.0

getProperties

public Collection<Property> getProperties()
Returns the aggregated properties of the property bag.

If the property bag has the inherit properties flag set and if it has a parent property bag, the properties of the parent are first called and subsequently the local properties are merged with the inherited ones. If there are properties with the same name, the local property is preserved discarding the inherited property.

Returns:
Since:
4.2.0

getProperty

public Property getProperty(String propertyName)
                     throws PortalException
Returns a property of the property bag.

The property may be an inherited property.

Parameters:
propertyName - name of the property to return
Returns:
Throws:
PortalException
Since:
4.2.0

getPropertyMap

protected Map<String,Property> getPropertyMap()
Internal method that returns the cumulative property map.

Returns:
the cumlative property map.
Since:
4.2.0

addProperty

public void addProperty(Property property)
                 throws PortalException
Adds a local property to the property bag.

If the property bag already contains a local property with the same name, an PortalObjectAlreadyExistsException exception is thrown.

Parameters:
property - the property to add.
Throws:
PortalException
Since:
4.2.0

removeProperty

public void removeProperty(String propertyName)
                    throws PortalException
Removes the property in the property bag with the given name.

If a property with the given name does not exist in the local properties of the property bag, a PortalObjectNotFoundException exception is thrown.

Parameters:
propertyName - name of the property to remove.
Throws:
PortalException
Since:
4.2.0


Lumisportal  4.2.1.080903 - Copyright © 2001-2007, Lumis. All Rights Reserved.