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);
}
}
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);
}
}
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();
}
}
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);
}
}
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;
}
Aggregations