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

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

public interface Occurrence
extends Serializable, Comparable

This interface represents an occurrence of a topic.

Version:
2006-06-14
Author:
Thomas Much
See Also:
Topic, Topic.addOccurrence(User, String, Topic)

Method Summary
 String getData()
          Returns the value of this occurrence.
 String getId()
          Returns the id of the occurrence.
 Topic getTopic()
          Returns the topic that this occurrence belongs to.
 Topic getType()
          Returns the type topic of this occurrence.
 boolean isOfType(Topic type)
          Checks if this occurrence is of the given type.
 void setData(User setter, String data)
          Changes the value of the occurrence.
 void setType(User setter, Topic type)
          Sets the type of the occurrence.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getId

public String getId()
Returns the id of the occurrence.

Returns:
the id of the occurrence that is computed automatically at creation time

getTopic

public Topic getTopic()
Returns the topic that this occurrence belongs to.

Returns:
the Topic object

getData

public String getData()
Returns the value of this occurrence. This may be some kind of a comment or a URL of a web resource.

Returns:
the value of the occurrence (may be the empty string, never null)

setData

public void setData(User setter,
                    String data)
             throws OntologyManagerException,
                    DynamicRightsManagerException
Changes the value of the occurrence.

Parameters:
setter - the user who wants to change the value
data - the new value
Throws:
OntologyManagerException - if the value could not be changed
DynamicRightsManagerException - if the user is not allowed to change the value
See Also:
DynamicRightsManager.mayChangeOccurrence(User)

getType

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

Returns:
the type topic or null if the occurrence does not have a type

setType

public void setType(User setter,
                    Topic type)
             throws OntologyManagerException,
                    DynamicRightsManagerException
Sets the type of the occurrence. 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.mayChangeOccurrence(User)

isOfType

public boolean isOfType(Topic type)
Checks if this occurrence is of the given type.

Parameters:
type - the type topic, including null for typeless occurrences
Returns:
true if the occurrence is of the specified type, false otherwise