|
|
|
@ -1,13 +1,13 @@
|
|
|
|
|
/** |
|
|
|
|
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. |
|
|
|
|
* |
|
|
|
|
* This library is free software; you can redistribute it and/or modify it under the terms of the |
|
|
|
|
* GNU Lesser General Public License as published by the Free Software Foundation; either version |
|
|
|
|
* 2.1 of the License, or (at your option) any later version. |
|
|
|
|
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General |
|
|
|
|
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) |
|
|
|
|
* any later version. |
|
|
|
|
* |
|
|
|
|
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without |
|
|
|
|
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
|
* Lesser General Public License for more details. |
|
|
|
|
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
|
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
|
|
|
|
* details. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
package it.tref.liferay.portos.bo.service.impl; |
|
|
|
@ -23,12 +23,12 @@ import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
|
|
|
|
|
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.service.TempisticaLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.service.base.ControlloPraticaLocalServiceBaseImpl; |
|
|
|
|
import it.tref.liferay.portos.bo.shared.util.Constants; |
|
|
|
|
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; |
|
|
|
|
import it.tref.liferay.portos.bo.shared.util.TipoIntegrazioneUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.shared.util.UnitaOperativeUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.util.AvvisoUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.util.AzioniPraticheUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.util.Constants; |
|
|
|
|
import it.tref.liferay.portos.bo.util.GestioneFirmeUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.util.TempisticaConstants; |
|
|
|
|
import it.tref.liferay.portos.bo.util.WorkflowConstants; |
|
|
|
@ -44,6 +44,7 @@ import java.util.List;
|
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Set; |
|
|
|
|
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; |
|
|
|
@ -85,15 +86,12 @@ import com.liferay.portlet.asset.model.AssetLinkConstants;
|
|
|
|
|
* The implementation of the controllo pratica local service. |
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* All custom service methods should be put in this class. Whenever methods are |
|
|
|
|
* added, rerun ServiceBuilder to copy their definitions into the |
|
|
|
|
* {@link it.tref.liferay.portos.bo.service.ControlloPraticaLocalService} |
|
|
|
|
* interface. |
|
|
|
|
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy |
|
|
|
|
* their definitions into the {@link it.tref.liferay.portos.bo.service.ControlloPraticaLocalService} interface. |
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* This is a local service. Methods of this service will not have security |
|
|
|
|
* checks based on the propagated JAAS credentials because this service can only |
|
|
|
|
* be accessed from within the same VM. |
|
|
|
|
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS |
|
|
|
|
* credentials because this service can only be accessed from within the same VM. |
|
|
|
|
* </p> |
|
|
|
|
* |
|
|
|
|
* @author Davide Barbagallo, 3F Consulting |
|
|
|
@ -102,17 +100,17 @@ import com.liferay.portlet.asset.model.AssetLinkConstants;
|
|
|
|
|
*/ |
|
|
|
|
public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServiceBaseImpl { |
|
|
|
|
/* |
|
|
|
|
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use |
|
|
|
|
* {@link |
|
|
|
|
* it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil} to |
|
|
|
|
* access the controllo pratica local service. |
|
|
|
|
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link |
|
|
|
|
* it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil} to access the controllo pratica local |
|
|
|
|
* service. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
private static final Log _log = LogFactoryUtil.getLog(ControlloPraticaLocalServiceImpl.class); |
|
|
|
|
|
|
|
|
|
public ControlloPratica addControlloPratica(long groupId, long userId, long intPraticaId, |
|
|
|
|
long dettPraticaId, boolean updateFlagControlloObbligatorio, ServiceContext serviceContext) |
|
|
|
|
throws PortalException, SystemException { |
|
|
|
|
@Override |
|
|
|
|
public ControlloPratica addControlloPratica(long groupId, long userId, long intPraticaId, long dettPraticaId, |
|
|
|
|
boolean updateFlagControlloObbligatorio, ServiceContext serviceContext) throws PortalException, |
|
|
|
|
SystemException { |
|
|
|
|
|
|
|
|
|
User user = userPersistence.findByPrimaryKey(userId); |
|
|
|
|
|
|
|
|
@ -143,8 +141,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
// aggiorno int e dett pratica per avvio workflow
|
|
|
|
|
IntPratica intPratica = intPraticaLocalService.updateStatoPratica(intPraticaId, |
|
|
|
|
StatoPraticaConstants.SOTTOPOSTA_A_PARERE); |
|
|
|
|
if (updateFlagControlloObbligatorio |
|
|
|
|
&& Constants.TIPO_PRATICA_DEPOSITO.equals(intPratica.getTipoPratica())) { |
|
|
|
|
if (updateFlagControlloObbligatorio && Constants.TIPO_PRATICA_DEPOSITO.equals(intPratica.getTipoPratica())) { |
|
|
|
|
intPratica.setControlloObbligatorio(true); |
|
|
|
|
intPratica = intPraticaLocalService.updateIntPratica(intPratica); |
|
|
|
|
} |
|
|
|
@ -162,9 +159,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
// ///////////
|
|
|
|
|
|
|
|
|
|
// Workflow
|
|
|
|
|
WorkflowHandlerRegistryUtil.startWorkflowInstance(entry.getCompanyId(), entry.getGroupId(), |
|
|
|
|
entry.getUserId(), ControlloPratica.class.getName(), entry.getPrimaryKey(), entry, |
|
|
|
|
serviceContext, wfContextMap); |
|
|
|
|
WorkflowHandlerRegistryUtil.startWorkflowInstance(entry.getCompanyId(), entry.getGroupId(), entry.getUserId(), |
|
|
|
|
ControlloPratica.class.getName(), entry.getPrimaryKey(), entry, serviceContext, wfContextMap); |
|
|
|
|
|
|
|
|
|
Date dtInvio = null; |
|
|
|
|
if (intPratica.getDtSorteggio() != null) { |
|
|
|
@ -173,22 +169,22 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
dtInvio = entry.getCreateDate(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TempisticaLocalServiceUtil.addTempistica(intPraticaId, dettPraticaId, |
|
|
|
|
TempisticaConstants.TIPO_PRATICA, dtInvio, serviceContext); |
|
|
|
|
TempisticaLocalServiceUtil.addTempistica(intPraticaId, dettPraticaId, TempisticaConstants.TIPO_PRATICA, |
|
|
|
|
dtInvio, serviceContext); |
|
|
|
|
|
|
|
|
|
return entry; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ControlloPratica deleteControlloPratica(long controlloPraticaId) throws PortalException, |
|
|
|
|
SystemException { |
|
|
|
|
@Override |
|
|
|
|
public ControlloPratica deleteControlloPratica(long controlloPraticaId) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
ControlloPratica entry = controlloPraticaPersistence.findByPrimaryKey(controlloPraticaId); |
|
|
|
|
|
|
|
|
|
return deleteControlloPratica(entry); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ControlloPratica deleteControlloPratica(ControlloPratica entry) throws SystemException, |
|
|
|
|
PortalException { |
|
|
|
|
@Override |
|
|
|
|
public ControlloPratica deleteControlloPratica(ControlloPratica entry) throws SystemException, PortalException { |
|
|
|
|
|
|
|
|
|
// Resources
|
|
|
|
|
resourceLocalService.deleteResource(entry.getCompanyId(), ControlloPratica.class.getName(), |
|
|
|
@ -200,28 +196,29 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
|
|
|
|
|
// Workflow
|
|
|
|
|
|
|
|
|
|
workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(entry.getCompanyId(), |
|
|
|
|
entry.getGroupId(), ControlloPratica.class.getName(), entry.getControlloPraticaId()); |
|
|
|
|
workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(entry.getCompanyId(), entry.getGroupId(), |
|
|
|
|
ControlloPratica.class.getName(), entry.getControlloPraticaId()); |
|
|
|
|
|
|
|
|
|
controlloPraticaPersistence.remove(entry); |
|
|
|
|
|
|
|
|
|
return entry; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<ControlloPratica> findByIntPraticaId_Status(long intPraticaId, int status) |
|
|
|
|
throws SystemException { |
|
|
|
|
@Override |
|
|
|
|
public List<ControlloPratica> findByIntPraticaId_Status(long intPraticaId, int status) throws SystemException { |
|
|
|
|
|
|
|
|
|
return controlloPraticaPersistence.findByIntPraticaId_Status(intPraticaId, status); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int countByIntPraticaId_Status(long intPraticaId, int status) throws SystemException { |
|
|
|
|
|
|
|
|
|
return controlloPraticaPersistence.countByIntPraticaId_Status(intPraticaId, status); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void updateAsset(long userId, ControlloPratica entry, long[] assetCategoryIds, |
|
|
|
|
String[] assetTagNames, long[] assetLinkEntryIds, Date now) throws PortalException, |
|
|
|
|
SystemException { |
|
|
|
|
@Override |
|
|
|
|
public void updateAsset(long userId, ControlloPratica entry, long[] assetCategoryIds, String[] assetTagNames, |
|
|
|
|
long[] assetLinkEntryIds, Date now) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
boolean visible = false; |
|
|
|
|
|
|
|
|
@ -239,23 +236,24 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, entry.getGroupId(), now, now, |
|
|
|
|
ControlloPratica.class.getName(), entry.getControlloPraticaId(), entry.getUuid(), 0, |
|
|
|
|
assetCategoryIds, assetTagNames, visible, null, null, null, null, ContentTypes.TEXT_PLAIN, |
|
|
|
|
String.valueOf(entry.getPrimaryKey()), String.valueOf(entry.getPrimaryKey()), null, null, 0, |
|
|
|
|
0, null, false); |
|
|
|
|
ControlloPratica.class.getName(), entry.getControlloPraticaId(), entry.getUuid(), 0, assetCategoryIds, |
|
|
|
|
assetTagNames, visible, null, null, null, null, ContentTypes.TEXT_PLAIN, |
|
|
|
|
String.valueOf(entry.getPrimaryKey()), String.valueOf(entry.getPrimaryKey()), null, null, 0, 0, null, |
|
|
|
|
false); |
|
|
|
|
|
|
|
|
|
assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds, |
|
|
|
|
AssetLinkConstants.TYPE_RELATED); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void deleteAsset(ControlloPratica entry) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
assetEntryLocalService.deleteEntry(ControlloPratica.class.getName(), entry.getControlloPraticaId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ControlloPratica updateStatus(long userId, long resourcePrimKey, int status, |
|
|
|
|
ServiceContext serviceContext, List<ControlloPratica> wfNewListVarianti) throws PortalException, |
|
|
|
|
SystemException { |
|
|
|
|
@Override |
|
|
|
|
public ControlloPratica updateStatus(long userId, long resourcePrimKey, int status, ServiceContext serviceContext, |
|
|
|
|
List<ControlloPratica> wfNewListVarianti) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
User user = userPersistence.findByPrimaryKey(userId); |
|
|
|
|
Date now = new Date(); |
|
|
|
@ -276,8 +274,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
List<DettPratica> successivePratiche = dettPraticaLocalService |
|
|
|
|
.findCompletedByIntPraticaAndSuccessivoDettPratica(entry.getIntPraticaId(), |
|
|
|
|
entry.getDettPraticaId()); |
|
|
|
|
boolean autorizzazione = Constants.TIPO_PRATICA_AUTORIZZAZIONE.equalsIgnoreCase(intPratica |
|
|
|
|
.getTipoPratica()); |
|
|
|
|
boolean autorizzazione = Constants.TIPO_PRATICA_AUTORIZZAZIONE |
|
|
|
|
.equalsIgnoreCase(intPratica.getTipoPratica()); |
|
|
|
|
boolean avvioWorkflow = false; |
|
|
|
|
for (DettPratica dettPraticaSuc : successivePratiche) { |
|
|
|
|
if (TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPraticaSuc.getTipoIntegrazione()) |
|
|
|
@ -311,14 +309,12 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
return entry; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean generazioneDocumento(long controlloPraticaId, String jsonParams, String tipoAvviso, |
|
|
|
|
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, |
|
|
|
|
SystemException { |
|
|
|
|
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica |
|
|
|
|
.getDettPraticaId()); |
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId); |
|
|
|
|
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica.getDettPraticaId()); |
|
|
|
|
|
|
|
|
|
ServiceContext serviceContext = new ServiceContext(); |
|
|
|
|
serviceContext.setCompanyId(controlloPratica.getCompanyId()); |
|
|
|
@ -339,21 +335,20 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Deprecated |
|
|
|
|
public boolean updateStatoPraticaGeneraDocumentoFinale(long controlloPraticaId, String jsonParams, |
|
|
|
|
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, |
|
|
|
|
SystemException { |
|
|
|
|
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
return generaDocumentoFinale(controlloPraticaId, jsonParams, userIdFirma, workflowContext); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean generaDocumentoFinale(long controlloPraticaId, String jsonParams, long userIdFirma, |
|
|
|
|
Map<String, Serializable> workflowContext) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica |
|
|
|
|
.getDettPraticaId()); |
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId); |
|
|
|
|
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica.getDettPraticaId()); |
|
|
|
|
|
|
|
|
|
ServiceContext serviceContext = new ServiceContext(); |
|
|
|
|
serviceContext.setCompanyId(controlloPratica.getCompanyId()); |
|
|
|
@ -385,14 +380,13 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void updateIstruttore(long controlloPraticaId, Map<String, Serializable> workflowContext) |
|
|
|
|
throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId); |
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
Map<String, String> parametri = (Map<String, String>) workflowContext |
|
|
|
|
.get("CONTEXT_TASK_FORM_PARAMETERS"); |
|
|
|
|
Map<String, String> parametri = (Map<String, String>) workflowContext.get("CONTEXT_TASK_FORM_PARAMETERS"); |
|
|
|
|
IntPratica intPratica = intPraticaLocalService.getIntPratica(controlloPratica.getIntPraticaId()); |
|
|
|
|
long istruttore = GetterUtil.getLong(parametri.get("istruttore")); |
|
|
|
|
intPratica.setStatusByUserId(istruttore); |
|
|
|
@ -401,6 +395,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Deprecated |
|
|
|
|
public String valutazioneEsitoFinale(long controlloPraticaId, Map<String, Serializable> workflowContext) |
|
|
|
|
throws PortalException, SystemException { |
|
|
|
@ -409,22 +404,21 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* I valori di ritorno possibili sono: |
|
|
|
|
* approvato,non_approvato,annullato,richiesta_integrazione |
|
|
|
|
* |
|
|
|
|
* I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione |
|
|
|
|
* |
|
|
|
|
* @throws SystemException |
|
|
|
|
* @throws PortalException |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public String valutazioneEsitoFinaleUpdateStatoPratica(long controlloPraticaId, |
|
|
|
|
Map<String, Serializable> workflowContext) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
String esito = getEsitoFinale(controlloPraticaId, workflowContext); |
|
|
|
|
String ramoWorkflow = StringPool.BLANK; |
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId); |
|
|
|
|
|
|
|
|
|
Avviso avviso = avvisoLocalService.fetchLastAvvisoByIntPraticaPerStatoFinale(controlloPratica |
|
|
|
|
.getIntPraticaId()); |
|
|
|
|
Avviso avviso = avvisoLocalService |
|
|
|
|
.fetchLastAvvisoByIntPraticaPerStatoFinale(controlloPratica.getIntPraticaId()); |
|
|
|
|
if (avviso != null && avviso.getRifiutato()) { |
|
|
|
|
ramoWorkflow = "rifiuto_firma"; |
|
|
|
|
} else { |
|
|
|
@ -467,8 +461,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
|
|
|
|
|
// Map<String, String> parametri = (Map<String, String>)
|
|
|
|
|
// workflowContext.get("CONTEXT_TASK_FORM_PARAMETERS");
|
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId); |
|
|
|
|
Map<String, Serializable> parametri = WorkflowUtil.getFormParameters(controlloPratica); |
|
|
|
|
String esitoScelta = (String) parametri.get("esito"); |
|
|
|
|
|
|
|
|
@ -483,8 +476,9 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
return esitoScelta; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void aggiornaStatoPerRichiestaIntegrazione(long controlloPraticaId, |
|
|
|
|
Map<String, Serializable> workflowContext) throws PortalException, SystemException { |
|
|
|
|
@Override |
|
|
|
|
public void aggiornaStatoPerRichiestaIntegrazione(long controlloPraticaId, Map<String, Serializable> workflowContext) |
|
|
|
|
throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
ControlloPratica controllo = controlloPraticaLocalService.getControlloPratica(controlloPraticaId); |
|
|
|
|
IntPratica pratica = intPraticaLocalService.getIntPratica(controllo.getIntPraticaId()); |
|
|
|
@ -496,11 +490,11 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
intPraticaLocalService.updateIntPratica(pratica); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getJsonListaIstruttori(long controlloPraticaId, Map<String, Serializable> workflowContext) |
|
|
|
|
throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId); |
|
|
|
|
int unitaOperativa = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId()) |
|
|
|
|
.getUnitaOperativa(); |
|
|
|
|
boolean preassegnazione = (0 == unitaOperativa); |
|
|
|
@ -551,100 +545,102 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
return jsonObject.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getJsonEsitoPratica(long controlloPraticaId, Map<String, Serializable> workflowContext) |
|
|
|
|
throws PortalException, SystemException { |
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId); |
|
|
|
|
IntPratica intPratica = intPraticaLocalService.getIntPratica(controlloPratica.getIntPraticaId()); |
|
|
|
|
if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { |
|
|
|
|
return jsonDeposito; |
|
|
|
|
} |
|
|
|
|
switch (intPratica.getTipoProcedura()) { |
|
|
|
|
case Constants.PROCEDURA_P3: |
|
|
|
|
if (Validator.isNull(intPratica.getDtViarch())) { |
|
|
|
|
return jsonViarchStart; |
|
|
|
|
} else { |
|
|
|
|
return jsonViarchEnd; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return jsonAutorizzazione; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
private static final String jsonDeposito = StringPool.BLANK; |
|
|
|
|
private static final String jsonAutorizzazione = getJsonAutorizzazione(); |
|
|
|
|
private static final String jsonViarchStart = getJsonViarchStart(); |
|
|
|
|
private static final String jsonViarchEnd = getJsonViarchStart(); |
|
|
|
|
|
|
|
|
|
private static String getJsonAutorizzazione() { |
|
|
|
|
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); |
|
|
|
|
jsonObject.put("esito", jsonArray); |
|
|
|
|
|
|
|
|
|
if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { |
|
|
|
|
JSONObject etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", StatoPraticaConstants.getEsitoDeposito(StatoPraticaConstants.CONFORME)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.CONFORME); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette |
|
|
|
|
.put("label", StatoPraticaConstants.getEsitoDeposito(StatoPraticaConstants.NON_CONFORME)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.NON_CONFORME); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette |
|
|
|
|
.put("label", StatoPraticaConstants.getEsitoDeposito(StatoPraticaConstants.INTEGRAZIONE)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.INTEGRAZIONE); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", StatoPraticaConstants.getEsitoDeposito(StatoPraticaConstants.ANNULLATA)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.ANNULLATA); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
} else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) { |
|
|
|
|
JSONObject etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", |
|
|
|
|
StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.AUTORIZZATA)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.CONFORME); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", |
|
|
|
|
StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.NON_CONFORME)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.NON_CONFORME); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", |
|
|
|
|
StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.INTEGRAZIONE)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.INTEGRAZIONE); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", |
|
|
|
|
StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.PREAVVISO_CONTRARIO)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.PREAVVISO_CONTRARIO); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", |
|
|
|
|
StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.NO_PARERE)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.NO_PARERE); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
} |
|
|
|
|
JSONObject etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.AUTORIZZATA)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.CONFORME); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.NON_CONFORME)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.NON_CONFORME); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.INTEGRAZIONE)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.INTEGRAZIONE); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.PREAVVISO_CONTRARIO)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.PREAVVISO_CONTRARIO); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.NO_PARERE)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.NO_PARERE); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
return jsonObject.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ControlloPratica addPraticheAlControllo(long controlloPraticaId, long dettPraticaId) |
|
|
|
|
throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
private static String getJsonViarchStart() { |
|
|
|
|
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); |
|
|
|
|
jsonObject.put("esito", jsonArray); |
|
|
|
|
JSONObject etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", "Attiva VIArch"); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.VIARCH); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
etichette = JSONFactoryUtil.createJSONObject(); |
|
|
|
|
etichette.put("label", StatoPraticaConstants.getEsitoAutorizzazione(StatoPraticaConstants.INTEGRAZIONE)); |
|
|
|
|
etichette.put("value", StatoPraticaConstants.INTEGRAZIONE); |
|
|
|
|
etichette.put("default", false); |
|
|
|
|
jsonArray.put(etichette); |
|
|
|
|
return jsonObject.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public ControlloPratica addPraticheAlControllo(long controlloPraticaId, long dettPraticaId) throws PortalException, |
|
|
|
|
SystemException { |
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId); |
|
|
|
|
controlloPratica.setDettPraticaId(dettPraticaId); |
|
|
|
|
controlloPratica.setModifiedDate(new Date()); |
|
|
|
|
|
|
|
|
|
return controlloPraticaPersistence.update(controlloPratica); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* ADT: BUG ID=5 - tracciamento operazione aggiungi varianti al controllo |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param controlloPraticaId |
|
|
|
|
* @param dettPraticaId |
|
|
|
|
* @return |
|
|
|
|
* @throws PortalException |
|
|
|
|
* @throws SystemException |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public ControlloPratica addPraticheAlControlloVarianti(long controlloPraticaId, long dettPraticaId, |
|
|
|
|
ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
|
_log.info("start addPraticheAlControlloVarianti per controlloPraticaId=" + controlloPraticaId); |
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId); |
|
|
|
|
controlloPratica.setDettPraticaId(dettPraticaId); |
|
|
|
|
controlloPratica.setModifiedDate(new Date()); |
|
|
|
|
ControlloPratica result = controlloPraticaPersistence.update(controlloPratica); |
|
|
|
@ -660,22 +656,19 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
FormLogLocalServiceUtil.addFormLog(lastTask.getWorkflowInstanceId(), 0l, "cambio-istruttore", |
|
|
|
|
jsonFormParameters, serviceContext); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
_log.error( |
|
|
|
|
"Errore in addPraticheAlControlloVarianti - inserimento log non riuscito -controlloPraticaId = " |
|
|
|
|
+ controlloPraticaId, e); |
|
|
|
|
_log.error("Errore in addPraticheAlControlloVarianti - inserimento log non riuscito -controlloPraticaId = " |
|
|
|
|
+ controlloPraticaId, e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getReturnValueScriptIniziale(long controlloPraticaId) throws PortalException, |
|
|
|
|
SystemException { |
|
|
|
|
@Override |
|
|
|
|
public String getReturnValueScriptIniziale(long controlloPraticaId) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService |
|
|
|
|
.getControlloPratica(controlloPraticaId); |
|
|
|
|
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId); |
|
|
|
|
|
|
|
|
|
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica |
|
|
|
|
.getDettPraticaId()); |
|
|
|
|
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica.getDettPraticaId()); |
|
|
|
|
|
|
|
|
|
if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) { |
|
|
|
|
return "portos1_integrazioni"; |
|
|
|
@ -684,16 +677,15 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getTipoEsito(long controlloPraticaId) throws SystemException, PortalException { |
|
|
|
|
|
|
|
|
|
String tipoEsito = StringPool.BLANK; |
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
|
.fetchControlloPratica(controlloPraticaId); |
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.fetchControlloPratica(controlloPraticaId); |
|
|
|
|
|
|
|
|
|
ClassLoader classLoaderKaleo = (ClassLoader) PortletBeanLocatorUtil.locate( |
|
|
|
|
com.liferay.portal.workflow.kaleo.service.ClpSerializer.getServletContextName(), |
|
|
|
|
"portletClassLoader"); |
|
|
|
|
com.liferay.portal.workflow.kaleo.service.ClpSerializer.getServletContextName(), "portletClassLoader"); |
|
|
|
|
|
|
|
|
|
DynamicQuery dqKaleo = DynamicQueryFactoryUtil.forClass(KaleoInstance.class, classLoaderKaleo); |
|
|
|
|
dqKaleo.add(RestrictionsFactoryUtil.eq("classPK", controlloPraticaId)); |
|
|
|
@ -708,10 +700,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
it.tref.liferay.portos.kaleo.service.ClpSerializer.getServletContextName(), |
|
|
|
|
"portletClassLoader"); |
|
|
|
|
|
|
|
|
|
DynamicQuery dqKaleoLog = DynamicQueryFactoryUtil |
|
|
|
|
.forClass(FormLog.class, classLoaderKaleoLog); |
|
|
|
|
dqKaleoLog.add(RestrictionsFactoryUtil.eq("workflowInstanceId", |
|
|
|
|
kaleoInstance.getKaleoInstanceId())); |
|
|
|
|
DynamicQuery dqKaleoLog = DynamicQueryFactoryUtil.forClass(FormLog.class, classLoaderKaleoLog); |
|
|
|
|
dqKaleoLog.add(RestrictionsFactoryUtil.eq("workflowInstanceId", kaleoInstance.getKaleoInstanceId())); |
|
|
|
|
dqKaleoLog.add(RestrictionsFactoryUtil.eq("transitionName", "registra-esito")); |
|
|
|
|
|
|
|
|
|
Order defaultOrder = OrderFactoryUtil.desc("createDate"); |
|
|
|
@ -735,26 +725,26 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
return tipoEsito; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<ControlloPratica> findByIntPratica(long intPraticaId) throws SystemException { |
|
|
|
|
return controlloPraticaPersistence.findByIntPraticaId(intPraticaId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Long calculateDateAvvioProcedimento(long controlloPraticaId) throws SystemException, |
|
|
|
|
PortalException { |
|
|
|
|
ControlloPratica controllo = ControlloPraticaLocalServiceUtil |
|
|
|
|
.fetchControlloPratica(controlloPraticaId); |
|
|
|
|
@Override |
|
|
|
|
public Long calculateDateAvvioProcedimento(long controlloPraticaId) throws SystemException, PortalException { |
|
|
|
|
ControlloPratica controllo = ControlloPraticaLocalServiceUtil.fetchControlloPratica(controlloPraticaId); |
|
|
|
|
IntPratica pratica = IntPraticaLocalServiceUtil.fetchIntPratica(controllo.getIntPraticaId()); |
|
|
|
|
|
|
|
|
|
Date apertura = pratica.getDtPratica(); |
|
|
|
|
Date chiusura = null; |
|
|
|
|
long stop = 0; |
|
|
|
|
|
|
|
|
|
List<Avviso> avvisi = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(), |
|
|
|
|
QueryUtil.ALL_POS, QueryUtil.ALL_POS, OrderByComparatorFactoryUtil |
|
|
|
|
.getOrderByComparatorFactory().create("portos_bo_Avviso", "createDate", true)); |
|
|
|
|
List<Avviso> avvisi = AvvisoLocalServiceUtil.findByIntPratica( |
|
|
|
|
pratica.getIntPraticaId(), |
|
|
|
|
QueryUtil.ALL_POS, |
|
|
|
|
QueryUtil.ALL_POS, |
|
|
|
|
OrderByComparatorFactoryUtil.getOrderByComparatorFactory().create("portos_bo_Avviso", "createDate", |
|
|
|
|
true)); |
|
|
|
|
Date start = null; |
|
|
|
|
Date end = null; |
|
|
|
|
|
|
|
|
|
_log.debug("Pratica " + pratica.getNumeroProgetto()); |
|
|
|
|
for (Avviso avviso : avvisi) { |
|
|
|
|
if (!avviso.isAnnullato()) { |
|
|
|
@ -800,139 +790,26 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
|
|
|
|
|
start = end = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// C'è uno stop ancora attivo
|
|
|
|
|
if (Validator.isNotNull(start)) { |
|
|
|
|
chiusura = start; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Long giorni = null; |
|
|
|
|
if (Validator.isNull(chiusura)) { |
|
|
|
|
giorni = SismicaUtil.daysPast(apertura); |
|
|
|
|
} else { |
|
|
|
|
giorni = SismicaUtil.daysBetween(apertura, chiusura); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return giorni - stop; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
* public long calculateDateAvvioProcedimentoOld(long controlloPraticaId) |
|
|
|
|
* throws SystemException, PortalException { |
|
|
|
|
* |
|
|
|
|
* long giorni = 0; |
|
|
|
|
* |
|
|
|
|
* ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
|
* .fetchControlloPratica(controlloPraticaId); |
|
|
|
|
* |
|
|
|
|
* Long intPraticaId = controlloPratica.getIntPraticaId(); |
|
|
|
|
* |
|
|
|
|
* List<Tempistica> tempisticaList = |
|
|
|
|
* TempisticaLocalServiceUtil.findByIntPratica_Tipo(intPraticaId, |
|
|
|
|
* TempisticaConstants.TIPO_PRATICA); |
|
|
|
|
* |
|
|
|
|
* if (tempisticaList != null && tempisticaList.size() > 0) { Tempistica |
|
|
|
|
* temp = null; |
|
|
|
|
* |
|
|
|
|
* for (Iterator iterator = tempisticaList.iterator(); iterator.hasNext();) |
|
|
|
|
* { Tempistica tempistica = (Tempistica) iterator.next(); if (temp == null |
|
|
|
|
* || temp.getCreateDate().before(tempistica.getCreateDate())) temp = |
|
|
|
|
* tempistica; } |
|
|
|
|
* |
|
|
|
|
* long giorniMillisecFormat = 0; if (temp.getStop() > 0) |
|
|
|
|
* giorniMillisecFormat = temp.getStop() - (temp.getStart() + |
|
|
|
|
* temp.getWait()); else if (temp.getStop() == 0) giorniMillisecFormat = |
|
|
|
|
* System.currentTimeMillis() - (temp.getStart() + temp.getWait()); |
|
|
|
|
* |
|
|
|
|
* giorni = TimeUnit.DAYS.convert(giorniMillisecFormat, |
|
|
|
|
* TimeUnit.MILLISECONDS); } |
|
|
|
|
* |
|
|
|
|
* return giorni; } |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* ADT: gestione workflow varianti |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param dettPraticaId |
|
|
|
|
* @throws Exception |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void gestioneWFVarianti(ControlloPratica cp) { |
|
|
|
|
try { |
|
|
|
|
/* |
|
|
|
|
* DettPratica |
|
|
|
|
* dettPratica=DettPraticaLocalServiceUtil.getDettPratica |
|
|
|
|
* (cp.getDettPraticaId()); |
|
|
|
|
* if(dettPratica.getTipoIntegrazione().equals |
|
|
|
|
* (TipoIntegrazioneUtil.VARIANTE)){ _log.info( |
|
|
|
|
* "gestioneWFVarianti - avviato workflow per variante dettPraticaId=" |
|
|
|
|
* +cp.getDettPraticaId()+" -ControlloPraticaId="+cp. |
|
|
|
|
* getControlloPraticaId()); IntPratica intPratica= |
|
|
|
|
* IntPraticaLocalServiceUtil.fetchIntPratica(cp.getIntPraticaId()); |
|
|
|
|
* long statusByuserId=intPratica.getStatusByUserId(); |
|
|
|
|
* _log.info("gestioneWFVarianti -statusByuserId=" |
|
|
|
|
* +statusByuserId+" per int pratica=" |
|
|
|
|
* +intPratica.getIntPraticaId()); //WorkflowInstanceLink
|
|
|
|
|
* workflowInstanceLink = |
|
|
|
|
* WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink( |
|
|
|
|
* // cp.getCompanyId(),cp.getGroupId(),
|
|
|
|
|
* ControlloPratica.class.getName(),cp.getPrimaryKey()); |
|
|
|
|
* //_log.info(
|
|
|
|
|
* "gestioneWFVarianti - workflowInstanceLink=="+workflowInstanceLink |
|
|
|
|
* .getWorkflowInstanceId()); if (statusByuserId==0){ |
|
|
|
|
* _log.info("gestioneWFVarianti - KO - statusByuserId=" |
|
|
|
|
* +statusByuserId); return; }else{ |
|
|
|
|
* _log.info("gestioneWFVarianti - statusByuserId determinato =" |
|
|
|
|
* +statusByuserId); } long workflowInstanceId = |
|
|
|
|
* WorkflowUtil.getWorkflowInstanceId(cp); |
|
|
|
|
* |
|
|
|
|
* //creazione record KaleoTaskInstanceToken di tipo ESITO
|
|
|
|
|
* ServiceContext serviceContext = new ServiceContext(); |
|
|
|
|
* serviceContext.setCompanyId(cp.getCompanyId()); KaleoInstance |
|
|
|
|
* kaleoInstance = |
|
|
|
|
* KaleoInstanceLocalServiceUtil.getKaleoInstance(workflowInstanceId |
|
|
|
|
* ); KaleoInstanceToken rootKaleoInstanceToken = |
|
|
|
|
* kaleoInstance.getRootKaleoInstanceToken(serviceContext); |
|
|
|
|
* _log.info("gestioneWFVarianti - rootKaleoInstanceToken="+ |
|
|
|
|
* rootKaleoInstanceToken.getCurrentKaleoNodeName()); long |
|
|
|
|
* kaleoTaskInstanceTokenID=CounterLocalServiceUtil.increment( |
|
|
|
|
* "com.liferay.counter.model.Counter"); |
|
|
|
|
* _log.info("kaleoTaskInstanceTokenID="+kaleoTaskInstanceTokenID); |
|
|
|
|
* KaleoTaskInstanceToken x = |
|
|
|
|
* KaleoTaskInstanceTokenLocalServiceUtil. |
|
|
|
|
* createKaleoTaskInstanceToken(kaleoTaskInstanceTokenID); |
|
|
|
|
* x.setKaleoTaskId(21642); x.setKaleoTaskName("Esito"); |
|
|
|
|
* x.setCompleted(false); x.setGroupId(cp.getGroupId()); |
|
|
|
|
* x.setClassName |
|
|
|
|
* ("it.tref.liferay.portos.bo.model.ControlloPratica"); |
|
|
|
|
* x.setClassPK(kaleoInstance.getClassPK()); |
|
|
|
|
* x.setCompanyId(kaleoInstance.getCompanyId()); |
|
|
|
|
* x.setUserId(kaleoInstance.getUserId()); |
|
|
|
|
* x.setUserName(kaleoInstance.getUserName()); x.setCreateDate(new |
|
|
|
|
* Date()); |
|
|
|
|
* x.setKaleoInstanceId(kaleoInstance.getKaleoInstanceId()); |
|
|
|
|
* x.setKaleoDefinitionId(kaleoInstance.getKaleoDefinitionId()); |
|
|
|
|
* x.setKaleoInstanceTokenId |
|
|
|
|
* (rootKaleoInstanceToken.getKaleoInstanceTokenId()); |
|
|
|
|
* x.setWorkflowContext(kaleoInstance.getWorkflowContext()); |
|
|
|
|
* x=KaleoTaskInstanceTokenLocalServiceUtil |
|
|
|
|
* .updateKaleoTaskInstanceToken(x); _log.info( |
|
|
|
|
* "gestioneWFVarianti - KaleoTaskInstanceToken di tipo ESITO creato - KaleoTaskInstanceTokenId = " |
|
|
|
|
* +x.getKaleoTaskInstanceTokenId()); _log.info( |
|
|
|
|
* "gestioneWFVarianti - correttamente eseguito - ControlloPraticaId = " |
|
|
|
|
* +cp.getControlloPraticaId()); |
|
|
|
|
* ////////////////////////////////////
|
|
|
|
|
* /////////////////////////////////
|
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* } |
|
|
|
|
*/ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
_log.error( |
|
|
|
|
"gestioneWFVarianti - Errore in gestioneWFVarianti - dettaPratiacaId=" |
|
|
|
|
+ cp.getDettPraticaId(), e); |
|
|
|
|
// throw e;
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|