Search in sources :

Example 1 with CRUDComponentSession

use of it.cnr.jada.ejb.CRUDComponentSession in project sigla-main by consiglionazionaledellericerche.

the class ListaSospesiCNRPerCdsSelezionatoreBP method confermaMandato.

public void confermaMandato(UserContext userContext, MandatoBulk mandatoBulk, MandatoBulk mandatoNew) throws BusinessProcessException {
    final MandatoComponentSession mandatoComponentSession = Optional.ofNullable(createComponentSession("CNRDOCCONT00_EJB_MandatoComponentSession")).filter(MandatoComponentSession.class::isInstance).map(MandatoComponentSession.class::cast).orElseThrow(() -> new BusinessProcessException("Errore nella creazione dell'EJB CNRDOCCONT00_EJB_MandatoComponentSession"));
    try {
        mandatoBulk = Optional.ofNullable(mandatoComponentSession.inizializzaBulkPerModifica(userContext, mandatoBulk)).filter(MandatoBulk.class::isInstance).map(MandatoBulk.class::cast).orElseThrow(() -> new BusinessProcessException("Errore nella modifica del Mandato originario!"));
        mandatoBulk.setStatoVarSos(StatoVariazioneSostituzione.ANNULLATO_PER_SOSTITUZIONE.value());
        mandatoBulk.setFl_riemissione(Boolean.TRUE);
        mandatoBulk.setPg_mandato_riemissione(mandatoNew.getPg_mandato());
        mandatoComponentSession.annullaMandato(userContext, mandatoBulk, true);
        /**
         * Associo al nuovo mandato le reversali collegate se presenti
         */
        final BulkList<Ass_mandato_reversaleBulk> reversaliColl = mandatoBulk.getReversaliColl();
        reversaliColl.stream().filter(Ass_mandato_reversaleBulk.class::isInstance).map(Ass_mandato_reversaleBulk.class::cast).forEach(ass -> {
            try {
                mandatoComponentSession.creaAss_mandato_reversale(userContext, mandatoNew, new ReversaleBulk(ass.getCd_cds_reversale(), ass.getEsercizio_reversale(), ass.getPg_reversale()));
            } catch (ComponentException | RemoteException e) {
                throw new RuntimeException(e);
            }
        });
        final MandatoBulk mandatoBulk1 = Optional.ofNullable(mandatoComponentSession.inizializzaBulkPerModifica(userContext, mandatoNew)).filter(MandatoBulk.class::isInstance).map(MandatoBulk.class::cast).orElseThrow(() -> new BusinessProcessException("Errore nella modifica del nuovo Mandato!"));
        mandatoBulk1.setIm_ritenute(mandatoBulk.getIm_ritenute());
        mandatoBulk1.setToBeUpdated();
        ((CRUDComponentSession) createComponentSession("JADAEJB_CRUDComponentSession")).modificaConBulk(userContext, mandatoBulk1);
        commitUserTransaction();
    } catch (ComponentException | RemoteException e) {
        mandatoBulk.setStatoVarSos(null);
        rollbackUserTransaction();
        throw handleException(e);
    }
}
Also used : ReversaleBulk(it.cnr.contab.doccont00.core.bulk.ReversaleBulk) MandatoBulk(it.cnr.contab.doccont00.core.bulk.MandatoBulk) MandatoComponentSession(it.cnr.contab.doccont00.ejb.MandatoComponentSession) ComponentException(it.cnr.jada.comp.ComponentException) CRUDComponentSession(it.cnr.jada.ejb.CRUDComponentSession) Ass_mandato_reversaleBulk(it.cnr.contab.doccont00.core.bulk.Ass_mandato_reversaleBulk) RemoteException(java.rmi.RemoteException) BusinessProcessException(it.cnr.jada.action.BusinessProcessException)

Example 2 with CRUDComponentSession

use of it.cnr.jada.ejb.CRUDComponentSession in project sigla-main by consiglionazionaledellericerche.

the class AnagraficoComponent method Popola_ecf.

public void Popola_ecf(UserContext userContext, Long prog_estrazione) throws ComponentException {
    try {
        EcfHome home = (EcfHome) getHome(userContext, EcfBulk.class, "ELENCO_CF", "none");
        SQLBuilder sql = home.createSQLBuilder();
        sql.addSQLClause("AND", "ESERCIZIO", sql.EQUALS, it.cnr.contab.utenze00.bp.CNRUserContext.getEsercizio(userContext));
        sql.openParenthesis("AND");
        sql.openParenthesis("AND");
        sql.addSQLClause("AND", " fr003001", sql.ISNOTNULL, null);
        sql.addSQLClause("AND", " cl002001", sql.ISNULL, null);
        sql.addSQLClause("AND", " cl003001", sql.ISNULL, null);
        sql.openParenthesis("AND");
        sql.addSQLClause("AND", " fr004001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr004002", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr005001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr006001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr007001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr008001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr009001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr009002", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr010001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr011001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr012001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", " fr013001", sql.NOT_EQUALS, 0);
        sql.closeParenthesis();
        sql.closeParenthesis();
        sql.openParenthesis("OR");
        sql.addSQLClause("AND", "cl003001", sql.ISNOTNULL, null);
        sql.addSQLClause("AND", "fr002001", sql.ISNULL, null);
        sql.addSQLClause("AND", "fr003001", sql.ISNULL, null);
        sql.openParenthesis("AND");
        sql.addSQLClause("AND", "cl004001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", "cl004002", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", "cl005001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", "cl006001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", "cl007001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", "cl008001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", "cl008002", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", "cl009001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", "cl010001", sql.NOT_EQUALS, 0);
        sql.addSQLClause("OR", "cl011001", sql.NOT_EQUALS, 0);
        sql.closeParenthesis();
        sql.closeParenthesis();
        sql.closeParenthesis();
        sql.addOrderBy("ESERCIZIO,CL002001,CL003001,FR002001,FR003001,PROG");
        List lista_ecf = home.fetchAll(sql);
        for (Iterator i = lista_ecf.iterator(); i.hasNext(); ) {
            EcfBulk ecf = (EcfBulk) i.next();
            EcfBulk new_ecf = new EcfBulk();
            new_ecf.setEsercizio(ecf.getEsercizio());
            new_ecf.setProg_estrazione(prog_estrazione);
            new_ecf.setCl002001(ecf.getCl002001());
            new_ecf.setCl003001(ecf.getCl003001());
            new_ecf.setCl004001(ecf.getCl004001());
            new_ecf.setCl004002(ecf.getCl004002());
            new_ecf.setCl005001(ecf.getCl005001());
            new_ecf.setCl006001(ecf.getCl006001());
            new_ecf.setCl007001(ecf.getCl007001());
            new_ecf.setCl008001(ecf.getCl008001());
            new_ecf.setCl008002(ecf.getCl008002());
            new_ecf.setCl009001(ecf.getCl009001());
            new_ecf.setCl010001(ecf.getCl010001());
            new_ecf.setCl011001(ecf.getCl011001());
            new_ecf.setFr002001(ecf.getFr002001());
            new_ecf.setFr003001(ecf.getFr003001());
            new_ecf.setFr004001(ecf.getFr004001());
            new_ecf.setFr004002(ecf.getFr004002());
            new_ecf.setFr005001(ecf.getFr005001());
            new_ecf.setFr006001(ecf.getFr006001());
            new_ecf.setFr007001(ecf.getFr007001());
            new_ecf.setFr008001(ecf.getFr008001());
            new_ecf.setFr009001(ecf.getFr009001());
            new_ecf.setFr009002(ecf.getFr009002());
            new_ecf.setFr010001(ecf.getFr010001());
            new_ecf.setFr011001(ecf.getFr011001());
            new_ecf.setFr012001(ecf.getFr012001());
            new_ecf.setFr013001(ecf.getFr013001());
            new_ecf.setToBeCreated();
            ((CRUDComponentSession) it.cnr.jada.util.ejb.EJBCommonServices.createEJB("JADAEJB_CRUDComponentSession", it.cnr.jada.ejb.CRUDComponentSession.class)).creaConBulk(userContext, new_ecf);
        }
    } catch (PersistencyException e) {
        handleException(e);
    } catch (RemoteException e) {
        handleException(e);
    } catch (EJBException e) {
        handleException(e);
    }
}
Also used : EcfBulk(it.cnr.contab.anagraf00.tabrif.bulk.EcfBulk) PersistencyException(it.cnr.jada.persistency.PersistencyException) EcfHome(it.cnr.contab.anagraf00.tabrif.bulk.EcfHome) CRUDComponentSession(it.cnr.jada.ejb.CRUDComponentSession) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException)

Example 3 with CRUDComponentSession

use of it.cnr.jada.ejb.CRUDComponentSession in project sigla-main by consiglionazionaledellericerche.

the class Liquid_coriComponent method Popola_f24Tot.

public void Popola_f24Tot(UserContext userContext, Liquid_coriBulk liquidazione) throws ComponentException {
    try {
        if (liquidazione != null && liquidazione.getPg_liquidazione() != null) {
            F24ep_tempTotHome home = (F24ep_tempTotHome) getHome(userContext, F24ep_tempTotBulk.class);
            SQLBuilder sql = home.createSQLBuilder();
            sql.addSQLClause("AND", "ESERCIZIO", sql.EQUALS, it.cnr.contab.utenze00.bp.CNRUserContext.getEsercizio(userContext));
            sql.addSQLClause("AND", "cd_cds", sql.EQUALS, liquidazione.getCd_cds());
            sql.addSQLClause("AND", "cd_unita_organizzativa", sql.EQUALS, liquidazione.getCd_unita_organizzativa());
            sql.addSQLClause("AND", "pg_liquidazione", sql.EQUALS, liquidazione.getPg_liquidazione());
            sql.addOrderBy("PROG");
            List lista = home.fetchAll(sql);
            for (Iterator i = lista.iterator(); i.hasNext(); ) {
                F24ep_tempTotBulk F24ep_temp = (F24ep_tempTotBulk) i.next();
                F24ep_temp.setToBeDeleted();
                ((CRUDComponentSession) it.cnr.jada.util.ejb.EJBCommonServices.createEJB("JADAEJB_CRUDComponentSession", it.cnr.jada.ejb.CRUDComponentSession.class)).eliminaConBulk(userContext, F24ep_temp);
            }
        }
        List lista;
        F24ep_tempTotHome home = (F24ep_tempTotHome) getHome(userContext, F24ep_tempTotBulk.class);
        SQLBuilder sql = home.createSQLBuilder();
        home = (F24ep_tempTotHome) getHome(userContext, F24ep_tempTotBulk.class, "V_F24EP", "none");
        sql = home.createSQLBuilder();
        sql.addSQLClause("AND", "ESERCIZIO", sql.EQUALS, it.cnr.contab.utenze00.bp.CNRUserContext.getEsercizio(userContext));
        sql.addSQLClause("AND", "cd_cds", sql.EQUALS, liquidazione.getCd_cds());
        sql.addSQLClause("AND", "cd_unita_organizzativa", sql.EQUALS, liquidazione.getCd_unita_organizzativa());
        sql.addSQLClause("AND", "pg_liquidazione", sql.EQUALS, liquidazione.getPg_liquidazione());
        sql.addOrderBy(" tipo_riga_f24,codice_tributo,codice_ente,mese_rif,anno_rif,esercizio,cd_cds,cd_unita_organizzativa,pg_liquidazione,cd_matricola_inps,periodo_da,periodo_a");
        lista = home.fetchAll(sql);
        for (Iterator i = lista.iterator(); i.hasNext(); ) {
            F24ep_tempTotBulk F24ep_temp = (F24ep_tempTotBulk) i.next();
            F24ep_tempTotBulk new_F24ep_temp = new F24ep_tempTotBulk();
            new_F24ep_temp.setTipo_riga_f24(F24ep_temp.getTipo_riga_f24());
            new_F24ep_temp.setEsercizio(F24ep_temp.getEsercizio());
            new_F24ep_temp.setAnno_rif(F24ep_temp.getAnno_rif());
            new_F24ep_temp.setMese_rif(F24ep_temp.getMese_rif());
            new_F24ep_temp.setCd_cds(F24ep_temp.getCd_cds());
            new_F24ep_temp.setCd_unita_organizzativa(F24ep_temp.getCd_unita_organizzativa());
            new_F24ep_temp.setCodice_ente(F24ep_temp.getCodice_ente());
            new_F24ep_temp.setCodice_tributo(F24ep_temp.getCodice_tributo());
            new_F24ep_temp.setImporto_debito(F24ep_temp.getImporto_debito());
            new_F24ep_temp.setPg_liquidazione(F24ep_temp.getPg_liquidazione());
            new_F24ep_temp.setCd_matricola_inps(F24ep_temp.getCd_matricola_inps());
            new_F24ep_temp.setPeriodo_da(F24ep_temp.getPeriodo_da());
            new_F24ep_temp.setPeriodo_a(F24ep_temp.getPeriodo_a());
            new_F24ep_temp.setToBeCreated();
            ((CRUDComponentSession) it.cnr.jada.util.ejb.EJBCommonServices.createEJB("JADAEJB_CRUDComponentSession", it.cnr.jada.ejb.CRUDComponentSession.class)).creaConBulk(userContext, new_F24ep_temp);
        }
    } catch (PersistencyException e) {
        handleException(e);
    } catch (EJBException e) {
        handleException(e);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : SQLBuilder(it.cnr.jada.persistency.sql.SQLBuilder) RemoteIterator(it.cnr.jada.util.RemoteIterator) Iterator(java.util.Iterator) PersistencyException(it.cnr.jada.persistency.PersistencyException) SimpleBulkList(it.cnr.jada.bulk.SimpleBulkList) BulkList(it.cnr.jada.bulk.BulkList) List(java.util.List) CRUDComponentSession(it.cnr.jada.ejb.CRUDComponentSession) EJBException(javax.ejb.EJBException) RemoteException(java.rmi.RemoteException)

Example 4 with CRUDComponentSession

use of it.cnr.jada.ejb.CRUDComponentSession in project sigla-main by consiglionazionaledellericerche.

the class Liquid_coriComponent method Popola_f24.

public void Popola_f24(UserContext userContext, Liquid_coriBulk liquidazione) throws ComponentException {
    try {
        // Elimina pendenti con la stessa liquidazione
        F24ep_tempHome home = (F24ep_tempHome) getHome(userContext, F24ep_tempBulk.class);
        SQLBuilder sql = home.createSQLBuilder();
        sql.addSQLClause("AND", "ESERCIZIO", sql.EQUALS, it.cnr.contab.utenze00.bp.CNRUserContext.getEsercizio(userContext));
        sql.addSQLClause("AND", "cd_cds", sql.EQUALS, liquidazione.getCd_cds());
        sql.addSQLClause("AND", "cd_unita_organizzativa", sql.EQUALS, liquidazione.getCd_unita_organizzativa());
        sql.addSQLClause("AND", "pg_liquidazione", sql.EQUALS, liquidazione.getPg_liquidazione());
        sql.addOrderBy("PROG");
        List lista = home.fetchAll(sql);
        for (Iterator i = lista.iterator(); i.hasNext(); ) {
            F24ep_tempBulk F24ep_temp = (F24ep_tempBulk) i.next();
            F24ep_temp.setToBeDeleted();
            ((CRUDComponentSession) it.cnr.jada.util.ejb.EJBCommonServices.createEJB("JADAEJB_CRUDComponentSession", it.cnr.jada.ejb.CRUDComponentSession.class)).eliminaConBulk(userContext, F24ep_temp);
        }
        home = (F24ep_tempHome) getHome(userContext, F24ep_tempBulk.class, "V_F24EP", "none");
        sql = home.createSQLBuilder();
        sql.addSQLClause("AND", "ESERCIZIO", sql.EQUALS, it.cnr.contab.utenze00.bp.CNRUserContext.getEsercizio(userContext));
        sql.addSQLClause("AND", "cd_cds", sql.EQUALS, liquidazione.getCd_cds());
        sql.addSQLClause("AND", "cd_unita_organizzativa", sql.EQUALS, liquidazione.getCd_unita_organizzativa());
        sql.addSQLClause("AND", "pg_liquidazione", sql.EQUALS, liquidazione.getPg_liquidazione());
        sql.addOrderBy("PROG");
        lista = home.fetchAll(sql);
        for (Iterator i = lista.iterator(); i.hasNext(); ) {
            F24ep_tempBulk F24ep_temp = (F24ep_tempBulk) i.next();
            F24ep_tempBulk new_F24ep_temp = new F24ep_tempBulk();
            new_F24ep_temp.setEsercizio(F24ep_temp.getEsercizio());
            new_F24ep_temp.setAnno_rif(F24ep_temp.getAnno_rif());
            new_F24ep_temp.setMese_rif(F24ep_temp.getMese_rif());
            new_F24ep_temp.setCd_cds(F24ep_temp.getCd_cds());
            new_F24ep_temp.setCd_unita_organizzativa(F24ep_temp.getCd_unita_organizzativa());
            new_F24ep_temp.setCodice_ente(F24ep_temp.getCodice_ente());
            new_F24ep_temp.setCodice_tributo(F24ep_temp.getCodice_tributo());
            new_F24ep_temp.setImporto_debito(F24ep_temp.getImporto_debito());
            new_F24ep_temp.setPg_liquidazione(F24ep_temp.getPg_liquidazione());
            new_F24ep_temp.setToBeCreated();
            ((CRUDComponentSession) it.cnr.jada.util.ejb.EJBCommonServices.createEJB("JADAEJB_CRUDComponentSession", it.cnr.jada.ejb.CRUDComponentSession.class)).creaConBulk(userContext, new_F24ep_temp);
        }
    } catch (PersistencyException e) {
        handleException(e);
    } catch (RemoteException e) {
        handleException(e);
    } catch (EJBException e) {
        handleException(e);
    }
}
Also used : SQLBuilder(it.cnr.jada.persistency.sql.SQLBuilder) RemoteIterator(it.cnr.jada.util.RemoteIterator) Iterator(java.util.Iterator) PersistencyException(it.cnr.jada.persistency.PersistencyException) SimpleBulkList(it.cnr.jada.bulk.SimpleBulkList) BulkList(it.cnr.jada.bulk.BulkList) List(java.util.List) CRUDComponentSession(it.cnr.jada.ejb.CRUDComponentSession) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException)

Example 5 with CRUDComponentSession

use of it.cnr.jada.ejb.CRUDComponentSession in project sigla-main by consiglionazionaledellericerche.

the class TestataProgettiRicercaBP method initializeModelForEditAllegati.

@Override
public OggettoBulk initializeModelForEditAllegati(ActionContext actioncontext, OggettoBulk oggettobulk) throws BusinessProcessException {
    ProgettoBulk progetto = this.innerInitializeModelForEditAllegati(actioncontext, (ProgettoBulk) oggettobulk, ((ProgettoBulk) oggettobulk).getCd_unita_organizzativa());
    CRUDComponentSession session = createComponentSession();
    if (!(session instanceof ProgettoRicercaPadreComponentSession)) {
        try {
            List<ProgettoBulk> progettifigli = ((ProgettoRicercaComponentSession) session).getAllChildren(actioncontext.getUserContext(), progetto);
            List<String> cdUoList = Optional.ofNullable(progettifigli).map(List::stream).orElse(Stream.empty()).map(ProgettoBulk::getCd_unita_organizzativa).distinct().collect(Collectors.toList());
            for (Iterator i = cdUoList.iterator(); i.hasNext(); ) {
                String cdUnitaOrganizzativa = (String) i.next();
                if (!cdUnitaOrganizzativa.equals(progetto.getCd_unita_organizzativa()))
                    progetto = (ProgettoBulk) this.innerInitializeModelForEditAllegati(actioncontext, progetto, cdUnitaOrganizzativa);
            }
        } catch (ComponentException | RemoteException e) {
            throw handleException(e);
        }
    }
    return progetto;
}
Also used : ProgettoRicercaComponentSession(it.cnr.contab.progettiric00.ejb.ProgettoRicercaComponentSession) RemoteIterator(it.cnr.jada.util.RemoteIterator) Iterator(java.util.Iterator) ComponentException(it.cnr.jada.comp.ComponentException) CRUDComponentSession(it.cnr.jada.ejb.CRUDComponentSession) BulkList(it.cnr.jada.bulk.BulkList) List(java.util.List) RemoteException(java.rmi.RemoteException) ProgettoRicercaPadreComponentSession(it.cnr.contab.progettiric00.ejb.ProgettoRicercaPadreComponentSession)

Aggregations

CRUDComponentSession (it.cnr.jada.ejb.CRUDComponentSession)8 RemoteException (java.rmi.RemoteException)7 PersistencyException (it.cnr.jada.persistency.PersistencyException)5 EJBException (javax.ejb.EJBException)5 BulkList (it.cnr.jada.bulk.BulkList)4 RemoteIterator (it.cnr.jada.util.RemoteIterator)4 Iterator (java.util.Iterator)4 List (java.util.List)4 SimpleBulkList (it.cnr.jada.bulk.SimpleBulkList)3 ComponentException (it.cnr.jada.comp.ComponentException)3 SQLBuilder (it.cnr.jada.persistency.sql.SQLBuilder)3 ApplicationException (it.cnr.jada.comp.ApplicationException)2 EcfBulk (it.cnr.contab.anagraf00.tabrif.bulk.EcfBulk)1 EcfHome (it.cnr.contab.anagraf00.tabrif.bulk.EcfHome)1 Ass_mandato_reversaleBulk (it.cnr.contab.doccont00.core.bulk.Ass_mandato_reversaleBulk)1 MandatoBulk (it.cnr.contab.doccont00.core.bulk.MandatoBulk)1 ReversaleBulk (it.cnr.contab.doccont00.core.bulk.ReversaleBulk)1 MandatoComponentSession (it.cnr.contab.doccont00.ejb.MandatoComponentSession)1 it.cnr.contab.doccont00.intcass.giornaliera (it.cnr.contab.doccont00.intcass.giornaliera)1 InformazioniContoEvidenza (it.cnr.contab.doccont00.intcass.giornaliera.FlussoGiornaleDiCassa.InformazioniContoEvidenza)1