HandOutCarViewPopulator.java
package org.andromda.samples.carrental.contracts.web.handOut;
import java.util.Map;
/**
* Provides the ability to populate any view in the Hand out Car
*/
public final class HandOutCarViewPopulator
{
/**
* Map fields from ChooseComfortClassSelectReservationFormImpl form
* to ChooseComfortClassSelectReservationFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(ChooseComfortClassSelectReservationFormImpl fromForm, ChooseComfortClassSelectReservationFormImpl toForm)
{
if(fromForm.isAvailableCarsSet())
{
toForm.setAvailableCars(fromForm.getAvailableCars());
}
if(fromForm.isIdSet())
{
toForm.setId(fromForm.getId());
}
if(fromForm.isIdReservationSet())
{
toForm.setIdReservation(fromForm.getIdReservation());
}
}
/**
* Map fields from ChooseCarSelectCarFormImpl form
* to ChooseComfortClassSelectReservationFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(ChooseCarSelectCarFormImpl fromForm, ChooseComfortClassSelectReservationFormImpl toForm)
{
if(fromForm.isIdSet())
{
toForm.setId(fromForm.getId());
}
}
/**
* Map fields from HandOutCarFormImpl form
* to ChooseComfortClassSelectReservationFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(HandOutCarFormImpl fromForm, ChooseComfortClassSelectReservationFormImpl toForm)
{
if(fromForm.isIdReservationSet())
{
toForm.setIdReservation(fromForm.getIdReservation());
}
}
/**
* Populate page variables for view Choose Comfort Class
*
* @param fromForm origin form
* @param pageVariables the page variables
*/
public static void populateChooseComfortClassPageVariables(Object fromForm, Map<String,Object> pageVariables)
{
if(fromForm instanceof HandOutCarFormImpl)
{
final HandOutCarFormImpl sourceForm=(HandOutCarFormImpl)fromForm;
if(sourceForm.isCustomerReservationsSet())
{
pageVariables.put("customerReservations",sourceForm.getCustomerReservations());
}
}
}
/**
* Populates the view using the appropriate view populator.
*
* @param fromForm the origin form
* @param toForm the destiny form
*/
public static void populateForm(Object fromForm, ChooseComfortClassSelectReservationFormImpl toForm)
{
if(fromForm instanceof ChooseComfortClassSelectReservationFormImpl)
{
populateForm((ChooseComfortClassSelectReservationFormImpl)fromForm,toForm);
}
else if(fromForm instanceof ChooseCarSelectCarFormImpl)
{
populateForm((ChooseCarSelectCarFormImpl)fromForm,toForm);
}
else if(fromForm instanceof HandOutCarFormImpl)
{
populateForm((HandOutCarFormImpl)fromForm,toForm);
}
}
/**
* Map fields from ChooseComfortClassSelectReservationFormImpl form
* to ChooseCarSelectCarFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(ChooseComfortClassSelectReservationFormImpl fromForm, ChooseCarSelectCarFormImpl toForm)
{
if(fromForm.isIdSet())
{
toForm.setId(fromForm.getId());
}
}
/**
* Map fields from ChooseCarSelectCarFormImpl form
* to ChooseCarSelectCarFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(ChooseCarSelectCarFormImpl fromForm, ChooseCarSelectCarFormImpl toForm)
{
if(fromForm.isHandOutDateSet())
{
toForm.setHandOutDate(fromForm.getHandOutDate());
}
if(fromForm.isReturnDateSet())
{
toForm.setReturnDate(fromForm.getReturnDate());
}
if(fromForm.isIdSet())
{
toForm.setId(fromForm.getId());
}
}
/**
* Map fields from HandOutDocContinueFormImpl form
* to ChooseCarSelectCarFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(HandOutDocContinueFormImpl fromForm, ChooseCarSelectCarFormImpl toForm)
{
if(fromForm.isHandOutDateSet())
{
toForm.setHandOutDate(fromForm.getHandOutDate());
}
if(fromForm.isReturnDateSet())
{
toForm.setReturnDate(fromForm.getReturnDate());
}
}
/**
* Populate page variables for view Choose Car
*
* @param fromForm origin form
* @param pageVariables the page variables
*/
public static void populateChooseCarPageVariables(Object fromForm, Map<String,Object> pageVariables)
{
if(fromForm instanceof ChooseComfortClassSelectReservationFormImpl)
{
final ChooseComfortClassSelectReservationFormImpl sourceForm=(ChooseComfortClassSelectReservationFormImpl)fromForm;
if(sourceForm.isAvailableCarsSet())
{
pageVariables.put("availableCars",sourceForm.getAvailableCars());
}
}
}
/**
* Populates the view using the appropriate view populator.
*
* @param fromForm the origin form
* @param toForm the destiny form
*/
public static void populateForm(Object fromForm, ChooseCarSelectCarFormImpl toForm)
{
if(fromForm instanceof ChooseComfortClassSelectReservationFormImpl)
{
populateForm((ChooseComfortClassSelectReservationFormImpl)fromForm,toForm);
}
else if(fromForm instanceof ChooseCarSelectCarFormImpl)
{
populateForm((ChooseCarSelectCarFormImpl)fromForm,toForm);
}
else if(fromForm instanceof HandOutDocContinueFormImpl)
{
populateForm((HandOutDocContinueFormImpl)fromForm,toForm);
}
}
/**
* Map fields from ChooseCarSelectCarFormImpl form
* to HandOutDocContinueFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(ChooseCarSelectCarFormImpl fromForm, HandOutDocContinueFormImpl toForm)
{
if(fromForm.isHandOutDateSet())
{
toForm.setHandOutDate(fromForm.getHandOutDate());
}
if(fromForm.isReturnDateSet())
{
toForm.setReturnDate(fromForm.getReturnDate());
}
}
/**
* Map fields from HandOutDocContinueFormImpl form
* to HandOutDocContinueFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(HandOutDocContinueFormImpl fromForm, HandOutDocContinueFormImpl toForm)
{
if(fromForm.isContractNoSet())
{
toForm.setContractNo(fromForm.getContractNo());
}
if(fromForm.isSignedSet())
{
toForm.setSigned(fromForm.isSigned());
}
if(fromForm.isHandOutDateSet())
{
toForm.setHandOutDate(fromForm.getHandOutDate());
}
if(fromForm.isReturnDateSet())
{
toForm.setReturnDate(fromForm.getReturnDate());
}
}
/**
* Map fields from ContractFinishReservationFormImpl form
* to HandOutDocContinueFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(ContractFinishReservationFormImpl fromForm, HandOutDocContinueFormImpl toForm)
{
if(fromForm.isContractNoSet())
{
toForm.setContractNo(fromForm.getContractNo());
}
if(fromForm.isSignedSet())
{
toForm.setSigned(fromForm.isSigned());
}
}
/**
* Populates the view using the appropriate view populator.
*
* @param fromForm the origin form
* @param toForm the destiny form
*/
public static void populateForm(Object fromForm, HandOutDocContinueFormImpl toForm)
{
if(fromForm instanceof ChooseCarSelectCarFormImpl)
{
populateForm((ChooseCarSelectCarFormImpl)fromForm,toForm);
}
else if(fromForm instanceof HandOutDocContinueFormImpl)
{
populateForm((HandOutDocContinueFormImpl)fromForm,toForm);
}
else if(fromForm instanceof ContractFinishReservationFormImpl)
{
populateForm((ContractFinishReservationFormImpl)fromForm,toForm);
}
}
/**
* Map fields from HandOutDocContinueFormImpl form
* to ContractFinishReservationFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(HandOutDocContinueFormImpl fromForm, ContractFinishReservationFormImpl toForm)
{
if(fromForm.isContractNoSet())
{
toForm.setContractNo(fromForm.getContractNo());
}
if(fromForm.isSignedSet())
{
toForm.setSigned(fromForm.isSigned());
}
}
/**
* Map fields from ContractFinishReservationFormImpl form
* to ContractFinishReservationFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(ContractFinishReservationFormImpl fromForm, ContractFinishReservationFormImpl toForm)
{
if(fromForm.isContractNoSet())
{
toForm.setContractNo(fromForm.getContractNo());
}
if(fromForm.isSignedSet())
{
toForm.setSigned(fromForm.isSigned());
}
}
/**
* Populates the view using the appropriate view populator.
*
* @param fromForm the origin form
* @param toForm the destiny form
*/
public static void populateForm(Object fromForm, ContractFinishReservationFormImpl toForm)
{
if(fromForm instanceof HandOutDocContinueFormImpl)
{
populateForm((HandOutDocContinueFormImpl)fromForm,toForm);
}
else if(fromForm instanceof ContractFinishReservationFormImpl)
{
populateForm((ContractFinishReservationFormImpl)fromForm,toForm);
}
}
}