de.uka.ipd.consensus.foundation.schema
Interface AssociationRole

All Superinterfaces:
Comparable, Serializable
All Known Implementing Classes:
AssociationRoleImpl

public interface AssociationRole
extends Serializable, Comparable

This interface represents one role of an association.

Version:
2006-06-14
Author:
Thomas Much
See Also:
Association

Method Summary
 void addTopic(User adder, Topic topic)
          Adds a topic to this role.
 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.
 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.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getAssociation

public Association getAssociation()
Returns the association that this role belongs to.

Returns:
the association that this role belongs to, never null

getType

public Topic getType()
Returns the type topic of this role.

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
Sets the type of the role. If the implementation supports classes, the type must be a class topic.

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)
Checks if this role is of the given type.

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()
Returns the name of this role's type.

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)
Returns the player Topic objects of this role.

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
Adds a topic to this role.

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
Removes a topic from this role.

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

hasTopic

public boolean hasTopic(Topic topic)
Checks if the given topic is a player of this role.

Parameters:
topic - the topic in question
Returns:
true if the topic is player of this role, false otherwise