org.inria.ns.reflex.processor.xcl
Class SetAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.core.AbstractSetAction
          extended by org.inria.ns.reflex.processor.xcl.SetAction
All Implemented Interfaces:
Computable, Executable, Presentable, NamespaceContextFactory

public class SetAction
extends AbstractSetAction

The <xcl:set> element adds a new property to the data set, or replace the property of the data set that have the same name if any.

A property may be simple or composed of several values. In this case it is possible to define a key for each item of the collection.

Examples

Scope

A property may be local, global, or shared, according to the value of the @scope attribute. Global properties are reachable from all logics functions.

Conditional assignment

It is allowed to use core instructions during value assignment :

<xcl:set name="foo" scope="global">
     <xcl:item value="{expression}"/>
     <xcl:if test="{expression}">
         <xcl:then>
             <xcl:item value="{expression}"/>
         </xcl:then>
     <xcl:/if">
</set>

(@xcl:if could also be used)

Author:
Philippe Poulard
See Also:
QName, DataSet, SetItemAction

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.core.AbstractAction
AbstractAction.ParameterAdapter, AbstractAction.UselessAction
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
NO_VALUE
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Constructor Summary
SetAction(Expression value, Element element, AbstractAction parent)
          Creates a new instance of SetAction.
 
Method Summary
 Object getComputedValue(DataSet dataSet)
          Return the computed value of the property.
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for SetAction.
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
addProperty, getComputedName, getName, getValue, runAction, scope, unmarshalScope
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractAction
addAction, addFallbackAction, createContext, getCanonicalPath, getFallbackAction, getLocalFallbackAction, getLogger, getNamespaceContext, getNode, getParent, recover, recover, removeFallbackAction, reorganize, run, runActions, toPrettyString, toPrettyString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SetAction

public SetAction(Expression value,
                 Element element,
                 AbstractAction parent)
          throws XMLException
Creates a new instance of SetAction.

Parameters:
value - The value of the property, as an Expression.
element - The element from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from.
Throws:
XMLException
Method Detail

unmarshal

public static AbstractAction unmarshal(AbstractAction parent,
                                       Element element)
                                throws XMLException
XML unmarshaller for SetAction.

Parameters:
parent - The action depending from.
element - The XML element to unmarshall.
Returns:
The SetAction created.
Throws:
UnmarshalException - When the element and its content is not those expected.
XMLException

getComputedValue

public Object getComputedValue(DataSet dataSet)
                        throws ExecutionException,
                               XPathException
Return the computed value of the property.

Specified by:
getComputedValue in interface Computable
Specified by:
getComputedValue in class AbstractSetAction
Parameters:
dataSet - The set of datas used when the name is computed.
Returns:
The computed value of the property.
Throws:
ExecutionException - If the computation can't be performed.
XPathException