it.eng.spago.cms.operations
Class SetOperation

java.lang.Object
  extended by it.eng.spago.cms.operations.SetOperation

public class SetOperation
extends java.lang.Object

Models a set operation on the repostitory. The operation has six attributes:

If the type of the node to set is SetOperation.TYPE_CONTENT it's necessary to set also the content to store into the node. It's possible to set one or more properties for the node. Each property as a name, a type and a set of values congruent with the type. The possible types oF a properties are: STRING (java String object), DATE(java Calendar object), LONG(java Long object), DOUBLE(java Double object), BOOLEAN (java Boolean object), BINARY(java InputStream object) The configuration of the operation is stored into a Spago SourceBean structured like below:
 <OPERATION name="">
                <SETOPERATION path="" type="(container/content)" cancelOldProperties="(true/flase)">
                        <CONTENT stream="" /> (optional)
                        <PROPERTIES> (optional)
                                <PROPERTY name="" type="STRING/DATE/LONG/DOUBLE/BOOLEAN/BINARY" >
                                        <PROPERTYVALUE value=""/>
                                        <PROPERTYVALUE value=""/>
                                        ....
                                </PROPERTY>
                                ....
                        </PROPERTIES>
                </SETOPERATION>
 </OPERATION>
 


Field Summary
static java.lang.String TYPE_CONTAINER
          the property container type
static java.lang.String TYPE_CONTENT
          The property content type (leaf node)
 
Constructor Summary
SetOperation()
          Constructor of the class useful to build an empty set operation.
SetOperation(java.lang.String path, java.lang.String type, boolean holdProperties)
          Constructor of the class useful to build a set operation setting the path, type and cancelOldProperties attributes.
SetOperation(java.lang.String path, java.lang.String type, boolean holdProperties, java.io.InputStream content)
          Constructor of the class useful to build a set operation setting the path, type, cancelOldProperties attributes and the content.
SetOperation(java.lang.String path, java.lang.String type, boolean holdProperties, java.util.List cmsProperties)
          Constructor of the class useful to build a set operation setting the path, type, cancelOldProperties attributes and a list of properties.
SetOperation(java.lang.String path, java.lang.String type, boolean holdProperties, java.util.List cmsProperties, java.io.InputStream content)
          Constructor of the class useful to build a set operation setting the path, type, cancelOldProperties attributes, a list of properties and the content.
 
Method Summary
 SourceBean getOperationDescriptor()
          Gets the Internal SourceBean which defines the internal structure of the operation
 void setContent(java.io.InputStream is)
          Set the content of the cms node
 void setEraseOldProperties(boolean erase)
          Set the flag to activate or deactivate the deletion of the old cms node properties
 void setPath(java.lang.String path)
          Set the path of the cms node
 void setProperties(java.util.List properties)
          Set the list of properties of the node
 void setType(java.lang.String type)
          Set the type of the cms node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_CONTENT

public static final java.lang.String TYPE_CONTENT
The property content type (leaf node)

See Also:
Constant Field Values

TYPE_CONTAINER

public static final java.lang.String TYPE_CONTAINER
the property container type

See Also:
Constant Field Values
Constructor Detail

SetOperation

public SetOperation()
             throws BuildOperationException
Constructor of the class useful to build an empty set operation. Attributes which have a default value are filled with it

Throws:
BuildOperationException - Thrown if an error occurs during the creation

SetOperation

public SetOperation(java.lang.String path,
                    java.lang.String type,
                    boolean holdProperties)
             throws BuildOperationException
Constructor of the class useful to build a set operation setting the path, type and cancelOldProperties attributes.

Parameters:
path - The Path of the cms node to set
type - The type of the cms node (SetOperation.TYPE_CONTENT or SetOperation.TYPE_CONTAINER)
holdProperties - Flag to activate or deactivate the deletion of the old node properties (if the node already exist)
Throws:
BuildOperationException - Thrown if an error occurs during the creation

SetOperation

public SetOperation(java.lang.String path,
                    java.lang.String type,
                    boolean holdProperties,
                    java.io.InputStream content)
             throws BuildOperationException
Constructor of the class useful to build a set operation setting the path, type, cancelOldProperties attributes and the content.

Parameters:
path - The Path of the cms node to set
type - The type of the cms node (SetOperation.TYPE_CONTENT or SetOperation.TYPE_CONTAINER)
holdProperties - Flag to activate or deactivate the deletion of the old node properties (if the node already exist)
content - The content of the node. If the node is of type SetOperation.TYPE_CONTAINER the content will be ignored
Throws:
BuildOperationException - Thrown if an error occurs during the creation

SetOperation

public SetOperation(java.lang.String path,
                    java.lang.String type,
                    boolean holdProperties,
                    java.util.List cmsProperties)
             throws BuildOperationException
Constructor of the class useful to build a set operation setting the path, type, cancelOldProperties attributes and a list of properties.

Parameters:
path - The Path of the cms node to set
type - The type of the cms node (SetOperation.TYPE_CONTENT or SetOperation.TYPE_CONTAINER)
holdProperties - Flag to activate or deactivate the deletion of the old node properties (if the node already exist)
content - The content of the node. If the node is of type SetOperation.TYPE_CONTAINER the content will be ignored
cmsProperties - The list of properties of the node. Each property of the list must be of type it.eng.spago.cms.CmsProperty
Throws:
BuildOperationException - Thrown if an error occurs during the creation

SetOperation

public SetOperation(java.lang.String path,
                    java.lang.String type,
                    boolean holdProperties,
                    java.util.List cmsProperties,
                    java.io.InputStream content)
             throws BuildOperationException
Constructor of the class useful to build a set operation setting the path, type, cancelOldProperties attributes, a list of properties and the content.

Parameters:
path - The Path of the cms node to set
type - The type of the cms node (SetOperation.TYPE_CONTENT or SetOperation.TYPE_CONTAINER)
holdProperties - Flag to activate or deactivate the deletion of the old node properties (if the node already exist)
cmsProperties - The list of properties of the node. Each property of the list must be of type it.eng.spago.cms.CmsProperty
content - The content of the node. If the node is of type SetOperation.TYPE_CONTAINER the content will be ignored
Throws:
BuildOperationException - Thrown if an error occurs during the creation
Method Detail

setPath

public void setPath(java.lang.String path)
             throws BuildOperationException
Set the path of the cms node

Parameters:
path - Path of the cms node
Throws:
BuildOperationException - Thrown if an error occurs during the setting

setContent

public void setContent(java.io.InputStream is)
                throws BuildOperationException
Set the content of the cms node

Parameters:
is - Content InputStream of the cms node
Throws:
BuildOperationException - Thrown if an error occurs during the setting

setType

public void setType(java.lang.String type)
             throws BuildOperationException
Set the type of the cms node

Parameters:
tyoe - Type of the cms node (SetOperation.TYPE_CONTENT / SetOperation.TYPE_CONTAINER)
Throws:
BuildOperationException - Thrown if an error occurs during the setting

setEraseOldProperties

public void setEraseOldProperties(boolean erase)
                           throws BuildOperationException
Set the flag to activate or deactivate the deletion of the old cms node properties

Parameters:
erase - boolean flag to activate or deactivate the deletion of the old cms node properties
Throws:
BuildOperationException - Thrown if an error occurs during the setting

setProperties

public void setProperties(java.util.List properties)
                   throws BuildOperationException
Set the list of properties of the node

Parameters:
properties - List of tne node properties Each property must be of type it.eng.spago.cms.CmsProperty
Throws:
BuildOperationException - Thrown if an error occurs during the setting

getOperationDescriptor

public SourceBean getOperationDescriptor()
Gets the Internal SourceBean which defines the internal structure of the operation

Returns:
The Internal SourceBean of the operation which defines the internal structure of the operation