diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalService.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalService.java index f2b7bb74..bdf32b51 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalService.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalService.java @@ -326,9 +326,8 @@ public interface AvvisoLocalService extends BaseLocalService, com.liferay.portal.kernel.exception.SystemException; public it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica( - long intPraticaId, java.lang.String stato, - java.lang.String jsonParameters, long classPk, - java.lang.String className, + long intPraticaId, java.lang.String stato, java.lang.String base64File, + long classPk, java.lang.String className, com.liferay.portal.service.ServiceContext serviceContext, java.lang.String tipoAvviso, java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId) diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceClp.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceClp.java index 373f1afa..1f6c2537 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceClp.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceClp.java @@ -1332,9 +1332,8 @@ public class AvvisoLocalServiceClp implements AvvisoLocalService { @Override public it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica( - long intPraticaId, java.lang.String stato, - java.lang.String jsonParameters, long classPk, - java.lang.String className, + long intPraticaId, java.lang.String stato, java.lang.String base64File, + long classPk, java.lang.String className, com.liferay.portal.service.ServiceContext serviceContext, java.lang.String tipoAvviso, java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId) @@ -1350,7 +1349,7 @@ public class AvvisoLocalServiceClp implements AvvisoLocalService { ClpSerializer.translateInput(stato), - ClpSerializer.translateInput(jsonParameters), + ClpSerializer.translateInput(base64File), classPk, diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceUtil.java index 9644a4ce..04e437b7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceUtil.java @@ -365,9 +365,8 @@ public class AvvisoLocalServiceUtil { } public static it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica( - long intPraticaId, java.lang.String stato, - java.lang.String jsonParameters, long classPk, - java.lang.String className, + long intPraticaId, java.lang.String stato, java.lang.String base64File, + long classPk, java.lang.String className, com.liferay.portal.service.ServiceContext serviceContext, java.lang.String tipoAvviso, java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId) @@ -375,7 +374,7 @@ public class AvvisoLocalServiceUtil { com.liferay.portal.kernel.exception.SystemException { return getService() .createStandardAvvisoPratica(intPraticaId, stato, - jsonParameters, classPk, className, serviceContext, tipoAvviso, + base64File, classPk, className, serviceContext, tipoAvviso, userCodiceFiscalePrimaFirma, controlloPraticaId); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceWrapper.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceWrapper.java index ef5362ae..e05fbf04 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceWrapper.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceWrapper.java @@ -375,17 +375,16 @@ public class AvvisoLocalServiceWrapper implements AvvisoLocalService, @Override public it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica( - long intPraticaId, java.lang.String stato, - java.lang.String jsonParameters, long classPk, - java.lang.String className, + long intPraticaId, java.lang.String stato, java.lang.String base64File, + long classPk, java.lang.String className, com.liferay.portal.service.ServiceContext serviceContext, java.lang.String tipoAvviso, java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException { return _avvisoLocalService.createStandardAvvisoPratica(intPraticaId, - stato, jsonParameters, classPk, className, serviceContext, - tipoAvviso, userCodiceFiscalePrimaFirma, controlloPraticaId); + stato, base64File, classPk, className, serviceContext, tipoAvviso, + userCodiceFiscalePrimaFirma, controlloPraticaId); } @Override diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java index ab9f4d24..5493ce01 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java @@ -365,9 +365,6 @@ public interface ControlloPraticaLocalService extends BaseLocalService, throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException; - /** - * I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione - */ public java.lang.String valutazioneEsitoFinaleUpdateStatoPratica( long controlloPraticaId, java.util.Map workflowContext) @@ -426,10 +423,4 @@ public interface ControlloPraticaLocalService extends BaseLocalService, long controlloPraticaId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException; - - /** - * ADT: gestione workflow varianti - */ - public void gestioneWFVarianti( - it.tref.liferay.portos.bo.model.ControlloPratica cp); } \ 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/service/ControlloPraticaLocalServiceClp.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceClp.java index 791759ef..2d03383a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceClp.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceClp.java @@ -225,12 +225,6 @@ public class ControlloPraticaLocalServiceClp _methodName41 = "calculateDateAvvioProcedimento"; _methodParameterTypes41 = new String[] { "long" }; - - _methodName42 = "gestioneWFVarianti"; - - _methodParameterTypes42 = new String[] { - "it.tref.liferay.portos.bo.model.ControlloPratica" - }; } @Override @@ -1638,27 +1632,6 @@ public class ControlloPraticaLocalServiceClp return (java.lang.Long)ClpSerializer.translateOutput(returnObj); } - @Override - public void gestioneWFVarianti( - it.tref.liferay.portos.bo.model.ControlloPratica cp) { - try { - _invokableLocalService.invokeMethod(_methodName42, - _methodParameterTypes42, - new Object[] { ClpSerializer.translateInput(cp) }); - } - catch (Throwable t) { - t = ClpSerializer.translateThrowable(t); - - if (t instanceof RuntimeException) { - throw (RuntimeException)t; - } - else { - throw new RuntimeException(t.getClass().getName() + - " is not a valid exception"); - } - } - } - private InvokableLocalService _invokableLocalService; private String _methodName0; private String[] _methodParameterTypes0; @@ -1742,6 +1715,4 @@ public class ControlloPraticaLocalServiceClp private String[] _methodParameterTypes40; private String _methodName41; private String[] _methodParameterTypes41; - private String _methodName42; - private String[] _methodParameterTypes42; } \ 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/service/ControlloPraticaLocalServiceUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceUtil.java index 8264c658..656afd2b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceUtil.java @@ -418,9 +418,6 @@ public class ControlloPraticaLocalServiceUtil { getService().updateIstruttore(controlloPraticaId, workflowContext); } - /** - * I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione - */ public static java.lang.String valutazioneEsitoFinaleUpdateStatoPratica( long controlloPraticaId, java.util.Map workflowContext) @@ -506,14 +503,6 @@ public class ControlloPraticaLocalServiceUtil { return getService().calculateDateAvvioProcedimento(controlloPraticaId); } - /** - * ADT: gestione workflow varianti - */ - public static void gestioneWFVarianti( - it.tref.liferay.portos.bo.model.ControlloPratica cp) { - getService().gestioneWFVarianti(cp); - } - public static void clearService() { _service = null; } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java index ba3a1359..a9f284a1 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java @@ -446,9 +446,6 @@ public class ControlloPraticaLocalServiceWrapper workflowContext); } - /** - * I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione - */ @Override public java.lang.String valutazioneEsitoFinaleUpdateStatoPratica( long controlloPraticaId, @@ -538,15 +535,6 @@ public class ControlloPraticaLocalServiceWrapper return _controlloPraticaLocalService.calculateDateAvvioProcedimento(controlloPraticaId); } - /** - * ADT: gestione workflow varianti - */ - @Override - public void gestioneWFVarianti( - it.tref.liferay.portos.bo.model.ControlloPratica cp) { - _controlloPraticaLocalService.gestioneWFVarianti(cp); - } - /** * @deprecated As of 6.1.0, replaced by {@link #getWrappedService} */ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/WorkflowUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/WorkflowUtil.java index 3df90a61..a180cdb9 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/WorkflowUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/WorkflowUtil.java @@ -198,10 +198,8 @@ public class WorkflowUtil { ServiceContext serviceContext) throws PortalException, SystemException { if (isWorkflowAttivabile(intPraticaId)) { - ControlloPratica cp = ControlloPraticaLocalServiceUtil.addControlloPratica(groupId, userId, intPraticaId, - dettPraticaId, false, serviceContext); - // ADT: bug id=7 gestione workflow - ControlloPraticaLocalServiceUtil.gestioneWFVarianti(cp); + ControlloPraticaLocalServiceUtil.addControlloPratica(groupId, userId, intPraticaId, dettPraticaId, false, + serviceContext); } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java index d491f034..1363bdc7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java @@ -162,7 +162,6 @@ public class ManutenzioneDatabase { if (mode.contains("!UnitaOperative!")) { esito.addAll(fixUnitaOperative()); } - if (mode.contains("!Pulisci!")) { esito.addAll(puliziaDocumentLibrary(companyId)); esitoLog( @@ -186,13 +185,11 @@ public class ManutenzioneDatabase { clearCache(); _log.info("Elaborazione completata correttamente."); } - // if (mode.contains("!Integrazioni!")) { - // SismicaUtil.integrazioniScadute(); - // } - // if (mode.startsWith("!Workflow!")) { - // String[] pezzi = StringUtil.split(mode, '!'); - // esito.addAll(SismicaUtil.aggiungiWorkflow(pezzi[2], pezzi[3])); - // } + if (mode.contains("!Gestione!")) { + esito.addAll(SismicaUtil.gestionePratiche()); + } + // if(mode.contains("!Integrazioni!")){SismicaUtil.integrazioniScadute();}if(mode.startsWith("!Workflow!")){String[] + // pezzi=StringUtil.split(mode, '!');esito.addAll(SismicaUtil.aggiungiWorkflow(pezzi[2],pezzi[3]));} return esito; } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java index 3ec0ce24..072a3e21 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java @@ -11,6 +11,7 @@ import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.FineLavori; import it.tref.liferay.portos.bo.model.IntPratica; +import it.tref.liferay.portos.bo.scheduler.SchedulerPratiche; import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; @@ -192,6 +193,41 @@ public class SismicaUtil { return esito; } + public static List gestionePratiche() { + List esito = new ArrayList<>(); + esito.add("Gestione pratiche"); + int start = 0; + List pratiche = null; + try { + do { + pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE); + for (IntPratica pratica : pratiche) { + if (Validator.isNotNull(pratica.getNumeroProgetto()) + && (0 == ControlloPraticaLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId()) + .size())) { + DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica + .getIntPraticaId()); + if (Validator.isNotNull(dettPratica)) { + esito.add("Gestione pratica " + pratica.getNumeroProgetto() + " (id " + + pratica.getIntPraticaId() + ")"); + dettPratica.setGestita(false); + DettPraticaLocalServiceUtil.updateDettPratica(dettPratica); + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(dettPratica.getCompanyId()); + serviceContext.setScopeGroupId(dettPratica.getGroupId()); + serviceContext.setUserId(dettPratica.getUserId()); + SchedulerPratiche.avvioWorkflow(dettPratica, dettPratica.getUserId(), serviceContext); + } + } + } + start += pratiche.size(); + } while (pratiche.size() > 0); + } catch (Exception e) { + esito.add("Errore durante l'elaborazione " + e.getMessage()); + } + return esito; + } + private static List riparaAssegnazioniAlRuolo(long companyId, long userId) { List esito = new ArrayList<>(); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/DettPraticaImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/DettPraticaImpl.java index 7ff8ea02..ac6d8772 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/DettPraticaImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/DettPraticaImpl.java @@ -76,16 +76,16 @@ public class DettPraticaImpl extends DettPraticaBaseImpl { sb.append("Autorizzazione "); } sb.append("n. "); - if (Validator.isNull(getProtocollo())) { + if (Validator.isNotNull(getProtocollo())) { + // TODO da decidere che data, per adesso si mette quella di creazione il numero protocollo sbagliato + // dovrebbe essere il primo + sb.append(intPratica.getNumeroProgetto()).append(" del ").append(sdf.format(intPratica.getDtPratica())); + } else { if (Validator.isNotNull(intPratica.getNumeroProgetto())) { sb.append(intPratica.getNumeroProgetto()).append(StringPool.SPACE).append(StringPool.DASH) .append(StringPool.SPACE); } sb.append(getDettPraticaId()).append(" (Temporaneo) "); - } else { - // TODO da decidere che data, per adesso si mette quella di creazione il numero protocollo sbagliato - // dovrebbe essere il primo - sb.append(intPratica.getNumeroProgetto()).append(" del ").append(sdf.format(intPratica.getDtPratica())); } sb.append(" - id ").append(intPratica.getIntPraticaId()); } catch (PortalException | SystemException e) { @@ -110,9 +110,9 @@ public class DettPraticaImpl extends DettPraticaBaseImpl { sb.append(LanguageUtil.get(LocaleUtil.getSiteDefault(), "label-integrazione-" + getTipoIntegrazione())); } if (Validator.isNotNull(getVarianteNumero())) { - sb.append(LanguageUtil.get(LocaleUtil.getSiteDefault(), " #" + getVarianteNumero())); + sb.append(StringPool.SPACE).append(StringPool.POUND).append(getVarianteNumero()); } else if (Validator.isNotNull(getIntegrazione())) { - sb.append(LanguageUtil.get(LocaleUtil.getSiteDefault(), " #" + getIntegrazione())); + sb.append(StringPool.SPACE).append(StringPool.POUND).append(getIntegrazione()); } if (Validator.isNotNull(getProtocollo())) { sb.append(" protocollo ") @@ -136,9 +136,9 @@ public class DettPraticaImpl extends DettPraticaBaseImpl { sb.append(LanguageUtil.get(LocaleUtil.getSiteDefault(), "label-integrazione-" + getTipoIntegrazione())); } if (Validator.isNotNull(getVarianteNumero())) { - sb.append(" #").append(getVarianteNumero()); + sb.append(StringPool.SPACE).append(StringPool.POUND).append(getVarianteNumero()); } else if (Validator.isNotNull(getIntegrazione())) { - sb.append(" #").append(getIntegrazione()); + sb.append(StringPool.SPACE).append(StringPool.POUND).append(getIntegrazione()); } sb.append(StringPool.SPACE).append(StringPool.OPEN_PARENTHESIS).append(getTitle()) .append(StringPool.CLOSE_PARENTHESIS); @@ -149,9 +149,7 @@ public class DettPraticaImpl extends DettPraticaBaseImpl { public String serializeToVersioning() throws NoSuchFieldException, SecurityException { StringBuilder sb = new StringBuilder(); - sb.append(StringPool.OPEN_CURLY_BRACE).append("\"version\":").append(StringPool.QUOTE) - .append(Constants.DETTPRATICA_VERSION_IMPL).append(StringPool.QUOTE).append(StringPool.COMMA) - .append("\"fields\":").append(StringPool.OPEN_BRACKET); + sb.append("{\"version\":\"").append(Constants.DETTPRATICA_VERSION_IMPL).append("\",\"fields\":["); Map modelAttributes = getModelValues(); String privateUuid = "uuid_"; Object[][] columns = DettPraticaModelImpl.TABLE_COLUMNS; @@ -176,15 +174,13 @@ public class DettPraticaImpl extends DettPraticaBaseImpl { break; } Object value = modelAttributes.get(property); - sb.append(StringPool.OPEN_CURLY_BRACE).append("\"name\":").append(StringPool.QUOTE).append(property) - .append(StringPool.QUOTE).append(StringPool.COMMA).append("\"class\":").append(StringPool.QUOTE) - .append(className).append(StringPool.QUOTE).append(StringPool.COMMA).append("\"value\":") + sb.append("{\"name\":\"").append(property).append("\",\"class\":\"").append(className) + .append("\",\"value\":") .append(JSONObject.quote(String.valueOf(value)).replaceAll("[\r\n]+", StringPool.SPACE)) .append(StringPool.CLOSE_CURLY_BRACE).append(StringPool.COMMA); } sb.setLength(sb.length() - 1); - sb.append(StringPool.CLOSE_BRACKET); - sb.append(StringPool.CLOSE_CURLY_BRACE); + sb.append(StringPool.CLOSE_BRACKET).append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); } @@ -192,7 +188,7 @@ public class DettPraticaImpl extends DettPraticaBaseImpl { public String serializeToVersioningPage() throws NoSuchFieldException, SecurityException { StringBuilder sb = new StringBuilder(); - sb.append(StringPool.OPEN_CURLY_BRACE).append("\"fields\":").append(StringPool.OPEN_BRACKET); + sb.append("{\"fields\":["); Object[][] columns = DettPraticaModelImpl.TABLE_COLUMNS; for (Object[] column_x : columns) { String property = (String) column_x[0]; @@ -201,8 +197,7 @@ public class DettPraticaImpl extends DettPraticaBaseImpl { } } sb.setLength(sb.length() - 1); - sb.append(StringPool.CLOSE_BRACKET); - sb.append(StringPool.CLOSE_CURLY_BRACE); + sb.append(StringPool.CLOSE_BRACKET).append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); } 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 7f98e13c..d7aed0c8 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,17 +1,13 @@ 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; @@ -21,14 +17,11 @@ 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; @@ -54,18 +47,13 @@ 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; @@ -85,8 +73,6 @@ 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 { @@ -247,47 +233,6 @@ public class GestioneAttivitaPortlet extends MVCPortlet { } } - 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) throws PortalException, SystemException { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java index 4095e6a6..e95e1441 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java @@ -114,8 +114,6 @@ public class SchedulerGeneraDocumento implements MessageListener { IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(avviso.getIntPraticaId()); long folderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, AvvisoUtil .getAllTipoDocumentoFolderProps().get(avviso.getTipoDocumento())); - _log.info("tipoDocumento = " + avviso.getTipoDocumento() + ", prop = " - + AvvisoUtil.getAllTipoDocumentoFolderProps().get(avviso.getTipoDocumento())); String fileName = AvvisoLocalServiceUtil.getFileNameAvviso(avviso.getClassPk(), avviso.getTipoDocumento(), avviso.getAvvisoId(), "B"); Map parameters = new HashMap(); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java index 9b055d9c..f92bddce 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java @@ -276,7 +276,7 @@ public class SchedulerPratiche implements MessageListener { return intPratica; } - public void gestionePratica(DettPratica dettPratica) throws Exception { + private void gestionePratica(DettPratica dettPratica) throws Exception { ServiceContext serviceContext = getServiceContext(dettPratica); // protocollazione da servizio remoto @@ -320,6 +320,13 @@ public class SchedulerPratiche implements MessageListener { 0L); } } + // Avvio Workflow + if (!dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO)) { + avvioWorkflow(dettPratica, dettPratica.getUserId(), serviceContext); + } else { + _log.info("Workflow non avviato per pratica " + intPratica.getNumeroProgetto() + " (id " + + intPratica.getIntPraticaId() + ")"); + } dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaGestita(dettPratica.getDettPraticaId(), true); } @@ -370,7 +377,7 @@ public class SchedulerPratiche implements MessageListener { return collaudo; } - private ControlloPratica avvioWorkflow(DettPratica dettPratica, long userId, ServiceContext serviceContext) + public static ControlloPratica avvioWorkflow(DettPratica dettPratica, long userId, ServiceContext serviceContext) throws Exception { if (dettPratica.isCompleta() && !dettPratica.isGestita()) { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/ControlloPraticaLocalServiceClpInvoker.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/ControlloPraticaLocalServiceClpInvoker.java index fe73fd8f..cf28f031 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/ControlloPraticaLocalServiceClpInvoker.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/ControlloPraticaLocalServiceClpInvoker.java @@ -233,12 +233,6 @@ public class ControlloPraticaLocalServiceClpInvoker { _methodName228 = "calculateDateAvvioProcedimento"; _methodParameterTypes228 = new String[] { "long" }; - - _methodName229 = "gestioneWFVarianti"; - - _methodParameterTypes229 = new String[] { - "it.tref.liferay.portos.bo.model.ControlloPratica" - }; } public Object invokeMethod(String name, String[] parameterTypes, @@ -507,13 +501,6 @@ public class ControlloPraticaLocalServiceClpInvoker { return ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(((Long)arguments[0]).longValue()); } - if (_methodName229.equals(name) && - Arrays.deepEquals(_methodParameterTypes229, parameterTypes)) { - ControlloPraticaLocalServiceUtil.gestioneWFVarianti((it.tref.liferay.portos.bo.model.ControlloPratica)arguments[0]); - - return null; - } - throw new UnsupportedOperationException(); } @@ -603,6 +590,4 @@ public class ControlloPraticaLocalServiceClpInvoker { private String[] _methodParameterTypes227; private String _methodName228; private String[] _methodParameterTypes228; - private String _methodName229; - private String[] _methodParameterTypes229; } \ 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/service/impl/AvvisoLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java index 9dea67d8..fedbbd71 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java @@ -17,6 +17,7 @@ import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.base.AvvisoLocalServiceBaseImpl; +import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; import it.tref.liferay.portos.bo.util.AvvisoUtil; import it.tref.liferay.portos.bo.util.AzioniPraticheUtil; @@ -54,6 +55,7 @@ import com.liferay.portal.kernel.repository.model.Folder; import com.liferay.portal.kernel.search.Indexable; import com.liferay.portal.kernel.search.IndexableType; import com.liferay.portal.kernel.util.Base64; +import com.liferay.portal.kernel.util.ContentTypes; import com.liferay.portal.kernel.util.MimeTypesUtil; import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.StringPool; @@ -61,6 +63,7 @@ import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.model.User; import com.liferay.portal.service.ServiceContext; import com.liferay.portlet.documentlibrary.NoSuchFileEntryException; +import com.liferay.portlet.documentlibrary.NoSuchFolderException; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.util.dao.orm.CustomSQLUtil; @@ -125,19 +128,44 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl { } @Override - public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, String jsonParameters, long classPk, + public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, String base64File, long classPk, String className, ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma, long controlloPraticaId) throws SystemException, PortalException { IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId); - String statoPraticaCode = PraticaUtil.getStatoPraticaCode(stato, intPratica); - String propertiesTemplate = AvvisoUtil.getFileTemplateProp(statoPraticaCode, intPratica.getTipoProcedura()); - long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(), - propertiesTemplate); - _log.info("statoPraticaCode=" + statoPraticaCode + ", tipoProcedura=" + intPratica.getTipoProcedura() - + ", propertiesTemplate=" + propertiesTemplate + ", fileEntryIdTemplate=" + fileEntryIdTemplate); - return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate, classPk, - className, userCodiceFiscalePrimaFirma, jsonParameters, controlloPraticaId, serviceContext); + if (base64File.isEmpty() || !base64File.startsWith("data:application/pdf;base64,")) { + String statoPraticaCode = PraticaUtil.getStatoPraticaCode(stato, intPratica); + String propertiesTemplate = AvvisoUtil.getFileTemplateProp(statoPraticaCode, intPratica.getTipoProcedura()); + long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(), + propertiesTemplate); + _log.info("statoPraticaCode=" + statoPraticaCode + ", tipoProcedura=" + intPratica.getTipoProcedura() + + ", propertiesTemplate=" + propertiesTemplate + ", fileEntryIdTemplate=" + fileEntryIdTemplate); + return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate, + classPk, className, userCodiceFiscalePrimaFirma, StringPool.BLANK, controlloPraticaId, + serviceContext); + } else { + byte[] bytes = Base64.decode(base64File.substring(28)); + long attachmentFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(serviceContext.getCompanyId(), + ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); + Folder attachmentFolder = DLAppLocalServiceUtil.getFolder(attachmentFolderId); + long repositoryId = attachmentFolder.getRepositoryId(); + String folderName = PraticaUtil.getFolderName(classPk); + 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); + } + String targetFileName = getFileNameAvviso(classPk, StatoPraticaConstants.SANZIONE_DOC1, null, "F") + ".pdf"; + FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(serviceContext.getUserId(), repositoryId, + folder.getFolderId(), StringPool.BLANK, ContentTypes.APPLICATION_PDF, targetFileName, + targetFileName, StringPool.BLANK, bytes, serviceContext); + return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, 0L, classPk, className, + userCodiceFiscalePrimaFirma, fileEntry.getFileEntryId(), 0L, StringPool.BLANK, controlloPraticaId, + serviceContext); + } } @Override @@ -145,8 +173,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl { ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma, long controlloPraticaId) throws SystemException, PortalException { - return createStandardAvvisoPratica(intPraticaId, stato, null, classPk, className, serviceContext, tipoAvviso, - userCodiceFiscalePrimaFirma, controlloPraticaId); + return createStandardAvvisoPratica(intPraticaId, stato, StringPool.BLANK, classPk, className, serviceContext, + tipoAvviso, userCodiceFiscalePrimaFirma, controlloPraticaId); } @Override @@ -180,9 +208,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl { + "\", userCodiceFiscalePrimaFirma=\"" + userCodiceFiscalePrimaFirma + "\", fileEntryIdBase=" + fileEntryIdBase + ", fileEntryIdFirma=" + fileEntryIdFirma + ", jsonParameters=\"" + jsonParameters + "\", controlloPraticaId=" + controlloPraticaId + ", serviceContext=\"" + serviceContext + "\""); - if (0 == fileEntryIdTemplate) { - throw new PortalException("fileEntryIdTemplate=" + fileEntryIdTemplate); - } + User user = userPersistence.fetchByPrimaryKey(serviceContext.getUserId()); Date now = new Date(); Avviso avviso = createAvviso(counterLocalService.increment(Avviso.class.getName())); 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 0ed89ab7..949b9a6d 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 @@ -32,10 +32,10 @@ import it.tref.liferay.portos.bo.util.AzioniPraticheUtil; import it.tref.liferay.portos.bo.util.GestioneFirmeUtil; import it.tref.liferay.portos.bo.util.PraticaUtil; import it.tref.liferay.portos.bo.util.TempisticaConstants; -import it.tref.liferay.portos.bo.util.WorkflowConstants; import it.tref.liferay.portos.bo.util.WorkflowUtil; import it.tref.liferay.portos.kaleo.model.FormLog; import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil; +import it.tref.liferay.portos.kaleo.shared.util.WorkflowConstants; import java.io.Serializable; import java.util.Date; @@ -67,6 +67,7 @@ import com.liferay.portal.kernel.search.Indexer; import com.liferay.portal.kernel.search.IndexerRegistryUtil; import com.liferay.portal.kernel.util.ContentTypes; import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.MapUtil; import com.liferay.portal.kernel.util.OrderByComparatorFactoryUtil; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; @@ -309,11 +310,15 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi codiceFiscale = GestioneFirmeUtil.getCodiceFiscaleFirma(controlloPratica.getCompanyId(), controlloPratica.getGroupId(), statoPratica); } - // TODO Da riempire - // XXX Di cosa? Di caramelle? - String jsonParameters = StringPool.BLANK; - avvisoLocalService.createStandardAvvisoPratica(controlloPratica.getIntPraticaId(), statoPratica, - jsonParameters, dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext, + String base64File = StringPool.BLANK; + @SuppressWarnings("unchecked") + Map formParameters = (Map) workflowContext + .get(WorkflowConstants.CONTEXT_TASK_FORM_PARAMETERS); + if (MapUtil.getBoolean(formParameters, "base64", false)) { + base64File = MapUtil.getString(formParameters, "testo_del_documento"); + } + avvisoLocalService.createStandardAvvisoPratica(controlloPratica.getIntPraticaId(), statoPratica, base64File, + dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext, AvvisoUtil.TIPO_AVVISO_FIRMA, codiceFiscale, controlloPraticaId); return true; } @@ -332,9 +337,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi intPraticaLocalService.updateIntPratica(intPratica); } - /** - * I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione - */ + // I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione @Override public String valutazioneEsitoFinaleUpdateStatoPratica(long controlloPraticaId, Map workflowContext) throws PortalException, SystemException { @@ -705,11 +708,4 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi } return giorni - stop; } - - /** - * ADT: gestione workflow varianti - */ - @Override - public void gestioneWFVarianti(ControlloPratica cp) { - } } \ 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/workflow/ControlloPraticaWorkflowHandler.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/workflow/ControlloPraticaWorkflowHandler.java index 1c80bd14..54d58363 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/workflow/ControlloPraticaWorkflowHandler.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/workflow/ControlloPraticaWorkflowHandler.java @@ -57,11 +57,6 @@ public class ControlloPraticaWorkflowHandler extends BaseWorkflowHandler { List wfNewListVarianti = new ArrayList(); ControlloPratica cp = ControlloPraticaLocalServiceUtil.updateStatus(userId, resourcePrimKey, status, serviceContext, wfNewListVarianti); - // E richiamiamo il nostro metodo che farà update dello status sul nostro asset! - if (wfNewListVarianti.size() > 0) { - _log.info("wfNewListVarianti size >0" + wfNewListVarianti.size()); - ControlloPraticaLocalServiceUtil.gestioneWFVarianti(wfNewListVarianti.get(0)); - } return cp; } } \ No newline at end of file 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 80defdb0..a8704ddc 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=3046 - build.date=1618844951246 + build.number=3053 + build.date=1619167679284 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/asset/controllopratica/full_content.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/asset/controllopratica/full_content.jsp index 4c9f29a8..7d6d52df 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/asset/controllopratica/full_content.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/asset/controllopratica/full_content.jsp @@ -1,3 +1,4 @@ +<%@page import="com.liferay.portal.kernel.util.MapUtil"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="it.tref.liferay.portos.bo.util.AvvisoUtil"%> <%@page import="com.liferay.portlet.documentlibrary.util.DLUtil"%> @@ -14,10 +15,9 @@ <%@page import="it.tref.liferay.portos.bo.util.WorkflowUtil"%> <%@page import="com.liferay.portal.model.User"%> <%@page import="com.liferay.portal.service.UserLocalServiceUtil"%> -<%@ include file="/html/asset/controllopratica/init.jsp" %> - +<%@include file="/html/asset/controllopratica/init.jsp"%> <% -ControlloPratica controlloPratica = (ControlloPratica)request.getAttribute("controlloPratica"); +ControlloPratica controlloPratica = (ControlloPratica) request.getAttribute("controlloPratica"); Map parametri = WorkflowUtil.getFormParameters(controlloPratica); IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId()); DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica.getIntPraticaId()); @@ -27,7 +27,9 @@ Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getT Group groupTerritorio = GroupLocalServiceUtil.getGroup(territorio.getGroupId()); Organization org = OrganizationLocalServiceUtil.getOrganization(groupTerritorio.getOrganizationId()); Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId()); -List pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPraticaId(intPratica.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS); +List pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPraticaId(intPratica.getIntPraticaId(), + QueryUtil.ALL_POS, QueryUtil.ALL_POS); +List nascosti = Arrays.asList(new String[] { "base64" }); %>

<%= intPratica.getTitle(true) %>

pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPrati
  • <%= geologo.getFullName() %> - : + : Parere non espresso @@ -119,13 +121,17 @@ List pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPrati if (parametri.isEmpty()) { out.print("
  • Nessun dato inserito
  • "); } else { + boolean base64 = MapUtil.getBoolean(parametri, "base64", false); for (Entry entry : parametri.entrySet()) { String key = entry.getKey(); if (key.equals("ingloba_variante")) { String value = entry.getValue().toString(); - out.print("
  • " + value + "
  • "); - } else { + out.print("
  • " + value + "
  • "); + } else if (!nascosti.contains(key)) { String value = entry.getValue().toString(); + if (base64 && key.equalsIgnoreCase("testo_del_documento")) { + value = "File allegato"; + } out.print("
  • " + LanguageUtil.get(pageContext, key) + ": " + LanguageUtil.get(pageContext, WorkflowUtil.adjustWorkflowContextValue(key, value, intPratica.getIntPraticaId())) @@ -159,7 +165,7 @@ List pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPrati border-bottom: 2px solid #ddd; line-height: 1.5; } - .title_int_pratica, .title_date_workflow { + .title_int_pratica, .title_date_workflow { margin:0; } .container_header_text_attivita { @@ -170,7 +176,7 @@ List pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPrati -ms-flex-align: center; align-items: center; } - + .list-geo, .list-workflow { margin-left: 50px!important; } @@ -197,14 +203,14 @@ List pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPrati color: #555; margin: 5px 7px 5px 0px; } - + .container_header_text_attivita .text_attivita, .columns-max .control-group.field-wrapper > .control-group { margin: 0; } .text-local { margin-left: 35px; } - + #updateComments .control-group.field-wrapper, #updateComments .columns-max .control-group.field-wrapper > .control-group { display: -webkit-box; display: -ms-flexbox; @@ -214,11 +220,11 @@ List pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPrati align-items: center; width: 100%; } - + #updateComments .control-group.field-wrapper, #updateComments .columns-max .control-group.field-wrapper > .control-group[data-fieldname="esito"] { display: block; } - + #updateComments .control-group.field-wrapper textarea, #updateComments .control-group.field-wrapper input[type="text"] { width: 80%; margin-bottom: 0px!important; @@ -229,18 +235,18 @@ List pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPrati #updateComments .control-group.field-wrapper label, #updateComments .columns-max .control-group.field-wrapper > .control-group label, #updateComments .control-group.field-wrapper span.control-label { width: 20%; } - + #updateComments .control-group.field-wrapper .lfr-input-date.input-large, #updateComments .columns-max .control-group.field-wrapper > .control-group select { margin-left: -4px; } #updateComments .control-group.field-wrapper label, #updateComments .control-group.field-wrapper .control-group.input-text-wrapper { margin-bottom: 0!important; } - + #updateComments .separator { border-top: 1px solid #812121; } - + #updateComments .radio { width: auto!important; } 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 76a1e66a..c8ed14f8 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 @@ -42,7 +42,6 @@ String randomId = StringUtil.randomId(); String buttonIdCambioIstruttore = "buttonIdCambioIstruttore_" + randomId; String buttonIdSelezionaGeologo = "buttonIdSelezionaGeologo_" + randomId; String buttonIdAnnullaRicGeologo = "buttonIdAnnullaRicGeologo_" + randomId; -String buttonIdAllegaSanzione = "buttonIdAllegaSanzione_" + controlloPratica.getDettPraticaId(); String buttonIdAggiungiDettPraticheAlControllo = "buttonIdAggiungiDettPraticheAlControllo_" + randomId; Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); long territorioGroupId = territorio.getGroupId(); @@ -160,25 +159,6 @@ 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 deleted file mode 100644 index 74cdaa5d..00000000 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/actions/action_allega_sanzione.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<%@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; -%> - - - - - - - - -
    - - - -
    - - - - - - - - - -
    \ No newline at end of file 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 00196f6c..f95bd659 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,11 +3,18 @@ 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; @@ -24,6 +31,8 @@ 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 { @@ -37,7 +46,7 @@ public class SchedulerKaleoController implements MessageListener { if (lock.tryLock()) { try { // Riparazione pratiche con workflow sporco - riparaLifecycleWorkflowNew(); + // riparaLifecycleWorkflowNew(); } catch (Exception e) { _log.error(e, e); } finally { @@ -48,139 +57,139 @@ public class SchedulerKaleoController implements MessageListener { // 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-kaleo-controller-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/service.properties index 8b2e5f32..9880e45b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_kaleo_controller - build.number=10 - build.date=1618410642507 + build.number=11 + build.date=1618997334627 build.auto.upgrade=true ## 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 868ec17c..f62f7f07 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 @@ -57,9 +57,10 @@ if (ddmTemplateId > 0) { repeatable="true" requestedLocale="<%= LocaleUtil.fromLanguageId(languageId) %>" /> <% -String esito = parameters.containsKey("esito") ? parameters.get("esito").toString() : StringPool.BLANK; -String istruttore = parameters.containsKey("istruttore") ? parameters.get("istruttore").toString() : StringPool.BLANK; +String esito = MapUtil.getString(parameters, "esito", StringPool.BLANK); +String istruttore = MapUtil.getString(parameters, "istruttore", StringPool.BLANK); String ns = renderResponse.getNamespace(); +boolean base64 = MapUtil.getBoolean(parameters, "base64", false); for (Entry>> entry : fieldNameOptions.entrySet()) { String name = entry.getKey(); String regexSelect = "(?s)(.*?)()(.*)"; @@ -72,14 +73,12 @@ 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 = " 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 (base64) { + String search = "(?s)("; + String replace = "$1 style=\"display:none\">$2" + + "File allegato "; + html = html.replaceAll(search, replace); +} if (hasFileUpload) { String replace = - "$1
    " + + "$1
    " + + "" + ""; - System.out.println(replace); + ""; html = html.replaceAll("(?s)(]*? data-fieldName=\"testo_del_documento\".*?)", replace); } %> 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 b8984182..ddebf5b8 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 @@ -10,6 +10,7 @@ import it.tref.liferay.portos.bo.util.PraticaUtil; import it.tref.liferay.portos.kaleo.model.FormLog; import it.tref.liferay.portos.kaleo.service.ClpSerializer; import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil; +import it.tref.liferay.portos.kaleo.shared.util.WorkflowConstants; import it.tref.liferay.portos.kaleo.util.WorkflowUtil; import java.io.IOException; @@ -55,7 +56,6 @@ import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringUtil; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.WebKeys; -import com.liferay.portal.kernel.workflow.WorkflowConstants; import com.liferay.portal.kernel.workflow.WorkflowException; import com.liferay.portal.kernel.workflow.WorkflowLog; import com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil; @@ -168,17 +168,16 @@ 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 if (transitionName.equalsIgnoreCase("registra-esito")) { HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil .getHttpServletRequest(actionRequest)); - String esito = httpServletRequest.getParameter("kaleo--esito--") != null ? httpServletRequest.getParameter( - "kaleo--esito--").trim() : StringPool.BLANK; - String testoDocumento = httpServletRequest.getParameter("kaleo--testo_del_documento--") != null ? httpServletRequest - .getParameter("kaleo--testo_del_documento--") : StringPool.BLANK; + String esito = httpServletRequest.getParameter("kaleo--esito--") == null ? StringPool.BLANK + : httpServletRequest.getParameter("kaleo--esito--").trim(); + String testoDocumento = httpServletRequest.getParameter("kaleo--testo_del_documento--") == null ? StringPool.BLANK + : httpServletRequest.getParameter("kaleo--testo_del_documento--"); if (!valoriAmmessi.contains(esito) || ((esito.equalsIgnoreCase(StatoPraticaConstants.INTEGRAZIONE) || esito .equalsIgnoreCase(StatoPraticaConstants.PREAVVISO_CONTRARIO)) && testoDocumento.isEmpty())) { @@ -193,7 +192,7 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { .getHttpServletRequest(actionRequest)); String istruttore = httpServletRequest.getParameter("kaleo--istruttore--"); if (Validator.isNull(istruttore)) { - _log.error("controllo validazione completamento task = " + transitionName + " -" + workflowTaskId + _log.error("controllo validazione completamento task = " + transitionName + " - " + workflowTaskId + " non riuscito - istruttore non presente nel workflow"); throw new PortalException("controllo validazione completamento task riassegna non riuscito"); } @@ -211,10 +210,10 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { IntPraticaLocalServiceUtil.updateIntPratica(pratica); } } + Map workflowContext = new HashMap(); + workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); + WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext); if (aggiorna) { - Map workflowContext = new HashMap(); - workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); - WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext); WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(), themeDisplay.getUserId(), workflowTaskId, transitionName, comment, workflowContext); } diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java index bbcac266..a7e1d4a6 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java @@ -199,22 +199,16 @@ public class WorkflowUtil { Enumeration enu = portletRequest.getParameterNames(); while (enu.hasMoreElements()) { String name = enu.nextElement(); - if (!name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) - && !name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { - continue; - } - if (formParameters == null) { - formParameters = new HashMap(); - } - String parameterName = name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(), name.length() - - WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM.length()); - String[] values = ParamUtil.getParameterValues(portletRequest, name); - for (int i = 0; i < values.length; i++) { - _log.info(name + "[" + i + "] = \"" + values[i] + "\""); + if (name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) + && name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { + if (formParameters == null) { + formParameters = new HashMap(); + } + String parameterName = name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(), + name.length() - WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM.length()); + String value = StringUtil.merge(ParamUtil.getParameterValues(portletRequest, name)); + formParameters.put(parameterName, value); } - String value = StringUtil.merge(ParamUtil.getParameterValues(portletRequest, name)); - _log.info("Finale \"" + value + "\""); - formParameters.put(parameterName, value); } if (formParameters == null) { HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil @@ -222,17 +216,16 @@ public class WorkflowUtil { Enumeration enums = httpServletRequest.getParameterNames(); while (enums.hasMoreElements()) { String name = enums.nextElement(); - if (!name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) - && !name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { - continue; - } - if (formParameters == null) { - formParameters = new HashMap(); + if (name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) + && name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { + if (formParameters == null) { + formParameters = new HashMap(); + } + String parameterName = name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(), + name.length() - WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM.length()); + String value = StringUtil.merge(ParamUtil.getParameterValues(httpServletRequest, name)); + formParameters.put(parameterName, value); } - String parameterName = name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(), - name.length() - WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM.length()); - String value = StringUtil.merge(ParamUtil.getParameterValues(httpServletRequest, name)); - formParameters.put(parameterName, value); } } if (formParameters != null) { diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/service.properties index 19cc1c76..afd1c57d 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=Kaleo - build.number=40 - build.date=1618410772164 + build.number=41 + build.date=1619007863902 build.auto.upgrade=true ##