diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java index 56e7c595..071234e2 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java @@ -36,10 +36,14 @@ import it.tref.liferay.portos.kaleo.model.FormLog; import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil; import java.io.Serializable; +import java.util.Collections; +import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.TreeMap; + import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil; import com.liferay.portal.kernel.dao.orm.DynamicQuery; import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; @@ -491,8 +495,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi public String getJsonListaIstruttori(long controlloPraticaId, Map workflowContext) throws PortalException, SystemException { + _log.info("Inizio attività"); ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil .getControlloPratica(controlloPraticaId); + _log.info("Controllo pratica " + controlloPratica.getControlloPraticaId()); JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); @@ -502,11 +508,17 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi List userGroupRoles = UserGroupRoleLocalServiceUtil.getUserGroupRolesByGroupAndRole( controlloPratica.getGroupId(), role.getRoleId()); + Map sorted = new TreeMap<>(); for (UserGroupRole userGroupRole : userGroupRoles) { + User user = userGroupRole.getUser(); JSONObject istruttore = JSONFactoryUtil.createJSONObject(); - istruttore.put("label", userGroupRole.getUser().getFullName()); - istruttore.put("value", userGroupRole.getUserId()); + istruttore.put("label", user.getFullName()); + istruttore.put("value", user.getUserId()); istruttore.put("default", false); + sorted.put((user.getLastName() + user.getFirstName()).toUpperCase(), istruttore); + } + + for (JSONObject istruttore : sorted.values()) { jsonArray.put(istruttore); } @@ -547,12 +559,12 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) { JSONObject etichette = JSONFactoryUtil.createJSONObject(); etichette.put("label", "Autorizzata"); - etichette.put("value", "AU"); + etichette.put("value", "CO"); etichette.put("default", false); jsonArray.put(etichette); etichette = JSONFactoryUtil.createJSONObject(); etichette.put("label", "Non autorizzata"); - etichette.put("value", "AN"); + etichette.put("value", "NC"); etichette.put("default", false); jsonArray.put(etichette); etichette = JSONFactoryUtil.createJSONObject(); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AllegatoManualePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AllegatoManualePersistenceImpl.java index b040f227..5c96356f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AllegatoManualePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AllegatoManualePersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchAllegatoManualeException; import it.tref.liferay.portos.bo.model.AllegatoManuale; import it.tref.liferay.portos.bo.model.impl.AllegatoManualeImpl; import it.tref.liferay.portos.bo.model.impl.AllegatoManualeModelImpl; +import it.tref.liferay.portos.bo.service.persistence.AllegatoManualePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AsseverazionePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AsseverazionePersistenceImpl.java index 63caa01d..15633d6f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AsseverazionePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AsseverazionePersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchAsseverazioneException; import it.tref.liferay.portos.bo.model.Asseverazione; import it.tref.liferay.portos.bo.model.impl.AsseverazioneImpl; import it.tref.liferay.portos.bo.model.impl.AsseverazioneModelImpl; +import it.tref.liferay.portos.bo.service.persistence.AsseverazionePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AvvisoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AvvisoPersistenceImpl.java index b95c271d..38e33edc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AvvisoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AvvisoPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchAvvisoException; import it.tref.liferay.portos.bo.model.Avviso; import it.tref.liferay.portos.bo.model.impl.AvvisoImpl; import it.tref.liferay.portos.bo.model.impl.AvvisoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.AvvisoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/CollaudoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/CollaudoPersistenceImpl.java index a0e6a43b..4ce032ca 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/CollaudoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/CollaudoPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchCollaudoException; import it.tref.liferay.portos.bo.model.Collaudo; import it.tref.liferay.portos.bo.model.impl.CollaudoImpl; import it.tref.liferay.portos.bo.model.impl.CollaudoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.CollaudoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunePersistenceImpl.java index b0b64b21..4a23bffd 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunePersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchComuneException; import it.tref.liferay.portos.bo.model.Comune; import it.tref.liferay.portos.bo.model.impl.ComuneImpl; import it.tref.liferay.portos.bo.model.impl.ComuneModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ComunePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunicazionePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunicazionePersistenceImpl.java index 0b7f9ee2..f5b8166f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunicazionePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunicazionePersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchComunicazioneException; import it.tref.liferay.portos.bo.model.Comunicazione; import it.tref.liferay.portos.bo.model.impl.ComunicazioneImpl; import it.tref.liferay.portos.bo.model.impl.ComunicazioneModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ComunicazionePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ConfigurazionePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ConfigurazionePersistenceImpl.java index 66507dd0..32809343 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ConfigurazionePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ConfigurazionePersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchConfigurazioneException; import it.tref.liferay.portos.bo.model.Configurazione; import it.tref.liferay.portos.bo.model.impl.ConfigurazioneImpl; import it.tref.liferay.portos.bo.model.impl.ConfigurazioneModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ConfigurazionePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ControlloPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ControlloPraticaPersistenceImpl.java index 48cf51eb..a4fa6f91 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ControlloPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ControlloPraticaPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchControlloPraticaException; import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.model.impl.ControlloPraticaImpl; import it.tref.liferay.portos.bo.model.impl.ControlloPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ControlloPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DelegaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DelegaPersistenceImpl.java index 402cecd0..8c56fb32 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DelegaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DelegaPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchDelegaException; import it.tref.liferay.portos.bo.model.Delega; import it.tref.liferay.portos.bo.model.impl.DelegaImpl; import it.tref.liferay.portos.bo.model.impl.DelegaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.DelegaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DettPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DettPraticaPersistenceImpl.java index e8ae1737..7f53be18 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DettPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DettPraticaPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchDettPraticaException; import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.impl.DettPraticaImpl; import it.tref.liferay.portos.bo.model.impl.DettPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.DettPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocAggiuntivaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocAggiuntivaPersistenceImpl.java index 649a5476..c25ae1dc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocAggiuntivaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocAggiuntivaPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchDocAggiuntivaException; import it.tref.liferay.portos.bo.model.DocAggiuntiva; import it.tref.liferay.portos.bo.model.impl.DocAggiuntivaImpl; import it.tref.liferay.portos.bo.model.impl.DocAggiuntivaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.DocAggiuntivaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocPraticaPersistenceImpl.java index 42630357..255330f7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocPraticaPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchDocPraticaException; import it.tref.liferay.portos.bo.model.DocPratica; import it.tref.liferay.portos.bo.model.impl.DocPraticaImpl; import it.tref.liferay.portos.bo.model.impl.DocPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.DocPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/FineLavoriPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/FineLavoriPersistenceImpl.java index a5f79405..7ba24480 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/FineLavoriPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/FineLavoriPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchFineLavoriException; import it.tref.liferay.portos.bo.model.FineLavori; import it.tref.liferay.portos.bo.model.impl.FineLavoriImpl; import it.tref.liferay.portos.bo.model.impl.FineLavoriModelImpl; +import it.tref.liferay.portos.bo.service.persistence.FineLavoriPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/HistoryWorkflowActionPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/HistoryWorkflowActionPersistenceImpl.java index ad50d7ea..f80406ab 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/HistoryWorkflowActionPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/HistoryWorkflowActionPersistenceImpl.java @@ -42,6 +42,7 @@ import it.tref.liferay.portos.bo.NoSuchHistoryWorkflowActionException; import it.tref.liferay.portos.bo.model.HistoryWorkflowAction; import it.tref.liferay.portos.bo.model.impl.HistoryWorkflowActionImpl; import it.tref.liferay.portos.bo.model.impl.HistoryWorkflowActionModelImpl; +import it.tref.liferay.portos.bo.service.persistence.HistoryWorkflowActionPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IUVPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IUVPersistenceImpl.java index a6ba54ac..6f469f0e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IUVPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IUVPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchIUVException; import it.tref.liferay.portos.bo.model.IUV; import it.tref.liferay.portos.bo.model.impl.IUVImpl; import it.tref.liferay.portos.bo.model.impl.IUVModelImpl; +import it.tref.liferay.portos.bo.service.persistence.IUVPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/InfoFascicoloPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/InfoFascicoloPersistenceImpl.java index 12f22a0a..b85535de 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/InfoFascicoloPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/InfoFascicoloPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchInfoFascicoloException; import it.tref.liferay.portos.bo.model.InfoFascicolo; import it.tref.liferay.portos.bo.model.impl.InfoFascicoloImpl; import it.tref.liferay.portos.bo.model.impl.InfoFascicoloModelImpl; +import it.tref.liferay.portos.bo.service.persistence.InfoFascicoloPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IntPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IntPraticaPersistenceImpl.java index 307036e1..ee52c9b7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IntPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IntPraticaPersistenceImpl.java @@ -48,6 +48,7 @@ import it.tref.liferay.portos.bo.NoSuchIntPraticaException; import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.model.impl.IntPraticaImpl; import it.tref.liferay.portos.bo.model.impl.IntPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.IntPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/PagamentoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/PagamentoPersistenceImpl.java index 627905df..6fe6e3c8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/PagamentoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/PagamentoPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchPagamentoException; import it.tref.liferay.portos.bo.model.Pagamento; import it.tref.liferay.portos.bo.model.impl.PagamentoImpl; import it.tref.liferay.portos.bo.model.impl.PagamentoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.PagamentoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ParereGeologoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ParereGeologoPersistenceImpl.java index c6ce3907..e4133c60 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ParereGeologoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ParereGeologoPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchParereGeologoException; import it.tref.liferay.portos.bo.model.ParereGeologo; import it.tref.liferay.portos.bo.model.impl.ParereGeologoImpl; import it.tref.liferay.portos.bo.model.impl.ParereGeologoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ParereGeologoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ProvinciaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ProvinciaPersistenceImpl.java index daa33e1b..2c7a846f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ProvinciaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ProvinciaPersistenceImpl.java @@ -43,6 +43,7 @@ import it.tref.liferay.portos.bo.NoSuchProvinciaException; import it.tref.liferay.portos.bo.model.Provincia; import it.tref.liferay.portos.bo.model.impl.ProvinciaImpl; import it.tref.liferay.portos.bo.model.impl.ProvinciaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ProvinciaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SoggettoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SoggettoPersistenceImpl.java index f17aaf4b..c8c09bbf 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SoggettoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SoggettoPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchSoggettoException; import it.tref.liferay.portos.bo.model.Soggetto; import it.tref.liferay.portos.bo.model.impl.SoggettoImpl; import it.tref.liferay.portos.bo.model.impl.SoggettoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.SoggettoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SorteggioPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SorteggioPersistenceImpl.java index ec8a983f..fc566b28 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SorteggioPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SorteggioPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchSorteggioException; import it.tref.liferay.portos.bo.model.Sorteggio; import it.tref.liferay.portos.bo.model.impl.SorteggioImpl; import it.tref.liferay.portos.bo.model.impl.SorteggioModelImpl; +import it.tref.liferay.portos.bo.service.persistence.SorteggioPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/StoricoSoggettoPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/StoricoSoggettoPraticaPersistenceImpl.java index 78333501..0c095d3d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/StoricoSoggettoPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/StoricoSoggettoPraticaPersistenceImpl.java @@ -42,6 +42,7 @@ import it.tref.liferay.portos.bo.NoSuchStoricoSoggettoPraticaException; import it.tref.liferay.portos.bo.model.StoricoSoggettoPratica; import it.tref.liferay.portos.bo.model.impl.StoricoSoggettoPraticaImpl; import it.tref.liferay.portos.bo.model.impl.StoricoSoggettoPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.StoricoSoggettoPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TempisticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TempisticaPersistenceImpl.java index 720078c4..252fc452 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TempisticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TempisticaPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchTempisticaException; import it.tref.liferay.portos.bo.model.Tempistica; import it.tref.liferay.portos.bo.model.impl.TempisticaImpl; import it.tref.liferay.portos.bo.model.impl.TempisticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.TempisticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TerritorioPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TerritorioPersistenceImpl.java index a9c7f7d5..c8e0dee9 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TerritorioPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TerritorioPersistenceImpl.java @@ -44,6 +44,7 @@ import it.tref.liferay.portos.bo.NoSuchTerritorioException; import it.tref.liferay.portos.bo.model.Territorio; import it.tref.liferay.portos.bo.model.impl.TerritorioImpl; import it.tref.liferay.portos.bo.model.impl.TerritorioModelImpl; +import it.tref.liferay.portos.bo.service.persistence.TerritorioPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties index 432619e1..865fc16a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_bo - build.number=2756 - build.date=1606726892312 + build.number=2759 + build.date=1606818542516 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/ivy.xml b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/ivy.xml index b541bf3c..5714266d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/ivy.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/ivy.xml @@ -7,7 +7,7 @@ xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" > - + diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp index 93cd15c3..9cd28488 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp @@ -1,3 +1,10 @@ +<%@page import="java.io.Serializable"%> +<%@page import="java.nio.file.Files"%> +<%@page import="java.nio.file.Path"%> +<%@page import="java.io.File"%> +<%@page import="com.liferay.portal.kernel.log.LogFactoryUtil"%> +<%@page import="com.liferay.portal.kernel.log.Log"%> +<%@page import="java.nio.file.Paths"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.liferay.portal.kernel.util.MapUtil"%> <%@page import="com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalServiceUtil"%> @@ -109,20 +116,54 @@ if (ddmTemplateId > 0) { /> <% - for (Entry>> entry : fieldNameOptions.entrySet()) { - String base = "(?s)\\sname=\"" + renderResponse.getNamespace() + entry.getKey() - + "_INSTANCE_[^\"]*\"(.*?)value=\"Value"; - int counter = 1; + Log _log = LogFactoryUtil.getLog("kaleo_merda"); + String ns = renderResponse.getNamespace(); + for (Entry>> entry : fieldNameOptions.entrySet()) { + String name = entry.getKey(); + _log.info("name = "+ name); for (Map option : entry.getValue()) { - String regex = base + counter + "\"(.*?)Label" + counter; - String replace = " name=\"" + entry.getKey() + "\"$1value=\"" + option.get("value") + "\""; - if (MapUtil.getBoolean(option, "default")) { - replace += " checked=\"checked\""; + for (Entry x : option.entrySet()) { + _log.info(" - " + x.getKey() + " = " + x.getValue()); + } + } + String regexSelect = "(?s)(.*?)()(.*)"; + if (html.matches(regexSelect)) { + String match = html.replaceAll(regexSelect, "$2"); + String select = match.replaceAll("(?s)([?>]*>).*", "$1\n"); + for (Map option : entry.getValue()) { + select += "\n"; + } + html = html.replaceAll(regexSelect, "$1" + select + "\n" + "$3"); + } else { + String regexInput = "(?s)]+).*?"; + for (Map option : entry.getValue()) { + String replaceInput = " <%= html %> +<%! +private void salva(String name, String str) { + Log _log = LogFactoryUtil.getLog("render_form_task_jsp_salva"); + try { + String debugPath = com.liferay.portal.kernel.util.PropsUtil.get("liferay.home") + "/debug"; + _log.info("debugPath = " + debugPath); + File debugFile = new File(debugPath); + if (!debugFile.exists()) + debugFile.mkdirs(); + Path path = Paths.get(debugPath + "/" + name); + Files.write(path, str.getBytes()); + } catch (Exception e) { + _log.error("Errore", e); + } +} +%> \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java index 02dd8743..d3020d34 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java @@ -83,443 +83,458 @@ import com.liferay.portal.workflow.kaleo.service.KaleoTaskInstanceTokenLocalServ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { - private final static Log _log = LogFactoryUtil.getLog(EditWorkflowTaskAction.class); - - @Override - public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, - ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { - - String cmd = ParamUtil.getString(actionRequest, Constants.CMD); - - if (cmd.equals(Constants.SAVE) || cmd.equals(Constants.RESET)) { + private final static Log _log = LogFactoryUtil.getLog(EditWorkflowTaskAction.class); - try { + @Override + public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, + ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { - if (cmd.equals(Constants.SAVE)) { - completeTask(actionRequest); - } else if (cmd.equals(Constants.RESET)) { - relaseTask(actionRequest); - } + String cmd = ParamUtil.getString(actionRequest, Constants.CMD); - String redirect = ParamUtil.getString(actionRequest, "redirect"); - String closeRedirect = ParamUtil.getString(actionRequest, "closeRedirect"); + if (cmd.equals(Constants.SAVE) || cmd.equals(Constants.RESET)) { - if (Validator.isNotNull(closeRedirect)) { - redirect = HttpUtil.setParameter(redirect, "closeRedirect", closeRedirect); + try { + + if (cmd.equals(Constants.SAVE)) { + completeTask(actionRequest); + } else if (cmd.equals(Constants.RESET)) { + relaseTask(actionRequest); + } + + String redirect = ParamUtil.getString(actionRequest, "redirect"); + String closeRedirect = ParamUtil.getString(actionRequest, "closeRedirect"); + + if (Validator.isNotNull(closeRedirect)) { + redirect = HttpUtil.setParameter(redirect, "closeRedirect", closeRedirect); + + SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + + SessionMessages.KEY_SUFFIX_CLOSE_REDIRECT, closeRedirect); + } + + sendRedirect(actionRequest, actionResponse, redirect); + + } catch (Exception e) { + if (e instanceof WorkflowTaskDueDateException) { + SessionErrors.add(actionRequest, e.getClass()); + } else if (e instanceof PrincipalException || e instanceof WorkflowException) { + + SessionErrors.add(actionRequest, e.getClass()); + + setForward(actionRequest, "portlet.workflow_tasks.error"); + } else { + throw e; + } + } + } else { + originalStrutsPortletAction.processAction(originalStrutsPortletAction, portletConfig, + actionRequest, actionResponse); + } + } - SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) - + SessionMessages.KEY_SUFFIX_CLOSE_REDIRECT, closeRedirect); - } + protected void assignTask(ActionRequest actionRequest) throws Exception { - sendRedirect(actionRequest, actionResponse, redirect); + ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); - } catch (Exception e) { - if (e instanceof WorkflowTaskDueDateException) { - SessionErrors.add(actionRequest, e.getClass()); - } else if (e instanceof PrincipalException || e instanceof WorkflowException) { + long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); - SessionErrors.add(actionRequest, e.getClass()); + long assigneeUserId = ParamUtil.getLong(actionRequest, "assigneeUserId"); + String comment = ParamUtil.getString(actionRequest, "comment"); - setForward(actionRequest, "portlet.workflow_tasks.error"); - } else { - throw e; - } - } - } else { - originalStrutsPortletAction.processAction(originalStrutsPortletAction, portletConfig, actionRequest, - actionResponse); - } - } + WorkflowTaskManagerUtil.assignWorkflowTaskToUser(themeDisplay.getCompanyId(), + themeDisplay.getUserId(), workflowTaskId, assigneeUserId, comment, null, null); + } + + protected void completeTask(ActionRequest actionRequest) throws Exception { + + ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + + long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); - protected void assignTask(ActionRequest actionRequest) throws Exception { + String transitionName = ParamUtil.getString(actionRequest, "transitionName"); + String comment = ParamUtil.getString(actionRequest, "comment"); - ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + // ADT: bug mancata problema assegnazione WF + checkPresenzaIstruttore(transitionName, workflowTaskId); + + // ADT: BUG ANOMALIA REGISTRA ESITO + if (transitionName.equalsIgnoreCase("registra-esito")) { + HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil + .getHttpServletRequest(actionRequest)); + String esito = httpServletRequest.getParameter("kaleo--esito--") != null ? httpServletRequest + .getParameter("kaleo--esito--").trim() : ""; + String testoDocumento = httpServletRequest.getParameter("kaleo--testo_del_documento--") != null ? httpServletRequest + .getParameter("kaleo--testo_del_documento--") : ""; + List valoriAmmessi = Arrays.asList("AL", "NC", "CO", "IN"); + if (!valoriAmmessi.contains(esito) || (esito.equalsIgnoreCase("IN") && testoDocumento.isEmpty())) { + _log.error("controllo validazione completamento task registra-esito = " + workflowTaskId + + " non riuscito - esito non valorizzato o esito IN con testo del documento vuoto"); + throw new PortalException( + "controllo validazione completamento task registra-esito non riuscito"); + } + } else if (transitionName.equalsIgnoreCase("Riassegna") || transitionName.equalsIgnoreCase("assegna")) { + HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil + .getHttpServletRequest(actionRequest)); + String istr = httpServletRequest.getParameter("kaleo--istruttore--") != null ? httpServletRequest + .getParameter("kaleo--istruttore--").trim() : ""; + if (istr.isEmpty()) { + _log.error("controllo validazione completamento task = " + transitionName + " -" + + workflowTaskId + + " non riuscito - esito non valorizzato o esito IN con testo del documento vuoto"); + throw new PortalException( + "controllo validazione completamento task registra-esito non riuscito"); + } + } - long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); + Map workflowContext = new HashMap(); - long assigneeUserId = ParamUtil.getLong(actionRequest, "assigneeUserId"); - String comment = ParamUtil.getString(actionRequest, "comment"); + workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); - WorkflowTaskManagerUtil.assignWorkflowTaskToUser(themeDisplay.getCompanyId(), themeDisplay.getUserId(), - workflowTaskId, assigneeUserId, comment, null, null); - } + WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext); - - - - - protected void completeTask(ActionRequest actionRequest) throws Exception { + WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(), themeDisplay.getUserId(), + workflowTaskId, transitionName, comment, workflowContext); + } - ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + protected void relaseTask(ActionRequest actionRequest) throws Exception { - long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); + ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); - String transitionName = ParamUtil.getString(actionRequest, "transitionName"); - String comment = ParamUtil.getString(actionRequest, "comment"); + long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); - //ADT: bug mancata problema assegnazione WF - checkPresenzaIstruttore(transitionName,workflowTaskId); - - //ADT: BUG ANOMALIA REGISTRA ESITO - if (transitionName.equalsIgnoreCase("registra-esito")) { - HttpServletRequest httpServletRequest =PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(actionRequest)); - String esito=httpServletRequest.getParameter("kaleo--esito--")!=null?httpServletRequest.getParameter("kaleo--esito--").trim():""; - String testoDocumento=httpServletRequest.getParameter("kaleo--testo_del_documento--")!=null?httpServletRequest.getParameter("kaleo--testo_del_documento--"):""; - List valoriAmmessi=Arrays.asList("AL", "NC", "CO" ,"IN"); - if (!valoriAmmessi.contains(esito) || (esito.equalsIgnoreCase("IN")&& testoDocumento.isEmpty())){ - _log.error("controllo validazione completamento task registra-esito = "+workflowTaskId+" non riuscito - esito non valorizzato o esito IN con testo del documento vuoto"); - throw new PortalException("controllo validazione completamento task registra-esito non riuscito"); - } - }else if (transitionName.equalsIgnoreCase("Riassegna")||transitionName.equalsIgnoreCase("assegna")) { - HttpServletRequest httpServletRequest =PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(actionRequest)); - String istr=httpServletRequest.getParameter("kaleo--istruttore--")!=null?httpServletRequest.getParameter("kaleo--istruttore--").trim():""; - if (istr.isEmpty()){ - _log.error("controllo validazione completamento task = "+transitionName +" -"+workflowTaskId+" non riuscito - esito non valorizzato o esito IN con testo del documento vuoto"); - throw new PortalException("controllo validazione completamento task registra-esito non riuscito"); - } - } - ///////////////////////////////////////////////////////// - - Map workflowContext = new HashMap(); + long assigneeUserId = ParamUtil.getLong(actionRequest, "assigneeUserId"); + String comment = ParamUtil.getString(actionRequest, "comment"); - workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); + WorkflowTaskManagerUtil.assignWorkflowTaskToRole(themeDisplay.getCompanyId(), assigneeUserId, + workflowTaskId, 0L, comment, null, null); + } - WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext); + protected boolean isCheckMethodOnProcessAction() { - WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(), themeDisplay.getUserId(), workflowTaskId, - transitionName, comment, workflowContext); - } + return _CHECK_METHOD_ON_PROCESS_ACTION; + } - protected void relaseTask(ActionRequest actionRequest) throws Exception { + protected void updateTask(ActionRequest actionRequest) throws Exception { - ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); - long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); + long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); - long assigneeUserId = ParamUtil.getLong(actionRequest, "assigneeUserId"); - String comment = ParamUtil.getString(actionRequest, "comment"); + String comment = ParamUtil.getString(actionRequest, "comment"); - WorkflowTaskManagerUtil.assignWorkflowTaskToRole(themeDisplay.getCompanyId(), assigneeUserId, workflowTaskId, 0L, - comment, null, null); - } + int dueDateMonth = ParamUtil.getInteger(actionRequest, "dueDateMonth"); + int dueDateDay = ParamUtil.getInteger(actionRequest, "dueDateDay"); + int dueDateYear = ParamUtil.getInteger(actionRequest, "dueDateYear"); + int dueDateHour = ParamUtil.getInteger(actionRequest, "dueDateHour"); + int dueDateMinute = ParamUtil.getInteger(actionRequest, "dueDateMinute"); + int dueDateAmPm = ParamUtil.getInteger(actionRequest, "dueDateAmPm"); - protected boolean isCheckMethodOnProcessAction() { + if (dueDateAmPm == Calendar.PM) { + dueDateHour += 12; + } - return _CHECK_METHOD_ON_PROCESS_ACTION; - } + Date dueDate = PortalUtil.getDate(dueDateMonth, dueDateDay, dueDateYear, dueDateHour, dueDateMinute, + WorkflowTaskDueDateException.class); - protected void updateTask(ActionRequest actionRequest) throws Exception { + WorkflowTaskManagerUtil.updateDueDate(themeDisplay.getCompanyId(), themeDisplay.getUserId(), + workflowTaskId, comment, dueDate); + } - ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + private static final boolean _CHECK_METHOD_ON_PROCESS_ACTION = false; - long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); + protected void sendRedirect(ActionRequest actionRequest, ActionResponse actionResponse, String redirect) + throws IOException, SystemException { - String comment = ParamUtil.getString(actionRequest, "comment"); + sendRedirect(null, actionRequest, actionResponse, redirect, null); + } - int dueDateMonth = ParamUtil.getInteger(actionRequest, "dueDateMonth"); - int dueDateDay = ParamUtil.getInteger(actionRequest, "dueDateDay"); - int dueDateYear = ParamUtil.getInteger(actionRequest, "dueDateYear"); - int dueDateHour = ParamUtil.getInteger(actionRequest, "dueDateHour"); - int dueDateMinute = ParamUtil.getInteger(actionRequest, "dueDateMinute"); - int dueDateAmPm = ParamUtil.getInteger(actionRequest, "dueDateAmPm"); + protected void sendRedirect(PortletConfig portletConfig, ActionRequest actionRequest, + ActionResponse actionResponse, String redirect, String closeRedirect) throws IOException, + SystemException { - if (dueDateAmPm == Calendar.PM) { - dueDateHour += 12; - } + if (isDisplaySuccessMessage(actionRequest)) { + addSuccessMessage(actionRequest, actionResponse); + } - Date dueDate = - PortalUtil.getDate(dueDateMonth, dueDateDay, dueDateYear, dueDateHour, dueDateMinute, - WorkflowTaskDueDateException.class); + if (Validator.isNull(redirect)) { + redirect = (String) actionRequest.getAttribute(WebKeys.REDIRECT); + } - WorkflowTaskManagerUtil.updateDueDate(themeDisplay.getCompanyId(), themeDisplay.getUserId(), workflowTaskId, - comment, dueDate); - } + if (Validator.isNull(redirect)) { + redirect = ParamUtil.getString(actionRequest, "redirect"); + } - private static final boolean _CHECK_METHOD_ON_PROCESS_ACTION = false; + if ((portletConfig != null) && Validator.isNotNull(redirect) && Validator.isNotNull(closeRedirect)) { - protected void sendRedirect(ActionRequest actionRequest, ActionResponse actionResponse, String redirect) - throws IOException, SystemException { + redirect = HttpUtil.setParameter(redirect, "closeRedirect", closeRedirect); - sendRedirect(null, actionRequest, actionResponse, redirect, null); - } + SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + + SessionMessages.KEY_SUFFIX_CLOSE_REDIRECT, closeRedirect); + } - protected void sendRedirect(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse, - String redirect, String closeRedirect) throws IOException, SystemException { + if (Validator.isNull(redirect)) { + return; + } - if (isDisplaySuccessMessage(actionRequest)) { - addSuccessMessage(actionRequest, actionResponse); - } + // LPS-1928 - if (Validator.isNull(redirect)) { - redirect = (String) actionRequest.getAttribute(WebKeys.REDIRECT); - } + HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); - if (Validator.isNull(redirect)) { - redirect = ParamUtil.getString(actionRequest, "redirect"); - } + if (BrowserSnifferUtil.isIe(request) && (BrowserSnifferUtil.getMajorVersion(request) == 6.0) + && redirect.contains(StringPool.POUND)) { - if ((portletConfig != null) && Validator.isNotNull(redirect) && Validator.isNotNull(closeRedirect)) { + String redirectToken = "&#"; - redirect = HttpUtil.setParameter(redirect, "closeRedirect", closeRedirect); + if (!redirect.contains(StringPool.QUESTION)) { + redirectToken = StringPool.QUESTION + redirectToken; + } - SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) - + SessionMessages.KEY_SUFFIX_CLOSE_REDIRECT, closeRedirect); - } + redirect = StringUtil.replace(redirect, StringPool.POUND, redirectToken); + } - if (Validator.isNull(redirect)) { - return; - } + redirect = PortalUtil.escapeRedirect(redirect); - // LPS-1928 + if (Validator.isNotNull(redirect)) { + actionResponse.sendRedirect(redirect); + } + } - HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); + protected boolean isDisplaySuccessMessage(PortletRequest portletRequest) throws SystemException { - if (BrowserSnifferUtil.isIe(request) && (BrowserSnifferUtil.getMajorVersion(request) == 6.0) - && redirect.contains(StringPool.POUND)) { + if (!SessionErrors.isEmpty(portletRequest)) { + return false; + } - String redirectToken = "&#"; + ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); - if (!redirect.contains(StringPool.QUESTION)) { - redirectToken = StringPool.QUESTION + redirectToken; - } + Layout layout = themeDisplay.getLayout(); - redirect = StringUtil.replace(redirect, StringPool.POUND, redirectToken); - } + if (layout.isTypeControlPanel()) { + return true; + } - redirect = PortalUtil.escapeRedirect(redirect); + String portletId = (String) portletRequest.getAttribute(WebKeys.PORTLET_ID); - if (Validator.isNotNull(redirect)) { - actionResponse.sendRedirect(redirect); - } - } + try { + LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet(); - protected boolean isDisplaySuccessMessage(PortletRequest portletRequest) throws SystemException { + if (layoutTypePortlet.hasPortletId(portletId)) { + return true; + } + } catch (PortalException pe) { + if (_log.isDebugEnabled()) { + _log.debug(pe, pe); + } + } - if (!SessionErrors.isEmpty(portletRequest)) { - return false; - } + Portlet portlet = PortletLocalServiceUtil.getPortletById(themeDisplay.getCompanyId(), portletId); - ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); + if (portlet.isAddDefaultResource()) { + return true; + } - Layout layout = themeDisplay.getLayout(); + return false; + } - if (layout.isTypeControlPanel()) { - return true; - } + protected void addSuccessMessage(ActionRequest actionRequest, ActionResponse actionResponse) { - String portletId = (String) portletRequest.getAttribute(WebKeys.PORTLET_ID); + PortletConfig portletConfig = (PortletConfig) actionRequest + .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); - try { - LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet(); + boolean addProcessActionSuccessMessage = GetterUtil.getBoolean( + portletConfig.getInitParameter("add-process-action-success-action"), true); - if (layoutTypePortlet.hasPortletId(portletId)) { - return true; - } - } catch (PortalException pe) { - if (_log.isDebugEnabled()) { - _log.debug(pe, pe); - } - } + if (!addProcessActionSuccessMessage) { + return; + } - Portlet portlet = PortletLocalServiceUtil.getPortletById(themeDisplay.getCompanyId(), portletId); + String successMessage = ParamUtil.getString(actionRequest, "successMessage"); - if (portlet.isAddDefaultResource()) { - return true; - } + SessionMessages.add(actionRequest, "requestProcessed", successMessage); + } - return false; - } + protected void setForward(PortletRequest portletRequest, String forward) { - protected void addSuccessMessage(ActionRequest actionRequest, ActionResponse actionResponse) { + portletRequest.setAttribute(getForwardKey(portletRequest), forward); + } - PortletConfig portletConfig = (PortletConfig) actionRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); + public static String getForwardKey(PortletRequest portletRequest) { - boolean addProcessActionSuccessMessage = - GetterUtil.getBoolean(portletConfig.getInitParameter("add-process-action-success-action"), true); + String portletId = (String) portletRequest.getAttribute(WebKeys.PORTLET_ID); - if (!addProcessActionSuccessMessage) { - return; - } + String portletNamespace = PortalUtil.getPortletNamespace(portletId); - String successMessage = ParamUtil.getString(actionRequest, "successMessage"); + return portletNamespace.concat(PORTLET_STRUTS_FORWARD); + } - SessionMessages.add(actionRequest, "requestProcessed", successMessage); - } + private final static String PORTLET_STRUTS_FORWARD = "PORTLET_STRUTS_FORWARD"; - protected void setForward(PortletRequest portletRequest, String forward) { + @Override + public String render(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, + RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { - portletRequest.setAttribute(getForwardKey(portletRequest), forward); - } + ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); - public static String getForwardKey(PortletRequest portletRequest) { + long workflowTaskId = ParamUtil.getLong(renderRequest, "workflowTaskId"); - String portletId = (String) portletRequest.getAttribute(WebKeys.PORTLET_ID); + WorkflowTask workflowTask = null; - String portletNamespace = PortalUtil.getPortletNamespace(portletId); + if (workflowTaskId > 0) { + workflowTask = WorkflowTaskManagerUtil.getWorkflowTask(themeDisplay.getCompanyId(), + workflowTaskId); + } - return portletNamespace.concat(PORTLET_STRUTS_FORWARD); - } + String valoreTransizioneEsito = getTransitionValue(workflowTask.getWorkflowInstanceId(), + "registra-esito"); + String valoreTransizioneAssegna = getTransitionValue(workflowTask.getWorkflowInstanceId(), "assegna"); - private final static String PORTLET_STRUTS_FORWARD = "PORTLET_STRUTS_FORWARD"; + renderRequest.setAttribute("registra-esito-value", valoreTransizioneEsito); + renderRequest.setAttribute("assegna-value", valoreTransizioneAssegna); - @Override - public String render(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, - RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { + // Gestione permessi action button + ControlloPratica controlloPratica = getControlloPratica(workflowTask.getWorkflowInstanceId()); - ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); + // ADT BUG BO ID=33 + renderRequest.setAttribute( + "historyWorkflowEsitiLogs", + getHistoryWorkfloLogs(themeDisplay, workflowTask.getWorkflowInstanceId(), renderRequest, + controlloPratica)); - long workflowTaskId = ParamUtil.getLong(renderRequest, "workflowTaskId"); + long groupIdTerritorio = controlloPratica.getGroupId(); + Group group = GroupLocalServiceUtil.getGroup(groupIdTerritorio); - WorkflowTask workflowTask = null; + User user = themeDisplay.getUser(); + Organization org = OrganizationLocalServiceUtil.getOrganization(group.getClassPK()); - if (workflowTaskId > 0) { - workflowTask = WorkflowTaskManagerUtil.getWorkflowTask(themeDisplay.getCompanyId(), workflowTaskId); - } + boolean canPortosAssegnatore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), + org.getGroupId(), "portos_assegnatore"); + boolean canPortosApprovatore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), + org.getGroupId(), "portos_approvatore"); - String valoreTransizioneEsito = getTransitionValue(workflowTask.getWorkflowInstanceId(), "registra-esito"); - String valoreTransizioneAssegna = getTransitionValue(workflowTask.getWorkflowInstanceId(), "assegna"); + boolean canPortosIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), + org.getGroupId(), "portos_istruttore"); - renderRequest.setAttribute("registra-esito-value", valoreTransizioneEsito); - renderRequest.setAttribute("assegna-value", valoreTransizioneAssegna); - - // Gestione permessi action button - ControlloPratica controlloPratica = getControlloPratica(workflowTask.getWorkflowInstanceId()); - - //ADT BUG BO ID=33 - renderRequest.setAttribute("historyWorkflowEsitiLogs", getHistoryWorkfloLogs(themeDisplay,workflowTask.getWorkflowInstanceId(),renderRequest,controlloPratica)); - - long groupIdTerritorio = controlloPratica.getGroupId(); - Group group = GroupLocalServiceUtil.getGroup(groupIdTerritorio); + renderRequest.setAttribute("canPortosAssegnatore", canPortosAssegnatore); + renderRequest.setAttribute("canPortosApprovatore", canPortosApprovatore); + renderRequest.setAttribute("canPortosIstruttore", canPortosIstruttore); - User user = themeDisplay.getUser(); - Organization org = OrganizationLocalServiceUtil.getOrganization(group.getClassPK()); + return originalStrutsPortletAction.render(originalStrutsPortletAction, portletConfig, renderRequest, + renderResponse); + } - boolean canPortosAssegnatore = - UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), org.getGroupId(), "portos_assegnatore"); - boolean canPortosApprovatore = - UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), org.getGroupId(), "portos_approvatore"); + private String getTransitionValue(long taskInstanceId, String transitionName) throws PortalException, + SystemException { + + ClassLoader classLoaderKaleoLog = (ClassLoader) PortletBeanLocatorUtil.locate( + it.tref.liferay.portos.kaleo.service.ClpSerializer.getServletContextName(), + "portletClassLoader"); + + DynamicQuery dqKaleoLog = DynamicQueryFactoryUtil.forClass(FormLog.class, classLoaderKaleoLog); + dqKaleoLog.add(RestrictionsFactoryUtil.eq("workflowInstanceId", taskInstanceId)); + dqKaleoLog.add(RestrictionsFactoryUtil.eq("transitionName", transitionName)); + + List listaKaleoLog = FormLogLocalServiceUtil.dynamicQuery(dqKaleoLog); + if (listaKaleoLog != null && !listaKaleoLog.isEmpty()) { + FormLog formLog = listaKaleoLog.get(0); + JSONObject json = JSONFactoryUtil.createJSONObject(formLog.getFormParameters()); + + KaleoInstance kaleoInstance = KaleoInstanceLocalServiceUtil.getKaleoInstance(taskInstanceId); + ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil + .getControlloPratica(kaleoInstance.getClassPK()); + + if (json.has("esito")) { + String tipoEsito = ""; + String appStirng = json.getString("esito"); + switch (appStirng) { + case "IN": + tipoEsito = "Richiesta Integrazione"; + break; + + case "CO": + if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { + tipoEsito = "Conforme"; + } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) { + tipoEsito = "Autorizzata"; + } + break; - boolean canPortosIstruttore = - UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), org.getGroupId(), "portos_istruttore"); + case "NC": + if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { + tipoEsito = "Non conforme"; + } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) { + tipoEsito = "Non autorizzata"; + } + break; - renderRequest.setAttribute("canPortosAssegnatore", canPortosAssegnatore); - renderRequest.setAttribute("canPortosApprovatore", canPortosApprovatore); - renderRequest.setAttribute("canPortosIstruttore", canPortosIstruttore); + case "AL": + tipoEsito = "Annullata"; + break; + default: + break; + } + return tipoEsito; - return originalStrutsPortletAction.render(originalStrutsPortletAction, portletConfig, renderRequest, renderResponse); - } + } else if (json.has("istruttore")) { - private String getTransitionValue(long taskInstanceId, String transitionName) throws PortalException, SystemException { + String userIdIstruttore = json.getString("istruttore"); + User istruttore = UserLocalServiceUtil.fetchUser(Long.parseLong(userIdIstruttore)); + if (Validator.isNotNull(istruttore)) { + return istruttore.getFullName(); + } - ClassLoader classLoaderKaleoLog = - (ClassLoader) PortletBeanLocatorUtil.locate( - it.tref.liferay.portos.kaleo.service.ClpSerializer.getServletContextName(), "portletClassLoader"); + } - DynamicQuery dqKaleoLog = DynamicQueryFactoryUtil.forClass(FormLog.class, classLoaderKaleoLog); - dqKaleoLog.add(RestrictionsFactoryUtil.eq("workflowInstanceId", taskInstanceId)); - dqKaleoLog.add(RestrictionsFactoryUtil.eq("transitionName", transitionName)); + } - List listaKaleoLog = FormLogLocalServiceUtil.dynamicQuery(dqKaleoLog); - if (listaKaleoLog != null && !listaKaleoLog.isEmpty()) { - FormLog formLog = listaKaleoLog.get(0); - JSONObject json = JSONFactoryUtil.createJSONObject(formLog.getFormParameters()); + return null; + } - KaleoInstance kaleoInstance = KaleoInstanceLocalServiceUtil.getKaleoInstance(taskInstanceId); - ControlloPratica controlloPratica = - ControlloPraticaLocalServiceUtil.getControlloPratica(kaleoInstance.getClassPK()); + private ControlloPratica getControlloPratica(long taskInstanceId) throws PortalException, SystemException { - if (json.has("esito")) { - String tipoEsito = ""; - String appStirng = json.getString("esito"); - switch (appStirng) { - case "IN": - tipoEsito = "Richiesta Integrazione"; - break; + ClassLoader classLoaderKaleoLog = (ClassLoader) PortletBeanLocatorUtil.locate( + it.tref.liferay.portos.kaleo.service.ClpSerializer.getServletContextName(), + "portletClassLoader"); - case "CO": - if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { - tipoEsito = "Conforme"; - } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) { - tipoEsito = "Autorizzata"; - } - break; + KaleoInstance kaleoInstance = KaleoInstanceLocalServiceUtil.getKaleoInstance(taskInstanceId); + ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil + .getControlloPratica(kaleoInstance.getClassPK()); - case "NC": - if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { - tipoEsito = "Non conforme"; - } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) { - tipoEsito = "Non autorizzata"; - } - break; + return controlloPratica; + } - case "AL": - tipoEsito = "Annullata"; - break; - - default: - break; - } - return tipoEsito; - - } else if (json.has("istruttore")) { - - String userIdIstruttore = json.getString("istruttore"); - User istruttore = UserLocalServiceUtil.fetchUser(Long.parseLong(userIdIstruttore)); - if (Validator.isNotNull(istruttore)) { - return istruttore.getFullName(); - } - - } - - } - - return null; - } - - private ControlloPratica getControlloPratica(long taskInstanceId) throws PortalException, SystemException { - - ClassLoader classLoaderKaleoLog = - (ClassLoader) PortletBeanLocatorUtil.locate( - it.tref.liferay.portos.kaleo.service.ClpSerializer.getServletContextName(), "portletClassLoader"); - - - KaleoInstance kaleoInstance = KaleoInstanceLocalServiceUtil.getKaleoInstance(taskInstanceId); - ControlloPratica controlloPratica = - ControlloPraticaLocalServiceUtil.getControlloPratica(kaleoInstance.getClassPK()); - - return controlloPratica; - } - - - /** - * ADT BUG BO ID=33 - implementazione nuovo metodo - * - * @param themeDisplay - * @param workflowInstanceId - * @param renderRequest - * @param controlloPratica - * @return - */ - private Map getHistoryWorkfloLogs(ThemeDisplay themeDisplay,long workflowInstanceId, RenderRequest renderRequest,ControlloPratica controlloPratica) { - - Map esitiMapByWorkflowLogID=new HashMap(); - try { + /** + * ADT BUG BO ID=33 - implementazione nuovo metodo + * + * @param themeDisplay + * @param workflowInstanceId + * @param renderRequest + * @param controlloPratica + * @return + */ + private Map getHistoryWorkfloLogs(ThemeDisplay themeDisplay, long workflowInstanceId, + RenderRequest renderRequest, ControlloPratica controlloPratica) { + + Map esitiMapByWorkflowLogID = new HashMap(); + try { List logTypes = new ArrayList(); logTypes.add(WorkflowLog.TASK_ASSIGN); logTypes.add(WorkflowLog.TASK_COMPLETION); logTypes.add(WorkflowLog.TASK_UPDATE); logTypes.add(WorkflowLog.TRANSITION); - List workflowLogs = WorkflowLogManagerUtil.getWorkflowLogsByWorkflowInstance(themeDisplay.getCompanyId(), workflowInstanceId, logTypes,QueryUtil.ALL_POS, QueryUtil.ALL_POS,WorkflowComparatorFactoryUtil.getLogCreateDateComparator(true)); + List workflowLogs = WorkflowLogManagerUtil.getWorkflowLogsByWorkflowInstance( + themeDisplay.getCompanyId(), workflowInstanceId, logTypes, QueryUtil.ALL_POS, + QueryUtil.ALL_POS, WorkflowComparatorFactoryUtil.getLogCreateDateComparator(true)); for (WorkflowLog workflowLog : workflowLogs) { try { WorkflowTask wfTask = null; if (workflowLog.getWorkflowTaskId() > 0) { - wfTask = WorkflowTaskManagerUtil.getWorkflowTask(themeDisplay.getCompanyId(),workflowLog.getWorkflowTaskId()); + wfTask = WorkflowTaskManagerUtil.getWorkflowTask(themeDisplay.getCompanyId(), + workflowLog.getWorkflowTaskId()); ServiceContext serviceContext = ServiceContextFactory.getInstance(renderRequest); - FormLog formLog = FormLogLocalServiceUtil.findByC_Task(serviceContext.getCompanyId(),wfTask.getWorkflowTaskId()); + FormLog formLog = FormLogLocalServiceUtil.findByC_Task(serviceContext.getCompanyId(), + wfTask.getWorkflowTaskId()); - if (formLog!=null&&Validator.isNotNull(formLog.getFormParameters())) { + if (formLog != null && Validator.isNotNull(formLog.getFormParameters())) { JSONObject json = JSONFactoryUtil.createJSONObject(formLog.getFormParameters()); if (json.has("esito")) { String tipoEsito = ""; @@ -530,11 +545,10 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { break; case "CO": - if (AzioniPraticheUtil.isDeposito(controlloPratica - .getIntPraticaId())) { + if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { tipoEsito = "Conforme"; } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica - .getIntPraticaId())) { + .getIntPraticaId())) { tipoEsito = "Autorizzata"; } break; @@ -542,7 +556,8 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { case "NC": if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { tipoEsito = "Non conforme"; - } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) { + } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica + .getIntPraticaId())) { tipoEsito = "Non autorizzata"; } break; @@ -555,7 +570,9 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { break; } - //_log.info("WorkflowLogId="+ workflowLog.getWorkflowLogId() + " "+ tipoEsito); + // _log.info("WorkflowLogId="+ + // workflowLog.getWorkflowLogId() + " "+ + // tipoEsito); esitiMapByWorkflowLogID.put(workflowLog.getWorkflowLogId(), tipoEsito); } } @@ -575,26 +592,31 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { return esitiMapByWorkflowLogID; } - - - /** - * ADT: check congruenza WF - presenza dell'istruttore - * - * - * @param transitionName - * @param workflowTaskId - */ + + /** + * ADT: check congruenza WF - presenza dell'istruttore + * + * + * @param transitionName + * @param workflowTaskId + */ private void checkPresenzaIstruttore(String transitionName, long workflowTaskId) { if (transitionName.equalsIgnoreCase("registra-esito")) { try { - KaleoTaskInstanceToken kaleoTaskInstanceToken = KaleoTaskInstanceTokenLocalServiceUtil.getKaleoTaskInstanceToken(workflowTaskId); - ControlloPratica controlloPratica = getControlloPratica(kaleoTaskInstanceToken.getKaleoInstanceId()); - Map wfParameters = it.tref.liferay.portos.bo.util.WorkflowUtil.getFormParameters(controlloPratica); + KaleoTaskInstanceToken kaleoTaskInstanceToken = KaleoTaskInstanceTokenLocalServiceUtil + .getKaleoTaskInstanceToken(workflowTaskId); + ControlloPratica controlloPratica = getControlloPratica(kaleoTaskInstanceToken + .getKaleoInstanceId()); + Map wfParameters = it.tref.liferay.portos.bo.util.WorkflowUtil + .getFormParameters(controlloPratica); String istruttore = (String) wfParameters.get("istruttore"); - _log.info("checkPresenzaIstruttore - istruttore presente sul workflow= " + istruttore+ " - ControlloPraticaId = " + controlloPratica.getControlloPraticaId()); + _log.info("checkPresenzaIstruttore - istruttore presente sul workflow= " + istruttore + + " - ControlloPraticaId = " + controlloPratica.getControlloPraticaId()); if (istruttore == null) { - _log.info("checkPresenzaIstruttore - rilevata incongrueza WF - istruttore non presente per controlloPratica = " + controlloPratica.getControlloPraticaId()); - long istruttoreId = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId()).getStatusByUserId(); + _log.info("checkPresenzaIstruttore - rilevata incongrueza WF - istruttore non presente per controlloPratica = " + + controlloPratica.getControlloPraticaId()); + long istruttoreId = IntPraticaLocalServiceUtil.getIntPratica( + controlloPratica.getIntPraticaId()).getStatusByUserId(); if (istruttoreId > 0) { String jsonFormParameters = null; Map parametri = new HashMap(); @@ -605,15 +627,19 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(controlloPratica.getCompanyId()); serviceContext.setUserId(controlloPratica.getUserId()); - FormLogLocalServiceUtil.addFormLog(kaleoTaskInstanceToken.getKaleoInstanceId(), 0l, "cambio-istruttore", jsonFormParameters, serviceContext); - _log.info("checkPresenzaIstruttore correttamente eseguito - ControlloPraticaId = " + controlloPratica.getControlloPraticaId()); - }else{ - _log.info("checkPresenzaIstruttore KO - istruttore non calcolato - ControlloPraticaId = " + controlloPratica.getControlloPraticaId()); + FormLogLocalServiceUtil.addFormLog(kaleoTaskInstanceToken.getKaleoInstanceId(), 0l, + "cambio-istruttore", jsonFormParameters, serviceContext); + _log.info("checkPresenzaIstruttore correttamente eseguito - ControlloPraticaId = " + + controlloPratica.getControlloPraticaId()); + } else { + _log.info("checkPresenzaIstruttore KO - istruttore non calcolato - ControlloPraticaId = " + + controlloPratica.getControlloPraticaId()); } } } catch (Exception e) { - _log.error("checkPresenzaIstruttore KO per workflowTaskId = "+ workflowTaskId+" ["+e.getMessage()+" , "+e.getCause()+"]"); + _log.error("checkPresenzaIstruttore KO per workflowTaskId = " + workflowTaskId + " [" + + e.getMessage() + " , " + e.getCause() + "]"); } } } diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java index 46cf6875..c0ab224f 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/util/WorkflowUtil.java @@ -41,191 +41,201 @@ import com.liferay.portal.workflow.kaleo.service.KaleoTaskInstanceTokenLocalServ public class WorkflowUtil { - public static Map executeOnOpenForm(long companyId, long workflowTaskId, long assigneeUserId, - String transitionName) throws PortalException, SystemException { + public static Map executeOnOpenForm(long companyId, long workflowTaskId, + long assigneeUserId, String transitionName) throws PortalException, SystemException { + + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(companyId); + serviceContext.setUserId(assigneeUserId); - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(companyId); - serviceContext.setUserId(assigneeUserId); + KaleoTaskInstanceToken kaleoTaskInstanceToken = KaleoTaskInstanceTokenLocalServiceUtil + .getKaleoTaskInstanceToken(workflowTaskId); - KaleoTaskInstanceToken kaleoTaskInstanceToken = - KaleoTaskInstanceTokenLocalServiceUtil.getKaleoTaskInstanceToken(workflowTaskId); + KaleoTask kaleoTask = kaleoTaskInstanceToken.getKaleoTask(); + + Map workflowContext = new HashMap(); + + WorkflowHandler workflowHandler = WorkflowHandlerRegistryUtil + .getWorkflowHandler(kaleoTaskInstanceToken.getClassName()); + if (workflowHandler != null) { + workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_TYPE, + workflowHandler.getType(Locale.getDefault())); + } + + workflowContext + .put(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME, kaleoTaskInstanceToken.getClassName()); + workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK, + String.valueOf(kaleoTaskInstanceToken.getClassPK())); + workflowContext.put(WorkflowConstants.CONTEXT_COMPANY_ID, + String.valueOf(kaleoTaskInstanceToken.getCompanyId())); + workflowContext.put(WorkflowConstants.CONTEXT_GROUP_ID, + String.valueOf(kaleoTaskInstanceToken.getGroupId())); + workflowContext.put(WorkflowConstants.CONTEXT_USER_ID, String.valueOf(assigneeUserId)); + workflowContext.put(WorkflowConstants.CONTEXT_SERVICE_CONTEXT, serviceContext); + workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); + + ExecutionContext executionContext = new ExecutionContext( + kaleoTaskInstanceToken.getKaleoInstanceToken(), kaleoTaskInstanceToken, workflowContext, + serviceContext); + + ActionExecutorUtil.executeKaleoActions(KaleoNode.class.getName(), kaleoTask.getKaleoNodeId(), + ExecutionType.ON_OPEN_FORM, executionContext); + + return executionContext.getWorkflowContext(); + } + + public static Map executeOnValidation(long companyId, long workflowTaskId, + long assigneeUserId, String transitionName) throws PortalException, SystemException { + + return executeOnValidation(companyId, workflowTaskId, assigneeUserId, transitionName, null); + } + + public static Map executeOnValidation(long companyId, long workflowTaskId, + long assigneeUserId, String transitionName, Map workflowContext) + throws PortalException, SystemException { + + if (workflowContext == null) { + workflowContext = Collections. emptyMap(); + } + + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(companyId); + serviceContext.setUserId(assigneeUserId); + + KaleoTaskInstanceToken kaleoTaskInstanceToken = KaleoTaskInstanceTokenLocalServiceUtil + .getKaleoTaskInstanceToken(workflowTaskId); + + KaleoTask kaleoTask = kaleoTaskInstanceToken.getKaleoTask(); + + WorkflowHandler workflowHandler = WorkflowHandlerRegistryUtil + .getWorkflowHandler(kaleoTaskInstanceToken.getClassName()); + if (workflowHandler != null) { + workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_TYPE, + workflowHandler.getType(Locale.getDefault())); + } - KaleoTask kaleoTask = kaleoTaskInstanceToken.getKaleoTask(); + workflowContext + .put(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME, kaleoTaskInstanceToken.getClassName()); + workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK, + String.valueOf(kaleoTaskInstanceToken.getClassPK())); + workflowContext.put(WorkflowConstants.CONTEXT_COMPANY_ID, + String.valueOf(kaleoTaskInstanceToken.getCompanyId())); + workflowContext.put(WorkflowConstants.CONTEXT_GROUP_ID, + String.valueOf(kaleoTaskInstanceToken.getGroupId())); + workflowContext.put(WorkflowConstants.CONTEXT_USER_ID, String.valueOf(assigneeUserId)); + workflowContext.put(WorkflowConstants.CONTEXT_SERVICE_CONTEXT, serviceContext); + workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); - Map workflowContext = new HashMap(); + ExecutionContext executionContext = new ExecutionContext( + kaleoTaskInstanceToken.getKaleoInstanceToken(), kaleoTaskInstanceToken, workflowContext, + serviceContext); + + ActionExecutorUtil.executeKaleoActions(KaleoNode.class.getName(), kaleoTask.getKaleoNodeId(), + ExecutionType.ON_VALIDATION, executionContext); + + return executionContext.getWorkflowContext(); + } + + public static Map getFormParameters(long companyId, long workflowTaskId) + throws PortalException, SystemException { + + return getFormParameters(companyId, 0, 0, StringPool.BLANK, workflowTaskId); + } + + public static Map getFormParameters(long companyId, long groupId, long classPK, + String className, long workflowTaskId) throws PortalException, SystemException { + + if (Validator.isNotNull(workflowTaskId)) { + + KaleoTaskInstanceToken kaleoTaskInstanceToken = KaleoTaskInstanceTokenLocalServiceUtil + .getKaleoTaskInstanceToken(workflowTaskId); + + companyId = kaleoTaskInstanceToken.getCompanyId(); + groupId = kaleoTaskInstanceToken.getGroupId(); + classPK = kaleoTaskInstanceToken.getClassPK(); + className = kaleoTaskInstanceToken.getClassName(); + } + + WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil + .fetchWorkflowInstanceLink(companyId, groupId, className, classPK); + if (workflowInstanceLink == null) { + throw new NoSuchWorkflowInstanceLinkException(); + } + + long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId(); + + Map parameters = new HashMap(); + + // order asc + List formLogs = FormLogLocalServiceUtil.findByC_Instance(companyId, workflowInstanceId, + QueryUtil.ALL_POS, QueryUtil.ALL_POS); + for (FormLog formLog : formLogs) { + String formParameters = formLog.getFormParameters(); + if (Validator.isNotNull(formParameters)) { + JSONDeserializer> jsonDeserializer = JSONFactoryUtil + .> createJSONDeserializer(); + parameters.putAll(jsonDeserializer.deserialize(formParameters)); + } + } - WorkflowHandler workflowHandler = - WorkflowHandlerRegistryUtil.getWorkflowHandler(kaleoTaskInstanceToken.getClassName()); - if (workflowHandler != null) { - workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_TYPE, workflowHandler.getType(Locale.getDefault())); - } + return parameters; + } - workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME, kaleoTaskInstanceToken.getClassName()); - workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK, String.valueOf(kaleoTaskInstanceToken.getClassPK())); - workflowContext.put(WorkflowConstants.CONTEXT_COMPANY_ID, String.valueOf(kaleoTaskInstanceToken.getCompanyId())); - workflowContext.put(WorkflowConstants.CONTEXT_GROUP_ID, String.valueOf(kaleoTaskInstanceToken.getGroupId())); - workflowContext.put(WorkflowConstants.CONTEXT_USER_ID, String.valueOf(assigneeUserId)); - workflowContext.put(WorkflowConstants.CONTEXT_SERVICE_CONTEXT, serviceContext); - workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); + public static void updateWorkflowContextWithTaskFormParameters(PortletRequest portletRequest, + Map workflowContext) { - ExecutionContext executionContext = - new ExecutionContext(kaleoTaskInstanceToken.getKaleoInstanceToken(), kaleoTaskInstanceToken, workflowContext, - serviceContext); + Map formParameters = null; + + Enumeration enu = portletRequest.getParameterNames(); + + while (enu.hasMoreElements()) { + String name = enu.nextElement(); + + if (!name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) + && !name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { + continue; + } + + if (formParameters == null) { + formParameters = new HashMap(); + } + + String parameterName = name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(), + name.length() - WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM.length()); + String value = StringUtil.merge(ParamUtil.getParameterValues(portletRequest, name)); + formParameters.put(parameterName, value); + } + + if (formParameters == null) { + + HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil + .getHttpServletRequest(portletRequest)); + + Enumeration enums = httpServletRequest.getParameterNames(); + + while (enums.hasMoreElements()) { + String name = enums.nextElement(); + + if (!name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) + && !name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { + continue; + } - ActionExecutorUtil.executeKaleoActions(KaleoNode.class.getName(), kaleoTask.getKaleoNodeId(), - ExecutionType.ON_OPEN_FORM, executionContext); + if (formParameters == null) { + formParameters = new HashMap(); + } - return executionContext.getWorkflowContext(); - } + String parameterName = name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(), + name.length() - WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM.length()); + String value = StringUtil.merge(ParamUtil.getParameterValues(httpServletRequest, name)); + formParameters.put(parameterName, value); + } + } - public static Map executeOnValidation(long companyId, long workflowTaskId, long assigneeUserId, - String transitionName) throws PortalException, SystemException { - - return executeOnValidation(companyId, workflowTaskId, assigneeUserId, transitionName, null); - } - - public static Map executeOnValidation(long companyId, long workflowTaskId, long assigneeUserId, - String transitionName, Map workflowContext) throws PortalException, SystemException { - - if (workflowContext == null) { - workflowContext = Collections.emptyMap(); - } - - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(companyId); - serviceContext.setUserId(assigneeUserId); - - KaleoTaskInstanceToken kaleoTaskInstanceToken = - KaleoTaskInstanceTokenLocalServiceUtil.getKaleoTaskInstanceToken(workflowTaskId); - - KaleoTask kaleoTask = kaleoTaskInstanceToken.getKaleoTask(); - - WorkflowHandler workflowHandler = - WorkflowHandlerRegistryUtil.getWorkflowHandler(kaleoTaskInstanceToken.getClassName()); - if (workflowHandler != null) { - workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_TYPE, workflowHandler.getType(Locale.getDefault())); - } - - workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME, kaleoTaskInstanceToken.getClassName()); - workflowContext.put(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK, String.valueOf(kaleoTaskInstanceToken.getClassPK())); - workflowContext.put(WorkflowConstants.CONTEXT_COMPANY_ID, String.valueOf(kaleoTaskInstanceToken.getCompanyId())); - workflowContext.put(WorkflowConstants.CONTEXT_GROUP_ID, String.valueOf(kaleoTaskInstanceToken.getGroupId())); - workflowContext.put(WorkflowConstants.CONTEXT_USER_ID, String.valueOf(assigneeUserId)); - workflowContext.put(WorkflowConstants.CONTEXT_SERVICE_CONTEXT, serviceContext); - workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); - - ExecutionContext executionContext = - new ExecutionContext(kaleoTaskInstanceToken.getKaleoInstanceToken(), kaleoTaskInstanceToken, workflowContext, - serviceContext); - - ActionExecutorUtil.executeKaleoActions(KaleoNode.class.getName(), kaleoTask.getKaleoNodeId(), - ExecutionType.ON_VALIDATION, executionContext); - - return executionContext.getWorkflowContext(); - } - - public static Map getFormParameters(long companyId, long workflowTaskId) - throws PortalException, SystemException { - - return getFormParameters(companyId, 0, 0, StringPool.BLANK, workflowTaskId); - } - - public static Map getFormParameters(long companyId, long groupId, long classPK, - String className, long workflowTaskId) throws PortalException, SystemException { - - if (Validator.isNotNull(workflowTaskId)) { - - KaleoTaskInstanceToken kaleoTaskInstanceToken = - KaleoTaskInstanceTokenLocalServiceUtil.getKaleoTaskInstanceToken(workflowTaskId); - - companyId = kaleoTaskInstanceToken.getCompanyId(); - groupId = kaleoTaskInstanceToken.getGroupId(); - classPK = kaleoTaskInstanceToken.getClassPK(); - className = kaleoTaskInstanceToken.getClassName(); - } - - WorkflowInstanceLink workflowInstanceLink = - WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink(companyId, groupId, className, classPK); - if (workflowInstanceLink == null) { - throw new NoSuchWorkflowInstanceLinkException(); - } - - long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId(); - - Map parameters = new HashMap(); - - // order asc - List formLogs = - FormLogLocalServiceUtil.findByC_Instance(companyId, workflowInstanceId, QueryUtil.ALL_POS, QueryUtil.ALL_POS); - for (FormLog formLog : formLogs) { - String formParameters = formLog.getFormParameters(); - if (Validator.isNotNull(formParameters)) { - JSONDeserializer> jsonDeserializer = - JSONFactoryUtil.>createJSONDeserializer(); - parameters.putAll(jsonDeserializer.deserialize(formParameters)); - } - } - - return parameters; - } - - public static void updateWorkflowContextWithTaskFormParameters(PortletRequest portletRequest, - Map workflowContext) { - - Map formParameters = null; - - Enumeration enu = portletRequest.getParameterNames(); - - while (enu.hasMoreElements()) { - String name = enu.nextElement(); - - if (!name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) - && !name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { - continue; - } - - if (formParameters == null) { - formParameters = new HashMap(); - } - - String parameterName = - name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(), name.length() - - WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM.length()); - String value = StringUtil.merge(ParamUtil.getParameterValues(portletRequest, name)); - formParameters.put(parameterName, value); - } - - if (formParameters == null) { - - HttpServletRequest httpServletRequest = - PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(portletRequest)); - - Enumeration enums = httpServletRequest.getParameterNames(); - - while (enums.hasMoreElements()) { - String name = enums.nextElement(); - - if (!name.startsWith(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM) - && !name.endsWith(WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM)) { - continue; - } - - if (formParameters == null) { - formParameters = new HashMap(); - } - - String parameterName = - name.substring(WorkflowConstants.PREFIX_NAME_ELEMENT_FORM.length(), name.length() - - WorkflowConstants.SUFFIX_NAME_ELEMENT_FORM.length()); - String value = StringUtil.merge(ParamUtil.getParameterValues(httpServletRequest, name)); - formParameters.put(parameterName, value); - } - } - - if (formParameters != null) { - workflowContext.put(WorkflowConstants.CONTEXT_TASK_FORM_PARAMETERS, (Serializable) formParameters); - } - } + if (formParameters != null) { + workflowContext + .put(WorkflowConstants.CONTEXT_TASK_FORM_PARAMETERS, (Serializable) formParameters); + } + } }