Sfoglia il codice sorgente

Sanatorie con allegato

master
Salvatore La Manna 4 anni fa
parent
commit
96788e21e2
  1. 5
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalService.java
  2. 7
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceClp.java
  3. 7
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceUtil.java
  4. 9
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/AvvisoLocalServiceWrapper.java
  5. 9
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java
  6. 29
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceClp.java
  7. 11
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceUtil.java
  8. 12
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java
  9. 6
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/WorkflowUtil.java
  10. 13
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java
  11. 36
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java
  12. 35
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/DettPraticaImpl.java
  13. 55
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java
  14. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java
  15. 11
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java
  16. 15
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/ControlloPraticaLocalServiceClpInvoker.java
  17. 42
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java
  18. 28
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java
  19. 5
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/workflow/ControlloPraticaWorkflowHandler.java
  20. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  21. 16
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/asset/controllopratica/full_content.jsp
  22. 20
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp
  23. 36
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/actions/action_allega_sanzione.jsp
  24. 277
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/scheduler/SchedulerKaleoController.java
  25. 4
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/service.properties
  26. 45
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp
  27. 15
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java
  28. 23
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java
  29. 4
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/service.properties

5
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; com.liferay.portal.kernel.exception.SystemException;
public it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica( public it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica(
long intPraticaId, java.lang.String stato, long intPraticaId, java.lang.String stato, java.lang.String base64File,
java.lang.String jsonParameters, long classPk, long classPk, java.lang.String className,
java.lang.String className,
com.liferay.portal.service.ServiceContext serviceContext, com.liferay.portal.service.ServiceContext serviceContext,
java.lang.String tipoAvviso, java.lang.String tipoAvviso,
java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId) java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId)

7
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 @Override
public it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica( public it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica(
long intPraticaId, java.lang.String stato, long intPraticaId, java.lang.String stato, java.lang.String base64File,
java.lang.String jsonParameters, long classPk, long classPk, java.lang.String className,
java.lang.String className,
com.liferay.portal.service.ServiceContext serviceContext, com.liferay.portal.service.ServiceContext serviceContext,
java.lang.String tipoAvviso, java.lang.String tipoAvviso,
java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId) java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId)
@ -1350,7 +1349,7 @@ public class AvvisoLocalServiceClp implements AvvisoLocalService {
ClpSerializer.translateInput(stato), ClpSerializer.translateInput(stato),
ClpSerializer.translateInput(jsonParameters), ClpSerializer.translateInput(base64File),
classPk, classPk,

7
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( public static it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica(
long intPraticaId, java.lang.String stato, long intPraticaId, java.lang.String stato, java.lang.String base64File,
java.lang.String jsonParameters, long classPk, long classPk, java.lang.String className,
java.lang.String className,
com.liferay.portal.service.ServiceContext serviceContext, com.liferay.portal.service.ServiceContext serviceContext,
java.lang.String tipoAvviso, java.lang.String tipoAvviso,
java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId) java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId)
@ -375,7 +374,7 @@ public class AvvisoLocalServiceUtil {
com.liferay.portal.kernel.exception.SystemException { com.liferay.portal.kernel.exception.SystemException {
return getService() return getService()
.createStandardAvvisoPratica(intPraticaId, stato, .createStandardAvvisoPratica(intPraticaId, stato,
jsonParameters, classPk, className, serviceContext, tipoAvviso, base64File, classPk, className, serviceContext, tipoAvviso,
userCodiceFiscalePrimaFirma, controlloPraticaId); userCodiceFiscalePrimaFirma, controlloPraticaId);
} }

9
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 @Override
public it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica( public it.tref.liferay.portos.bo.model.Avviso createStandardAvvisoPratica(
long intPraticaId, java.lang.String stato, long intPraticaId, java.lang.String stato, java.lang.String base64File,
java.lang.String jsonParameters, long classPk, long classPk, java.lang.String className,
java.lang.String className,
com.liferay.portal.service.ServiceContext serviceContext, com.liferay.portal.service.ServiceContext serviceContext,
java.lang.String tipoAvviso, java.lang.String tipoAvviso,
java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId) java.lang.String userCodiceFiscalePrimaFirma, long controlloPraticaId)
throws com.liferay.portal.kernel.exception.PortalException, throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException { com.liferay.portal.kernel.exception.SystemException {
return _avvisoLocalService.createStandardAvvisoPratica(intPraticaId, return _avvisoLocalService.createStandardAvvisoPratica(intPraticaId,
stato, jsonParameters, classPk, className, serviceContext, stato, base64File, classPk, className, serviceContext, tipoAvviso,
tipoAvviso, userCodiceFiscalePrimaFirma, controlloPraticaId); userCodiceFiscalePrimaFirma, controlloPraticaId);
} }
@Override @Override

9
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, throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException; com.liferay.portal.kernel.exception.SystemException;
/**
* I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
*/
public java.lang.String valutazioneEsitoFinaleUpdateStatoPratica( public java.lang.String valutazioneEsitoFinaleUpdateStatoPratica(
long controlloPraticaId, long controlloPraticaId,
java.util.Map<java.lang.String, java.io.Serializable> workflowContext) java.util.Map<java.lang.String, java.io.Serializable> workflowContext)
@ -426,10 +423,4 @@ public interface ControlloPraticaLocalService extends BaseLocalService,
long controlloPraticaId) long controlloPraticaId)
throws com.liferay.portal.kernel.exception.PortalException, throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException; com.liferay.portal.kernel.exception.SystemException;
/**
* ADT: gestione workflow varianti
*/
public void gestioneWFVarianti(
it.tref.liferay.portos.bo.model.ControlloPratica cp);
} }

29
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"; _methodName41 = "calculateDateAvvioProcedimento";
_methodParameterTypes41 = new String[] { "long" }; _methodParameterTypes41 = new String[] { "long" };
_methodName42 = "gestioneWFVarianti";
_methodParameterTypes42 = new String[] {
"it.tref.liferay.portos.bo.model.ControlloPratica"
};
} }
@Override @Override
@ -1638,27 +1632,6 @@ public class ControlloPraticaLocalServiceClp
return (java.lang.Long)ClpSerializer.translateOutput(returnObj); 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 InvokableLocalService _invokableLocalService;
private String _methodName0; private String _methodName0;
private String[] _methodParameterTypes0; private String[] _methodParameterTypes0;
@ -1742,6 +1715,4 @@ public class ControlloPraticaLocalServiceClp
private String[] _methodParameterTypes40; private String[] _methodParameterTypes40;
private String _methodName41; private String _methodName41;
private String[] _methodParameterTypes41; private String[] _methodParameterTypes41;
private String _methodName42;
private String[] _methodParameterTypes42;
} }

11
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); getService().updateIstruttore(controlloPraticaId, workflowContext);
} }
/**
* I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
*/
public static java.lang.String valutazioneEsitoFinaleUpdateStatoPratica( public static java.lang.String valutazioneEsitoFinaleUpdateStatoPratica(
long controlloPraticaId, long controlloPraticaId,
java.util.Map<java.lang.String, java.io.Serializable> workflowContext) java.util.Map<java.lang.String, java.io.Serializable> workflowContext)
@ -506,14 +503,6 @@ public class ControlloPraticaLocalServiceUtil {
return getService().calculateDateAvvioProcedimento(controlloPraticaId); 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() { public static void clearService() {
_service = null; _service = null;
} }

12
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); workflowContext);
} }
/**
* I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
*/
@Override @Override
public java.lang.String valutazioneEsitoFinaleUpdateStatoPratica( public java.lang.String valutazioneEsitoFinaleUpdateStatoPratica(
long controlloPraticaId, long controlloPraticaId,
@ -538,15 +535,6 @@ public class ControlloPraticaLocalServiceWrapper
return _controlloPraticaLocalService.calculateDateAvvioProcedimento(controlloPraticaId); 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} * @deprecated As of 6.1.0, replaced by {@link #getWrappedService}
*/ */

6
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 { ServiceContext serviceContext) throws PortalException, SystemException {
if (isWorkflowAttivabile(intPraticaId)) { if (isWorkflowAttivabile(intPraticaId)) {
ControlloPratica cp = ControlloPraticaLocalServiceUtil.addControlloPratica(groupId, userId, intPraticaId, ControlloPraticaLocalServiceUtil.addControlloPratica(groupId, userId, intPraticaId, dettPraticaId, false,
dettPraticaId, false, serviceContext); serviceContext);
// ADT: bug id=7 gestione workflow
ControlloPraticaLocalServiceUtil.gestioneWFVarianti(cp);
} }
} }

13
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!")) { if (mode.contains("!UnitaOperative!")) {
esito.addAll(fixUnitaOperative()); esito.addAll(fixUnitaOperative());
} }
if (mode.contains("!Pulisci!")) { if (mode.contains("!Pulisci!")) {
esito.addAll(puliziaDocumentLibrary(companyId)); esito.addAll(puliziaDocumentLibrary(companyId));
esitoLog( esitoLog(
@ -186,13 +185,11 @@ public class ManutenzioneDatabase {
clearCache(); clearCache();
_log.info("Elaborazione completata correttamente."); _log.info("Elaborazione completata correttamente.");
} }
// if (mode.contains("!Integrazioni!")) { if (mode.contains("!Gestione!")) {
// SismicaUtil.integrazioniScadute(); esito.addAll(SismicaUtil.gestionePratiche());
// } }
// if (mode.startsWith("!Workflow!")) { // if(mode.contains("!Integrazioni!")){SismicaUtil.integrazioniScadute();}if(mode.startsWith("!Workflow!")){String[]
// String[] pezzi = StringUtil.split(mode, '!'); // pezzi=StringUtil.split(mode, '!');esito.addAll(SismicaUtil.aggiungiWorkflow(pezzi[2],pezzi[3]));}
// esito.addAll(SismicaUtil.aggiungiWorkflow(pezzi[2], pezzi[3]));
// }
return esito; return esito;
} }

36
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.DettPratica;
import it.tref.liferay.portos.bo.model.FineLavori; import it.tref.liferay.portos.bo.model.FineLavori;
import it.tref.liferay.portos.bo.model.IntPratica; 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.AvvisoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
@ -192,6 +193,41 @@ public class SismicaUtil {
return esito; return esito;
} }
public static List<String> gestionePratiche() {
List<String> esito = new ArrayList<>();
esito.add("Gestione pratiche");
int start = 0;
List<IntPratica> 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<String> riparaAssegnazioniAlRuolo(long companyId, long userId) { private static List<String> riparaAssegnazioniAlRuolo(long companyId, long userId) {
List<String> esito = new ArrayList<>(); List<String> esito = new ArrayList<>();

35
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("Autorizzazione ");
} }
sb.append("n. "); 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())) { if (Validator.isNotNull(intPratica.getNumeroProgetto())) {
sb.append(intPratica.getNumeroProgetto()).append(StringPool.SPACE).append(StringPool.DASH) sb.append(intPratica.getNumeroProgetto()).append(StringPool.SPACE).append(StringPool.DASH)
.append(StringPool.SPACE); .append(StringPool.SPACE);
} }
sb.append(getDettPraticaId()).append(" (Temporaneo) "); 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()); sb.append(" - id ").append(intPratica.getIntPraticaId());
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
@ -110,9 +110,9 @@ public class DettPraticaImpl extends DettPraticaBaseImpl {
sb.append(LanguageUtil.get(LocaleUtil.getSiteDefault(), "label-integrazione-" + getTipoIntegrazione())); sb.append(LanguageUtil.get(LocaleUtil.getSiteDefault(), "label-integrazione-" + getTipoIntegrazione()));
} }
if (Validator.isNotNull(getVarianteNumero())) { 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())) { } 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())) { if (Validator.isNotNull(getProtocollo())) {
sb.append(" protocollo ") sb.append(" protocollo ")
@ -136,9 +136,9 @@ public class DettPraticaImpl extends DettPraticaBaseImpl {
sb.append(LanguageUtil.get(LocaleUtil.getSiteDefault(), "label-integrazione-" + getTipoIntegrazione())); sb.append(LanguageUtil.get(LocaleUtil.getSiteDefault(), "label-integrazione-" + getTipoIntegrazione()));
} }
if (Validator.isNotNull(getVarianteNumero())) { if (Validator.isNotNull(getVarianteNumero())) {
sb.append(" #").append(getVarianteNumero()); sb.append(StringPool.SPACE).append(StringPool.POUND).append(getVarianteNumero());
} else if (Validator.isNotNull(getIntegrazione())) { } 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()) sb.append(StringPool.SPACE).append(StringPool.OPEN_PARENTHESIS).append(getTitle())
.append(StringPool.CLOSE_PARENTHESIS); .append(StringPool.CLOSE_PARENTHESIS);
@ -149,9 +149,7 @@ public class DettPraticaImpl extends DettPraticaBaseImpl {
public String serializeToVersioning() throws NoSuchFieldException, SecurityException { public String serializeToVersioning() throws NoSuchFieldException, SecurityException {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(StringPool.OPEN_CURLY_BRACE).append("\"version\":").append(StringPool.QUOTE) sb.append("{\"version\":\"").append(Constants.DETTPRATICA_VERSION_IMPL).append("\",\"fields\":[");
.append(Constants.DETTPRATICA_VERSION_IMPL).append(StringPool.QUOTE).append(StringPool.COMMA)
.append("\"fields\":").append(StringPool.OPEN_BRACKET);
Map<String, Object> modelAttributes = getModelValues(); Map<String, Object> modelAttributes = getModelValues();
String privateUuid = "uuid_"; String privateUuid = "uuid_";
Object[][] columns = DettPraticaModelImpl.TABLE_COLUMNS; Object[][] columns = DettPraticaModelImpl.TABLE_COLUMNS;
@ -176,15 +174,13 @@ public class DettPraticaImpl extends DettPraticaBaseImpl {
break; break;
} }
Object value = modelAttributes.get(property); Object value = modelAttributes.get(property);
sb.append(StringPool.OPEN_CURLY_BRACE).append("\"name\":").append(StringPool.QUOTE).append(property) sb.append("{\"name\":\"").append(property).append("\",\"class\":\"").append(className)
.append(StringPool.QUOTE).append(StringPool.COMMA).append("\"class\":").append(StringPool.QUOTE) .append("\",\"value\":")
.append(className).append(StringPool.QUOTE).append(StringPool.COMMA).append("\"value\":")
.append(JSONObject.quote(String.valueOf(value)).replaceAll("[\r\n]+", StringPool.SPACE)) .append(JSONObject.quote(String.valueOf(value)).replaceAll("[\r\n]+", StringPool.SPACE))
.append(StringPool.CLOSE_CURLY_BRACE).append(StringPool.COMMA); .append(StringPool.CLOSE_CURLY_BRACE).append(StringPool.COMMA);
} }
sb.setLength(sb.length() - 1); sb.setLength(sb.length() - 1);
sb.append(StringPool.CLOSE_BRACKET); sb.append(StringPool.CLOSE_BRACKET).append(StringPool.CLOSE_CURLY_BRACE);
sb.append(StringPool.CLOSE_CURLY_BRACE);
return sb.toString(); return sb.toString();
} }
@ -192,7 +188,7 @@ public class DettPraticaImpl extends DettPraticaBaseImpl {
public String serializeToVersioningPage() throws NoSuchFieldException, SecurityException { public String serializeToVersioningPage() throws NoSuchFieldException, SecurityException {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(StringPool.OPEN_CURLY_BRACE).append("\"fields\":").append(StringPool.OPEN_BRACKET); sb.append("{\"fields\":[");
Object[][] columns = DettPraticaModelImpl.TABLE_COLUMNS; Object[][] columns = DettPraticaModelImpl.TABLE_COLUMNS;
for (Object[] column_x : columns) { for (Object[] column_x : columns) {
String property = (String) column_x[0]; String property = (String) column_x[0];
@ -201,8 +197,7 @@ public class DettPraticaImpl extends DettPraticaBaseImpl {
} }
} }
sb.setLength(sb.length() - 1); sb.setLength(sb.length() - 1);
sb.append(StringPool.CLOSE_BRACKET); sb.append(StringPool.CLOSE_BRACKET).append(StringPool.CLOSE_CURLY_BRACE);
sb.append(StringPool.CLOSE_CURLY_BRACE);
return sb.toString(); return sb.toString();
} }

55
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; 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.Comune;
import it.tref.liferay.portos.bo.model.ControlloPratica; 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.IntPratica;
import it.tref.liferay.portos.bo.model.ParereGeologo; import it.tref.liferay.portos.bo.model.ParereGeologo;
import it.tref.liferay.portos.bo.model.Provincia; import it.tref.liferay.portos.bo.model.Provincia;
import it.tref.liferay.portos.bo.model.Territorio; import it.tref.liferay.portos.bo.model.Territorio;
import it.tref.liferay.portos.bo.search.ControlloPraticaAdvancedSearch; 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.ComuneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaServiceUtil; 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.TerritorioLocalServiceUtil;
import it.tref.liferay.portos.bo.service.permission.IntPraticaPermission; 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.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.shared.util.Constants;
import it.tref.liferay.portos.bo.util.AvvisoUtil; import it.tref.liferay.portos.bo.util.AvvisoUtil;
import it.tref.liferay.portos.bo.util.MailUtil; 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 it.tref.liferay.portos.bo.util.WorkflowUtil;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; 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.language.LanguageUtil;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; 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.Document;
import com.liferay.portal.kernel.search.Hits; import com.liferay.portal.kernel.search.Hits;
import com.liferay.portal.kernel.servlet.ServletResponseUtil; import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.servlet.SessionErrors; 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.CSVUtil;
import com.liferay.portal.kernel.util.ContentTypes; 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.GetterUtil;
import com.liferay.portal.kernel.util.MimeTypesUtil;
import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; 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.service.WorkflowInstanceLinkLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil; 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; import com.liferay.util.bridges.mvc.MVCPortlet;
public class GestioneAttivitaPortlet extends 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) public void aggiungiDettPraticheAlControllo(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortalException, SystemException { throws PortalException, SystemException {

2
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()); IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(avviso.getIntPraticaId());
long folderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, AvvisoUtil long folderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, AvvisoUtil
.getAllTipoDocumentoFolderProps().get(avviso.getTipoDocumento())); .getAllTipoDocumentoFolderProps().get(avviso.getTipoDocumento()));
_log.info("tipoDocumento = " + avviso.getTipoDocumento() + ", prop = "
+ AvvisoUtil.getAllTipoDocumentoFolderProps().get(avviso.getTipoDocumento()));
String fileName = AvvisoLocalServiceUtil.getFileNameAvviso(avviso.getClassPk(), avviso.getTipoDocumento(), String fileName = AvvisoLocalServiceUtil.getFileNameAvviso(avviso.getClassPk(), avviso.getTipoDocumento(),
avviso.getAvvisoId(), "B"); avviso.getAvvisoId(), "B");
Map<String, Object> parameters = new HashMap<String, Object>(); Map<String, Object> parameters = new HashMap<String, Object>();

11
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; return intPratica;
} }
public void gestionePratica(DettPratica dettPratica) throws Exception { private void gestionePratica(DettPratica dettPratica) throws Exception {
ServiceContext serviceContext = getServiceContext(dettPratica); ServiceContext serviceContext = getServiceContext(dettPratica);
// protocollazione da servizio remoto // protocollazione da servizio remoto
@ -320,6 +320,13 @@ public class SchedulerPratiche implements MessageListener {
0L); 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); dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaGestita(dettPratica.getDettPraticaId(), true);
} }
@ -370,7 +377,7 @@ public class SchedulerPratiche implements MessageListener {
return collaudo; return collaudo;
} }
private ControlloPratica avvioWorkflow(DettPratica dettPratica, long userId, ServiceContext serviceContext) public static ControlloPratica avvioWorkflow(DettPratica dettPratica, long userId, ServiceContext serviceContext)
throws Exception { throws Exception {
if (dettPratica.isCompleta() && !dettPratica.isGestita()) { if (dettPratica.isCompleta() && !dettPratica.isGestita()) {

15
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"; _methodName228 = "calculateDateAvvioProcedimento";
_methodParameterTypes228 = new String[] { "long" }; _methodParameterTypes228 = new String[] { "long" };
_methodName229 = "gestioneWFVarianti";
_methodParameterTypes229 = new String[] {
"it.tref.liferay.portos.bo.model.ControlloPratica"
};
} }
public Object invokeMethod(String name, String[] parameterTypes, public Object invokeMethod(String name, String[] parameterTypes,
@ -507,13 +501,6 @@ public class ControlloPraticaLocalServiceClpInvoker {
return ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(((Long)arguments[0]).longValue()); 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(); throw new UnsupportedOperationException();
} }
@ -603,6 +590,4 @@ public class ControlloPraticaLocalServiceClpInvoker {
private String[] _methodParameterTypes227; private String[] _methodParameterTypes227;
private String _methodName228; private String _methodName228;
private String[] _methodParameterTypes228; private String[] _methodParameterTypes228;
private String _methodName229;
private String[] _methodParameterTypes229;
} }

42
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.AvvisoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.base.AvvisoLocalServiceBaseImpl; 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.shared.util.StatoPraticaConstants;
import it.tref.liferay.portos.bo.util.AvvisoUtil; import it.tref.liferay.portos.bo.util.AvvisoUtil;
import it.tref.liferay.portos.bo.util.AzioniPraticheUtil; 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.Indexable;
import com.liferay.portal.kernel.search.IndexableType; import com.liferay.portal.kernel.search.IndexableType;
import com.liferay.portal.kernel.util.Base64; 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.MimeTypesUtil;
import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.StringPool; 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.model.User;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portlet.documentlibrary.NoSuchFileEntryException; import com.liferay.portlet.documentlibrary.NoSuchFileEntryException;
import com.liferay.portlet.documentlibrary.NoSuchFolderException;
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.util.dao.orm.CustomSQLUtil; import com.liferay.util.dao.orm.CustomSQLUtil;
@ -125,19 +128,44 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
} }
@Override @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, String className, ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
long controlloPraticaId) throws SystemException, PortalException { long controlloPraticaId) throws SystemException, PortalException {
IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId); IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId);
if (base64File.isEmpty() || !base64File.startsWith("data:application/pdf;base64,")) {
String statoPraticaCode = PraticaUtil.getStatoPraticaCode(stato, intPratica); String statoPraticaCode = PraticaUtil.getStatoPraticaCode(stato, intPratica);
String propertiesTemplate = AvvisoUtil.getFileTemplateProp(statoPraticaCode, intPratica.getTipoProcedura()); String propertiesTemplate = AvvisoUtil.getFileTemplateProp(statoPraticaCode, intPratica.getTipoProcedura());
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(), long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
propertiesTemplate); propertiesTemplate);
_log.info("statoPraticaCode=" + statoPraticaCode + ", tipoProcedura=" + intPratica.getTipoProcedura() _log.info("statoPraticaCode=" + statoPraticaCode + ", tipoProcedura=" + intPratica.getTipoProcedura()
+ ", propertiesTemplate=" + propertiesTemplate + ", fileEntryIdTemplate=" + fileEntryIdTemplate); + ", propertiesTemplate=" + propertiesTemplate + ", fileEntryIdTemplate=" + fileEntryIdTemplate);
return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate, classPk, return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate,
className, userCodiceFiscalePrimaFirma, jsonParameters, controlloPraticaId, serviceContext); 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 @Override
@ -145,8 +173,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma, ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
long controlloPraticaId) throws SystemException, PortalException { long controlloPraticaId) throws SystemException, PortalException {
return createStandardAvvisoPratica(intPraticaId, stato, null, classPk, className, serviceContext, tipoAvviso, return createStandardAvvisoPratica(intPraticaId, stato, StringPool.BLANK, classPk, className, serviceContext,
userCodiceFiscalePrimaFirma, controlloPraticaId); tipoAvviso, userCodiceFiscalePrimaFirma, controlloPraticaId);
} }
@Override @Override
@ -180,9 +208,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
+ "\", userCodiceFiscalePrimaFirma=\"" + userCodiceFiscalePrimaFirma + "\", fileEntryIdBase=" + "\", userCodiceFiscalePrimaFirma=\"" + userCodiceFiscalePrimaFirma + "\", fileEntryIdBase="
+ fileEntryIdBase + ", fileEntryIdFirma=" + fileEntryIdFirma + ", jsonParameters=\"" + jsonParameters + fileEntryIdBase + ", fileEntryIdFirma=" + fileEntryIdFirma + ", jsonParameters=\"" + jsonParameters
+ "\", controlloPraticaId=" + controlloPraticaId + ", serviceContext=\"" + serviceContext + "\""); + "\", controlloPraticaId=" + controlloPraticaId + ", serviceContext=\"" + serviceContext + "\"");
if (0 == fileEntryIdTemplate) {
throw new PortalException("fileEntryIdTemplate=" + fileEntryIdTemplate);
}
User user = userPersistence.fetchByPrimaryKey(serviceContext.getUserId()); User user = userPersistence.fetchByPrimaryKey(serviceContext.getUserId());
Date now = new Date(); Date now = new Date();
Avviso avviso = createAvviso(counterLocalService.increment(Avviso.class.getName())); Avviso avviso = createAvviso(counterLocalService.increment(Avviso.class.getName()));

28
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.GestioneFirmeUtil;
import it.tref.liferay.portos.bo.util.PraticaUtil; import it.tref.liferay.portos.bo.util.PraticaUtil;
import it.tref.liferay.portos.bo.util.TempisticaConstants; 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.bo.util.WorkflowUtil;
import it.tref.liferay.portos.kaleo.model.FormLog; import it.tref.liferay.portos.kaleo.model.FormLog;
import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil; import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil;
import it.tref.liferay.portos.kaleo.shared.util.WorkflowConstants;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; 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.search.IndexerRegistryUtil;
import com.liferay.portal.kernel.util.ContentTypes; import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.GetterUtil; 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.OrderByComparatorFactoryUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
@ -309,11 +310,15 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
codiceFiscale = GestioneFirmeUtil.getCodiceFiscaleFirma(controlloPratica.getCompanyId(), codiceFiscale = GestioneFirmeUtil.getCodiceFiscaleFirma(controlloPratica.getCompanyId(),
controlloPratica.getGroupId(), statoPratica); controlloPratica.getGroupId(), statoPratica);
} }
// TODO Da riempire String base64File = StringPool.BLANK;
// XXX Di cosa? Di caramelle? @SuppressWarnings("unchecked")
String jsonParameters = StringPool.BLANK; Map<String, String> formParameters = (Map<String, String>) workflowContext
avvisoLocalService.createStandardAvvisoPratica(controlloPratica.getIntPraticaId(), statoPratica, .get(WorkflowConstants.CONTEXT_TASK_FORM_PARAMETERS);
jsonParameters, dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext, 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); AvvisoUtil.TIPO_AVVISO_FIRMA, codiceFiscale, controlloPraticaId);
return true; return true;
} }
@ -332,9 +337,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
intPraticaLocalService.updateIntPratica(intPratica); 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 @Override
public String valutazioneEsitoFinaleUpdateStatoPratica(long controlloPraticaId, public String valutazioneEsitoFinaleUpdateStatoPratica(long controlloPraticaId,
Map<String, Serializable> workflowContext) throws PortalException, SystemException { Map<String, Serializable> workflowContext) throws PortalException, SystemException {
@ -705,11 +708,4 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
return giorni - stop; return giorni - stop;
} }
/**
* ADT: gestione workflow varianti
*/
@Override
public void gestioneWFVarianti(ControlloPratica cp) {
}
} }

5
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<ControlloPratica> wfNewListVarianti = new ArrayList<ControlloPratica>(); List<ControlloPratica> wfNewListVarianti = new ArrayList<ControlloPratica>();
ControlloPratica cp = ControlloPraticaLocalServiceUtil.updateStatus(userId, resourcePrimKey, status, ControlloPratica cp = ControlloPraticaLocalServiceUtil.updateStatus(userId, resourcePrimKey, status,
serviceContext, wfNewListVarianti); 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; return cp;
} }
} }

4
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
## ##
build.namespace=portos_bo build.namespace=portos_bo
build.number=3046 build.number=3053
build.date=1618844951246 build.date=1619167679284
build.auto.upgrade=true build.auto.upgrade=true
## ##

16
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 contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.liferay.portos.bo.util.AvvisoUtil"%> <%@page import="it.tref.liferay.portos.bo.util.AvvisoUtil"%>
<%@page import="com.liferay.portlet.documentlibrary.util.DLUtil"%> <%@page import="com.liferay.portlet.documentlibrary.util.DLUtil"%>
@ -14,10 +15,9 @@
<%@page import="it.tref.liferay.portos.bo.util.WorkflowUtil"%> <%@page import="it.tref.liferay.portos.bo.util.WorkflowUtil"%>
<%@page import="com.liferay.portal.model.User"%> <%@page import="com.liferay.portal.model.User"%>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%> <%@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<String, Serializable> parametri = WorkflowUtil.getFormParameters(controlloPratica); Map<String, Serializable> parametri = WorkflowUtil.getFormParameters(controlloPratica);
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId()); IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId());
DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica.getIntPraticaId()); DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica.getIntPraticaId());
@ -27,7 +27,9 @@ Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getT
Group groupTerritorio = GroupLocalServiceUtil.getGroup(territorio.getGroupId()); Group groupTerritorio = GroupLocalServiceUtil.getGroup(territorio.getGroupId());
Organization org = OrganizationLocalServiceUtil.getOrganization(groupTerritorio.getOrganizationId()); Organization org = OrganizationLocalServiceUtil.getOrganization(groupTerritorio.getOrganizationId());
Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId()); Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId());
List<ParereGeologo> pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPraticaId(intPratica.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS); List<ParereGeologo> pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPraticaId(intPratica.getIntPraticaId(),
QueryUtil.ALL_POS, QueryUtil.ALL_POS);
List<String> nascosti = Arrays.asList(new String[] { "base64" });
%> %>
<h4 class="title_int_pratica"><%= intPratica.getTitle(true) %></h4> <h4 class="title_int_pratica"><%= intPratica.getTitle(true) %></h4>
<liferay-portlet:renderURL portletName='<%= PortletKeys.CARICHI_LAVORO %>' <liferay-portlet:renderURL portletName='<%= PortletKeys.CARICHI_LAVORO %>'
@ -119,13 +121,17 @@ List<ParereGeologo> pareriGeologo = ParereGeologoLocalServiceUtil.findByIntPrati
if (parametri.isEmpty()) { if (parametri.isEmpty()) {
out.print("<li><strong>Nessun dato inserito</strong></li>"); out.print("<li><strong>Nessun dato inserito</strong></li>");
} else { } else {
boolean base64 = MapUtil.getBoolean(parametri, "base64", false);
for (Entry<String, Serializable> entry : parametri.entrySet()) { for (Entry<String, Serializable> entry : parametri.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
if (key.equals("ingloba_variante")) { if (key.equals("ingloba_variante")) {
String value = entry.getValue().toString(); String value = entry.getValue().toString();
out.print("<li><strong>" + value + "</strong></li>"); out.print("<li><strong>" + value + "</strong></li>");
} else { } else if (!nascosti.contains(key)) {
String value = entry.getValue().toString(); String value = entry.getValue().toString();
if (base64 && key.equalsIgnoreCase("testo_del_documento")) {
value = "File allegato";
}
out.print("<li><strong>" + LanguageUtil.get(pageContext, key) + ":</strong> " out.print("<li><strong>" + LanguageUtil.get(pageContext, key) + ":</strong> "
+ LanguageUtil.get(pageContext, + LanguageUtil.get(pageContext,
WorkflowUtil.adjustWorkflowContextValue(key, value, intPratica.getIntPraticaId())) WorkflowUtil.adjustWorkflowContextValue(key, value, intPratica.getIntPraticaId()))

20
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 buttonIdCambioIstruttore = "buttonIdCambioIstruttore_" + randomId;
String buttonIdSelezionaGeologo = "buttonIdSelezionaGeologo_" + randomId; String buttonIdSelezionaGeologo = "buttonIdSelezionaGeologo_" + randomId;
String buttonIdAnnullaRicGeologo = "buttonIdAnnullaRicGeologo_" + randomId; String buttonIdAnnullaRicGeologo = "buttonIdAnnullaRicGeologo_" + randomId;
String buttonIdAllegaSanzione = "buttonIdAllegaSanzione_" + controlloPratica.getDettPraticaId();
String buttonIdAggiungiDettPraticheAlControllo = "buttonIdAggiungiDettPraticheAlControllo_" + randomId; String buttonIdAggiungiDettPraticheAlControllo = "buttonIdAggiungiDettPraticheAlControllo_" + randomId;
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
long territorioGroupId = territorio.getGroupId(); long territorioGroupId = territorio.getGroupId();
@ -160,25 +159,6 @@ long territorioGroupId = territorio.getGroupId();
</div> </div>
</c:if> </c:if>
</c:if> </c:if>
<c:if test="<%= intPratica.isSanatoria() && IntPraticaPermission.contains(permissionChecker,
territorioGroupId, ActionKeys.RICHIEDI_PARERE_GEOLOGO)
&& intPratica.getStatusByUserId() == user.getUserId() %>">
<liferay-util:include page="/html/gestioneattivita/actions/action_allega_sanzione.jsp"
servletContext="<%= application %>" >
<liferay-util:param name="intPraticaId"
value="<%= String.valueOf(intPratica.getIntPraticaId()) %>" />
<liferay-util:param name="dettPraticaId"
value="<%= String.valueOf(controlloPratica.getDettPraticaId()) %>" />
<liferay-util:param name="dettPraticaId"
value="<%= String.valueOf(controlloPratica.getControlloPraticaId()) %>" />
<liferay-util:param name="buttonIdAllegaSanzione" value="<%= buttonIdAllegaSanzione %>" />
</liferay-util:include>
<div title='<%= LanguageUtil.get(pageContext, "fascicolo-action-allega-sanzione-doc1") %>'
class="tooltip-info">
<liferay-ui:icon id="<%= buttonIdAllegaSanzione %>" linkCssClass="btn btn-action"
iconCssClass="fa fa-map" message="" url="#" />
</div>
</c:if>
</c:if> </c:if>
<c:if test="<%= lastDettPraticaId != controlloPratica.getDettPraticaId() <c:if test="<%= lastDettPraticaId != controlloPratica.getDettPraticaId()
&& intPratica.getStatusByUserId() == user.getUserId() %>"> && intPratica.getStatusByUserId() == user.getUserId() %>">

36
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/actions/action_allega_sanzione.jsp

@ -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;
%>
<liferay-portlet:actionURL name="allegaSanzione" var="allegaSanzioneURL">
<liferay-util:param name="intPraticaId" value="<%= String.valueOf(intPraticaId) %>" />
<liferay-util:param name="dettPraticaId" value="<%= String.valueOf(dettPraticaId) %>" />
<liferay-util:param name="controlloPraticaId" value="<%= String.valueOf(controlloPraticaId) %>" />
<liferay-util:param name="tipoFile" value="<%= StatoPraticaConstants.SANZIONE_DOC1 %>" />
<liferay-util:param name="redirect" value="<%= currentURL %>" />
</liferay-portlet:actionURL>
<aui:form name="<%= formNameAllegaSanzione %>" method="post" enctype="multipart/form-data"
action="<%= allegaSanzioneURL %>">
<div id='<%= renderResponse.getNamespace() + divIdAllegaSanzione %>' class="hide">
<aui:input type="file" name="fileSanzione" label="File">
<aui:validator name="required" />
</aui:input>
</div>
<liferay-util:include page="/html/common/submit_window.jsp" servletContext="<%= application %>">
<liferay-util:param name="formName" value="<%= formNameAllegaSanzione %>" />
<liferay-util:param name="titolo" value="Allega computo sanzione" />
<liferay-util:param name="buttonId" value="<%= buttonIdAllegaSanzione %>" />
<liferay-util:param name="buttonConferma" value="CONFERMA" />
<liferay-util:param name="contentDiv" value="<%= divIdAllegaSanzione %>" />
<liferay-util:param name="width" value="500" />
<liferay-util:param name="buttonBar" value="true" />
</liferay-util:include>
</aui:form>

277
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.model.ControlloPratica;
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; 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.KaleoTaskAssignmentInstance;
import it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken; 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.KaleoTaskAssignmentInstanceLocalServiceUtil;
import it.tref.liferay.portos.kaleo.controller.service.KaleoTaskInstanceTokenLocalServiceUtil; 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.List;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; 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.Message;
import com.liferay.portal.kernel.messaging.MessageListener; import com.liferay.portal.kernel.messaging.MessageListener;
import com.liferay.portal.kernel.messaging.MessageListenerException; 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; import com.liferay.portal.model.User;
public class SchedulerKaleoController implements MessageListener { public class SchedulerKaleoController implements MessageListener {
@ -37,7 +46,7 @@ public class SchedulerKaleoController implements MessageListener {
if (lock.tryLock()) { if (lock.tryLock()) {
try { try {
// Riparazione pratiche con workflow sporco // Riparazione pratiche con workflow sporco
riparaLifecycleWorkflowNew(); // riparaLifecycleWorkflowNew();
} catch (Exception e) { } catch (Exception e) {
_log.error(e, e); _log.error(e, e);
} finally { } finally {
@ -48,139 +57,139 @@ public class SchedulerKaleoController implements MessageListener {
// ADT // ADT
private void riparaLifecycleWorkflowNew() throws Exception { private void riparaLifecycleWorkflowNew() throws Exception {
// List<Object[]> listaKO = new ArrayList<Object[]>(); List<Object[]> listaKO = new ArrayList<Object[]>();
// List<Object[]> lista = IntPraticaLocalServiceUtil.riparaWorkflow(); List<Object[]> lista = IntPraticaLocalServiceUtil.riparaWorkflow();
// for (Object[] objs : lista) { for (Object[] objs : lista) {
// long kaleotaskinstancetokenid = Long.parseLong(String.valueOf(objs[0])); long kaleotaskinstancetokenid = Long.parseLong(String.valueOf(objs[0]));
// long kaleoinstancetokenid = Long.parseLong(String.valueOf(objs[1])); long kaleoinstancetokenid = Long.parseLong(String.valueOf(objs[1]));
// long controllopraticaid = (objs[2] != null) ? Long.parseLong(String.valueOf(objs[2])) : 0; long controllopraticaid = (objs[2] != null) ? Long.parseLong(String.valueOf(objs[2])) : 0;
// long statusbyuserid = Long.parseLong(String.valueOf(objs[3])); long statusbyuserid = Long.parseLong(String.valueOf(objs[3]));
// _log.info("RIPARA_WORKFLOW inizio lavorazione -- controllopraticaid=" + controllopraticaid _log.info("RIPARA_WORKFLOW inizio lavorazione -- controllopraticaid=" + controllopraticaid
// + " statusbyuserid=" + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid + " statusbyuserid=" + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid
// + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid); + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid);
// if (controllopraticaid == 0) { if (controllopraticaid == 0) {
// _log.info("RIPARA_WORKFLOW KO controllopraticaid non valorizzato =" + controllopraticaid); _log.info("RIPARA_WORKFLOW KO controllopraticaid non valorizzato =" + controllopraticaid);
// continue; continue;
// } }
// try { try {
// ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
// .fetchControlloPratica(controllopraticaid); .fetchControlloPratica(controllopraticaid);
// DynamicQuery queryKIT = DynamicQueryFactoryUtil.forClass(KaleoTaskInstanceToken.class); DynamicQuery queryKIT = DynamicQueryFactoryUtil.forClass(KaleoTaskInstanceToken.class);
// queryKIT.add(RestrictionsFactoryUtil.eq("classPK", controllopraticaid)); queryKIT.add(RestrictionsFactoryUtil.eq("classPK", controllopraticaid));
// Order defaultOrderDettPrtatica = OrderFactoryUtil.asc("createDate"); Order defaultOrderDettPrtatica = OrderFactoryUtil.asc("createDate");
// queryKIT.addOrder(defaultOrderDettPrtatica); queryKIT.addOrder(defaultOrderDettPrtatica);
// List<KaleoTaskInstanceToken> listas = KaleoTaskInstanceTokenLocalServiceUtil.dynamicQuery(queryKIT); List<KaleoTaskInstanceToken> listas = KaleoTaskInstanceTokenLocalServiceUtil.dynamicQuery(queryKIT);
// if (listas != null && !listas.isEmpty()) { if (listas != null && !listas.isEmpty()) {
// KaleoTaskInstanceToken ktit = null; KaleoTaskInstanceToken ktit = null;
// for (KaleoTaskInstanceToken k : listas) { for (KaleoTaskInstanceToken k : listas) {
// if (k.getKaleoTaskName().equalsIgnoreCase("Assegnazione")) { if (k.getKaleoTaskName().equalsIgnoreCase("Assegnazione")) {
// ktit = k; ktit = k;
// break; break;
// } }
// } }
// if (ktit != null) { if (ktit != null) {
// WorkflowInstance wfInstance = WorkflowInstanceManagerUtil.getWorkflowInstance( WorkflowInstance wfInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(
// controlloPratica.getCompanyId(), ktit.getKaleoInstanceId()); controlloPratica.getCompanyId(), ktit.getKaleoInstanceId());
// Serializable wfVariante = wfInstance.getWorkflowContext().get("wf_variante"); Serializable wfVariante = wfInstance.getWorkflowContext().get("wf_variante");
// boolean isVariante = false; boolean isVariante = false;
// if (wfVariante != null) { if (wfVariante != null) {
// isVariante = (wfVariante != null && wfVariante.toString().length() > 0); isVariante = (wfVariante != null && wfVariante.toString().length() > 0);
// } }
// _log.info("RIPARA_WORKFLOW isVariante=" + isVariante + " per controllopraticaid=" _log.info("RIPARA_WORKFLOW isVariante=" + isVariante + " per controllopraticaid="
// + controllopraticaid); + controllopraticaid);
// _log.info("RIPARA_WORKFLOW KaleoTaskInstanceTokenId=" + ktit.getKaleoTaskInstanceTokenId() _log.info("RIPARA_WORKFLOW KaleoTaskInstanceTokenId=" + ktit.getKaleoTaskInstanceTokenId()
// + " --controllopraticaid=" + controllopraticaid); + " --controllopraticaid=" + controllopraticaid);
// DynamicQuery queryKAT = DynamicQueryFactoryUtil.forClass(KaleoTaskAssignmentInstance.class); DynamicQuery queryKAT = DynamicQueryFactoryUtil.forClass(KaleoTaskAssignmentInstance.class);
// queryKAT.add(RestrictionsFactoryUtil.eq("kaleoTaskInstanceTokenId", queryKAT.add(RestrictionsFactoryUtil.eq("kaleoTaskInstanceTokenId",
// ktit.getKaleoTaskInstanceTokenId())); ktit.getKaleoTaskInstanceTokenId()));
// List<KaleoTaskAssignmentInstance> listass = KaleoTaskAssignmentInstanceLocalServiceUtil List<KaleoTaskAssignmentInstance> listass = KaleoTaskAssignmentInstanceLocalServiceUtil
// .dynamicQuery(queryKAT); .dynamicQuery(queryKAT);
// _log.info("size lista KaleoTaskAssignmentInstance per kaleoTaskInstanceTokenId=" _log.info("size lista KaleoTaskAssignmentInstance per kaleoTaskInstanceTokenId="
// + ktit.getKaleoTaskInstanceTokenId() + " :" + listass.size()); + ktit.getKaleoTaskInstanceTokenId() + " :" + listass.size());
// if (listass != null && !listass.isEmpty()) { if (listass != null && !listass.isEmpty()) {
// // creazione record assente sulla tabella KaleoTaskAssignmentInstance // creazione record assente sulla tabella KaleoTaskAssignmentInstance
// KaleoTaskAssignmentInstance assignmentInstanceApp = listass.get(0); KaleoTaskAssignmentInstance assignmentInstanceApp = listass.get(0);
// long kaleoTaskAssignementInstanceId = CounterLocalServiceUtil long kaleoTaskAssignementInstanceId = CounterLocalServiceUtil
// .increment("com.liferay.counter.model.Counter"); .increment("com.liferay.counter.model.Counter");
// KaleoTaskAssignmentInstance assignmentInstance = KaleoTaskAssignmentInstanceLocalServiceUtil KaleoTaskAssignmentInstance assignmentInstance = KaleoTaskAssignmentInstanceLocalServiceUtil
// .createKaleoTaskAssignmentInstance(kaleoTaskAssignementInstanceId); .createKaleoTaskAssignmentInstance(kaleoTaskAssignementInstanceId);
// assignmentInstance.setCreateDate(assignmentInstanceApp.getCreateDate()); assignmentInstance.setCreateDate(assignmentInstanceApp.getCreateDate());
// assignmentInstance.setModifiedDate(assignmentInstanceApp.getModifiedDate()); assignmentInstance.setModifiedDate(assignmentInstanceApp.getModifiedDate());
// assignmentInstance.setModifiedDate(assignmentInstanceApp.getModifiedDate()); assignmentInstance.setModifiedDate(assignmentInstanceApp.getModifiedDate());
// assignmentInstance.setGroupId(assignmentInstanceApp.getGroupId()); assignmentInstance.setGroupId(assignmentInstanceApp.getGroupId());
// assignmentInstance.setCompanyId(assignmentInstanceApp.getCompanyId()); assignmentInstance.setCompanyId(assignmentInstanceApp.getCompanyId());
// assignmentInstance.setUserId(assignmentInstanceApp.getUserId()); assignmentInstance.setUserId(assignmentInstanceApp.getUserId());
// assignmentInstance.setUserName(assignmentInstanceApp.getUserName()); assignmentInstance.setUserName(assignmentInstanceApp.getUserName());
// assignmentInstance.setKaleoDefinitionId(assignmentInstanceApp.getKaleoDefinitionId()); assignmentInstance.setKaleoDefinitionId(assignmentInstanceApp.getKaleoDefinitionId());
// assignmentInstance.setKaleoInstanceId(assignmentInstanceApp.getKaleoInstanceId()); assignmentInstance.setKaleoInstanceId(assignmentInstanceApp.getKaleoInstanceId());
// assignmentInstance.setKaleoInstanceTokenId(kaleoinstancetokenid); assignmentInstance.setKaleoInstanceTokenId(kaleoinstancetokenid);
// assignmentInstance.setKaleoTaskInstanceTokenId(kaleotaskinstancetokenid); assignmentInstance.setKaleoTaskInstanceTokenId(kaleotaskinstancetokenid);
// assignmentInstance.setKaleoTaskId(21642L); assignmentInstance.setKaleoTaskId(21642L);
// assignmentInstance.setKaleoTaskName("Esito"); assignmentInstance.setKaleoTaskName("Esito");
// assignmentInstance.setAssigneeClassName(User.class.getName()); assignmentInstance.setAssigneeClassName(User.class.getName());
// assignmentInstance.setAssigneeClassPK(statusbyuserid); assignmentInstance.setAssigneeClassPK(statusbyuserid);
// assignmentInstance.setCompleted(false); assignmentInstance.setCompleted(false);
// KaleoTaskAssignmentInstanceLocalServiceUtil KaleoTaskAssignmentInstanceLocalServiceUtil
// .updateKaleoTaskAssignmentInstance(assignmentInstance); .updateKaleoTaskAssignmentInstance(assignmentInstance);
// // patch per tener contro anche delle varianti create da applicativo portos2: forzo lo stato // patch per tener contro anche delle varianti create da applicativo portos2: forzo lo stato
// // del WF a ESITO // del WF a ESITO
// long kaleoInstanceId = assignmentInstanceApp.getKaleoInstanceId(); long kaleoInstanceId = assignmentInstanceApp.getKaleoInstanceId();
// KaleoInstance kaleoInstance = KaleoInstanceLocalServiceUtil KaleoInstance kaleoInstance = KaleoInstanceLocalServiceUtil
// .getKaleoInstance(kaleoInstanceId); .getKaleoInstance(kaleoInstanceId);
// long rootKaleoInstanceTokenId = kaleoInstance.getRootKaleoInstanceTokenId(); long rootKaleoInstanceTokenId = kaleoInstance.getRootKaleoInstanceTokenId();
// KaleoInstanceToken rootKaleoInstanceToken = KaleoInstanceTokenLocalServiceUtil KaleoInstanceToken rootKaleoInstanceToken = KaleoInstanceTokenLocalServiceUtil
// .getKaleoInstanceToken(rootKaleoInstanceTokenId); .getKaleoInstanceToken(rootKaleoInstanceTokenId);
// _log.info("rootKaleoInstanceToken=" + rootKaleoInstanceToken.getCurrentKaleoNodeName()); _log.info("rootKaleoInstanceToken=" + rootKaleoInstanceToken.getCurrentKaleoNodeName());
// rootKaleoInstanceToken.setCurrentKaleoNodeId(21639); rootKaleoInstanceToken.setCurrentKaleoNodeId(21639);
// rootKaleoInstanceToken.setCurrentKaleoNodeName("Esito"); rootKaleoInstanceToken.setCurrentKaleoNodeName("Esito");
// KaleoInstanceTokenLocalServiceUtil.updateKaleoInstanceToken(rootKaleoInstanceToken); KaleoInstanceTokenLocalServiceUtil.updateKaleoInstanceToken(rootKaleoInstanceToken);
// // task di assegnazione viene inserito a completato: // task di assegnazione viene inserito a completato:
// if (!assignmentInstanceApp.isCompleted()) { if (!assignmentInstanceApp.isCompleted()) {
// assignmentInstanceApp.setCompleted(true); assignmentInstanceApp.setCompleted(true);
// assignmentInstanceApp.setCompletionDate(new Date()); assignmentInstanceApp.setCompletionDate(new Date());
// KaleoTaskAssignmentInstanceLocalServiceUtil KaleoTaskAssignmentInstanceLocalServiceUtil
// .updateKaleoTaskAssignmentInstance(assignmentInstanceApp); .updateKaleoTaskAssignmentInstance(assignmentInstanceApp);
// } }
// // solo per le nuove varianti di PORTOS2 // solo per le nuove varianti di PORTOS2
// if (isVariante) { if (isVariante) {
// _log.info("cancellazione task di assegnazione per controllopraticaid=" _log.info("cancellazione task di assegnazione per controllopraticaid="
// + controllopraticaid); + controllopraticaid);
// KaleoTaskInstanceTokenLocalServiceUtil.deleteKaleoTaskInstanceToken(ktit); KaleoTaskInstanceTokenLocalServiceUtil.deleteKaleoTaskInstanceToken(ktit);
// KaleoTaskAssignmentInstanceLocalServiceUtil KaleoTaskAssignmentInstanceLocalServiceUtil
// .deleteKaleoTaskAssignmentInstance(assignmentInstanceApp); .deleteKaleoTaskAssignmentInstance(assignmentInstanceApp);
// } else if (!ktit.isCompleted()) { } else if (!ktit.isCompleted()) {
// ktit.setCompleted(true); ktit.setCompleted(true);
// ktit.setCompletionDate(new Date()); ktit.setCompletionDate(new Date());
// KaleoTaskInstanceTokenLocalServiceUtil.updateKaleoTaskInstanceToken(ktit); KaleoTaskInstanceTokenLocalServiceUtil.updateKaleoTaskInstanceToken(ktit);
// } }
// if (controlloPratica != null) { if (controlloPratica != null) {
// _log.info("RIPARA_WORKFLOW - Pulisco Workflow ed indicizzo per intPraticaId=" _log.info("RIPARA_WORKFLOW - Pulisco Workflow ed indicizzo per intPraticaId="
// + controlloPratica.getIntPraticaId()); + controlloPratica.getIntPraticaId());
// CacheRegistryUtil.clear(); CacheRegistryUtil.clear();
// IntPraticaLocalServiceUtil.reIndexFasciolo(controlloPratica.getIntPraticaId(), IntPraticaLocalServiceUtil.reIndexFasciolo(controlloPratica.getIntPraticaId(),
// controlloPratica.getCompanyId()); controlloPratica.getCompanyId());
// } }
// } }
// _log.info("RIPARA_WORKFLOW fine lavorazione OK -- controllopraticaid=" + controllopraticaid _log.info("RIPARA_WORKFLOW fine lavorazione OK -- controllopraticaid=" + controllopraticaid
// + " statusbyuserid=" + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid + " statusbyuserid=" + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid
// + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid); + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid);
// } else { } else {
// _log.info("RIPARA_WORKFLOW fine lavorazione KO --task assegnazione non trovato per controllopraticaid=" _log.info("RIPARA_WORKFLOW fine lavorazione KO --task assegnazione non trovato per controllopraticaid="
// + controllopraticaid + controllopraticaid
// + " statusbyuserid=" + " statusbyuserid="
// + statusbyuserid + statusbyuserid
// + " kaleoinstancetokenid=" + " kaleoinstancetokenid="
// + kaleoinstancetokenid + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid); + kaleoinstancetokenid + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid);
// listaKO.add(objs); listaKO.add(objs);
// } }
// } }
// } catch (Exception e) { } catch (Exception e) {
// _log.error("Errore RIPARA_WORKFLOW -- controllopraticaid=" + controllopraticaid + " statusbyuserid=" _log.error("Errore RIPARA_WORKFLOW -- controllopraticaid=" + controllopraticaid + " statusbyuserid="
// + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid + statusbyuserid + " kaleoinstancetokenid=" + kaleoinstancetokenid
// + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid, e); + " --kaleotaskinstancetokenid=" + kaleotaskinstancetokenid, e);
// } }
// } }
// patchTaskEsitiForWF(listaKO); patchTaskEsitiForWF(listaKO);
} }
private void patchTaskEsitiForWF(List<Object[]> lista) { private void patchTaskEsitiForWF(List<Object[]> lista) {

4
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.namespace=portos_kaleo_controller
build.number=10 build.number=11
build.date=1618410642507 build.date=1618997334627
build.auto.upgrade=true build.auto.upgrade=true
## ##

45
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) %>" /> repeatable="true" requestedLocale="<%= LocaleUtil.fromLanguageId(languageId) %>" />
</liferay-util:buffer> </liferay-util:buffer>
<% <%
String esito = parameters.containsKey("esito") ? parameters.get("esito").toString() : StringPool.BLANK; String esito = MapUtil.getString(parameters, "esito", StringPool.BLANK);
String istruttore = parameters.containsKey("istruttore") ? parameters.get("istruttore").toString() : StringPool.BLANK; String istruttore = MapUtil.getString(parameters, "istruttore", StringPool.BLANK);
String ns = renderResponse.getNamespace(); String ns = renderResponse.getNamespace();
boolean base64 = MapUtil.getBoolean(parameters, "base64", false);
for (Entry<String, List<Map<String, Serializable>>> entry : fieldNameOptions.entrySet()) { for (Entry<String, List<Map<String, Serializable>>> entry : fieldNameOptions.entrySet()) {
String name = entry.getKey(); String name = entry.getKey();
String regexSelect = "(?s)(.*?)(<select.*?\\sname=\"" + ns + name + "_INSTANCE_[^\"]+.*?</select>)(.*)"; String regexSelect = "(?s)(.*?)(<select.*?\\sname=\"" + ns + name + "_INSTANCE_[^\"]+.*?</select>)(.*)";
@ -72,14 +73,12 @@ for (Entry<String, List<Map<String, Serializable>>> entry : fieldNameOptions.ent
if ((name.equals("istruttore") && value.equalsIgnoreCase(istruttore)) || MapUtil.getBoolean(option, "default")) { if ((name.equals("istruttore") && value.equalsIgnoreCase(istruttore)) || MapUtil.getBoolean(option, "default")) {
select += " selected=\"selected\""; select += " selected=\"selected\"";
} }
select += StringPool.GREATER_THAN + HtmlUtil.escape(option.get("label").toString()) + "</option>\n";
} }
html = html.replaceAll(regexSelect, "$1" + select + "</select>\n" + "$3"); html = html.replaceAll(regexSelect, "$1" + select + "</select>\n" + "$3");
} else { } else {
String regexInput = "(?s)<input(.*?)\\sname=\"" + ns + name + "_INSTANCE_[^\"]+\"(.*?)value=\"[^\"]*([^>]+).*?</label>"; String regexInput = "(?s)<input(.*?)\\sname=\"" + ns + name + "_INSTANCE_[^\"]+\"(.*?)value=\"[^\"]*([^>]+).*?</label>";
for (Map<String, Serializable> option : entry.getValue()) { for (Map<String, Serializable> option : entry.getValue()) {
for (Entry<String, Serializable> x : option.entrySet()) {
System.out.println(x.getKey() + " = " + x.getValue());
}
String value = option.get("value").toString(); String value = option.get("value").toString();
String replaceInput = "<input$1 name=\"" + prefix + name + suffix + "\"$2value=\"" + HtmlUtil.escape(value); String replaceInput = "<input$1 name=\"" + prefix + name + suffix + "\"$2value=\"" + HtmlUtil.escape(value);
boolean checked = MapUtil.getBoolean(option, "default"); boolean checked = MapUtil.getBoolean(option, "default");
@ -104,21 +103,45 @@ for (Entry<String, Serializable> p : parameters.entrySet()) {
// Rimozione valori non utilizzati // Rimozione valori non utilizzati
html = html.replaceAll("(?s)<input[^>]*?value=\"Value[0-9]\"[^>]*>.*?</label>", "</label>"); html = html.replaceAll("(?s)<input[^>]*?value=\"Value[0-9]\"[^>]*>.*?</label>", "</label>");
html = html.replaceAll("(?s)<label[^>]*>[ \t\r\n]*</label>", StringPool.BLANK); html = html.replaceAll("(?s)<label[^>]*>[ \t\r\n]*</label>", StringPool.BLANK);
if (base64) {
String search = "(?s)(<textarea .*? name=\"" + prefix +"testo_del_documento" + suffix + "\".*?)>(.*?)</textarea>";
String replace = "$1 style=\"display:none\">$2</textarea>" +
"<input type=\"hidden\" name=\"" + prefix + "base64" + suffix + "\" value=\"true\" /><script>" +
"window.mostraDoc = function() {\n" +
" var w = window.open('');\n" +
" w.document.write(\"<iframe width='100%' height='100%' src='$2'></iframe>\");\n" +
"}\n" +
"</script>File allegato <button type=\"button\" onclick=\"mostraDoc()\">Visualizza</button>";
html = html.replaceAll(search, replace);
}
if (hasFileUpload) { if (hasFileUpload) {
String replace = String replace =
"$1<div id=\"fileInputOn\" style=\"display:none\"><input id=\"allegatoManuale\" type=\"file\" /></div>" + "$1<div id=\"fileInputOn\" style=\"display:block\"><input id=\"allegatoManuale\" type=\"file\" accept=\"application/pdf\"></div>" +
"<input type=\"hidden\" id=\"base64\" name=\"" + prefix + "base64" + suffix + "\" value=\"false\">" +
"<script>\n" + "<script>\n" +
"var inputFile = document.getElementById('allegatoManuale')\n" +
"var inputTesto = document.querySelector(\"[name='" + prefix + "testo_del_documento" + suffix + "']\");\n" +
"var testoDelDocumento = inputTesto.value;\n" +
"var els = document.querySelectorAll('input[type=radio].field');\n" + "var els = document.querySelectorAll('input[type=radio].field');\n" +
"for (var i = 0; i < els.length; i++) {\n" + "for (var i = 0; i < els.length; i++) {\n" +
"els[i].addEventListener('change', function(event) {\n" + "els[i].addEventListener('change', function(event) {\n" +
"var upload = (this.getAttribute('data-upload') === '1');\n" + "var upload = (this.getAttribute('data-upload') === '1');\n" +
"document.getElementById('base64').value = upload ? 'true' : 'false';\n" +
"inputFile.value = '';\n" +
"if (upload) {\n" +
"testoDelDocumento = inputTesto.value;\n" +
"console.log(testoDelDocumento);\n" +
"inputTesto.value = '';\n" +
"} else {\n" +
"inputTesto.value = testoDelDocumento;\n" +
"}\n" +
"document.querySelector(\"[data-fieldname='testo_del_documento']\").style.display = (upload ? 'none' : '')\n" + "document.querySelector(\"[data-fieldname='testo_del_documento']\").style.display = (upload ? 'none' : '')\n" +
"document.getElementById('fileInputOn').style.display = (upload ? '' : 'none')\n" + "document.getElementById('fileInputOn').style.display = (upload ? '' : 'none')\n" +
"});\n" + "});\n" +
"}\n" + "}\n" +
"document.getElementById('allegatoManuale').addEventListener('change', function(event) {\n" + "inputFile.addEventListener('change', function(event) {\n" +
"var files = document.getElementById('allegatoManuale').files;\n" + "var files = this.files;\n" +
"if (files.length > 0) {\n" + "if (files.length > 0) {\n" +
"getBase64(files[0]);\n" + "getBase64(files[0]);\n" +
"}\n" + "}\n" +
@ -128,14 +151,10 @@ if (hasFileUpload) {
"var reader = new FileReader();\n" + "var reader = new FileReader();\n" +
"reader.readAsDataURL(file);\n" + "reader.readAsDataURL(file);\n" +
"reader.onload = function () {\n" + "reader.onload = function () {\n" +
"document.getElementById('testo_del_documento').value = reader.result;\n" + "inputTesto.value = reader.result;\n" +
"};\n" +
"reader.onerror = function (error) {\n" +
"console.log('Error: ', error);\n" +
"};\n" + "};\n" +
"}" + "}" +
"</script>"; "</script>";
System.out.println(replace);
html = html.replaceAll("(?s)(<div[^>]*? data-fieldName=\"testo_del_documento\".*?</div>)", replace); html = html.replaceAll("(?s)(<div[^>]*? data-fieldName=\"testo_del_documento\".*?</div>)", replace);
} }
%> %>

15
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.model.FormLog;
import it.tref.liferay.portos.kaleo.service.ClpSerializer; import it.tref.liferay.portos.kaleo.service.ClpSerializer;
import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil; 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 it.tref.liferay.portos.kaleo.util.WorkflowUtil;
import java.io.IOException; 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.StringUtil;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys; 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.WorkflowException;
import com.liferay.portal.kernel.workflow.WorkflowLog; import com.liferay.portal.kernel.workflow.WorkflowLog;
import com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil; import com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil;
@ -168,17 +168,16 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction {
String transitionName = ParamUtil.getString(actionRequest, "transitionName"); String transitionName = ParamUtil.getString(actionRequest, "transitionName");
String comment = ParamUtil.getString(actionRequest, "comment"); String comment = ParamUtil.getString(actionRequest, "comment");
boolean aggiorna = true; boolean aggiorna = true;
aggiorna = false;
// ADT: bug mancata problema assegnazione WF // ADT: bug mancata problema assegnazione WF
checkPresenzaIstruttore(transitionName, workflowTaskId); checkPresenzaIstruttore(transitionName, workflowTaskId);
// ADT: BUG ANOMALIA REGISTRA ESITO // ADT: BUG ANOMALIA REGISTRA ESITO
if (transitionName.equalsIgnoreCase("registra-esito")) { if (transitionName.equalsIgnoreCase("registra-esito")) {
HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil
.getHttpServletRequest(actionRequest)); .getHttpServletRequest(actionRequest));
String esito = httpServletRequest.getParameter("kaleo--esito--") != null ? httpServletRequest.getParameter( String esito = httpServletRequest.getParameter("kaleo--esito--") == null ? StringPool.BLANK
"kaleo--esito--").trim() : StringPool.BLANK; : httpServletRequest.getParameter("kaleo--esito--").trim();
String testoDocumento = httpServletRequest.getParameter("kaleo--testo_del_documento--") != null ? httpServletRequest String testoDocumento = httpServletRequest.getParameter("kaleo--testo_del_documento--") == null ? StringPool.BLANK
.getParameter("kaleo--testo_del_documento--") : StringPool.BLANK; : httpServletRequest.getParameter("kaleo--testo_del_documento--");
if (!valoriAmmessi.contains(esito) if (!valoriAmmessi.contains(esito)
|| ((esito.equalsIgnoreCase(StatoPraticaConstants.INTEGRAZIONE) || esito || ((esito.equalsIgnoreCase(StatoPraticaConstants.INTEGRAZIONE) || esito
.equalsIgnoreCase(StatoPraticaConstants.PREAVVISO_CONTRARIO)) && testoDocumento.isEmpty())) { .equalsIgnoreCase(StatoPraticaConstants.PREAVVISO_CONTRARIO)) && testoDocumento.isEmpty())) {
@ -193,7 +192,7 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction {
.getHttpServletRequest(actionRequest)); .getHttpServletRequest(actionRequest));
String istruttore = httpServletRequest.getParameter("kaleo--istruttore--"); String istruttore = httpServletRequest.getParameter("kaleo--istruttore--");
if (Validator.isNull(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"); + " non riuscito - istruttore non presente nel workflow");
throw new PortalException("controllo validazione completamento task riassegna non riuscito"); throw new PortalException("controllo validazione completamento task riassegna non riuscito");
} }
@ -211,10 +210,10 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction {
IntPraticaLocalServiceUtil.updateIntPratica(pratica); IntPraticaLocalServiceUtil.updateIntPratica(pratica);
} }
} }
if (aggiorna) {
Map<String, Serializable> workflowContext = new HashMap<String, Serializable>(); Map<String, Serializable> workflowContext = new HashMap<String, Serializable>();
workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName);
WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext); WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext);
if (aggiorna) {
WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(), themeDisplay.getUserId(), WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(), themeDisplay.getUserId(),
workflowTaskId, transitionName, comment, workflowContext); workflowTaskId, transitionName, comment, workflowContext);
} }

23
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java

@ -199,33 +199,25 @@ public class WorkflowUtil {
Enumeration<String> enu = portletRequest.getParameterNames(); Enumeration<String> enu = portletRequest.getParameterNames();
while (enu.hasMoreElements()) { while (enu.hasMoreElements()) {
String name = enu.nextElement(); String name = enu.nextElement();
if (!name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) if (name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM)
&& !name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { && name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) {
continue;
}
if (formParameters == null) { if (formParameters == null) {
formParameters = new HashMap<String, String>(); formParameters = new HashMap<String, String>();
} }
String parameterName = name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(), name.length() String parameterName = name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(),
- WorkflowConstants.SUFFIX_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] + "\"");
}
String value = StringUtil.merge(ParamUtil.getParameterValues(portletRequest, name)); String value = StringUtil.merge(ParamUtil.getParameterValues(portletRequest, name));
_log.info("Finale \"" + value + "\"");
formParameters.put(parameterName, value); formParameters.put(parameterName, value);
} }
}
if (formParameters == null) { if (formParameters == null) {
HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil
.getHttpServletRequest(portletRequest)); .getHttpServletRequest(portletRequest));
Enumeration<String> enums = httpServletRequest.getParameterNames(); Enumeration<String> enums = httpServletRequest.getParameterNames();
while (enums.hasMoreElements()) { while (enums.hasMoreElements()) {
String name = enums.nextElement(); String name = enums.nextElement();
if (!name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) if (name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM)
&& !name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { && name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) {
continue;
}
if (formParameters == null) { if (formParameters == null) {
formParameters = new HashMap<String, String>(); formParameters = new HashMap<String, String>();
} }
@ -235,6 +227,7 @@ public class WorkflowUtil {
formParameters.put(parameterName, value); formParameters.put(parameterName, value);
} }
} }
}
if (formParameters != null) { if (formParameters != null) {
workflowContext.put(WorkflowConstants.CONTEXT_TASK_FORM_PARAMETERS, (Serializable) formParameters); workflowContext.put(WorkflowConstants.CONTEXT_TASK_FORM_PARAMETERS, (Serializable) formParameters);
} }

4
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
## ##
build.namespace=Kaleo build.namespace=Kaleo
build.number=40 build.number=41
build.date=1618410772164 build.date=1619007863902
build.auto.upgrade=true build.auto.upgrade=true
## ##

Caricamento…
Annulla
Salva