Sfoglia il codice sorgente

fixes funzionalità di eliminazione controlloPratica

develop
marcoalderighi 2 anni fa
parent
commit
f9892c9527
  1. 20
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java
  2. 13
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java

20
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java

@ -10,14 +10,10 @@ import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import java.util.Date;
import java.util.List;
import it.nextmind.liferay.portos.advanced.operation.util.AdvancedOperationUtil;
import it.tref.liferay.portos.bo.model.ControlloPratica;
import it.tref.liferay.portos.bo.model.DettPratica;
@ -28,6 +24,10 @@ import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
@ -39,16 +39,16 @@ public class AdvancedOperationPortlet extends MVCPortlet {
_checkIfUserIsCompanyAdmin(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0L);
if (intPraticaId != 0L) {
List<ControlloPratica> controlloPraticaList =
ControlloPraticaLocalServiceUtil.findByIntPraticaId_Status(intPraticaId, WorkflowConstants.STATUS_APPROVED);
ControlloPraticaLocalServiceUtil.findByIntPratica(intPraticaId);
for(ControlloPratica cp : controlloPraticaList){
_log.info("AdvancedOperationPortlet --- Deleting ControlloPratica " + cp.getControlloPraticaId() +
" of IntPraticaId " + intPraticaId);
ControlloPraticaLocalServiceUtil.deleteControlloPratica(cp);
if(Arrays.asList(AdvancedOperationUtil.STATUS_ARRAY).contains(cp.getStatus())){
_log.info("AdvancedOperationPortlet --- Deleting ControlloPratica " + cp.getControlloPraticaId() +
" with Status " + cp.getStatus() +" of IntPraticaId " + intPraticaId);
ControlloPraticaLocalServiceUtil.deleteControlloPratica(cp);
}
}
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));

13
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java

@ -30,6 +30,9 @@ import java.util.List;
public class AdvancedOperationUtil {
public static final int[] STATUS_ARRAY =
{WorkflowConstants.STATUS_DRAFT, WorkflowConstants.STATUS_INACTIVE, WorkflowConstants.STATUS_PENDING};
public static boolean isNotWorkflowManuallyStarted(IntPratica intPratica){
switch (intPratica.getStatoPratica()) {
case StatoPraticaConstants.VIDIMATA :
@ -45,9 +48,13 @@ public class AdvancedOperationUtil {
if(Constants.PROCEDURA_C.equalsIgnoreCase(intPratica.getTipoProcedura())){
try{
long intPraticaId = intPratica.getIntPraticaId();
List<ControlloPratica> controlloPraticas =
ControlloPraticaLocalServiceUtil.findByIntPraticaId_Status(intPraticaId, WorkflowConstants.STATUS_APPROVED);
return !controlloPraticas.isEmpty();
for(int i : STATUS_ARRAY){
List<ControlloPratica> controlloPraticas =
ControlloPraticaLocalServiceUtil.findByIntPraticaId_Status(intPraticaId, i);
if(!controlloPraticas.isEmpty()){
return true;
}
}
} catch (SystemException e){
_log.error(e,e);
return false;

Caricamento…
Annulla
Salva