AdminAdminController.java
// license-header java merge-point
// Generated by andromda-jsf cartridge (controllers\Controller.java.vsl) DO NOT EDIT!
package org.andromda.samples.carrental.admins.web.admin;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import org.andromda.samples.carrental.ControllerBase;
import org.andromda.samples.carrental.JsfUtils;
import org.andromda.samples.carrental.admins.web.main.AdministrationController;
/**
* <p>
* TODO: Model Documentation for
* org.andromda.samples.carrental.admins.web.admin.AdminAdminController
* </p>
*/
public abstract class AdminAdminController
extends ControllerBase
implements Serializable
{
/**
* The serial version UID of this class. Needed for serialization.
*/
private static final long serialVersionUID = 1L;
/**
* Returns an instance from the JSF context
*
*/
public static AdminAdminController instance()
{
return (AdminAdminController)JsfUtils.resolveVariable("adminAdminController");
}
/**
* Populate action form and page variables
*
* @param currentView the current view
* @param forward the forward view
* @param sourceForm the source form
* @throws IllegalAccessException
* @throws InvocationTargetException
* @throws NoSuchMethodException
*/
private void populateActionFormsAndPageVariables(final String currentView, String forward, final Object sourceForm) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
{
if(forward == null)
{
forward=currentView;
}
final Map<String,Object> pageVariables=this.getPageVariables(forward);
if("/org/andromda/samples/carrental/admins/web/admin/administrator-details.jsf".equals(forward))
{
ManageAdministratorsViewPopulator.populateForm(sourceForm,this.getAdministratorDetailsUpdateForm());
ManageAdministratorsViewPopulator.populateForm(sourceForm,this.getAdministratorDetailsAddForm());
}
ControllerBase.getUseCaseScope().put(CURRENT_PAGE_VARIABLES_KEY, pageVariables);
}
/**
* <p>
* TODO: Model Documentation for
* org.andromda.samples.carrental.admins.web.admin.updateAdministrator
* </p>
*
* @param form the associated form
* @throws Throwable
*/
public abstract String updateAdministrator(UpdateAdministratorForm form)
throws Throwable;
/**
* <p>
* TODO: Model Documentation for
* org.andromda.samples.carrental.admins.web.admin.addAdministrator
* </p>
*
* @param form the associated form
* @throws Throwable
*/
public abstract String addAdministrator(AddAdministratorForm form)
throws Throwable;
/**
* Retrieves the {@link AdministratorDetailsUpdateFormImpl} form instance
*
* @return AdministratorDetailsUpdateFormImpl
*/
protected AdministratorDetailsUpdateFormImpl getAdministratorDetailsUpdateForm()
{
return (AdministratorDetailsUpdateFormImpl)JsfUtils.resolveVariable("manageAdministratorsAdministratorDetailsUpdateForm");
}
/**
* <p>
* TODO: Model Documentation for update
* </p>
* This method is called when 'update' is triggered in the view 'Administrator Details'.
* It can be safely overridden in descendant classes.
*
* @param form the associated form
*/
protected void _administratorDetails_update(AdministratorDetailsUpdateFormImpl form)
{
//this method can be overridden
}
/**
* Retrieves administratorDetailsUpdate()
*
* @return administratorDetailsUpdate
* @throws Throwable
*/
public String administratorDetailsUpdate()
throws Throwable
{
this.setLastPostedFormClientId("manageAdministratorsAdministratorDetailsUpdateForm");
String forward=null;
final AdministratorDetailsUpdateFormImpl form =
this.getAdministratorDetailsUpdateForm();
//trigger method execution
_administratorDetails_update(form);
forward = _updateAdministrator(form);
populateActionFormsAndPageVariables("/org/andromda/samples/carrental/admins/web/admin/administrator-details.jsf",forward,form);
if(forward != null)
{
if("/org/andromda/samples/carrental/admins/web/admin/administrator-details.jsf".equals(forward))
{
forward = null; //the destination form is the same, stay on the current view
}
}
return forward;
}
/**
* <p>
* TODO: Model Documentation for Update administrator
* </p>
*
* @param form the associated form
* @return the forward view
* @throws Throwable
*/
protected String _updateAdministrator(final AdministratorDetailsUpdateFormImpl form)
throws Throwable
{
String forward = null;
updateAdministrator(form);
forward = __updateAdministrator(form);
return forward;
}
/**
* <p>
* TODO: Model Documentation for Start
* </p>
*
* @param form the associated form
* @return the forward view
* @throws Throwable
*/
protected String _start(final AdministratorDetailsUpdateFormImpl form)
throws Throwable
{
String forward = null;
forward = "/org/andromda/samples/carrental/admins/web/admin/administrator-details.jsf";
return forward;
}
/**
* <p>
* TODO: Model Documentation for org.andromda.samples.carrental.admins.web.admin.update
* administrator transition
* </p>
*
* @return a transition
*/
protected String __updateAdministrator(final AdministratorDetailsUpdateFormImpl form)
throws Throwable
{
final String value = String.valueOf(updateAdministrator(form));
String forward = null;
if (value.equals("succeed"))
{
forward = ((AdministrationController)JsfUtils.resolveVariable("administrationController")).startUseCase();
}
if (value.equals("fail"))
{
forward = _start(form);
}
if (forward == null)
{
// throw exception in case we have an invalid return value from the controller
throw new RuntimeException("Runtime model error: no valid path selected. Selected path="+value);
}
else
{
return forward;
}
}
/**
* Retrieves the {@link AdministratorDetailsAddFormImpl} form instance
*
* @return AdministratorDetailsAddFormImpl
*/
protected AdministratorDetailsAddFormImpl getAdministratorDetailsAddForm()
{
return (AdministratorDetailsAddFormImpl)JsfUtils.resolveVariable("manageAdministratorsAdministratorDetailsAddForm");
}
/**
* <p>
* TODO: Model Documentation for add
* </p>
* This method is called when 'add' is triggered in the view 'Administrator Details'.
* It can be safely overridden in descendant classes.
*
* @param form the associated form
*/
protected void _administratorDetails_add(AdministratorDetailsAddFormImpl form)
{
//this method can be overridden
}
/**
* Retrieves administratorDetailsAdd()
*
* @return administratorDetailsAdd
* @throws Throwable
*/
public String administratorDetailsAdd()
throws Throwable
{
this.setLastPostedFormClientId("manageAdministratorsAdministratorDetailsAddForm");
String forward=null;
final AdministratorDetailsAddFormImpl form =
this.getAdministratorDetailsAddForm();
//trigger method execution
_administratorDetails_add(form);
forward = _addAdministrator(form);
populateActionFormsAndPageVariables("/org/andromda/samples/carrental/admins/web/admin/administrator-details.jsf",forward,form);
if(forward != null)
{
if("/org/andromda/samples/carrental/admins/web/admin/administrator-details.jsf".equals(forward))
{
forward = null; //the destination form is the same, stay on the current view
}
}
return forward;
}
/**
* <p>
* TODO: Model Documentation for Add administrator
* </p>
*
* @param form the associated form
* @return the forward view
* @throws Throwable
*/
protected String _addAdministrator(final AdministratorDetailsAddFormImpl form)
throws Throwable
{
String forward = null;
addAdministrator(form);
forward = __addAdministrator(form);
return forward;
}
/**
* <p>
* TODO: Model Documentation for Start
* </p>
*
* @param form the associated form
* @return the forward view
* @throws Throwable
*/
protected String _start(final AdministratorDetailsAddFormImpl form)
throws Throwable
{
String forward = null;
forward = "/org/andromda/samples/carrental/admins/web/admin/administrator-details.jsf";
return forward;
}
/**
* <p>
* TODO: Model Documentation for org.andromda.samples.carrental.admins.web.admin.Add
* administrator test
* </p>
*
* @return a transition
*/
protected String __addAdministrator(final AdministratorDetailsAddFormImpl form)
throws Throwable
{
final String value = String.valueOf(addAdministrator(form));
String forward = null;
if (value.equals("succeed"))
{
forward = ((AdministrationController)JsfUtils.resolveVariable("administrationController")).startUseCase();
}
if (value.equals("fail"))
{
forward = _start(form);
}
if (forward == null)
{
// throw exception in case we have an invalid return value from the controller
throw new RuntimeException("Runtime model error: no valid path selected. Selected path="+value);
}
else
{
return forward;
}
}
/**
* <p>
* TODO: Model Documentation for cancel
* </p>
* This method is called when 'cancel' is triggered in the view 'Administrator Details'.
* It can be safely overridden in descendant classes.
*/
protected void _administratorDetails_cancel()
{
//this method can be overridden
}
/**
* Retrieves administratorDetailsCancel()
*
* @return administratorDetailsCancel
* @throws Throwable
*/
public String administratorDetailsCancel()
throws Throwable
{
this.setLastPostedFormClientId("manageAdministratorsAdministratorDetailsCancelForm");
String forward=null;
forward=((AdministrationController)JsfUtils.resolveVariable("administrationController")).startUseCase();
return forward;
}
/**
* This method is called when the use case 'Manage Administrators' starts.
* It can be safely overridden in descendant classes.
*/
protected void _manageAdministrators_started()
{
//this method can be overridden
}
/**
* Retrieves the internal start use case
*
* @return manageAdministrators
* @throws Throwable
*/
protected String internalStartUseCase(Map<String,Object> useCaseParameters)
throws Throwable
{
this.setLastPostedFormClientId("manageAdministratorsManageAdministratorsForm");
String forward=null;
//trigger method execution
_manageAdministrators_started();
forward = _start();
return forward;
}
/**
* <p>
* TODO: Model Documentation for Start
* </p>
*
* @return the forward view
* @throws Throwable
*/
protected String _start()
throws Throwable
{
String forward = null;
forward = "/org/andromda/samples/carrental/admins/web/admin/administrator-details.jsf";
return forward;
}
}