i3.dragos.gm.core.proxy
Class RelationClassProxy

java.lang.Object
  extended by i3.dragos.gm.core.proxy.GraphEntityClassProxy
      extended by i3.dragos.gm.core.proxy.RelationClassProxy
All Implemented Interfaces:
ExistenceCheckable, GraphEntityClass, MetaAttributable, RelationClass

public class RelationClassProxy
extends GraphEntityClassProxy
implements RelationClass

An RelationClassProxy delegates all method calls to the underlying relation class except for those that access fields which are used after an relation class has been deleted.

Author:
Boris Boehlen <boehlen@cs.rwth-aachen.de>

Field Summary
 
Fields inherited from class i3.dragos.gm.core.proxy.GraphEntityClassProxy
proxiedEntityClass
 
Constructor Summary
RelationClassProxy(RelationClass e)
          Constructs a new wrapper for an relation class.
 
Method Summary
 RelationEndClass declareRelationEndClass(java.lang.String name, GraphEntityClass target, Cardinality card, RelationEndDirection direction)
          Adds a relation end to the relation class.
 java.util.Collection<? extends RelationEndClass> getRelationEndClasses()
          Returns a collection with all relation ends of the relation class.
 void undeclareRelationEndClass(RelationEndClass rec)
          Undeclares a relation end previously declared for the relation class.
 
Methods inherited from class i3.dragos.gm.core.proxy.GraphEntityClassProxy
addSubClass, checkExistence, checkExistenceOptional, declareAttribute, equals, getAllDeclaredAttributes, getAllMetaAttributes, getAllSubClasses, getAllSuperClasses, getAttribute, getDataSourceURL, getDeclaredAttributes, getDirectSubClasses, getDirectSuperClasses, getInternalIdentifier, getMetaAttribute, getName, getProxyGraphEntityClass, getWrappedGraphEntityClass, hasAttribute, hashCode, isAbstract, isMetaAttributeKeyReserved, isMetaAttributeSet, isSubClassOf, isSuperClassOf, removeSubClass, setMetaAttribute, toString, undeclareAllAttributes, undeclareAttribute, undeclareAttribute, unsetMetaAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface i3.dragos.gm.core.schema.GraphEntityClass
addSubClass, declareAttribute, equals, getAllDeclaredAttributes, getAllSubClasses, getAllSuperClasses, getAttribute, getDataSourceURL, getDeclaredAttributes, getDirectSubClasses, getDirectSuperClasses, getInternalIdentifier, getName, getWrappedGraphEntityClass, hasAttribute, hashCode, isAbstract, isSubClassOf, isSuperClassOf, removeSubClass, undeclareAllAttributes, undeclareAttribute, undeclareAttribute
 
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

RelationClassProxy

public RelationClassProxy(RelationClass e)
Constructs a new wrapper for an relation class.

Parameters:
e - The relation class to wrap.
Method Detail

declareRelationEndClass

public RelationEndClass declareRelationEndClass(java.lang.String name,
                                                GraphEntityClass target,
                                                Cardinality card,
                                                RelationEndDirection direction)
                                         throws EntityNotFoundException,
                                                DragosException,
                                                EntityAlreadyExistsException
Adds a relation end to the relation class.

Specified by:
declareRelationEndClass in interface RelationClass
Parameters:
name - The name of the relation end.
target - The target of the relation end.
card - The cardinality allowed for the target.
direction - The direction of the relation end.
Returns:
the new relation end class.
Throws:
EntityNotFoundException - if the graph element class does not exist.
EntityAlreadyExistsException - if a schema entity with the same name has already been declared.
DragosException - if something else went wrong.

undeclareRelationEndClass

public void undeclareRelationEndClass(RelationEndClass rec)
                               throws EntityNotFoundException,
                                      DragosException
Undeclares a relation end previously declared for the relation class.

It simply performs an additional check whether the RelationEndClass to undeclare really belongs to this RelationClass, throwing an EntityNotFoundException if not. Afterwards, it follows the same procedure as Schema.undeclareGraphEntityClass(GraphEntityClass).

This method could/should be implemented roughly as follows:

 if (! this.equals(rec.getRelationClass())) {
     throw new EntityNotFoundException("RelationEndClass " + rec + " does not belong to " + toString());
 }
 getSchema().undeclareGraphEntityClass(rec);
 

Specified by:
undeclareRelationEndClass in interface RelationClass
Parameters:
rec - The RelationEndClass to undeclare.
Throws:
EntityNotFoundException - if the RelationEndClass does not exist or does not belong to this RelationClass.
DragosException - if something else went wrong.
See Also:
Schema.undeclareGraphEntityClass(GraphEntityClass)

getRelationEndClasses

public java.util.Collection<? extends RelationEndClass> getRelationEndClasses()
                                                                       throws DragosException
Returns a collection with all relation ends of the relation class. The elements of the collection are of type RelationEndClass

Specified by:
getRelationEndClasses in interface RelationClass
Returns:
a collection with all relation ends of the relation class.
Throws:
DragosException - if something went wrong.


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.