com.sri.emo.dbobj
Class Node

java.lang.Object
  extended by com.jcorporate.expresso.core.dataobjects.BaseDataObject
      extended by com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
          extended by com.jcorporate.expresso.core.dbobj.DBObject
              extended by com.jcorporate.expresso.core.dbobj.SecuredDBObject
                  extended by com.jcorporate.expresso.core.dbobj.RowSecuredDBObject
                      extended by com.sri.emo.dbobj.Node
All Implemented Interfaces:
Cacheable, ContextNested, DataObject, Securable, LookupInterface, IViewable, ModelVisitable, Serializable, Comparable

public class Node
extends RowSecuredDBObject
implements Comparable, ModelVisitable, IViewable

Encapsulate an element in a linked graph.

Author:
larry hamel
See Also:
Serialized Form
To Do:
Implement equals and hashcode for handling in collections.

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jcorporate.expresso.core.dbobj.DBObject
DBObject.FieldError, DBObject.FieldUpdate
 
Field Summary
static String ATTRIBUTE_JOIN
           
static String FULL_XML
           
static String GROUP_OF_OWNER
          virtual field; convenience for sorting
static String ID_DELIMITER
          Used to separate machine name from internal ID, for creating universally unique IDs ("global" ids).
static String IDENT_TAG_NAME
           
static String IGNORE_RELATIONS
           
static String INDENT
          optional attribute which will hold indentation level for tree access
static String NODE_ANNOTATION
           
static String NODE_COMMENT
           
static String NODE_CREATED
           
static String NODE_ID
           
static String NODE_JOIN
           
static String NODE_MIME_TYPE
           
static String NODE_MODIFIED
           
static String NODE_OWNER
           
static String NODE_PATH
           
static String NODE_TABLE
           
static String NODE_TITLE
           
static String NODE_TYPE
           
(package private) static int numCalls
           
static String REF_ID
           
static String REFERENCE
           
static String REFS_ONLY
           
static String RELATED
           
static String RELATED_DELIMITER
          XML: used to seperate 2 halves of name for related node tags.
static String RELATION_JOIN
           
static String RELATION_TYPE_JOIN
           
 
Fields inherited from class com.jcorporate.expresso.core.dbobj.RowSecuredDBObject
DEFAULT_PERMISSION_CODE
 
Fields inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject
ADD, ALL_FUNCTIONS, CACHE_NAME, CACHE_TTY, DELETE, SEARCH, SYSTEM_ACCOUNT_NAME, UPDATE
 
Fields inherited from class com.jcorporate.expresso.core.dbobj.DBObject
ATTRIBUTE_ERROR, ATTRIBUTE_ERROR_MESSAGE, ATTRIBUTE_PAGE_LIMIT, BIG_DECIMAL_ZERO, CACHE_LIMIT_PERCENT, CACHE_LIMIT_TTL, EMAIL_MASK, EVENT_ADD, EVENT_DELETE, EVENT_UPDATE, FLOAT_MASK, INT_MASK, IS_CHECK_RELATIONAL_INTEGRITY, IS_MUTABLE, sCacheStats, UPDATE_CHANGED_ONLY, WHERE_KEYWORD
 
Fields inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
anyFieldsDistinct, anyFieldsToInput, anyFieldsToRetrieve, appendCustomWhere, caseSensitiveQuery, customWhereClause, dbKey, distinctFields, inputFields, localConnection, LONGBINARY_READ_DEFAULT_SIZE, maxRecords, myClassName, myUpdates, offsetRecord, recordSet, retrieveFields, sMetadataMap, sortKeys
 
Fields inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject
currentStatus, globalMask
 
Fields inherited from interface com.jcorporate.expresso.core.dataobjects.Securable
SYSTEM_ACCOUNT
 
Fields inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject
STATUS_CURRENT, STATUS_DELETED, STATUS_NEW, STATUS_UPDATED
 
Constructor Summary
Node()
          Constructor without parameters is required by framework, but if you use this constructor, be sure to setRequestingUid() after instantiation.
Node(DBConnection theConnection, int theUser)
          Constructor.
Node(org.dom4j.Element root)
          Constructs a Node from an XML Element.
Node(ExpressoRequest request)
           
Node(ExpressoRequest request, org.dom4j.Element root)
          Construct node from XML--just basic XML attributes, NOT related nodes, or model-app Attributes side-effect: also adds DBObject.setAttribute() items for root param, and one for ident.
Node(ExpressoRequest request, String id)
          Constructs a Node with the given 'context' and the given Id.
Node(ReadOnlyUser user)
           
Node(SecuredDBObject node)
          Constructs a node using another object as the security credentials.
Node(String id)
          Constructs a Node that has the given string id.
 
Method Summary
 void acceptVisitor(ModelVisitor visitor)
          Accepts the visitor and redirects the visitor to the appropriate type we're dealing with.
 void add()
          We override to set dates (by superclass) but rather to add default permissions.
 Attribute addAttribute(String attribType, String value, String comment)
          Adds a new attribute to be associated with this node.
 Node cloneOrphan(String title)
          Create clone which copies all EXCEPT "upstream" links.
 Node cloneSibling(String title)
          Creates and returns a deep copy of this object--everything, including links to "contained by" objects above this one.
 Node cloneTree(String suffix, HashMap itemInfo)
          Recursively clone contained tree beneath this node, including this node.
 int compareTo(Object o)
          Compares this object with the specified object for order.
 void delete(boolean deleteDetails)
          Delete row.
 List getAttributes()
          Fetch all attributes of this node OF ALL KINDS.
 Attribute[] getAttributes(String attribType)
          Fetch any attributes of this node, of this type, in alpha order by value.
 Attribute[] getAttributesAssumeSecure(String attribType)
          Fetch any attributes of this node, of this type, in alpha order by value, using System ID to speed recall w/o permissions check.
 Relation[] getDestRelations()
          Get relations for which my ID is marked as destination.
 NodeType getEntity()
          Get node type; will throw if node type is not set or cannot be found.
 String getGlobalId()
          For creating universally unique IDs ("global" ids) by combining machine name with internal ID.
static HashMap getIgnoredRelations(ExpressoRequest request)
           
 ValidValue[] getMultiValuedAttributeMenu()
           
 String getNodeAnnotation()
           
 String getNodeAnnotationRaw()
           
 String getNodeComment()
           
 String getNodeCommentRaw()
           
 String getNodeCreated()
           
 String getNodeId()
           
 String getNodeModified()
           
 String getNodeOwner()
           
 void getNodesInStronglyRelatedTree(ExpressoRequest request, HashMap outputMap)
          Get ALL related nodes in tree beneath this node EXCEPT types indicated for omission recurses into tree; side-effect: adds attribute 'level' with node level w/i tree to each node.
 void getNodesInStronglyRelatedTree(Map outputMap)
          Get ALL related nodes in tree beneath this node EXCEPT types indicated for omission recurses into tree; side-effect: adds attribute 'level' with node level w/i tree to each node.
 String getNodeTitle()
          Get the node's title.
 String getNodeTitleRaw()
           
 String getNodeType()
           
static HashMap getNodeTypesWithRefOnly_Map(ExpressoRequest request)
           
 Part[] getParts()
          Get all parts within this node.
 List getRawRelated()
          return all nodes related to this node as source
 List getRawRelated(String relation, String nodeType)
           
 List getRawRelatedAssumeSecure(String dbname, String relation, String typeOfPart)
          Get related nodes, without ID test (for speed).
 List getRawRelatedUsingDataObjects()
          Grabs a list of joined data objects based on the matrix join.
 String getRecentEditor()
           
 Node[] getRelatedNodes(String relation, String typeOfPart)
           
 Map getRelatedNodesHash(String relationType, String targetNodeType, List toPopulateOldRemainingList)
          Find all properly-typed nodes related to this source node, with relation of given type.
 Node[] getShallowContainedNodes(String type, ExpressoRequest request)
          Find nodes contained just beneath this one.
 Relation[] getSrcRelations()
          Fet relations for which my ID is marked as source.
 Node[] getStronglyRelatedNodes()
          get all nodes that have this node as 'src' for some strong relation
 List getTags()
           
 String getVersion()
           
 Transition getViewTrans()
          provide a transition for viewing this object, suitable for creating an HTTP link
 org.dom4j.Element getXML(ExpressoRequest request, ArrayList alreadyIncluded)
          Format XML for this node.
 void parseXMLAttributes(Map allNodesByXML_ID, ExpressoRequest request, Map translatePicklistMap)
          Parse xml to create relations and attributes; nodes are assumed already created by Node(xml) constructor, and allNodes has map of all nodes.
 List parseXMLRelations(Map allNodesByXML_ID, boolean isExternalRefRequired)
          Parse xml to create relations; all nodes from xml are assumed already created by Node(xml) constructor.
 void populateDefaultValues()
          Add sample record.
 void setNodeAnnotation(String annotation)
           
 void setNodeComment(String s)
           
 void setNodeId(String id)
           
 void setNodeOwner(String nodeOwner)
           
 void setNodeTitle(String title)
           
 void setNodeType(String type)
           
 void setRecentEditor(String username)
           
protected  void setupFields()
          Defines the database table name and fields for this DB object.
 void touch()
          Set recent editor and modification date.
 void update()
          We override to set dates, and make sure perms are complete.
 Attribute updateAttribute(String attributeId, String value, String comment)
          Saves an attributes for the node, touching the node as necessary, etc.
 void updateNodeRelations(String targetNodeType, String relationType, String[] targetNodeIds)
          Updates the specified node relation to reflect the new values specified in the targetNodeIds.
 void view(AbstractDBController defaultaction, ExpressoRequest request, ExpressoResponse response)
          Allow a special hander to create custom view, while providing default view also.
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.RowSecuredDBObject
add, addGroupPerm, canRequesterAdministrate, canRequesterRead, canRequesterWrite, checkDeleteDetailPerm, checkKeyLength, defaultGroup, defaultPermissions, deleteAll, find, getAdministrateGroups, getGroups, getPermissions, getReadGroups, getWriteGroups, isAdminGroup, isReadGroup, isRowAllowed, isRowAllowed, isWriteGroup, ownerID, removeGroup, retrieve, searchAndRetrieveList, searchAndRetrieveList, setPermissions, setPermissions
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject
canRequesterAdd, canRequesterDelete, canRequesterUpdate, checkAllowed, copyAttributes, count, createSecurityCache, delete, getRequestingUid, getRequestingUser, getString, getString, getString, getString, getString, getString, getSystemUid, instantiate, isAllowed, search, setRequestingUid, setRequestingUser
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.DBObject
addDetail, addField, addField, addFieldError, addFoundKeys, addIfNeeded, addIndex, addKey, addMaster, addOrUpdate, addSortKey, addTransition, addVirtualField, addVirtualField, addVirtualField, addVirtualField, average, basicAdd, cacheIsChangedComparison, canUseRetrieve, checkAllReferredToBy, checkAllRefs, checkAllRefsPublic, checkField, checkMutable, checkRef, checkRef, clear, clearDistinctFields, clearError, clearFieldsToInput, clearFieldsToRetrieve, clearSortKeys, clone, containsWildCards, copyAllFields, deleteAll, deleteDetails, denotesRange, equals, fetchImmut, fetchImmutable, forKey, formatDateTime, get, getAllAttributes, getAttribute, getAttributesIterator, getBooleanFieldValue, getCacheSize, getCacheStatsMap, getCacheUtil, getCheckZeroUpdate, getCustomWhereClause, getDataContext, getDataField, getDataTransferObject, getDBName, getDetails, getDistinctFieldCount, getDistinctFields, getField, getFieldAttributesIterator, getFieldBigDecimal, getFieldBoolean, getFieldByte, getFieldByteArray, getFieldData, getFieldDate, getFieldDecimalFormatted, getFieldDouble, getFieldErrorMessage, getFieldFloat, getFieldInt, getFieldLong, getFieldMetaData, getFieldShort, getFieldsToInputCount, getFieldsToRetrieveCount, getFilterClass, getFoundCount, getFoundKeysArray, getIndexArray, getISOValuesDefault, getISOValuesDefault, getISOValuesDefault, getKey, getKeyFieldListIterator, getLength, getLengthInt, getLocale, getLogger, getLookupObject, getMax, getMax, getMaxRecords, getMyKeys, getMyUpdatesArray, getOffsetRecord, getPatternMatcher, getPrecision, getSerializedForm, getSizeEstimate, getStringFilter, getThisDBbj, getThisDBObj, getValidValueDescrip, getValidValues, getValidValuesList, getValues, getValuesDefault, getValuesDefault, getValuesDefault, hasError, hasErrors, haveAllKeys, initialize, isCached, isChanged, isDistinct, isEmpty, isFieldDistinct, isFieldNull, isFieldsToInput, isFieldsToRetrieve, isFieldToRetrieve, isMultiValued, isMutable, isMutable, isReadOnly, isSecret, isVirtual, loadFromConnection, logChange, max, min, newInstance, noNewLine, noQuotes, notifyListeners, referredToBy, removeAttribute, removeFromCache, retrieveFromCache, saveBinaryField, search, set, setAttribute, setCacheLimit, setCacheLimit, setCacheLimitAsPercent, setCacheSize, setCharset, setCheckZeroUpdate, setConnection, setConnection, setCustomWhereClause, setCustomWhereClause, setDataContext, setDataField, setDataTransferObject, setDefaultValue, setDescription, setField, setField, setField, setField, setField, setField, setField, setField, setField, setField, setFieldData, setFieldData, setFieldDistinct, setFieldsToInput, setFieldsToRetrieve, setFilterClass, setFilterClass, setKey, setKeys, setLocale, setLookupField, setLookupObject, setMask, setMaxRecords, setMultiValued, setName, setOffsetRecord, setReadOnly, setSchema, setSecret, setSortKey, setStringFilter, setStringFiltersOnAll, setTargetDbSchema, setTargetTable, sqlAggrFunction, sum, toDebugString, update, updateAll, updateAll, updateIsChanged, verify
 
Methods inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
addInParam, addOutParam, buildWhereClause, buildWhereClauseBuffer, checkZeroUpdate, constructNewMetaData, createAndExecuteSearch, createAndRunStoreProcedure, createSQLSelectStatement, createSQLSelectStatement, getConnectionPool, getCustomStringFieldValue, getDef, getDistinctFieldArrayList, getExecutor, getFieldsToInputIterator, getFieldsToRetrieveIterator, getJDBCMetaData, getJDBCUtil, getLocalConnection, getMappedDataContext, getMetaData, getQueryInterface, getSerialForm, loadFromConnection, makeLimitationStub, quoteIfNeeded, runStoredProcedure, runStoredProcedureAndRetrieveList, selectFieldString, setCaseSensitiveQuery, setDBConnectionPool, setDBName, setMappedDataContext, setOriginalDBName, setTargetStoreProcedure
 
Methods inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject
getGlobalMask, getStatus, isGlobalMasked, setFieldsWithDefaults, setGlobalMask, setStatus
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_ID

public static final String NODE_ID
See Also:
Constant Field Values

NODE_TYPE

public static final String NODE_TYPE
See Also:
Constant Field Values

NODE_OWNER

public static final String NODE_OWNER
See Also:
Constant Field Values

NODE_TITLE

public static final String NODE_TITLE
See Also:
Constant Field Values

NODE_ANNOTATION

public static final String NODE_ANNOTATION
See Also:
Constant Field Values

NODE_CREATED

public static final String NODE_CREATED
See Also:
Constant Field Values

NODE_MODIFIED

public static final String NODE_MODIFIED
See Also:
Constant Field Values

NODE_PATH

public static final String NODE_PATH
See Also:
Constant Field Values

NODE_MIME_TYPE

public static final String NODE_MIME_TYPE
See Also:
Constant Field Values

NODE_COMMENT

public static final String NODE_COMMENT
See Also:
Constant Field Values

RELATION_JOIN

public static final String RELATION_JOIN
See Also:
Constant Field Values

NODE_TABLE

public static final String NODE_TABLE
See Also:
Constant Field Values

NODE_JOIN

public static final String NODE_JOIN
See Also:
Constant Field Values

ATTRIBUTE_JOIN

public static final String ATTRIBUTE_JOIN
See Also:
Constant Field Values

RELATED_DELIMITER

public static final String RELATED_DELIMITER
XML: used to seperate 2 halves of name for related node tags.

See Also:
Constant Field Values

REF_ID

public static final String REF_ID
See Also:
Constant Field Values

RELATED

public static final String RELATED
See Also:
Constant Field Values

REFERENCE

public static final String REFERENCE
See Also:
Constant Field Values

ID_DELIMITER

public static final String ID_DELIMITER
Used to separate machine name from internal ID, for creating universally unique IDs ("global" ids).

See Also:
getGlobalId(), Constant Field Values

IDENT_TAG_NAME

public static final String IDENT_TAG_NAME
See Also:
Constant Field Values

GROUP_OF_OWNER

public static final String GROUP_OF_OWNER
virtual field; convenience for sorting

See Also:
Constant Field Values

REFS_ONLY

public static final String REFS_ONLY
See Also:
Constant Field Values

IGNORE_RELATIONS

public static final String IGNORE_RELATIONS
See Also:
Constant Field Values

INDENT

public static final String INDENT
optional attribute which will hold indentation level for tree access

See Also:
Constant Field Values

FULL_XML

public static final String FULL_XML
See Also:
Constant Field Values

RELATION_TYPE_JOIN

public static final String RELATION_TYPE_JOIN
See Also:
Constant Field Values

numCalls

static int numCalls
Constructor Detail

Node

public Node(ReadOnlyUser user)
     throws DBException
Throws:
DBException

Node

public Node()
     throws DBException
Constructor without parameters is required by framework, but if you use this constructor, be sure to setRequestingUid() after instantiation.

Throws:
DBException - upon error.

Node

public Node(DBConnection theConnection,
            int theUser)
     throws DBException
Constructor.

Parameters:
theConnection - DBConnection to be used to communicate with the database
theUser - User name attempting to access the object
Throws:
DBException - If the user cannot access this object or the object cannot be initialized

Node

public Node(ExpressoRequest request,
            String id)
     throws DBException
Constructs a Node with the given 'context' and the given Id.

Parameters:
id - String the node id. (String)
request - the ExpressoRequest object.
Throws:
DBException - If the user cannot access this object or the object cannot be initialized

Node

public Node(String id)
     throws DBException
Constructs a Node that has the given string id. Security Parameters are set by RowSecuredDBObject's default constructors using the RequestRegistry

Parameters:
id - String the node id. (String)
Throws:
DBException - upon error.

Node

public Node(ExpressoRequest request)
     throws DBException
Parameters:
request - the ExpressoRequest object.
Throws:
DBException - If the user cannot access this object or the object cannot be initialized

Node

public Node(SecuredDBObject node)
     throws DBException
Constructs a node using another object as the security credentials.

Parameters:
node - SecuredDBObject
Throws:
DBException - upon construction error.

Node

public Node(org.dom4j.Element root)
     throws DBException
Constructs a Node from an XML Element.

Parameters:
root - Element The Element to parse.
Throws:
DBException - upon error.

Node

public Node(ExpressoRequest request,
            org.dom4j.Element root)
     throws DBException
Construct node from XML--just basic XML attributes, NOT related nodes, or model-app Attributes side-effect: also adds DBObject.setAttribute() items for root param, and one for ident.

Parameters:
request - the ExpressoRequest object.
root - The Root Element to load.
Throws:
DBException - upon database access error.
Method Detail

getTags

public List getTags()
             throws DBException
Returns:
list of NodeTag instances for this node
Throws:
DBException

setupFields

protected void setupFields()
                    throws DBException
Defines the database table name and fields for this DB object.

Overrides:
setupFields in class DBObject
Throws:
DBException - if the operation cannot be performed

populateDefaultValues

public void populateDefaultValues()
                           throws DBException
Add sample record.

Overrides:
populateDefaultValues in class DBObject
Throws:
DBException - if the operation cannot be performed

setNodeId

public void setNodeId(String id)
               throws DBException
Throws:
DBException

getNodeType

public String getNodeType()
                   throws DBException
Throws:
DBException

setNodeType

public void setNodeType(String type)
                 throws DBException
Throws:
DBException

getNodeId

public String getNodeId()
                 throws DBException
Throws:
DBException

addAttribute

public Attribute addAttribute(String attribType,
                              String value,
                              String comment)
                       throws DBException
Adds a new attribute to be associated with this node.

Parameters:
attribType - String the attribute type.
value - String the attribute value.
comment - String the attribute comment.
Returns:
Attribute the resulting saved attribute.
Throws:
DBException - upon general database error.

updateAttribute

public Attribute updateAttribute(String attributeId,
                                 String value,
                                 String comment)
                          throws DBException,
                                 DBRecordNotFoundException
Saves an attributes for the node, touching the node as necessary, etc.

Parameters:
attributeId - the attribute to update.
Returns:
Attribute the resulting attribute.
Throws:
DBException - upon general DBObject error.
DBRecordNotFoundException - if the attribute wasn't found.

getNodeTitle

public String getNodeTitle()
                    throws DBException
Get the node's title.

Returns:
current title or "" -- never null
Throws:
DBException - upon database access error.

getRawRelated

public List getRawRelated(String relation,
                          String nodeType)
                   throws DBException
Parameters:
relation -
nodeType -
Returns:
a list of MultiDBObject which are products of an SQL join, in order by relation order
Throws:
DBException - upon database access error.

getRawRelated

public List getRawRelated()
                   throws DBException
return all nodes related to this node as source

Returns:
a list of MultiDBObject which are products of an SQL join, in order by relation order
Throws:
DBException - upon database access error.

getRawRelatedUsingDataObjects

public List getRawRelatedUsingDataObjects()
                                   throws DBException
Grabs a list of joined data objects based on the matrix join.

Returns:
List of JoinedDataObjects
Throws:
DBException - upon join creation/execution error.

getRawRelatedAssumeSecure

public List getRawRelatedAssumeSecure(String dbname,
                                      String relation,
                                      String typeOfPart)
                               throws DBException
Get related nodes, without ID test (for speed).

Parameters:
dbname - the database object to load from.
relation -
typeOfPart -
Returns:
a list of MultiDBObject which are products of an SQL join, in alpha order by title
Throws:
DBException - upon database access error.

getRelatedNodes

public Node[] getRelatedNodes(String relation,
                              String typeOfPart)
                       throws DBException
Returns:
a list of Nodes which are products of an SQL join, in by relation order; can be empty list; never returns null
Throws:
DBException - upon database access error.

getAttributes

public Attribute[] getAttributes(String attribType)
                          throws DBException
Fetch any attributes of this node, of this type, in alpha order by value.

Returns:
an array of Attributes; NEVER null, but could be empty
Throws:
DBException - upon database access error.

getMultiValuedAttributeMenu

public ValidValue[] getMultiValuedAttributeMenu()
                                         throws DBException
Throws:
DBException

getAttributesAssumeSecure

public Attribute[] getAttributesAssumeSecure(String attribType)
                                      throws DBException
Fetch any attributes of this node, of this type, in alpha order by value, using System ID to speed recall w/o permissions check.

Returns:
an array of Attributes; NEVER null, but could be empty
Throws:
DBException - upon database access error.

getAttributes

public List getAttributes()
                   throws DBException
Fetch all attributes of this node OF ALL KINDS.

Returns:
a list of Attributes
Throws:
DBException - upon database access error.

getNodeAnnotation

public String getNodeAnnotation()
                         throws DBException
Throws:
DBException

getNodeAnnotationRaw

public String getNodeAnnotationRaw()
                            throws DBException
Throws:
DBException

getNodeCommentRaw

public String getNodeCommentRaw()
                         throws DBException
Throws:
DBException

getNodeComment

public String getNodeComment()
                      throws DBException
Throws:
DBException

setNodeTitle

public void setNodeTitle(String title)
                  throws DBException
Throws:
DBException

cloneSibling

public Node cloneSibling(String title)
                  throws DBException
Creates and returns a deep copy of this object--everything, including links to "contained by" objects above this one.

Parameters:
title - The Node Title.
Returns:
a cloned sibling.
Throws:
DBException - upon database access error.
See Also:
cloneOrphan(java.lang.String)

getSrcRelations

public Relation[] getSrcRelations()
                           throws DBException
Fet relations for which my ID is marked as source.

Returns:
an array of relations.
Throws:
DBException - upon database access error.

getDestRelations

public Relation[] getDestRelations()
                            throws DBException
Get relations for which my ID is marked as destination.

Returns:
an array of relations, never null
Throws:
DBException - upon database access error.

delete

public void delete(boolean deleteDetails)
            throws DBException
Delete row.

Overrides:
delete in class RowSecuredDBObject
Throws:
DBException - upon database access error.

getNodeOwner

public String getNodeOwner()
                    throws DBException
Throws:
DBException

getNodeCreated

public String getNodeCreated()
                      throws DBException
Throws:
DBException

getNodeModified

public String getNodeModified()
                       throws DBException
Throws:
DBException

getVersion

public String getVersion()
                  throws DBException
Returns:
version number for this node type
Throws:
DBException - upon database access error.

add

public void add()
         throws DBException
We override to set dates (by superclass) but rather to add default permissions.

Specified by:
add in interface DataObject
Overrides:
add in class RowSecuredDBObject
Throws:
DBException - upon database access error.
See Also:
for a better way to add() with specific permissions

update

public void update()
            throws DBException
We override to set dates, and make sure perms are complete.

Specified by:
update in interface DataObject
Overrides:
update in class RowSecuredDBObject
Throws:
DBException - upon database access error.

getXML

public org.dom4j.Element getXML(ExpressoRequest request,
                                ArrayList alreadyIncluded)
                         throws DBException
Format XML for this node. Note that double quotes are removed from regular fields (varchar fields) by the JDBC escape handler. longvarchar fields, on the other hand, are not filtered by this handler, NOR by standard calls to getField which would normally use the FilterManager. so longvarchar fields must be filtered manually.

This routine is intensive on DB. To lighten load, security checks are reduced after first node. related nodes are assumed readable, so we use "superuser"

Parameters:
alreadyIncluded - list of nodes already included in XML; used to prevent infinite loop if a circular relation is found
request - the ExpressoRequest object.
Returns:
dom4j Element.
Throws:
DBException - upon database access error.

getNodeTypesWithRefOnly_Map

public static HashMap getNodeTypesWithRefOnly_Map(ExpressoRequest request)
Parameters:
request - the ExpressoRequest object.
Returns:
hashmap of param values which have name 'refs_only'

getIgnoredRelations

public static HashMap getIgnoredRelations(ExpressoRequest request)
Parameters:
request - the ExpressoRequest object.
Returns:
map of param values which have name 'IGNORE_RELATIONS'

getGlobalId

public String getGlobalId()
                   throws DBException
For creating universally unique IDs ("global" ids) by combining machine name with internal ID.

Returns:
node id.
Throws:
DBException - upon database access error.

getRecentEditor

public String getRecentEditor()
                       throws DBException
Throws:
DBException

setRecentEditor

public void setRecentEditor(String username)
                     throws DBException
Throws:
DBException

getEntity

public NodeType getEntity()
                   throws DBException
Get node type; will throw if node type is not set or cannot be found.

Returns:
entity named by the node type of this node
Throws:
DBException - upon database access error.

cloneOrphan

public Node cloneOrphan(String title)
                 throws DBException
Create clone which copies all EXCEPT "upstream" links.

Parameters:
title - The Node Title.
Returns:
cloned Node
Throws:
DBException - upon database access error.
See Also:
cloneSibling(java.lang.String)

compareTo

public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive.

The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.

It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this Object.

view

public void view(AbstractDBController defaultaction,
                 ExpressoRequest request,
                 ExpressoResponse response)
          throws DBException,
                 ControllerException
Allow a special hander to create custom view, while providing default view also.

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

setNodeAnnotation

public void setNodeAnnotation(String annotation)
                       throws DBException
Throws:
DBException

setNodeComment

public void setNodeComment(String s)
                    throws DBException
Throws:
DBException

setNodeOwner

public void setNodeOwner(String nodeOwner)
                  throws DBException
Parameters:
nodeOwner - login name of last editor
Throws:
DBException

getShallowContainedNodes

public Node[] getShallowContainedNodes(String type,
                                       ExpressoRequest request)
                                throws DBException
Find nodes contained just beneath this one.

Parameters:
request - the ExpressoRequest object.
Returns:
array of nodes which have relation RelationType .DEST_IS_PART_OF_SRC with our node as "src"
Throws:
DBException - upon database access error.

cloneTree

public Node cloneTree(String suffix,
                      HashMap itemInfo)
               throws DBException
Recursively clone contained tree beneath this node, including this node.

Returns:
cloned node instance.
Throws:
DBException - upon database access error.

parseXMLRelations

public List parseXMLRelations(Map allNodesByXML_ID,
                              boolean isExternalRefRequired)
                       throws Exception
Parse xml to create relations; all nodes from xml are assumed already created by Node(xml) constructor.

Parameters:
allNodesByXML_ID - all nodes put in hash with key of the ID in the import XML, to ease relationship-building.
Returns:
a list of nodes which where discovered, and which need processing
Throws:
Exception - upon DOM or database error.

parseXMLAttributes

public void parseXMLAttributes(Map allNodesByXML_ID,
                               ExpressoRequest request,
                               Map translatePicklistMap)
                        throws Exception
Parse xml to create relations and attributes; nodes are assumed already created by Node(xml) constructor, and allNodes has map of all nodes.

SIDE-EFFECT: removes attribute for xml from this node--we are finished with xml, and this is a flag that no more parsing is required/allowed

Parameters:
allNodesByXML_ID - java.util.Map
request - The ExpressoRequest Object
translatePicklistMap - map of old ID to new picklist item, for translation
Throws:
Exception - upon database or DOM error.

getNodesInStronglyRelatedTree

public void getNodesInStronglyRelatedTree(ExpressoRequest request,
                                          HashMap outputMap)
                                   throws DBException
Get ALL related nodes in tree beneath this node EXCEPT types indicated for omission recurses into tree; side-effect: adds attribute 'level' with node level w/i tree to each node.

Uses optional INDENT attribute to determine formatting indentation

Parameters:
request - The ExpressoRequest object.
outputMap - which will end up containing all nodes in tree; hand in empty map to begin with
Throws:
DBException - upon database access error.
See Also:
INDENT

getNodesInStronglyRelatedTree

public void getNodesInStronglyRelatedTree(Map outputMap)
                                   throws DBException
Get ALL related nodes in tree beneath this node EXCEPT types indicated for omission recurses into tree; side-effect: adds attribute 'level' with node level w/i tree to each node.

uses optional INDENT attribute to determine formatting indentation

Parameters:
outputMap - which will end up containing all nodes in tree; hand in empty map to begin with
Throws:
DBException - upon database access error.
See Also:
INDENT

getParts

public Part[] getParts()
                throws DBException
Get all parts within this node.

Returns:
An array of Parts for this node.
Throws:
DBException - upon database error.

touch

public void touch()
           throws DBException
Set recent editor and modification date. To save bandwidth and ease, this function will not update if all the conditions are true.
  1. The current user is the same as the last editor
  2. Less then a second has passed since the last update.

Throws:
DBException - upon database error.

getViewTrans

public Transition getViewTrans()
                        throws DBException
provide a transition for viewing this object, suitable for creating an HTTP link

Specified by:
getViewTrans in interface IViewable
Returns:
transtion for viewing, including label for name of object; never null
Throws:
DBException - upon database access error.

acceptVisitor

public void acceptVisitor(ModelVisitor visitor)
Description copied from interface: ModelVisitable
Accepts the visitor and redirects the visitor to the appropriate type we're dealing with.

Specified by:
acceptVisitor in interface ModelVisitable
Parameters:
visitor - ViewVisitor

getNodeTitleRaw

public String getNodeTitleRaw()
                       throws DBException
Throws:
DBException

getRelatedNodesHash

public Map getRelatedNodesHash(String relationType,
                               String targetNodeType,
                               List toPopulateOldRemainingList)
                        throws DBException
Find all properly-typed nodes related to this source node, with relation of given type.

Parameters:
relationType - the relationship type
targetNodeType - nodes of this type (only) will be returned
toPopulateOldRemainingList - (returned param) list to receive ordered list of MultiDBObjects; pass in null if you don't want this list added
Returns:
hash with key = node Id, value = node
Throws:
DBException - upon error.

updateNodeRelations

public void updateNodeRelations(String targetNodeType,
                                String relationType,
                                String[] targetNodeIds)
                         throws DBException
Updates the specified node relation to reflect the new values specified in the targetNodeIds.

Parameters:
targetNodeType - String
relationType - String
targetNodeIds - String[]
Throws:
DBException

getStronglyRelatedNodes

public Node[] getStronglyRelatedNodes()
                               throws DBException
get all nodes that have this node as 'src' for some strong relation

Returns:
array, never null
Throws:
DBException


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