src/it/finsiel/siged/mvc/presentation/action/soggetto/CercaAooAction.java
public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        ActionMessages errors = new ActionMessages();
        HttpSession session = request.getSession();

        CercaAooForm aooForm = (CercaAooForm) form;

        if (form == null) {
            logger.info(" Creating new Cerca AOO Form");
            form = new CercaAooForm();
            request.setAttribute(mapping.getAttribute(), form);
        }

        String codice = (String) request.getAttribute("nominativoDestinatario");
        boolean preQuery = (!"".equals(codice) && codice != null);
        ParametriLdapVO par = LookupDelegate.getInstance().getIndicePAParams();

        if (request.getParameter("parId") != null) {
            // l'utente ha selezionato un'amministrazione, mostriamo le AOO
            String ammCN = (String) request.getParameter("parId");
            aooForm.setListaAoo(LdapUtil.listaAOO(par.getHost(),
                    par.getPorta(), "o=" + ammCN + "," + par.getDn(),
                    "(aoo=*)", LDAPConnection.SCOPE_SUB, 100));
            return (mapping.findForward("listaAoo"));
        } else if (aooForm.getCerca() != null || preQuery) {
            // l'utente vuole effettuare una ricerca
            aooForm.setListaAmm(null);
            if (!"".equals(codice) && codice != null) {
                aooForm.setNome(codice);
            }

            errors = aooForm.validate(mapping, request);
            if (!errors.isEmpty()) {
                saveErrors(request, errors);
                return mapping.findForward("input");
            }

            try {
                aooForm.setListaAmm(LdapUtil.cercaAmministrazione(
                        par.getHost(), par.getPorta(), par.getDn(),
                        "(&(description=*" + aooForm.getNome() + "*)"
                                + "(objectClass=amministrazione)(tipoAmm="
                                + aooForm.getCategoriaId() + "))",
                        LDAPConnection.SCOPE_SUB, 100));
            } catch (Exception e) {
                errors.add("general", new ActionMessage("errore.ricerca.ldap"));
            }

        } else if (request.getParameter("annulla") != null) {
            session.removeAttribute("tornaProtocollo");
            return (mapping.findForward("tornaProtocolloUscita"));

        } else if (request.getParameter("codiceAoo") != null) {
            // l'utente ha selezionato un'aoo
            String dn = (String) request.getParameter("codiceAoo");
            DestinatarioVO aoo = LdapUtil.getAOO(par.getHost(), par.getPorta(),
                    dn);
            if (ReturnValues.NOT_FOUND == aoo.getReturnValue()) {
                errors.add("general", new ActionMessage("aoo.notfound"));
                saveErrors(request, errors);
                return mapping.findForward("input");
            }
            session.removeAttribute("tornaProtocollo");
            Object pForm = session.getAttribute("protocolloForm");
            if (pForm != null) {
                ArrayList navBar = (ArrayList) session
                        .getAttribute(Constants.NAV_BAR);
                if (navBar.size() > 1) {
                    navBar.remove(navBar.size() - 1);
                }
                ProtocolloUscitaForm protForm = (ProtocolloUscitaForm) pForm;
                // soggetto selezionato
                protForm.setNominativoDestinatario(aoo.getDestinatario());
                protForm.setEmailDestinatario(aoo.getEmail());
                protForm.setCitta(aoo.getCitta());
                protForm.setIndirizzoDestinatario(aoo.getIndirizzo());
                return (mapping.findForward("tornaProtocolloUscita"));
            }
            // carica i dati nel protocollo form
            return (mapping.findForward("input"));
        }
        return (mapping.findForward("input"));

    }
/**
     * Process the specified HTTP request, and create the corresponding HTTP
     * response (or forward to another web component that will create it).
     * Return an <code>ActionForward</code> instance describing where and how
     * control should be forwarded, or <code>null</code> if the response has
     * already been completed.
     * 
     * @param mapping
     *            The ActionMapping used to select this instance
     * @param pfForm
     *            The optional ActionForm bean for this request (if any)
     * @param request
     *            The HTTP request we are processing
     * @param response
     *            The HTTP response we are creating
     * 
     * @exception Exception
     *                if business logic throws an exception
     */
Process the specified HTTP request, and create the corresponding HTTP
response (or forward to another web component that will create it).
Return an ActionForward instance describing where and how
control should be forwarded, or null if the response has
already been completed.

@param mapping
The ActionMapping used to select this instance
@param pfForm
The optional ActionForm bean for this request (if any)
@param request
The HTTP request we are processing
@param response
The HTTP response we are creating

@exception Exception
if business logic throws an exception
Process the specified HTTP request and create the corresponding HTTP response ( or forward to another web component that will create it ) . Return an ActionForward instance describing where and how control should be forwarded or null if the response has already been completed . @param mapping The ActionMapping used to select this instance @param pfForm The optional ActionForm bean for this request ( if any ) @param request The HTTP request we are processing @param response The HTTP response we are creating @exception Exception if business logic throws an exception
public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        ActionMessages errors = new ActionMessages();
        HttpSession session = request.getSession();
        CercaAooForm aooForm = (CercaAooForm) form;
        if (form == null) {
            logger.info(" Creating new Cerca AOO Form");
            form = new CercaAooForm();
            request.setAttribute(mapping.getAttribute(), form);
        }
        String codice = (String) request.getAttribute("nominativoDestinatario");
        boolean preQuery = (!"".equals(codice) && codice != null);
        ParametriLdapVO par = LookupDelegate.getInstance().getIndicePAParams();
        if (request.getParameter("parId") != null) {
            String ammCN = (String) request.getParameter("parId");
            aooForm.setListaAoo(LdapUtil.listaAOO(par.getHost(),
                    par.getPorta(), "o=" + ammCN + "," + par.getDn(),
                    "(aoo=*)", LDAPConnection.SCOPE_SUB, 100));
            return (mapping.findForward("listaAoo"));
        } else if (aooForm.getCerca() != null || preQuery) {
            aooForm.setListaAmm(null);
            if (!"".equals(codice) && codice != null) {
                aooForm.setNome(codice);
            }
            errors = aooForm.validate(mapping, request);
            if (!errors.isEmpty()) {
                saveErrors(request, errors);
                return mapping.findForward("input");
            }
            try {
                aooForm.setListaAmm(LdapUtil.cercaAmministrazione(
                        par.getHost(), par.getPorta(), par.getDn(),
                        "(&(description=*" + aooForm.getNome() + "*)"
                                + "(objectClass=amministrazione)(tipoAmm="
                                + aooForm.getCategoriaId() + "))",
                        LDAPConnection.SCOPE_SUB, 100));
            } catch (Exception e) {
                errors.add("general", new ActionMessage("errore.ricerca.ldap"));
            }
        } else if (request.getParameter("annulla") != null) {
            session.removeAttribute("tornaProtocollo");
            return (mapping.findForward("tornaProtocolloUscita"));
        } else if (request.getParameter("codiceAoo") != null) {
            String dn = (String) request.getParameter("codiceAoo");
            DestinatarioVO aoo = LdapUtil.getAOO(par.getHost(), par.getPorta(),
                    dn);
            if (ReturnValues.NOT_FOUND == aoo.getReturnValue()) {
                errors.add("general", new ActionMessage("aoo.notfound"));
                saveErrors(request, errors);
                return mapping.findForward("input");
            }
            session.removeAttribute("tornaProtocollo");
            Object pForm = session.getAttribute("protocolloForm");
            if (pForm != null) {
                ArrayList navBar = (ArrayList) session
                        .getAttribute(Constants.NAV_BAR);
                if (navBar.size() > 1) {
                    navBar.remove(navBar.size() - 1);
                }
                ProtocolloUscitaForm protForm = (ProtocolloUscitaForm) pForm;
                protForm.setNominativoDestinatario(aoo.getDestinatario());
                protForm.setEmailDestinatario(aoo.getEmail());
                protForm.setCitta(aoo.getCitta());
                protForm.setIndirizzoDestinatario(aoo.getIndirizzo());
                return (mapping.findForward("tornaProtocolloUscita"));
            }
            return (mapping.findForward("input"));
        }
        return (mapping.findForward("input"));
    }
public ActionForward execute ( ActionMapping mapping , ActionForm form , HttpServletRequest request , HttpServletResponse response ) throws Exception { ActionMessages errors = new ActionMessages ( ) ; HttpSession session = request . getSession ( ) ; CercaAooForm aooForm = ( CercaAooForm ) form ; if ( form == null ) { logger . info ( " Creating new Cerca AOO Form" ) ; form = new CercaAooForm ( ) ; request . setAttribute ( mapping . getAttribute ( ) , form ) ; } String codice = ( String ) request . getAttribute ( "nominativoDestinatario" ) ; boolean preQuery = ( ! "" . equals ( codice ) && codice != null ) ; ParametriLdapVO par = LookupDelegate . getInstance ( ) . getIndicePAParams ( ) ; if ( request . getParameter ( "parId" ) != null ) { String ammCN = ( String ) request . getParameter ( "parId" ) ; aooForm . setListaAoo ( LdapUtil . listaAOO ( par . getHost ( ) , par . getPorta ( ) , "o=" + ammCN + "," + par . getDn ( ) , "(aoo=*)" , LDAPConnection . SCOPE_SUB , 100 ) ) ; return ( mapping . findForward ( "listaAoo" ) ) ; } else if ( aooForm . getCerca ( ) != null || preQuery ) { aooForm . setListaAmm ( null ) ; if ( ! "" . equals ( codice ) && codice != null ) { aooForm . setNome ( codice ) ; } errors = aooForm . validate ( mapping , request ) ; if ( ! errors . isEmpty ( ) ) { saveErrors ( request , errors ) ; return mapping . findForward ( "input" ) ; } try { aooForm . setListaAmm ( LdapUtil . cercaAmministrazione ( par . getHost ( ) , par . getPorta ( ) , par . getDn ( ) , "(&(description=*" + aooForm . getNome ( ) + "*)" + "(objectClass=amministrazione)(tipoAmm=" + aooForm . getCategoriaId ( ) + "))" , LDAPConnection . SCOPE_SUB , 100 ) ) ; } catch ( Exception e ) { errors . add ( "general" , new ActionMessage ( "errore.ricerca.ldap" ) ) ; } } else if ( request . getParameter ( "annulla" ) != null ) { session . removeAttribute ( "tornaProtocollo" ) ; return ( mapping . findForward ( "tornaProtocolloUscita" ) ) ; } else if ( request . getParameter ( "codiceAoo" ) != null ) { String dn = ( String ) request . getParameter ( "codiceAoo" ) ; DestinatarioVO aoo = LdapUtil . getAOO ( par . getHost ( ) , par . getPorta ( ) , dn ) ; if ( ReturnValues . NOT_FOUND == aoo . getReturnValue ( ) ) { errors . add ( "general" , new ActionMessage ( "aoo.notfound" ) ) ; saveErrors ( request , errors ) ; return mapping . findForward ( "input" ) ; } session . removeAttribute ( "tornaProtocollo" ) ; Object pForm = session . getAttribute ( "protocolloForm" ) ; if ( pForm != null ) { ArrayList navBar = ( ArrayList ) session . getAttribute ( Constants . NAV_BAR ) ; if ( navBar . size ( ) > 1 ) { navBar . remove ( navBar . size ( ) - 1 ) ; } ProtocolloUscitaForm protForm = ( ProtocolloUscitaForm ) pForm ; protForm . setNominativoDestinatario ( aoo . getDestinatario ( ) ) ; protForm . setEmailDestinatario ( aoo . getEmail ( ) ) ; protForm . setCitta ( aoo . getCitta ( ) ) ; protForm . setIndirizzoDestinatario ( aoo . getIndirizzo ( ) ) ; return ( mapping . findForward ( "tornaProtocolloUscita" ) ) ; } return ( mapping . findForward ( "input" ) ) ; } return ( mapping . findForward ( "input" ) ) ; }
Process the specified HTTP request, and create the corresponding HTTP
 response (or forward to another web component that will create it).
Process the specified HTTP request and create the corresponding HTTP response ( or forward to another web component that will create it ) .
// l'utente ha selezionato un'amministrazione, mostriamo le AOO // l'utente vuole effettuare una ricerca // l'utente ha selezionato un'aoo // soggetto selezionato // carica i dati nel protocollo form