All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.cnr.contab.doccont00.action.RicercaMandatoReversaleAction Maven / Gradle / Ivy

/*
 * Copyright (C) 2019  Consiglio Nazionale delle Ricerche
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Affero General Public License as
 *     published by the Free Software Foundation, either version 3 of the
 *     License, or (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Affero General Public License for more details.
 *
 *     You should have received a copy of the GNU Affero General Public License
 *     along with this program.  If not, see .
 */

package it.cnr.contab.doccont00.action;


import it.cnr.contab.doccont00.bp.CRUDDistintaCassiereBP;
import it.cnr.contab.doccont00.bp.RicercaMandatoReversaleBP;
import it.cnr.contab.doccont00.intcass.bulk.V_mandato_reversaleBulk;
import it.cnr.contab.util.Utility;
import it.cnr.jada.action.*;
import it.cnr.jada.bulk.BulkInfo;
import it.cnr.jada.bulk.OggettoBulk;
import it.cnr.jada.util.ObjectReplacer;
import it.cnr.jada.util.RemoteIterator;
import it.cnr.jada.util.action.SelectionListener;
import it.cnr.jada.util.action.SelezionatoreListaBP;

import java.rmi.RemoteException;

public class RicercaMandatoReversaleAction extends it.cnr.jada.util.action.CRUDAction {
    public RicercaMandatoReversaleAction() {
        super();
    }

    /**
     * Gestisce un HookForward di ritorno da un risultato di una ricerca (SelezionatoreBP)
     *
     * @param context ActionContext in uso.
     * @return Forward
     */
    public Forward doAnnullaRiportaSelezione(ActionContext context) {
        try {
            context.closeBusinessProcess();
            return context.findDefaultForward();
        } catch (Exception e) {
            return handleException(context, e);
        }
    }

    /**
     * Gestisce una richiesta di ricerca.
     * 

* L'implementazione di default utilizza il metodo astratto read * di CRUDBusinessProcess. * Se la ricerca fornisce più di un risultato viene creato un * nuovo SelezionatoreListaBP per la selezione di un elemento. * Al business process viene anche chiesto l'elenco delle colonne da * visualizzare. */ public Forward doCerca(ActionContext context) throws java.rmi.RemoteException, InstantiationException, javax.ejb.RemoveException { String setCol = null; try { fillModel(context); RicercaMandatoReversaleBP bp = (RicercaMandatoReversaleBP) getBusinessProcess(context); OggettoBulk model = bp.getModel(); it.cnr.jada.util.RemoteIterator ri = bp.find(context, null, model); if (ri == null || ri.countElements() == 0) { it.cnr.jada.util.ejb.EJBCommonServices.closeRemoteIterator(context, ri); bp.setMessage("Nessun mandato/reversale da inserire in distinta."); return context.findDefaultForward(); } else { // Mario - purtroppo sono costretto ad ottenere una referenza al bp padre del RicercaMandatoReversaleBP // supponiamo (senza controllo ulteriore) che questo bp sia figlio sempre di CRUDDistintaCassiereBP CRUDDistintaCassiereBP bpp = (CRUDDistintaCassiereBP) bp.getParent(); bp.setModel(context, model); if (bpp != null && bpp.isUoDistintaTuttaSac(context) && (Utility.createParametriCnrComponentSession().getParametriCnr(context.getUserContext(), it.cnr.contab.utenze00.bulk.CNRUserInfo.getEsercizio(context)).getFl_tesoreria_unica().booleanValue())) setCol = "elencoConUoFirmati"; else if (bpp != null && bpp.isUoDistintaTuttaSac(context)) setCol = "elencoConUo"; SelezionatoreListaBP nbp = selectMandatiInDistinta(context, ri, it.cnr.jada.bulk.BulkInfo.getBulkInfo(V_mandato_reversaleBulk.class), setCol, "doRiportaSelezione", null, bp); nbp.setMultiSelection(true); inserisciMandatiCORI(context, bp, bpp, nbp); context.addHookForward("annulla_seleziona", this, "doAnnullaRiportaSelezione"); return context.findDefaultForward(); } } catch (Throwable e) { return handleException(context, e); } } /** * Gestisce un HookForward di ritorno da un risultato di una ricerca (SelezionatoreBP) * * @param context ActionContext in uso. * @return Forward */ public Forward doRiportaSelezione(ActionContext context) { try { BusinessProcess bp = this.getBusinessProcess(context); HookForward caller = (HookForward) context.getCaller(); context.closeBusinessProcess(); HookForward forward = (HookForward) context.findForward("bringback"); return forward; } catch (Exception e) { return handleException(context, e); } } public SelezionatoreListaBP selectMandatiInDistinta(ActionContext actioncontext, RemoteIterator remoteiterator, BulkInfo bulkinfo, String s, String s1, ObjectReplacer objectreplacer, SelectionListener selectionlistener) throws BusinessProcessException { try { SelezionatoreListaBP selezionatorelistabp = (SelezionatoreListaBP) actioncontext.createBusinessProcess("SelezionatoreMandatiInDistintaBP"); selezionatorelistabp.setObjectReplacer(objectreplacer); selezionatorelistabp.setSelectionListener(actioncontext, selectionlistener); selezionatorelistabp.setIterator(actioncontext, remoteiterator); selezionatorelistabp.setBulkInfo(bulkinfo); selezionatorelistabp.setColumns(bulkinfo.getColumnFieldPropertyDictionary(s)); actioncontext.addHookForward("seleziona", this, s1); HookForward _tmp = (HookForward) actioncontext.findForward("seleziona"); actioncontext.addBusinessProcess(selezionatorelistabp); return selezionatorelistabp; } catch (RemoteException remoteexception) { throw new BusinessProcessException(remoteexception); } } public void inserisciMandatiCORI(ActionContext context, RicercaMandatoReversaleBP bp, CRUDDistintaCassiereBP bpp, SelezionatoreListaBP nbp) throws BusinessProcessException { bp.inserisciMandatiCORI(context, bp, bpp, nbp); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy