package de.snailshell.consensus.demo.actions;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.Action;

import de.snailshell.consensus.demo.ConsensusFoundationUtils;
import de.uka.ipd.consensus.foundation.ConsensusFoundationManager;
import de.uka.ipd.consensus.foundation.evolution.EvolutionManager;
import de.uka.ipd.consensus.foundation.logging.LoggingManager;
import de.uka.ipd.consensus.foundation.ontology.OntologyManager;
import de.uka.ipd.consensus.foundation.rating.RatingManager;
import de.uka.ipd.consensus.foundation.rights.DynamicRightsManager;
import de.uka.ipd.consensus.foundation.schema.User;
import de.uka.ipd.consensus.foundation.scoring.IncentiveManager;
import de.uka.ipd.consensus.foundation.user.UserManager;

/**
 * @author Thomas Much
 * @version 2006-06-14
 */
public class BasisAction extends Action implements ConsensusFoundationManager {

	private ConsensusFoundationManager getConsensusFoundationManager() {
		return ConsensusFoundationUtils.getConsensusFoundationManager( this.getServlet().getServletContext() );
	}
	
	
	public LoggingManager getLoggingManager() {
		return getConsensusFoundationManager().getLoggingManager();
	}


	public UserManager getUserManager() {
		return getConsensusFoundationManager().getUserManager();
	}


	public OntologyManager getOntologyManager() {
		return getConsensusFoundationManager().getOntologyManager();
	}

	
	public EvolutionManager getEvolutionManager() {
		return getConsensusFoundationManager().getEvolutionManager();
	}

	
	public RatingManager getRatingManager() {
		return getConsensusFoundationManager().getRatingManager();
	}

	
	public IncentiveManager getIncentiveManager() {
		return getConsensusFoundationManager().getIncentiveManager();
	}

	
	public DynamicRightsManager getDynamicRightsManager() {
		return getConsensusFoundationManager().getDynamicRightsManager();
	}

	
	public String getVersion() {
		return getConsensusFoundationManager().getVersion();
	}


	public User getUser(HttpServletRequest request) {
		return ConsensusFoundationUtils.getUser(request);
	}

	
	public boolean isUserLoggedOn(HttpServletRequest request) {
		return (getUser(request) != null);
	}

}
