de.uka.ipd.consensus.impl
Class AssociationRoleImpl

java.lang.Object
  extended byde.uka.ipd.consensus.impl.TM4JObjectWrapper
      extended byde.uka.ipd.consensus.impl.AssociationRoleImpl
All Implemented Interfaces:
AssociationRole, Comparable, Serializable

public class AssociationRoleImpl
extends TM4JObjectWrapper
implements AssociationRole

TODO

Version:
2006-06-14
Author:
Thomas Much
See Also:
Serialized Form

Field Summary
 
Fields inherited from class de.uka.ipd.consensus.impl.TM4JObjectWrapper
EMPTY_SCOPE
 
Constructor Summary
protected AssociationRoleImpl(OntologyManagerImpl omi, org.tm4j.topicmap.Member tmMember)
           
 
Method Summary
 void addTopic(User adder, Topic topic)
          Adds a topic to this role.
 int compareTo(Object other)
           
 Association getAssociation()
          Returns the association that this role belongs to.
 String getName()
          Returns the name of this role's type.
 Collection getTopics(User user)
          Returns the player Topic objects of this role.
 Topic getType()
          Returns the type topic of this role.
protected  org.tm4j.topicmap.Member getWrappedMember()
           
 boolean hasTopic(Topic topic)
          Checks if the given topic is a player of this role.
 boolean isOfType(Topic type)
          Checks if this role is of the given type.
 void removeTopic(User remover, Topic topic)
          Removes a topic from this role.
 void setType(User setter, Topic type)
          Sets the type of the role.
 String toString()
           
 
Methods inherited from class de.uka.ipd.consensus.impl.TM4JObjectWrapper
equals, getCache, getLoggingManager, getObjectId, getOccurrence, getOntologyManager, getWrappedObject, hashCode, putCache, wrap, wrap, wrap, wrap, wrap, wrap, wrap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AssociationRoleImpl

protected AssociationRoleImpl(OntologyManagerImpl omi,
                              org.tm4j.topicmap.Member tmMember)
Method Detail

getWrappedMember

protected org.tm4j.topicmap.Member getWrappedMember()

getAssociation

public Association getAssociation()
Description copied from interface: AssociationRole
Returns the association that this role belongs to.

Specified by:
getAssociation in interface AssociationRole
Returns:
the association that this role belongs to, never null

getType

public Topic getType()
Description copied from interface: AssociationRole
Returns the type topic of this role.

Specified by:
getType in interface AssociationRole
Returns:
the type topic or null if the role does not have a type

setType

public void setType(User setter,
                    Topic type)
             throws OntologyManagerException,
                    DynamicRightsManagerException
Description copied from interface: AssociationRole
Sets the type of the role. If the implementation supports classes, the type must be a class topic.

Specified by:
setType in interface AssociationRole
Parameters:
setter - the user who wants to set the type
type - the type topic (or null to remove the type)
Throws:
OntologyManagerException - if the type could not be set
DynamicRightsManagerException - if the user is not allowed to change the type
See Also:
Topic.isClassTopic(), DynamicRightsManager.mayChangeAssociation(User, Association)

isOfType

public boolean isOfType(Topic type)
Description copied from interface: AssociationRole
Checks if this role is of the given type.

Specified by:
isOfType in interface AssociationRole
Parameters:
type - the type topic, including null for the typeless role
Returns:
true if the role is of the specified type, false otherwise

getName

public String getName()
Description copied from interface: AssociationRole
Returns the name of this role's type.

Specified by:
getName in interface AssociationRole
Returns:
the name of this role's type or the empty string if this role does not have a type (never null)
See Also:
Concept.getName()

getTopics

public Collection getTopics(User user)
Description copied from interface: AssociationRole
Returns the player Topic objects of this role.

Specified by:
getTopics in interface AssociationRole
Parameters:
user - the user who wants to see the topics
Returns:
a possibly empty collection, never null
See Also:
DynamicRightsManager.mayViewTopic(User, Topic)

addTopic

public void addTopic(User adder,
                     Topic topic)
              throws OntologyManagerException,
                     DynamicRightsManagerException
Description copied from interface: AssociationRole
Adds a topic to this role.

Specified by:
addTopic in interface AssociationRole
Parameters:
adder - the user who wants to add the topic
topic - the topic to be added
Throws:
OntologyManagerException - if the topic could not be added
DynamicRightsManagerException - if the user is not allowed to add the topic
See Also:
DynamicRightsManager.mayChangeAssociation(User, Association)

removeTopic

public void removeTopic(User remover,
                        Topic topic)
                 throws OntologyManagerException,
                        DynamicRightsManagerException
Description copied from interface: AssociationRole
Removes a topic from this role.

Specified by:
removeTopic in interface AssociationRole
Parameters:
remover - the user who wants to remove the topic.
topic - the topic to be removed
Throws:
DynamicRightsManagerException - if the user is not allowed to remove the topic
OntologyManagerException - if the topic could not be removed
See Also:
DynamicRightsManager.mayChangeAssociation(User, Association)

hasTopic

public boolean hasTopic(Topic topic)
Description copied from interface: AssociationRole
Checks if the given topic is a player of this role.

Specified by:
hasTopic in interface AssociationRole
Parameters:
topic - the topic in question
Returns:
true if the topic is player of this role, false otherwise

compareTo

public int compareTo(Object other)
Specified by:
compareTo in interface Comparable

toString

public String toString()