Skip to content

Commit

Permalink
Piano di gestione preliminare aggiunta il filtro con la ricerca guida…
Browse files Browse the repository at this point in the history
…ta sui progetti.
  • Loading branch information
mspasiano committed Jan 9, 2024
1 parent 321f071 commit 591ab12
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@

package it.cnr.contab.config00.sto.bulk;

import it.cnr.contab.config00.bulk.Parametri_cnrBulk;
import it.cnr.contab.config00.bulk.Parametri_cnrHome;
import it.cnr.contab.prevent01.bulk.Pdg_esercizioBulk;
import it.cnr.contab.prevent01.bulk.Pdg_moduloBulk;
import it.cnr.contab.progettiric00.core.bulk.ProgettoBulk;
import it.cnr.contab.progettiric00.core.bulk.Progetto_sipBulk;
import it.cnr.contab.progettiric00.core.bulk.Progetto_sipHome;
import it.cnr.contab.utenze00.bp.CNRUserContext;
import it.cnr.jada.UserContext;
import it.cnr.jada.bulk.BulkHome;
import it.cnr.jada.comp.ApplicationException;
import it.cnr.jada.persistency.*;
import it.cnr.jada.persistency.sql.FindClause;
import it.cnr.jada.persistency.sql.LoggableStatement;
import it.cnr.jada.persistency.sql.PersistentHome;
import it.cnr.jada.persistency.sql.SQLBuilder;
import it.cnr.jada.persistency.sql.*;

import java.sql.ResultSet;
import java.sql.SQLException;
Expand Down Expand Up @@ -474,7 +474,35 @@ public boolean verificaEsercizioPreventivo(CdrBulk cdr) throws PersistencyExcept
throw new PersistencyException(e);
}
}
public java.util.List<Pdg_moduloBulk> findPdgModuloDettagli(UserContext userContext, CdrBulk testata, CompoundFindClause compoundfindclause) throws IntrospectionException, PersistencyException {
Parametri_cnrHome parCnrhome = (Parametri_cnrHome)getHomeCache().getHome(Parametri_cnrBulk.class);
Parametri_cnrBulk parCnrBulk = (Parametri_cnrBulk)parCnrhome.findByPrimaryKey(new Parametri_cnrBulk(it.cnr.contab.utenze00.bp.CNRUserContext.getEsercizio( userContext )));

PersistentHome dettHome = getHomeCache().getHome(Pdg_moduloBulk.class);
SQLBuilder sql = dettHome.createSQLBuilder();
if (Optional.ofNullable(compoundfindclause).isPresent()) {
dettHome = getHomeCache().getHome(Pdg_moduloBulk.class, "CODICE_PROGETTO");
sql = dettHome.createSQLBuilder();
sql.generateJoin("progetto", "PROGETTO");
sql.generateJoin(ProgettoBulk.class, Progetto_sipBulk.class, "progettopadre", "PROGETTOPADRE");

sql.addSQLClause(FindClause.AND, "PROGETTO.ESERCIZIO", SQLBuilder.EQUALS, it.cnr.contab.utenze00.bp.CNRUserContext.getEsercizio(userContext));
sql.addSQLClause(FindClause.AND, "PROGETTO.TIPO_FASE", SQLBuilder.EQUALS, "P");
sql.addClause(compoundfindclause);
};

sql.addClause("AND", "esercizio", SQLBuilder.EQUALS, it.cnr.contab.utenze00.bp.CNRUserContext.getEsercizio(userContext));
sql.addClause("AND", "cd_centro_responsabilita", SQLBuilder.EQUALS, testata.getCd_centro_responsabilita());

Unita_organizzativa_enteBulk ente = (Unita_organizzativa_enteBulk) getHomeCache().getHome(Unita_organizzativa_enteBulk.class).findAll().get(0);
if (!((CNRUserContext) userContext).getCd_unita_organizzativa().equals(ente.getCd_unita_organizzativa())) {
Progetto_sipHome progettohome = (Progetto_sipHome) getHomeCache().getHome(Progetto_sipBulk.class);
sql.addSQLExistsClause("AND", progettohome.abilitazioni(userContext, "PDG_MODULO.PG_PROGETTO", parCnrBulk.getLivelloProgetto()));
}
final List<Pdg_moduloBulk> result = dettHome.fetchAll(sql);
getHomeCache().fetchAll(userContext);
return result;
}
public java.util.Collection findPdgModuloDettagli(UserContext userContext, CdrBulk testata, Integer livelloProgetto) throws IntrospectionException, PersistencyException {
PersistentHome dettHome = getHomeCache().getHome(Pdg_moduloBulk.class);
SQLBuilder sql = dettHome.createSQLBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,19 @@ public Forward doConfermaCompletaProgetto(ActionContext context, int opt) throws
return context.findDefaultForward();
}

public Forward doFilterCRUDMain_Dettagli(ActionContext context) {
return context.findDefaultForward();
public it.cnr.jada.action.Forward doFilterCRUDMain_Dettagli(it.cnr.jada.action.ActionContext context) throws it.cnr.jada.action.BusinessProcessException {
try {
CRUDPdGAggregatoModuloBP _tmp = (CRUDPdGAggregatoModuloBP) context.getBusinessProcess();
RicercaLiberaBP ricercaliberabp = (RicercaLiberaBP) context.createBusinessProcess("RicercaLibera");
ricercaliberabp.setFreeSearchSet("prg_liv2");
ricercaliberabp.setPrototype(new Pdg_moduloBulk());
context.addHookForward("filter", this, "doBringBackFilter");
HookForward hookforward = (HookForward) context.findForward("filter");
hookforward.addParameter("controller", _tmp.getCrudDettagli());
return context.addBusinessProcess(ricercaliberabp);
} catch (Exception exception) {
return handleException(context, exception);
}
}

public it.cnr.jada.action.Forward doCambiaStato(it.cnr.jada.action.ActionContext context) throws it.cnr.jada.action.BusinessProcessException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@
*/
package it.cnr.contab.prevent01.bp;

import java.io.IOException;
import java.math.BigDecimal;
import java.rmi.RemoteException;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;

import javax.ejb.RemoveException;
import javax.servlet.ServletException;
import javax.servlet.jsp.PageContext;

import it.cnr.contab.config00.bulk.Configurazione_cnrBulk;
import it.cnr.contab.config00.bulk.Parametri_cnrBulk;
Expand All @@ -44,13 +48,17 @@
import it.cnr.contab.progettiric00.core.bulk.Progetto_sipBulk;
import it.cnr.contab.progettiric00.core.bulk.TipoFinanziamentoBulk;
import it.cnr.contab.progettiric00.ejb.ProgettoRicercaPadreComponentSession;
import it.cnr.contab.utente00.ejb.RuoloComponentSession;
import it.cnr.contab.utenze00.bp.CNRUserContext;
import it.cnr.contab.utenze00.bp.CRUDRuoloBP;
import it.cnr.contab.utenze00.bulk.CNRUserInfo;
import it.cnr.contab.utenze00.bulk.RuoloBulk;
import it.cnr.contab.utenze00.bulk.UtenteBulk;
import it.cnr.contab.util.Utility;
import it.cnr.jada.UserContext;
import it.cnr.jada.action.ActionContext;
import it.cnr.jada.action.BusinessProcessException;
import it.cnr.jada.action.HttpActionContext;
import it.cnr.jada.bulk.BulkList;
import it.cnr.jada.bulk.OggettoBulk;
import it.cnr.jada.bulk.UserInfo;
Expand All @@ -66,6 +74,7 @@
import it.cnr.jada.util.action.SimpleDetailCRUDController;
import it.cnr.jada.util.ejb.EJBCommonServices;
import it.cnr.jada.util.jsp.Button;
import it.cnr.jada.util.jsp.TableCustomizer;

/**
* @author mincarnato
Expand All @@ -83,17 +92,43 @@ public class CRUDPdGAggregatoModuloBP extends it.cnr.jada.util.action.SimpleCRUD
private boolean isUtenteDirettore;
private Progetto_sipBulk progettoForUpdate;
private Integer annoFromPianoEconomico;

private SimpleDetailCRUDController crudDettagli = new SimpleDetailCRUDController( "Dettagli", Pdg_moduloBulk.class, "dettagli", this, false) {
private CompoundFindClause compoundFindClausePdgModulo = null;

public void setFilter(ActionContext actioncontext, CompoundFindClause compoundfindclause)
{
compoundFindClausePdgModulo = compoundfindclause;
CRUDPdGAggregatoModuloBP bp = (CRUDPdGAggregatoModuloBP) actioncontext.getBusinessProcess();
CdrBulk cdrBulk = (CdrBulk) bp.getModel();
try {
cdrBulk.setDettagli(new BulkList(createComponentSession().find(
actioncontext.getUserContext(),
CdrBulk.class,
"findPdgModuloDettagli",
actioncontext.getUserContext(),
cdrBulk,
compoundfindclause)));
bp.setModel(actioncontext, cdrBulk);
} catch (BusinessProcessException e) {
handleException(e);
} catch (ComponentException e) {
handleException(e);
} catch (RemoteException e) {
handleException(e);
}
super.setFilter(actioncontext, compoundfindclause);
}

@Override
public boolean isFiltered() {
return Optional.ofNullable(compoundFindClausePdgModulo).isPresent();
}

public void validateForDelete(ActionContext context, OggettoBulk detail) throws ValidationException {
validaCancellazionePdgModulo(context, (Pdg_moduloBulk)detail);
}

public boolean isFiltered()
{
return false;
}
public boolean isReadonly()
{
return super.isReadonly() && !isUtenteAbilitato() && !isCdrPdGPUtilizzabile();
Expand All @@ -106,6 +141,16 @@ public boolean isShrinkable()
{
return super.isShrinkable() && isUtenteAbilitato() && isCdrPdGPUtilizzabile();
}

@Override
public void writeHTMLTable(PageContext pagecontext, String s, boolean flag, boolean flag1, boolean flag2, String s1, String s2, boolean flag3, TableCustomizer tablecustomizer, List list) throws ServletException, IOException {
super.writeHTMLTable(pagecontext, s, flag, flag1, flag2, s1, s2, flag3, tablecustomizer, list);
if (HttpActionContext.isFromBootstrap(pagecontext)) {
pagecontext.getOut().print("<label class=\"ml-2 text-info font-italic h5\">");
pagecontext.getOut().print("Mostrati " + list.size() + " progetti.");
pagecontext.getOut().print("</label>");
}
}
};

public CRUDPdGAggregatoModuloBP() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,22 @@
enabledOnSearch="false"
/>

<freeSearchSet name="prg_liv2">
<findFieldProperty
name="cd_progetto_search"
property="progetto.cd_progetto"
inputType="TEXT"
enabledOnSearch="true"
enabledOnFreeSearch="true"
enabledOnEdit="true"
label="Progetto" />
<findFieldProperty
name="cd_progetto_padre"
label="Area Progettuale" />
<findFieldProperty
name="stato"
label="Stato attuale" />
</freeSearchSet>
<columnSet name="prg_liv2">
<columnFieldProperty
name="cd_progetto"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@
columnSize="10"
fetchOnly="false" />
</defaultColumnMap>
<columnMap
name="CODICE_PROGETTO"
extends="default" >
<columnMapping
columnName="PROGETTO.CD_PROGETTO"
propertyName="progetto.cd_progetto"
sqlTypeName="VARCHAR"
columnSize="30"
nullable="false" />
<columnMapping
columnName="PROGETTOPADRE.CD_PROGETTO"
propertyName="progettopadre.cd_progetto"
sqlTypeName="VARCHAR"
columnSize="30"
nullable="false" />
</columnMap>

<persistentProperty
name="cdr"
partOfOid="true" />
Expand Down
4 changes: 2 additions & 2 deletions sigla-web/src/main/webapp/prevent01/pdg_aggregato_modulo.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<td>
<% if (bp.getParametriCnr().getFl_nuovo_pdg())
controller.writeHTMLTable(pageContext,"prg_liv2",true,false,true,"100%","auto;max-height:50vh");
controller.writeHTMLTable(pageContext,"prg_liv2",true,true,true,"100%","auto;max-height:50vh");
else
controller.writeHTMLTable(pageContext,null,true,false,true,"100%","auto;max-height:50vh");
controller.writeHTMLTable(pageContext,null,true,true,true,"100%","auto;max-height:50vh");
%>
</td>
</table>
Expand Down

0 comments on commit 591ab12

Please sign in to comment.