Skip to content

Commit

Permalink
Aggiornamenti vari
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaelepagano committed Apr 12, 2017
1 parent 87b4853 commit 1230a00
Show file tree
Hide file tree
Showing 43 changed files with 1,263 additions and 308 deletions.
Expand Up @@ -7,7 +7,6 @@
import it.cnr.contab.config00.sto.bulk.CdrBulk;
import it.cnr.contab.prevent01.bulk.Pdg_programmaBulk;
import it.cnr.contab.progettiric00.core.bulk.ProgettoBulk;
import it.cnr.contab.utenze00.bp.CNRUserContext;
import it.cnr.jada.action.ActionContext;
import it.cnr.jada.action.Forward;
import it.cnr.jada.action.MessageToUser;
Expand Down Expand Up @@ -479,13 +478,13 @@ public it.cnr.jada.action.Forward doBringBackSearchFind_nodo_padre_2016(ActionCo
}
if (linea!=null && linea.getPdgProgramma()!=null && linea.getPdgProgramma().getCd_programma()!=null &&
progetto!=null && progetto.getProgettopadre()!=null &&
!linea.getPdgProgramma().getCd_programma().equals(progetto.getProgettopadre().getCd_dipartimento())) {
!linea.getPdgProgramma().getCd_programma().equals(progetto.getProgettopadre().getCd_programma())) {
setErrorMessage(context,"Attenzione: il progetto, appartenente al dipartimento con codice "+progetto.getProgettopadre().getCd_dipartimento()+
" non è coerente con il programma indicato sulla GAE!");
return context.findDefaultForward();
} else if (linea!=null && (linea.getPdgProgramma()==null || linea.getPdgProgramma().getCd_programma()==null) &&
progetto!=null && progetto.getProgettopadre()!=null && progetto.getProgettopadre().getCd_dipartimento()!=null) {
linea.setPdgProgramma((Pdg_programmaBulk)bp.createComponentSession().findByPrimaryKey(context.getUserContext(), new Pdg_programmaBulk(progetto.getProgettopadre().getCd_dipartimento())));
progetto!=null && progetto.getProgettopadre()!=null && progetto.getProgettopadre().getPdgProgramma()!=null) {
linea.setPdgProgramma((Pdg_programmaBulk)bp.createComponentSession().findByPrimaryKey(context.getUserContext(), progetto.getProgettopadre().getPdgProgramma()));
}
linea.setProgetto2016(progetto);
return context.findDefaultForward();
Expand Down
Expand Up @@ -5,6 +5,7 @@

import it.cnr.contab.config00.blob.bulk.PostItBulk;
import it.cnr.contab.config00.bulk.Parametri_cnrBulk;
import it.cnr.contab.config00.bulk.Parametri_enteBulk;
import it.cnr.contab.config00.latt.bulk.WorkpackageBulk;
import it.cnr.contab.config00.sto.bulk.Unita_organizzativaBulk;
import it.cnr.contab.prevent01.bulk.Pdg_moduloBulk;
Expand Down Expand Up @@ -98,7 +99,9 @@ protected void initialize(ActionContext actioncontext) throws BusinessProcessExc
setEsercizioScrivania(it.cnr.contab.utenze00.bulk.CNRUserInfo.getEsercizio(actioncontext));
Parametri_cnrBulk parCnr = Utility.createParametriCnrComponentSession().getParametriCnr(actioncontext.getUserContext(), CNRUserContext.getEsercizio(actioncontext.getUserContext()));
setFlNuovoPdg(parCnr.getFl_nuovo_pdg().booleanValue());
aggiornaGECO(actioncontext.getUserContext());
Parametri_enteBulk parEnte = Utility.createParametriEnteComponentSession().getParametriEnte(actioncontext.getUserContext());
if (parEnte.getFl_informix())
aggiornaGECO(actioncontext.getUserContext());
super.initialize(actioncontext);
} catch (ComponentException e) {
throw new BusinessProcessException(e);
Expand Down
@@ -1,7 +1,6 @@
package it.cnr.contab.config00.bulk;

import java.math.BigDecimal;
import java.util.Date;

import it.cnr.jada.persistency.Keyed;

Expand Down Expand Up @@ -46,6 +45,7 @@ public class Parametri_cnrBase extends Parametri_cnrKey implements Keyed {
private String clausolaOrdine;
private java.sql.Timestamp data_stipula_contratti;
private Boolean fl_nuovo_pdg;
private Boolean fl_pdg_codlast;
private java.sql.Timestamp data_attivazione_new_voce;

private Boolean fl_tesoreria_unica;
Expand Down Expand Up @@ -326,5 +326,13 @@ public void setData_attivazione_new_voce(java.sql.Timestamp data_attivazione_new
}
public void setFl_tesoreria_unica(Boolean fl_tesoreria_unica) {
this.fl_tesoreria_unica = fl_tesoreria_unica;
}
}

public Boolean getFl_pdg_codlast() {
return fl_pdg_codlast;
}

public void setFl_pdg_codlast(Boolean fl_pdg_codlast) {
this.fl_pdg_codlast = fl_pdg_codlast;
}
}
Expand Up @@ -29,6 +29,9 @@ public class Parametri_enteBase extends Parametri_enteKey implements Keyed{
// FL_AUTENTICAZIONE_LDAP CHAR(1)
private java.lang.Boolean fl_autenticazione_ldap;

// FL_INFORMIX CHAR(1)
private java.lang.Boolean fl_informix;

private java.lang.String ldap_user;

private java.lang.String ldap_password;
Expand Down Expand Up @@ -202,4 +205,12 @@ public void setLdap_link_cambio_password(
java.lang.String ldap_link_cambio_password) {
this.ldap_link_cambio_password = ldap_link_cambio_password;
}

public java.lang.Boolean getFl_informix() {
return fl_informix;
}

public void setFl_informix(java.lang.Boolean fl_informix) {
this.fl_informix = fl_informix;
}
}
@@ -1,21 +1,24 @@
package it.cnr.contab.config00.bulk;

import it.cnr.jada.bulk.*;
import it.cnr.jada.persistency.*;
import it.cnr.jada.persistency.sql.*;


import java.sql.Connection;
import java.sql.SQLException;

import it.cnr.jada.bulk.BulkHome;
import it.cnr.jada.bulk.OggettoBulk;
import it.cnr.jada.persistency.PersistencyException;
import it.cnr.jada.persistency.PersistentCache;
import it.cnr.jada.persistency.sql.FindClause;
import it.cnr.jada.persistency.sql.SQLBuilder;
import it.cnr.jada.persistency.sql.SQLExceptionHandler;

/**
* @author aimprota
*/
public class Parametri_enteHome extends BulkHome
{
//Parametri_enteBulk parametri;
private static final long serialVersionUID = 1L;

/**
/**
* @param class1
* @param connection
*/
Expand All @@ -38,30 +41,39 @@ public Parametri_enteHome(Connection connection, PersistentCache persistentcache
* @param par_ent Parametri Ente
*/

public void initializePrimaryKeyForInsert(it.cnr.jada.UserContext userContext,OggettoBulk par_ent) throws PersistencyException {
public void initializePrimaryKeyForInsert(it.cnr.jada.UserContext userContext,OggettoBulk parEnte) throws PersistencyException {
try {
((Parametri_enteBulk)par_ent).setId(new Integer( ((Integer)findAndLockMax( par_ent, "id", new Integer(0) )).intValue()+1 ));
((Parametri_enteBulk)parEnte).setId(new Integer( ((Integer)findAndLockMax( parEnte, "id", new Integer(0) )).intValue()+1 ));
} catch(it.cnr.jada.bulk.BusyResourceException e) {
throw new PersistencyException(e);
}
}

/**
* Ritorna un SQLBuilder con la columnMap del ricevente
*/
public SQLBuilder selectRigaAttiva() {
SQLBuilder sql = createSQLBuilder();
sql.addSQLClause("AND", "ATTIVO", sql.EQUALS, "Y");
sql.addClause(FindClause.AND, "attivo", SQLBuilder.EQUALS, Boolean.TRUE);
return sql;
}

public int contaRigheAttive(it.cnr.jada.UserContext userContext) throws IntrospectionException, PersistencyException {
public int contaRigheAttive(it.cnr.jada.UserContext userContext) throws PersistencyException {
try{
PersistentHome dettHome = getHomeCache().getHome(Parametri_enteBulk.class);
SQLBuilder sql = dettHome.createSQLBuilder();
sql.addClause("AND", "ATTIVO", sql.EQUALS, "Y");
return(sql.executeCountQuery(getConnection()));
return selectRigaAttiva().executeCountQuery(getConnection());
}catch(SQLException sqlException){
throw SQLExceptionHandler.getInstance().handleSQLException(sqlException);
}
}

public Parametri_enteBulk getParametriEnteAttiva() throws PersistencyException{
return (Parametri_enteBulk) this.fetchAll(selectRigaAttiva()).get(0);
}

public boolean isInformixAttivo() throws PersistencyException{
Parametri_enteBulk parente = getParametriEnteAttiva();
if (parente!=null)
return parente.getFl_informix();
return true;
}
}
Expand Up @@ -172,15 +172,15 @@ public it.cnr.jada.bulk.OggettoBulk creaConBulk(it.cnr.jada.UserContext uc, it.c
throw new ApplicationException( "La Commessa sul GAE non può essere nulla.");
if (latt!=null && latt.getModulo2015()!=null &&
latt.getModulo2015().getProgettopadre()!=null && latt.getModulo2015().getProgettopadre().getProgettopadre()!=null)
cdProgramma = latt.getModulo2015().getProgettopadre().getProgettopadre().getCd_dipartimento();
cdProgramma = latt.getModulo2015().getProgettopadre().getProgettopadre().getCd_programma();
}
if (parCnr.getFl_nuovo_pdg()) {
if (latt.getProgetto2016() == null ||(latt.getProgetto2016() != null && latt.getProgetto2016().getPg_progetto() == null))
throw new ApplicationException( "Il Progetto sul GAE non può essere nullo. " );
if (latt!=null && latt.getProgetto2016()!=null && latt.getProgetto2016().getProgettopadre()!=null)
if (cdProgramma != null && !cdProgramma.equals(latt.getProgetto2016().getProgettopadre().getCd_dipartimento()))
throw new ApplicationException( "Il Codice Dipartimento del Modulo di attività ("+cdProgramma+") non può essere differente da quello del Progetto ("+latt.getProgetto2016().getProgettopadre().getCd_dipartimento()+")." );
cdProgramma = latt.getProgetto2016().getProgettopadre().getCd_dipartimento();
if (cdProgramma != null && !cdProgramma.equals(latt.getProgetto2016().getProgettopadre().getCd_programma()))
throw new ApplicationException( "Il Codice Dipartimento del Modulo di attività ("+cdProgramma+") non può essere differente da quello del Progetto ("+latt.getProgetto2016().getProgettopadre().getCd_programma()+")." );
cdProgramma = latt.getProgetto2016().getProgettopadre().getCd_programma();
}
if (cdProgramma!=null) {
if (latt.getPdgProgramma()!=null && !cdProgramma.equals(latt.getPdgProgramma().getCd_programma()))
Expand Down Expand Up @@ -609,12 +609,13 @@ public WorkpackageBulk inizializzaNature(UserContext userContext,WorkpackageBulk
try {
NaturaHome home = (NaturaHome)getHome(userContext,NaturaBulk.class);
SQLBuilder sql = home.createSQLBuilder();
if (linea_attivita.getTi_gestione() != null){
if (linea_attivita.getTi_gestione().equals(linea_attivita.TI_GESTIONE_SPESE))
sql.addSQLClause("AND","FL_SPESA",sql.EQUALS,"Y");
else if (linea_attivita.getTi_gestione().equals(linea_attivita.TI_GESTIONE_ENTRATE))
sql.addSQLClause("AND","FL_ENTRATA",sql.EQUALS,"Y");

if (linea_attivita.TI_GESTIONE_SPESE.equals(linea_attivita.getTi_gestione()))
sql.addSQLClause("AND","FL_SPESA",sql.EQUALS,"Y");
else if (linea_attivita.TI_GESTIONE_ENTRATE.equals(linea_attivita.getTi_gestione()))
sql.addSQLClause("AND","FL_ENTRATA",sql.EQUALS,"Y");
else if (linea_attivita.getTi_gestione().equals(linea_attivita.TI_GESTIONE_ENTRAMBE)) {
sql.addSQLClause("AND","FL_SPESA",sql.EQUALS,"Y");
sql.addSQLClause("AND","FL_ENTRATA",sql.EQUALS,"Y");
}
Broker broker = home.createBroker(sql);
linea_attivita.setNature(home.fetchAll(broker));
Expand Down Expand Up @@ -945,7 +946,7 @@ public SQLBuilder selectProgetto2016ByClause (UserContext userContext,
sql.addSQLJoin("V_PROGETTO_PADRE.ESERCIZIO_PROGETTO_PADRE","PROGETTO_DIP.ESERCIZIO");
sql.addSQLJoin("V_PROGETTO_PADRE.PG_PROGETTO_PADRE","PROGETTO_DIP.PG_PROGETTO");
sql.addSQLJoin("V_PROGETTO_PADRE.TIPO_FASE_PROGETTO_PADRE","PROGETTO_DIP.TIPO_FASE");
sql.addSQLClause(FindClause.AND, "PROGETTO_DIP.CD_DIPARTIMENTO", SQLBuilder.EQUALS, linea_attivita.getPdgProgramma().getCd_programma());
sql.addSQLClause(FindClause.AND, "PROGETTO_DIP.CD_PROGRAMMA", SQLBuilder.EQUALS, linea_attivita.getPdgProgramma().getCd_programma());
}
return sql;
}
Expand Down
Expand Up @@ -6,12 +6,8 @@
*/
package it.cnr.contab.config00.comp;

import java.sql.SQLException;
import java.util.Calendar;


import it.cnr.contab.config00.bulk.Parametri_cnrBulk;
import it.cnr.contab.config00.bulk.Parametri_cnrHome;
import it.cnr.contab.config00.bulk.Parametri_enteBulk;
import it.cnr.contab.config00.bulk.Parametri_enteHome;
import it.cnr.contab.config00.bulk.ServizioPecBulk;
Expand All @@ -32,7 +28,7 @@
import it.cnr.jada.comp.CRUDComponent;
import it.cnr.jada.comp.ComponentException;
import it.cnr.jada.persistency.Broker;
import it.cnr.jada.persistency.sql.*;
import it.cnr.jada.persistency.sql.SQLBuilder;

/**
* @author rpagano
Expand All @@ -42,6 +38,8 @@
*/
public class Parametri_enteComponent extends CRUDComponent {

private static final long serialVersionUID = 1L;

public OggettoBulk creaConBulk(UserContext userContext, OggettoBulk oggettobulk)
throws ComponentException
{
Expand Down Expand Up @@ -84,8 +82,8 @@ private void validaRiga(UserContext userContext, Parametri_enteBulk parametri_en
if(parametri_ente.getAttivo().booleanValue()) {
Parametri_enteHome testataHome = (Parametri_enteHome)getHome(userContext, Parametri_enteBulk.class);
SQLBuilder sql = testataHome.createSQLBuilder();
sql.addSQLClause("AND","ATTIVO",sql.EQUALS,"Y");
sql.addSQLClause("AND","ID",sql.NOT_EQUALS,parametri_ente.getId());
sql.addSQLClause("AND","ATTIVO",SQLBuilder.EQUALS,"Y");
sql.addSQLClause("AND","ID", SQLBuilder.NOT_EQUALS, parametri_ente.getId());

try {
totAttive = sql.executeCountQuery(testataHome.getConnection()) + 1;
Expand All @@ -104,18 +102,9 @@ private void validaRiga(UserContext userContext, Parametri_enteBulk parametri_en
}
public Parametri_enteBulk getParametriEnte(UserContext userContext) throws ComponentException{
try{
Parametri_enteHome testataHome = (Parametri_enteHome)getHome(userContext, Parametri_enteBulk.class);
SQLBuilder sql = testataHome.createSQLBuilder();
sql.addSQLClause("AND","ATTIVO",sql.EQUALS,"Y");

getHomeCache(userContext).fetchAll(userContext,testataHome);
Parametri_enteBulk ente = (Parametri_enteBulk) getHome(userContext, Parametri_enteBulk.class).fetchAll(sql).get(0);
return ente;

return ((Parametri_enteHome)getHome(userContext, Parametri_enteBulk.class)).getParametriEnteAttiva();
}catch(it.cnr.jada.persistency.PersistencyException ex){
throw handleException(ex);
} catch (Exception ex) {
throw handleException(ex);
}
}
/**
Expand All @@ -128,7 +117,7 @@ public int getGiorniRimanenti(UserContext userContext) throws ComponentException
try{
Parametri_enteHome testataHome = (Parametri_enteHome)getHome(userContext, Parametri_enteBulk.class);
SQLBuilder sql = testataHome.createSQLBuilder();
sql.addSQLClause("AND","ATTIVO",sql.EQUALS,"Y");
sql.addSQLClause("AND","ATTIVO",SQLBuilder.EQUALS,"Y");

getHomeCache(userContext).fetchAll(userContext,testataHome);
Parametri_enteBulk ente = (Parametri_enteBulk) getHome(userContext, Parametri_enteBulk.class).fetchAll(sql).get(0);
Expand Down
Expand Up @@ -30,12 +30,15 @@ public class WorkpackageBulk extends WorkpackageBase implements CostantiTi_gesti
private BulkList risultati;
private BulkList dettagliPostIt = new BulkList();

public final static String TI_GESTIONE_ENTRAMBE = "X" ;

private final static java.util.Dictionary ti_gestioneKeys;

static {
ti_gestioneKeys = new it.cnr.jada.util.OrderedHashtable();
ti_gestioneKeys.put(TI_GESTIONE_SPESE, "Spese");
ti_gestioneKeys.put(TI_GESTIONE_ENTRATE, "Entrate");
ti_gestioneKeys.put(TI_GESTIONE_ENTRAMBE, "Entrambe");
}
private Insieme_laBulk insieme_la;

Expand Down
Expand Up @@ -1327,6 +1327,12 @@ public AccertamentoBulk refreshNuoveLineeAttivitaColl( AccertamentoBulk accertam

public java.util.List findCapitoliDiEntrataCds( AccertamentoBulk accertamento ) throws IntrospectionException,PersistencyException
{
PersistentHome parCNRHome = getHomeCache().getHome(Parametri_cnrBulk.class);
Parametri_cnrBulk parCNR = (Parametri_cnrBulk)parCNRHome.findByPrimaryKey(new Parametri_cnrBulk(accertamento.getEsercizio()));

if (parCNR.getFl_nuovo_pdg())
return Arrays.asList(accertamento.getCapitolo());

PersistentHome evHome = getHomeCache().getHome(Voce_fBulk.class);
SQLBuilder sql = evHome.createSQLBuilder();
sql.addClause("AND","esercizio",sql.EQUALS, accertamento.getEsercizio());
Expand Down
Expand Up @@ -25,6 +25,7 @@
import it.cnr.jada.comp.ComponentException;
import it.cnr.jada.persistency.PersistencyException;
import it.cnr.jada.persistency.sql.CompoundFindClause;
import it.cnr.jada.persistency.sql.FindClause;
import it.cnr.jada.persistency.sql.LoggableStatement;
import it.cnr.jada.persistency.sql.SQLBuilder;

Expand Down Expand Up @@ -172,7 +173,11 @@ public SQLBuilder selectLinea_attivitaByClause (UserContext userContext,
sql.addClause("AND","cd_centro_responsabilita",sql.EQUALS,dett.getCd_cdr_assegnatario());
sql.addClause("AND","pg_progetto",sql.EQUALS,dett.getPg_progetto());
sql.addClause("AND","cd_natura",sql.EQUALS,dett.getCd_natura());
sql.addClause("AND","ti_gestione",sql.EQUALS,Elemento_voceHome.GESTIONE_ENTRATE);

sql.openParenthesis(FindClause.AND);
sql.addClause(FindClause.OR,"ti_gestione",SQLBuilder.EQUALS,WorkpackageBulk.TI_GESTIONE_ENTRATE);
sql.addClause(FindClause.OR,"ti_gestione",SQLBuilder.EQUALS,WorkpackageBulk.TI_GESTIONE_ENTRAMBE);
sql.closeParenthesis();

Parametri_cnrHome parCnrhome = (Parametri_cnrHome)getHome(userContext, Parametri_cnrBulk.class);
Parametri_cnrBulk parCnrBulk = (Parametri_cnrBulk)parCnrhome.findByPrimaryKey(new Parametri_cnrBulk(it.cnr.contab.utenze00.bp.CNRUserContext.getEsercizio( userContext )));
Expand Down
Expand Up @@ -13,6 +13,7 @@
import it.cnr.contab.config00.latt.bulk.WorkpackageHome;
import it.cnr.contab.config00.pdcfin.bulk.Elemento_voceBulk;
import it.cnr.contab.config00.pdcfin.bulk.Elemento_voceHome;
import it.cnr.contab.doccont00.core.bulk.Linea_attivitaBulk;
import it.cnr.contab.pdg01.bulk.Pdg_modulo_spese_gestBulk;
import it.cnr.contab.prevent01.bulk.Pdg_modulo_speseBulk;
import it.cnr.contab.prevent01.bulk.Pdg_modulo_speseHome;
Expand All @@ -27,6 +28,7 @@
import it.cnr.jada.comp.ComponentException;
import it.cnr.jada.persistency.PersistencyException;
import it.cnr.jada.persistency.sql.CompoundFindClause;
import it.cnr.jada.persistency.sql.FindClause;
import it.cnr.jada.persistency.sql.LoggableStatement;
import it.cnr.jada.persistency.sql.SQLBuilder;

Expand Down Expand Up @@ -178,7 +180,11 @@ public SQLBuilder selectLinea_attivitaByClause (UserContext userContext,
sql.addSQLClause("AND","V_LINEA_ATTIVITA_VALIDA.ESERCIZIO",sql.EQUALS,CNRUserContext.getEsercizio(userContext));
sql.addClause("AND","cd_centro_responsabilita",sql.EQUALS,dett.getCd_cdr_assegnatario());
sql.addClause("AND","pg_progetto",sql.EQUALS,dett.getPg_progetto());
sql.addClause("AND","ti_gestione",sql.EQUALS,Elemento_voceHome.GESTIONE_SPESE);

sql.openParenthesis(FindClause.AND);
sql.addClause(FindClause.OR,"ti_gestione",SQLBuilder.EQUALS,WorkpackageBulk.TI_GESTIONE_SPESE);
sql.addClause(FindClause.OR,"ti_gestione",SQLBuilder.EQUALS,WorkpackageBulk.TI_GESTIONE_ENTRAMBE);
sql.closeParenthesis();

if(dett.getPdg_modulo_spese()!=null && dett.getPdg_modulo_spese().getCd_cofog()!=null )
sql.addSQLClause("AND","V_LINEA_ATTIVITA_VALIDA.CD_COFOG",sql.EQUALS,dett.getPdg_modulo_spese().getCd_cofog());
Expand Down
Expand Up @@ -353,7 +353,12 @@ public SQLBuilder selectLinea_attivitaByClause (UserContext userContext,

sql.addSQLClause(FindClause.AND,"V_LINEA_ATTIVITA_VALIDA.ESERCIZIO",SQLBuilder.EQUALS,CNRUserContext.getEsercizio(userContext));
sql.addClause(FindClause.AND,"cd_centro_responsabilita",SQLBuilder.EQUALS,dett.getCd_cdr_assegnatario());
sql.addClause(FindClause.AND,"ti_gestione",SQLBuilder.EQUALS,Elemento_voceHome.GESTIONE_SPESE);

sql.openParenthesis(FindClause.AND);
sql.addClause(FindClause.OR,"ti_gestione",SQLBuilder.EQUALS,WorkpackageBulk.TI_GESTIONE_SPESE);
sql.addClause(FindClause.OR,"ti_gestione",SQLBuilder.EQUALS,WorkpackageBulk.TI_GESTIONE_ENTRAMBE);
sql.closeParenthesis();

if (dett.getProgetto()!=null && dett.getProgetto().getPg_progetto()!=null)
sql.addClause(FindClause.AND,"pg_progetto",SQLBuilder.EQUALS,dett.getProgetto().getPg_progetto());

Expand Down

0 comments on commit 1230a00

Please sign in to comment.