/*
 * This file is part of DebGen Biobank Software developed by ASTRID Research.
 * All rights reserved. Reproduction, modification, use or disclosure
 * to third parties without express authority is forbidden.
 *
 * Copyright ASTRID Research Inc., Hungary, 2009-2011.
 *
 * ASTRID Research
 * Headquaters: Csapo utca 42. Debrecen H-4029 HUNGARY
 * Phone: +36-52-533-173        Fax: +36-52-533-174
 * Web: http://www.astrid.hu    E-mail: info@astrid.hu
 *
 * Project name: DebGen Biobank Software project.
 * URLS:
 * Developers: Istvan Zoltan Nagy (istvan.nagy@astrid.hu)
 */
package hu.astrid.debgen.server.requestprocessor.facade;

import hu.astrid.debgen.server.requestprocessor.ActionParameter;
import hu.astrid.debgen.server.requestprocessor.exception.InvalidPageNameFormatException;
import hu.astrid.debgen.server.requestprocessor.service.RequestProcessorService;
import hu.astrid.debgen.authentication.domain.DebGenUser;
import javax.servlet.http.HttpServletRequest;

/**
 * Facade to process requests
 * @author inagy
 */
public class RequestProcessorFacade {

    /**
     * Returns an ActionParameter from an URI
     * @param uri The requested URI
     * @return The ActionParameter object created by the request
     * @throws InvalidPageNameFormatException When the page name is unknown
     * @throws Exception When other error occurs
     */
    public static ActionParameter getActionParameterFromUri(String uri) throws InvalidPageNameFormatException, Exception {
        return RequestProcessorService.getActionParameterFromUri(uri);
    }

    /**
     * Returns the current user from the session
     * @param request The current request
     * @return The name of the user
     */
    public static DebGenUser getDebGenUser(HttpServletRequest request) {
        return RequestProcessorService.getDebGenUser(request);
    }
}
