org.mmbase.applications.vprowizards.spring.action
Class CreateRelationAction

java.lang.Object
  extended by org.mmbase.applications.vprowizards.spring.action.Action
      extended by org.mmbase.applications.vprowizards.spring.action.AbstractNodeAction
          extended by org.mmbase.applications.vprowizards.spring.action.AbstractRelationAction
              extended by org.mmbase.applications.vprowizards.spring.action.CreateRelationAction
Direct Known Subclasses:
ToggleRelationAction

public class CreateRelationAction
extends AbstractRelationAction

this action creates a relation. source and destiation nodes can be set either as nodennr or as nodenr reference, which meens they are looked up in the id map of the ResultContainer.

Author:
Ernst Bunders

Field Summary
static String SORT_POSITION_BEGIN
           
static String SORT_POSITION_END
           
 
Fields inherited from class org.mmbase.applications.vprowizards.spring.action.AbstractRelationAction
destinationNode, destinationNodeNumber, destinationNodeRef, relationManager, relationValues, role, searchDir, sourceNode, sourceNodeNumber, sourceNodeRef
 
Fields inherited from class org.mmbase.applications.vprowizards.spring.action.AbstractNodeAction
securityContext
 
Constructor Summary
CreateRelationAction()
           
 
Method Summary
protected  void createCacheFlushHints()
          This template method is called when the node to edit is changed.
protected  Node createRelation(Transaction transaction, Map<String,Node> idMap, HttpServletRequest request)
          This template method should be implemented by concrete implementations of this class.
 String getSortField()
           
 String getSortPosition()
           
protected  void processNode(Transaction transaction)
          When sortField is set, and it is a valid field, the sort position is calculated and set on the new relation.
protected  Integer resolvePosition(Transaction transaction)
          Derive the position field value, if sortField is set.
 void setRole(String role)
           
 void setSortField(String sortField)
           
 void setSortPosition(String sortPosition)
           
 
Methods inherited from class org.mmbase.applications.vprowizards.spring.action.AbstractRelationAction
createNode, getDestinationNodeNumber, getDestinationNodeRef, getRelationValues, getRole, getSearchDir, getSourceNodeNumber, getSourceNodeRef, putValues, resolveNode, resolveSourceAndDestination, setDestinationNodeNumber, setDestinationNodeRef, setRelationValues, setSearchDir, setSourceNodeNumber, setSourceNodeRef
 
Methods inherited from class org.mmbase.applications.vprowizards.spring.action.AbstractNodeAction
addCachFlushHint, addFieldError, addFieldError, addFieldErrorTypeMessage, addFieldErrorTypeMessage, addFieldErrorTypeValue, addGlobalError, addGlobalError, addGlobalError, addNodeParam, addParam, getDateFields, getFields, getFile, getId, getLocale, getNode, hasChanged, hasErrors, isNodeNullIllegal, mayCreate, mayDelete, mayWrite, process, setChanged, setDateFields, setFields, setFile, setHtmlField, setId, setSecurityContext, shouldProcess, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SORT_POSITION_BEGIN

public static final String SORT_POSITION_BEGIN
See Also:
Constant Field Values

SORT_POSITION_END

public static final String SORT_POSITION_END
See Also:
Constant Field Values
Constructor Detail

CreateRelationAction

public CreateRelationAction()
Method Detail

createCacheFlushHints

protected void createCacheFlushHints()
Description copied from class: AbstractNodeAction
This template method is called when the node to edit is changed. custom cachflush hints can be set here. This class dous not know if the current node is updated or created, so it dousn't know what kind of events to create.

Specified by:
createCacheFlushHints in class AbstractNodeAction

createRelation

protected Node createRelation(Transaction transaction,
                              Map<String,Node> idMap,
                              HttpServletRequest request)
Description copied from class: AbstractRelationAction
This template method should be implemented by concrete implementations of this class. It is called by AbstractRelationAction.createNode(Transaction, Map, HttpServletRequest) after all the preliminary checks.

Specified by:
createRelation in class AbstractRelationAction
Returns:

processNode

protected void processNode(Transaction transaction)
When sortField is set, and it is a valid field, the sort position is calculated and set on the new relation.

Overrides:
processNode in class AbstractNodeAction
See Also:
AbstractNodeAction.processNode(org.mmbase.bridge.Transaction)

resolvePosition

protected final Integer resolvePosition(Transaction transaction)
Derive the position field value, if sortField is set. If something goes wrong a global error is set. The sort position value will be, depending on the sortPostion field, either the lowest current sort position value minus 1, or the highest current sort position value plus one.

Parameters:
transaction -
Returns:
the value to be inserted as the new sort position.

getSortPosition

public String getSortPosition()

setSortPosition

public void setSortPosition(String sortPosition)

getSortField

public String getSortField()

setSortField

public void setSortField(String sortField)

setRole

public void setRole(String role)
Overrides:
setRole in class AbstractRelationAction


MMBase 2.0-SNAPSHOT - null