package it.csi.demo.democomp.presentation.democomp.action.miaapp;

import java.util.*;

import java.lang.reflect.InvocationTargetException;
import java.beans.IntrospectionException;

import org.apache.struts2.interceptor.validation.SkipValidation;

import com.opensymphony.xwork2.Preparable;
import com.opensymphony.xwork2.validator.annotations.*;
import com.opensymphony.xwork2.conversion.annotations.*;
import com.opensymphony.xwork2.ActionContext;

import it.csi.demo.democomp.dto.*;

import it.csi.demo.democomp.presentation.democomp.security.*;

import it.csi.demo.democomp.business.*;

import it.csi.demo.democomp.presentation.democomp.action.*;

import it.csi.demo.democomp.presentation.democomp.interceptor.MethodProtection;

import it.csi.demo.democomp.presentation.democomp.interceptor.FatClientOnly;
import it.csi.demo.democomp.presentation.uiutils.*;
import flexjson.JSON;

/**
 * CpHomeAction Action Class.
 *
 * @author GuiGen
 */
@Validation()
@Conversion()
public class CpHomeAction extends BaseAction implements Preparable {

	@VisitorFieldValidator(message = "", key = "cpHome.persone.visitorvalidator.label", appendPrefix = true)
	public void setAppDatapersone(
			java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Persona> value) {
		getSession().put("appDatapersone", value);
	}

	public java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Persona> getAppDatapersone() {
		return (java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Persona>) (getSession()
				.get("appDatapersone"));
	}

	@VisitorFieldValidator(message = "", key = "cpHome.filtroPersona.visitorvalidator.label", appendPrefix = true)
	public void setAppDatafiltroPersona(
			it.csi.demo.democomp.dto.nspersona.Persona value) {
		getSession().put("appDatafiltroPersona", value);
	}

	public it.csi.demo.democomp.dto.nspersona.Persona getAppDatafiltroPersona() {
		return (it.csi.demo.democomp.dto.nspersona.Persona) (getSession()
				.get("appDatafiltroPersona"));
	}

	public void setAppDataprovince(
			java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Provincia> value) {
		getSession().put("appDataprovince", value);
	}

	public java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Provincia> getAppDataprovince() {
		return (java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Provincia>) (getSession()
				.get("appDataprovince"));
	}

	public void setAppDataregioni(
			java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Regione> value) {
		getSession().put("appDataregioni", value);
	}

	public java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Regione> getAppDataregioni() {
		return (java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Regione>) (getSession()
				.get("appDataregioni"));
	}

	public void setAppDataselTabellaIdPersona(java.lang.Integer value) {
		getSession().put("appDataselTabellaIdPersona", value);
	}

	public java.lang.Integer getAppDataselTabellaIdPersona() {
		return (java.lang.Integer) (getSession()
				.get("appDataselTabellaIdPersona"));
	}

	public void setAppDataselettoreOperazione(java.lang.String value) {
		getSession().put("appDataselettoreOperazione", value);
	}

	public java.lang.String getAppDataselettoreOperazione() {
		return (java.lang.String) (getSession()
				.get("appDataselettoreOperazione"));
	}

	@VisitorFieldValidator(message = "", key = "cpHome.cittadino.visitorvalidator.label", appendPrefix = true)
	public void setAppDatacittadino(
			it.csi.demo.democomp.dto.nspersona.Cittadino value) {
		getSession().put("appDatacittadino", value);
	}

	public it.csi.demo.democomp.dto.nspersona.Cittadino getAppDatacittadino() {
		return (it.csi.demo.democomp.dto.nspersona.Cittadino) (getSession()
				.get("appDatacittadino"));
	}

	public void setAppDatacomuni(
			java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Comune> value) {
		getSession().put("appDatacomuni", value);
	}

	public java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Comune> getAppDatacomuni() {
		return (java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Comune>) (getSession()
				.get("appDatacomuni"));
	}

	public void setAppDatacomuni2(
			java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Comune> value) {
		getSession().put("appDatacomuni2", value);
	}

	public java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Comune> getAppDatacomuni2() {
		return (java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Comune>) (getSession()
				.get("appDatacomuni2"));
	}

	public void setAppDataprovince2(
			java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Provincia> value) {
		getSession().put("appDataprovince2", value);
	}

	public java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Provincia> getAppDataprovince2() {
		return (java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Provincia>) (getSession()
				.get("appDataprovince2"));
	}

	/////////////////////////////////////////
	/// property comuni a tutte le action
	/////////////////////////////////////////

	// riga selezionata in una eventuale tabella
	// NOTA: l'id della cella selezionata e' data da idRiga + idColonna
	private String _idRiga = "";

	public void setIdRiga(String val) {
		_idRiga = val;
	}

	public String getIdRiga() {
		return _idRiga;
	}

	// colonna selezionata in una eventuale tabella
	// NOTA: l'id della cella selezionata e' data da idRiga + idColonna
	private String _idColonna = "";

	public void setIdColonna(String val) {
		_idColonna = val;
	}

	public String getIdColonna() {
		return _idColonna;
	}

	/// parametri per cambio TAB

	private String selectedTabKey;

	public void setSelectedTabKey(String value) {
		selectedTabKey = value;
	}

	public String getSelectedTabKey() {
		return selectedTabKey;
	}

	private String selectedTabValue;

	public void setSelectedTabValue(String value) {
		selectedTabValue = value;
	}

	public String getSelectedTabValue() {
		return selectedTabValue;
	}

	/**
	 * @generated
	 */
	private List<TableFilter> filter;

	/**
	 * @generated
	 */
	public List<TableFilter> getFilter() {
		return filter;
	}

	/**
	 * @generated
	 */
	public void setFilter(List<TableFilter> filter) {
		this.filter = filter;
	}

	/**
	 * @generated
	 */
	private TableStatus tableStatus;

	/**
	 * @generated
	 */
	public TableStatus getTableStatus() {
		return tableStatus;
	}

	/**
	 * @generated
	 */
	public void setTableStatus(TableStatus tableStatus) {
		this.tableStatus = tableStatus;
	}

	/**
	 * classe model associata
	 */
	public Class modelClass() {
		return it.csi.demo.democomp.dto.miaapp.CpHomeModel.class;
	}

	/**
	 * I singoli eventi sui singoli widget sono gestiti dai metodi specifici
	 * @return SUCCESS.
	 */
	@SkipValidation
	public String execute() throws CommandExecutionException {
		// esegue eventuali comandi di clear appdata
		ICommand clearCmd = (ICommand) session
				.get(PENDING_CLEAR_COMMAND_ATTRIBUTE);
		if (clearCmd != null) {
			clearCmd.doCommand(this);
			session.remove(PENDING_CLEAR_COMMAND_ATTRIBUTE);
		}
		return SUCCESS;
	}

	//////////////////////////////////////////////////////////////////////////////////
	/// metodi specifici per la gestione del singolo tipo di evento sul singolo widget
	/// contenuto nel contentPanel
	/// metodo: handle<nomeWidget>_<NOME_EVENTO>
	/// es: handletreeVoci_CLICKED
	//////////////////////////////////////////////////////////////////////////////////

	/**
	 * Gestione dell'evento VALUE_CHANGED sul widget [cbRegione]
	 */
	@SkipValidation
	@MethodProtection(level = "REJECT_SAME")
	public String handleCbRegione_VALUE_CHANGED()
			throws CommandExecutionException {
		ICommand action = initCommand("cbRegione", "VALUE_CHANGED");
		if (log.isDebugEnabled()) {
			log.debug("[CpHomeAction::handleCbRegione_VALUE_CHANGED] dump model before");
			dumpModel(false);
		}

		String result = action.doCommand(this);
		if (result != null) {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleCbRegione_VALUE_CHANGED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleCbRegione_VALUE_CHANGED] returning result ["
						+ result + "]");
			}
			return result;

		} else {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleCbRegione_VALUE_CHANGED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleCbRegione_VALUE_CHANGED] returning default result [SUCCESS]");
			}
			return SUCCESS;

		}
	}

	/**
	 * Gestione dell'evento CLICKED sul widget [bRicerca]
	 */
	@MethodProtection(level = "REJECT_SAME")
	public String handleBRicerca_CLICKED() throws CommandExecutionException {
		ICommand action = initCommand("bRicerca", "CLICKED");
		if (log.isDebugEnabled()) {
			log.debug("[CpHomeAction::handleBRicerca_CLICKED] dump model before");
			dumpModel(false);
		}

		String result = action.doCommand(this);
		if (result != null) {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBRicerca_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBRicerca_CLICKED] returning result ["
						+ result + "]");
			}
			return result;

		} else {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBRicerca_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBRicerca_CLICKED] returning default result [SUCCESS]");
			}
			return SUCCESS;

		}
	}

	/**
	 * Gestione dell'evento CLICKED sul widget [bAzzera]
	 */
	@MethodProtection(level = "REJECT_SAME")
	public String handleBAzzera_CLICKED() throws CommandExecutionException {
		ICommand action = initCommand("bAzzera", "CLICKED");
		if (log.isDebugEnabled()) {
			log.debug("[CpHomeAction::handleBAzzera_CLICKED] dump model before");
			dumpModel(false);
		}

		String result = action.doCommand(this);
		if (result != null) {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBAzzera_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBAzzera_CLICKED] returning result ["
						+ result + "]");
			}
			return result;

		} else {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBAzzera_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBAzzera_CLICKED] returning default result [SUCCESS]");
			}
			return SUCCESS;

		}
	}

	/**
	 * Gestione dell'evento CLICKED sul widget [bCancella]
	 */
	@MethodProtection(level = "REJECT_SAME")
	public String handleBCancella_CLICKED() throws CommandExecutionException {
		ICommand action = initCommand("bCancella", "CLICKED");
		if (log.isDebugEnabled()) {
			log.debug("[CpHomeAction::handleBCancella_CLICKED] dump model before");
			dumpModel(false);
		}

		String result = action.doCommand(this);
		if (result != null) {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBCancella_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBCancella_CLICKED] returning result ["
						+ result + "]");
			}
			return result;

		} else {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBCancella_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBCancella_CLICKED] returning default result [SUCCESS]");
			}
			return SUCCESS;

		}
	}

	/**
	 * Gestione dell'evento CLICKED sul widget [bInserisci]
	 */
	@MethodProtection(level = "REJECT_SAME")
	public String handleBInserisci_CLICKED() throws CommandExecutionException {
		ICommand action = initCommand("bInserisci", "CLICKED");
		if (log.isDebugEnabled()) {
			log.debug("[CpHomeAction::handleBInserisci_CLICKED] dump model before");
			dumpModel(false);
		}

		String result = action.doCommand(this);
		if (result != null) {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBInserisci_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBInserisci_CLICKED] returning result ["
						+ result + "]");
			}
			return result;

		} else {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBInserisci_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBInserisci_CLICKED] returning default result [SUCCESS]");
			}
			return SUCCESS;

		}
	}

	/**
	 * Gestione dell'evento CLICKED sul widget [bModifica]
	 */
	@MethodProtection(level = "REJECT_SAME")
	public String handleBModifica_CLICKED() throws CommandExecutionException {
		ICommand action = initCommand("bModifica", "CLICKED");
		if (log.isDebugEnabled()) {
			log.debug("[CpHomeAction::handleBModifica_CLICKED] dump model before");
			dumpModel(false);
		}

		String result = action.doCommand(this);
		if (result != null) {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBModifica_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBModifica_CLICKED] returning result ["
						+ result + "]");
			}
			return result;

		} else {
			if (log.isDebugEnabled()) {
				log.debug("[CpHomeAction::handleBModifica_CLICKED] dump model after");
				dumpModel(false);
				log.debug("[CpHomeAction::handleBModifica_CLICKED] returning default result [SUCCESS]");
			}
			return SUCCESS;

		}
	}

	//////////////////////////////////////////////////////////////////////////////////
	/// metodo di data providing sull'intero ContentPanel
	/// metodo: provide_CPDATA
	//////////////////////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////////////////////
	/// metodi di data providing sui widget dotati di multi data binding
	/// contenuti nel contentPanel
	/// metodo: provide<nomeWidget>_<tipologia dati>
	/// es: provideCbComuni_DATASET
	//////////////////////////////////////////////////////////////////////////////////

	/**
	 * Prepara l'input stream referenziato dal result "provideData" con i valori relativi 
	 * al data-binding relativo al dataset DATASET del widget cbRegione.
	 * @return sempre il result "provideData"
	 */
	@SkipValidation
	@FatClientOnly
	public String provideCbRegione_DATASET() throws CommandExecutionException {

		// reperisce il dato da serializzare
		com.opensymphony.xwork2.ActionContext ctx = com.opensymphony.xwork2.ActionContext
				.getContext();
		Object dataToProvide = ctx.getValueStack().findValue("appDataregioni");

		// serializza
		flexjson.JSONSerializer serializer = new flexjson.JSONSerializer();

		String response = serializer.exclude("*.class").deepSerialize(
				dataToProvide);
		// imposta l'input stream di risposta
		java.io.ByteArrayInputStream bais;
		try {
			bais = new java.io.ByteArrayInputStream(response.getBytes("UTF-8"));
			dataProviderStream = bais;
			// risposta
			return "provideData";
		} catch (java.io.UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new CommandExecutionException("errore provide Data", e);
		}
	}

	/**
	 * Prepara l'input stream referenziato dal result "provideData" con i valori relativi 
	 * al data-binding relativo al dataset DATASET del widget cbProvincia.
	 * @return sempre il result "provideData"
	 */
	@SkipValidation
	@FatClientOnly
	public String provideCbProvincia_DATASET() throws CommandExecutionException {

		// reperisce il dato da serializzare
		com.opensymphony.xwork2.ActionContext ctx = com.opensymphony.xwork2.ActionContext
				.getContext();
		Object dataToProvide = ctx.getValueStack().findValue("appDataprovince");

		// serializza
		flexjson.JSONSerializer serializer = new flexjson.JSONSerializer();

		String response = serializer.exclude("*.class").deepSerialize(
				dataToProvide);
		// imposta l'input stream di risposta
		java.io.ByteArrayInputStream bais;
		try {
			bais = new java.io.ByteArrayInputStream(response.getBytes("UTF-8"));
			dataProviderStream = bais;
			// risposta
			return "provideData";
		} catch (java.io.UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new CommandExecutionException("errore provide Data", e);
		}
	}

	/**
	 * Prepara l'input stream referenziato dal result "provideData" con i valori relativi 
	 * al data-binding relativo al dataset DATASET del widget tRicerca.
	 * @return sempre il result "provideData"
	 */
	@SkipValidation
	@FatClientOnly
	public String provideTRicerca_DATASET() throws CommandExecutionException {

		// reperisce il dato da serializzare
		com.opensymphony.xwork2.ActionContext ctx = com.opensymphony.xwork2.ActionContext
				.getContext();
		Object dataToProvide = ctx.getValueStack().findValue("appDatapersone");

		if (isTableClearStatus("cpHome_tRicerca")) {
			tableStatus.setClearStatus(true);
		}
		TableDataArranger arranger = new TableDataArranger();
		if (dataToProvide != null) {
			dataToProvide = arranger.arrange((List) dataToProvide, tableStatus,
					filter);
		}

		// serializza
		flexjson.JSONSerializer serializer = new flexjson.JSONSerializer();

		String response = serializer.exclude("*.class").deepSerialize(
				dataToProvide);
		// imposta l'input stream di risposta
		java.io.ByteArrayInputStream bais;
		try {
			bais = new java.io.ByteArrayInputStream(response.getBytes("UTF-8"));
			dataProviderStream = bais;
			// risposta
			return "provideData";
		} catch (java.io.UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new CommandExecutionException("errore provide Data", e);
		}
	}

	/**
	 * Gestione della validazione
	 */
	public void validate() {
		/*PROTECTED REGION ID(R-1459633069) ENABLED START*/
		/* Inserire la validazione */
		/*PROTECTED REGION END*/
	}

	protected Map<String, UISecConstraint> allVisibilityConstraints = null;
	protected Map<String, UISecConstraint> allOnOffConstraints = null;

	/**
	 * Metodo di preparazione della schermata/action
	 */
	public void prepare() throws CommandExecutionException {
		super.prepare();

		// cancellazione eventuale degli errori di conversione non desiderati
		clearConversionErrorsIfSkipValidation();

		// caricamento struttura di constraints
		if (allVisibilityConstraints == null)
			allVisibilityConstraints = getPageVisibilityUIConstraints();
		if (allOnOffConstraints == null)
			allOnOffConstraints = getPageONOFFUIConstraints();

		// gestione dello stato di default
		if (getSession().get("cpHome_currentState") == null) {
			// Screen State Command begin
			//prepara i nomi dei componenti target da abilitare/disabilitare
			String[] default_widgets_on = new String[]{"mnuMenu", "cbRegione",
					"cbProvincia", "tfCognome", "tfRetribuzione", "bRicerca",
					"bAzzera", "tRicerca", "bInserisci"};

			String[] default_widgets_off = new String[]{"bCancella",
					"bModifica"};

			String[] default_widgets_show = new String[]{"mnuMenu",
					"cbRegione", "cbProvincia", "tfCognome", "tfRetribuzione",
					"bRicerca", "bAzzera", "tRicerca", "bInserisci"};

			String[] default_widgets_hide = new String[]{"bCancella",
					"bModifica"};

			ScreenStateCommand defaultScreenStateCmd = new ScreenStateCommand(
					"cpHome", null, default_widgets_on, default_widgets_off,
					default_widgets_show, default_widgets_hide);
			//Screen State Command end

			defaultScreenStateCmd.doCommand(this);
		}

		// comandi eseguiti ad ogni refresh solo se non sono in modalita' fatclient
		ActionContext ctx = ActionContext.getContext();
		String methodName = ctx.getActionInvocation().getProxy().getMethod();

		if (methodName.startsWith("execute")
				|| (!methodName.startsWith("exec") && !methodName
						.startsWith("provide"))) {
			// comandi eseguiti ad ogni refresh solo per i metodi non fatclient
			ICommand cmd = initOnRefreshCommand();
			cmd.doCommand(this);
		}

	}

	// ridefinizione dei metodi di verifica visibilita'/validazione
	// per supportare i security check

	public boolean isWidgetDisabled(String cpName, String widgShortName) {
		UISecConstraint ctr = allOnOffConstraints.get(widgShortName);
		if (ctr != null) {
			try {
				return !ctr.verifyConstraint(session,
						UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR,
						getSpringSecurityHelper());
			} catch (BEException ex) {
				log.error("[CpHomeAction::isWidgetDisabled] errore durante verifica->disable");
				return true; // forzo la DISABILITAZIONE
			}
		} else
			return super.isWidgetDisabled(cpName, widgShortName);
	}

	public boolean isWidgetVisible(String cpName, String widgShortName) {
		UISecConstraint ctr = allVisibilityConstraints.get(widgShortName);
		if (ctr != null) {
			try {
				return ctr.verifyConstraint(session,
						UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR,
						getSpringSecurityHelper());
			} catch (BEException ex) {
				log.error("[CpHomeAction::isWidgetVisible] errore durante verifica->hide");
				return false; // forzo l'invisibilita'
			}
		} else
			return super.isWidgetVisible(cpName, widgShortName);
	}

	/**
	 * inizializza la struttura dei command da eseguire al refresh del pannello
	 */
	private ICommand initOnRefreshCommand() {
		// ExecCommand begin
		String[] resultNames4gestisciCombo = new String[]{"ok"};

		ICommand[] actionsForResults4gestisciCombo = new ICommand[1];
		/// NOP Command begin
		NOPCommand act_onRefresh_resokAction_0 = new NOPCommand();
		/// NOP Command end
		actionsForResults4gestisciCombo[0] = act_onRefresh_resokAction_0;

		ExecCommand act_onRefresh_1 = new ExecCommand(
				resultNames4gestisciCombo, actionsForResults4gestisciCombo) {
			public ExecResults doLogic(Object theModel)
					throws CommandExecutionException {
				it.csi.util.performance.StopWatch watcher = new it.csi.util.performance.StopWatch(
						it.csi.demo.democomp.util.Constants.APPLICATION_CODE);
				ExecResults result = null;
				try {
					watcher.start();
					result = getSpringBackEnd()
							.gestisciCombo(
									(it.csi.demo.democomp.dto.miaapp.CpHomeModel) theModel);
					watcher.stop();
					watcher.dumpElapsed("CpHomeAction", "readOne()",
							"chiamata verso BackEnd", "gestisciCombo");
					return result;
				} catch (BEException e) {
					throw new CommandExecutionException(
							"errore non gestito nell'esecuzione del metodo [gestisciCombo]:"
									+ e.getMessage(), e);
				}

			}

			public void storeAppData(ExecResults res, BaseAction strutsAction) {
				// cast della action al tipo specifico per poter utilizzare direttamente
				// le property
				CpHomeAction specificAction = (CpHomeAction) strutsAction;

				// store del dato province
				//java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Provincia> _appDataprovince = 
				//	(java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Provincia>)res.getAppDataprovince();
				// il dato province e' salvato in un attributo della action corrente
				//specificAction.setAppDataprovince(_appDataprovince);
				// il dato province e' salvato in sessione
				strutsAction.getSession().put("appDataprovince",
						specificAction.getAppDataprovince());
				// store del dato regioni
				//java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Regione> _appDataregioni = 
				//	(java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Regione>)res.getAppDataregioni();
				// il dato regioni e' salvato in un attributo della action corrente
				//specificAction.setAppDataregioni(_appDataregioni);
				// il dato regioni e' salvato in sessione
				strutsAction.getSession().put("appDataregioni",
						specificAction.getAppDataregioni());
			}
		};
		// Exec Action end
		return act_onRefresh_1;
	}

	protected Map<String, UISecConstraint> getPageVisibilityUIConstraints() {
		Map<String, UISecConstraint> allConstraints = new HashMap<String, UISecConstraint>();

		// constraint fittizio per mnuMenu
		UISecConstraint mnuMenu_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "mnuMenu",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] mnuMenu_constraints = new UISecConstraint[]{mnuMenu_defaultVisib_ctr};
		UISecConstraint mnuMenu_ctr = new ComplexUISecConstraint(
				mnuMenu_constraints);
		allConstraints.put("mnuMenu", mnuMenu_ctr);

		// constraint fittizio per cbRegione
		UISecConstraint cbRegione_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "cbRegione",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] cbRegione_constraints = new UISecConstraint[]{cbRegione_defaultVisib_ctr};
		UISecConstraint cbRegione_ctr = new ComplexUISecConstraint(
				cbRegione_constraints);
		allConstraints.put("cbRegione", cbRegione_ctr);

		// constraint fittizio per cbProvincia
		UISecConstraint cbProvincia_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "cbProvincia",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] cbProvincia_constraints = new UISecConstraint[]{cbProvincia_defaultVisib_ctr};
		UISecConstraint cbProvincia_ctr = new ComplexUISecConstraint(
				cbProvincia_constraints);
		allConstraints.put("cbProvincia", cbProvincia_ctr);

		// constraint fittizio per tfCognome
		UISecConstraint tfCognome_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "tfCognome",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] tfCognome_constraints = new UISecConstraint[]{tfCognome_defaultVisib_ctr};
		UISecConstraint tfCognome_ctr = new ComplexUISecConstraint(
				tfCognome_constraints);
		allConstraints.put("tfCognome", tfCognome_ctr);

		// constraint fittizio per tfRetribuzione
		UISecConstraint tfRetribuzione_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "tfRetribuzione",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] tfRetribuzione_constraints = new UISecConstraint[]{tfRetribuzione_defaultVisib_ctr};
		UISecConstraint tfRetribuzione_ctr = new ComplexUISecConstraint(
				tfRetribuzione_constraints);
		allConstraints.put("tfRetribuzione", tfRetribuzione_ctr);

		// constraint fittizio per bRicerca
		UISecConstraint bRicerca_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "bRicerca",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bRicerca_constraints = new UISecConstraint[]{bRicerca_defaultVisib_ctr};
		UISecConstraint bRicerca_ctr = new ComplexUISecConstraint(
				bRicerca_constraints);
		allConstraints.put("bRicerca", bRicerca_ctr);

		// constraint fittizio per bAzzera
		UISecConstraint bAzzera_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "bAzzera",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bAzzera_constraints = new UISecConstraint[]{bAzzera_defaultVisib_ctr};
		UISecConstraint bAzzera_ctr = new ComplexUISecConstraint(
				bAzzera_constraints);
		allConstraints.put("bAzzera", bAzzera_ctr);

		// constraint fittizio per tRicerca
		UISecConstraint tRicerca_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "tRicerca",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] tRicerca_constraints = new UISecConstraint[]{tRicerca_defaultVisib_ctr};
		UISecConstraint tRicerca_ctr = new ComplexUISecConstraint(
				tRicerca_constraints);
		allConstraints.put("tRicerca", tRicerca_ctr);

		// constraint fittizio per bCancella
		UISecConstraint bCancella_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "bCancella",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bCancella_constraints = new UISecConstraint[]{bCancella_defaultVisib_ctr};
		UISecConstraint bCancella_ctr = new ComplexUISecConstraint(
				bCancella_constraints);
		allConstraints.put("bCancella", bCancella_ctr);

		// constraint fittizio per bInserisci
		UISecConstraint bInserisci_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "bInserisci",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bInserisci_constraints = new UISecConstraint[]{bInserisci_defaultVisib_ctr};
		UISecConstraint bInserisci_ctr = new ComplexUISecConstraint(
				bInserisci_constraints);
		allConstraints.put("bInserisci", bInserisci_ctr);

		// constraint fittizio per bModifica
		UISecConstraint bModifica_defaultVisib_ctr =

		new DummyUISecConstraint("cpHome", "bModifica",
				UISecConstraint.VISIB_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bModifica_constraints = new UISecConstraint[]{bModifica_defaultVisib_ctr};
		UISecConstraint bModifica_ctr = new ComplexUISecConstraint(
				bModifica_constraints);
		allConstraints.put("bModifica", bModifica_ctr);
		return allConstraints;
	}

	protected Map<String, UISecConstraint> getPageONOFFUIConstraints() {
		Map<String, UISecConstraint> allConstraints = new HashMap<String, UISecConstraint>();

		// constraint fittizio per mnuMenu
		UISecConstraint mnuMenu_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "mnuMenu",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] mnuMenu_constraints = new UISecConstraint[]{mnuMenu_defaultOnoff_ctr};
		UISecConstraint mnuMenu_ctr = new ComplexUISecConstraint(
				mnuMenu_constraints);
		allConstraints.put("mnuMenu", mnuMenu_ctr);

		// constraint fittizio per cbRegione
		UISecConstraint cbRegione_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "cbRegione",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] cbRegione_constraints = new UISecConstraint[]{cbRegione_defaultOnoff_ctr};
		UISecConstraint cbRegione_ctr = new ComplexUISecConstraint(
				cbRegione_constraints);
		allConstraints.put("cbRegione", cbRegione_ctr);

		// constraint fittizio per cbProvincia
		UISecConstraint cbProvincia_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "cbProvincia",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] cbProvincia_constraints = new UISecConstraint[]{cbProvincia_defaultOnoff_ctr};
		UISecConstraint cbProvincia_ctr = new ComplexUISecConstraint(
				cbProvincia_constraints);
		allConstraints.put("cbProvincia", cbProvincia_ctr);

		// constraint fittizio per tfCognome
		UISecConstraint tfCognome_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "tfCognome",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] tfCognome_constraints = new UISecConstraint[]{tfCognome_defaultOnoff_ctr};
		UISecConstraint tfCognome_ctr = new ComplexUISecConstraint(
				tfCognome_constraints);
		allConstraints.put("tfCognome", tfCognome_ctr);

		// constraint fittizio per tfRetribuzione
		UISecConstraint tfRetribuzione_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "tfRetribuzione",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] tfRetribuzione_constraints = new UISecConstraint[]{tfRetribuzione_defaultOnoff_ctr};
		UISecConstraint tfRetribuzione_ctr = new ComplexUISecConstraint(
				tfRetribuzione_constraints);
		allConstraints.put("tfRetribuzione", tfRetribuzione_ctr);

		// constraint fittizio per bRicerca
		UISecConstraint bRicerca_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "bRicerca",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bRicerca_constraints = new UISecConstraint[]{bRicerca_defaultOnoff_ctr};
		UISecConstraint bRicerca_ctr = new ComplexUISecConstraint(
				bRicerca_constraints);
		allConstraints.put("bRicerca", bRicerca_ctr);

		// constraint fittizio per bAzzera
		UISecConstraint bAzzera_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "bAzzera",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bAzzera_constraints = new UISecConstraint[]{bAzzera_defaultOnoff_ctr};
		UISecConstraint bAzzera_ctr = new ComplexUISecConstraint(
				bAzzera_constraints);
		allConstraints.put("bAzzera", bAzzera_ctr);

		// constraint fittizio per tRicerca
		UISecConstraint tRicerca_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "tRicerca",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] tRicerca_constraints = new UISecConstraint[]{tRicerca_defaultOnoff_ctr};
		UISecConstraint tRicerca_ctr = new ComplexUISecConstraint(
				tRicerca_constraints);
		allConstraints.put("tRicerca", tRicerca_ctr);

		// constraint fittizio per bCancella
		UISecConstraint bCancella_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "bCancella",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bCancella_constraints = new UISecConstraint[]{bCancella_defaultOnoff_ctr};
		UISecConstraint bCancella_ctr = new ComplexUISecConstraint(
				bCancella_constraints);
		allConstraints.put("bCancella", bCancella_ctr);

		// constraint fittizio per bInserisci
		UISecConstraint bInserisci_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "bInserisci",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bInserisci_constraints = new UISecConstraint[]{bInserisci_defaultOnoff_ctr};
		UISecConstraint bInserisci_ctr = new ComplexUISecConstraint(
				bInserisci_constraints);
		allConstraints.put("bInserisci", bInserisci_ctr);

		// constraint fittizio per bModifica
		UISecConstraint bModifica_defaultOnoff_ctr =

		new DummyUISecConstraint("cpHome", "bModifica",
				UISecConstraint.ONOFF_CONSTRAINED_BEHAVIOR, true, true);

		UISecConstraint[] bModifica_constraints = new UISecConstraint[]{bModifica_defaultOnoff_ctr};
		UISecConstraint bModifica_ctr = new ComplexUISecConstraint(
				bModifica_constraints);
		allConstraints.put("bModifica", bModifica_ctr);
		return allConstraints;
	}

	/**  */
	void dumpModel(boolean pre) {
		log.debug("[CpHomeAction::dumpmodel] START");

		log.debug("[CpHomeAction::dumpmodel] #### DUMP del model della action "
				+ this.getClass()
				+ (pre ? " prima dell'azione" : " dopo l'azione"));
		log.debug("[CpHomeAction::dumpmodel] [a] campi pubblici del model");
		try {
			java.beans.BeanInfo bi = java.beans.Introspector.getBeanInfo(this
					.getClass());
			java.beans.PropertyDescriptor[] props = bi.getPropertyDescriptors();
			for (int i = 0; i < props.length; i++) {
				java.beans.PropertyDescriptor pd = props[i];
				java.lang.reflect.Method m = pd.getReadMethod();
				if (m != null) {
					Object pval = m.invoke(this, new Object[]{});
					log.debug("[CpHomeAction::dumpmodel] " + pd.getName() + ":"
							+ pval);
				}
			}
		} catch (IllegalAccessException e) {
			log.error("[CpHomeAction::dumpmodel] Errore nel dump" + e
					+ ", ignoro");
		} catch (InvocationTargetException e) {
			log.error("[CpHomeAction::dumpmodel] Errore nel dump" + e
					+ ", ignoro");
		} catch (IntrospectionException e) {
			log.error("[CpHomeAction::dumpmodel] Errore nel dump" + e
					+ ", ignoro");
		}
		log.debug("[CpHomeAction::dumpmodel] [b] stato dei widget");
		Object cpWidgetStatus = session.get("cpHome");
		log.debug("[CpHomeAction::dumpmodel] " + cpWidgetStatus);
		log.debug("[CpHomeAction::dumpmodel] [c] sessione");
		log.debug("[CpHomeAction::dumpmodel] " + session);
	}

	static final String PENDING_CLEAR_COMMAND_ATTRIBUTE = "_pending_clear_command_";
	/**
	 *	Metodo per la rimozione dalla sessione degli application data a scope
	 *  SAME_PAGE. 
	 */
	public void clearPageScopedAppData() {
		// nothing to clear...
	}

	/**
	 * inizializza la struttura dei command da eseguire per ciascun event handler 
	 * di ciascun widget
	 */
	private ICommand initCommand(String sourceWidget, String eventType) {
		HashMap<String, HashMap<String, ICommand>> cmdsByWidget = new HashMap<String, HashMap<String, ICommand>>();

		// contiene i comandi del widget cbRegione per ogni Ev.H.
		HashMap<String, ICommand> cmds4cbRegioneByEvh = new HashMap<String, ICommand>();

		cmds4cbRegioneByEvh.put("VALUE_CHANGED",
				initCommandCbRegione_VALUE_CHANGED());
		cmdsByWidget.put("cbRegione", cmds4cbRegioneByEvh);
		// contiene i comandi del widget bRicerca per ogni Ev.H.
		HashMap<String, ICommand> cmds4bRicercaByEvh = new HashMap<String, ICommand>();

		cmds4bRicercaByEvh.put("CLICKED", initCommandBRicerca_CLICKED());
		cmdsByWidget.put("bRicerca", cmds4bRicercaByEvh);
		// contiene i comandi del widget bAzzera per ogni Ev.H.
		HashMap<String, ICommand> cmds4bAzzeraByEvh = new HashMap<String, ICommand>();

		cmds4bAzzeraByEvh.put("CLICKED", initCommandBAzzera_CLICKED());
		cmdsByWidget.put("bAzzera", cmds4bAzzeraByEvh);
		// contiene i comandi del widget bCancella per ogni Ev.H.
		HashMap<String, ICommand> cmds4bCancellaByEvh = new HashMap<String, ICommand>();

		cmds4bCancellaByEvh.put("CLICKED", initCommandBCancella_CLICKED());
		cmdsByWidget.put("bCancella", cmds4bCancellaByEvh);
		// contiene i comandi del widget bInserisci per ogni Ev.H.
		HashMap<String, ICommand> cmds4bInserisciByEvh = new HashMap<String, ICommand>();

		cmds4bInserisciByEvh.put("CLICKED", initCommandBInserisci_CLICKED());
		cmdsByWidget.put("bInserisci", cmds4bInserisciByEvh);
		// contiene i comandi del widget bModifica per ogni Ev.H.
		HashMap<String, ICommand> cmds4bModificaByEvh = new HashMap<String, ICommand>();

		cmds4bModificaByEvh.put("CLICKED", initCommandBModifica_CLICKED());
		cmdsByWidget.put("bModifica", cmds4bModificaByEvh);

		ICommand ris = cmdsByWidget.get(sourceWidget).get(eventType);
		if (ris != null)
			return ris;
		else
			return new ICommand() { // NOP..
				public String doCommand(BaseAction strutsAction)
						throws CommandExecutionException {
					return null;
				}
			};
	}

	private ICommand initCommandCbRegione_VALUE_CHANGED() {
		/// Refresh Command begin
		String[] act_actions_value_changed_cbRegione_1_panels = new String[]{"pRicerca"};
		String[] act_actions_value_changed_cbRegione_1_widgets = new String[]{"cbProvincia"};
		RefreshViewCommand act_actions_value_changed_cbRegione_1 = new RefreshViewCommand(
				"cpHome", act_actions_value_changed_cbRegione_1_panels,
				act_actions_value_changed_cbRegione_1_widgets);

		/// Refresh Command end
		return act_actions_value_changed_cbRegione_1;
	}

	private ICommand initCommandBRicerca_CLICKED() {
		// ExecCommand begin
		String[] resultNames4eseguiRicerca = new String[]{"ok", "ko"};

		ICommand[] actionsForResults4eseguiRicerca = new ICommand[2];
		// SequenceCommand begin
		/// Refresh Command begin
		String[] act_actions_clicked_bRicerca_resokActionstep_0_panels = new String[]{
				"pTabella", "pComandiTabella", "pRicerca"};
		String[] act_actions_clicked_bRicerca_resokActionstep_0_widgets = new String[]{"tRicerca"};
		RefreshViewCommand act_actions_clicked_bRicerca_resokActionstep_0 = new RefreshViewCommand(
				"cpHome",
				act_actions_clicked_bRicerca_resokActionstep_0_panels,
				act_actions_clicked_bRicerca_resokActionstep_0_widgets);

		/// Refresh Command end
		// Screen State Command begin
		//prepara i nomi dei componenti target da abilitare/disabilitare
		String[] act_actions_clicked_bRicerca_resokActionstep_1_on = new String[]{
				"mnuMenu", "cbRegione", "cbProvincia", "tfCognome",
				"tfRetribuzione", "bRicerca", "bAzzera", "tRicerca",
				"bCancella", "bInserisci", "bModifica"};

		String[] act_actions_clicked_bRicerca_resokActionstep_1_off = new String[]{};

		String[] act_actions_clicked_bRicerca_resokActionstep_1_show = new String[]{
				"mnuMenu", "cbRegione", "cbProvincia", "tfCognome",
				"tfRetribuzione", "bRicerca", "bAzzera", "tRicerca",
				"bCancella", "bInserisci", "bModifica"};

		String[] act_actions_clicked_bRicerca_resokActionstep_1_hide = new String[]{};

		ScreenStateCommand act_actions_clicked_bRicerca_resokActionstep_1 = new ScreenStateCommand(
				"cpHome", "TROVATO_QUALCOSA",
				act_actions_clicked_bRicerca_resokActionstep_1_on,
				act_actions_clicked_bRicerca_resokActionstep_1_off,
				act_actions_clicked_bRicerca_resokActionstep_1_show,
				act_actions_clicked_bRicerca_resokActionstep_1_hide);
		//Screen State Command end

		ICommand[] act_actions_clicked_bRicerca_resokAction_0_steps = new ICommand[]{
				act_actions_clicked_bRicerca_resokActionstep_0,
				act_actions_clicked_bRicerca_resokActionstep_1};
		SequenceCommand act_actions_clicked_bRicerca_resokAction_0 = new SequenceCommand(
				act_actions_clicked_bRicerca_resokAction_0_steps);
		// SequenceCommand end
		actionsForResults4eseguiRicerca[0] = act_actions_clicked_bRicerca_resokAction_0;
		// SequenceCommand begin
		// Screen State Command begin
		//prepara i nomi dei componenti target da abilitare/disabilitare
		String[] act_actions_clicked_bRicerca_reskoActionstep_0_on = new String[]{
				"mnuMenu", "cbRegione", "cbProvincia", "tfCognome",
				"tfRetribuzione", "bRicerca", "bAzzera", "tRicerca",
				"bInserisci"};

		String[] act_actions_clicked_bRicerca_reskoActionstep_0_off = new String[]{
				"bCancella", "bModifica"};

		String[] act_actions_clicked_bRicerca_reskoActionstep_0_show = new String[]{
				"mnuMenu", "cbRegione", "cbProvincia", "tfCognome",
				"tfRetribuzione", "bRicerca", "bAzzera", "tRicerca",
				"bInserisci"};

		String[] act_actions_clicked_bRicerca_reskoActionstep_0_hide = new String[]{
				"bCancella", "bModifica"};

		ScreenStateCommand act_actions_clicked_bRicerca_reskoActionstep_0 = new ScreenStateCommand(
				"cpHome", "NESSUN_RISULTATO",
				act_actions_clicked_bRicerca_reskoActionstep_0_on,
				act_actions_clicked_bRicerca_reskoActionstep_0_off,
				act_actions_clicked_bRicerca_reskoActionstep_0_show,
				act_actions_clicked_bRicerca_reskoActionstep_0_hide);
		//Screen State Command end
		/// Refresh Command begin
		String[] act_actions_clicked_bRicerca_reskoActionstep_1_panels = new String[]{
				"pTabella", "pComandiTabella", "pnlErroriRicerca", "pRicerca"};
		String[] act_actions_clicked_bRicerca_reskoActionstep_1_widgets = new String[]{"tRicerca"};
		RefreshViewCommand act_actions_clicked_bRicerca_reskoActionstep_1 = new RefreshViewCommand(
				"cpHome",
				act_actions_clicked_bRicerca_reskoActionstep_1_panels,
				act_actions_clicked_bRicerca_reskoActionstep_1_widgets);

		/// Refresh Command end

		ICommand[] act_actions_clicked_bRicerca_reskoAction_1_steps = new ICommand[]{
				act_actions_clicked_bRicerca_reskoActionstep_0,
				act_actions_clicked_bRicerca_reskoActionstep_1};
		SequenceCommand act_actions_clicked_bRicerca_reskoAction_1 = new SequenceCommand(
				act_actions_clicked_bRicerca_reskoAction_1_steps);
		// SequenceCommand end
		actionsForResults4eseguiRicerca[1] = act_actions_clicked_bRicerca_reskoAction_1;

		ExecCommand act_actions_clicked_bRicerca_1 = new ExecCommand(
				resultNames4eseguiRicerca, actionsForResults4eseguiRicerca) {
			public ExecResults doLogic(Object theModel)
					throws CommandExecutionException {
				it.csi.util.performance.StopWatch watcher = new it.csi.util.performance.StopWatch(
						it.csi.demo.democomp.util.Constants.APPLICATION_CODE);
				ExecResults result = null;
				try {
					watcher.start();
					result = getSpringBackEnd()
							.eseguiRicerca(
									(it.csi.demo.democomp.dto.miaapp.CpHomeModel) theModel);
					watcher.stop();
					watcher.dumpElapsed("CpHomeAction", "readOne()",
							"chiamata verso BackEnd", "eseguiRicerca");
					return result;
				} catch (BEException e) {
					throw new CommandExecutionException(
							"errore non gestito nell'esecuzione del metodo [eseguiRicerca]:"
									+ e.getMessage(), e);
				}

			}

			public void storeAppData(ExecResults res, BaseAction strutsAction) {
				// cast della action al tipo specifico per poter utilizzare direttamente
				// le property
				CpHomeAction specificAction = (CpHomeAction) strutsAction;

				// store del dato persone
				//java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Persona> _appDatapersone = 
				//	(java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Persona>)res.getAppDatapersone();
				// il dato persone e' salvato in un attributo della action corrente
				//specificAction.setAppDatapersone(_appDatapersone);
				// il dato persone e' salvato in sessione
				strutsAction.getSession().put("appDatapersone",
						specificAction.getAppDatapersone());
			}
		};
		// Exec Action end
		return act_actions_clicked_bRicerca_1;
	}

	private ICommand initCommandBAzzera_CLICKED() {
		// ExecCommand begin
		String[] resultNames4azzeraCampiRicerca = new String[]{"Ok"};

		ICommand[] actionsForResults4azzeraCampiRicerca = new ICommand[1];
		// SequenceCommand begin
		// Screen State Command begin
		//prepara i nomi dei componenti target da abilitare/disabilitare
		String[] act_actions_clicked_bAzzera_resokActionstep_0_on = new String[]{
				"mnuMenu", "cbRegione", "cbProvincia", "tfCognome",
				"tfRetribuzione", "bRicerca", "bAzzera", "tRicerca",
				"bInserisci"};

		String[] act_actions_clicked_bAzzera_resokActionstep_0_off = new String[]{
				"bCancella", "bModifica"};

		String[] act_actions_clicked_bAzzera_resokActionstep_0_show = new String[]{
				"mnuMenu", "cbRegione", "cbProvincia", "tfCognome",
				"tfRetribuzione", "bRicerca", "bAzzera", "tRicerca",
				"bInserisci"};

		String[] act_actions_clicked_bAzzera_resokActionstep_0_hide = new String[]{
				"bCancella", "bModifica"};

		ScreenStateCommand act_actions_clicked_bAzzera_resokActionstep_0 = new ScreenStateCommand(
				"cpHome", "NESSUN_RISULTATO",
				act_actions_clicked_bAzzera_resokActionstep_0_on,
				act_actions_clicked_bAzzera_resokActionstep_0_off,
				act_actions_clicked_bAzzera_resokActionstep_0_show,
				act_actions_clicked_bAzzera_resokActionstep_0_hide);
		//Screen State Command end
		/// Refresh Command begin
		String[] act_actions_clicked_bAzzera_resokActionstep_1_panels = new String[]{
				"pTabella", "pComandiTabella", "pnlErroriRicerca", "pRicerca"};
		String[] act_actions_clicked_bAzzera_resokActionstep_1_widgets = new String[]{"tRicerca"};
		RefreshViewCommand act_actions_clicked_bAzzera_resokActionstep_1 = new RefreshViewCommand(
				"cpHome", act_actions_clicked_bAzzera_resokActionstep_1_panels,
				act_actions_clicked_bAzzera_resokActionstep_1_widgets);

		/// Refresh Command end

		ICommand[] act_actions_clicked_bAzzera_resokAction_0_steps = new ICommand[]{
				act_actions_clicked_bAzzera_resokActionstep_0,
				act_actions_clicked_bAzzera_resokActionstep_1};
		SequenceCommand act_actions_clicked_bAzzera_resokAction_0 = new SequenceCommand(
				act_actions_clicked_bAzzera_resokAction_0_steps);
		// SequenceCommand end
		actionsForResults4azzeraCampiRicerca[0] = act_actions_clicked_bAzzera_resokAction_0;

		ExecCommand act_actions_clicked_bAzzera_1 = new ExecCommand(
				resultNames4azzeraCampiRicerca,
				actionsForResults4azzeraCampiRicerca) {
			public ExecResults doLogic(Object theModel)
					throws CommandExecutionException {
				it.csi.util.performance.StopWatch watcher = new it.csi.util.performance.StopWatch(
						it.csi.demo.democomp.util.Constants.APPLICATION_CODE);
				ExecResults result = null;
				try {
					watcher.start();
					result = getSpringBackEnd()
							.azzeraCampiRicerca(
									(it.csi.demo.democomp.dto.miaapp.CpHomeModel) theModel);
					watcher.stop();
					watcher.dumpElapsed("CpHomeAction", "readOne()",
							"chiamata verso BackEnd", "azzeraCampiRicerca");
					return result;
				} catch (BEException e) {
					throw new CommandExecutionException(
							"errore non gestito nell'esecuzione del metodo [azzeraCampiRicerca]:"
									+ e.getMessage(), e);
				}

			}

			public void storeAppData(ExecResults res, BaseAction strutsAction) {
				// cast della action al tipo specifico per poter utilizzare direttamente
				// le property
				CpHomeAction specificAction = (CpHomeAction) strutsAction;

				// store del dato persone
				//java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Persona> _appDatapersone = 
				//	(java.util.ArrayList<it.csi.demo.democomp.dto.nspersona.Persona>)res.getAppDatapersone();
				// il dato persone e' salvato in un attributo della action corrente
				//specificAction.setAppDatapersone(_appDatapersone);
				// il dato persone e' salvato in sessione
				strutsAction.getSession().put("appDatapersone",
						specificAction.getAppDatapersone());
			}
		};
		// Exec Action end
		return act_actions_clicked_bAzzera_1;
	}

	private ICommand initCommandBCancella_CLICKED() {
		// ExecCommand begin
		String[] resultNames4cancellaRecordSelezionati = new String[]{"Ok",
				"Ko"};

		ICommand[] actionsForResults4cancellaRecordSelezionati = new ICommand[2];
		/// Refresh Command begin
		String[] act_actions_clicked_bCancella_resokAction_0_panels = new String[]{
				"pTabella", "pnlErroriRicerca"};
		String[] act_actions_clicked_bCancella_resokAction_0_widgets = new String[]{"tRicerca"};
		RefreshViewCommand act_actions_clicked_bCancella_resokAction_0 = new RefreshViewCommand(
				"cpHome", act_actions_clicked_bCancella_resokAction_0_panels,
				act_actions_clicked_bCancella_resokAction_0_widgets);

		/// Refresh Command end
		actionsForResults4cancellaRecordSelezionati[0] = act_actions_clicked_bCancella_resokAction_0;
		/// Refresh Command begin
		String[] act_actions_clicked_bCancella_reskoAction_1_panels = new String[]{
				"pTabella", "pnlErroriRicerca"};
		String[] act_actions_clicked_bCancella_reskoAction_1_widgets = new String[]{"tRicerca"};
		RefreshViewCommand act_actions_clicked_bCancella_reskoAction_1 = new RefreshViewCommand(
				"cpHome", act_actions_clicked_bCancella_reskoAction_1_panels,
				act_actions_clicked_bCancella_reskoAction_1_widgets);

		/// Refresh Command end
		actionsForResults4cancellaRecordSelezionati[1] = act_actions_clicked_bCancella_reskoAction_1;

		ExecCommand act_actions_clicked_bCancella_1 = new ExecCommand(
				resultNames4cancellaRecordSelezionati,
				actionsForResults4cancellaRecordSelezionati) {
			public ExecResults doLogic(Object theModel)
					throws CommandExecutionException {
				it.csi.util.performance.StopWatch watcher = new it.csi.util.performance.StopWatch(
						it.csi.demo.democomp.util.Constants.APPLICATION_CODE);
				ExecResults result = null;
				try {
					watcher.start();
					result = getSpringBackEnd()
							.cancellaRecordSelezionati(
									(it.csi.demo.democomp.dto.miaapp.CpHomeModel) theModel);
					watcher.stop();
					watcher.dumpElapsed("CpHomeAction", "readOne()",
							"chiamata verso BackEnd",
							"cancellaRecordSelezionati");
					return result;
				} catch (BEException e) {
					throw new CommandExecutionException(
							"errore non gestito nell'esecuzione del metodo [cancellaRecordSelezionati]:"
									+ e.getMessage(), e);
				}

			}

			public void storeAppData(ExecResults res, BaseAction strutsAction) {
				// nothing to store...
			}
		};
		// Exec Action end
		return act_actions_clicked_bCancella_1;
	}

	private ICommand initCommandBInserisci_CLICKED() {
		// ExecCommand begin
		String[] resultNames4visualizzaRecordVuoto = new String[]{"ok"};

		ICommand[] actionsForResults4visualizzaRecordVuoto = new ICommand[1];
		/// Jump Command begin
		JumpCommand act_actions_clicked_bInserisci_resokAction_0 = new JumpCommand(
				"cpDettaglioCittadino", null, false);
		/// Jump Command end
		actionsForResults4visualizzaRecordVuoto[0] = act_actions_clicked_bInserisci_resokAction_0;

		ExecCommand act_actions_clicked_bInserisci_1 = new ExecCommand(
				resultNames4visualizzaRecordVuoto,
				actionsForResults4visualizzaRecordVuoto) {
			public ExecResults doLogic(Object theModel)
					throws CommandExecutionException {
				it.csi.util.performance.StopWatch watcher = new it.csi.util.performance.StopWatch(
						it.csi.demo.democomp.util.Constants.APPLICATION_CODE);
				ExecResults result = null;
				try {
					watcher.start();
					result = getSpringBackEnd()
							.visualizzaRecordVuoto(
									(it.csi.demo.democomp.dto.miaapp.CpHomeModel) theModel);
					watcher.stop();
					watcher.dumpElapsed("CpHomeAction", "readOne()",
							"chiamata verso BackEnd", "visualizzaRecordVuoto");
					return result;
				} catch (BEException e) {
					throw new CommandExecutionException(
							"errore non gestito nell'esecuzione del metodo [visualizzaRecordVuoto]:"
									+ e.getMessage(), e);
				}

			}

			public void storeAppData(ExecResults res, BaseAction strutsAction) {
				// nothing to store...
			}
		};
		// Exec Action end
		return act_actions_clicked_bInserisci_1;
	}

	private ICommand initCommandBModifica_CLICKED() {
		// ExecCommand begin
		String[] resultNames4modificaRecordSelezionato = new String[]{"Ok",
				"Ko"};

		ICommand[] actionsForResults4modificaRecordSelezionato = new ICommand[2];
		/// Jump Command begin
		JumpCommand act_actions_clicked_bModifica_resokAction_0 = new JumpCommand(
				"cpDettaglioCittadino", null, false);
		/// Jump Command end
		actionsForResults4modificaRecordSelezionato[0] = act_actions_clicked_bModifica_resokAction_0;
		/// Refresh Command begin
		String[] act_actions_clicked_bModifica_reskoAction_1_panels = new String[]{
				"pTabella", "pnlErroriRicerca"};
		String[] act_actions_clicked_bModifica_reskoAction_1_widgets = new String[]{"tRicerca"};
		RefreshViewCommand act_actions_clicked_bModifica_reskoAction_1 = new RefreshViewCommand(
				"cpHome", act_actions_clicked_bModifica_reskoAction_1_panels,
				act_actions_clicked_bModifica_reskoAction_1_widgets);

		/// Refresh Command end
		actionsForResults4modificaRecordSelezionato[1] = act_actions_clicked_bModifica_reskoAction_1;

		ExecCommand act_actions_clicked_bModifica_1 = new ExecCommand(
				resultNames4modificaRecordSelezionato,
				actionsForResults4modificaRecordSelezionato) {
			public ExecResults doLogic(Object theModel)
					throws CommandExecutionException {
				it.csi.util.performance.StopWatch watcher = new it.csi.util.performance.StopWatch(
						it.csi.demo.democomp.util.Constants.APPLICATION_CODE);
				ExecResults result = null;
				try {
					watcher.start();
					result = getSpringBackEnd()
							.modificaRecordSelezionato(
									(it.csi.demo.democomp.dto.miaapp.CpHomeModel) theModel);
					watcher.stop();
					watcher.dumpElapsed("CpHomeAction", "readOne()",
							"chiamata verso BackEnd",
							"modificaRecordSelezionato");
					return result;
				} catch (BEException e) {
					throw new CommandExecutionException(
							"errore non gestito nell'esecuzione del metodo [modificaRecordSelezionato]:"
									+ e.getMessage(), e);
				}

			}

			public void storeAppData(ExecResults res, BaseAction strutsAction) {
				// nothing to store...
			}
		};
		// Exec Action end
		return act_actions_clicked_bModifica_1;
	}

	@SkipValidation
	public String handleChangeTab() {
		if (this.hasActionErrors() || this.hasFieldErrors() || this.hasErrors())
			return INPUT;
		else {
			session.put(selectedTabKey, selectedTabValue);
			return SUCCESS;
		}
	}

}
