diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/.tern-project b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/.tern-project new file mode 100644 index 00000000..a185ba0d --- /dev/null +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/.tern-project @@ -0,0 +1 @@ +{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp index c1456196..07d65aa8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp @@ -1,80 +1,74 @@ <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="init.jsp" %> - -
+
- - - -
+ +
- +
- - function (val, fieldNode, ruleValue) { - return fieldNode.get('disabled') || (val != null && val!=''); + + function (val, fieldNode, ruleValue) { + return fieldNode.get('disabled') || (val != null && val != ''); + } + + + function (val, fieldNode, ruleValue) { + if (fieldNode.get('disabled')) { + return true; } - - - - function (val, fieldNode, ruleValue) { - if(fieldNode.get('disabled')){ - return true; - } - var regex = '^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$'; - var regex1 = /^(?:[B-DF-HJ-NP-TV-Z](?:[AEIOU]{2}|[AEIOU]X)|[AEIOU]{2}X|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[1256LMRS][\dLMNP-V])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[\dLMNP-V][1-9MNP-V]|[1-9MNP-V][0L]))[A-Z]$/i; - var regexObj = new RegExp (regex1); - var result = regexObj.test(val); - return result; - } - - + var regex = '^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$'; + var regex1 = /^(?:[B-DF-HJ-NP-TV-Z](?:[AEIOU]{2}|[AEIOU]X)|[AEIOU]{2}X|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[1256LMRS][\dLMNP-V])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[\dLMNP-V][1-9MNP-V]|[1-9MNP-V][0L]))[A-Z]$/i; + var regexObj = new RegExp (regex1); + var result = regexObj.test(val); + return result; + } + +
-
+
- +
- +
-
+
-
- +
+ function (val, fieldNode, ruleValue) { var A = AUI(); - - var checkValue = true; - + var checkValue = true; var portletNamespace = ''; - var sanatorie = A.one("#"+portletNamespace + "sanatoria").val(); - - if(sanatorie == "true"){ - if(val == ""){ + var sanatorie = A.one("#" + portletNamespace + "sanatoria").val(); + if (sanatorie == "true") { + if (val == "") { checkValue = false; } } - return checkValue; } @@ -82,100 +76,97 @@
-
+
-
Tipologia Soggetto
+
Tipologia Soggetto
- - - - - - - + + + + + + +
-
+
-
Tipologia Richiesta
+
Tipologia Richiesta
- - + +
- -
+
-
+
- +
- - -
+
function (val, fieldNode, ruleValue) { - var A = AUI(); - - var checkValue = true; - var portletNamespace = ''; - var dataVidimazione = A.one("#"+portletNamespace + "dataVidimazione").val(); - var sanatorie = A.one("#"+portletNamespace + "sanatoria").val(); - - if(sanatorie == "true"){ - checkValue = false; - } - - if(dataVidimazione != ""){ - var checkDateFixed = "01/01/2015"; - var checkDateFixed = new Date(checkDateFixed); - - var vidimazioneDate = new Date(dataVidimazione); - - if(vidimazioneDate <= checkDateFixed){ - checkValue = false; - } - } - - if(!checkValue){ - if(val != ""){ - return true; - } - - } - - return checkValue; + var A = AUI(); + var checkValue = true; + var portletNamespace = ''; + var dataVidimazione = A.one("#" + portletNamespace + "dataVidimazione").val(); + var sanatorie = A.one("#"+portletNamespace + "sanatoria").val(); + if (sanatorie == "true") { + checkValue = false; + } + if (dataVidimazione != "") { + var checkDateFixed = "01/01/2015"; + var checkDateFixed = new Date(checkDateFixed); + var vidimazioneDate = new Date(dataVidimazione); + if (vidimazioneDate <= checkDateFixed) { + checkValue = false; + } + } + if (!checkValue) { + if (val != "") { + return true; + } + } + return checkValue; }
- -
+
- - - - - - - -YUI().use( - 'aui-datepicker', - function(Y) { - var datepicker = new Y.DatePicker( - { - trigger: '.calendarDatepicker', - calendar: { - dateFormat: 'dd/MM/yyyy', - }, - mask: '%d/%m/%Y', - popover: { - toolbars: { - header: [[ - { - icon: 'icon-trash', - label: Liferay.Language.get("Cancella"), - on: { - click: function() { - datepicker.clearSelection(); - } - } - } - ]] - }, - zIndex: 1 - } - } - ); - } -); - - +YUI().use('aui-datepicker', function(Y) { + var datepicker = new Y.DatePicker({ + trigger: '.calendarDatepicker', + calendar: { + dateFormat: 'dd/MM/yyyy', + }, + mask: '%d/%m/%Y', + popover: { + toolbars: { + header: [[{ + icon: 'icon-trash', + label: Liferay.Language.get("Cancella"), + on: { + click: function() { + datepicker.clearSelection(); + } + } + }]] + }, + zIndex: 1 + } + }); +}); + \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_fe/richiedi-atto.jsp b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_fe/richiedi-atto.jsp index da3be83c..58e207bc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_fe/richiedi-atto.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_fe/richiedi-atto.jsp @@ -73,7 +73,7 @@ boolean isNoCNSUser = UserLocalServiceUtil.hasRoleUser(roleNoCNS.getRoleId(), th - + @@ -104,14 +104,14 @@ boolean isNoCNSUser = UserLocalServiceUtil.hasRoleUser(roleNoCNS.getRoleId(), th
- +
-
+
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPratica.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPratica.java index a0bc4333..a701e9e6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPratica.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPratica.java @@ -39,4 +39,6 @@ public interface IntPratica extends IntPraticaModel, PersistedModel { public boolean isChiusa() throws com.liferay.portal.kernel.exception.SystemException; + + public boolean isSanatoria(); } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaClp.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaClp.java index c39a6f72..913344b1 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaClp.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaClp.java @@ -1167,6 +1167,25 @@ public class IntPraticaClp extends BaseModelImpl } } + @Override + public boolean isSanatoria() { + try { + String methodName = "isSanatoria"; + + Class[] parameterTypes = new Class[] { }; + + Object[] parameterValues = new Object[] { }; + + Boolean returnObj = (Boolean)invokeOnRemoteModel(methodName, + parameterTypes, parameterValues); + + return returnObj; + } + catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + @Override public StagedModelType getStagedModelType() { return new StagedModelType(PortalUtil.getClassNameId( diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaWrapper.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaWrapper.java index 3289fad1..879ba122 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaWrapper.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaWrapper.java @@ -1162,6 +1162,11 @@ public class IntPraticaWrapper implements IntPratica, ModelWrapper { return _intPratica.isChiusa(); } + @Override + public boolean isSanatoria() { + return _intPratica.isSanatoria(); + } + @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/startup/DatabaseUpdateAction.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/startup/DatabaseUpdateAction.java deleted file mode 100644 index ba5a6b0d..00000000 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/startup/DatabaseUpdateAction.java +++ /dev/null @@ -1,191 +0,0 @@ -package it.mwg.sismica.bo.startup; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import com.liferay.portal.kernel.dao.jdbc.DataAccess; -import com.liferay.portal.kernel.events.ActionException; -import com.liferay.portal.kernel.events.SimpleAction; -import com.liferay.portal.kernel.log.Log; -import com.liferay.portal.kernel.log.LogFactoryUtil; - -public class DatabaseUpdateAction extends SimpleAction { - - private static final Log _log = LogFactoryUtil.getLog(DatabaseUpdateAction.class.getName()); - private Connection connection; - - @Override - public void run(String[] ids) throws ActionException { - try { - connection = DataAccess.getUpgradeOptimizedConnection(); - Statement s = connection.createStatement(); - - if (!hasColumn("portos_bo_intpratica", "tipoprocedura")) { - _log.info("Aggiornamento a v2 di portos_bo_intpratica"); - s.executeUpdate("ALTER TABLE portos_bo_intpratica ADD COLUMN tipoprocedura VARCHAR(75) NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "georischiogeomorfologicopai")) { - String[] columns = new String[] { "geoclasseindagine", "geopericolositageologica", - "geopericolositageomorfica", "geopericolositasismica", "geofattibilitasismica", - "geopericolositaidraulica", "geofattibilitaidraulica", "geofattibilitageologica" }; - - for (String column : columns) { - int righe = s.executeUpdate("UPDATE portos_bo_dettpratica SET " + column + "='NA' " - + "WHERE " + column + "='0'"); - if (righe > 0) { - _log.info("Aggiornate " + righe + " righe in portos_bo_dettpratica, colonna " - + column); - } - } - - _log.info("Aggiornamento a v2 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica " - + "ADD COLUMN georischiogeomorfologicopai VARCHAR(75) NULL," - + "ADD COLUMN geopericolositaidraulicapai VARCHAR(75) NULL," - + "ADD COLUMN georischioidraulicopai VARCHAR(75) NULL"); - } - if (!hasColumn("portos_bo_dettpratica", "tcnuovacostruzionecomplessa")) { - _log.info("Aggiornamento a v4 di portos_bo_dettpratica"); - int righe = s - .executeUpdate("UPDATE portos_bo_dettpratica SET destinazione='2' WHERE destinazione='1'"); - if (righe > 0) { - _log.info("Aggiornate " + righe + " righe in portos_bo_dettpratica, colonna destinazione"); - } - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcnuovacostruzionecomplessa BOOL NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "tccostruzioniesistenti")) { - _log.info("Aggiornamento a v5 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tccostruzioniesistenti BOOL NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "paesaggiolocale")) { - _log.info("Aggiornamento a v6 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN paesaggiolocale TEXT NULL"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN livelloditutela TEXT NULL"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN vincoli TEXT NULL"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcmanutordstraord BOOL NULL"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcaltriinterventi BOOL NULL"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcaltriinterventidesc TEXT NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "tcaltriinterventi")) { - _log.info("Aggiornamento a v7 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcaltriinterventi BOOL NULL"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcaltriinterventidesc TEXT NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "destinazionealtrointervento")) { - _log.info("Aggiornamento a v8 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN destinazionealtrointervento TEXT NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "codicefiscaleprincipalearcheologo")) { - _log.info("Aggiornamento a v9 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN codicefiscaleprincipalearcheologo VARCHAR(75) NULL"); - } - - if (!hasColumn("portos_bo_territorio", "articolo61")) { - _log.info("Aggiornamento a v2 di portos_bo_territorio"); - s.executeUpdate("ALTER TABLE portos_bo_territorio ADD COLUMN articolo61 BOOL"); - } - - if (!hasColumn("portos_bo_asseverazione", "dichiarazioni")) { - _log.info("Aggiornamento a v2 di portos_bo_asseverazione"); - s.executeUpdate("ALTER TABLE portos_bo_asseverazione ADD COLUMN dichiarazioni TEXT NULL"); - } - - if (!hasColumn("portos_bo_delega", "dichiarazioni")) { - _log.info("Aggiornamento a v2 di portos_bo_delega"); - s.executeUpdate("ALTER TABLE portos_bo_delega ADD COLUMN dichiarazioni TEXT NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "nocollaudo")) { - _log.info("Aggiornamento a v8 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN nocollaudo BOOL NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "tcnuovacostruzionepertinenza")) { - _log.info("Aggiornamento a v8 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcnuovacostruzionepertinenza BOOL NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "tcinterventoopereescavazione")) { - _log.info("Aggiornamento a v8 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcinterventoopereescavazione BOOL NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "tcviarch")) { - _log.info("Aggiornamento a v8 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcviarch BOOL NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "tcoperaa25")) { - _log.info("Aggiornamento a v8 di portos_bo_dettpratica"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcoperaa25 BOOL NULL"); - } - - if (!hasColumn("portos_bo_soggetto", "tipoaltrosoggetto")) { - s.executeUpdate("ALTER TABLE portos_bo_soggetto ADD COLUMN tipoaltrosoggetto TEXT NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "pagSoggettiAdAutorizzazione")) { - s.executeUpdate("ALTER TABLE portos_bo_dettpratica " - + "ADD COLUMN pagsoggettiadautorizzazione DOUBLE NULL," - + "ADD COLUMN paginterventirestauromanufatti DOUBLE NULL," - + "ADD COLUMN pagaltricasiculturali DOUBLE NULL," - + "ADD COLUMN paglottizzazioni DOUBLE NULL," - + "ADD COLUMN paggrandistrutture DOUBLE NULL," - + "ADD COLUMN pagcondotte DOUBLE NULL," - + "ADD COLUMN pagpalificazioni DOUBLE NULL," - + "ADD COLUMN pagimpiantieolici DOUBLE NULL," - + "ADD COLUMN pagnuoverealizzazioni DOUBLE NULL," - + "ADD COLUMN pagimmobilipreesistenti DOUBLE NULL," - + "ADD COLUMN pagmanifestipubblicitari DOUBLE NULL," - + "ADD COLUMN pagpareridimassima DOUBLE NULL," - + "ADD COLUMN pagaltricasipaesaggistici DOUBLE NULL," - + "ADD COLUMN pagvariantipareriresi DOUBLE NULL," - + "ADD COLUMN pagrilascioattestazioni DOUBLE NULL," - + "ADD COLUMN pagconsultazioniarchivio DOUBLE NULL"); - } - - if (!hasColumn("portos_bo_pagamento", "numerobollettino")) { - s.executeUpdate("ALTER TABLE portos_bo_pagamento ADD COLUMN numerobollettino VARCHAR(75) NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "sanatoriaedilizia47")) { - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN sanatoriaedilizia47 BOOL NULL"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN sanatoriaedilizia724 BOOL NULL"); - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN sanatoriaedilizia326 BOOL NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "normlavorinodirettore")) { - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN normlavorinodirettore BOOL NULL"); - } - - if (!hasColumn("portos_bo_dettpratica", "interventovocep7")) { - s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN interventovocep7 VARCHAR(20) NULL"); - } - - } catch (SQLException e) { - _log.error("Errore di accesso al database: ", e); - throw new ActionException(e); - } - } - - private boolean hasColumn(String table, String column) { - boolean result = true; - ResultSet rs = null; - try { - Statement s = connection.createStatement(); - rs = s.executeQuery("SELECT " + column + " FROM " + table + " WHERE false"); - rs.getMetaData().getColumnName(1); - } catch (SQLException e) { - result = false; - } - return result; - } -} diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/IntPraticaImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/IntPraticaImpl.java index 23508e8e..a5ddaf4f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/IntPraticaImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/IntPraticaImpl.java @@ -14,6 +14,7 @@ package it.tref.liferay.portos.bo.model.impl; import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; +import it.tref.liferay.portos.bo.shared.util.Constants; import java.util.Locale; @@ -91,4 +92,10 @@ public class IntPraticaImpl extends IntPraticaBaseImpl { } return completata; } + + @Override + public boolean isSanatoria() { + return getTipoProcedura().equalsIgnoreCase(Constants.PROCEDURA_P8) + || getTipoProcedura().equalsIgnoreCase(Constants.PROCEDURA_P9); + } } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/listener/KaleoInstanceTokenModelListener.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/listener/KaleoInstanceTokenModelListener.java index 856de86e..cd5879f4 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/listener/KaleoInstanceTokenModelListener.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/listener/KaleoInstanceTokenModelListener.java @@ -67,6 +67,7 @@ public class KaleoInstanceTokenModelListener extends BaseModelListener collaudatori = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto( pratica.getIntPraticaId(), TipoSoggettoUtil.COLLAUDATORE); List fineLavoriList = FineLavoriLocalServiceUtil.findByIntPraticaId( - pratica.getIntPraticaId(), -1, -1, null); + pratica.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); boolean compleatata = false; for (FineLavori fineLavori : fineLavoriList) { if (fineLavori.isCompletata() && !fineLavori.isParziale()) { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java index 4a9d2ac1..7f98e13c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java @@ -1,13 +1,17 @@ package it.tref.liferay.portos.bo.portlet; +import it.tref.liferay.portos.bo.model.Avviso; import it.tref.liferay.portos.bo.model.Comune; import it.tref.liferay.portos.bo.model.ControlloPratica; +import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.model.ParereGeologo; import it.tref.liferay.portos.bo.model.Provincia; import it.tref.liferay.portos.bo.model.Territorio; import it.tref.liferay.portos.bo.search.ControlloPraticaAdvancedSearch; +import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; import it.tref.liferay.portos.bo.service.ComuneLocalServiceUtil; +import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaServiceUtil; @@ -17,11 +21,14 @@ import it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil; import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; import it.tref.liferay.portos.bo.service.permission.IntPraticaPermission; import it.tref.liferay.portos.bo.shared.util.ActionKeys; +import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; import it.tref.liferay.portos.bo.shared.util.Constants; import it.tref.liferay.portos.bo.util.AvvisoUtil; import it.tref.liferay.portos.bo.util.MailUtil; +import it.tref.liferay.portos.bo.util.PraticaUtil; import it.tref.liferay.portos.bo.util.WorkflowUtil; +import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -47,13 +54,18 @@ import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.repository.model.FileEntry; +import com.liferay.portal.kernel.repository.model.Folder; import com.liferay.portal.kernel.search.Document; import com.liferay.portal.kernel.search.Hits; import com.liferay.portal.kernel.servlet.ServletResponseUtil; import com.liferay.portal.kernel.servlet.SessionErrors; +import com.liferay.portal.kernel.upload.UploadPortletRequest; import com.liferay.portal.kernel.util.CSVUtil; import com.liferay.portal.kernel.util.ContentTypes; +import com.liferay.portal.kernel.util.FileUtil; import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.MimeTypesUtil; import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; @@ -73,6 +85,8 @@ import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil; import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.util.PortalUtil; +import com.liferay.portlet.documentlibrary.NoSuchFolderException; +import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.util.bridges.mvc.MVCPortlet; public class GestioneAttivitaPortlet extends MVCPortlet { @@ -233,8 +247,45 @@ public class GestioneAttivitaPortlet extends MVCPortlet { } } - public void allegaSanzione(ActionRequest actionRequest, ActionResponse actionResponse) { + public void allegaSanzione(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, + PortalException, SystemException { + String fileParam = "fileSanzione"; + Date now = new Date(); + UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest); + ServiceContext serviceContext = ServiceContextFactory.getInstance(uploadPortletRequest); + long companyId = serviceContext.getCompanyId(); + File file = uploadPortletRequest.getFile(fileParam); + if (Validator.isNull(file)) { + // TODO + _log.info("File is null"); + return; + } + String sourceFileName = uploadPortletRequest.getFileName(fileParam); + long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId"); + long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId"); + long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId"); + String tipoFile = ParamUtil.getString(actionRequest, "tipoFile"); + String targetFileName = dettPraticaId + StringPool.UNDERLINE + tipoFile + StringPool.UNDERLINE + + (new Date()).getTime() + StringPool.UNDERLINE + sourceFileName; + long attachmentFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, + ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); + Folder attachmentFolder = DLAppLocalServiceUtil.getFolder(attachmentFolderId); + long repositoryId = attachmentFolder.getRepositoryId(); + String folderName = PraticaUtil.getFolderName(dettPraticaId); + Folder folder = null; + try { + folder = DLAppLocalServiceUtil.getFolder(repositoryId, attachmentFolder.getFolderId(), folderName); + } catch (NoSuchFolderException e) { + folder = DLAppLocalServiceUtil.addFolder(serviceContext.getUserId(), attachmentFolder.getRepositoryId(), + attachmentFolder.getFolderId(), folderName, StringPool.BLANK, serviceContext); + } + FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(serviceContext.getUserId(), repositoryId, + folder.getFolderId(), sourceFileName, MimeTypesUtil.getContentType(sourceFileName), targetFileName, + targetFileName, StringPool.BLANK, FileUtil.getBytes(file), serviceContext); + Avviso avviso = AvvisoLocalServiceUtil.addAvviso(intPraticaId, "Descrizione lunga", now, + AvvisoUtil.TIPO_AVVISO_FIRMA, tipoFile, -1L, dettPraticaId, DettPratica.class.getName(), + StringPool.BLANK, fileEntry.getFileEntryId(), 0L, StringPool.BLANK, controlloPraticaId, serviceContext); } public void aggiungiDettPraticheAlControllo(ActionRequest actionRequest, ActionResponse actionResponse) diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/report/builder/builder/ReportAvvisoBeanBuilder.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/report/builder/builder/ReportAvvisoBeanBuilder.java index b7fed21e..deae1441 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/report/builder/builder/ReportAvvisoBeanBuilder.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/report/builder/builder/ReportAvvisoBeanBuilder.java @@ -38,6 +38,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.language.LanguageUtil; @@ -135,7 +136,8 @@ public class ReportAvvisoBeanBuilder { List docPraticas = null; if (avviso.getTipoDocumento().equalsIgnoreCase(DocumentiPraticaUtil.TIPOLOGIA_ALLEGATO_ANNULLAMENTO_FASCICOLO)) { docPraticas = DocPraticaLocalServiceUtil.findByIntPratica_Tipologia(intPraticaId, - DocumentiPraticaUtil.TIPOLOGIA_ALLEGATO_ANNULLAMENTO_FASCICOLO, -1, -1); + DocumentiPraticaUtil.TIPOLOGIA_ALLEGATO_ANNULLAMENTO_FASCICOLO, QueryUtil.ALL_POS, + QueryUtil.ALL_POS); } else if (avviso.getTipoDocumento().equalsIgnoreCase(StatoPraticaConstants.AUTORIZZATA) && (avviso.getControlloPraticaId() != 0)) { docPraticas = new ArrayList<>(); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java index efa74d18..0ed89ab7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java @@ -479,79 +479,64 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi private static final String jsonViarch = getJsonViarch(); private static String getJsonAutorizzazione() { - JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); - JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); - jsonObject.put("esito", jsonArray); - JSONObject etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.AUTORIZZATA)); - etichette.put("value", StatoPraticaConstants.CONFORME); - etichette.put("default", false); - jsonArray.put(etichette); - etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.NON_CONFORME)); - etichette.put("value", StatoPraticaConstants.NON_CONFORME); - etichette.put("default", false); - jsonArray.put(etichette); - etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.INTEGRAZIONE)); - etichette.put("value", StatoPraticaConstants.INTEGRAZIONE); - etichette.put("default", false); - jsonArray.put(etichette); - etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.PREAVVISO_CONTRARIO)); - etichette.put("value", StatoPraticaConstants.PREAVVISO_CONTRARIO); - etichette.put("default", false); - jsonArray.put(etichette); - etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.NO_PARERE)); - etichette.put("value", StatoPraticaConstants.NO_PARERE); - etichette.put("default", false); - jsonArray.put(etichette); - return jsonObject.toString(); + + JSONArray esito = JSONFactoryUtil.createJSONArray(); + esito.put(etichetta(StatoPraticaConstants.CONFORME)); + esito.put(etichetta(StatoPraticaConstants.NON_CONFORME)); + esito.put(etichetta(StatoPraticaConstants.INTEGRAZIONE)); + esito.put(etichetta(StatoPraticaConstants.PREAVVISO_CONTRARIO)); + esito.put(etichetta(StatoPraticaConstants.NO_PARERE)); + JSONObject ret = JSONFactoryUtil.createJSONObject(); + ret.put("esito", esito); + return ret.toString(); } private static String getJsonSanatoria() { - JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); - JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); - jsonObject.put("esito", jsonArray); - JSONObject etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.AUTORIZZATA)); - etichette.put("value", StatoPraticaConstants.CONFORME); - etichette.put("default", false); - jsonArray.put(etichette); - etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.NON_CONFORME)); - etichette.put("value", StatoPraticaConstants.NON_CONFORME); - etichette.put("default", false); - jsonArray.put(etichette); - etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", "Autorizzazione a seguito di pagamento di sanzione pecuniaria"); - etichette.put("value", StatoPraticaConstants.INTEGRAZIONE); - etichette.put("default", false); - jsonArray.put(etichette); - return jsonObject.toString(); + + JSONArray esito = JSONFactoryUtil.createJSONArray(); + esito.put(etichetta(StatoPraticaConstants.CONFORME)); + esito.put(etichetta(StatoPraticaConstants.NON_CONFORME)); + esito.put(etichetta("Autorizzazione a seguito di pagamento di sanzione pecuniaria", + StatoPraticaConstants.INTEGRAZIONE, true)); + JSONObject ret = JSONFactoryUtil.createJSONObject(); + ret.put("esito", esito); + return ret.toString(); } private static String getJsonViarch() { - JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); - JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); - jsonObject.put("esito", jsonArray); - JSONObject etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", "Attiva VIArch"); - etichette.put("value", StatoPraticaConstants.CONFORME); - etichette.put("default", false); - jsonArray.put(etichette); - etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", "Concludi VIArch"); - etichette.put("value", StatoPraticaConstants.NON_CONFORME); - etichette.put("default", false); - jsonArray.put(etichette); - etichette = JSONFactoryUtil.createJSONObject(); - etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.INTEGRAZIONE)); - etichette.put("value", StatoPraticaConstants.INTEGRAZIONE); - etichette.put("default", false); - jsonArray.put(etichette); - return jsonObject.toString(); + + JSONArray esito = JSONFactoryUtil.createJSONArray(); + esito.put(etichetta("Attiva VIArch", StatoPraticaConstants.CONFORME)); + esito.put(etichetta("Concludi VIArch", StatoPraticaConstants.NON_CONFORME)); + esito.put(etichetta(StatoPraticaConstants.INTEGRAZIONE)); + JSONObject ret = JSONFactoryUtil.createJSONObject(); + ret.put("esito", esito); + return ret.toString(); + } + + private static JSONObject etichetta(String value) { + + return etichetta(StatoPraticaConstants.getEsitoAutorizzazione(value), value, false, false); + } + + private static JSONObject etichetta(String label, String value) { + + return etichetta(label, value, false, false); + } + + private static JSONObject etichetta(String label, String value, boolean upload) { + + return etichetta(label, value, upload, false); + } + + private static JSONObject etichetta(String label, String value, boolean upload, boolean isDefault) { + + JSONObject etichetta = JSONFactoryUtil.createJSONObject(); + etichetta.put("label", label); + etichetta.put("value", value); + etichetta.put("upload", upload); + etichetta.put("default", isDefault); + return etichetta; } @Override diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java index eb2a4dab..6519ca88 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java @@ -16,11 +16,11 @@ import it.tref.liferay.portos.bo.shared.protocollo.model.Protocollo; import it.tref.liferay.portos.bo.shared.protocollo.model.Protocollo.TipoProtocollo; import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileReader; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; import java.net.HttpURLConnection; import java.net.URL; import java.text.ParseException; @@ -191,19 +191,21 @@ public class ProtocollazioneUtil { return "Oggetto: " + className + StringPool.SPACE + classPk; } - public static List csvToOggettoProtocollo(java.io.File file) throws FileNotFoundException, - IOException, ParseException { + private static final String[] FILE_PROTOCOLLO_HEADER = { "id", "mittente/destinatario id", "ufficio id", "oggetto", + "numero fascicolo", "data inserimento", "tipo" }; + + private static List csvToOggettoProtocollo(byte[] bytes) throws IOException, ParseException { - String[] FILE_PROTOCOLLO_HEADER = { "id", "mittente/destinatario id", "ufficio id", "oggetto", - "numero fascicolo", "data inserimento", "tipo" }; CSVFormat format = CSVFormat.EXCEL.withTrailingDelimiter().withHeader(FILE_PROTOCOLLO_HEADER) .withSkipHeaderRecord().withIgnoreEmptyLines().withIgnoreSurroundingSpaces(); - Iterable records = format.parse(new FileReader(file)); + Reader reader = new InputStreamReader(new ByteArrayInputStream(bytes)); + Iterable records = format.parse(reader); List listaOggettoProtocollo = new ArrayList<>(); - for (CSVRecord csvRecord : records) { - listaOggettoProtocollo.add(new OggettoProtocollo(csvRecord.get("id"), csvRecord - .get("mittente/destinatario id"), csvRecord.get("ufficio id"), csvRecord.get("oggetto"), csvRecord - .get("numero fascicolo"), csvRecord.get("data inserimento"), csvRecord.get("tipo"))); + reader.close(); + for (CSVRecord record : records) { + listaOggettoProtocollo.add(new OggettoProtocollo(record.get("id"), record.get("mittente/destinatario id"), + record.get("ufficio id"), record.get("oggetto"), record.get("numero fascicolo"), record + .get("data inserimento"), record.get("tipo"))); } return listaOggettoProtocollo; } @@ -251,13 +253,8 @@ public class ProtocollazioneUtil { throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); } byte[] bytes = IOUtils.toByteArray(conn.getInputStream()); - java.io.File tempFile = java.io.File.createTempFile("prefix", "suffix", null); - FileOutputStream fos = new FileOutputStream(tempFile); - fos.write(bytes); - fos.flush(); - fos.close(); conn.disconnect(); - return ProtocollazioneUtil.csvToOggettoProtocollo(tempFile); + return csvToOggettoProtocollo(bytes); } catch (Exception e) { } return result; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portal.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portal.properties index 1633ee2c..86e0e590 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portal.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portal.properties @@ -1,8 +1,7 @@ application.startup.events=\ it.tref.liferay.portos.bo.startup.RoleUpdateAction,\ it.tref.liferay.portos.bo.startup.KaleoListenereStartupAction,\ - it.tref.liferay.portos.bo.startup.CompanyExpandoStartupAction,\ - it.mwg.sismica.bo.startup.DatabaseUpdateAction + it.tref.liferay.portos.bo.startup.CompanyExpandoStartupAction #MODEL LISTENER value.object.listener.it.tref.liferay.portos.bo.model.DettPratica=it.tref.liferay.portos.bo.model.listener.DettPraticaModelListener diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portlet.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portlet.properties index d0f0b1a0..26dad894 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portlet.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portlet.properties @@ -1,7 +1,2 @@ resource.actions.configs=resource-actions/default.xml - -#protocollo.cvs.url=http://localhost:9090/portos-protocollazione-service/v1/api-rest/export-protocolli protocollo.cvs.url=http://localhost:9080/portos-protocollazione-service/v1/api-rest/export-protocolli - -## Importer ## -portos.files.importer.callback.address=http://localhost:9080/portos-file-retriever-portlet/FileRetriever diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties index 04508ffb..1732b5df 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_bo - build.number=3043 - build.date=1618405143549 + build.number=3045 + build.date=1618493741615 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp index 15dd0834..76a1e66a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp @@ -160,15 +160,17 @@ long territorioGroupId = territorio.getGroupId();
- <%-- - + +
- --%>
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/actions/action_allega_sanzione.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/actions/action_allega_sanzione.jsp index f9e82ec0..74cdaa5d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/actions/action_allega_sanzione.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/actions/action_allega_sanzione.jsp @@ -1,17 +1,20 @@ <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@page import="it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants"%> <%@include file="/html/gestioneattivita/init.jsp"%> <% long intPraticaId = ParamUtil.getLong(request, "intPraticaId"); long dettPraticaId = ParamUtil.getLong(request, "dettPraticaId"); +long controlloPraticaId = ParamUtil.getLong(request, "controlloPraticaId"); String buttonIdAllegaSanzione = ParamUtil.getString(request, "buttonIdAllegaSanzione"); String randomId = StringUtil.randomId(); String formNameAllegaSanzione = "formNameAllegaSanzione_" + randomId; String divIdAllegaSanzione = "divIdAllegaSanzione_" + randomId; -System.out.println("intPraticaId = " + intPraticaId + ", dettPraticaId = " + dettPraticaId); %> + + - +
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java index 0826b8d5..c1b4f415 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java @@ -1,17 +1,17 @@ package it.tref.liferay.portos.firma.util; -import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.net.HttpURLConnection; +import java.util.Date; import java.util.List; -import org.apache.commons.io.FileUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.mime.MultipartEntity; +import org.apache.http.entity.mime.content.ByteArrayBody; import org.apache.http.entity.mime.content.ContentBody; -import org.apache.http.entity.mime.content.FileBody; import org.apache.http.impl.client.DefaultHttpClient; import com.fasterxml.jackson.databind.ObjectMapper; @@ -46,18 +46,17 @@ public class FirmaUtil { public static List getCodiceFiscale(byte[] fileArray, String urlPdfExtractor) { List listaCodiciFiscali = null; + HttpClient client = null; try { - File file = File.createTempFile("codicefiscale", ".p7m"); - FileUtils.writeByteArrayToFile(file, fileArray); ObjectMapper mapper = new ObjectMapper(); - ContentBody body = new FileBody(file); + ContentBody body = new ByteArrayBody(fileArray, "codicefiscale" + (new Date()).getTime() + ".p7m"); MultipartEntity entity = new MultipartEntity(); entity.addPart("file", body); HttpPost request = new HttpPost(urlPdfExtractor); request.setEntity(entity); - HttpClient client = new DefaultHttpClient(); + client = new DefaultHttpClient(); HttpResponse response = client.execute(request); - if (response.getStatusLine().getStatusCode() != 200) { + if (response.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_OK) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } InputStream inputStream = response.getEntity().getContent(); @@ -67,6 +66,8 @@ public class FirmaUtil { } } catch (IOException e) { _log.error(e.getMessage()); + } finally { + client.getConnectionManager().shutdown(); } return listaCodiciFiscali; } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/scheduler/SchedulerKaleoController.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/scheduler/SchedulerKaleoController.java index ab4b79cd..00196f6c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/scheduler/SchedulerKaleoController.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/scheduler/SchedulerKaleoController.java @@ -3,18 +3,11 @@ package it.tref.liferay.portos.kaleo.controller.scheduler; import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; -import it.tref.liferay.portos.kaleo.controller.model.KaleoInstance; -import it.tref.liferay.portos.kaleo.controller.model.KaleoInstanceToken; import it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance; import it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken; -import it.tref.liferay.portos.kaleo.controller.service.KaleoInstanceLocalServiceUtil; -import it.tref.liferay.portos.kaleo.controller.service.KaleoInstanceTokenLocalServiceUtil; import it.tref.liferay.portos.kaleo.controller.service.KaleoTaskAssignmentInstanceLocalServiceUtil; import it.tref.liferay.portos.kaleo.controller.service.KaleoTaskInstanceTokenLocalServiceUtil; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -31,8 +24,6 @@ import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.messaging.Message; import com.liferay.portal.kernel.messaging.MessageListener; import com.liferay.portal.kernel.messaging.MessageListenerException; -import com.liferay.portal.kernel.workflow.WorkflowInstance; -import com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil; import com.liferay.portal.model.User; public class SchedulerKaleoController implements MessageListener { @@ -55,143 +46,141 @@ public class SchedulerKaleoController implements MessageListener { } } - /** - * ADT - */ + // ADT private void riparaLifecycleWorkflowNew() throws Exception { - List listaKO = new ArrayList(); - List lista = IntPraticaLocalServiceUtil.riparaWorkflow(); - for (Object[] objs : lista) { - long kaleotaskinstancetokenid = Long.parseLong(String.valueOf(objs[0])); - long kaleoinstancetokenid = Long.parseLong(String.valueOf(objs[1])); - long controllopraticaid = (objs[2] != null) ? Long.parseLong(String.valueOf(objs[2])) : 0; - long statusbyuserid = Long.parseLong(String.valueOf(objs[3])); - _log.info("RIPARA_WORKFLOW inizio lavorazione -- controllopraticaid=" + controllopraticaid - + " statusbyuserid=" + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid - + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid); - if (controllopraticaid == 0) { - _log.info("RIPARA_WORKFLOW KO controllopraticaid non valorizzato =" + controllopraticaid); - continue; - } - try { - ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil - .fetchControlloPratica(controllopraticaid); - DynamicQuery queryKIT = DynamicQueryFactoryUtil.forClass(KaleoTaskInstanceToken.class); - queryKIT.add(RestrictionsFactoryUtil.eq("classPK", controllopraticaid)); - Order defaultOrderDettPrtatica = OrderFactoryUtil.asc("createDate"); - queryKIT.addOrder(defaultOrderDettPrtatica); - List listas = KaleoTaskInstanceTokenLocalServiceUtil.dynamicQuery(queryKIT); - if (listas != null && !listas.isEmpty()) { - KaleoTaskInstanceToken ktit = null; - for (KaleoTaskInstanceToken k : listas) { - if (k.getKaleoTaskName().equalsIgnoreCase("Assegnazione")) { - ktit = k; - break; - } - } - if (ktit != null) { - WorkflowInstance wfInstance = WorkflowInstanceManagerUtil.getWorkflowInstance( - controlloPratica.getCompanyId(), ktit.getKaleoInstanceId()); - Serializable wfVariante = wfInstance.getWorkflowContext().get("wf_variante"); - boolean isVariante = false; - if (wfVariante != null) { - isVariante = (wfVariante != null && wfVariante.toString().length() > 0); - } - _log.info("RIPARA_WORKFLOW isVariante=" + isVariante + " per controllopraticaid=" - + controllopraticaid); - _log.info("RIPARA_WORKFLOW KaleoTaskInstanceTokenId=" + ktit.getKaleoTaskInstanceTokenId() - + " --controllopraticaid=" + controllopraticaid); - DynamicQuery queryKAT = DynamicQueryFactoryUtil.forClass(KaleoTaskAssignmentInstance.class); - queryKAT.add(RestrictionsFactoryUtil.eq("kaleoTaskInstanceTokenId", - ktit.getKaleoTaskInstanceTokenId())); - List listass = KaleoTaskAssignmentInstanceLocalServiceUtil - .dynamicQuery(queryKAT); - _log.info("size lista KaleoTaskAssignmentInstance per kaleoTaskInstanceTokenId=" - + ktit.getKaleoTaskInstanceTokenId() + " :" + listass.size()); - if (listass != null && !listass.isEmpty()) { - // creazione record assente sulla tabella KaleoTaskAssignmentInstance - KaleoTaskAssignmentInstance assignmentInstanceApp = listass.get(0); - long kaleoTaskAssignementInstanceId = CounterLocalServiceUtil - .increment("com.liferay.counter.model.Counter"); - KaleoTaskAssignmentInstance assignmentInstance = KaleoTaskAssignmentInstanceLocalServiceUtil - .createKaleoTaskAssignmentInstance(kaleoTaskAssignementInstanceId); - assignmentInstance.setCreateDate(assignmentInstanceApp.getCreateDate()); - assignmentInstance.setModifiedDate(assignmentInstanceApp.getModifiedDate()); - assignmentInstance.setModifiedDate(assignmentInstanceApp.getModifiedDate()); - assignmentInstance.setGroupId(assignmentInstanceApp.getGroupId()); - assignmentInstance.setCompanyId(assignmentInstanceApp.getCompanyId()); - assignmentInstance.setUserId(assignmentInstanceApp.getUserId()); - assignmentInstance.setUserName(assignmentInstanceApp.getUserName()); - assignmentInstance.setKaleoDefinitionId(assignmentInstanceApp.getKaleoDefinitionId()); - assignmentInstance.setKaleoInstanceId(assignmentInstanceApp.getKaleoInstanceId()); - assignmentInstance.setKaleoInstanceTokenId(kaleoinstancetokenid); - assignmentInstance.setKaleoTaskInstanceTokenId(kaleotaskinstancetokenid); - assignmentInstance.setKaleoTaskId(21642L); - assignmentInstance.setKaleoTaskName("Esito"); - assignmentInstance.setAssigneeClassName(User.class.getName()); - assignmentInstance.setAssigneeClassPK(statusbyuserid); - assignmentInstance.setCompleted(false); - KaleoTaskAssignmentInstanceLocalServiceUtil - .updateKaleoTaskAssignmentInstance(assignmentInstance); - // patch per tener contro anche delle varianti create da applicativo portos2: forzo lo stato - // del WF a ESITO - long kaleoInstanceId = assignmentInstanceApp.getKaleoInstanceId(); - KaleoInstance kaleoInstance = KaleoInstanceLocalServiceUtil - .getKaleoInstance(kaleoInstanceId); - long rootKaleoInstanceTokenId = kaleoInstance.getRootKaleoInstanceTokenId(); - KaleoInstanceToken rootKaleoInstanceToken = KaleoInstanceTokenLocalServiceUtil - .getKaleoInstanceToken(rootKaleoInstanceTokenId); - _log.info("rootKaleoInstanceToken=" + rootKaleoInstanceToken.getCurrentKaleoNodeName()); - rootKaleoInstanceToken.setCurrentKaleoNodeId(21639); - rootKaleoInstanceToken.setCurrentKaleoNodeName("Esito"); - KaleoInstanceTokenLocalServiceUtil.updateKaleoInstanceToken(rootKaleoInstanceToken); - // task di assegnazione viene inserito a completato: - if (!assignmentInstanceApp.isCompleted()) { - assignmentInstanceApp.setCompleted(true); - assignmentInstanceApp.setCompletionDate(new Date()); - KaleoTaskAssignmentInstanceLocalServiceUtil - .updateKaleoTaskAssignmentInstance(assignmentInstanceApp); - } - // solo per le nuove varianti di PORTOS2 - if (isVariante) { - _log.info("cancellazione task di assegnazione per controllopraticaid=" - + controllopraticaid); - KaleoTaskInstanceTokenLocalServiceUtil.deleteKaleoTaskInstanceToken(ktit); - KaleoTaskAssignmentInstanceLocalServiceUtil - .deleteKaleoTaskAssignmentInstance(assignmentInstanceApp); - } else if (!ktit.isCompleted()) { - ktit.setCompleted(true); - ktit.setCompletionDate(new Date()); - KaleoTaskInstanceTokenLocalServiceUtil.updateKaleoTaskInstanceToken(ktit); - } - if (controlloPratica != null) { - _log.info("RIPARA_WORKFLOW - Pulisco Workflow ed indicizzo per intPraticaId=" - + controlloPratica.getIntPraticaId()); - CacheRegistryUtil.clear(); - IntPraticaLocalServiceUtil.reIndexFasciolo(controlloPratica.getIntPraticaId(), - controlloPratica.getCompanyId()); - } - } - _log.info("RIPARA_WORKFLOW fine lavorazione OK -- controllopraticaid=" + controllopraticaid - + " statusbyuserid=" + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid - + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid); - } else { - _log.info("RIPARA_WORKFLOW fine lavorazione KO --task assegnazione non trovato per controllopraticaid=" - + controllopraticaid - + " statusbyuserid=" - + statusbyuserid - + " kaleoinstancetokenid=" - + kaleoinstancetokenid + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid); - listaKO.add(objs); - } - } - } catch (Exception e) { - _log.error("Errore RIPARA_WORKFLOW -- controllopraticaid=" + controllopraticaid + " statusbyuserid=" - + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid - + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid, e); - } - } - patchTaskEsitiForWF(listaKO); + // List listaKO = new ArrayList(); + // List lista = IntPraticaLocalServiceUtil.riparaWorkflow(); + // for (Object[] objs : lista) { + // long kaleotaskinstancetokenid = Long.parseLong(String.valueOf(objs[0])); + // long kaleoinstancetokenid = Long.parseLong(String.valueOf(objs[1])); + // long controllopraticaid = (objs[2] != null) ? Long.parseLong(String.valueOf(objs[2])) : 0; + // long statusbyuserid = Long.parseLong(String.valueOf(objs[3])); + // _log.info("RIPARA_WORKFLOW inizio lavorazione -- controllopraticaid=" + controllopraticaid + // + " statusbyuserid=" + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid + // + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid); + // if (controllopraticaid == 0) { + // _log.info("RIPARA_WORKFLOW KO controllopraticaid non valorizzato =" + controllopraticaid); + // continue; + // } + // try { + // ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil + // .fetchControlloPratica(controllopraticaid); + // DynamicQuery queryKIT = DynamicQueryFactoryUtil.forClass(KaleoTaskInstanceToken.class); + // queryKIT.add(RestrictionsFactoryUtil.eq("classPK", controllopraticaid)); + // Order defaultOrderDettPrtatica = OrderFactoryUtil.asc("createDate"); + // queryKIT.addOrder(defaultOrderDettPrtatica); + // List listas = KaleoTaskInstanceTokenLocalServiceUtil.dynamicQuery(queryKIT); + // if (listas != null && !listas.isEmpty()) { + // KaleoTaskInstanceToken ktit = null; + // for (KaleoTaskInstanceToken k : listas) { + // if (k.getKaleoTaskName().equalsIgnoreCase("Assegnazione")) { + // ktit = k; + // break; + // } + // } + // if (ktit != null) { + // WorkflowInstance wfInstance = WorkflowInstanceManagerUtil.getWorkflowInstance( + // controlloPratica.getCompanyId(), ktit.getKaleoInstanceId()); + // Serializable wfVariante = wfInstance.getWorkflowContext().get("wf_variante"); + // boolean isVariante = false; + // if (wfVariante != null) { + // isVariante = (wfVariante != null && wfVariante.toString().length() > 0); + // } + // _log.info("RIPARA_WORKFLOW isVariante=" + isVariante + " per controllopraticaid=" + // + controllopraticaid); + // _log.info("RIPARA_WORKFLOW KaleoTaskInstanceTokenId=" + ktit.getKaleoTaskInstanceTokenId() + // + " --controllopraticaid=" + controllopraticaid); + // DynamicQuery queryKAT = DynamicQueryFactoryUtil.forClass(KaleoTaskAssignmentInstance.class); + // queryKAT.add(RestrictionsFactoryUtil.eq("kaleoTaskInstanceTokenId", + // ktit.getKaleoTaskInstanceTokenId())); + // List listass = KaleoTaskAssignmentInstanceLocalServiceUtil + // .dynamicQuery(queryKAT); + // _log.info("size lista KaleoTaskAssignmentInstance per kaleoTaskInstanceTokenId=" + // + ktit.getKaleoTaskInstanceTokenId() + " :" + listass.size()); + // if (listass != null && !listass.isEmpty()) { + // // creazione record assente sulla tabella KaleoTaskAssignmentInstance + // KaleoTaskAssignmentInstance assignmentInstanceApp = listass.get(0); + // long kaleoTaskAssignementInstanceId = CounterLocalServiceUtil + // .increment("com.liferay.counter.model.Counter"); + // KaleoTaskAssignmentInstance assignmentInstance = KaleoTaskAssignmentInstanceLocalServiceUtil + // .createKaleoTaskAssignmentInstance(kaleoTaskAssignementInstanceId); + // assignmentInstance.setCreateDate(assignmentInstanceApp.getCreateDate()); + // assignmentInstance.setModifiedDate(assignmentInstanceApp.getModifiedDate()); + // assignmentInstance.setModifiedDate(assignmentInstanceApp.getModifiedDate()); + // assignmentInstance.setGroupId(assignmentInstanceApp.getGroupId()); + // assignmentInstance.setCompanyId(assignmentInstanceApp.getCompanyId()); + // assignmentInstance.setUserId(assignmentInstanceApp.getUserId()); + // assignmentInstance.setUserName(assignmentInstanceApp.getUserName()); + // assignmentInstance.setKaleoDefinitionId(assignmentInstanceApp.getKaleoDefinitionId()); + // assignmentInstance.setKaleoInstanceId(assignmentInstanceApp.getKaleoInstanceId()); + // assignmentInstance.setKaleoInstanceTokenId(kaleoinstancetokenid); + // assignmentInstance.setKaleoTaskInstanceTokenId(kaleotaskinstancetokenid); + // assignmentInstance.setKaleoTaskId(21642L); + // assignmentInstance.setKaleoTaskName("Esito"); + // assignmentInstance.setAssigneeClassName(User.class.getName()); + // assignmentInstance.setAssigneeClassPK(statusbyuserid); + // assignmentInstance.setCompleted(false); + // KaleoTaskAssignmentInstanceLocalServiceUtil + // .updateKaleoTaskAssignmentInstance(assignmentInstance); + // // patch per tener contro anche delle varianti create da applicativo portos2: forzo lo stato + // // del WF a ESITO + // long kaleoInstanceId = assignmentInstanceApp.getKaleoInstanceId(); + // KaleoInstance kaleoInstance = KaleoInstanceLocalServiceUtil + // .getKaleoInstance(kaleoInstanceId); + // long rootKaleoInstanceTokenId = kaleoInstance.getRootKaleoInstanceTokenId(); + // KaleoInstanceToken rootKaleoInstanceToken = KaleoInstanceTokenLocalServiceUtil + // .getKaleoInstanceToken(rootKaleoInstanceTokenId); + // _log.info("rootKaleoInstanceToken=" + rootKaleoInstanceToken.getCurrentKaleoNodeName()); + // rootKaleoInstanceToken.setCurrentKaleoNodeId(21639); + // rootKaleoInstanceToken.setCurrentKaleoNodeName("Esito"); + // KaleoInstanceTokenLocalServiceUtil.updateKaleoInstanceToken(rootKaleoInstanceToken); + // // task di assegnazione viene inserito a completato: + // if (!assignmentInstanceApp.isCompleted()) { + // assignmentInstanceApp.setCompleted(true); + // assignmentInstanceApp.setCompletionDate(new Date()); + // KaleoTaskAssignmentInstanceLocalServiceUtil + // .updateKaleoTaskAssignmentInstance(assignmentInstanceApp); + // } + // // solo per le nuove varianti di PORTOS2 + // if (isVariante) { + // _log.info("cancellazione task di assegnazione per controllopraticaid=" + // + controllopraticaid); + // KaleoTaskInstanceTokenLocalServiceUtil.deleteKaleoTaskInstanceToken(ktit); + // KaleoTaskAssignmentInstanceLocalServiceUtil + // .deleteKaleoTaskAssignmentInstance(assignmentInstanceApp); + // } else if (!ktit.isCompleted()) { + // ktit.setCompleted(true); + // ktit.setCompletionDate(new Date()); + // KaleoTaskInstanceTokenLocalServiceUtil.updateKaleoTaskInstanceToken(ktit); + // } + // if (controlloPratica != null) { + // _log.info("RIPARA_WORKFLOW - Pulisco Workflow ed indicizzo per intPraticaId=" + // + controlloPratica.getIntPraticaId()); + // CacheRegistryUtil.clear(); + // IntPraticaLocalServiceUtil.reIndexFasciolo(controlloPratica.getIntPraticaId(), + // controlloPratica.getCompanyId()); + // } + // } + // _log.info("RIPARA_WORKFLOW fine lavorazione OK -- controllopraticaid=" + controllopraticaid + // + " statusbyuserid=" + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid + // + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid); + // } else { + // _log.info("RIPARA_WORKFLOW fine lavorazione KO --task assegnazione non trovato per controllopraticaid=" + // + controllopraticaid + // + " statusbyuserid=" + // + statusbyuserid + // + " kaleoinstancetokenid=" + // + kaleoinstancetokenid + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid); + // listaKO.add(objs); + // } + // } + // } catch (Exception e) { + // _log.error("Errore RIPARA_WORKFLOW -- controllopraticaid=" + controllopraticaid + " statusbyuserid=" + // + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid + // + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid, e); + // } + // } + // patchTaskEsitiForWF(listaKO); } private void patchTaskEsitiForWF(List lista) { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java index 63c367e1..7dc61bd0 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java @@ -1,34 +1,34 @@ /** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * - * This library is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 2.1 of the License, or (at your option) + * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * - * This library 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 Lesser General Public License for more + * This library 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 Lesser General Public License for more * details. */ package it.tref.liferay.portos.report.model.impl; /** - * The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the "kaleotaskassignmentinstance" database table, with each column mapped to a property of this class. + * The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the + * "kaleotaskassignmentinstance" database table, with each column mapped to a property of this class. * *

- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun + * ServiceBuilder to copy their definitions into the + * {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} interface. *

* * @author 3F Consulting */ -public class KaleoTaskAssignmentInstanceImpl - extends KaleoTaskAssignmentInstanceBaseImpl { +public class KaleoTaskAssignmentInstanceImpl extends KaleoTaskAssignmentInstanceBaseImpl { /* - * NOTE FOR DEVELOPERS: - * - * Never reference this class directly. All methods that expect a kaleo task assignment instance model instance should use the {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} interface instead. + * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task assignment + * instance model instance should use the {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} + * interface instead. */ public KaleoTaskAssignmentInstanceImpl() { } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/KaleoInstanceLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/KaleoInstanceLocalServiceImpl.java index abb17bc6..1d2db06c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/KaleoInstanceLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/KaleoInstanceLocalServiceImpl.java @@ -1,14 +1,12 @@ /** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * - * This library is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 2.1 of the License, or (at your option) + * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * - * This library 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 Lesser General Public License for more + * This library 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 Lesser General Public License for more * details. */ @@ -20,21 +18,21 @@ import it.tref.liferay.portos.report.service.base.KaleoInstanceLocalServiceBaseI * The implementation of the kaleo instance local service. * *

- * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.report.service.KaleoInstanceLocalService} interface. + * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy + * their definitions into the {@link it.tref.liferay.portos.report.service.KaleoInstanceLocalService} interface. * *

- * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM. + * This is a local service. Methods of this service will not have security checks based on the propagated JAAS + * credentials because this service can only be accessed from within the same VM. *

* * @author 3F Consulting * @see it.tref.liferay.portos.report.service.base.KaleoInstanceLocalServiceBaseImpl * @see it.tref.liferay.portos.report.service.KaleoInstanceLocalServiceUtil */ -public class KaleoInstanceLocalServiceImpl - extends KaleoInstanceLocalServiceBaseImpl { +public class KaleoInstanceLocalServiceImpl extends KaleoInstanceLocalServiceBaseImpl { /* - * NOTE FOR DEVELOPERS: - * - * Never reference this interface directly. Always use {@link it.tref.liferay.portos.report.service.KaleoInstanceLocalServiceUtil} to access the kaleo instance local service. + * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link + * it.tref.liferay.portos.report.service.KaleoInstanceLocalServiceUtil} to access the kaleo instance local service. */ } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java index d6341c7e..fe3c0cad 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java @@ -31,6 +31,7 @@ import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.ParamUtil; +import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.model.Organization; import com.liferay.portal.service.OrganizationLocalServiceUtil; @@ -41,103 +42,102 @@ public class ReportScadenzarioIstruttorie implements PortosReportInterface { @Override public String generateHTML(HttpServletRequest httpServletRequest) { - String html = ""; + String html = StringPool.BLANK; try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - JasperHtmlExporterBuilder htmlExporter = DynamicReports.export.htmlExporter(bos).setIgnoreHyperLink(true); - JasperReportBuilder builder = generateReport(httpServletRequest); builder.pageFooter(DynamicReports.cmp.pageNumber().setStyle(TemplatesADV.boldCenteredStyle)); builder.toHtml(htmlExporter); - byte[] byteArray = bos.toByteArray(); html = new String(byteArray); - } catch (DRException e) { _log.error(e, e); } - return html; } @Override public JasperReportBuilder generateReport(HttpServletRequest request) { - String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null); - - TextColumnBuilder presidioColumn = DynamicReports.col.column("Ufficio", "presidioColumn", DynamicReports.type.stringType()); - TextColumnBuilder numeroPraticheDaAssegnareColumn = DynamicReports.col.column("Nďż˝pratiche da assegnare da parte delle PO", "numeroPraticheDaAssegnareColumn", DynamicReports.type.integerType()); - - TextColumnBuilder numeroPraticheDaApprovareColumn = DynamicReports.col.column("Nďż˝ pratiche da approvare da parte delle PO", "numeroPraticheDaApprovareColumn", DynamicReports.type.integerType()); - - // - TextColumnBuilder numeroPraticheInIstruttoriaOrdinarieColumn = DynamicReports.col.column("Nďż˝pratiche In Istruttoria", "numeroPraticheInIstruttoriaOrdinarieColumn", DynamicReports.type.integerType()); - - TextColumnBuilder numeroPraticheConIntegrazOrdinarieColumn = DynamicReports.col.column("Nďż˝ pratiche con Int.Richieste", "numeroPraticheConIntegrazOrdinarieColumn", DynamicReports.type.integerType()); - - // - TextColumnBuilder numeroPraticheInIstruttoriaInScadenzaColumn = DynamicReports.col.column("Nďż˝ pratiche In Istruttoria", "numeroPraticheInIstruttoriaInScadenzaColumn", DynamicReports.type.integerType()); - - TextColumnBuilder numeroPraticheConIntegrazInScadenzaColumn = DynamicReports.col.column("Nďż˝ pratiche con Int.Richieste", "numeroPraticheConIntegrazInScadenzaColumn", DynamicReports.type.integerType()); - // - TextColumnBuilder numeroPraticheInIstruttoriaScaduteColumn = DynamicReports.col.column("Nďż˝ pratiche In Istruttoria", "numeroPraticheInIstruttoriaScaduteColumn", DynamicReports.type.integerType()); - TextColumnBuilder numeroPraticheConIntegrazScaduteColumn = DynamicReports.col.column("Nďż˝ pratiche con Int.Richieste", "numeroPraticheConIntegrazScaduteColumn", DynamicReports.type.integerType()); - - ColumnTitleGroupBuilder titleGroupOrdinarie = DynamicReports.grid.titleGroup(tipoPraticaSelected + " Ordinarie ( 0-39gg) ", numeroPraticheInIstruttoriaOrdinarieColumn, numeroPraticheConIntegrazOrdinarieColumn); - - ColumnTitleGroupBuilder titleGroupInScadenza = DynamicReports.grid.titleGroup(tipoPraticaSelected + " In Scadenza ( 40-60 gg) ", numeroPraticheInIstruttoriaInScadenzaColumn, numeroPraticheConIntegrazInScadenzaColumn); - - ColumnTitleGroupBuilder titleGroupScadute = DynamicReports.grid.titleGroup(tipoPraticaSelected + " Scadute ( oltre 60 gg) ", numeroPraticheInIstruttoriaScaduteColumn, numeroPraticheConIntegrazScaduteColumn); + String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null); + TextColumnBuilder presidioColumn = DynamicReports.col.column("Ufficio", "presidioColumn", + DynamicReports.type.stringType()); + TextColumnBuilder numeroPraticheDaAssegnareColumn = DynamicReports.col.column( + "N° pratiche da assegnare da parte delle PO", "numeroPraticheDaAssegnareColumn", + DynamicReports.type.integerType()); + TextColumnBuilder numeroPraticheDaApprovareColumn = DynamicReports.col.column( + "N° pratiche da approvare da parte delle PO", "numeroPraticheDaApprovareColumn", + DynamicReports.type.integerType()); + TextColumnBuilder numeroPraticheInIstruttoriaOrdinarieColumn = DynamicReports.col.column( + "N° pratiche In Istruttoria", "numeroPraticheInIstruttoriaOrdinarieColumn", + DynamicReports.type.integerType()); + TextColumnBuilder numeroPraticheConIntegrazOrdinarieColumn = DynamicReports.col.column( + "N° pratiche con Int.Richieste", "numeroPraticheConIntegrazOrdinarieColumn", + DynamicReports.type.integerType()); + TextColumnBuilder numeroPraticheInIstruttoriaInScadenzaColumn = DynamicReports.col.column( + "N° pratiche In Istruttoria", "numeroPraticheInIstruttoriaInScadenzaColumn", + DynamicReports.type.integerType()); + TextColumnBuilder numeroPraticheConIntegrazInScadenzaColumn = DynamicReports.col.column( + "N° pratiche con Int.Richieste", "numeroPraticheConIntegrazInScadenzaColumn", + DynamicReports.type.integerType()); + TextColumnBuilder numeroPraticheInIstruttoriaScaduteColumn = DynamicReports.col.column( + "N° pratiche In Istruttoria", "numeroPraticheInIstruttoriaScaduteColumn", + DynamicReports.type.integerType()); + TextColumnBuilder numeroPraticheConIntegrazScaduteColumn = DynamicReports.col.column( + "N° pratiche con Int.Richieste", "numeroPraticheConIntegrazScaduteColumn", + DynamicReports.type.integerType()); + ColumnTitleGroupBuilder titleGroupOrdinarie = DynamicReports.grid.titleGroup(tipoPraticaSelected + + " Ordinarie ( 0-39 gg) ", numeroPraticheInIstruttoriaOrdinarieColumn, + numeroPraticheConIntegrazOrdinarieColumn); + ColumnTitleGroupBuilder titleGroupInScadenza = DynamicReports.grid.titleGroup(tipoPraticaSelected + + " In Scadenza ( 40-60 gg) ", numeroPraticheInIstruttoriaInScadenzaColumn, + numeroPraticheConIntegrazInScadenzaColumn); + ColumnTitleGroupBuilder titleGroupScadute = DynamicReports.grid.titleGroup(tipoPraticaSelected + + " Scadute ( oltre 60 gg) ", numeroPraticheInIstruttoriaScaduteColumn, + numeroPraticheConIntegrazScaduteColumn); JasperReportBuilder builder = DynamicReports .report() .setTemplate(TemplatesADV.reportTemplate) - .columnGrid(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, titleGroupOrdinarie, titleGroupInScadenza, titleGroupScadute) - .columns(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, numeroPraticheInIstruttoriaOrdinarieColumn, numeroPraticheConIntegrazOrdinarieColumn, numeroPraticheInIstruttoriaInScadenzaColumn, - numeroPraticheConIntegrazInScadenzaColumn, numeroPraticheInIstruttoriaScaduteColumn, numeroPraticheConIntegrazScaduteColumn).setDataSource(createDataSource(request)) + .columnGrid(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, + titleGroupOrdinarie, titleGroupInScadenza, titleGroupScadute) + .columns(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, + numeroPraticheInIstruttoriaOrdinarieColumn, numeroPraticheConIntegrazOrdinarieColumn, + numeroPraticheInIstruttoriaInScadenzaColumn, numeroPraticheConIntegrazInScadenzaColumn, + numeroPraticheInIstruttoriaScaduteColumn, numeroPraticheConIntegrazScaduteColumn) + .setDataSource(createDataSource(request)) .addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true"); - ; - return builder; } private JRDataSource createDataSource(HttpServletRequest request) { - DRDataSource dataSource = new DRDataSource("presidioColumn", "numeroPraticheDaAssegnareColumn", "numeroPraticheDaApprovareColumn", "numeroPraticheInIstruttoriaOrdinarieColumn", "numeroPraticheConIntegrazOrdinarieColumn", - "numeroPraticheInIstruttoriaInScadenzaColumn", "numeroPraticheConIntegrazInScadenzaColumn", "numeroPraticheInIstruttoriaScaduteColumn", "numeroPraticheConIntegrazScaduteColumn"); + DRDataSource dataSource = new DRDataSource("presidioColumn", "numeroPraticheDaAssegnareColumn", + "numeroPraticheDaApprovareColumn", "numeroPraticheInIstruttoriaOrdinarieColumn", + "numeroPraticheConIntegrazOrdinarieColumn", "numeroPraticheInIstruttoriaInScadenzaColumn", + "numeroPraticheConIntegrazInScadenzaColumn", "numeroPraticheInIstruttoriaScaduteColumn", + "numeroPraticheConIntegrazScaduteColumn"); try { String dateMaxString = ParamUtil.getString(request, "dateMax", null); String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null); - if (dateMaxString != null && tipoPraticaSelected != null) { - Date dateMax = SDF.parse(dateMaxString); - - Calendar calendarMax = Calendar.getInstance(); calendarMax.setTime(dateMax); calendarMax.set(Calendar.HOUR_OF_DAY, 23); dateMax = calendarMax.getTime(); - List orgs = new ArrayList(); orgs = OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); - int numeroPraticheDaAssegnareColumn = 0; int numeroPraticheDaApprovareColumn = 0; - - int numPraticheOrdInIstruttoriaTecnico = 0; int numPraticheOrdInAttesaIntegrazione = 0; - - int numPraticheInScadenzaInIstruttoriaTecnico = 0; int numPraticheInScadenzaInAttesaIntegrazione = 0; - int numPraticheScaduteInIstruttoriaTecnico = 0; int numPraticheScaduteInAttesaIntegrazione = 0; - int totPraticheAperteFinePeriodo=0; + int totPraticheAperteFinePeriodo = 0; int numeroPraticheDaAssegnareColumnTOTALE = 0; int numeroPraticheDaApprovareColumnTOTALE = 0; int numPraticheOrdInIstruttoriaTecnicoTOTALE = 0; @@ -146,71 +146,44 @@ public class ReportScadenzarioIstruttorie implements PortosReportInterface { int numPraticheInScadenzaInAttesaIntegrazioneTOTALE = 0; int numPraticheScaduteInIstruttoriaTecnicoTOTALE = 0; int numPraticheScaduteInAttesaIntegrazioneTOTALE = 0; - for (Organization org : orgs) { if (org.getParentOrganization() != null) { long groupId = org.getGroup().getGroupId(); - - Map dbResult=ReportEngineServiceUtil.praticheAperte(dateMax,groupId,tipoPraticaSelected); - - numPraticheOrdInIstruttoriaTecnico=dbResult.get("numPraticheOrdInIstruttoriaTecnico"); - numPraticheOrdInAttesaIntegrazione=dbResult.get("numPraticheOrdInAttesaIntegrazione"); - - numPraticheInScadenzaInIstruttoriaTecnico=dbResult.get("numPraticheInScadenzaInIstruttoriaTecnico"); - numPraticheInScadenzaInAttesaIntegrazione=dbResult.get("numPraticheInScadenzaInAttesaIntegrazione"); - - numPraticheScaduteInIstruttoriaTecnico=dbResult.get("numPraticheScaduteInIstruttoriaTecnico"); - numPraticheScaduteInAttesaIntegrazione=dbResult.get("numPraticheScaduteInAttesaIntegrazione"); - - + Map dbResult = ReportEngineServiceUtil.praticheAperte(dateMax, groupId, + tipoPraticaSelected); + numPraticheOrdInIstruttoriaTecnico = dbResult.get("numPraticheOrdInIstruttoriaTecnico"); + numPraticheOrdInAttesaIntegrazione = dbResult.get("numPraticheOrdInAttesaIntegrazione"); + numPraticheInScadenzaInIstruttoriaTecnico = dbResult + .get("numPraticheInScadenzaInIstruttoriaTecnico"); + numPraticheInScadenzaInAttesaIntegrazione = dbResult + .get("numPraticheInScadenzaInAttesaIntegrazione"); + numPraticheScaduteInIstruttoriaTecnico = dbResult.get("numPraticheScaduteInIstruttoriaTecnico"); + numPraticheScaduteInAttesaIntegrazione = dbResult.get("numPraticheScaduteInAttesaIntegrazione"); totPraticheAperteFinePeriodo += dbResult.get("totPraticheAperteFinePeriodo"); - numeroPraticheDaAssegnareColumnTOTALE += numeroPraticheDaAssegnareColumn; numeroPraticheDaApprovareColumnTOTALE += numeroPraticheDaApprovareColumn; - numPraticheOrdInIstruttoriaTecnicoTOTALE += numPraticheOrdInIstruttoriaTecnico; numPraticheOrdInAttesaIntegrazioneTOTALE += numPraticheOrdInAttesaIntegrazione; numPraticheInScadenzaInIstruttoriaTecnicoTOTALE += numPraticheInScadenzaInIstruttoriaTecnico; numPraticheInScadenzaInAttesaIntegrazioneTOTALE += numPraticheInScadenzaInAttesaIntegrazione; numPraticheScaduteInIstruttoriaTecnicoTOTALE += numPraticheScaduteInIstruttoriaTecnico; numPraticheScaduteInAttesaIntegrazioneTOTALE += numPraticheScaduteInAttesaIntegrazione; - - dataSource.add(org.getName(), - numeroPraticheDaAssegnareColumn, - numeroPraticheDaApprovareColumn, - - numPraticheOrdInIstruttoriaTecnico, - numPraticheOrdInAttesaIntegrazione, - - numPraticheInScadenzaInIstruttoriaTecnico, - numPraticheInScadenzaInAttesaIntegrazione, - numPraticheScaduteInIstruttoriaTecnico, - numPraticheScaduteInAttesaIntegrazione); - + dataSource.add(org.getName(), numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, + numPraticheOrdInIstruttoriaTecnico, numPraticheOrdInAttesaIntegrazione, + numPraticheInScadenzaInIstruttoriaTecnico, numPraticheInScadenzaInAttesaIntegrazione, + numPraticheScaduteInIstruttoriaTecnico, numPraticheScaduteInAttesaIntegrazione); } } - - _log.info("totPraticheAperteFinePeriodo= " + totPraticheAperteFinePeriodo); - dataSource.add("TOTALI", - numeroPraticheDaAssegnareColumnTOTALE, - numeroPraticheDaApprovareColumnTOTALE, - numPraticheOrdInIstruttoriaTecnicoTOTALE, - numPraticheOrdInAttesaIntegrazioneTOTALE, + dataSource.add("TOTALI", numeroPraticheDaAssegnareColumnTOTALE, numeroPraticheDaApprovareColumnTOTALE, + numPraticheOrdInIstruttoriaTecnicoTOTALE, numPraticheOrdInAttesaIntegrazioneTOTALE, numPraticheInScadenzaInIstruttoriaTecnicoTOTALE, - numPraticheInScadenzaInAttesaIntegrazioneTOTALE, - numPraticheScaduteInIstruttoriaTecnicoTOTALE, - numPraticheScaduteInAttesaIntegrazioneTOTALE - ); + numPraticheInScadenzaInAttesaIntegrazioneTOTALE, numPraticheScaduteInIstruttoriaTecnicoTOTALE, + numPraticheScaduteInAttesaIntegrazioneTOTALE); } - } catch (SystemException e) { - _log.error(e, e); - } catch (PortalException e) { - _log.error(e, e); - } catch (ParseException e) { + } catch (ParseException | PortalException | SystemException e) { _log.error(e, e); } - return dataSource; } @@ -221,41 +194,38 @@ public class ReportScadenzarioIstruttorie implements PortosReportInterface { @Override public List getSearchFields() { - List listaFields = new ArrayList(); + List listaFields = new ArrayList(); listaFields.add(new PortosSearchTermsReport(1, FieldType.DATE, "dateMax")); - List lista = new ArrayList<>(); lista.add("Autorizzazioni"); lista.add("Depositi a controllo obbligatorio"); lista.add("Sanatorie"); - listaFields.add(new PortosSearchTermsReport(3, FieldType.SELECT, "tipologiaPratica", lista)); - return listaFields; } @Override public boolean isCVSEnabled() { + return true; } @Override public boolean isPDFEnabled() { + return false; } @Override public boolean isExcelEnabled() { + return true; } @Override public boolean isWordEnabled() { + return false; } - - // - - -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java index 3ef14288..4948b61f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java @@ -1,11 +1,9 @@ package it.tref.portos.report.engine; -import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.portos.report.engine.PortosSearchTermsReport.FieldType; import it.tref.portos.report.engine.annotation.PortosReport; import it.tref.portos.report.engine.template.TemplatesADV; import it.tref.portos.report.engine.util.ReportEngineServiceUtil; -import it.tref.portos.report.engine.util.ReportTempisticheBean; import java.io.ByteArrayOutputStream; import java.text.ParseException; @@ -13,10 +11,8 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; @@ -36,193 +32,166 @@ import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.ParamUtil; +import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.model.Organization; import com.liferay.portal.service.OrganizationLocalServiceUtil; -//Task 33557 @PortosReport public class ReportTempisticheIstruttorie implements PortosReportInterface { private static Log _log = LogFactoryUtil.getLog(ReportTempisticheIstruttorie.class); - private static final SimpleDateFormat SDF = new SimpleDateFormat("dd/MM/yyyy"); - + private static final SimpleDateFormat SDF = new SimpleDateFormat("dd/MM/yyyy"); + private static final String nota1 = "(1): somma dei tempi di istruttoria della pratica da parte dei tecnici della sismica (prima istruttoria e istruttoria delle integrazioni)"; private static final String nota2 = "(2): durata in giorni, tra l'inizio del procedimento e la conclusione del procedimento, ovvero durata dell'istruttoria e dei tempi di trasmissione delle integrazioni richieste"; - + @Override public String generateHTML(HttpServletRequest httpServletRequest) { - String html = ""; - - try { - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - - JasperHtmlExporterBuilder htmlExporter = DynamicReports.export.htmlExporter(bos).setIgnoreHyperLink(true); - - JasperReportBuilder builder = generateReport(httpServletRequest); - builder.pageFooter(DynamicReports.cmp.pageNumber().setStyle(TemplatesADV.boldCenteredStyle)); - builder.toHtml(htmlExporter); - - byte[] byteArray = bos.toByteArray(); - html = new String(byteArray); - - } catch (DRException e) { - _log.error(e, e); - } - return html; + String html = StringPool.BLANK; + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + JasperHtmlExporterBuilder htmlExporter = DynamicReports.export.htmlExporter(bos).setIgnoreHyperLink(true); + JasperReportBuilder builder = generateReport(httpServletRequest); + builder.pageFooter(DynamicReports.cmp.pageNumber().setStyle(TemplatesADV.boldCenteredStyle)); + builder.toHtml(htmlExporter); + byte[] byteArray = bos.toByteArray(); + html = new String(byteArray); + } catch (DRException e) { + _log.error(e, e); + } + return html; } @Override public JasperReportBuilder generateReport(HttpServletRequest request) { + String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null); - - TextColumnBuilder presidioColumn = - DynamicReports.col.column("Presidio", "presidio", DynamicReports.type.stringType()); - TextColumnBuilder numeroPraticheTotaliColumn = - DynamicReports.col.column("N° Pratiche Totali", "numeroPraticheTotaliColumn", DynamicReports.type.integerType()); - - TextColumnBuilder numeroTotaleAutorizzateInScadenzaColumn = - DynamicReports.col.column("Numero Totale", "numeroTotaleAutorizzateInScadenzaColumn", DynamicReports.type.integerType()); - TextColumnBuilder numeroTotaleAutorizzateScaduteColumn = - DynamicReports.col.column("Numero Totale", "numeroTotaleAutorizzateScaduteColumn", DynamicReports.type.integerType()); - - TextColumnBuilder durataMediaIstruttorieInScadenzaColumn = - DynamicReports.col.column("Durata media istruttorie (1)", "durataMediaIstruttorieInScadenzaColumn", DynamicReports.type.floatType()); - TextColumnBuilder durataMediaIstruttorieScaduteColumn = - DynamicReports.col.column("Durata media istruttorie (1)", "durataMediaIstruttorieScaduteColumn", DynamicReports.type.floatType()); - - TextColumnBuilder durataMediaApprovazionePraticaInScadenzaColumn = - DynamicReports.col.column("Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaInScadenzaColumn", DynamicReports.type.floatType()); - TextColumnBuilder durataMediaApprovazionePraticaScaduteColumn = - DynamicReports.col.column("Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaScaduteColumn", DynamicReports.type.floatType()); - - ColumnTitleGroupBuilder titleGroupInScadenza = - DynamicReports.grid.titleGroup(tipoPraticaSelected + " T <= 60 gg", numeroTotaleAutorizzateInScadenzaColumn, durataMediaIstruttorieInScadenzaColumn, durataMediaApprovazionePraticaInScadenzaColumn); - - ColumnTitleGroupBuilder titleGroupScadute = - DynamicReports.grid.titleGroup(tipoPraticaSelected + " T > 60 gg", numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, durataMediaApprovazionePraticaScaduteColumn); - - TextFieldBuilder note1 = - DynamicReports.cmp.text(nota1); - TextFieldBuilder note2 = - DynamicReports.cmp.text(nota2); + TextColumnBuilder presidioColumn = DynamicReports.col.column("Presidio", "presidio", + DynamicReports.type.stringType()); + TextColumnBuilder numeroPraticheTotaliColumn = DynamicReports.col.column("N° Pratiche Totali", + "numeroPraticheTotaliColumn", DynamicReports.type.integerType()); + TextColumnBuilder numeroTotaleAutorizzateInScadenzaColumn = DynamicReports.col.column("Numero Totale", + "numeroTotaleAutorizzateInScadenzaColumn", DynamicReports.type.integerType()); + TextColumnBuilder numeroTotaleAutorizzateScaduteColumn = DynamicReports.col.column("Numero Totale", + "numeroTotaleAutorizzateScaduteColumn", DynamicReports.type.integerType()); + TextColumnBuilder durataMediaIstruttorieInScadenzaColumn = DynamicReports.col.column( + "Durata media istruttorie (1)", "durataMediaIstruttorieInScadenzaColumn", + DynamicReports.type.floatType()); + TextColumnBuilder durataMediaIstruttorieScaduteColumn = DynamicReports.col.column( + "Durata media istruttorie (1)", "durataMediaIstruttorieScaduteColumn", DynamicReports.type.floatType()); + TextColumnBuilder durataMediaApprovazionePraticaInScadenzaColumn = DynamicReports.col.column( + "Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaInScadenzaColumn", + DynamicReports.type.floatType()); + TextColumnBuilder durataMediaApprovazionePraticaScaduteColumn = DynamicReports.col.column( + "Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaScaduteColumn", + DynamicReports.type.floatType()); + ColumnTitleGroupBuilder titleGroupInScadenza = DynamicReports.grid.titleGroup(tipoPraticaSelected + + " T <= 60 gg", numeroTotaleAutorizzateInScadenzaColumn, durataMediaIstruttorieInScadenzaColumn, + durataMediaApprovazionePraticaInScadenzaColumn); + ColumnTitleGroupBuilder titleGroupScadute = DynamicReports.grid.titleGroup(tipoPraticaSelected + " T > 60 gg", + numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, + durataMediaApprovazionePraticaScaduteColumn); + TextFieldBuilder note1 = DynamicReports.cmp.text(nota1); + TextFieldBuilder note2 = DynamicReports.cmp.text(nota2); note1.setStyle(DynamicReports.stl.style(TemplatesADV.rootStyle).setFontSize(6)); note2.setStyle(DynamicReports.stl.style(TemplatesADV.rootStyle).setFontSize(6)); - - JasperReportBuilder builder = - DynamicReports.report().setTemplate(TemplatesADV.reportTemplate) - .pageFooter(note1, note2) - .columnGrid(presidioColumn, numeroPraticheTotaliColumn, titleGroupInScadenza, titleGroupScadute) - .columns(presidioColumn, numeroPraticheTotaliColumn - , numeroTotaleAutorizzateInScadenzaColumn, durataMediaIstruttorieInScadenzaColumn, durataMediaApprovazionePraticaInScadenzaColumn - , numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, durataMediaApprovazionePraticaScaduteColumn) - .setDataSource(createDataSource(request)).addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true");; - + JasperReportBuilder builder = DynamicReports + .report() + .setTemplate(TemplatesADV.reportTemplate) + .pageFooter(note1, note2) + .columnGrid(presidioColumn, numeroPraticheTotaliColumn, titleGroupInScadenza, titleGroupScadute) + .columns(presidioColumn, numeroPraticheTotaliColumn, numeroTotaleAutorizzateInScadenzaColumn, + durataMediaIstruttorieInScadenzaColumn, durataMediaApprovazionePraticaInScadenzaColumn, + numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, + durataMediaApprovazionePraticaScaduteColumn).setDataSource(createDataSource(request)) + .addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true"); return builder; } private JRDataSource createDataSource(HttpServletRequest request) { - DRDataSource dataSource = - new DRDataSource("presidio", "numeroPraticheTotaliColumn" - , "numeroTotaleAutorizzateInScadenzaColumn", "durataMediaIstruttorieInScadenzaColumn", "durataMediaApprovazionePraticaInScadenzaColumn" - , "numeroTotaleAutorizzateScaduteColumn", "durataMediaIstruttorieScaduteColumn", "durataMediaApprovazionePraticaScaduteColumn"); - + + DRDataSource dataSource = new DRDataSource("presidio", "numeroPraticheTotaliColumn", + "numeroTotaleAutorizzateInScadenzaColumn", "durataMediaIstruttorieInScadenzaColumn", + "durataMediaApprovazionePraticaInScadenzaColumn", "numeroTotaleAutorizzateScaduteColumn", + "durataMediaIstruttorieScaduteColumn", "durataMediaApprovazionePraticaScaduteColumn"); try { String dateMinString = ParamUtil.getString(request, "dateMin", null); String dateMaxString = ParamUtil.getString(request, "dateMax", null); String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null); - if (dateMinString != null && dateMaxString != null && tipoPraticaSelected != null) { - Date dateMin = SDF.parse(dateMinString); Date dateMax = SDF.parse(dateMaxString); - Calendar calendarMin = Calendar.getInstance(); calendarMin.setTime(dateMin); calendarMin.set(Calendar.HOUR_OF_DAY, 1); - dateMin = calendarMin.getTime(); - + dateMin = calendarMin.getTime(); Calendar calendarMax = Calendar.getInstance(); calendarMax.setTime(dateMax); calendarMax.set(Calendar.HOUR_OF_DAY, 23); dateMax = calendarMax.getTime(); - List orgs = new ArrayList(); orgs = OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); - - int numeroPraticheTotaliTotale = 0; - int numeroTotaleAutorizzateInScadenzaTotale = 0; - float durataMediaIstruttorieInScadenzaTotale = 0; - float durataMediaApprovazionePraticaInScadenzaTotale = 0; - int numeroTotaleAutorizzateScaduteTotale = 0; - float durataMediaIstruttorieScaduteTotale = 0; - float durataMediaApprovazionePraticaScaduteTotale = 0; - int countOrganization = 0; + int numeroPraticheTotaliTotale = 0; + int numeroTotaleAutorizzateInScadenzaTotale = 0; + float durataMediaIstruttorieInScadenzaTotale = 0; + float durataMediaApprovazionePraticaInScadenzaTotale = 0; + int numeroTotaleAutorizzateScaduteTotale = 0; + float durataMediaIstruttorieScaduteTotale = 0; + float durataMediaApprovazionePraticaScaduteTotale = 0; int countOrganizationPraticheInScadenza = 0; int countOrganizationPraticheScadute = 0; - for (Organization org : orgs) { if (org.getParentOrganization() != null) { long groupId = org.getGroup().getGroupId(); - - - //Retrieve data from DB - //Map dbResult=elaboraAutorizzazioniNew(dateMin,dateMax,groupId,tipoPraticaSelected); - Map dbResult=ReportEngineServiceUtil.praticheChiuse(dateMin, dateMax, groupId, tipoPraticaSelected); - - - int numeroPraticheTotali =dbResult.get("count").intValue(); - int numeroTotaleAutorizzateInScadenza = dbResult.get("countOrdinarie").intValue(); + Map dbResult = ReportEngineServiceUtil.praticheChiuse(dateMin, dateMax, groupId, + tipoPraticaSelected); + int numeroPraticheTotali = dbResult.get("count").intValue(); + int numeroTotaleAutorizzateInScadenza = dbResult.get("countOrdinarie").intValue(); int numeroTotaleAutorizzateScadute = dbResult.get("countScadute").intValue(); - - float durataMediaIstruttorieInScadenza =dbResult.get("countOrdinarie")>0? dbResult.get("giorniTotOrdinarieIstruttorie")/dbResult.get("countOrdinarie"):0; - float durataMediaApprovazionePraticaInScadenza =dbResult.get("countOrdinarie")>0? dbResult.get("giorniTotOrdinarieApprovazioni")/dbResult.get("countOrdinarie"):0; - - float durataMediaIstruttorieScadute = dbResult.get("countScadute")>0?dbResult.get("giorniTotScaduteIstruttorie")/dbResult.get("countScadute"):0; - float durataMediaApprovazionePraticaScadute =dbResult.get("countScadute")>0?dbResult.get("giorniTotScaduteApprovazioni")/dbResult.get("countScadute"):0; - - dataSource.add(org.getName(), numeroPraticheTotali - , numeroTotaleAutorizzateInScadenza, durataMediaIstruttorieInScadenza, durataMediaApprovazionePraticaInScadenza - , numeroTotaleAutorizzateScadute, durataMediaIstruttorieScadute, durataMediaApprovazionePraticaScadute); - - numeroPraticheTotaliTotale+=numeroPraticheTotali; - numeroTotaleAutorizzateInScadenzaTotale+=numeroTotaleAutorizzateInScadenza; - numeroTotaleAutorizzateScaduteTotale+=numeroTotaleAutorizzateScadute; - durataMediaApprovazionePraticaInScadenzaTotale+=durataMediaApprovazionePraticaInScadenza; - durataMediaApprovazionePraticaScaduteTotale+=durataMediaApprovazionePraticaScadute; - durataMediaIstruttorieInScadenzaTotale+=durataMediaIstruttorieInScadenza; - durataMediaIstruttorieScaduteTotale+=durataMediaIstruttorieScadute; - - - if (numeroTotaleAutorizzateInScadenza>0) - countOrganizationPraticheInScadenza++; - if (numeroTotaleAutorizzateScadute>0) - countOrganizationPraticheScadute++; - - - countOrganization++; + float durataMediaIstruttorieInScadenza = dbResult.get("countOrdinarie") > 0 ? dbResult + .get("giorniTotOrdinarieIstruttorie") / dbResult.get("countOrdinarie") : 0; + float durataMediaApprovazionePraticaInScadenza = dbResult.get("countOrdinarie") > 0 ? dbResult + .get("giorniTotOrdinarieApprovazioni") / dbResult.get("countOrdinarie") : 0; + float durataMediaIstruttorieScadute = dbResult.get("countScadute") > 0 ? dbResult + .get("giorniTotScaduteIstruttorie") / dbResult.get("countScadute") : 0; + float durataMediaApprovazionePraticaScadute = dbResult.get("countScadute") > 0 ? dbResult + .get("giorniTotScaduteApprovazioni") / dbResult.get("countScadute") : 0; + dataSource.add(org.getName(), numeroPraticheTotali, numeroTotaleAutorizzateInScadenza, + durataMediaIstruttorieInScadenza, durataMediaApprovazionePraticaInScadenza, + numeroTotaleAutorizzateScadute, durataMediaIstruttorieScadute, + durataMediaApprovazionePraticaScadute); + numeroPraticheTotaliTotale += numeroPraticheTotali; + numeroTotaleAutorizzateInScadenzaTotale += numeroTotaleAutorizzateInScadenza; + numeroTotaleAutorizzateScaduteTotale += numeroTotaleAutorizzateScadute; + durataMediaApprovazionePraticaInScadenzaTotale += durataMediaApprovazionePraticaInScadenza; + durataMediaApprovazionePraticaScaduteTotale += durataMediaApprovazionePraticaScadute; + durataMediaIstruttorieInScadenzaTotale += durataMediaIstruttorieInScadenza; + durataMediaIstruttorieScaduteTotale += durataMediaIstruttorieScadute; + if (numeroTotaleAutorizzateInScadenza > 0) { + countOrganizationPraticheInScadenza++; + } + if (numeroTotaleAutorizzateScadute > 0) { + countOrganizationPraticheScadute++; + } } } - - dataSource.add("TOTALI", numeroPraticheTotaliTotale, numeroTotaleAutorizzateInScadenzaTotale, - countOrganizationPraticheInScadenza>0?durataMediaIstruttorieInScadenzaTotale/countOrganizationPraticheInScadenza:0, - countOrganizationPraticheInScadenza>0?durataMediaApprovazionePraticaInScadenzaTotale/countOrganizationPraticheInScadenza:0, - numeroTotaleAutorizzateScaduteTotale, - countOrganizationPraticheScadute>0?durataMediaIstruttorieScaduteTotale/countOrganizationPraticheScadute:0, - countOrganizationPraticheScadute>0?durataMediaApprovazionePraticaScaduteTotale/countOrganizationPraticheScadute:0); + dataSource.add("TOTALI", numeroPraticheTotaliTotale, numeroTotaleAutorizzateInScadenzaTotale, + countOrganizationPraticheInScadenza > 0 ? durataMediaIstruttorieInScadenzaTotale + / countOrganizationPraticheInScadenza : 0, + countOrganizationPraticheInScadenza > 0 ? durataMediaApprovazionePraticaInScadenzaTotale + / countOrganizationPraticheInScadenza : 0, numeroTotaleAutorizzateScaduteTotale, + countOrganizationPraticheScadute > 0 ? durataMediaIstruttorieScaduteTotale + / countOrganizationPraticheScadute : 0, + countOrganizationPraticheScadute > 0 ? durataMediaApprovazionePraticaScaduteTotale + / countOrganizationPraticheScadute : 0); } - } catch (SystemException e) { - _log.error(e, e); - } catch (PortalException e) { - _log.error(e, e); - } catch (ParseException e) { + } catch (ParseException | PortalException | SystemException e) { _log.error(e, e); } - return dataSource; } - + @Override public String getTitle() { return "Report Tempistiche Istruttorie"; @@ -230,40 +199,40 @@ public class ReportTempisticheIstruttorie implements PortosReportInterface { @Override public List getSearchFields() { - List listaFields = new ArrayList(); - - listaFields.add(new PortosSearchTermsReport(1, FieldType.DATE, "dateMin")); - listaFields.add(new PortosSearchTermsReport(2, FieldType.DATE, "dateMax")); - List lista = new ArrayList<>(); - lista.add("Autorizzazioni"); - lista.add("Depositi a controllo obbligatorio"); - lista.add("Depositi a sorteggio"); - lista.add("Sanatorie"); - - listaFields.add(new PortosSearchTermsReport(3, FieldType.SELECT, "tipologiaPratica", lista)); - - return listaFields; + List listaFields = new ArrayList(); + listaFields.add(new PortosSearchTermsReport(1, FieldType.DATE, "dateMin")); + listaFields.add(new PortosSearchTermsReport(2, FieldType.DATE, "dateMax")); + List lista = new ArrayList<>(); + lista.add("Autorizzazioni"); + lista.add("Depositi a controllo obbligatorio"); + lista.add("Depositi a sorteggio"); + lista.add("Sanatorie"); + listaFields.add(new PortosSearchTermsReport(3, FieldType.SELECT, "tipologiaPratica", lista)); + return listaFields; } @Override public boolean isCVSEnabled() { + return true; } @Override public boolean isPDFEnabled() { + return false; } @Override public boolean isExcelEnabled() { + return true; } @Override public boolean isWordEnabled() { + return false; - } - -} + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java index eef2d839..a6e4d87f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java @@ -12,8 +12,6 @@ import java.util.Locale; import javax.servlet.http.HttpServletRequest; -import com.liferay.portal.kernel.util.ParamUtil; - import net.sf.dynamicreports.report.base.expression.AbstractValueFormatter; import net.sf.dynamicreports.report.builder.HyperLinkBuilder; import net.sf.dynamicreports.report.builder.ReportTemplateBuilder; @@ -28,177 +26,148 @@ import net.sf.dynamicreports.report.constant.SplitType; import net.sf.dynamicreports.report.constant.VerticalTextAlignment; import net.sf.dynamicreports.report.definition.ReportParameters; +import com.liferay.portal.kernel.util.ParamUtil; +import com.liferay.portal.kernel.util.StringPool; + public class TemplatesADV { - public static final StyleBuilder rootStyle; - public static final StyleBuilder rootCenterStyle; - - public static final StyleBuilder boldStyle; - - public static final StyleBuilder italicStyle; - public static final StyleBuilder boldCenteredStyle; - public static final StyleBuilder bold11CenteredStyle; - public static final StyleBuilder bold15CenteredStyle; - public static final StyleBuilder columnStyle; - public static final StyleBuilder columnTitleStyle; - public static final StyleBuilder groupStyle; - public static final StyleBuilder subtotalStyle; - - - public static final ReportTemplateBuilder reportTemplate; - public static final CurrencyType currencyType; - public static final ComponentBuilder dynamicReportsComponent; - public static final ComponentBuilder footerComponent; - - static { - BorderBuilder border = stl.border(); - border.setBottomPen(stl.penThin().setLineColor(new Color(129, 33, 33))) - .setLeftPen(stl.penThin().setLineColor(new Color(129, 33, 33))) - .setTopPen(stl.penThin().setLineColor(new Color(129, 33, 33))) - .setRightPen(stl.penThin().setLineColor(new Color(129, 33, 33))); - - rootStyle = stl.style().setPadding(2).setFontSize(7); - rootCenterStyle = - stl.style(rootStyle).setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE); - - boldStyle = stl.style(rootStyle).bold().setFontSize(7); - italicStyle = stl.style(rootStyle).italic().setFontSize(7); - boldCenteredStyle = - stl.style(boldStyle).setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE) - .setFontSize(7); - bold11CenteredStyle = stl.style(boldCenteredStyle).setFontSize(11).setForegroundColor(new Color(129, 33, 33)); - bold15CenteredStyle = stl.style(boldCenteredStyle).setFontSize(15).setForegroundColor(new Color(129, 33, 33)); - columnStyle = stl.style(rootCenterStyle).setVerticalTextAlignment(VerticalTextAlignment.TOP).setBorder(border); - columnTitleStyle = - stl.style(columnStyle).setBorder(stl.pen2Point()).setHorizontalTextAlignment(HorizontalTextAlignment.CENTER) - .setBackgroundColor(Color.WHITE).bold().setForegroundColor(new Color(129, 33, 33)).italic(); - groupStyle = stl.style(boldStyle).setHorizontalTextAlignment(HorizontalTextAlignment.LEFT); - subtotalStyle = stl.style(boldStyle).setTopBorder(stl.pen1Point()); - - StyleBuilder crosstabGroupStyle = stl.style(columnTitleStyle); - StyleBuilder crosstabGroupTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(170, 170, 170)); - StyleBuilder crosstabGrandTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(140, 140, 140)); - StyleBuilder crosstabCellStyle = stl.style(columnStyle).setBorder(stl.pen1Point()); - TableOfContentsCustomizerBuilder tableOfContentsCustomizer = - tableOfContentsCustomizer().setHeadingStyle(0, stl.style(rootStyle).bold()); - - reportTemplate = - template().setLocale(Locale.ENGLISH).setColumnStyle(columnStyle).setColumnTitleStyle(columnTitleStyle) - .setGroupStyle(groupStyle).setGroupTitleStyle(groupStyle).setSubtotalStyle(subtotalStyle) - .highlightDetailEvenRows().crosstabHighlightEvenRows().setCrosstabGroupStyle(crosstabGroupStyle) - .setCrosstabGroupTotalStyle(crosstabGroupTotalStyle).setCrosstabGrandTotalStyle(crosstabGrandTotalStyle) - .setCrosstabCellStyle(crosstabCellStyle).setTableOfContentsCustomizer(tableOfContentsCustomizer) - .setDefaultSplitType(SplitType.PREVENT).setDetailSplitType(SplitType.PREVENT); - currencyType = new CurrencyType(); - - HyperLinkBuilder link = hyperLink(""); - - dynamicReportsComponent = - cmp.horizontalList( - // cmp.image(TemplatesADV.class.getResource("images/aaa.png")).setFixedDimension(60, 60), - cmp.verticalList( - cmp.text("GENIO CIVILE").setStyle(bold15CenteredStyle) - .setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text("").setStyle(italicStyle) - .setHyperLink(link))).setFixedWidth(300); - footerComponent = cmp.pageXofY().setStyle(stl.style(boldCenteredStyle).setTopBorder(stl.pen1Point())); - - } - - /** - * - * Creates custom component which is possible to add to any report band component - */ - - public static ComponentBuilder createTitleComponent(String label) { - HorizontalListBuilder horizontalListBuilder = cmp.horizontalList(); - horizontalListBuilder.add(dynamicReportsComponent, cmp.text(label).setStyle(bold15CenteredStyle) - .setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT)); - horizontalListBuilder.newRow(); - return horizontalListBuilder; - - } - - - /** - * ADT: BUG BO ID=34 – REPORT PRATICHE VIDIMATE - * - * @param label - * @param className - * @param request - * @return - */ - public static ComponentBuilder createTitleComponentNew(String label,String className,HttpServletRequest request) { - - - if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())){ - HorizontalListBuilder horizontalListBuilder = cmp.horizontalList(); - HyperLinkBuilder link = hyperLink(""); - StringBuilder stBuilder=new StringBuilder(); - if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())){ - String dateMinString = ParamUtil.getString(request, "dateMin", null); - String dateMaxString = ParamUtil.getString(request, "dateMax", null); - stBuilder.append("Periodo di Osservazione: dal "); - stBuilder.append(dateMinString); - stBuilder.append(" al "); - stBuilder.append(dateMaxString); - } - ComponentBuilder dynamicReportsComponentNew = - cmp.horizontalList( - // cmp.image(TemplatesADV.class.getResource("images/aaa.png")).setFixedDimension(60, 60), - cmp.verticalList( - cmp.text(stBuilder.toString()).setStyle(bold15CenteredStyle) - .setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text("").setStyle(italicStyle) - .setHyperLink(link))).setFixedWidth(300); - - - horizontalListBuilder.add(dynamicReportsComponentNew, cmp.text(label).setStyle(bold15CenteredStyle) - .setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT)); - horizontalListBuilder.newRow(); - return horizontalListBuilder; - - }else{ - return null; - } - - } - - public static CurrencyValueFormatter createCurrencyValueFormatter(String label) { - return new CurrencyValueFormatter(label); - } - - public static class CurrencyType extends BigDecimalType { - - private static final long serialVersionUID = 1L; - - @Override - public String getPattern() { - return "€ #.###,00"; - } - - } - - private static class CurrencyValueFormatter extends AbstractValueFormatter { - - private static final long serialVersionUID = 1L; - private String label; - - public CurrencyValueFormatter(String label) { - - this.label = label; - - } - - @Override - public String format(Number value, ReportParameters reportParameters) { - return label + currencyType.valueToString(value, reportParameters.getLocale()); - } - - } - - - - - - - -} + public static final StyleBuilder rootStyle; + public static final StyleBuilder rootCenterStyle; + + public static final StyleBuilder boldStyle; + + public static final StyleBuilder italicStyle; + public static final StyleBuilder boldCenteredStyle; + public static final StyleBuilder bold11CenteredStyle; + public static final StyleBuilder bold15CenteredStyle; + public static final StyleBuilder columnStyle; + public static final StyleBuilder columnTitleStyle; + public static final StyleBuilder groupStyle; + public static final StyleBuilder subtotalStyle; + + public static final ReportTemplateBuilder reportTemplate; + public static final CurrencyType currencyType; + public static final ComponentBuilder dynamicReportsComponent; + public static final ComponentBuilder footerComponent; + + static { + BorderBuilder border = stl.border(); + border.setBottomPen(stl.penThin().setLineColor(new Color(129, 33, 33))) + .setLeftPen(stl.penThin().setLineColor(new Color(129, 33, 33))) + .setTopPen(stl.penThin().setLineColor(new Color(129, 33, 33))) + .setRightPen(stl.penThin().setLineColor(new Color(129, 33, 33))); + + rootStyle = stl.style().setPadding(2).setFontSize(7); + rootCenterStyle = stl.style(rootStyle).setTextAlignment(HorizontalTextAlignment.CENTER, + VerticalTextAlignment.MIDDLE); + + boldStyle = stl.style(rootStyle).bold().setFontSize(7); + italicStyle = stl.style(rootStyle).italic().setFontSize(7); + boldCenteredStyle = stl.style(boldStyle) + .setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE).setFontSize(7); + bold11CenteredStyle = stl.style(boldCenteredStyle).setFontSize(11).setForegroundColor(new Color(129, 33, 33)); + bold15CenteredStyle = stl.style(boldCenteredStyle).setFontSize(15).setForegroundColor(new Color(129, 33, 33)); + columnStyle = stl.style(rootCenterStyle).setVerticalTextAlignment(VerticalTextAlignment.TOP).setBorder(border); + columnTitleStyle = stl.style(columnStyle).setBorder(stl.pen2Point()) + .setHorizontalTextAlignment(HorizontalTextAlignment.CENTER).setBackgroundColor(Color.WHITE).bold() + .setForegroundColor(new Color(129, 33, 33)).italic(); + groupStyle = stl.style(boldStyle).setHorizontalTextAlignment(HorizontalTextAlignment.LEFT); + subtotalStyle = stl.style(boldStyle).setTopBorder(stl.pen1Point()); + + StyleBuilder crosstabGroupStyle = stl.style(columnTitleStyle); + StyleBuilder crosstabGroupTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(170, 170, 170)); + StyleBuilder crosstabGrandTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(140, 140, 140)); + StyleBuilder crosstabCellStyle = stl.style(columnStyle).setBorder(stl.pen1Point()); + TableOfContentsCustomizerBuilder tableOfContentsCustomizer = tableOfContentsCustomizer().setHeadingStyle(0, + stl.style(rootStyle).bold()); + + reportTemplate = template().setLocale(Locale.ENGLISH).setColumnStyle(columnStyle) + .setColumnTitleStyle(columnTitleStyle).setGroupStyle(groupStyle).setGroupTitleStyle(groupStyle) + .setSubtotalStyle(subtotalStyle).highlightDetailEvenRows().crosstabHighlightEvenRows() + .setCrosstabGroupStyle(crosstabGroupStyle).setCrosstabGroupTotalStyle(crosstabGroupTotalStyle) + .setCrosstabGrandTotalStyle(crosstabGrandTotalStyle).setCrosstabCellStyle(crosstabCellStyle) + .setTableOfContentsCustomizer(tableOfContentsCustomizer).setDefaultSplitType(SplitType.PREVENT) + .setDetailSplitType(SplitType.PREVENT); + currencyType = new CurrencyType(); + + HyperLinkBuilder link = hyperLink(StringPool.BLANK); + + dynamicReportsComponent = cmp.horizontalList( + cmp.verticalList( + cmp.text("GENIO CIVILE").setStyle(bold15CenteredStyle) + .setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text(StringPool.BLANK) + .setStyle(italicStyle).setHyperLink(link))).setFixedWidth(300); + footerComponent = cmp.pageXofY().setStyle(stl.style(boldCenteredStyle).setTopBorder(stl.pen1Point())); + } + + // Creates custom component which is possible to add to any report band component + public static ComponentBuilder createTitleComponent(String label) { + + HorizontalListBuilder horizontalListBuilder = cmp.horizontalList(); + horizontalListBuilder.add(dynamicReportsComponent, cmp.text(label).setStyle(bold15CenteredStyle) + .setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT)); + horizontalListBuilder.newRow(); + return horizontalListBuilder; + } + + // ADT: BUG BO ID=34 - REPORT PRATICHE VIDIMATE + public static ComponentBuilder createTitleComponentNew(String label, String className, + HttpServletRequest request) { + + if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())) { + HorizontalListBuilder horizontalListBuilder = cmp.horizontalList(); + HyperLinkBuilder link = hyperLink(StringPool.BLANK); + StringBuilder stBuilder = new StringBuilder(); + if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())) { + String dateMinString = ParamUtil.getString(request, "dateMin", null); + String dateMaxString = ParamUtil.getString(request, "dateMax", null); + stBuilder.append("Periodo di Osservazione: dal "); + stBuilder.append(dateMinString); + stBuilder.append(" al "); + stBuilder.append(dateMaxString); + } + ComponentBuilder dynamicReportsComponentNew = cmp.horizontalList( + cmp.verticalList(cmp.text(stBuilder.toString()).setStyle(bold15CenteredStyle) + .setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text(StringPool.BLANK) + .setStyle(italicStyle).setHyperLink(link))).setFixedWidth(300); + horizontalListBuilder.add(dynamicReportsComponentNew, cmp.text(label).setStyle(bold15CenteredStyle) + .setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT)); + horizontalListBuilder.newRow(); + return horizontalListBuilder; + } else { + return null; + } + } + + public static CurrencyValueFormatter createCurrencyValueFormatter(String label) { + + return new CurrencyValueFormatter(label); + } + + public static class CurrencyType extends BigDecimalType { + + private static final long serialVersionUID = 1L; + + @Override + public String getPattern() { + + return "€ #.###,00"; + } + } + + private static class CurrencyValueFormatter extends AbstractValueFormatter { + + private static final long serialVersionUID = 1L; + private String label; + + public CurrencyValueFormatter(String label) { + + this.label = label; + } + + @Override + public String format(Number value, ReportParameters reportParameters) { + return label + currencyType.valueToString(value, reportParameters.getLocale()); + } + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java index a645d8ac..7baf726f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java @@ -6,12 +6,9 @@ import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportResu import it.tref.liferay.portos.report.shared.dto.ReportDto; import it.tref.liferay.portos.report.shared.dto.ReportResultDto; -import java.io.File; -import java.io.FileOutputStream; +import java.io.ByteArrayOutputStream; import java.io.InputStream; -import java.io.OutputStream; import java.io.Serializable; -import java.nio.file.Files; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; @@ -38,9 +35,9 @@ import com.liferay.portal.kernel.messaging.Message; import com.liferay.portal.kernel.messaging.MessageBusUtil; import com.liferay.portal.kernel.repository.model.FileEntry; import com.liferay.portal.kernel.util.ArrayUtil; +import com.liferay.portal.kernel.util.ContentTypes; import com.liferay.portal.kernel.util.MapUtil; import com.liferay.portal.kernel.util.StringPool; -import com.liferay.portal.kernel.util.SystemProperties; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.model.Company; import com.liferay.portal.model.RoleConstants; @@ -56,6 +53,7 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; public class ProtocolloMessageListener extends BaseMessageListener { + private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); private static final Log _log = LogFactoryUtil.getLog(ProtocolloMessageListener.class); @@ -64,10 +62,8 @@ public class ProtocolloMessageListener extends BaseMessageListener { long companyId = message.getLong(ReportConstants.COMPANY_ID); long userId = message.getLong(ReportConstants.USER_ID); - - Map taskContextMap = (Map) message - .get(ReportConstants.PARAMATERS); - + @SuppressWarnings("unchecked") + Map taskContextMap = (Map) message.get(ReportConstants.PARAMATERS); User user = UserLocalServiceUtil.getRoleUsers( RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR).getRoleId()).get(0); try { @@ -75,155 +71,91 @@ public class ProtocolloMessageListener extends BaseMessageListener { } catch (Exception e) { throw new SystemException(e); } - try { - JSONArray jsonArray = JSONFactoryUtil.createJSONArray(MapUtil.getString(taskContextMap, ReportConstants.PARAM_REPORTS)); - JSONObject jsonObject = jsonArray.getJSONObject(0); - ReportDto reportDto = JSONFactoryUtil.looseDeserialize(jsonObject.toString(), ReportDto.class); - - String protocolloToAttach = ""; - long dtPraticaString = 0L; - - String oggetto = ""; + String protocolloToAttach = StringPool.BLANK; + long dtPraticaLong = 0L; + String oggetto = StringPool.BLANK; if (reportDto.getParameters() != null) { protocolloToAttach = (String) reportDto.getParameters().get("protocollo"); - dtPraticaString = (Long) reportDto.getParameters().get("dtProtocollo"); + dtPraticaLong = (Long) reportDto.getParameters().get("dtProtocollo"); oggetto = (String) reportDto.getParameters().get("oggetto"); } - - Date dtPratica = new Date(dtPraticaString); - - protocolloToAttach = finalizzaProtocollazione(companyId, protocolloToAttach, dtPratica); - + protocolloToAttach = finalizzaProtocollazione(companyId, protocolloToAttach, new Date(dtPraticaLong)); long fileEntryId = reportDto.getFileEntryIds()[0]; - FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId); - if (Validator.isNotNull(fileEntry)) { - - InputStream is = fileEntry.getContentStream(); - - byte[] targetArray = new byte[is.available()]; - is.read(targetArray); - - String tempFileNameCopy = System.getProperty(SystemProperties.TMP_DIR) + File.separator - + "copied-files" + System.currentTimeMillis() + ".pdf"; - - File tempFileCopy = new File(tempFileNameCopy); - OutputStream outStreamCopiedFile = new FileOutputStream(tempFileCopy); - outStreamCopiedFile.write(targetArray); - - is.close(); - outStreamCopiedFile.close(); - - String tempFileNameModified = System.getProperty(SystemProperties.TMP_DIR) + File.separator - + "modified-files" + System.currentTimeMillis() + ".pdf"; - - File tempFileModified = new File(tempFileNameModified); - FileOutputStream fileOutputStream = new FileOutputStream(tempFileModified); - - PdfReader reader = new PdfReader(tempFileNameCopy); - PdfStamper stamper = new PdfStamper(reader, fileOutputStream); - + InputStream inputStream = fileEntry.getContentStream(); + byte[] inputBytes = new byte[inputStream.available()]; + inputStream.read(inputBytes); + inputStream.close(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + PdfReader reader = new PdfReader(inputBytes); + PdfStamper stamper = new PdfStamper(reader, outputStream); PdfWriter writer = stamper.getWriter(); - for (int i = 1; i <= reader.getNumberOfPages(); i++) { - PdfContentByte cb = stamper.getOverContent(i); PdfLayer protocollo = new PdfLayer("not printed", writer); protocollo.setOnPanel(false); protocollo.setPrint("Print", false); cb.beginLayer(protocollo); - - Font font = FontFactory.getFont(FontFactory.COURIER, 9.0f); - + Font font = FontFactory.getFont(FontFactory.COURIER, 9.0F); // Gestione stringa protocollo Rectangle pageSize = reader.getPageSize(i); float xProtocollo = pageSize.getWidth() - 8; float yProtocollo = pageSize.getHeight() / 3; - ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(protocolloToAttach, font), xProtocollo, yProtocollo, 90); - - // Gestion stringa oggetto + // Gestione stringa oggetto float xOggetto = pageSize.getWidth() - 8; float yOggetto = pageSize.getHeight() - 30; - if (oggetto != null) { if (oggetto.length() >= 75) { oggetto = oggetto.substring(0, 75); } } else { - oggetto = ""; + oggetto = StringPool.BLANK; } - - ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(oggetto, font), xOggetto, - yOggetto, 90); - + ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(oggetto, font), xOggetto, yOggetto, + 90); cb.endLayer(); } - stamper.close(); reader.close(); - + byte[] outputBytes = outputStream.toByteArray(); + outputStream.close(); ServiceContext serviceContext = new ServiceContext(); serviceContext.setUserId(userId); serviceContext.setCompanyId(companyId); - - byte[] newFilesBytes = Files.readAllBytes(tempFileModified.toPath()); - - fileOutputStream.close(); - - tempFileCopy.delete(); - tempFileModified.delete(); - - // ADT: BUG BO ID=28 FileEntry newFileEntry = null; try { newFileEntry = DLAppLocalServiceUtil.addFileEntry(userId, fileEntry.getRepositoryId(), - fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", "application/pdf", - reportDto.getFileName(), "", "", newFilesBytes, serviceContext); - + fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", ContentTypes.APPLICATION_PDF, + reportDto.getFileName(), StringPool.BLANK, StringPool.BLANK, outputBytes, serviceContext); } catch (DuplicateFileException e) { - FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), - fileEntry.getFolderId(), reportDto.getFileName()); - // DLAppLocalServiceUtil.deleteFileEntry(fe.getFileEntryId()); + FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), fileEntry.getFolderId(), + reportDto.getFileName()); _log.info("File duplicato : " + fe.getFileEntryId()); return; } - - tempFileCopy.delete(); - tempFileModified.delete(); - if (Validator.isNotNull(newFileEntry)) { - long[] fileEntryIds = new long[0]; fileEntryIds = ArrayUtil.append(fileEntryIds, newFileEntry.getFileEntryId()); - - ReportResultDto dto = new ReportResultDto(0L, fileEntryIds, - ReportResult.SUCCESSFUL.toString(), null); - + ReportResultDto dto = new ReportResultDto(0L, fileEntryIds, ReportResult.SUCCESSFUL.toString(), + null); Message responseMessage = MessageBusUtil.createResponseMessage(message); responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto)); - MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage); } - } - } catch (Exception e) { - _log.error(e, e); - ReportResultDto dto = new ReportResultDto(0L, null, ReportResult.FAILED.toString(), - e.getMessage()); - + ReportResultDto dto = new ReportResultDto(0L, null, ReportResult.FAILED.toString(), e.getMessage()); Message responseMessage = MessageBusUtil.createResponseMessage(message); responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto)); - MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage); } } @@ -231,8 +163,6 @@ public class ProtocolloMessageListener extends BaseMessageListener { private String finalizzaProtocollazione(long companyId, String protocollo, Date dtProtocollo) throws SystemException { - SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - Company company = CompanyLocalServiceUtil.fetchCompany(companyId); StringBuilder sb = new StringBuilder(); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties index 445d75cb..2baf9c4f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_rep - build.number=26 - build.date=1611761568046 + build.number=27 + build.date=1618480427939 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java index 3630f4eb..29127700 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java +++ b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java @@ -3,9 +3,7 @@ package it.tref.liferay.portos.bo.shared.util; public class ConfigurazioneConstants { public static final String TEMPLATE_FOLDER_ID = "conf.geniocivile.template.folder.id"; - public static final String ATTACHMENT_FOLDER_ID = "conf.geniocivile.attachment.folder.id"; - public static final String MANUAL_AVVISO_FOLDER_ID = "conf.geniocivile.avviso.folder.id.manual"; public static final String DIGITAL_SIGNATURE_SERVICE_ADDRESS_SIGN = "conf.geniocivile.digitalSignature.serviceAddressSign"; diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp index 48c59cc2..868ec17c 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp @@ -19,6 +19,7 @@ <%@ include file="/html/portlet/workflow_tasks/init.jsp"%> <% String classPkForCarichiLavoro = (String) renderRequest.getAttribute("classPkForCarichiLavoro"); +boolean hasFileUpload = false; %>
@@ -44,7 +45,6 @@ String redirect = StringPool.BLANK; DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getDDMStructure(ddmStructureId); Fields fields = null; String languageId = themeDisplay.getLanguageId(); -boolean translating = false; long classNameId = PortalUtil.getClassNameId(DDMStructure.class); long classPK = ddmStructure.getStructureId(); if (ddmTemplateId > 0) { @@ -72,18 +72,24 @@ for (Entry>> entry : fieldNameOptions.ent if ((name.equals("istruttore") && value.equalsIgnoreCase(istruttore)) || MapUtil.getBoolean(option, "default")) { select += " selected=\"selected\""; } - select += StringPool.GREATER_THAN + HtmlUtil.escape(option.get("label").toString()) + "\n"; } html = html.replaceAll(regexSelect, "$1" + select + "\n" + "$3"); } else { String regexInput = "(?s)]+).*?"; for (Map option : entry.getValue()) { + for (Entry x : option.entrySet()) { + System.out.println(x.getKey() + " = " + x.getValue()); + } String value = option.get("value").toString(); String replaceInput = ""; html = html.replaceFirst(regexInput, replaceInput); } @@ -98,5 +104,39 @@ for (Entry p : parameters.entrySet()) { // Rimozione valori non utilizzati html = html.replaceAll("(?s)]*?value=\"Value[0-9]\"[^>]*>.*?", ""); html = html.replaceAll("(?s)]*>[ \t\r\n]*", StringPool.BLANK); +if (hasFileUpload) { + String replace = + "$1
" + + ""; + System.out.println(replace); + html = html.replaceAll("(?s)(]*? data-fieldName=\"testo_del_documento\".*?
)", replace); +} %> <%= html %> \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java index 505ed344..b8984182 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java @@ -168,6 +168,7 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { String transitionName = ParamUtil.getString(actionRequest, "transitionName"); String comment = ParamUtil.getString(actionRequest, "comment"); boolean aggiorna = true; + aggiorna = false; // ADT: bug mancata problema assegnazione WF checkPresenzaIstruttore(transitionName, workflowTaskId); // ADT: BUG ANOMALIA REGISTRA ESITO diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/RenderFormTaskPortletAction.java b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/RenderFormTaskPortletAction.java index a218a112..2a7a51fe 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/RenderFormTaskPortletAction.java +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/RenderFormTaskPortletAction.java @@ -217,6 +217,7 @@ public class RenderFormTaskPortletAction extends BaseStrutsPortletAction { optionFields.put("label", LanguageUtil.get(locale, optionJSON.getString("label"))); optionFields.put("value", optionJSON.getString("value")); optionFields.put("default", optionJSON.getBoolean("default")); + optionFields.put("upload", optionJSON.getBoolean("upload")); options.add(optionFields); } fieldNameOptions.put(key, options);