/**
* 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.transformer.stats;
import org.squale.squalecommon.datatransfertobject.stats.SiteStatsDTO;
import org.squale.squaleweb.applicationlayer.formbean.config.ServeurForm;
import org.squale.squaleweb.applicationlayer.formbean.stats.SiteStatsForm;
import org.squale.squaleweb.transformer.ServeurTransformer;
import org.squale.welcom.struts.bean.WActionForm;
import org.squale.welcom.struts.transformer.WITransformer;
import org.squale.welcom.struts.transformer.WTransformerException;
import org.squale.welcom.struts.transformer.WTransformerFactory;
/**
*/
public class SiteStatsTransformer
implements WITransformer
{
/**
* @param pObject le tableau d'objet contenant l'objet � transformer
* @return le form r�sultat de la transformation
* @throws WTransformerException en cas d'�chec
*/
public WActionForm objToForm( Object[] pObject )
throws WTransformerException
{
SiteStatsForm form = new SiteStatsForm();
objToForm( pObject, form );
return form;
}
/**
* @param pObject le tableau d'objet contenant l'objet � transformer
* @param pForm le form r�sultat
* @throws WTransformerException en cas d'�chec
*/
public void objToForm( Object[] pObject, WActionForm pForm )
throws WTransformerException
{
SiteStatsForm form = (SiteStatsForm) pForm;
SiteStatsDTO dto = (SiteStatsDTO) pObject[0];
form.setLoc( dto.getLoc() );
form.setNbProjects( dto.getNbProjects() );
form.setServeurForm( (ServeurForm) WTransformerFactory.objToForm( ServeurTransformer.class, dto.getServeurDTO() ) );
form.setNbAppliToValidate( dto.getNbAppliToValidate() );
form.setNbAppliWithAuditsSuccessful( dto.getNbAppliWithAuditsSuccessful() );
form.setNbAppliWithoutSuccessfulAudits( dto.getNbAppliWithoutSuccessfulAudits() );
form.setNbValidatedApplis( dto.getNbValidatedApplis() );
}
/**
* @deprecated n'a pas de sens
* @param pForm le formulaire
* @throws WTransformerException si un pb apparait.
* @return rien mais lance syst�matiquement une exception
*/
public Object[] formToObj( WActionForm pForm )
throws WTransformerException
{
throw new WTransformerException( "deprecated" );
}
/**
* @deprecated n'a pas de sens
* @param pForm le formulaire
* @param pTab les param�tres
* @throws WTransformerException si un pb apparait.
*/
public void formToObj( WActionForm pForm, Object[] pTab )
throws WTransformerException
{
throw new WTransformerException( "deprecated" );
}
}