Sfoglia il codice sorgente

aggiunta funzionalità per cancellazione ControlloPratica per Pratiche di tipologia C

develop
marcoalderighi 2 anni fa
parent
commit
18e1515b6d
  1. BIN
      liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar
  2. 2
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/build.xml
  3. BIN
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar
  4. 39
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java
  5. 16
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java
  6. 24
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

BIN
liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar vendored

File binario non mostrato.

2
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/build.xml

@ -2,6 +2,6 @@
<!DOCTYPE project> <!DOCTYPE project>
<project name="portos-advanced-operation-portlet" basedir="." default="deploy"> <project name="portos-advanced-operation-portlet" basedir="." default="deploy">
<property name="import.shared" value="portos-report-shared" /> <property name="import.shared" value="portos-report-shared,portos-bo-shared" />
<import file="../build-common-portlet.xml" /> <import file="../build-common-portlet.xml" />
</project> </project>

BIN
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar

File binario non mostrato.

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

@ -19,9 +19,11 @@ import java.util.Date;
import java.util.List; import java.util.List;
import it.nextmind.liferay.portos.advanced.operation.util.AdvancedOperationUtil; 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; import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.model.DocPratica; import it.tref.liferay.portos.bo.model.DocPratica;
import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.model.IntPratica;
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
@ -33,6 +35,25 @@ public class AdvancedOperationPortlet extends MVCPortlet {
private static final Log _log = LogFactoryUtil.getLog(AdvancedOperationPortlet.class); private static final Log _log = LogFactoryUtil.getLog(AdvancedOperationPortlet.class);
public void deleteControlloPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0L);
if (intPraticaId != 0L) {
List<ControlloPratica> controlloPraticaList =
ControlloPraticaLocalServiceUtil.findByIntPratica(intPraticaId);
for(ControlloPratica cp : controlloPraticaList){
_log.info("AdvancedOperationPortlet --- Deleting ControlloPratica " + cp.getControlloPraticaId() +
" of IntPraticaId " + intPraticaId);
ControlloPraticaLocalServiceUtil.deleteControlloPratica(cp);
}
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void reindexPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{ public void reindexPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest); _checkIfUserIsCompanyAdmin(actionRequest);
@ -41,10 +62,12 @@ public class AdvancedOperationPortlet extends MVCPortlet {
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0L); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0L);
if (intPraticaId != 0L) { if (intPraticaId != 0L) {
_log.info("AdvancedOperationPortlet --- Reindexing fascicolo of IntPraticaId " + intPraticaId);
IntPraticaLocalServiceUtil.reIndexFasciolo(intPraticaId, themeDisplay.getCompanyId()); IntPraticaLocalServiceUtil.reIndexFasciolo(intPraticaId, themeDisplay.getCompanyId());
} }
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
} }
public void cambiaDataInizioLavori(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{ public void cambiaDataInizioLavori(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest); _checkIfUserIsCompanyAdmin(actionRequest);
@ -53,7 +76,7 @@ public class AdvancedOperationPortlet extends MVCPortlet {
Date dataInizioLavoriOpera = ParamUtil.getDate(actionRequest, "dataInizioLavoriOperaInput", Date dataInizioLavoriOpera = ParamUtil.getDate(actionRequest, "dataInizioLavoriOperaInput",
DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd"), null); DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd"), null);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
_log.info("AdvancedOperationPortlet --- Changing DataInizioLavori on DettPraticas of IntPraticaId" + intPraticaId);
List<DettPratica> dettPraticaListWithInizioLavori = AdvancedOperationUtil.fetchDettPraticaListWithInizioLavori(intPratica); List<DettPratica> dettPraticaListWithInizioLavori = AdvancedOperationUtil.fetchDettPraticaListWithInizioLavori(intPratica);
for(DettPratica dettPratica : dettPraticaListWithInizioLavori){ for(DettPratica dettPratica : dettPraticaListWithInizioLavori){
dettPratica.setDataInizioLavoriOpera(dataInizioLavoriOpera); dettPratica.setDataInizioLavoriOpera(dataInizioLavoriOpera);
@ -71,6 +94,7 @@ public class AdvancedOperationPortlet extends MVCPortlet {
boolean normLavoriInProprioFlag = ParamUtil.getBoolean(actionRequest, "normLavoriInProprioFlag"); boolean normLavoriInProprioFlag = ParamUtil.getBoolean(actionRequest, "normLavoriInProprioFlag");
List<DettPratica> dettPraticaList = DettPraticaLocalServiceUtil.findByIntPraticaId(intPraticaId); List<DettPratica> dettPraticaList = DettPraticaLocalServiceUtil.findByIntPraticaId(intPraticaId);
_log.info("AdvancedOperationPortlet --- Fixing NormLavoriInProprio flag of IntPraticaId " + intPraticaId);
for(DettPratica dettPratica : dettPraticaList){ for(DettPratica dettPratica : dettPraticaList){
if(dettPratica.getNormLavoriInProprio() == normLavoriInProprioFlag){ if(dettPratica.getNormLavoriInProprio() == normLavoriInProprioFlag){
dettPratica.setNormLavoriInProprio(!normLavoriInProprioFlag); dettPratica.setNormLavoriInProprio(!normLavoriInProprioFlag);
@ -89,6 +113,7 @@ public class AdvancedOperationPortlet extends MVCPortlet {
boolean collaudoStaticoFlag = ParamUtil.getBoolean(actionRequest, "collaudoStaticoFlag"); boolean collaudoStaticoFlag = ParamUtil.getBoolean(actionRequest, "collaudoStaticoFlag");
List<DettPratica> dettPraticaList = DettPraticaLocalServiceUtil.findByIntPraticaId(intPraticaId); List<DettPratica> dettPraticaList = DettPraticaLocalServiceUtil.findByIntPraticaId(intPraticaId);
_log.info("AdvancedOperationPortlet --- Fixing CollaudoStatico flag of IntPraticaId " + intPraticaId);
for(DettPratica dettPratica : dettPraticaList){ for(DettPratica dettPratica : dettPraticaList){
if(dettPratica.getCollaudoStatico() == collaudoStaticoFlag){ if(dettPratica.getCollaudoStatico() == collaudoStaticoFlag){
dettPratica.setCollaudoStatico(!collaudoStaticoFlag); dettPratica.setCollaudoStatico(!collaudoStaticoFlag);
@ -107,10 +132,14 @@ public class AdvancedOperationPortlet extends MVCPortlet {
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
if(WorkflowConstants.STATUS_DRAFT == intPratica.getStatus()){ if(WorkflowConstants.STATUS_DRAFT == intPratica.getStatus()){
_log.info("AdvancedOperationPortlet --- Fixing StatusPratica (From DRAFT to PENDING) "
+ "of IntPraticaId " + intPraticaId);
intPratica.setStatus(WorkflowConstants.STATUS_PENDING); intPratica.setStatus(WorkflowConstants.STATUS_PENDING);
intPratica.setModifiedDate(new Date()); intPratica.setModifiedDate(new Date());
IntPraticaLocalServiceUtil.updateIntPratica(intPratica); IntPraticaLocalServiceUtil.updateIntPratica(intPratica);
} else { } else {
_log.info("AdvancedOperationPortlet --- Impossible operation: Fixing StatusPratica (From DRAFT to PENDING) "
+ "of IntPraticaId " + intPraticaId);
SessionErrors.add(actionRequest, "operazione-impossibile"); SessionErrors.add(actionRequest, "operazione-impossibile");
} }
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
@ -124,6 +153,8 @@ public class AdvancedOperationPortlet extends MVCPortlet {
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
if(WorkflowConstants.STATUS_INCOMPLETE == intPratica.getStatus()){ if(WorkflowConstants.STATUS_INCOMPLETE == intPratica.getStatus()){
_log.info("AdvancedOperationPortlet --- Recovering Pratica Vidimata (INCOMPLETE ==> DRAFT) "
+ "with IntPraticaId " + intPraticaId);
_ripristinaPratica(intPratica, WorkflowConstants.STATUS_DRAFT); _ripristinaPratica(intPratica, WorkflowConstants.STATUS_DRAFT);
} else { } else {
SessionErrors.add(actionRequest, "operazione-impossibile"); SessionErrors.add(actionRequest, "operazione-impossibile");
@ -140,6 +171,8 @@ public class AdvancedOperationPortlet extends MVCPortlet {
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
if(WorkflowConstants.STATUS_INCOMPLETE == intPratica.getStatus()){ if(WorkflowConstants.STATUS_INCOMPLETE == intPratica.getStatus()){
_log.info("AdvancedOperationPortlet --- Recovering Pratica Vidimata (INCOMPLETE ==> APPROVED) "
+ "with IntPraticaId " + intPraticaId);
_ripristinaPratica(intPratica, WorkflowConstants.STATUS_APPROVED); _ripristinaPratica(intPratica, WorkflowConstants.STATUS_APPROVED);
} else { } else {
SessionErrors.add(actionRequest, "operazione-impossibile"); SessionErrors.add(actionRequest, "operazione-impossibile");
@ -155,7 +188,11 @@ public class AdvancedOperationPortlet extends MVCPortlet {
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
List<DocPratica> docPraticaOrfani = AdvancedOperationUtil.getDocPraticaOrfani(intPraticaId); List<DocPratica> docPraticaOrfani = AdvancedOperationUtil.getDocPraticaOrfani(intPraticaId);
_log.info("AdvancedOperationPortlet --- Deleting Documenti Orfani "
+ "of IntPraticaId " + intPraticaId);
for(DocPratica docPratica : docPraticaOrfani){ for(DocPratica docPratica : docPraticaOrfani){
_log.info("AdvancedOperationPortlet --- Deleting Documento Orfan " + docPratica.getDocPraticaId()
+ " of IntPraticaId " + intPraticaId);
DocPraticaLocalServiceUtil.deleteDocPratica(docPratica); DocPraticaLocalServiceUtil.deleteDocPratica(docPratica);
} }
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));

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

@ -21,13 +21,29 @@ import it.tref.liferay.portos.bo.model.IntPratica;
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.shared.util.Constants;
import java.io.Console;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
public class AdvancedOperationUtil { public class AdvancedOperationUtil {
public static boolean hasControlloPratica_ProceduraC(IntPratica intPratica){
if(Constants.PROCEDURA_C.equalsIgnoreCase(intPratica.getTipoProcedura())){
try{
long intPraticaId = intPratica.getIntPraticaId();
List<ControlloPratica> controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPraticaId);
return !controlloPraticas.isEmpty();
} catch (SystemException e){
_log.error(e,e);
return false;
}
}
return false;
}
public static List<WorkflowTask> getListaTask(IntPratica intPratica) { public static List<WorkflowTask> getListaTask(IntPratica intPratica) {
if(Validator.isNull(intPratica)){ if(Validator.isNull(intPratica)){
return null; return null;

24
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

@ -242,6 +242,30 @@
</div> </div>
<% } %> <% } %>
<% if(AdvancedOperationUtil.hasControlloPratica_ProceduraC(intPratica)){ %>
<div style="margin-right: 50px;">
<liferay-portlet:actionURL
name="deleteControlloPratica"
var="deleteControlloPraticaURL" >
<liferay-portlet:param name="intPraticaId" value="<%= String.valueOf(intPraticaId) %>"/>
<liferay-portlet:param name="mvcPath" value="/html/view.jsp"/>
</liferay-portlet:actionURL>
<%
String functionControlloPratica = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"deleteControlloPratica','Sei sicuro di voler eliminare questo ControlloPratica ed il relativo WorkFlow?')";
%>
<aui:form action="<%= deleteControlloPraticaURL %>" method="post" name="deleteControlloPratica">
<aui:button
type="button"
cssClass="btn-primary"
name="deleteControlloPraticaBtn"
onClick='<%= functionControlloPratica %>'
value="Elimina WorkFlow"
>
</aui:button>
</aui:form>
</div>
<% } %>
<% if(AdvancedOperationUtil.isPraticaAnnullata(intPratica)){ %> <% if(AdvancedOperationUtil.isPraticaAnnullata(intPratica)){ %>
<div style="margin-right: 50px;"> <div style="margin-right: 50px;">
<liferay-portlet:actionURL <liferay-portlet:actionURL

Caricamento…
Annulla
Salva