/**
* Copyright (C) 2008-2010, Squale Project - http://www.squale.org
*
* This file is part of Squale.
*
* Squale is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or any later version.
*
* Squale is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Squale. If not, see <http://www.gnu.org/licenses/>.
*/
package org.squale.squaleweb.applicationlayer.action.config;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.squale.jraf.helper.AccessDelegateHelper;
import org.squale.jraf.spi.accessdelegate.IApplicationComponent;
import org.squale.squaleweb.applicationlayer.action.accessRights.AdminAction;
import org.squale.squaleweb.transformer.ConfigPortailTransformer;
import org.squale.welcom.struts.bean.WActionForm;
import org.squale.welcom.struts.transformer.WTransformerFactory;
/**
* Configuration du portail
*/
public class ConfigPortailAction
extends AdminAction
{
/**
* Affichage de la liste des types de r�cup�ration des sources et de la liste des profiles.
*
* @param pMapping le mapping.
* @param pForm le formulaire � lire.
* @param pRequest la requ�te HTTP.
* @param pResponse la r�ponse de la servlet.
* @return l'action � r�aliser.
*/
public ActionForward list( ActionMapping pMapping, ActionForm pForm, HttpServletRequest pRequest,
HttpServletResponse pResponse )
{
ActionForward forward = null;
ActionErrors errors = new ActionErrors();
try
{
IApplicationComponent ac = AccessDelegateHelper.getInstance( "SqualixConfig" );
ArrayList managersDTO = (ArrayList) ac.execute( "getSourceManagements", null );
ArrayList profilesDTO = (ArrayList) ac.execute( "getProfiles", null );
WTransformerFactory.objToForm( ConfigPortailTransformer.class, (WActionForm) pForm, profilesDTO,
managersDTO );
}
catch ( Exception e )
{
handleException( e, errors, pRequest );
}
if ( !errors.isEmpty() )
{
saveMessages( pRequest, errors );
}
forward = pMapping.findForward( "list" );
return forward;
}
}