RegisterANewCustomerViewPopulator.java
package org.andromda.samples.carrental.customers.web.registerCustomer;
import java.util.Map;
/**
* Provides the ability to populate any view in the Register a new Customer
*/
public final class RegisterANewCustomerViewPopulator
{
/**
* Map fields from CreateNewCustomerNewCustomerFormImpl form
* to CreateNewCustomerNewCustomerFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(CreateNewCustomerNewCustomerFormImpl fromForm, CreateNewCustomerNewCustomerFormImpl toForm)
{
if(fromForm.isDriversSet())
{
toForm.setDrivers(fromForm.getDrivers());
}
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isSurnameSet())
{
toForm.setSurname(fromForm.getSurname());
}
if(fromForm.isLicenseNoSet())
{
toForm.setLicenseNo(fromForm.getLicenseNo());
}
if(fromForm.isLicenseIssuedBySet())
{
toForm.setLicenseIssuedBy(fromForm.getLicenseIssuedBy());
}
if(fromForm.isBirthDateSet())
{
toForm.setBirthDate(fromForm.getBirthDate());
}
if(fromForm.isCustomerNoSet())
{
toForm.setCustomerNo(fromForm.getCustomerNo());
}
if(fromForm.isPasswordSet())
{
toForm.setPassword(fromForm.getPassword());
}
}
/**
* Map fields from CreateNewCustomerSelectFormImpl form
* to CreateNewCustomerNewCustomerFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(CreateNewCustomerSelectFormImpl fromForm, CreateNewCustomerNewCustomerFormImpl toForm)
{
if(fromForm.isDriversSet())
{
toForm.setDrivers(fromForm.getDrivers());
}
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isSurnameSet())
{
toForm.setSurname(fromForm.getSurname());
}
if(fromForm.isLicenseNoSet())
{
toForm.setLicenseNo(fromForm.getLicenseNo());
}
if(fromForm.isLicenseIssuedBySet())
{
toForm.setLicenseIssuedBy(fromForm.getLicenseIssuedBy());
}
if(fromForm.isBirthDateSet())
{
toForm.setBirthDate(fromForm.getBirthDate());
}
if(fromForm.isCustomerNoSet())
{
toForm.setCustomerNo(fromForm.getCustomerNo());
}
}
/**
* Map fields from CreateLicensedDriverSaveDriverFormImpl form
* to CreateNewCustomerNewCustomerFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(CreateLicensedDriverSaveDriverFormImpl fromForm, CreateNewCustomerNewCustomerFormImpl toForm)
{
if(fromForm.isDriversSet())
{
toForm.setDrivers(fromForm.getDrivers());
}
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isSurnameSet())
{
toForm.setSurname(fromForm.getSurname());
}
if(fromForm.isLicenseNoSet())
{
toForm.setLicenseNo(fromForm.getLicenseNo());
}
if(fromForm.isLicenseIssuedBySet())
{
toForm.setLicenseIssuedBy(fromForm.getLicenseIssuedBy());
}
if(fromForm.isBirthDateSet())
{
toForm.setBirthDate(fromForm.getBirthDate());
}
}
/**
* Map fields from RegisterANewCustomerFormImpl form
* to CreateNewCustomerNewCustomerFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(RegisterANewCustomerFormImpl fromForm, CreateNewCustomerNewCustomerFormImpl toForm)
{
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isCustomerNoSet())
{
toForm.setCustomerNo(fromForm.getCustomerNo());
}
if(fromForm.isPasswordSet())
{
toForm.setPassword(fromForm.getPassword());
}
}
/**
* Map fields from CreateNewCustomerNewCustomerFormImpl form
* to CreateNewCustomerSelectFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(CreateNewCustomerNewCustomerFormImpl fromForm, CreateNewCustomerSelectFormImpl toForm)
{
if(fromForm.isDriversSet())
{
toForm.setDrivers(fromForm.getDrivers());
}
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isSurnameSet())
{
toForm.setSurname(fromForm.getSurname());
}
if(fromForm.isLicenseNoSet())
{
toForm.setLicenseNo(fromForm.getLicenseNo());
}
if(fromForm.isLicenseIssuedBySet())
{
toForm.setLicenseIssuedBy(fromForm.getLicenseIssuedBy());
}
if(fromForm.isBirthDateSet())
{
toForm.setBirthDate(fromForm.getBirthDate());
}
if(fromForm.isCustomerNoSet())
{
toForm.setCustomerNo(fromForm.getCustomerNo());
}
}
/**
* Map fields from CreateNewCustomerSelectFormImpl form
* to CreateNewCustomerSelectFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(CreateNewCustomerSelectFormImpl fromForm, CreateNewCustomerSelectFormImpl toForm)
{
if(fromForm.isDriversSet())
{
toForm.setDrivers(fromForm.getDrivers());
}
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isSurnameSet())
{
toForm.setSurname(fromForm.getSurname());
}
if(fromForm.isLicenseNoSet())
{
toForm.setLicenseNo(fromForm.getLicenseNo());
}
if(fromForm.isLicenseIssuedBySet())
{
toForm.setLicenseIssuedBy(fromForm.getLicenseIssuedBy());
}
if(fromForm.isBirthDateSet())
{
toForm.setBirthDate(fromForm.getBirthDate());
}
if(fromForm.isCustomerNoSet())
{
toForm.setCustomerNo(fromForm.getCustomerNo());
}
}
/**
* Map fields from CreateLicensedDriverSaveDriverFormImpl form
* to CreateNewCustomerSelectFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(CreateLicensedDriverSaveDriverFormImpl fromForm, CreateNewCustomerSelectFormImpl toForm)
{
if(fromForm.isDriversSet())
{
toForm.setDrivers(fromForm.getDrivers());
}
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isSurnameSet())
{
toForm.setSurname(fromForm.getSurname());
}
if(fromForm.isLicenseNoSet())
{
toForm.setLicenseNo(fromForm.getLicenseNo());
}
if(fromForm.isLicenseIssuedBySet())
{
toForm.setLicenseIssuedBy(fromForm.getLicenseIssuedBy());
}
if(fromForm.isBirthDateSet())
{
toForm.setBirthDate(fromForm.getBirthDate());
}
}
/**
* Map fields from RegisterANewCustomerFormImpl form
* to CreateNewCustomerSelectFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(RegisterANewCustomerFormImpl fromForm, CreateNewCustomerSelectFormImpl toForm)
{
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isCustomerNoSet())
{
toForm.setCustomerNo(fromForm.getCustomerNo());
}
}
/**
* Populate page variables for view Create new Customer
*
* @param fromForm origin form
* @param pageVariables the page variables
*/
public static void populateCreateNewCustomerPageVariables(Object fromForm, Map<String,Object> pageVariables)
{
if(fromForm instanceof RegisterANewCustomerFormImpl)
{
final RegisterANewCustomerFormImpl sourceForm=(RegisterANewCustomerFormImpl)fromForm;
if(sourceForm.isCustomersSet())
{
pageVariables.put("customers",sourceForm.getCustomers());
}
}
}
/**
* Populates the view using the appropriate view populator.
*
* @param fromForm the origin form
* @param toForm the destiny form
*/
public static void populateForm(Object fromForm, CreateNewCustomerNewCustomerFormImpl toForm)
{
if(fromForm instanceof CreateNewCustomerNewCustomerFormImpl)
{
populateForm((CreateNewCustomerNewCustomerFormImpl)fromForm,toForm);
}
else if(fromForm instanceof CreateNewCustomerSelectFormImpl)
{
populateForm((CreateNewCustomerSelectFormImpl)fromForm,toForm);
}
else if(fromForm instanceof CreateLicensedDriverSaveDriverFormImpl)
{
populateForm((CreateLicensedDriverSaveDriverFormImpl)fromForm,toForm);
}
else if(fromForm instanceof RegisterANewCustomerFormImpl)
{
populateForm((RegisterANewCustomerFormImpl)fromForm,toForm);
}
}
/**
* Populates the view using the appropriate view populator.
*
* @param fromForm the origin form
* @param toForm the destiny form
*/
public static void populateForm(Object fromForm, CreateNewCustomerSelectFormImpl toForm)
{
if(fromForm instanceof CreateNewCustomerNewCustomerFormImpl)
{
populateForm((CreateNewCustomerNewCustomerFormImpl)fromForm,toForm);
}
else if(fromForm instanceof CreateNewCustomerSelectFormImpl)
{
populateForm((CreateNewCustomerSelectFormImpl)fromForm,toForm);
}
else if(fromForm instanceof CreateLicensedDriverSaveDriverFormImpl)
{
populateForm((CreateLicensedDriverSaveDriverFormImpl)fromForm,toForm);
}
else if(fromForm instanceof RegisterANewCustomerFormImpl)
{
populateForm((RegisterANewCustomerFormImpl)fromForm,toForm);
}
}
/**
* Map fields from CreateNewCustomerNewCustomerFormImpl form
* to CreateLicensedDriverSaveDriverFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(CreateNewCustomerNewCustomerFormImpl fromForm, CreateLicensedDriverSaveDriverFormImpl toForm)
{
if(fromForm.isDriversSet())
{
toForm.setDrivers(fromForm.getDrivers());
}
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isSurnameSet())
{
toForm.setSurname(fromForm.getSurname());
}
if(fromForm.isLicenseNoSet())
{
toForm.setLicenseNo(fromForm.getLicenseNo());
}
if(fromForm.isLicenseIssuedBySet())
{
toForm.setLicenseIssuedBy(fromForm.getLicenseIssuedBy());
}
if(fromForm.isBirthDateSet())
{
toForm.setBirthDate(fromForm.getBirthDate());
}
}
/**
* Map fields from CreateNewCustomerSelectFormImpl form
* to CreateLicensedDriverSaveDriverFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(CreateNewCustomerSelectFormImpl fromForm, CreateLicensedDriverSaveDriverFormImpl toForm)
{
if(fromForm.isDriversSet())
{
toForm.setDrivers(fromForm.getDrivers());
}
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isSurnameSet())
{
toForm.setSurname(fromForm.getSurname());
}
if(fromForm.isLicenseNoSet())
{
toForm.setLicenseNo(fromForm.getLicenseNo());
}
if(fromForm.isLicenseIssuedBySet())
{
toForm.setLicenseIssuedBy(fromForm.getLicenseIssuedBy());
}
if(fromForm.isBirthDateSet())
{
toForm.setBirthDate(fromForm.getBirthDate());
}
}
/**
* Map fields from CreateLicensedDriverSaveDriverFormImpl form
* to CreateLicensedDriverSaveDriverFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(CreateLicensedDriverSaveDriverFormImpl fromForm, CreateLicensedDriverSaveDriverFormImpl toForm)
{
if(fromForm.isDriversSet())
{
toForm.setDrivers(fromForm.getDrivers());
}
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
if(fromForm.isSurnameSet())
{
toForm.setSurname(fromForm.getSurname());
}
if(fromForm.isLicenseNoSet())
{
toForm.setLicenseNo(fromForm.getLicenseNo());
}
if(fromForm.isLicenseIssuedBySet())
{
toForm.setLicenseIssuedBy(fromForm.getLicenseIssuedBy());
}
if(fromForm.isBirthDateSet())
{
toForm.setBirthDate(fromForm.getBirthDate());
}
}
/**
* Map fields from RegisterANewCustomerFormImpl form
* to CreateLicensedDriverSaveDriverFormImpl form
*
* @param fromForm origin form
* @param toForm destiny form
*/
public static void populateForm(RegisterANewCustomerFormImpl fromForm, CreateLicensedDriverSaveDriverFormImpl toForm)
{
if(fromForm.isNameSet())
{
toForm.setName(fromForm.getName());
}
}
/**
* Populate page variables for view Create Licensed Driver
*
* @param fromForm origin form
* @param pageVariables the page variables
*/
public static void populateCreateLicensedDriverPageVariables(Object fromForm, Map<String,Object> pageVariables)
{
if(fromForm instanceof CreateNewCustomerNewCustomerFormImpl)
{
final CreateNewCustomerNewCustomerFormImpl sourceForm=(CreateNewCustomerNewCustomerFormImpl)fromForm;
if(sourceForm.isDriversSet())
{
pageVariables.put("drivers",sourceForm.getDrivers());
}
}
else if(fromForm instanceof CreateNewCustomerSelectFormImpl)
{
final CreateNewCustomerSelectFormImpl sourceForm=(CreateNewCustomerSelectFormImpl)fromForm;
if(sourceForm.isDriversSet())
{
pageVariables.put("drivers",sourceForm.getDrivers());
}
}
else if(fromForm instanceof CreateLicensedDriverSaveDriverFormImpl)
{
final CreateLicensedDriverSaveDriverFormImpl sourceForm=(CreateLicensedDriverSaveDriverFormImpl)fromForm;
if(sourceForm.isDriversSet())
{
pageVariables.put("drivers",sourceForm.getDrivers());
}
}
}
/**
* Populates the view using the appropriate view populator.
*
* @param fromForm the origin form
* @param toForm the destiny form
*/
public static void populateForm(Object fromForm, CreateLicensedDriverSaveDriverFormImpl toForm)
{
if(fromForm instanceof CreateNewCustomerNewCustomerFormImpl)
{
populateForm((CreateNewCustomerNewCustomerFormImpl)fromForm,toForm);
}
else if(fromForm instanceof CreateNewCustomerSelectFormImpl)
{
populateForm((CreateNewCustomerSelectFormImpl)fromForm,toForm);
}
else if(fromForm instanceof CreateLicensedDriverSaveDriverFormImpl)
{
populateForm((CreateLicensedDriverSaveDriverFormImpl)fromForm,toForm);
}
else if(fromForm instanceof RegisterANewCustomerFormImpl)
{
populateForm((RegisterANewCustomerFormImpl)fromForm,toForm);
}
}
}