|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jcorporate.expresso.core.dataobjects.BaseDataObject com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject com.jcorporate.expresso.core.dbobj.DBObject com.jcorporate.expresso.core.dbobj.SecuredDBObject com.jcorporate.expresso.core.dbobj.RowSecuredDBObject com.sri.emo.dbobj.Node
public class Node
Encapsulate an element in a linked graph.
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.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 |
---|
public static final String NODE_ID
public static final String NODE_TYPE
public static final String NODE_OWNER
public static final String NODE_TITLE
public static final String NODE_ANNOTATION
public static final String NODE_CREATED
public static final String NODE_MODIFIED
public static final String NODE_PATH
public static final String NODE_MIME_TYPE
public static final String NODE_COMMENT
public static final String RELATION_JOIN
public static final String NODE_TABLE
public static final String NODE_JOIN
public static final String ATTRIBUTE_JOIN
public static final String RELATED_DELIMITER
public static final String REF_ID
public static final String RELATED
public static final String REFERENCE
public static final String ID_DELIMITER
getGlobalId()
,
Constant Field Valuespublic static final String IDENT_TAG_NAME
public static final String GROUP_OF_OWNER
public static final String REFS_ONLY
public static final String IGNORE_RELATIONS
public static final String INDENT
public static final String FULL_XML
public static final String RELATION_TYPE_JOIN
static int numCalls
Constructor Detail |
---|
public Node(ReadOnlyUser user) throws DBException
DBException
public Node() throws DBException
DBException
- upon error.public Node(DBConnection theConnection, int theUser) throws DBException
theConnection
- DBConnection to be used to
communicate with the databasetheUser
- User name attempting to access the
object
DBException
- If the user cannot access this
object or the object cannot be initializedpublic Node(ExpressoRequest request, String id) throws DBException
id
- String the node id. (String)request
- the ExpressoRequest
object.
DBException
- If the user cannot access this
object or the object cannot be initializedpublic Node(String id) throws DBException
id
- String the node id. (String)
DBException
- upon error.public Node(ExpressoRequest request) throws DBException
request
- the ExpressoRequest
object.
DBException
- If the user cannot access this
object or the object cannot be initializedpublic Node(SecuredDBObject node) throws DBException
node
- SecuredDBObject
DBException
- upon construction error.public Node(org.dom4j.Element root) throws DBException
root
- Element The Element to parse.
DBException
- upon error.public Node(ExpressoRequest request, org.dom4j.Element root) throws DBException
request
- the ExpressoRequest
object.root
- The Root Element to load.
DBException
- upon database access error.Method Detail |
---|
public List getTags() throws DBException
DBException
protected void setupFields() throws DBException
setupFields
in class DBObject
DBException
- if the operation cannot be performedpublic void populateDefaultValues() throws DBException
populateDefaultValues
in class DBObject
DBException
- if the operation cannot be performedpublic void setNodeId(String id) throws DBException
DBException
public String getNodeType() throws DBException
DBException
public void setNodeType(String type) throws DBException
DBException
public String getNodeId() throws DBException
DBException
public Attribute addAttribute(String attribType, String value, String comment) throws DBException
attribType
- String the attribute type.value
- String the attribute value.comment
- String the attribute comment.
DBException
- upon general database error.public Attribute updateAttribute(String attributeId, String value, String comment) throws DBException, DBRecordNotFoundException
attributeId
- the attribute to update.
DBException
- upon general DBObject error.
DBRecordNotFoundException
- if the attribute wasn't found.public String getNodeTitle() throws DBException
DBException
- upon database access error.public List getRawRelated(String relation, String nodeType) throws DBException
relation
- nodeType
-
DBException
- upon database access error.public List getRawRelated() throws DBException
DBException
- upon database access error.public List getRawRelatedUsingDataObjects() throws DBException
DBException
- upon join creation/execution error.public List getRawRelatedAssumeSecure(String dbname, String relation, String typeOfPart) throws DBException
dbname
- the database object to load from.relation
- typeOfPart
-
DBException
- upon database access error.public Node[] getRelatedNodes(String relation, String typeOfPart) throws DBException
DBException
- upon database access error.public Attribute[] getAttributes(String attribType) throws DBException
DBException
- upon database access error.public ValidValue[] getMultiValuedAttributeMenu() throws DBException
DBException
public Attribute[] getAttributesAssumeSecure(String attribType) throws DBException
DBException
- upon database access error.public List getAttributes() throws DBException
DBException
- upon database access error.public String getNodeAnnotation() throws DBException
DBException
public String getNodeAnnotationRaw() throws DBException
DBException
public String getNodeCommentRaw() throws DBException
DBException
public String getNodeComment() throws DBException
DBException
public void setNodeTitle(String title) throws DBException
DBException
public Node cloneSibling(String title) throws DBException
title
- The Node Title.
DBException
- upon database access error.cloneOrphan(java.lang.String)
public Relation[] getSrcRelations() throws DBException
DBException
- upon database access error.public Relation[] getDestRelations() throws DBException
DBException
- upon database access error.public void delete(boolean deleteDetails) throws DBException
delete
in class RowSecuredDBObject
DBException
- upon database access error.public String getNodeOwner() throws DBException
DBException
public String getNodeCreated() throws DBException
DBException
public String getNodeModified() throws DBException
DBException
public String getVersion() throws DBException
DBException
- upon database access error.public void add() throws DBException
add
in interface DataObject
add
in class RowSecuredDBObject
DBException
- upon database access error.for a better way to add() with specific permissions
public void update() throws DBException
update
in interface DataObject
update
in class RowSecuredDBObject
DBException
- upon database access error.public org.dom4j.Element getXML(ExpressoRequest request, ArrayList alreadyIncluded) throws DBException
alreadyIncluded
- list of nodes already included in XML; used to prevent infinite loop if a circular relation is foundrequest
- the ExpressoRequest
object.
DBException
- upon database access error.public static HashMap getNodeTypesWithRefOnly_Map(ExpressoRequest request)
request
- the ExpressoRequest
object.
public static HashMap getIgnoredRelations(ExpressoRequest request)
request
- the ExpressoRequest
object.
public String getGlobalId() throws DBException
DBException
- upon database access error.public String getRecentEditor() throws DBException
DBException
public void setRecentEditor(String username) throws DBException
DBException
public NodeType getEntity() throws DBException
DBException
- upon database access error.public Node cloneOrphan(String title) throws DBException
title
- The Node Title.
DBException
- upon database access error.cloneSibling(java.lang.String)
public int compareTo(Object o)
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."
compareTo
in interface Comparable
o
- the Object to be compared.
ClassCastException
- if the specified object's type prevents it
from being compared to this Object.public void view(AbstractDBController defaultaction, ExpressoRequest request, ExpressoResponse response) throws DBException, ControllerException
defaultaction
- the default controller.request
- the ExpressoRequest object.response
- the ExpressoResponse object.
DBException
- upon database access error.
ControllerException
- upon controller element related error.public void setNodeAnnotation(String annotation) throws DBException
DBException
public void setNodeComment(String s) throws DBException
DBException
public void setNodeOwner(String nodeOwner) throws DBException
nodeOwner
- login name of last editor
DBException
public Node[] getShallowContainedNodes(String type, ExpressoRequest request) throws DBException
request
- the ExpressoRequest
object.
DBException
- upon database access error.public Node cloneTree(String suffix, HashMap itemInfo) throws DBException
DBException
- upon database access error.public List parseXMLRelations(Map allNodesByXML_ID, boolean isExternalRefRequired) throws Exception
allNodesByXML_ID
- all nodes put in hash with key of the ID
in the import XML, to ease
relationship-building.
Exception
- upon DOM or database error.public void parseXMLAttributes(Map allNodesByXML_ID, ExpressoRequest request, Map translatePicklistMap) throws Exception
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
allNodesByXML_ID
- java.util.Maprequest
- The ExpressoRequest ObjecttranslatePicklistMap
- map of old ID to new picklist item, for translation
Exception
- upon database or DOM error.public void getNodesInStronglyRelatedTree(ExpressoRequest request, HashMap outputMap) throws DBException
request
- The ExpressoRequest object.outputMap
- which will end up containing all nodes in tree;
hand in empty map to begin with
DBException
- upon database access error.INDENT
public void getNodesInStronglyRelatedTree(Map outputMap) throws DBException
outputMap
- which will end up containing all nodes in tree;
hand in empty map to begin with
DBException
- upon database access error.INDENT
public Part[] getParts() throws DBException
DBException
- upon database error.public void touch() throws DBException
DBException
- upon database error.public Transition getViewTrans() throws DBException
getViewTrans
in interface IViewable
DBException
- upon database access error.public void acceptVisitor(ModelVisitor visitor)
ModelVisitable
acceptVisitor
in interface ModelVisitable
visitor
- ViewVisitorpublic String getNodeTitleRaw() throws DBException
DBException
public Map getRelatedNodesHash(String relationType, String targetNodeType, List toPopulateOldRemainingList) throws DBException
relationType
- the relationship typetargetNodeType
- nodes of this type (only) will be returnedtoPopulateOldRemainingList
- (returned param) list to receive ordered list of
MultiDBObjects; pass in null if you don't want this list added
DBException
- upon error.public void updateNodeRelations(String targetNodeType, String relationType, String[] targetNodeIds) throws DBException
targetNodeType
- StringrelationType
- StringtargetNodeIds
- String[]
DBException
public Node[] getStronglyRelatedNodes() throws DBException
DBException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |