|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object i3.dragos.gm.core.proxy.GraphEntityProxy i3.dragos.gm.core.proxy.RelationProxy
public class RelationProxy
A RelationProxy
delegates all method calls to the underlying
relation except for those that access fields which are used after a relation
has been deleted.
Field Summary |
---|
Fields inherited from class i3.dragos.gm.core.proxy.GraphEntityProxy |
---|
proxiedEntity |
Constructor Summary | |
---|---|
RelationProxy(Relation r)
Constructs a new wrapper for a relation. |
Method Summary | |
---|---|
RelationEnd |
createRelationEnd(GraphEntity target,
RelationEndClass type)
Creates a relation end. |
java.util.Collection<? extends RelationEnd> |
getAllRelationEndsOfRelation()
Returns a collection of all relation ends of this relation. |
java.util.Collection<? extends GraphEntity> |
getRelatedGraphEntitiesOfRelationEndsOfRelation(RelationEndClass type,
boolean includeSubClasses,
boolean set)
Returns a collection of entities referenced by this relation through relation ends. |
RelationClass |
getRelationClass()
Returns the relation's type. |
java.util.Collection<? extends RelationEnd> |
getRelationEndsOfRelation(RelationEndClass type,
boolean includeSubClasses)
Returns a collection of all relation ends of the specified type belonging to this relation. |
boolean |
isDirected()
Returns true if the relation is directed and
false otherwise. |
void |
removeAllRelationEndsOfRelation()
Removes all relation ends belonging to this relation from it. |
void |
removeRelationEnd(RelationEnd relationEndId)
Removes a relation end belonging to this relation from it. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface i3.dragos.gm.core.GraphEntity |
---|
equals, getAdjacentGraphEntities, getAdjacentRelations, getAdjacentRelations, getAllValidAttributeValues, getAttributeValue, getDataSourceURL, getEdges, getEdges, getGraphEntityClass, getInternalIdentifier, getParent, getRelationEnds, getRelationEnds, getRelationEnds, getWrappedGraphEntity, hashCode, isAttributeValid, isIncident, isIncident, putAttributeValue, setAttributeInvalid |
Methods inherited from interface i3.dragos.gm.core.schema.MetaAttributable |
---|
getAllMetaAttributes, getMetaAttribute, isMetaAttributeKeyReserved, isMetaAttributeSet, setMetaAttribute, unsetMetaAttribute |
Methods inherited from interface i3.dragos.gm.core.schema.ExistenceCheckable |
---|
checkExistence, checkExistenceOptional |
Constructor Detail |
---|
public RelationProxy(Relation r)
r
- The relation to wrap.Method Detail |
---|
public RelationClass getRelationClass() throws DragosException
getRelationClass
in interface Relation
DragosException
- if something went wrong.public boolean isDirected() throws DragosException
true
if the relation is directed and
false
otherwise.
A relation is directed if it contains at least one directed relation end. If all contained relation ends are undirected the relation is undirected, too.
isDirected
in interface Relation
true
if the relation is directed and false
otherwise.
DragosException
- if something went wrong.public RelationEnd createRelationEnd(GraphEntity target, RelationEndClass type) throws DragosException
The target
(if not null
)) has to be in the
same graph pool as this relation, otherwise an exception is thrown.
createRelationEnd
in interface Relation
target
- The graph element the relation end is connected to (may be null
).type
- The type of the new relation end (must not be null
).
EntityNotFoundException
- if the target was not
null
and could not be found, or if
the type for the relation end could not be found.
DragosException
- if something else went wrong.public void removeRelationEnd(RelationEnd relationEndId) throws EntityNotFoundException, DragosException
It simply performs an additional check whether the RelationEnd to
remove really belongs to this Relation, throwing an EntityNotFoundException
if not. Afterwards, it follows the same procedure as
Graph.removeGraphEntity(GraphEntity)
.
This method could/should be implemented roughly as follows:
if (! this.equals(relationEnd.getRelation())) { throw new EntityNotFoundException("RelationEnd " + relationEnd + " does not belong to " + toString()); } getParent().removeGraphEntity(relationEnd);
removeRelationEnd
in interface Relation
relationEndId
- the relation end which is removed.
EntityNotFoundException
- if the relation end couldn't be found or does not belong to this relation.
DragosException
- if something went wrong.public void removeAllRelationEndsOfRelation() throws DragosException
Graph.removeGraphEntity(GraphEntity)
,
and could / should be implemented using that method.
Relation ends connected to the relation, but not belongig to it, are not affected.
removeAllRelationEndsOfRelation
in interface Relation
DragosException
- if something went wrong .public java.util.Collection<? extends RelationEnd> getAllRelationEndsOfRelation() throws DragosException
RelationEnd
.
getAllRelationEndsOfRelation
in interface Relation
DragosException
- if anything went wrong.public java.util.Collection<? extends RelationEnd> getRelationEndsOfRelation(RelationEndClass type, boolean includeSubClasses) throws DragosException
If type == null
, this method is equivalent to
Relation.getAllRelationEndsOfRelation()
.
getRelationEndsOfRelation
in interface Relation
type
- The type of the relation ends to return
(null
means "any type").includeSubClasses
- Whether instances of subclasses of
type
should also be
returned (has no effect if
type == null
).
EntityNotFoundException
- if type != null
and type is not a dependent relation end class of relation's class.
DragosException
- if anything went wrong.public java.util.Collection<? extends GraphEntity> getRelatedGraphEntitiesOfRelationEndsOfRelation(RelationEndClass type, boolean includeSubClasses, boolean set) throws DragosException
In contrast to Relation.getRelationEndsOfRelation(RelationEndClass, boolean)
,
this method does not return the relation ends themselves,
but rather the related elements of each of these relation
ends.
If type == null
, this method will follow all
relation ends belonging to this relation.
getRelatedGraphEntitiesOfRelationEndsOfRelation
in interface Relation
type
- The type of the relation ends to follow
(null
means "any type").includeSubClasses
- Whether instances of subclasses of
type
should also be
followed (has no effect if
type == null
).set
- If true
, each entity is contained at
most once in the returned collection, even if
multiple relation ends lead to it.
EntityNotFoundException
- if type != null
and type is not a dependent relation end class of relation's class.
DanglingReferenceException
- if this method would have to traverse a dangling relation end.
DragosException
- if anything went wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |