com.sri.emo.controller
Class AddNodeAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by com.jcorporate.expresso.core.controller.Controller
          extended by com.jcorporate.expresso.core.controller.DBController
              extended by com.sri.common.controller.AbstractDBController
                  extended by com.sri.common.controller.AbstractComponentController
                      extended by com.sri.emo.controller.NodeController
                          extended by com.sri.emo.controller.AddNodeAction
All Implemented Interfaces:
ComponentServiceLocator, Serializable

public class AddNodeAction
extends NodeController

Handle Node manipulation.

Author:
larry hamel
See Also:
Serialized Form

Field Summary
static String APPEND_TO_TITLE
           
static String DEC_ATTRIB_ORDER
           
static String DEC_REL_ORDER
           
static String DELETE_STRAY_ATTRIBUTES
           
static String DO_EDIT_NODE
           
static String DO_EXPORT_NODE
           
static String DO_IMPORT_NODE
           
static String EDIT_GROUP_DISPLAY
           
static String FINISH_IMPORT
           
static String INC_ATTRIB_ORDER
           
static String INC_REL_ORDER
           
static String IS_CHANGE_TITLE
           
static int MAX_CHARS_OUTPUT
          limit number of chars that appear in display for a given field
static String PICK_LIST_ITEM
          checkbox name
static String PICKLISTS_TAGNAME
           
static String PROMPT_EDIT_NODE
           
static String PROMPT_EXPORT_NODE
           
static String PROMPT_IMPORT_NODE
           
static String RETURN_TO
           
static String VIEW_NODE
           
static String VIEW_PART
           
 
Fields inherited from class com.sri.emo.controller.NodeController
PARAM_RETURN_URL
 
Fields inherited from class com.sri.common.controller.AbstractComponentController
REQUEST_CONTAINER
 
Fields inherited from class com.sri.common.controller.AbstractDBController
COLUMN, COMMON_FOOTER_HANDLER, COMMON_HEADER_HANDLER, DELIMIT, EMBEDDED_MODE, FOOTER, MAX_TEXTAREA_LENGTH, MULTIPLE_TEXTAREA_NUM_LINES, ROW, ROW_BLOCK, SESSION_CONTAINER, SINGLE_TEXTAREA_NUM_LINES, TEXTAREA_NUM_COLS, WARNING_LIST
 
Fields inherited from class com.jcorporate.expresso.core.controller.DBController
CACHE_NAME
 
Fields inherited from class com.jcorporate.expresso.core.controller.Controller
CONTROLLER_PARAM_KEY, CTL_SUCC_CTL, CTL_SUCC_STATE, CTL_SUCC_TRAN, mLog, NEWSTATE_EXCEPTION_KEY, ORIGINAL_URL_KEY, REQUEST_KEY, RESPONSE_KEY, RETURN_TO_SENDER_TRAN, STATE_ERR_CTL, STATE_ERR_STATE, STATE_ERR_TRAN, STATE_PARAM_KEY, STATE_SUCC_CTL, STATE_SUCC_STATE, STATE_SUCC_TRAN
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
AddNodeAction()
           
 
Method Summary
static void addTags(Node queryNode, ExpressoRequest request, ExpressoResponse response)
          Grabs all node tags and drops them into a request attribute called 'NodeTags' that the JSP can modify.
static void deleteAttributes(List attribsLeftOver, Node srcNode)
           
static void deleteJoinedRelations(List relLeftOver, Node srcNode)
           
static void filterAttribs(List allAttribs, Part part, ArrayList attribsForThisPart)
          iterate through list of all attributes and filter those that belong to the specified Part into the output list
static List filterIamPartOfJoinedRelations(List allRelations)
          remove relations of type "I am a part of" because these are reflexive relations, not intended as true parts
static void filterJoinedDataObjectRelations(List allRelations, Part part, List relatedDataObjectsForThisPart)
           
protected  Block getAttributeInputBlock(String nodeId, String srcNodeType, ExpressoRequest request, String attribName)
          utility to create an input block for a given attribute part.
protected  Block getAttributeOutputBlock(Node node, ExpressoRequest request, Part part, boolean canEdit, List attribs)
          Utility to create an output block for a given attribute part.
protected  ArrayList getAttributes(String parentNodeId, ExpressoRequest request, String attribType)
          Return an attributes of this node, of this type.
protected  Block getBlock(Node node, ExpressoRequest request, Part part, boolean canEdit, List attribs, List relatedNodes)
           
protected  Block getSharedNodeBlock(Node node, ExpressoRequest request, Part part, boolean canEdit, List relatedNodes)
          Utility to create an output block for a given shared node part.
 String getTitle()
          Returns the title of this controller.
static Transition getViewTrans(String nodeId)
           
protected  void runDecAttribOrderState(ExpressoRequest request, ExpressoResponse response)
          increment order of this attribute
protected  void runDecRelOrderState(ExpressoRequest request, ExpressoResponse response)
          Dec order of this relation.
protected  void runDoEditNodeState(ExpressoRequest request, ExpressoResponse response)
          handle updates to node info--not attributes or shared relations, but the few fields that the node owns: title, annotation, comment
protected  void runDoExportNodeState(ExpressoRequest request, ExpressoResponse response)
          Prompt for preferred xml format.
protected  void runDoImportNodeState(ExpressoRequest request, ExpressoResponse response)
          Prompt import of node from xml.
protected  void runIncAttribOrderState(ExpressoRequest request, ExpressoResponse response)
          Increment order of this attribute
protected  void runIncRelOrderState(ExpressoRequest request, ExpressoResponse response)
          Increment order of this relation.
protected  void runPromptEditNodeState(ExpressoRequest request, ExpressoResponse response)
          prompt for NEW node or updates to node info--not attributes or shared relations, but the few fields that the node owns: title, annotation, comment.
protected  void runPromptExportNodeState(ExpressoRequest request, ExpressoResponse response)
          Prompt for preferred xml format.
protected  void runPromptImportNodeState(ExpressoRequest request, ExpressoResponse response)
          Prompt import of node from xml.
protected  void runViewNodeState(ExpressoRequest request, ExpressoResponse response)
          Show view of node.
protected  void runViewPartState(ExpressoRequest request, ExpressoResponse response)
          Views all attributes or relations of a given part.
protected  void saveAttribute(ExpressoRequest request, int setNum)
          Write changes in attribute to DB.
 void view(Node querynode, ExpressoRequest request, ExpressoResponse response)
          Views a given node.
 
Methods inherited from class com.sri.emo.controller.NodeController
addReturnToSenderParameter, propagateReturnToSenderParameter, redirectToSender
 
Methods inherited from class com.sri.common.controller.AbstractComponentController
addStateHandler, initializeControllerContainer, locate, locator, newExpressoState, postPerform, prePerform
 
Methods inherited from class com.sri.common.controller.AbstractDBController
addEmbeddedParameter, addWarning, addWarningList, getActionForwarding, getCheckbox, getPermsTrans, getPrettyXML, getTextArea, getTextArea, getWarningList, isEmbeddedMode, isValidAndPopulated, outputXML, populateDBObject, stateAllowed, str, strTrunc, trimAllTextFields
 
Methods inherited from class com.jcorporate.expresso.core.controller.DBController
getString, isAllowed
 
Methods inherited from class com.jcorporate.expresso.core.controller.Controller
addFinalState, addPromptTransitions, addRegDomainParamtoSession, addRequestedURLtoSession, addState, addStatePairing, endTimer, execute, findControllerForm, generateToken, getActionForward, getControllerChainingTransition, getControllerSecurityTransition, getFinalState, getInitialState, getLogger, getParamValues, getRequestURL, getSchema, getSchemaHierarchy, getSchemaInstance, getSchemaStack, getState, getStates, getString, getString, handleException, instantiate, isFinalState, isHandleState, isPromptState, isTokenValid, loadStateForm, newState, nextHandleState, nextPromptState, populateStateForm, postPerform, prePerform, previousPromptState, processRequestTransitions, processTransitions, redirectRequest, redirectRequest, remapFromExtension, resetToken, saveToken, setControllerChainingTransition, setControllerSecurityTransition, setCurrentState, setInitialState, setSchema, setSchema, setupDefaultValues, setupReturnToSender, setupSubclassLog, transition, transition, transition, unloadStateForm
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEW_NODE

public static final String VIEW_NODE
See Also:
Constant Field Values

PROMPT_EXPORT_NODE

public static final String PROMPT_EXPORT_NODE
See Also:
Constant Field Values

DO_EXPORT_NODE

public static final String DO_EXPORT_NODE
See Also:
Constant Field Values

PROMPT_EDIT_NODE

public static final String PROMPT_EDIT_NODE
See Also:
Constant Field Values

DO_EDIT_NODE

public static final String DO_EDIT_NODE
See Also:
Constant Field Values

PROMPT_IMPORT_NODE

public static final String PROMPT_IMPORT_NODE
See Also:
Constant Field Values

DO_IMPORT_NODE

public static final String DO_IMPORT_NODE
See Also:
Constant Field Values

FINISH_IMPORT

public static final String FINISH_IMPORT
See Also:
Constant Field Values

INC_ATTRIB_ORDER

public static final String INC_ATTRIB_ORDER
See Also:
Constant Field Values

DEC_ATTRIB_ORDER

public static final String DEC_ATTRIB_ORDER
See Also:
Constant Field Values

INC_REL_ORDER

public static final String INC_REL_ORDER
See Also:
Constant Field Values

DEC_REL_ORDER

public static final String DEC_REL_ORDER
See Also:
Constant Field Values

EDIT_GROUP_DISPLAY

public static final String EDIT_GROUP_DISPLAY
See Also:
Constant Field Values

VIEW_PART

public static final String VIEW_PART
See Also:
Constant Field Values

MAX_CHARS_OUTPUT

public static final int MAX_CHARS_OUTPUT
limit number of chars that appear in display for a given field

See Also:
Constant Field Values

PICK_LIST_ITEM

public static final String PICK_LIST_ITEM
checkbox name

See Also:
Constant Field Values

RETURN_TO

public static final String RETURN_TO
See Also:
Constant Field Values

PICKLISTS_TAGNAME

public static final String PICKLISTS_TAGNAME
See Also:
Constant Field Values

IS_CHANGE_TITLE

public static final String IS_CHANGE_TITLE
See Also:
Constant Field Values

APPEND_TO_TITLE

public static final String APPEND_TO_TITLE
See Also:
Constant Field Values

DELETE_STRAY_ATTRIBUTES

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

AddNodeAction

public AddNodeAction()
Method Detail

getTitle

public String getTitle()
Returns the title of this controller.

Overrides:
getTitle in class Controller
Returns:
String.

runViewNodeState

protected void runViewNodeState(ExpressoRequest request,
                                ExpressoResponse response)
                         throws ControllerException
Show view of node. if user has rights, include edit buttons

Parameters:
request - the ExpressoRequest object.
response - the ExpressoResponse object.
Throws:
ControllerException - upon error.

runPromptExportNodeState

protected void runPromptExportNodeState(ExpressoRequest request,
                                        ExpressoResponse response)
                                 throws ControllerException
Prompt for preferred xml format.

Parameters:
request - the ExpressoRequest object.
response - the ExpressoResponse object.
Throws:
ControllerException - upon error.

runDoExportNodeState

protected void runDoExportNodeState(ExpressoRequest request,
                                    ExpressoResponse response)
                             throws ControllerException
Prompt for preferred xml format.

Parameters:
request - the ExpressoRequest object.
response - the ExpressoResponse object.
Throws:
ControllerException - upon error.

view

public void view(Node querynode,
                 ExpressoRequest request,
                 ExpressoResponse response)
          throws DBException,
                 ControllerException
Views a given node. In otherwords, creates the data and edit links in a table format.

Parameters:
querynode - Node the node we're querying to form the data.
request - ExpressoRequest the ExpressoRequest object.
response - ExpressoResponse The ExpressoResponse object.
Throws:
DBException - upon error querying/operating on the node.
ControllerException - upon error populating the ExpressoResponse object.

addTags

public static void addTags(Node queryNode,
                           ExpressoRequest request,
                           ExpressoResponse response)
                    throws DBException,
                           ControllerException
Grabs all node tags and drops them into a request attribute called 'NodeTags' that the JSP can modify.

Parameters:
queryNode - Node the current node we're viewing.
request - ExpressoRequest the request
response - ExpressoResposne the response
Throws:
DBException - upon database error.
ControllerException - upon adding controller element error.

filterIamPartOfJoinedRelations

public static List filterIamPartOfJoinedRelations(List allRelations)
                                           throws DBException
remove relations of type "I am a part of" because these are reflexive relations, not intended as true parts

Throws:
DBException

filterJoinedDataObjectRelations

public static void filterJoinedDataObjectRelations(List allRelations,
                                                   Part part,
                                                   List relatedDataObjectsForThisPart)
                                            throws DBException
Throws:
DBException

filterAttribs

public static void filterAttribs(List allAttribs,
                                 Part part,
                                 ArrayList attribsForThisPart)
                          throws DBException
iterate through list of all attributes and filter those that belong to the specified Part into the output list

Parameters:
allAttribs - input list of Attribute
part - membership criteria (the part type)
attribsForThisPart - output list
Throws:
DBException

deleteAttributes

public static void deleteAttributes(List attribsLeftOver,
                                    Node srcNode)
                             throws DBException
Parameters:
attribsLeftOver - list of Attribute which should be deleted
Throws:
DBException

deleteJoinedRelations

public static void deleteJoinedRelations(List relLeftOver,
                                         Node srcNode)
                                  throws DBException
Parameters:
relLeftOver - list of JoinedDataObject which should have relation elements deleted
Throws:
DBException

runPromptEditNodeState

protected void runPromptEditNodeState(ExpressoRequest request,
                                      ExpressoResponse response)
                               throws ControllerException
prompt for NEW node or updates to node info--not attributes or shared relations, but the few fields that the node owns: title, annotation, comment.

can be for a new node, or existing

Parameters:
request - the ExpressoRequest object.
response - the ExpressoResponse object.
Throws:
ControllerException - upon error.

saveAttribute

protected void saveAttribute(ExpressoRequest request,
                             int setNum)
                      throws ControllerException
Write changes in attribute to DB. note that an erased attribute means that we should *delete* the item from the DB

Parameters:
request - the ExpressoRequest object.
setNum - the set number.
Throws:
ControllerException - upon error.

getBlock

protected Block getBlock(Node node,
                         ExpressoRequest request,
                         Part part,
                         boolean canEdit,
                         List attribs,
                         List relatedNodes)
                  throws DBException,
                         ControllerException
Throws:
DBException
ControllerException

getAttributes

protected ArrayList getAttributes(String parentNodeId,
                                  ExpressoRequest request,
                                  String attribType)
                           throws ControllerException
Return an attributes of this node, of this type.

Parameters:
parentNodeId - the id of the parent in the tree.
request - the ExpressoRequest object.
attribType - the attribute type.
Returns:
ArrayList of attributes
Throws:
ControllerException - upon error.

getAttributeOutputBlock

protected Block getAttributeOutputBlock(Node node,
                                        ExpressoRequest request,
                                        Part part,
                                        boolean canEdit,
                                        List attribs)
                                 throws DBException,
                                        ControllerException
Utility to create an output block for a given attribute part.

Parameters:
node - the parent node
request - the ExpressoRequest object.
part - the Part to get the attributes from.
canEdit - true if you want a transition link to the edit controller
attribs - A list of attributes
Returns:
Populated Block.
Throws:
DBException - upon database related error.
ControllerException - upon Expresso controller related error.

getAttributeInputBlock

protected Block getAttributeInputBlock(String nodeId,
                                       String srcNodeType,
                                       ExpressoRequest request,
                                       String attribName)
                                throws ControllerException
utility to create an input block for a given attribute part.

this method is complicated by fact that we must associate sets of items together as inputs; we'll get back just a pile of parameters from the HTML page POST, so we need a way to prefix param names such that they can be grouped together later.

Parameters:
nodeId - the id of the node.
srcNodeType - source the node type.
request - The ExpressoRequest object
attribName - the name of the attribute to populate
Returns:
a Block of Inputs for the attributes
Throws:
ControllerException - upon any sort of error.

getSharedNodeBlock

protected Block getSharedNodeBlock(Node node,
                                   ExpressoRequest request,
                                   Part part,
                                   boolean canEdit,
                                   List relatedNodes)
                            throws DBException,
                                   ControllerException
Utility to create an output block for a given shared node part.

Parameters:
node - the source node
request - ExpressoRequest The ExpressoRequest object
part - Part the part we're querying.
canEdit - boolean true if the user can edit the node
relatedNodes - list of multidbobjects from node.getRawRelated() of related node info.
Returns:
Block Bloc populated with the appropriate inputs/outputs, etc
Throws:
DBException - upon database access error
ControllerException - upon Controller related error.

runDoEditNodeState

protected void runDoEditNodeState(ExpressoRequest request,
                                  ExpressoResponse response)
                           throws ControllerException
handle updates to node info--not attributes or shared relations, but the few fields that the node owns: title, annotation, comment

Parameters:
request - The ServletExpressoRequest object.
response - The ExpressoResponse object.
Throws:
ControllerException - upon error.

runPromptImportNodeState

protected void runPromptImportNodeState(ExpressoRequest request,
                                        ExpressoResponse response)
                                 throws ControllerException
Prompt import of node from xml.

Parameters:
request - The ExpressoRequest object.
response - The ExpressoResponse object.
Throws:
ControllerException - upon error.

runDoImportNodeState

protected void runDoImportNodeState(ExpressoRequest request,
                                    ExpressoResponse response)
                             throws ControllerException
Prompt import of node from xml. assumes that all reference IDs ('ident') are for Nodes internal to the given tree

Parameters:
request - The ExpressoRequest object.
response - The ExpressoResponse object.
Throws:
ControllerException - upon error.

getViewTrans

public static Transition getViewTrans(String nodeId)

runIncAttribOrderState

protected void runIncAttribOrderState(ExpressoRequest request,
                                      ExpressoResponse response)
                               throws DBException,
                                      ControllerException
Increment order of this attribute

Parameters:
request - The ExpressoRequest object.
response - The ExpressoResponse object.
Throws:
ControllerException - upon error.
DBException - upon database related error.

runDecAttribOrderState

protected void runDecAttribOrderState(ExpressoRequest request,
                                      ExpressoResponse response)
                               throws DBException,
                                      ControllerException
increment order of this attribute

Parameters:
request - The ExpressoRequest object.
response - The ExpressoResponse object.
Throws:
ControllerException - upon error.
DBException - upon database related error.

runIncRelOrderState

protected void runIncRelOrderState(ExpressoRequest request,
                                   ExpressoResponse response)
                            throws DBException,
                                   ControllerException
Increment order of this relation.

Parameters:
request - The ExpressoRequest object.
response - The ExpressoResponse object.
Throws:
ControllerException - upon error.
DBException - upon database related error.

runDecRelOrderState

protected void runDecRelOrderState(ExpressoRequest request,
                                   ExpressoResponse response)
                            throws DBException,
                                   ControllerException
Dec order of this relation.

Parameters:
request - The ExpressoRequest object.
response - The ExpressoResponse object.
Throws:
ControllerException - upon error.
DBException - upon database related error.

runViewPartState

protected void runViewPartState(ExpressoRequest request,
                                ExpressoResponse response)
                         throws ControllerException,
                                DBException
Views all attributes or relations of a given part. Useful for when somebody does not have permission to update an attribute, but the attribute label is truncates (such as in treeview)

Parameters:
request - ExpressoRequest the ExpressoRequest object.
response - ExpressoResponse the ExpressoResponse object.
Throws:
ControllerException - upon controller framework related error.
DBException - upon database access related error.


Copyright © 2004-2006 Codeguild, Inc.. All Rights Reserved.