|
||||||||||
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.sri.emo.dbobj.Relation
public class Relation
Encapsulate a linkage between two nodes.
Relation should NOT be subclassed from RowSecuredDBObject because a relationship can be established in either direction, by either owning party, and if the source or destination node is removed, the relationship should be removed. In other words, the relationship should not be owned by anyone, so that it may be removed by either "owning" party.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jcorporate.expresso.core.dbobj.DBObject |
---|
DBObject.FieldError, DBObject.FieldUpdate |
Field Summary | |
---|---|
static String |
RELATION_ANNOTATION
|
static String |
RELATION_CREATED
|
static String |
RELATION_DEST
|
static String |
RELATION_MODIFIED
|
static String |
RELATION_ORDER
|
static String |
RELATION_OWNER
|
static String |
RELATION_SRC
|
static String |
RELATION_TYPE
|
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 | |
---|---|
Relation()
Default constructor for Relation
creates a new object of this type with no connection
yet allocated. |
|
Relation(ControllerRequest request)
Deprecated. Use RequestRegistry to propage these parameters instead. |
|
Relation(DBConnection theConnection)
Constructor |
|
Relation(DBConnection theConnection,
int theUser)
Constructor |
|
Relation(ReadOnlyUser userSecurity)
Constructor for security setup. |
|
Relation(SecuredDBObject obj)
|
Method Summary | |
---|---|
void |
acceptVisitor(ModelVisitor visitor)
Accepts the visitor and redirects the visitor to the appropriate type we're dealing with. |
void |
add()
handle inverse too |
Relation |
clone(String cloneNodeId,
String fieldname)
Deep copy fields. |
Relation |
clone(String cloneNodeId,
String fieldname,
String relType)
Deep copy fields. |
int |
compareTo(Object o)
Compares this object with the specified object for order. |
void |
delete(boolean deleteDetails)
Handle inverse too. |
String |
getDestId()
|
Node |
getDestNode()
|
String |
getOrder()
|
int |
getOrderInt()
|
String |
getRelationTypeName()
|
String |
getSrcId()
|
Node |
getSrcNode()
|
RelationType |
getType()
|
Transition |
getViewTrans()
This version assumes that we're looking at the node that is the source node since we don't have enough information to choose otherwise. |
boolean |
isReflexive()
|
boolean |
isStrong()
|
boolean |
isUpstreamLink(String srcOrDest)
|
void |
setDestId(String id)
|
void |
setOrder(int order)
|
void |
setOrder(String order)
|
void |
setRelationTypeName(String relationType)
|
void |
setSrcId(String id)
|
protected void |
setupFields()
Defines the database table name and fields for this DB object |
void |
update()
we override to handle case where relation type is manipulated. |
void |
updateOrder()
normal update is disallowed, but update JUST for order is ok since we are not updating primary key that way |
Methods inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject |
---|
canRequesterAdd, canRequesterDelete, canRequesterRead, canRequesterUpdate, checkAllowed, copyAttributes, count, createSecurityCache, delete, deleteAll, find, getRequestingUid, getRequestingUser, getString, getString, getString, getString, getString, getString, getSystemUid, instantiate, isAllowed, retrieve, search, searchAndRetrieveList, searchAndRetrieveList, 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 RELATION_SRC
public static final String RELATION_DEST
public static final String RELATION_TYPE
public static final String RELATION_ANNOTATION
public static final String RELATION_OWNER
public static final String RELATION_CREATED
public static final String RELATION_MODIFIED
public static final String RELATION_ORDER
Constructor Detail |
---|
public Relation() throws DBException
Relation
creates a new object of this type with no connection
yet allocated.
DBException
- If the new object cannot be
createdpublic Relation(DBConnection theConnection) throws DBException
theConnection
- Database connection to
communicate with the database
DBException
- If the new object cannot be
createdpublic Relation(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 Relation(ControllerRequest request) throws DBException
request
- ControllerRequest
DBException
public Relation(ReadOnlyUser userSecurity) throws DBException
userSecurity
- ReadOnlyUser security context.
DBException
- upon construction error.public Relation(SecuredDBObject obj) throws DBException
DBException
Method Detail |
---|
protected void setupFields() throws DBException
setupFields
in class DBObject
DBException
- if the operation cannot be performedpublic Relation clone(String cloneNodeId, String fieldname) throws DBException
cloneNodeId
- the id of the node being clonedfieldname
- within this Relation object, the name of the Relation field (RELATION_SRC or RELATION_DEST)
which the cloned node occupies; in other words, clone the other field, replace this field
DBException
- upon database error.public Relation clone(String cloneNodeId, String fieldname, String relType) throws DBException
cloneNodeId
- the id of the node being clonedfieldname
- within this Relation object, the name of the Relation field (RELATION_SRC or RELATION_DEST)
which the cloned node occupies; in other words, clone the other field, replace this fieldrelType
- The relationship type.
DBException
- upon database error.public void setSrcId(String id) throws DBException
DBException
public void setDestId(String id) throws DBException
DBException
public String getRelationTypeName() throws DBException
DBException
public void setRelationTypeName(String relationType) throws DBException
DBException
public String getDestId() throws DBException
DBException
public String getSrcId() throws DBException
DBException
public Node getSrcNode() throws DBException
DBException
public void add() throws DBException
add
in interface DataObject
add
in class SecuredDBObject
DBException
- If the user is not permitted to add
or if the add failspublic void updateOrder() throws DBException
DBException
- if the update to the database fails due to
a database errorpublic boolean isReflexive() throws DBException
DBException
public RelationType getType() throws DBException
DBException
public void delete(boolean deleteDetails) throws DBException
delete
in class DBObject
deleteDetails
- true if detail fields should be deteled as well.
DBException
- if delete is not allowed for the current userpublic void update() throws DBException
update
in interface DataObject
update
in class SecuredDBObject
DBException
- because this operation disallowed, in favor of delete() + add()public Node getDestNode() throws DBException
DBException
public boolean isUpstreamLink(String srcOrDest) throws DBException
srcOrDest
- use either Relation.RELATION_DEST or Relation.RELATION_SRC to indicate
what kind of containment relation (there are 2 relations that are inverses)
DBException
- upon database error.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 int getOrderInt() throws DBException
DBException
public void setOrder(String order) throws DBException
DBException
public void setOrder(int order) throws DBException
DBException
public String getOrder() throws DBException
DBException
public Transition getViewTrans() throws DBException
getViewTrans
in interface IViewable
DBException
- if src or dest IDs not foundpublic void acceptVisitor(ModelVisitor visitor)
ModelVisitable
acceptVisitor
in interface ModelVisitable
visitor
- ViewVisitorpublic boolean isStrong() throws DBException
DBException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |