package de.uka.ipd.consensus.foundation.rights;

import java.util.Properties;

import de.uka.ipd.consensus.foundation.ConsensusFoundationModule;
import de.uka.ipd.consensus.foundation.logging.LoggingManager;
import de.uka.ipd.consensus.foundation.ontology.OntologyManager;
import de.uka.ipd.consensus.foundation.schema.Association;
import de.uka.ipd.consensus.foundation.schema.Attribute;
import de.uka.ipd.consensus.foundation.schema.Attributeable;
import de.uka.ipd.consensus.foundation.schema.Concept;
import de.uka.ipd.consensus.foundation.schema.Rateable;
import de.uka.ipd.consensus.foundation.schema.Rating;
import de.uka.ipd.consensus.foundation.schema.SuperSubclass;
import de.uka.ipd.consensus.foundation.schema.Synonym;
import de.uka.ipd.consensus.foundation.schema.Topic;
import de.uka.ipd.consensus.foundation.schema.TypeInstance;
import de.uka.ipd.consensus.foundation.schema.User;
import de.uka.ipd.consensus.foundation.scoring.IncentiveManager;
import de.uka.ipd.consensus.foundation.user.UserManager;

/**
 * <p>The DynamicRightsManager is used by many other components to check if an user action is allowed.
 * An implementation can be written to carry out the incentives for the IncentiveManager (that are basically
 * a question of the user's score and his rights). To compute the users rights efficiently, an implementation can register itself
 * as a ScoringListener and compute the rights in the <code>scored()</code> method.</p>
 * 
 * <p>Use the <code>mayXXX()</code> methods for efficiency. The <code>checkXXX()</code> methods exist for convenience.
 * An implementation should realize the logic within the former methods, the latter methods should use the former ones.</p>
 * 
 * <p>The DynamicRightsManager implementation can be configured with the key <code>cf.dynamicrightsmanager</code>
 * in the <code>ConsensusFoundation.properties</code> configuration file. It's an optional component.</p>
 * 
 * <p>The implementation is loaded by the <code>ConsensusFoundation</code> constructor. For successful instantiation,
 * the DynamicRightsManager implementation must provide a default constructor without arguments.</p>
 * 
 * @author Thomas Much
 * @version 2006-06-14
 * @see de.uka.ipd.consensus.foundation.ConsensusFoundation
 */
public interface DynamicRightsManager extends ConsensusFoundationModule {

	/**
	 * This method is called by the <code>ConsensusFoundation</code> constructor to initialize the DynamicRightsManager.
	 * @param config all entries from <code>ConsensusFoundation.properties</code>
	 * @param logging the successfully initialized LoggingManager instance
	 * @param users the the successfully initialized UserManager instance
	 * @param ontology the the successfully initialized OntologyManager instance
	 * @param incentive the the successfully initialized IncentiveManager instance or <code>null</code>, if no IncentiveManager is available 
	 * @throws Exception if any error occurs (startup of the application is aborted in this case)
	 * @see de.uka.ipd.consensus.foundation.ConsensusFoundation#ConsensusFoundation()
	 */
	public void init(Properties config, LoggingManager logging, UserManager users, OntologyManager ontology, IncentiveManager incentive) throws Exception;

	
	/**
	 * Checks if the user is allowed to create topics of the given type.
	 * @param user the user who wants to create a topic
	 * @param type the type of the topic to be created, including <code>null</code> for a typeless topic
	 * @return <code>true</code> if the user is allowed to create the topic, <code>false</code> otherwise
	 * @see #checkCreateTopic(User, Topic)
	 */
	public boolean mayCreateTopic(User user, Topic type);
	
	
	/**
	 * Checks if the user is allowed to create topics of the given superclass.
	 * @param user user the user who wants to create a class topic
	 * @param cls the superclass of the class topic to be created, including <code>null</code> for a root class topic
	 * @return <code>true</code> if the user is allowed to create the class topic, <code>false</code> otherwise
	 * @see #checkCreateClassTopic(User, Topic)
	 * @see de.uka.ipd.consensus.foundation.schema.Topic#isClassTopic()
	 */
	public boolean mayCreateClassTopic(User user, Topic cls);
	
	
	/**
	 * Checks if the user is allowed to view a certain topic.
	 * This method is used for type (class) topics, too, i.e. if the user is allowed to see an element of a certain type.
	 * @param user the user who wants to see the topic
	 * @param topic the topic in question
	 * @return <code>true</code> if the user is allowed to view the topic, <code>false</code> otherwise
	 * @see #checkViewTopic(User, Topic)
	 */
	public boolean mayViewTopic(User user, Topic topic);
	
	
	/**
	 * Checks if a user is allowed to remove a topic permanently from the ontology.
	 * @param user the user who wants to delete the topic
	 * @param topic the topic to be deleted
	 * @return <code>true</code> if the user is allowed to delete the topic, <code>false</code> otherwise
	 * @see #checkDeleteTopic(User, Topic)
	 */
	public boolean mayDeleteTopic(User user, Topic topic);
	
	
	/**
	 * Checks if a user is allowed to merge to topics.
	 * @param user the user who wants to merge the topics
	 * @param topic1 the first topic to be merged
	 * @param topic2 the second topic to be merged
	 * @return <code>true</code> if the user is allowed to merge the topics, <code>false</code> otherwise
	 * @see #checkMergeTopics(User, Topic, Topic)
	 */
	public boolean mayMergeTopics(User user, Topic topic1, Topic topic2);

	
	/**
	 * Checks if the user is allowed to create associations of the given type.
	 * @param user the user who wants to create an association
	 * @param type the type of the association to be created, including <code>null</code> for a typeless association
	 * @return <code>true</code> if the user is allowed to create the association, <code>false</code> otherwise
	 * @see #checkCreateAssociation(User, Topic)
	 */
	public boolean mayCreateAssociation(User user, Topic type);
	
	
	/**
	 * Checks if the user is allowed to view a certain association.
	 * @param user the user who wants to see the association
	 * @param assoc the association in question
	 * @return <code>true</code> if the user is allowed to see the association, <code>false</code> otherwise
	 * @see #checkViewAssociation(User, Association)
	 */
	public boolean mayViewAssociation(User user, Association assoc);
	
	
	/**
	 * Checks if the user is allowed to change an association (add/remove roles/topics).
	 * @param user the user who wants to change the association
	 * @param assoc the association to be changed
	 * @return <code>true</code> if the user is allowed to change the association, <code>false</code> otherwise
	 * @see #checkChangeAssociation(User, Association)
	 */
	public boolean mayChangeAssociation(User user, Association assoc);
	
	
	/**
	 * Checks if a user is allowed to remove an association permanently from the ontology.
	 * @param user the user who wants to delete the association
	 * @param assoc the association to be deleted
	 * @return <code>true</code> if the user is allowed to delete the association, <code>false</code> otherwise
	 * @see #checkDeleteAssociation(User, Association)
	 */
	public boolean mayDeleteAssociation(User user, Association assoc);

	
	/**
	 * Checks if the user is allowed to create attributes of the given type.
	 * @param user the user who wants to create an attribute
	 * @param type the type of the attribute to be created, including <code>null</code> for a typeless attribute
	 * @return <code>true</code> if the user is allowed to create the attribute, <code>false</code> otherwise
	 * @see #checkCreateAttribute(User, Topic)
	 * @see #mayAddAttribute(User, Attribute, Attributeable)
	 * 
	 */
	public boolean mayCreateAttribute(User user, Topic type);
	
	
	/**
	 * Checks if the user is allowed to add the attribute to the given attributeable element (a topic).
	 * @param user the user who wants to add the attribute
	 * @param attr the attribute to be added
	 * @param attributeable the topic that will be container of the attribute
	 * @return <code>true</code> if the user is allowed to add the attribute, <code>false</code> otherwise
	 * @see #checkAddAttribute(User, Attribute, Attributeable)
	 * @see #mayCreateAttribute(User, Topic)
	 */
	public boolean mayAddAttribute(User user, Attribute attr, Attributeable attributeable);
	
	
	/**
	 * Checks if the user is allowed to remove the attribute from its topic.
	 * @param user the user who wants to remove the attribute
	 * @param attr the attribute to be removed
	 * @return <code>true</code> if the user is allowed to remove the attribute, <code>false</code> otherwise
	 * @see #checkRemoveAttribute(User, Attribute)
	 */
	public boolean mayRemoveAttribute(User user, Attribute attr);
	
	
	/**
	 * Checks if the user is allowed to see a certain attribute.
	 * @param user the user who wants to see the attribute
	 * @param attr the attribute in question
	 * @return <code>true</code> if the user is allowed to see the attribute, <code>false</code> otherwise
	 * @see #checkViewAttribute(User, Attribute)
	 */
	public boolean mayViewAttribute(User user, Attribute attr);
	
	
	/**
	 * Checks if the user is allowed to change the attribute's value.
	 * @param user the user who wants to change the value
	 * @param attr the attribute in question
	 * @return <code>true</code> if the user is allowed to change the attribute's value, <code>false</code> otherwise
	 * @see #checkChangeAttributeValue(User, Attribute)
	 */
	public boolean mayChangeAttributeValue(User user, Attribute attr);

	
	/**
	 * Checks if the user is allowed to create ratings.
	 * @param user the user who wants to create a rating
	 * @return <code>true</code> if the user is allowed to create ratings, <code>false</code> otherwise
	 * @see #checkCreateRating(User)
	 * @see #mayAddRating(Rating, Rateable)
	 */
	public boolean mayCreateRating(User user);
	
	
	/**
	 * Checks if a user is allowed to assign a rating to a certain rateable element.
	 * @param rating the rating to be assigned
	 * @param rateable the rateable element that will receive the rating
	 * @return <code>true</code> if the user is allowed to add the rating, <code>false</code> otherwise
	 * @see #checkAddRating(Rating, Rateable)
	 * @see #mayCreateRating(User)
	 */
	public boolean mayAddRating(Rating rating, Rateable rateable);
	
	
	/**
	 * Checks if a user is allowed to remove a rating permanently from an element.
	 * @param remover the user who wants to remove the rating
	 * @param rating the rating to be removed
	 * @return <code>true</code> if the user is allowed to remove the rating, <code>false</code> otherwise
	 * @see #checkRemoveRating(User, Rating)
	 */
	public boolean mayRemoveRating(User remover, Rating rating);

	
	/**
	 * Checks if the user is allowed to change the comment of a certain concept.
	 * @param user the user who wants to change the comment
	 * @param concept the concept in question
	 * @return <code>true</code> if the user is allowed to change the comment, <code>false</code> otherwise
	 * @see #checkChangeConceptComment(User, Concept)
	 */
	public boolean mayChangeConceptComment(User user, Concept concept);
	
	
	/**
	 * Checks if the user is allowed to change the comment of a certain user (including himself).
	 * @param user the user who wants to change the comment
	 * @param commentated the user who's comment string will be changed
	 * @return <code>true</code> if the user is allowed to change the comment, <code>false</code> otherwise
	 * @see #checkChangeUserComment(User, User)
	 */
	public boolean mayChangeUserComment(User user, User commentated);
	
	
	/**
	 * Checks if the user is allowed to change (create/delete) occurrences.
	 * @param user the user who wants to change an occurrence
	 * @return <code>true</code> if the user is allowed to change occurrences, <code>false</code> otherwise
	 * @see #checkChangeOccurrence(User)
	 */
	public boolean mayChangeOccurrence(User user);

	
	/**
	 * Checks if the user is allowed to add a synonymous topic to a given topic.
	 * @param user the user who wants to add the synonym
	 * @param base the topic that is assigned the synonymous topic
	 * @return <code>true</code> if the user is allowed to add the synonym, <code>false</code> otherwise
	 * @see #checkAddSynonym(User, Topic)
	 */
	public boolean mayAddSynonym(User user, Topic base);
	
	
	/**
	 * Checks if the user is allowed to remove a synonym relationship between two topics.
	 * @param user the user who wants to remove the synonym relationship
	 * @param synonym the Synonym object containing the two synonymous topics
	 * @return <code>true</code> if the user is allowed to remove the synonym, <code>false</code> otherwise
	 * @see #checkRemoveSynonym(User, Synonym)
	 */
	public boolean mayRemoveSynonym(User user, Synonym synonym);

	
	/**
	 * Checks if the user is allowed to add a type topic to a given topic.
	 * @param user the user who wants to add a type
	 * @param base the topic which is assigned the new type
	 * @return <code>true</code> if the user is allowed to add a type, <code>false</code> otherwise
	 * @see #checkAddType(User, Topic)
	 */
	public boolean mayAddType(User user, Topic base);
	
	
	/**
	 * Checks if the user is allowed to remove a type from a topic.
	 * @param user the user who wants to remove a type
	 * @param type the TypeInstance object which contains both the type topic and the base topic
	 * @return <code>true</code> if the user is allowed to remove the type, <code>false</code> otherwise
	 * @see #checkRemoveType(User, TypeInstance)
	 */
	public boolean mayRemoveType(User user, TypeInstance type);
	
	
	/**
	 * Checks if the user is allowed to add a superclass to a class topic.
	 * @param user the user who wants to add the superclass
	 * @param base the topic that will be assigned a new superclass
	 * @return <code>true</code> if the user is allowed to add a superclass, <code>false</code> otherwise
	 * @see #checkAddClass(User, Topic)
	 * @see de.uka.ipd.consensus.foundation.schema.Topic#isClassTopic()
	 */
	public boolean mayAddClass(User user, Topic base);
	
	
	/**
	 * Checks if the user is allowed to remove a superclass from a class topic.
	 * @param user the user who wants to remove the superclass
	 * @param cls the SuperSubclass object containing both the superclass and the subclass topic
	 * @return <code>true</code> if the user is allowed to remove the superclass, <code>false</code> otherwise
	 * @see #checkRemoveClass(User, SuperSubclass)
	 */
	public boolean mayRemoveClass(User user, SuperSubclass cls);


	/**
	 * Checks if the user is allowed to do queries using the provided query language(s).
	 * @param user the user who wants to do the query
	 * @param query the query string
	 * @return <code>true</code> if the user is allowed to do the query, <code>false</code> otherwise
	 * @see #checkQuery(User, String)
	 */
	public boolean mayQuery(User user, String query);
	
	
	/**
	 * Checks if the user is allowed to create topics of the given type.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to create a topic
	 * @param type the type of the topic to be created, including <code>null</code> for a typeless topic
	 * @throws DynamicRightsManagerException if the user is not allowed to create the topic
	 * @see #mayCreateTopic(User, Topic)
	 */
	public void checkCreateTopic(User user, Topic type) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to create topics of the given superclass.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user user the user who wants to create a class topic
	 * @param cls the superclass of the class topic to be created, including <code>null</code> for a root class topic
	 * @throws DynamicRightsManagerException if the user is not allowed to create the class topic
	 * @see #mayCreateClassTopic(User, Topic)
	 * @see de.uka.ipd.consensus.foundation.schema.Topic#isClassTopic()
	 */
	public void checkCreateClassTopic(User user, Topic cls) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to view a certain topic.
	 * This method is used for type (class) topics, too, i.e. if the user is allowed to see an element of a certain type.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to see the topic
	 * @param topic the topic in question
	 * @throws DynamicRightsManagerException if the user is not allowed to view the topic
	 * @see #mayViewTopic(User, Topic)
	 */
	public void checkViewTopic(User user, Topic topic) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if a user is allowed to remove a topic permanently from the ontology.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to delete the topic
	 * @param topic the topic to be deleted
	 * @throws DynamicRightsManagerException if the user is not allowed to delete the topic
	 * @see #mayDeleteTopic(User, Topic)
	 */
	public void checkDeleteTopic(User user, Topic topic) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if a user is allowed to merge to topics.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to merge the topics
	 * @param topic1 the first topic to be merged
	 * @param topic2 the second topic to be merged
	 * @throws DynamicRightsManagerException if the user is not allowed to merge the topics
	 * @see #mayMergeTopics(User, Topic, Topic)
	 */
	public void checkMergeTopics(User user, Topic topic1, Topic topic2) throws DynamicRightsManagerException;

	
	/**
	 * Checks if the user is allowed to create associations of the given type.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to create an association
	 * @param type the type of the association to be created, including <code>null</code> for a typeless association
	 * @throws DynamicRightsManagerException if the user is not allowed to create the association
	 * @see #mayCreateAssociation(User, Topic)
	 */
	public void checkCreateAssociation(User user, Topic type) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to view a certain association.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to see the association
	 * @param assoc the association in question
	 * @throws DynamicRightsManagerException if the user is not allowed to see the association
	 * @see #mayViewAssociation(User, Association)
	 */
	public void checkViewAssociation(User user, Association assoc) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to change an association (add/remove roles/topics).
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to change the association
	 * @param assoc the association to be changed
	 * @throws DynamicRightsManagerException if the user is not allowed to change the association
	 * @see #mayChangeAssociation(User, Association)
	 */
	public void checkChangeAssociation(User user, Association assoc) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if a user is allowed to remove an association permanently from the ontology.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to delete the association
	 * @param assoc the association to be deleted
	 * @throws DynamicRightsManagerException if the user is not allowed to delete the association
	 * @see #mayDeleteAssociation(User, Association)
	 */
	public void checkDeleteAssociation(User user, Association assoc) throws DynamicRightsManagerException;

	
	/**
	 * Checks if the user is allowed to create attributes of the given type.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to create an attribute
	 * @param type the type of the attribute to be created, including <code>null</code> for a typeless attribute
	 * @throws DynamicRightsManagerException if the user is not allowed to create the attribute
	 * @see #mayCreateAttribute(User, Topic)
	 * @see #checkAddAttribute(User, Attribute, Attributeable)
	 */
	public void checkCreateAttribute(User user, Topic type) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to add the attribute to the given attributeable element (a topic).
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to add the attribute
	 * @param attr the attribute to be added
	 * @param attributeable the topic that will be container of the attribute
	 * @throws DynamicRightsManagerException if the user is not allowed to add the attribute
	 * @see #mayAddAttribute(User, Attribute, Attributeable)
	 * @see #checkCreateAttribute(User, Topic)
	 */
	public void checkAddAttribute(User user, Attribute attr, Attributeable attributeable) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to remove the attribute from its topic.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to remove the attribute
	 * @param attr the attribute to be removed
	 * @throws DynamicRightsManagerException if the user is not allowed to remove the attribute
	 * @see #mayRemoveAttribute(User, Attribute)
	 */
	public void checkRemoveAttribute(User user, Attribute attr) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to see a certain attribute.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to see the attribute
	 * @param attr the attribute in question
	 * @throws DynamicRightsManagerException if the user is not allowed to see the attribute
	 * @see #mayViewAttribute(User, Attribute)
	 */
	public void checkViewAttribute(User user, Attribute attr) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to change the attribute's value.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to change the value
	 * @param attr the attribute in question
	 * @throws DynamicRightsManagerException if the user is not allowed to change the attribute's value
	 * @see #mayChangeAttributeValue(User, Attribute)
	 */
	public void checkChangeAttributeValue(User user, Attribute attr) throws DynamicRightsManagerException;

	
	/**
	 * Checks if the user is allowed to create ratings.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to create a rating
	 * @throws DynamicRightsManagerException if the user is not allowed to create ratings
	 * @see #mayCreateRating(User)
	 * @see #checkAddRating(Rating, Rateable)
	 */
	public void checkCreateRating(User user) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if a user is allowed to assign a rating to a certain rateable element.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param rating the rating to be assigned
	 * @param rateable the rateable element that will receive the rating
	 * @throws DynamicRightsManagerException if the user is not allowed to add the rating
	 * @see #mayAddRating(Rating, Rateable)
	 * @see #checkCreateRating(User)
	 */
	public void checkAddRating(Rating rating, Rateable rateable) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if a user is allowed to remove a rating permanently from an element.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param remover the user who wants to remove the rating
	 * @param rating the rating to be removed
	 * @throws DynamicRightsManagerException if the user is not allowed to remove the rating
	 * @see #mayRemoveRating(User, Rating)
	 */
	public void checkRemoveRating(User remover, Rating rating) throws DynamicRightsManagerException;

	
	/**
	 * Checks if the user is allowed to change the comment of a certain concept.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to change the comment
	 * @param concept the concept in question
	 * @throws DynamicRightsManagerException if the user is not allowed to change the comment
	 * @see #mayChangeConceptComment(User, Concept)
	 */
	public void checkChangeConceptComment(User user, Concept concept) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to change the comment of a certain user (including himself).
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to change the comment
	 * @param commentated the user who's comment string will be changed
	 * @throws DynamicRightsManagerException if the user is not allowed to change the comment
	 * @see #mayChangeUserComment(User, User)
	 */
	public void checkChangeUserComment(User user, User commentated) throws DynamicRightsManagerException;


	/**
	 * Checks if the user is allowed to change (create/delete) occurrences.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to change an occurrence
	 * @throws DynamicRightsManagerException if the user is not allowed to change occurrences
	 * @see #mayChangeOccurrence(User)
	 */
	public void checkChangeOccurrence(User user) throws DynamicRightsManagerException;

	
	/**
	 * Checks if the user is allowed to add a synonymous topic to a given topic.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to add the synonym
	 * @param base the topic that is assigned the synonymous topic
	 * @throws DynamicRightsManagerException if the user is not allowed to add a synonym
	 * @see #mayAddSynonym(User, Topic)
	 */
	public void checkAddSynonym(User user, Topic base) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to remove a synonym relationship between two topics.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to remove the synonym relationship
	 * @param synonym the Synonym object containing the two synonymous topics
	 * @throws DynamicRightsManagerException if the user is not allowed to remove the synonym
	 * @see #mayRemoveSynonym(User, Synonym)
	 */
	public void checkRemoveSynonym(User user, Synonym synonym) throws DynamicRightsManagerException;

	
	/**
	 * Checks if the user is allowed to add a type topic to a given topic.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to add a type
	 * @param base the topic which is assigned the new type
	 * @throws DynamicRightsManagerException if the user is not allowed to add a type
	 * @see #mayAddType(User, Topic)
	 */
	public void checkAddType(User user, Topic base) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to remove a type from a topic.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to remove a type
	 * @param type the TypeInstance object which contains both the type topic and the base topic
	 * @throws DynamicRightsManagerException if the user is not allowed to remove the type
	 * @see #mayRemoveType(User, TypeInstance)
	 */
	public void checkRemoveType(User user, TypeInstance type) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to add a superclass to a class topic.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to add the superclass
	 * @param base the topic that will be assigned a new superclass
	 * @throws DynamicRightsManagerException if the user is not allowed to add a superclass
	 * @see #mayAddClass(User, Topic)
	 * @see de.uka.ipd.consensus.foundation.schema.Topic#isClassTopic()
	 */
	public void checkAddClass(User user, Topic base) throws DynamicRightsManagerException;
	
	
	/**
	 * Checks if the user is allowed to remove a superclass from a class topic.
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to remove the superclass
	 * @param cls the SuperSubclass object containing both the superclass and the subclass topic
	 * @throws DynamicRightsManagerException if the user is not allowed to remove the superclass
	 * @see #mayRemoveClass(User, SuperSubclass)
	 */
	public void checkRemoveClass(User user, SuperSubclass cls) throws DynamicRightsManagerException;

	
	/**
	 * Checks if the user is allowed to do queries using the provided query language(s).
	 * <p>This method returns silently if the user is granted the right.</p>
	 * @param user the user who wants to do the query
	 * @param query the query string
	 * @throws DynamicRightsManagerException if the user is not allowed to do the query
	 * @see #mayQuery(User, String)
	 */
	public void checkQuery(User user, String query) throws DynamicRightsManagerException;

}
