|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GraphEntity
GraphEntity
is the base class of all graphs, edges, nodes,
relations and relation ends.
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Checks for equality with another object. |
java.util.Collection<? extends GraphEntity> |
getAdjacentGraphEntities(ConnectionMode connectionMode,
EdgeClass type,
boolean includeSubClasses)
Returns all adjacent graph entities connected through Edges. |
java.util.Collection<? extends Relation> |
getAdjacentRelations(ConnectionMode connectionMode,
RelationClass type,
boolean includeSubClasses)
Returns all adjacent Relations connected through RelationEnds. |
java.util.Collection<? extends Relation> |
getAdjacentRelations(ConnectionMode connectionMode,
RelationEndClass type,
boolean includeSubClasses)
Returns all adjacent Relations connected through RelationEnds. |
java.util.Map<Attribute,java.io.Serializable> |
getAllValidAttributeValues()
Returns a map containg all attributes which have a valid value at the moment. |
java.io.Serializable |
getAttributeValue(Attribute attribute)
Returns the value of the attribute. |
DataSourceURL |
getDataSourceURL()
Returns the URL to the data source that stores this graph entity. |
java.util.Collection<? extends Edge> |
getEdges(ConnectionMode connectionMode)
Returns a collection containing the ( Edge ) of all edges
of the requested kind connected to this graph element. |
java.util.Collection<? extends Edge> |
getEdges(ConnectionMode connectionMode,
EdgeClass type,
boolean includeSubClasses)
Returns a collection containing the ( Edge ) of all edges
of the requested kind and type connected to this graph element. |
GraphEntityClass |
getGraphEntityClass()
Returns the graph entity's type. |
java.io.Serializable |
getInternalIdentifier()
Returns the internal identifier used to uniquely identify this object in the storage backend. |
Graph |
getParent()
Returns the graph this graph element is contained in. |
java.util.Collection<? extends RelationEnd> |
getRelationEnds(ConnectionMode connectionMode)
Returns a collection containing all relation ends of the requested kind connected to this graph element. |
java.util.Collection<? extends RelationEnd> |
getRelationEnds(ConnectionMode connectionMode,
RelationClass type,
boolean includeSubClasses)
Returns a collection containing all relation ends of the requested kind and type connected to this graph element. |
java.util.Collection<? extends RelationEnd> |
getRelationEnds(ConnectionMode connectionMode,
RelationEndClass type,
boolean includeSubClasses)
Returns a collection containing all relation ends of the requested kind and type connected to this graph element. |
GraphEntity |
getWrappedGraphEntity()
Returns the wrapped entity, null if none. |
int |
hashCode()
To comply with the general contract for Object.hashCode() ,
it is recommended to return the hash code of the internal identifier. |
boolean |
isAttributeValid(Attribute attribute)
Returns true if the attribute's value is valid and
false otherwise. |
boolean |
isIncident(Edge edge)
Returns true if the specified edge is connected to this
graph element and false otherwise. |
boolean |
isIncident(RelationEnd relationEnd)
Returns true if the specified relation end is connected
to this graph element and false otherwise. |
void |
putAttributeValue(Attribute attribute,
java.io.Serializable value)
Stores a new value for the attribute and sets its validity to true . |
void |
setAttributeInvalid(Attribute attribute)
Marks an attribute's value as invalid. |
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 |
Method Detail |
---|
boolean equals(java.lang.Object o)
This object is considered equal if all of the following conditions are met:
o != null
o instanceof GraphEntity
getDataSourceURL().equals(((GraphEntity) o).getDataSourceURL())
getInternalIdentifier().equals(((GraphEntity) o).getInternalIdentifier())
Subclasses and implementations might want to extend this list by
adding assertions comparing additional or internal data (e.g. the type
of the graph entity). However, equality must only be determined by the
above rules, preferably by using super.equals(o)
, and any
difference in the additional data for two object equal according
to the rules above is to be considered an error.
equals
in class java.lang.Object
o
- The Object to compare to.
true
if o
is equal according to above
rules, false
otherwise.int hashCode()
Object.hashCode()
,
it is recommended to return the hash code of the internal identifier.
hashCode
in class java.lang.Object
DataSourceURL getDataSourceURL()
null
.
java.io.Serializable getInternalIdentifier()
To retrieve the entity use GraphPool.getGraphEntityByInternalIdentifier(Serializable)
.
As alternative you may consider to use the classes in the package
i3.dragos.gm.core.id
.
GraphEntityClass getGraphEntityClass() throws DragosException
null
.
DragosException
- if something went wrong.Graph getParent() throws DragosException
null
for and only for top-level graphs.
DragosException
- if something went wrong.void putAttributeValue(Attribute attribute, java.io.Serializable value) throws EntityNotFoundException, DragosException, java.lang.IllegalArgumentException
true
.
attribute
- The attribute.value
- The new value of the attribute. May be null
.
java.lang.IllegalArgumentException
- if id is null
or does not
match the attribute's value Java class type.
EntityNotFoundException
- if the attribute is not defined
for this entity.
DragosException
- if something went wrong.java.io.Serializable getAttributeValue(Attribute attribute) throws EntityNotFoundException, InvalidValueException, DragosException
null
.
The check whether the attribute is defined for this entity's class (which might result in an EntityNotFoundException) has to be performed every time, even when the non-existance of such an attribute in the implementations attribute map already would be sufficient to throw an InvalidValueException!
In other words: check the Attribute first, before trying to look up
the value.
This ensures conistency with the other attribute handling
methods and helps detect user errors.
attribute
- The attribute that should be retrieved.
java.lang.IllegalArgumentException
- if id is null
.
EntityNotFoundException
- if the attribute is not defined
stored for this entity.
InvalidValueException
- if the value of the attribute is not valid
(explicitly marked invalid or not set yet).
DragosException
- if something went wrong.java.util.Map<Attribute,java.io.Serializable> getAllValidAttributeValues() throws DragosException
Attribute
, Object}.
DragosException
- if something went wrong.void setAttributeInvalid(Attribute attribute) throws EntityNotFoundException, DragosException
The check whether this Attribute is defined for this entity's class
(which might result in an EntityNotFoundException) has to be performed
every time, even when the non-existance of such an attribute in the
implementations attribute map already would be sufficient return
without above check, since the attribute obviously must be invalid
already!
This ensures conistency with the other attribute handling
methods and helps detect user errors.
attribute
- The attribute.
java.lang.IllegalArgumentException
- if id is null
.
EntityNotFoundException
- if this attribute is not defined for this entity.
DragosException
- if something went wrong.boolean isAttributeValid(Attribute attribute) throws EntityNotFoundException, DragosException
true
if the attribute's value is valid and
false
otherwise.
The check whether this Attribute is defined for this entity's class
(which might result in an EntityNotFoundException) has to be performed
every time, even when the non-existance of such an attribute in the
implementations attribute map already would be sufficient to return
false
without above check!
This ensures conistency with the other attribute handling
methods and helps detect user errors.
attribute
- The attribute.
true
if the attribute's value is valid and
false
otherwise.
java.lang.IllegalArgumentException
- if id is null
.
EntityNotFoundException
- if this attribute is not defined for this entity.
DragosException
- if something went wrong.java.util.Collection<? extends Edge> getEdges(ConnectionMode connectionMode) throws DragosException
Edge
) of all edges
of the requested kind connected to this graph element.
connectionMode
- The kind of edges that should be returned.
Edge
) of all edges
of the requested kind connected to this graph element.
DragosException
- if something went wrong.java.util.Collection<? extends Edge> getEdges(ConnectionMode connectionMode, EdgeClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
Edge
) of all edges
of the requested kind and type connected to this graph element.
connectionMode
- The kind of edges that should be returned.type
- The type of edges wanted (null
means "any
type").includeSubClasses
- If and only if true
, this method will
also match edges whose EdgeClass is a subclass of the specified
type (ignored if type == null
).
Edge
) of all edges
of the requested kind and type connected to this graph element.
EntityNotFoundException
- if the type for the edge couldn't be
found.
DragosException
- if something went wrong.boolean isIncident(Edge edge) throws DragosException
true
if the specified edge is connected to this
graph element and false
otherwise.
edge
- The edge, which will be checked.
true
if the specified edge is connected to this
graph element and false
otherwise.
DragosException
- if something went wrong.java.util.Collection<? extends GraphEntity> getAdjacentGraphEntities(ConnectionMode connectionMode, EdgeClass type, boolean includeSubClasses) throws EntityNotFoundException, DanglingReferenceException, DragosException
connectionMode
- The kind of edges that should be followed.type
- The type of edges to follow (null
means "any
type").includeSubClasses
- If and only if true
, this method will
also match edges whose EdgeClass is a subclass of the specified
type (ignored if type == null
).
EntityNotFoundException
- if the type for the edge couldn't be found.
DanglingReferenceException
- if this method would have to traverse a dangling edge.
DragosException
- if something went wrong.java.util.Collection<? extends RelationEnd> getRelationEnds(ConnectionMode connectionMode) throws DragosException
"Connected" means that this graph entity is
the "relatedElement" of the relation end. This implies that,
if this method is called on a relation, relation ends belonging to
the relation will only be returned if they point back to it.
To access all dependent relation ends of a relation, see
Relation.getAllRelationEndsOfRelation()
.
connectionMode
- The kind of relation ends that should be returned.
DragosException
- if something went wrong.java.util.Collection<? extends RelationEnd> getRelationEnds(ConnectionMode connectionMode, RelationClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
"Connected" means that this graph entity is
the "relatedElement" of the relation end. This implies that,
if this method is called on a relation, relation ends belonging to
the relation will only be returned if they point back to it.
To access all dependent relation ends of a relation, see
Relation.getAllRelationEndsOfRelation()
.
connectionMode
- The kind of relation ends that should be returned.type
- The type of the relation the relation end belongs to
(null
means "any type").includeSubClasses
- If and only if true
, this method
will also match relations whose RelationClass is a subclass
of the specified type (ignored if type == null
).
EntityNotFoundException
- if the type for the relation couldn't be
found.
DragosException
- if something went wrong.java.util.Collection<? extends RelationEnd> getRelationEnds(ConnectionMode connectionMode, RelationEndClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
"Connected" means that this graph entity is
the "relatedElement" of the relation end. This implies that,
if this method is called on a relation, relation ends belonging to
the relation will only be returned if they point back to it.
To access all dependent relation ends of a relation, see
Relation.getAllRelationEndsOfRelation()
.
connectionMode
- The kind of relation ends that should be returned.type
- The type the relation ends have to belong to
(null
means "any type").includeSubClasses
- If and only if true
, this method
will also match relation ends whose RelationEndClass is a subclass
of the specified type (ignored if type == null
).
EntityNotFoundException
- if the type for the relation ends couldn't be
found.
DragosException
- if something went wrong.boolean isIncident(RelationEnd relationEnd) throws DragosException
true
if the specified relation end is connected
to this graph element and false
otherwise.
relationEnd
- The relationEnd, which will be checked.
true
if the specified relationEnd is connected to this
graph element and false
otherwise.
DragosException
- if something went wrong.java.util.Collection<? extends Relation> getAdjacentRelations(ConnectionMode connectionMode, RelationClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
As with getRelationEnds(ConnectionMode)
,
"connected" means that this graph entity is the
"relatedElement" of the relation end.
This implies that, if this method is called on a relation,
relation ends belonging to the relation will only be returned
if they point back to it.
For accessing the dependent relation ends of a relation, or the
entities connected through those, there are a number of
methods in Relation
.
connectionMode
- The kind of relation ends that should be followed.type
- The type of Relations whose RelationEnds we should follow (null
means "any
type").includeSubClasses
- If and only if true
, this method will
also follow relation ends belonging to instances of subclasses
of the specified RelationClass (ignored if type == null
).
EntityNotFoundException
- if the type for the Relation couldn't be found.
DragosException
- if something went wrong.java.util.Collection<? extends Relation> getAdjacentRelations(ConnectionMode connectionMode, RelationEndClass type, boolean includeSubClasses) throws EntityNotFoundException, DragosException
As with getRelationEnds(ConnectionMode)
,
"connected" means that this graph entity is the
"relatedElement" of the relation end.
This implies that, if this method is called on a relation,
relation ends belonging to the relation will only be returned
if they point back to it.
For accessing the dependent relation ends of a relation, or the
entities connected through those, there are a number of
methods in Relation
.
connectionMode
- The kind of relation ends that should be followed.type
- The type of RelationEnds we should follow (null
means "any
type").includeSubClasses
- If and only if true
, this method will
also follow relation ends whose RelationEndClass is a subclass of the specified
type (ignored if type == null
).
EntityNotFoundException
- if the type for the RelationEnd couldn't be found.
DragosException
- if something went wrong.GraphEntity getWrappedGraphEntity()
null
if none.
For subinterfaces defined in the core GM (like Edge, Node...),
the returned value is guaranteed to be an instance of the same
subinterface.
null
if none.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |