Sfoglia il codice sorgente

Upload file sanzione per sanatorie

master
Salvatore La Manna 4 anni fa
parent
commit
1658cade65
  1. 1
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/.tern-project
  2. 246
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp
  3. 6
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_fe/richiedi-atto.jsp
  4. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPratica.java
  5. 19
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaClp.java
  6. 5
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaWrapper.java
  7. 191
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/startup/DatabaseUpdateAction.java
  8. 7
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/IntPraticaImpl.java
  9. 5
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/listener/KaleoInstanceTokenModelListener.java
  10. 3
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java
  11. 3
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaIstruttorePortlet.java
  12. 53
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java
  13. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/report/builder/builder/ReportAvvisoBeanBuilder.java
  14. 119
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java
  15. 33
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java
  16. 3
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portal.properties
  17. 5
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/portlet.properties
  18. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  19. 9
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp
  20. 5
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/actions/action_allega_sanzione.jsp
  21. 2
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/domanda/page_dettagli_principali.jsp
  22. 17
      liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java
  23. 279
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/scheduler/SchedulerKaleoController.java
  24. 26
      liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java
  25. 24
      liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/KaleoInstanceLocalServiceImpl.java
  26. 182
      liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java
  27. 279
      liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java
  28. 317
      liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java
  29. 132
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java
  30. 4
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties
  31. 2
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java
  32. 44
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp
  33. 1
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java
  34. 1
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/RenderFormTaskPortletAction.java

1
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/.tern-project

@ -0,0 +1 @@
{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]}

246
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp

@ -1,80 +1,74 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="init.jsp" %>
<div style="width:30%;">
<div style="width: 30%">
<liferay-ui:error key="atto-non-esistente" message="Nessun atto trovato per questo numero progetto" />
</div>
<liferay-portlet:actionURL name="aggiungiRichiestaBO" var="aggiungiRichiestaBOURL">
<liferay-portlet:param name="tabs1" value="Aggiungi Richiesta" />
</liferay-portlet:actionURL>
<aui:form name="fmDomande" action="<%=aggiungiRichiestaBOURL %>" method="POST" enctype="multipart/form-data" >
<div class="row-fluid" style="margin-top: 10px;">
<aui:form name="fmDomande" action="<%= aggiungiRichiestaBOURL %>" method="POST" enctype="multipart/form-data">
<div class="row-fluid" style="margin-top: 10px">
<div class="span3">
<aui:input name="emailRicontatto" label="Email per il ricontatto">
<aui:validator name="required" />
<aui:validator name="email"/>
<aui:validator name="email" />
</aui:input>
</div>
<div class="span3">
<aui:input name="codiceFiscale" label="Codice Fiscale Utente" max="16" min="16">
<aui:validator name="custom" errorMessage="campo-richiesto" >
function (val, fieldNode, ruleValue) {
return fieldNode.get('disabled') || (val != null && val!='');
<aui:validator name="custom" errorMessage="campo-richiesto">
function (val, fieldNode, ruleValue) {
return fieldNode.get('disabled') || (val != null && val != '');
}
</aui:validator>
<aui:validator name="custom" errorMessage="campo-non-valido">
function (val, fieldNode, ruleValue) {
if (fieldNode.get('disabled')) {
return true;
}
</aui:validator>
<aui:validator name="custom" errorMessage="campo-non-valido" >
function (val, fieldNode, ruleValue) {
if(fieldNode.get('disabled')){
return true;
}
var regex = '^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$';
var regex1 = /^(?:[B-DF-HJ-NP-TV-Z](?:[AEIOU]{2}|[AEIOU]X)|[AEIOU]{2}X|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[1256LMRS][\dLMNP-V])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[\dLMNP-V][1-9MNP-V]|[1-9MNP-V][0L]))[A-Z]$/i;
var regexObj = new RegExp (regex1);
var result = regexObj.test(val);
return result;
}
</aui:validator>
</aui:input>
var regex = '^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$';
var regex1 = /^(?:[B-DF-HJ-NP-TV-Z](?:[AEIOU]{2}|[AEIOU]X)|[AEIOU]{2}X|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[1256LMRS][\dLMNP-V])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[\dLMNP-V][1-9MNP-V]|[1-9MNP-V][0L]))[A-Z]$/i;
var regexObj = new RegExp (regex1);
var result = regexObj.test(val);
return result;
}
</aui:validator>
</aui:input>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px;">
<div class="row-fluid" style="margin-top: 10px">
<div class="span3">
<aui:input name="numeroProgetto" label="Numero Progetto" style="width:50%;">
<aui:input name="numeroProgetto" label="Numero Progetto" style="width: 50%">
<aui:validator name="required" />
<aui:validator name="digits" />
</aui:input>
</div>
<div class="span3">
<aui:input name="dataVidimazione" cssClass="calendarDatepicker" label="Data di vidimazione" style="width:50%;">
<aui:input name="dataVidimazione" cssClass="calendarDatepicker" label="Data di vidimazione"
style="width: 50%">
<aui:validator name="required" />
</aui:input>
</div>
<div class="span3">
<div style="margin-top: 7%;">
<div style="margin-top: 7%">
<aui:input name="sanatoria" type="checkbox" label="Trattasi di Sanatoria" />
</div>
</div>
<div class="span3">
<div style="margin-top: 7%;">
<aui:input name="dataSanatoria" cssClass="calendarDatepicker" label="Data Sanatoria" style="width:50%;" >
<div style="margin-top: 7%">
<aui:input name="dataSanatoria" cssClass="calendarDatepicker" label="Data Sanatoria"
style="width: 50%" >
<aui:validator name="custom" errorMessage="campo-richiesto" >
function (val, fieldNode, ruleValue) {
var A = AUI();
var checkValue = true;
var checkValue = true;
var portletNamespace = '<portlet:namespace/>';
var sanatorie = A.one("#"+portletNamespace + "sanatoria").val();
if(sanatorie == "true"){
if(val == ""){
var sanatorie = A.one("#" + portletNamespace + "sanatoria").val();
if (sanatorie == "true") {
if (val == "") {
checkValue = false;
}
}
return checkValue;
}
</aui:validator>
@ -82,100 +76,97 @@
</div>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px;">
<div class="row-fluid" style="margin-top: 10px">
<div class="span12">
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold;">Tipologia Soggetto</div>
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold">Tipologia Soggetto</div>
<div>
<aui:input checked="true" inlineField="true" inlineLabel="right" name="qualitaPersona" value="committente" type="radio" label="Proprietario/committente" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="progettista" type="radio" label="Progettista/collaudatore" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="impresa" type="radio" label="Impresa" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="autorita" type="radio" label="Autorità giudiziaria/CTU" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="confinanti" type="radio" label="Confinante/vicini" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="ctp" type="radio" label="CTP" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="altriSoggetti" type="radio" label="Altro soggetto" />
<aui:input checked="true" inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="committente" label="Proprietario/committente" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="progettista" label="Progettista/collaudatore" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="impresa" label="Impresa" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="autorita" label="Autorità giudiziaria/CTU" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="confinanti" label="Confinante/vicini" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="ctp" label="CTP" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="altriSoggetti" label="Altro soggetto" />
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span3">
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold;">Tipologia Richiesta</div>
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold">Tipologia Richiesta</div>
<div>
<aui:input cssClass="visione" checked="true" inlineField="true" inlineLabel="right" name="visione" value="visione" type="radio" label="Prendere visione" onClick="hideDettaglio();" />
<aui:input cssClass="visione" inlineField="true" inlineLabel="right" name="visione" value="copia" type="radio" label="Estrarre copia" onClick="showDettaglio();" />
<aui:input cssClass="visione" checked="true" inlineField="true" inlineLabel="right" name="visione"
value="visione" type="radio" label="Prendere visione" onClick="hideDettaglio();" />
<aui:input cssClass="visione" inlineField="true" inlineLabel="right" name="visione" value="copia"
type="radio" label="Estrarre copia" onClick="showDettaglio();" />
</div>
</div>
<div class="span4" id="optionContainerCopia" style="display:none;">
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold;">&nbsp;</div>
<div class="span4" id="optionContainerCopia" style="display: none">
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold">&nbsp;</div>
<div>
<aui:input checked="true" inlineField="true" inlineLabel="right" name="copiaDett" value="semplice" type="radio" label="Semplice"/>
<aui:input inlineField="true" inlineLabel="right" name="copiaDett" value="autentica" type="radio" label="Autentica (da assoggettare ad imposta di bollo)" />
<aui:input checked="true" inlineField="true" inlineLabel="right" name="copiaDett" value="semplice"
type="radio" label="Semplice"/>
<aui:input inlineField="true" inlineLabel="right" name="copiaDett" value="autentica" type="radio"
label="Autentica (da assoggettare ad imposta di bollo)" />
</div>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px;">
<div class="row-fluid" style="margin-top: 10px">
<div class="span12">
<aui:input name="motivazione" type="textarea" label="Motivazione della richiesta" />
</div>
</div>
<div class="row-fluid" style="margin-top: 10px;">
<div class="row-fluid" style="margin-top: 10px">
<div class="span12">
<aui:input name="documentoIdentita" type="file" label="Documento d'identità" >
<aui:input name="documentoIdentita" type="file" label="Documento d'identità" >
<aui:validator name="required" />
</aui:input>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px;">
<div class="row-fluid" style="margin-top: 10px">
<div class="span12">
<aui:input name="allegatoPagamento" type="file" label="Allegato pagamento" >
<aui:validator name="custom" errorMessage="campo-richiesto" >
function (val, fieldNode, ruleValue) {
var A = AUI();
var checkValue = true;
var portletNamespace = '<portlet:namespace/>';
var dataVidimazione = A.one("#"+portletNamespace + "dataVidimazione").val();
var sanatorie = A.one("#"+portletNamespace + "sanatoria").val();
if(sanatorie == "true"){
checkValue = false;
}
if(dataVidimazione != ""){
var checkDateFixed = "01/01/2015";
var checkDateFixed = new Date(checkDateFixed);
var vidimazioneDate = new Date(dataVidimazione);
if(vidimazioneDate <= checkDateFixed){
checkValue = false;
}
}
if(!checkValue){
if(val != ""){
return true;
}
}
return checkValue;
var A = AUI();
var checkValue = true;
var portletNamespace = '<portlet:namespace/>';
var dataVidimazione = A.one("#" + portletNamespace + "dataVidimazione").val();
var sanatorie = A.one("#"+portletNamespace + "sanatoria").val();
if (sanatorie == "true") {
checkValue = false;
}
if (dataVidimazione != "") {
var checkDateFixed = "01/01/2015";
var checkDateFixed = new Date(checkDateFixed);
var vidimazioneDate = new Date(dataVidimazione);
if (vidimazioneDate <= checkDateFixed) {
checkValue = false;
}
}
if (!checkValue) {
if (val != "") {
return true;
}
}
return checkValue;
}
</aui:validator>
</aui:input>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px;">
<div class="row-fluid" style="margin-top: 10px">
<div class="span12">
<aui:button type="submit" value="Richiedi Atto" />
</div>
</div>
</aui:form>
<script type="text/javascript">
function hideDettaglio(){
AUI().one('#optionContainerCopia').hide();
@ -184,42 +175,29 @@ function hideDettaglio(){
function showDettaglio(){
AUI().one('#optionContainerCopia').show();
}
</script>
<aui:script use="aui-base">
YUI().use(
'aui-datepicker',
function(Y) {
var datepicker = new Y.DatePicker(
{
trigger: '.calendarDatepicker',
calendar: {
dateFormat: 'dd/MM/yyyy',
},
mask: '%d/%m/%Y',
popover: {
toolbars: {
header: [[
{
icon: 'icon-trash',
label: Liferay.Language.get("Cancella"),
on: {
click: function() {
datepicker.clearSelection();
}
}
}
]]
},
zIndex: 1
}
}
);
}
);
</aui:script>
YUI().use('aui-datepicker', function(Y) {
var datepicker = new Y.DatePicker({
trigger: '.calendarDatepicker',
calendar: {
dateFormat: 'dd/MM/yyyy',
},
mask: '%d/%m/%Y',
popover: {
toolbars: {
header: [[{
icon: 'icon-trash',
label: Liferay.Language.get("Cancella"),
on: {
click: function() {
datepicker.clearSelection();
}
}
}]]
},
zIndex: 1
}
});
});
</aui:script>

6
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_fe/richiedi-atto.jsp

@ -73,7 +73,7 @@ boolean isNoCNSUser = UserLocalServiceUtil.hasRoleUser(roleNoCNS.getRoleId(), th
<aui:input checked="true" inlineField="true" inlineLabel="right" name="qualitaPersona" value="committente" type="radio" label="Proprietario/committente" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="progettista" type="radio" label="Progettista/collaudatore" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="impresa" type="radio" label="Impresa" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="autorita" type="radio" label="Autorità giudiziaria/CTU" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="autorita" type="radio" label="Autorità giudiziaria/CTU" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="confinanti" type="radio" label="Confinante/vicini" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="ctp" type="radio" label="CTP" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="altriSoggetti" type="radio" label="Altro soggetto" />
@ -104,14 +104,14 @@ boolean isNoCNSUser = UserLocalServiceUtil.hasRoleUser(roleNoCNS.getRoleId(), th
<c:if test="<%=isNoCNSUser %>">
<div class="row-fluid" style="margin-top: 10px;">
<div class="span12">
<aui:input name="documentoIdentita" type="file" label="Documento d'identità" >
<aui:input name="documentoIdentita" type="file" label="Documento d'identità">
<aui:validator name="required" />
</aui:input>
</div>
</div>
</c:if>
<div class="row-fluid" style="margin-top: 10px;">
<div class="row-fluid" style="margin-top: 10px">
<div class="span12">
<aui:input name="allegatoPagamento" type="file" label="Allegato pagamento" >
<aui:validator name="custom" errorMessage="campo-richiesto" >

2
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPratica.java

@ -39,4 +39,6 @@ public interface IntPratica extends IntPraticaModel, PersistedModel {
public boolean isChiusa()
throws com.liferay.portal.kernel.exception.SystemException;
public boolean isSanatoria();
}

19
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaClp.java

@ -1167,6 +1167,25 @@ public class IntPraticaClp extends BaseModelImpl<IntPratica>
}
}
@Override
public boolean isSanatoria() {
try {
String methodName = "isSanatoria";
Class<?>[] parameterTypes = new Class<?>[] { };
Object[] parameterValues = new Object[] { };
Boolean returnObj = (Boolean)invokeOnRemoteModel(methodName,
parameterTypes, parameterValues);
return returnObj;
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
@Override
public StagedModelType getStagedModelType() {
return new StagedModelType(PortalUtil.getClassNameId(

5
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/model/IntPraticaWrapper.java

@ -1162,6 +1162,11 @@ public class IntPraticaWrapper implements IntPratica, ModelWrapper<IntPratica> {
return _intPratica.isChiusa();
}
@Override
public boolean isSanatoria() {
return _intPratica.isSanatoria();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {

191
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/startup/DatabaseUpdateAction.java

@ -1,191 +0,0 @@
package it.mwg.sismica.bo.startup;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.liferay.portal.kernel.dao.jdbc.DataAccess;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
public class DatabaseUpdateAction extends SimpleAction {
private static final Log _log = LogFactoryUtil.getLog(DatabaseUpdateAction.class.getName());
private Connection connection;
@Override
public void run(String[] ids) throws ActionException {
try {
connection = DataAccess.getUpgradeOptimizedConnection();
Statement s = connection.createStatement();
if (!hasColumn("portos_bo_intpratica", "tipoprocedura")) {
_log.info("Aggiornamento a v2 di portos_bo_intpratica");
s.executeUpdate("ALTER TABLE portos_bo_intpratica ADD COLUMN tipoprocedura VARCHAR(75) NULL");
}
if (!hasColumn("portos_bo_dettpratica", "georischiogeomorfologicopai")) {
String[] columns = new String[] { "geoclasseindagine", "geopericolositageologica",
"geopericolositageomorfica", "geopericolositasismica", "geofattibilitasismica",
"geopericolositaidraulica", "geofattibilitaidraulica", "geofattibilitageologica" };
for (String column : columns) {
int righe = s.executeUpdate("UPDATE portos_bo_dettpratica SET " + column + "='NA' "
+ "WHERE " + column + "='0'");
if (righe > 0) {
_log.info("Aggiornate " + righe + " righe in portos_bo_dettpratica, colonna "
+ column);
}
}
_log.info("Aggiornamento a v2 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica "
+ "ADD COLUMN georischiogeomorfologicopai VARCHAR(75) NULL,"
+ "ADD COLUMN geopericolositaidraulicapai VARCHAR(75) NULL,"
+ "ADD COLUMN georischioidraulicopai VARCHAR(75) NULL");
}
if (!hasColumn("portos_bo_dettpratica", "tcnuovacostruzionecomplessa")) {
_log.info("Aggiornamento a v4 di portos_bo_dettpratica");
int righe = s
.executeUpdate("UPDATE portos_bo_dettpratica SET destinazione='2' WHERE destinazione='1'");
if (righe > 0) {
_log.info("Aggiornate " + righe + " righe in portos_bo_dettpratica, colonna destinazione");
}
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcnuovacostruzionecomplessa BOOL NULL");
}
if (!hasColumn("portos_bo_dettpratica", "tccostruzioniesistenti")) {
_log.info("Aggiornamento a v5 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tccostruzioniesistenti BOOL NULL");
}
if (!hasColumn("portos_bo_dettpratica", "paesaggiolocale")) {
_log.info("Aggiornamento a v6 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN paesaggiolocale TEXT NULL");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN livelloditutela TEXT NULL");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN vincoli TEXT NULL");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcmanutordstraord BOOL NULL");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcaltriinterventi BOOL NULL");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcaltriinterventidesc TEXT NULL");
}
if (!hasColumn("portos_bo_dettpratica", "tcaltriinterventi")) {
_log.info("Aggiornamento a v7 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcaltriinterventi BOOL NULL");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcaltriinterventidesc TEXT NULL");
}
if (!hasColumn("portos_bo_dettpratica", "destinazionealtrointervento")) {
_log.info("Aggiornamento a v8 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN destinazionealtrointervento TEXT NULL");
}
if (!hasColumn("portos_bo_dettpratica", "codicefiscaleprincipalearcheologo")) {
_log.info("Aggiornamento a v9 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN codicefiscaleprincipalearcheologo VARCHAR(75) NULL");
}
if (!hasColumn("portos_bo_territorio", "articolo61")) {
_log.info("Aggiornamento a v2 di portos_bo_territorio");
s.executeUpdate("ALTER TABLE portos_bo_territorio ADD COLUMN articolo61 BOOL");
}
if (!hasColumn("portos_bo_asseverazione", "dichiarazioni")) {
_log.info("Aggiornamento a v2 di portos_bo_asseverazione");
s.executeUpdate("ALTER TABLE portos_bo_asseverazione ADD COLUMN dichiarazioni TEXT NULL");
}
if (!hasColumn("portos_bo_delega", "dichiarazioni")) {
_log.info("Aggiornamento a v2 di portos_bo_delega");
s.executeUpdate("ALTER TABLE portos_bo_delega ADD COLUMN dichiarazioni TEXT NULL");
}
if (!hasColumn("portos_bo_dettpratica", "nocollaudo")) {
_log.info("Aggiornamento a v8 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN nocollaudo BOOL NULL");
}
if (!hasColumn("portos_bo_dettpratica", "tcnuovacostruzionepertinenza")) {
_log.info("Aggiornamento a v8 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcnuovacostruzionepertinenza BOOL NULL");
}
if (!hasColumn("portos_bo_dettpratica", "tcinterventoopereescavazione")) {
_log.info("Aggiornamento a v8 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcinterventoopereescavazione BOOL NULL");
}
if (!hasColumn("portos_bo_dettpratica", "tcviarch")) {
_log.info("Aggiornamento a v8 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcviarch BOOL NULL");
}
if (!hasColumn("portos_bo_dettpratica", "tcoperaa25")) {
_log.info("Aggiornamento a v8 di portos_bo_dettpratica");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN tcoperaa25 BOOL NULL");
}
if (!hasColumn("portos_bo_soggetto", "tipoaltrosoggetto")) {
s.executeUpdate("ALTER TABLE portos_bo_soggetto ADD COLUMN tipoaltrosoggetto TEXT NULL");
}
if (!hasColumn("portos_bo_dettpratica", "pagSoggettiAdAutorizzazione")) {
s.executeUpdate("ALTER TABLE portos_bo_dettpratica "
+ "ADD COLUMN pagsoggettiadautorizzazione DOUBLE NULL,"
+ "ADD COLUMN paginterventirestauromanufatti DOUBLE NULL,"
+ "ADD COLUMN pagaltricasiculturali DOUBLE NULL,"
+ "ADD COLUMN paglottizzazioni DOUBLE NULL,"
+ "ADD COLUMN paggrandistrutture DOUBLE NULL,"
+ "ADD COLUMN pagcondotte DOUBLE NULL,"
+ "ADD COLUMN pagpalificazioni DOUBLE NULL,"
+ "ADD COLUMN pagimpiantieolici DOUBLE NULL,"
+ "ADD COLUMN pagnuoverealizzazioni DOUBLE NULL,"
+ "ADD COLUMN pagimmobilipreesistenti DOUBLE NULL,"
+ "ADD COLUMN pagmanifestipubblicitari DOUBLE NULL,"
+ "ADD COLUMN pagpareridimassima DOUBLE NULL,"
+ "ADD COLUMN pagaltricasipaesaggistici DOUBLE NULL,"
+ "ADD COLUMN pagvariantipareriresi DOUBLE NULL,"
+ "ADD COLUMN pagrilascioattestazioni DOUBLE NULL,"
+ "ADD COLUMN pagconsultazioniarchivio DOUBLE NULL");
}
if (!hasColumn("portos_bo_pagamento", "numerobollettino")) {
s.executeUpdate("ALTER TABLE portos_bo_pagamento ADD COLUMN numerobollettino VARCHAR(75) NULL");
}
if (!hasColumn("portos_bo_dettpratica", "sanatoriaedilizia47")) {
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN sanatoriaedilizia47 BOOL NULL");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN sanatoriaedilizia724 BOOL NULL");
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN sanatoriaedilizia326 BOOL NULL");
}
if (!hasColumn("portos_bo_dettpratica", "normlavorinodirettore")) {
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN normlavorinodirettore BOOL NULL");
}
if (!hasColumn("portos_bo_dettpratica", "interventovocep7")) {
s.executeUpdate("ALTER TABLE portos_bo_dettpratica ADD COLUMN interventovocep7 VARCHAR(20) NULL");
}
} catch (SQLException e) {
_log.error("Errore di accesso al database: ", e);
throw new ActionException(e);
}
}
private boolean hasColumn(String table, String column) {
boolean result = true;
ResultSet rs = null;
try {
Statement s = connection.createStatement();
rs = s.executeQuery("SELECT " + column + " FROM " + table + " WHERE false");
rs.getMetaData().getColumnName(1);
} catch (SQLException e) {
result = false;
}
return result;
}
}

7
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/impl/IntPraticaImpl.java

@ -14,6 +14,7 @@ package it.tref.liferay.portos.bo.model.impl;
import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.shared.util.Constants;
import java.util.Locale;
@ -91,4 +92,10 @@ public class IntPraticaImpl extends IntPraticaBaseImpl {
}
return completata;
}
@Override
public boolean isSanatoria() {
return getTipoProcedura().equalsIgnoreCase(Constants.PROCEDURA_P8)
|| getTipoProcedura().equalsIgnoreCase(Constants.PROCEDURA_P9);
}
}

5
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/model/listener/KaleoInstanceTokenModelListener.java

@ -67,6 +67,7 @@ public class KaleoInstanceTokenModelListener extends BaseModelListener<KaleoInst
private void gestioneWFVarianti(ControlloPratica cp, KaleoInstanceToken model) {
_log.info("GestioneWFVarianti(" + cp.getControlloPraticaId() + ", " + model.getKaleoInstanceTokenId());
try {
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(cp.getDettPraticaId());
if (dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIANTE)) {
@ -77,10 +78,10 @@ public class KaleoInstanceTokenModelListener extends BaseModelListener<KaleoInst
_log.info("gestioneWFVarianti -statusByuserId=" + statusByuserId + " per int pratica="
+ intPratica.getIntPraticaId());
if (statusByuserId == 0) {
_log.info("gestioneWFVarianti - KO - statusByuserId=" + statusByuserId);
_log.info("gestioneWFVarianti - KO - statusByuserId = 0");
return;
} else {
_log.info("gestioneWFVarianti - statusByuserId determinato =" + statusByuserId);
_log.info("gestioneWFVarianti - statusByuserId determinato = " + statusByuserId);
}
long kaleoTaskInstanceTokenID = CounterLocalServiceUtil.increment("com.liferay.counter.model.Counter");
_log.info("kaleoTaskInstanceTokenID=" + kaleoTaskInstanceTokenID);

3
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java

@ -49,6 +49,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.liferay.counter.service.CounterLocalServiceUtil;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.json.JSONArray;
@ -423,7 +424,7 @@ public class FascicoloPortlet extends MVCPortlet {
HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest);
StringBuilder sb = new StringBuilder();
List<IntPratica> lista = new ArrayList<IntPratica>();
Hits hits = IntPraticaAdvancedSearch.searchProgettiBO(httpRequest, user, -1, -1);
Hits hits = IntPraticaAdvancedSearch.searchProgettiBO(httpRequest, user, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
for (Document doc : hits.toList()) {
String intPraticaId = doc.get("intPraticaId");
try {

3
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaIstruttorePortlet.java

@ -32,6 +32,7 @@ import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;
import javax.servlet.http.HttpServletRequest;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.json.JSONArray;
@ -155,7 +156,7 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
List<Soggetto> collaudatori = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
pratica.getIntPraticaId(), TipoSoggettoUtil.COLLAUDATORE);
List<FineLavori> fineLavoriList = FineLavoriLocalServiceUtil.findByIntPraticaId(
pratica.getIntPraticaId(), -1, -1, null);
pratica.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
boolean compleatata = false;
for (FineLavori fineLavori : fineLavoriList) {
if (fineLavori.isCompletata() && !fineLavori.isParziale()) {

53
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java

@ -1,13 +1,17 @@
package it.tref.liferay.portos.bo.portlet;
import it.tref.liferay.portos.bo.model.Avviso;
import it.tref.liferay.portos.bo.model.Comune;
import it.tref.liferay.portos.bo.model.ControlloPratica;
import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.model.IntPratica;
import it.tref.liferay.portos.bo.model.ParereGeologo;
import it.tref.liferay.portos.bo.model.Provincia;
import it.tref.liferay.portos.bo.model.Territorio;
import it.tref.liferay.portos.bo.search.ControlloPraticaAdvancedSearch;
import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ComuneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaServiceUtil;
@ -17,11 +21,14 @@ import it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil;
import it.tref.liferay.portos.bo.service.permission.IntPraticaPermission;
import it.tref.liferay.portos.bo.shared.util.ActionKeys;
import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants;
import it.tref.liferay.portos.bo.shared.util.Constants;
import it.tref.liferay.portos.bo.util.AvvisoUtil;
import it.tref.liferay.portos.bo.util.MailUtil;
import it.tref.liferay.portos.bo.util.PraticaUtil;
import it.tref.liferay.portos.bo.util.WorkflowUtil;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -47,13 +54,18 @@ import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.language.LanguageUtil;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.repository.model.Folder;
import com.liferay.portal.kernel.search.Document;
import com.liferay.portal.kernel.search.Hits;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.servlet.SessionErrors;
import com.liferay.portal.kernel.upload.UploadPortletRequest;
import com.liferay.portal.kernel.util.CSVUtil;
import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.MimeTypesUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
@ -73,6 +85,8 @@ import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil;
import com.liferay.portlet.documentlibrary.NoSuchFolderException;
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
public class GestioneAttivitaPortlet extends MVCPortlet {
@ -233,8 +247,45 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
}
}
public void allegaSanzione(ActionRequest actionRequest, ActionResponse actionResponse) {
public void allegaSanzione(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException,
PortalException, SystemException {
String fileParam = "fileSanzione";
Date now = new Date();
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);
ServiceContext serviceContext = ServiceContextFactory.getInstance(uploadPortletRequest);
long companyId = serviceContext.getCompanyId();
File file = uploadPortletRequest.getFile(fileParam);
if (Validator.isNull(file)) {
// TODO
_log.info("File is null");
return;
}
String sourceFileName = uploadPortletRequest.getFileName(fileParam);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId");
String tipoFile = ParamUtil.getString(actionRequest, "tipoFile");
String targetFileName = dettPraticaId + StringPool.UNDERLINE + tipoFile + StringPool.UNDERLINE
+ (new Date()).getTime() + StringPool.UNDERLINE + sourceFileName;
long attachmentFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId,
ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
Folder attachmentFolder = DLAppLocalServiceUtil.getFolder(attachmentFolderId);
long repositoryId = attachmentFolder.getRepositoryId();
String folderName = PraticaUtil.getFolderName(dettPraticaId);
Folder folder = null;
try {
folder = DLAppLocalServiceUtil.getFolder(repositoryId, attachmentFolder.getFolderId(), folderName);
} catch (NoSuchFolderException e) {
folder = DLAppLocalServiceUtil.addFolder(serviceContext.getUserId(), attachmentFolder.getRepositoryId(),
attachmentFolder.getFolderId(), folderName, StringPool.BLANK, serviceContext);
}
FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(serviceContext.getUserId(), repositoryId,
folder.getFolderId(), sourceFileName, MimeTypesUtil.getContentType(sourceFileName), targetFileName,
targetFileName, StringPool.BLANK, FileUtil.getBytes(file), serviceContext);
Avviso avviso = AvvisoLocalServiceUtil.addAvviso(intPraticaId, "Descrizione lunga", now,
AvvisoUtil.TIPO_AVVISO_FIRMA, tipoFile, -1L, dettPraticaId, DettPratica.class.getName(),
StringPool.BLANK, fileEntry.getFileEntryId(), 0L, StringPool.BLANK, controlloPraticaId, serviceContext);
}
public void aggiungiDettPraticheAlControllo(ActionRequest actionRequest, ActionResponse actionResponse)

4
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/report/builder/builder/ReportAvvisoBeanBuilder.java

@ -38,6 +38,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.language.LanguageUtil;
@ -135,7 +136,8 @@ public class ReportAvvisoBeanBuilder {
List<DocPratica> docPraticas = null;
if (avviso.getTipoDocumento().equalsIgnoreCase(DocumentiPraticaUtil.TIPOLOGIA_ALLEGATO_ANNULLAMENTO_FASCICOLO)) {
docPraticas = DocPraticaLocalServiceUtil.findByIntPratica_Tipologia(intPraticaId,
DocumentiPraticaUtil.TIPOLOGIA_ALLEGATO_ANNULLAMENTO_FASCICOLO, -1, -1);
DocumentiPraticaUtil.TIPOLOGIA_ALLEGATO_ANNULLAMENTO_FASCICOLO, QueryUtil.ALL_POS,
QueryUtil.ALL_POS);
} else if (avviso.getTipoDocumento().equalsIgnoreCase(StatoPraticaConstants.AUTORIZZATA)
&& (avviso.getControlloPraticaId() != 0)) {
docPraticas = new ArrayList<>();

119
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java

@ -479,79 +479,64 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
private static final String jsonViarch = getJsonViarch();
private static String getJsonAutorizzazione() {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
jsonObject.put("esito", jsonArray);
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();
JSONArray esito = JSONFactoryUtil.createJSONArray();
esito.put(etichetta(StatoPraticaConstants.CONFORME));
esito.put(etichetta(StatoPraticaConstants.NON_CONFORME));
esito.put(etichetta(StatoPraticaConstants.INTEGRAZIONE));
esito.put(etichetta(StatoPraticaConstants.PREAVVISO_CONTRARIO));
esito.put(etichetta(StatoPraticaConstants.NO_PARERE));
JSONObject ret = JSONFactoryUtil.createJSONObject();
ret.put("esito", esito);
return ret.toString();
}
private static String getJsonSanatoria() {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
jsonObject.put("esito", jsonArray);
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", "Autorizzazione a seguito di pagamento di sanzione pecuniaria");
etichette.put("value", StatoPraticaConstants.INTEGRAZIONE);
etichette.put("default", false);
jsonArray.put(etichette);
return jsonObject.toString();
JSONArray esito = JSONFactoryUtil.createJSONArray();
esito.put(etichetta(StatoPraticaConstants.CONFORME));
esito.put(etichetta(StatoPraticaConstants.NON_CONFORME));
esito.put(etichetta("Autorizzazione a seguito di pagamento di sanzione pecuniaria",
StatoPraticaConstants.INTEGRAZIONE, true));
JSONObject ret = JSONFactoryUtil.createJSONObject();
ret.put("esito", esito);
return ret.toString();
}
private static String getJsonViarch() {
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.CONFORME);
etichette.put("default", false);
jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "Concludi VIArch");
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);
return jsonObject.toString();
JSONArray esito = JSONFactoryUtil.createJSONArray();
esito.put(etichetta("Attiva VIArch", StatoPraticaConstants.CONFORME));
esito.put(etichetta("Concludi VIArch", StatoPraticaConstants.NON_CONFORME));
esito.put(etichetta(StatoPraticaConstants.INTEGRAZIONE));
JSONObject ret = JSONFactoryUtil.createJSONObject();
ret.put("esito", esito);
return ret.toString();
}
private static JSONObject etichetta(String value) {
return etichetta(StatoPraticaConstants.getEsitoAutorizzazione(value), value, false, false);
}
private static JSONObject etichetta(String label, String value) {
return etichetta(label, value, false, false);
}
private static JSONObject etichetta(String label, String value, boolean upload) {
return etichetta(label, value, upload, false);
}
private static JSONObject etichetta(String label, String value, boolean upload, boolean isDefault) {
JSONObject etichetta = JSONFactoryUtil.createJSONObject();
etichetta.put("label", label);
etichetta.put("value", value);
etichetta.put("upload", upload);
etichetta.put("default", isDefault);
return etichetta;
}
@Override

33
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java

@ -16,11 +16,11 @@ import it.tref.liferay.portos.bo.shared.protocollo.model.Protocollo;
import it.tref.liferay.portos.bo.shared.protocollo.model.Protocollo.TipoProtocollo;
import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.ParseException;
@ -191,19 +191,21 @@ public class ProtocollazioneUtil {
return "Oggetto: " + className + StringPool.SPACE + classPk;
}
public static List<OggettoProtocollo> csvToOggettoProtocollo(java.io.File file) throws FileNotFoundException,
IOException, ParseException {
private static final String[] FILE_PROTOCOLLO_HEADER = { "id", "mittente/destinatario id", "ufficio id", "oggetto",
"numero fascicolo", "data inserimento", "tipo" };
private static List<OggettoProtocollo> csvToOggettoProtocollo(byte[] bytes) throws IOException, ParseException {
String[] FILE_PROTOCOLLO_HEADER = { "id", "mittente/destinatario id", "ufficio id", "oggetto",
"numero fascicolo", "data inserimento", "tipo" };
CSVFormat format = CSVFormat.EXCEL.withTrailingDelimiter().withHeader(FILE_PROTOCOLLO_HEADER)
.withSkipHeaderRecord().withIgnoreEmptyLines().withIgnoreSurroundingSpaces();
Iterable<CSVRecord> records = format.parse(new FileReader(file));
Reader reader = new InputStreamReader(new ByteArrayInputStream(bytes));
Iterable<CSVRecord> records = format.parse(reader);
List<OggettoProtocollo> listaOggettoProtocollo = new ArrayList<>();
for (CSVRecord csvRecord : records) {
listaOggettoProtocollo.add(new OggettoProtocollo(csvRecord.get("id"), csvRecord
.get("mittente/destinatario id"), csvRecord.get("ufficio id"), csvRecord.get("oggetto"), csvRecord
.get("numero fascicolo"), csvRecord.get("data inserimento"), csvRecord.get("tipo")));
reader.close();
for (CSVRecord record : records) {
listaOggettoProtocollo.add(new OggettoProtocollo(record.get("id"), record.get("mittente/destinatario id"),
record.get("ufficio id"), record.get("oggetto"), record.get("numero fascicolo"), record
.get("data inserimento"), record.get("tipo")));
}
return listaOggettoProtocollo;
}
@ -251,13 +253,8 @@ public class ProtocollazioneUtil {
throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
}
byte[] bytes = IOUtils.toByteArray(conn.getInputStream());
java.io.File tempFile = java.io.File.createTempFile("prefix", "suffix", null);
FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(bytes);
fos.flush();
fos.close();
conn.disconnect();
return ProtocollazioneUtil.csvToOggettoProtocollo(tempFile);
return csvToOggettoProtocollo(bytes);
} catch (Exception e) {
}
return result;

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

@ -1,8 +1,7 @@
application.startup.events=\
it.tref.liferay.portos.bo.startup.RoleUpdateAction,\
it.tref.liferay.portos.bo.startup.KaleoListenereStartupAction,\
it.tref.liferay.portos.bo.startup.CompanyExpandoStartupAction,\
it.mwg.sismica.bo.startup.DatabaseUpdateAction
it.tref.liferay.portos.bo.startup.CompanyExpandoStartupAction
#MODEL LISTENER
value.object.listener.it.tref.liferay.portos.bo.model.DettPratica=it.tref.liferay.portos.bo.model.listener.DettPraticaModelListener

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

@ -1,7 +1,2 @@
resource.actions.configs=resource-actions/default.xml
#protocollo.cvs.url=http://localhost:9090/portos-protocollazione-service/v1/api-rest/export-protocolli
protocollo.cvs.url=http://localhost:9080/portos-protocollazione-service/v1/api-rest/export-protocolli
## Importer ##
portos.files.importer.callback.address=http://localhost:9080/portos-file-retriever-portlet/FileRetriever

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

@ -13,8 +13,8 @@
##
build.namespace=portos_bo
build.number=3043
build.date=1618405143549
build.number=3045
build.date=1618493741615
build.auto.upgrade=true
##

9
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp

@ -160,15 +160,17 @@ long territorioGroupId = territorio.getGroupId();
</div>
</c:if>
</c:if>
<%--
<c:if test="<%= IntPraticaPermission.contains(permissionChecker, territorioGroupId,
ActionKeys.RICHIEDI_PARERE_GEOLOGO) && intPratica.getStatusByUserId() == user.getUserId() %>">
<c:if test="<%= intPratica.isSanatoria() && IntPraticaPermission.contains(permissionChecker,
territorioGroupId, ActionKeys.RICHIEDI_PARERE_GEOLOGO)
&& intPratica.getStatusByUserId() == user.getUserId() %>">
<liferay-util:include page="/html/gestioneattivita/actions/action_allega_sanzione.jsp"
servletContext="<%= application %>" >
<liferay-util:param name="intPraticaId"
value="<%= String.valueOf(intPratica.getIntPraticaId()) %>" />
<liferay-util:param name="dettPraticaId"
value="<%= String.valueOf(controlloPratica.getDettPraticaId()) %>" />
<liferay-util:param name="dettPraticaId"
value="<%= String.valueOf(controlloPratica.getControlloPraticaId()) %>" />
<liferay-util:param name="buttonIdAllegaSanzione" value="<%= buttonIdAllegaSanzione %>" />
</liferay-util:include>
<div title='<%= LanguageUtil.get(pageContext, "fascicolo-action-allega-sanzione-doc1") %>'
@ -177,7 +179,6 @@ long territorioGroupId = territorio.getGroupId();
iconCssClass="fa fa-map" message="" url="#" />
</div>
</c:if>
--%>
</c:if>
<c:if test="<%= lastDettPraticaId != controlloPratica.getDettPraticaId()
&& intPratica.getStatusByUserId() == user.getUserId() %>">

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

@ -1,17 +1,20 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants"%>
<%@include file="/html/gestioneattivita/init.jsp"%>
<%
long intPraticaId = ParamUtil.getLong(request, "intPraticaId");
long dettPraticaId = ParamUtil.getLong(request, "dettPraticaId");
long controlloPraticaId = ParamUtil.getLong(request, "controlloPraticaId");
String buttonIdAllegaSanzione = ParamUtil.getString(request, "buttonIdAllegaSanzione");
String randomId = StringUtil.randomId();
String formNameAllegaSanzione = "formNameAllegaSanzione_" + randomId;
String divIdAllegaSanzione = "divIdAllegaSanzione_" + randomId;
System.out.println("intPraticaId = " + intPraticaId + ", dettPraticaId = " + dettPraticaId);
%>
<liferay-portlet:actionURL name="allegaSanzione" var="allegaSanzioneURL">
<liferay-util:param name="intPraticaId" value="<%= String.valueOf(intPraticaId) %>" />
<liferay-util:param name="dettPraticaId" value="<%= String.valueOf(dettPraticaId) %>" />
<liferay-util:param name="controlloPraticaId" value="<%= String.valueOf(controlloPraticaId) %>" />
<liferay-util:param name="tipoFile" value="<%= StatoPraticaConstants.SANZIONE_DOC1 %>" />
<liferay-util:param name="redirect" value="<%= currentURL %>" />
</liferay-portlet:actionURL>
<aui:form name="<%= formNameAllegaSanzione %>" method="post" enctype="multipart/form-data"

2
liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/domanda/page_dettagli_principali.jsp

@ -98,7 +98,7 @@
</div>
</c:if>
<c:if test="<%= (intPratica.getTipoProcedura().equals(Constants.PROCEDURA_P7)) %>">
<aui:input disabled="<%=disabledInput %>" type="text" name="interventoVoceP7" style="display:inline-block;width:50px;" label="intervento-voce-b"/>
<aui:input disabled="<%= disabledInput && !enabledByIntegrazione %>" type="text" name="interventoVoceP7" style="display:inline-block;width:50px;" label="intervento-voce-b"/>
</c:if>
<div class="row row-padding-custom ">
<div class="col-xs-12">

17
liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java

@ -1,17 +1,17 @@
package it.tref.liferay.portos.firma.util;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.Date;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.DefaultHttpClient;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -46,18 +46,17 @@ public class FirmaUtil {
public static List<String> getCodiceFiscale(byte[] fileArray, String urlPdfExtractor) {
List<String> listaCodiciFiscali = null;
HttpClient client = null;
try {
File file = File.createTempFile("codicefiscale", ".p7m");
FileUtils.writeByteArrayToFile(file, fileArray);
ObjectMapper mapper = new ObjectMapper();
ContentBody body = new FileBody(file);
ContentBody body = new ByteArrayBody(fileArray, "codicefiscale" + (new Date()).getTime() + ".p7m");
MultipartEntity entity = new MultipartEntity();
entity.addPart("file", body);
HttpPost request = new HttpPost(urlPdfExtractor);
request.setEntity(entity);
HttpClient client = new DefaultHttpClient();
client = new DefaultHttpClient();
HttpResponse response = client.execute(request);
if (response.getStatusLine().getStatusCode() != 200) {
if (response.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_OK) {
throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
}
InputStream inputStream = response.getEntity().getContent();
@ -67,6 +66,8 @@ public class FirmaUtil {
}
} catch (IOException e) {
_log.error(e.getMessage());
} finally {
client.getConnectionManager().shutdown();
}
return listaCodiciFiscali;
}

279
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/scheduler/SchedulerKaleoController.java

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

26
liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java

@ -1,34 +1,34 @@
/**
* 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)
* 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
* 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.report.model.impl;
/**
* The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the &quot;kaleotaskassignmentinstance&quot; database table, with each column mapped to a property of this class.
* The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the
* &quot;kaleotaskassignmentinstance&quot; database table, with each column mapped to a property of this class.
*
* <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} interface.
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} interface.
* </p>
*
* @author 3F Consulting
*/
public class KaleoTaskAssignmentInstanceImpl
extends KaleoTaskAssignmentInstanceBaseImpl {
public class KaleoTaskAssignmentInstanceImpl extends KaleoTaskAssignmentInstanceBaseImpl {
/*
* NOTE FOR DEVELOPERS:
*
* Never reference this class directly. All methods that expect a kaleo task assignment instance model instance should use the {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} interface instead.
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task assignment
* instance model instance should use the {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance}
* interface instead.
*/
public KaleoTaskAssignmentInstanceImpl() {
}

24
liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/KaleoInstanceLocalServiceImpl.java

@ -1,14 +1,12 @@
/**
* 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)
* 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
* 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.
*/
@ -20,21 +18,21 @@ import it.tref.liferay.portos.report.service.base.KaleoInstanceLocalServiceBaseI
* The implementation of the kaleo instance 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.report.service.KaleoInstanceLocalService} 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.report.service.KaleoInstanceLocalService} 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 3F Consulting
* @see it.tref.liferay.portos.report.service.base.KaleoInstanceLocalServiceBaseImpl
* @see it.tref.liferay.portos.report.service.KaleoInstanceLocalServiceUtil
*/
public class KaleoInstanceLocalServiceImpl
extends KaleoInstanceLocalServiceBaseImpl {
public class KaleoInstanceLocalServiceImpl extends KaleoInstanceLocalServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS:
*
* Never reference this interface directly. Always use {@link it.tref.liferay.portos.report.service.KaleoInstanceLocalServiceUtil} to access the kaleo instance local service.
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* it.tref.liferay.portos.report.service.KaleoInstanceLocalServiceUtil} to access the kaleo instance local service.
*/
}

182
liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java

@ -31,6 +31,7 @@ import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.Organization;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
@ -41,103 +42,102 @@ public class ReportScadenzarioIstruttorie implements PortosReportInterface {
@Override
public String generateHTML(HttpServletRequest httpServletRequest) {
String html = "";
String html = StringPool.BLANK;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
JasperHtmlExporterBuilder htmlExporter = DynamicReports.export.htmlExporter(bos).setIgnoreHyperLink(true);
JasperReportBuilder builder = generateReport(httpServletRequest);
builder.pageFooter(DynamicReports.cmp.pageNumber().setStyle(TemplatesADV.boldCenteredStyle));
builder.toHtml(htmlExporter);
byte[] byteArray = bos.toByteArray();
html = new String(byteArray);
} catch (DRException e) {
_log.error(e, e);
}
return html;
}
@Override
public JasperReportBuilder generateReport(HttpServletRequest request) {
String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null);
TextColumnBuilder<String> presidioColumn = DynamicReports.col.column("Ufficio", "presidioColumn", DynamicReports.type.stringType());
TextColumnBuilder<Integer> numeroPraticheDaAssegnareColumn = DynamicReports.col.column("N<EFBFBD>pratiche da assegnare da parte delle PO", "numeroPraticheDaAssegnareColumn", DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheDaApprovareColumn = DynamicReports.col.column("N<EFBFBD> pratiche da approvare da parte delle PO", "numeroPraticheDaApprovareColumn", DynamicReports.type.integerType());
//
TextColumnBuilder<Integer> numeroPraticheInIstruttoriaOrdinarieColumn = DynamicReports.col.column("N<EFBFBD>pratiche In Istruttoria", "numeroPraticheInIstruttoriaOrdinarieColumn", DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheConIntegrazOrdinarieColumn = DynamicReports.col.column("N<EFBFBD> pratiche con Int.Richieste", "numeroPraticheConIntegrazOrdinarieColumn", DynamicReports.type.integerType());
//
TextColumnBuilder<Integer> numeroPraticheInIstruttoriaInScadenzaColumn = DynamicReports.col.column("N<EFBFBD> pratiche In Istruttoria", "numeroPraticheInIstruttoriaInScadenzaColumn", DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheConIntegrazInScadenzaColumn = DynamicReports.col.column("N<EFBFBD> pratiche con Int.Richieste", "numeroPraticheConIntegrazInScadenzaColumn", DynamicReports.type.integerType());
//
TextColumnBuilder<Integer> numeroPraticheInIstruttoriaScaduteColumn = DynamicReports.col.column("N<EFBFBD> pratiche In Istruttoria", "numeroPraticheInIstruttoriaScaduteColumn", DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheConIntegrazScaduteColumn = DynamicReports.col.column("N<EFBFBD> pratiche con Int.Richieste", "numeroPraticheConIntegrazScaduteColumn", DynamicReports.type.integerType());
ColumnTitleGroupBuilder titleGroupOrdinarie = DynamicReports.grid.titleGroup(tipoPraticaSelected + " Ordinarie ( 0-39gg) ", numeroPraticheInIstruttoriaOrdinarieColumn, numeroPraticheConIntegrazOrdinarieColumn);
ColumnTitleGroupBuilder titleGroupInScadenza = DynamicReports.grid.titleGroup(tipoPraticaSelected + " In Scadenza ( 40-60 gg) ", numeroPraticheInIstruttoriaInScadenzaColumn, numeroPraticheConIntegrazInScadenzaColumn);
ColumnTitleGroupBuilder titleGroupScadute = DynamicReports.grid.titleGroup(tipoPraticaSelected + " Scadute ( oltre 60 gg) ", numeroPraticheInIstruttoriaScaduteColumn, numeroPraticheConIntegrazScaduteColumn);
String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null);
TextColumnBuilder<String> presidioColumn = DynamicReports.col.column("Ufficio", "presidioColumn",
DynamicReports.type.stringType());
TextColumnBuilder<Integer> numeroPraticheDaAssegnareColumn = DynamicReports.col.column(
"N° pratiche da assegnare da parte delle PO", "numeroPraticheDaAssegnareColumn",
DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheDaApprovareColumn = DynamicReports.col.column(
"N° pratiche da approvare da parte delle PO", "numeroPraticheDaApprovareColumn",
DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheInIstruttoriaOrdinarieColumn = DynamicReports.col.column(
"N° pratiche In Istruttoria", "numeroPraticheInIstruttoriaOrdinarieColumn",
DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheConIntegrazOrdinarieColumn = DynamicReports.col.column(
"N° pratiche con Int.Richieste", "numeroPraticheConIntegrazOrdinarieColumn",
DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheInIstruttoriaInScadenzaColumn = DynamicReports.col.column(
"N° pratiche In Istruttoria", "numeroPraticheInIstruttoriaInScadenzaColumn",
DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheConIntegrazInScadenzaColumn = DynamicReports.col.column(
"N° pratiche con Int.Richieste", "numeroPraticheConIntegrazInScadenzaColumn",
DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheInIstruttoriaScaduteColumn = DynamicReports.col.column(
"N° pratiche In Istruttoria", "numeroPraticheInIstruttoriaScaduteColumn",
DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroPraticheConIntegrazScaduteColumn = DynamicReports.col.column(
"N° pratiche con Int.Richieste", "numeroPraticheConIntegrazScaduteColumn",
DynamicReports.type.integerType());
ColumnTitleGroupBuilder titleGroupOrdinarie = DynamicReports.grid.titleGroup(tipoPraticaSelected
+ " Ordinarie ( 0-39 gg) ", numeroPraticheInIstruttoriaOrdinarieColumn,
numeroPraticheConIntegrazOrdinarieColumn);
ColumnTitleGroupBuilder titleGroupInScadenza = DynamicReports.grid.titleGroup(tipoPraticaSelected
+ " In Scadenza ( 40-60 gg) ", numeroPraticheInIstruttoriaInScadenzaColumn,
numeroPraticheConIntegrazInScadenzaColumn);
ColumnTitleGroupBuilder titleGroupScadute = DynamicReports.grid.titleGroup(tipoPraticaSelected
+ " Scadute ( oltre 60 gg) ", numeroPraticheInIstruttoriaScaduteColumn,
numeroPraticheConIntegrazScaduteColumn);
JasperReportBuilder builder = DynamicReports
.report()
.setTemplate(TemplatesADV.reportTemplate)
.columnGrid(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, titleGroupOrdinarie, titleGroupInScadenza, titleGroupScadute)
.columns(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, numeroPraticheInIstruttoriaOrdinarieColumn, numeroPraticheConIntegrazOrdinarieColumn, numeroPraticheInIstruttoriaInScadenzaColumn,
numeroPraticheConIntegrazInScadenzaColumn, numeroPraticheInIstruttoriaScaduteColumn, numeroPraticheConIntegrazScaduteColumn).setDataSource(createDataSource(request))
.columnGrid(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn,
titleGroupOrdinarie, titleGroupInScadenza, titleGroupScadute)
.columns(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn,
numeroPraticheInIstruttoriaOrdinarieColumn, numeroPraticheConIntegrazOrdinarieColumn,
numeroPraticheInIstruttoriaInScadenzaColumn, numeroPraticheConIntegrazInScadenzaColumn,
numeroPraticheInIstruttoriaScaduteColumn, numeroPraticheConIntegrazScaduteColumn)
.setDataSource(createDataSource(request))
.addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true");
;
return builder;
}
private JRDataSource createDataSource(HttpServletRequest request) {
DRDataSource dataSource = new DRDataSource("presidioColumn", "numeroPraticheDaAssegnareColumn", "numeroPraticheDaApprovareColumn", "numeroPraticheInIstruttoriaOrdinarieColumn", "numeroPraticheConIntegrazOrdinarieColumn",
"numeroPraticheInIstruttoriaInScadenzaColumn", "numeroPraticheConIntegrazInScadenzaColumn", "numeroPraticheInIstruttoriaScaduteColumn", "numeroPraticheConIntegrazScaduteColumn");
DRDataSource dataSource = new DRDataSource("presidioColumn", "numeroPraticheDaAssegnareColumn",
"numeroPraticheDaApprovareColumn", "numeroPraticheInIstruttoriaOrdinarieColumn",
"numeroPraticheConIntegrazOrdinarieColumn", "numeroPraticheInIstruttoriaInScadenzaColumn",
"numeroPraticheConIntegrazInScadenzaColumn", "numeroPraticheInIstruttoriaScaduteColumn",
"numeroPraticheConIntegrazScaduteColumn");
try {
String dateMaxString = ParamUtil.getString(request, "dateMax", null);
String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null);
if (dateMaxString != null && tipoPraticaSelected != null) {
Date dateMax = SDF.parse(dateMaxString);
Calendar calendarMax = Calendar.getInstance();
calendarMax.setTime(dateMax);
calendarMax.set(Calendar.HOUR_OF_DAY, 23);
dateMax = calendarMax.getTime();
List<Organization> orgs = new ArrayList<Organization>();
orgs = OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
int numeroPraticheDaAssegnareColumn = 0;
int numeroPraticheDaApprovareColumn = 0;
int numPraticheOrdInIstruttoriaTecnico = 0;
int numPraticheOrdInAttesaIntegrazione = 0;
int numPraticheInScadenzaInIstruttoriaTecnico = 0;
int numPraticheInScadenzaInAttesaIntegrazione = 0;
int numPraticheScaduteInIstruttoriaTecnico = 0;
int numPraticheScaduteInAttesaIntegrazione = 0;
int totPraticheAperteFinePeriodo=0;
int totPraticheAperteFinePeriodo = 0;
int numeroPraticheDaAssegnareColumnTOTALE = 0;
int numeroPraticheDaApprovareColumnTOTALE = 0;
int numPraticheOrdInIstruttoriaTecnicoTOTALE = 0;
@ -146,71 +146,44 @@ public class ReportScadenzarioIstruttorie implements PortosReportInterface {
int numPraticheInScadenzaInAttesaIntegrazioneTOTALE = 0;
int numPraticheScaduteInIstruttoriaTecnicoTOTALE = 0;
int numPraticheScaduteInAttesaIntegrazioneTOTALE = 0;
for (Organization org : orgs) {
if (org.getParentOrganization() != null) {
long groupId = org.getGroup().getGroupId();
Map<String,Integer> dbResult=ReportEngineServiceUtil.praticheAperte(dateMax,groupId,tipoPraticaSelected);
numPraticheOrdInIstruttoriaTecnico=dbResult.get("numPraticheOrdInIstruttoriaTecnico");
numPraticheOrdInAttesaIntegrazione=dbResult.get("numPraticheOrdInAttesaIntegrazione");
numPraticheInScadenzaInIstruttoriaTecnico=dbResult.get("numPraticheInScadenzaInIstruttoriaTecnico");
numPraticheInScadenzaInAttesaIntegrazione=dbResult.get("numPraticheInScadenzaInAttesaIntegrazione");
numPraticheScaduteInIstruttoriaTecnico=dbResult.get("numPraticheScaduteInIstruttoriaTecnico");
numPraticheScaduteInAttesaIntegrazione=dbResult.get("numPraticheScaduteInAttesaIntegrazione");
Map<String, Integer> dbResult = ReportEngineServiceUtil.praticheAperte(dateMax, groupId,
tipoPraticaSelected);
numPraticheOrdInIstruttoriaTecnico = dbResult.get("numPraticheOrdInIstruttoriaTecnico");
numPraticheOrdInAttesaIntegrazione = dbResult.get("numPraticheOrdInAttesaIntegrazione");
numPraticheInScadenzaInIstruttoriaTecnico = dbResult
.get("numPraticheInScadenzaInIstruttoriaTecnico");
numPraticheInScadenzaInAttesaIntegrazione = dbResult
.get("numPraticheInScadenzaInAttesaIntegrazione");
numPraticheScaduteInIstruttoriaTecnico = dbResult.get("numPraticheScaduteInIstruttoriaTecnico");
numPraticheScaduteInAttesaIntegrazione = dbResult.get("numPraticheScaduteInAttesaIntegrazione");
totPraticheAperteFinePeriodo += dbResult.get("totPraticheAperteFinePeriodo");
numeroPraticheDaAssegnareColumnTOTALE += numeroPraticheDaAssegnareColumn;
numeroPraticheDaApprovareColumnTOTALE += numeroPraticheDaApprovareColumn;
numPraticheOrdInIstruttoriaTecnicoTOTALE += numPraticheOrdInIstruttoriaTecnico;
numPraticheOrdInAttesaIntegrazioneTOTALE += numPraticheOrdInAttesaIntegrazione;
numPraticheInScadenzaInIstruttoriaTecnicoTOTALE += numPraticheInScadenzaInIstruttoriaTecnico;
numPraticheInScadenzaInAttesaIntegrazioneTOTALE += numPraticheInScadenzaInAttesaIntegrazione;
numPraticheScaduteInIstruttoriaTecnicoTOTALE += numPraticheScaduteInIstruttoriaTecnico;
numPraticheScaduteInAttesaIntegrazioneTOTALE += numPraticheScaduteInAttesaIntegrazione;
dataSource.add(org.getName(),
numeroPraticheDaAssegnareColumn,
numeroPraticheDaApprovareColumn,
numPraticheOrdInIstruttoriaTecnico,
numPraticheOrdInAttesaIntegrazione,
numPraticheInScadenzaInIstruttoriaTecnico,
numPraticheInScadenzaInAttesaIntegrazione,
numPraticheScaduteInIstruttoriaTecnico,
numPraticheScaduteInAttesaIntegrazione);
dataSource.add(org.getName(), numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn,
numPraticheOrdInIstruttoriaTecnico, numPraticheOrdInAttesaIntegrazione,
numPraticheInScadenzaInIstruttoriaTecnico, numPraticheInScadenzaInAttesaIntegrazione,
numPraticheScaduteInIstruttoriaTecnico, numPraticheScaduteInAttesaIntegrazione);
}
}
_log.info("totPraticheAperteFinePeriodo= " + totPraticheAperteFinePeriodo);
dataSource.add("TOTALI",
numeroPraticheDaAssegnareColumnTOTALE,
numeroPraticheDaApprovareColumnTOTALE,
numPraticheOrdInIstruttoriaTecnicoTOTALE,
numPraticheOrdInAttesaIntegrazioneTOTALE,
dataSource.add("TOTALI", numeroPraticheDaAssegnareColumnTOTALE, numeroPraticheDaApprovareColumnTOTALE,
numPraticheOrdInIstruttoriaTecnicoTOTALE, numPraticheOrdInAttesaIntegrazioneTOTALE,
numPraticheInScadenzaInIstruttoriaTecnicoTOTALE,
numPraticheInScadenzaInAttesaIntegrazioneTOTALE,
numPraticheScaduteInIstruttoriaTecnicoTOTALE,
numPraticheScaduteInAttesaIntegrazioneTOTALE
);
numPraticheInScadenzaInAttesaIntegrazioneTOTALE, numPraticheScaduteInIstruttoriaTecnicoTOTALE,
numPraticheScaduteInAttesaIntegrazioneTOTALE);
}
} catch (SystemException e) {
_log.error(e, e);
} catch (PortalException e) {
_log.error(e, e);
} catch (ParseException e) {
} catch (ParseException | PortalException | SystemException e) {
_log.error(e, e);
}
return dataSource;
}
@ -221,41 +194,38 @@ public class ReportScadenzarioIstruttorie implements PortosReportInterface {
@Override
public List<PortosSearchTermsReport> getSearchFields() {
List<PortosSearchTermsReport> listaFields = new ArrayList<PortosSearchTermsReport>();
List<PortosSearchTermsReport> listaFields = new ArrayList<PortosSearchTermsReport>();
listaFields.add(new PortosSearchTermsReport(1, FieldType.DATE, "dateMax"));
List<String> lista = new ArrayList<>();
lista.add("Autorizzazioni");
lista.add("Depositi a controllo obbligatorio");
lista.add("Sanatorie");
listaFields.add(new PortosSearchTermsReport(3, FieldType.SELECT, "tipologiaPratica", lista));
return listaFields;
}
@Override
public boolean isCVSEnabled() {
return true;
}
@Override
public boolean isPDFEnabled() {
return false;
}
@Override
public boolean isExcelEnabled() {
return true;
}
@Override
public boolean isWordEnabled() {
return false;
}
//
}
}

279
liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java

@ -1,11 +1,9 @@
package it.tref.portos.report.engine;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import it.tref.portos.report.engine.PortosSearchTermsReport.FieldType;
import it.tref.portos.report.engine.annotation.PortosReport;
import it.tref.portos.report.engine.template.TemplatesADV;
import it.tref.portos.report.engine.util.ReportEngineServiceUtil;
import it.tref.portos.report.engine.util.ReportTempisticheBean;
import java.io.ByteArrayOutputStream;
import java.text.ParseException;
@ -13,10 +11,8 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
@ -36,193 +32,166 @@ import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.Organization;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
//Task 33557
@PortosReport
public class ReportTempisticheIstruttorie implements PortosReportInterface {
private static Log _log = LogFactoryUtil.getLog(ReportTempisticheIstruttorie.class);
private static final SimpleDateFormat SDF = new SimpleDateFormat("dd/MM/yyyy");
private static final SimpleDateFormat SDF = new SimpleDateFormat("dd/MM/yyyy");
private static final String nota1 = "(1): somma dei tempi di istruttoria della pratica da parte dei tecnici della sismica (prima istruttoria e istruttoria delle integrazioni)";
private static final String nota2 = "(2): durata in giorni, tra l'inizio del procedimento e la conclusione del procedimento, ovvero durata dell'istruttoria e dei tempi di trasmissione delle integrazioni richieste";
@Override
public String generateHTML(HttpServletRequest httpServletRequest) {
String html = "";
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
JasperHtmlExporterBuilder htmlExporter = DynamicReports.export.htmlExporter(bos).setIgnoreHyperLink(true);
JasperReportBuilder builder = generateReport(httpServletRequest);
builder.pageFooter(DynamicReports.cmp.pageNumber().setStyle(TemplatesADV.boldCenteredStyle));
builder.toHtml(htmlExporter);
byte[] byteArray = bos.toByteArray();
html = new String(byteArray);
} catch (DRException e) {
_log.error(e, e);
}
return html;
String html = StringPool.BLANK;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
JasperHtmlExporterBuilder htmlExporter = DynamicReports.export.htmlExporter(bos).setIgnoreHyperLink(true);
JasperReportBuilder builder = generateReport(httpServletRequest);
builder.pageFooter(DynamicReports.cmp.pageNumber().setStyle(TemplatesADV.boldCenteredStyle));
builder.toHtml(htmlExporter);
byte[] byteArray = bos.toByteArray();
html = new String(byteArray);
} catch (DRException e) {
_log.error(e, e);
}
return html;
}
@Override
public JasperReportBuilder generateReport(HttpServletRequest request) {
String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null);
TextColumnBuilder<String> presidioColumn =
DynamicReports.col.column("Presidio", "presidio", DynamicReports.type.stringType());
TextColumnBuilder<Integer> numeroPraticheTotaliColumn =
DynamicReports.col.column("N° Pratiche Totali", "numeroPraticheTotaliColumn", DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroTotaleAutorizzateInScadenzaColumn =
DynamicReports.col.column("Numero Totale", "numeroTotaleAutorizzateInScadenzaColumn", DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroTotaleAutorizzateScaduteColumn =
DynamicReports.col.column("Numero Totale", "numeroTotaleAutorizzateScaduteColumn", DynamicReports.type.integerType());
TextColumnBuilder<Float> durataMediaIstruttorieInScadenzaColumn =
DynamicReports.col.column("Durata media istruttorie (1)", "durataMediaIstruttorieInScadenzaColumn", DynamicReports.type.floatType());
TextColumnBuilder<Float> durataMediaIstruttorieScaduteColumn =
DynamicReports.col.column("Durata media istruttorie (1)", "durataMediaIstruttorieScaduteColumn", DynamicReports.type.floatType());
TextColumnBuilder<Float> durataMediaApprovazionePraticaInScadenzaColumn =
DynamicReports.col.column("Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaInScadenzaColumn", DynamicReports.type.floatType());
TextColumnBuilder<Float> durataMediaApprovazionePraticaScaduteColumn =
DynamicReports.col.column("Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaScaduteColumn", DynamicReports.type.floatType());
ColumnTitleGroupBuilder titleGroupInScadenza =
DynamicReports.grid.titleGroup(tipoPraticaSelected + " T <= 60 gg", numeroTotaleAutorizzateInScadenzaColumn, durataMediaIstruttorieInScadenzaColumn, durataMediaApprovazionePraticaInScadenzaColumn);
ColumnTitleGroupBuilder titleGroupScadute =
DynamicReports.grid.titleGroup(tipoPraticaSelected + " T > 60 gg", numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, durataMediaApprovazionePraticaScaduteColumn);
TextFieldBuilder<String> note1 =
DynamicReports.cmp.text(nota1);
TextFieldBuilder<String> note2 =
DynamicReports.cmp.text(nota2);
TextColumnBuilder<String> presidioColumn = DynamicReports.col.column("Presidio", "presidio",
DynamicReports.type.stringType());
TextColumnBuilder<Integer> numeroPraticheTotaliColumn = DynamicReports.col.column("N° Pratiche Totali",
"numeroPraticheTotaliColumn", DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroTotaleAutorizzateInScadenzaColumn = DynamicReports.col.column("Numero Totale",
"numeroTotaleAutorizzateInScadenzaColumn", DynamicReports.type.integerType());
TextColumnBuilder<Integer> numeroTotaleAutorizzateScaduteColumn = DynamicReports.col.column("Numero Totale",
"numeroTotaleAutorizzateScaduteColumn", DynamicReports.type.integerType());
TextColumnBuilder<Float> durataMediaIstruttorieInScadenzaColumn = DynamicReports.col.column(
"Durata media istruttorie (1)", "durataMediaIstruttorieInScadenzaColumn",
DynamicReports.type.floatType());
TextColumnBuilder<Float> durataMediaIstruttorieScaduteColumn = DynamicReports.col.column(
"Durata media istruttorie (1)", "durataMediaIstruttorieScaduteColumn", DynamicReports.type.floatType());
TextColumnBuilder<Float> durataMediaApprovazionePraticaInScadenzaColumn = DynamicReports.col.column(
"Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaInScadenzaColumn",
DynamicReports.type.floatType());
TextColumnBuilder<Float> durataMediaApprovazionePraticaScaduteColumn = DynamicReports.col.column(
"Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaScaduteColumn",
DynamicReports.type.floatType());
ColumnTitleGroupBuilder titleGroupInScadenza = DynamicReports.grid.titleGroup(tipoPraticaSelected
+ " T <= 60 gg", numeroTotaleAutorizzateInScadenzaColumn, durataMediaIstruttorieInScadenzaColumn,
durataMediaApprovazionePraticaInScadenzaColumn);
ColumnTitleGroupBuilder titleGroupScadute = DynamicReports.grid.titleGroup(tipoPraticaSelected + " T > 60 gg",
numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn,
durataMediaApprovazionePraticaScaduteColumn);
TextFieldBuilder<String> note1 = DynamicReports.cmp.text(nota1);
TextFieldBuilder<String> note2 = DynamicReports.cmp.text(nota2);
note1.setStyle(DynamicReports.stl.style(TemplatesADV.rootStyle).setFontSize(6));
note2.setStyle(DynamicReports.stl.style(TemplatesADV.rootStyle).setFontSize(6));
JasperReportBuilder builder =
DynamicReports.report().setTemplate(TemplatesADV.reportTemplate)
.pageFooter(note1, note2)
.columnGrid(presidioColumn, numeroPraticheTotaliColumn, titleGroupInScadenza, titleGroupScadute)
.columns(presidioColumn, numeroPraticheTotaliColumn
, numeroTotaleAutorizzateInScadenzaColumn, durataMediaIstruttorieInScadenzaColumn, durataMediaApprovazionePraticaInScadenzaColumn
, numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, durataMediaApprovazionePraticaScaduteColumn)
.setDataSource(createDataSource(request)).addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true");;
JasperReportBuilder builder = DynamicReports
.report()
.setTemplate(TemplatesADV.reportTemplate)
.pageFooter(note1, note2)
.columnGrid(presidioColumn, numeroPraticheTotaliColumn, titleGroupInScadenza, titleGroupScadute)
.columns(presidioColumn, numeroPraticheTotaliColumn, numeroTotaleAutorizzateInScadenzaColumn,
durataMediaIstruttorieInScadenzaColumn, durataMediaApprovazionePraticaInScadenzaColumn,
numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn,
durataMediaApprovazionePraticaScaduteColumn).setDataSource(createDataSource(request))
.addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true");
return builder;
}
private JRDataSource createDataSource(HttpServletRequest request) {
DRDataSource dataSource =
new DRDataSource("presidio", "numeroPraticheTotaliColumn"
, "numeroTotaleAutorizzateInScadenzaColumn", "durataMediaIstruttorieInScadenzaColumn", "durataMediaApprovazionePraticaInScadenzaColumn"
, "numeroTotaleAutorizzateScaduteColumn", "durataMediaIstruttorieScaduteColumn", "durataMediaApprovazionePraticaScaduteColumn");
DRDataSource dataSource = new DRDataSource("presidio", "numeroPraticheTotaliColumn",
"numeroTotaleAutorizzateInScadenzaColumn", "durataMediaIstruttorieInScadenzaColumn",
"durataMediaApprovazionePraticaInScadenzaColumn", "numeroTotaleAutorizzateScaduteColumn",
"durataMediaIstruttorieScaduteColumn", "durataMediaApprovazionePraticaScaduteColumn");
try {
String dateMinString = ParamUtil.getString(request, "dateMin", null);
String dateMaxString = ParamUtil.getString(request, "dateMax", null);
String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null);
if (dateMinString != null && dateMaxString != null && tipoPraticaSelected != null) {
Date dateMin = SDF.parse(dateMinString);
Date dateMax = SDF.parse(dateMaxString);
Calendar calendarMin = Calendar.getInstance();
calendarMin.setTime(dateMin);
calendarMin.set(Calendar.HOUR_OF_DAY, 1);
dateMin = calendarMin.getTime();
dateMin = calendarMin.getTime();
Calendar calendarMax = Calendar.getInstance();
calendarMax.setTime(dateMax);
calendarMax.set(Calendar.HOUR_OF_DAY, 23);
dateMax = calendarMax.getTime();
List<Organization> orgs = new ArrayList<Organization>();
orgs = OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
int numeroPraticheTotaliTotale = 0;
int numeroTotaleAutorizzateInScadenzaTotale = 0;
float durataMediaIstruttorieInScadenzaTotale = 0;
float durataMediaApprovazionePraticaInScadenzaTotale = 0;
int numeroTotaleAutorizzateScaduteTotale = 0;
float durataMediaIstruttorieScaduteTotale = 0;
float durataMediaApprovazionePraticaScaduteTotale = 0;
int countOrganization = 0;
int numeroPraticheTotaliTotale = 0;
int numeroTotaleAutorizzateInScadenzaTotale = 0;
float durataMediaIstruttorieInScadenzaTotale = 0;
float durataMediaApprovazionePraticaInScadenzaTotale = 0;
int numeroTotaleAutorizzateScaduteTotale = 0;
float durataMediaIstruttorieScaduteTotale = 0;
float durataMediaApprovazionePraticaScaduteTotale = 0;
int countOrganizationPraticheInScadenza = 0;
int countOrganizationPraticheScadute = 0;
for (Organization org : orgs) {
if (org.getParentOrganization() != null) {
long groupId = org.getGroup().getGroupId();
//Retrieve data from DB
//Map<String,Long> dbResult=elaboraAutorizzazioniNew(dateMin,dateMax,groupId,tipoPraticaSelected);
Map<String,Long> dbResult=ReportEngineServiceUtil.praticheChiuse(dateMin, dateMax, groupId, tipoPraticaSelected);
int numeroPraticheTotali =dbResult.get("count").intValue();
int numeroTotaleAutorizzateInScadenza = dbResult.get("countOrdinarie").intValue();
Map<String, Long> dbResult = ReportEngineServiceUtil.praticheChiuse(dateMin, dateMax, groupId,
tipoPraticaSelected);
int numeroPraticheTotali = dbResult.get("count").intValue();
int numeroTotaleAutorizzateInScadenza = dbResult.get("countOrdinarie").intValue();
int numeroTotaleAutorizzateScadute = dbResult.get("countScadute").intValue();
float durataMediaIstruttorieInScadenza =dbResult.get("countOrdinarie")>0? dbResult.get("giorniTotOrdinarieIstruttorie")/dbResult.get("countOrdinarie"):0;
float durataMediaApprovazionePraticaInScadenza =dbResult.get("countOrdinarie")>0? dbResult.get("giorniTotOrdinarieApprovazioni")/dbResult.get("countOrdinarie"):0;
float durataMediaIstruttorieScadute = dbResult.get("countScadute")>0?dbResult.get("giorniTotScaduteIstruttorie")/dbResult.get("countScadute"):0;
float durataMediaApprovazionePraticaScadute =dbResult.get("countScadute")>0?dbResult.get("giorniTotScaduteApprovazioni")/dbResult.get("countScadute"):0;
dataSource.add(org.getName(), numeroPraticheTotali
, numeroTotaleAutorizzateInScadenza, durataMediaIstruttorieInScadenza, durataMediaApprovazionePraticaInScadenza
, numeroTotaleAutorizzateScadute, durataMediaIstruttorieScadute, durataMediaApprovazionePraticaScadute);
numeroPraticheTotaliTotale+=numeroPraticheTotali;
numeroTotaleAutorizzateInScadenzaTotale+=numeroTotaleAutorizzateInScadenza;
numeroTotaleAutorizzateScaduteTotale+=numeroTotaleAutorizzateScadute;
durataMediaApprovazionePraticaInScadenzaTotale+=durataMediaApprovazionePraticaInScadenza;
durataMediaApprovazionePraticaScaduteTotale+=durataMediaApprovazionePraticaScadute;
durataMediaIstruttorieInScadenzaTotale+=durataMediaIstruttorieInScadenza;
durataMediaIstruttorieScaduteTotale+=durataMediaIstruttorieScadute;
if (numeroTotaleAutorizzateInScadenza>0)
countOrganizationPraticheInScadenza++;
if (numeroTotaleAutorizzateScadute>0)
countOrganizationPraticheScadute++;
countOrganization++;
float durataMediaIstruttorieInScadenza = dbResult.get("countOrdinarie") > 0 ? dbResult
.get("giorniTotOrdinarieIstruttorie") / dbResult.get("countOrdinarie") : 0;
float durataMediaApprovazionePraticaInScadenza = dbResult.get("countOrdinarie") > 0 ? dbResult
.get("giorniTotOrdinarieApprovazioni") / dbResult.get("countOrdinarie") : 0;
float durataMediaIstruttorieScadute = dbResult.get("countScadute") > 0 ? dbResult
.get("giorniTotScaduteIstruttorie") / dbResult.get("countScadute") : 0;
float durataMediaApprovazionePraticaScadute = dbResult.get("countScadute") > 0 ? dbResult
.get("giorniTotScaduteApprovazioni") / dbResult.get("countScadute") : 0;
dataSource.add(org.getName(), numeroPraticheTotali, numeroTotaleAutorizzateInScadenza,
durataMediaIstruttorieInScadenza, durataMediaApprovazionePraticaInScadenza,
numeroTotaleAutorizzateScadute, durataMediaIstruttorieScadute,
durataMediaApprovazionePraticaScadute);
numeroPraticheTotaliTotale += numeroPraticheTotali;
numeroTotaleAutorizzateInScadenzaTotale += numeroTotaleAutorizzateInScadenza;
numeroTotaleAutorizzateScaduteTotale += numeroTotaleAutorizzateScadute;
durataMediaApprovazionePraticaInScadenzaTotale += durataMediaApprovazionePraticaInScadenza;
durataMediaApprovazionePraticaScaduteTotale += durataMediaApprovazionePraticaScadute;
durataMediaIstruttorieInScadenzaTotale += durataMediaIstruttorieInScadenza;
durataMediaIstruttorieScaduteTotale += durataMediaIstruttorieScadute;
if (numeroTotaleAutorizzateInScadenza > 0) {
countOrganizationPraticheInScadenza++;
}
if (numeroTotaleAutorizzateScadute > 0) {
countOrganizationPraticheScadute++;
}
}
}
dataSource.add("TOTALI", numeroPraticheTotaliTotale, numeroTotaleAutorizzateInScadenzaTotale,
countOrganizationPraticheInScadenza>0?durataMediaIstruttorieInScadenzaTotale/countOrganizationPraticheInScadenza:0,
countOrganizationPraticheInScadenza>0?durataMediaApprovazionePraticaInScadenzaTotale/countOrganizationPraticheInScadenza:0,
numeroTotaleAutorizzateScaduteTotale,
countOrganizationPraticheScadute>0?durataMediaIstruttorieScaduteTotale/countOrganizationPraticheScadute:0,
countOrganizationPraticheScadute>0?durataMediaApprovazionePraticaScaduteTotale/countOrganizationPraticheScadute:0);
dataSource.add("TOTALI", numeroPraticheTotaliTotale, numeroTotaleAutorizzateInScadenzaTotale,
countOrganizationPraticheInScadenza > 0 ? durataMediaIstruttorieInScadenzaTotale
/ countOrganizationPraticheInScadenza : 0,
countOrganizationPraticheInScadenza > 0 ? durataMediaApprovazionePraticaInScadenzaTotale
/ countOrganizationPraticheInScadenza : 0, numeroTotaleAutorizzateScaduteTotale,
countOrganizationPraticheScadute > 0 ? durataMediaIstruttorieScaduteTotale
/ countOrganizationPraticheScadute : 0,
countOrganizationPraticheScadute > 0 ? durataMediaApprovazionePraticaScaduteTotale
/ countOrganizationPraticheScadute : 0);
}
} catch (SystemException e) {
_log.error(e, e);
} catch (PortalException e) {
_log.error(e, e);
} catch (ParseException e) {
} catch (ParseException | PortalException | SystemException e) {
_log.error(e, e);
}
return dataSource;
}
@Override
public String getTitle() {
return "Report Tempistiche Istruttorie";
@ -230,40 +199,40 @@ public class ReportTempisticheIstruttorie implements PortosReportInterface {
@Override
public List<PortosSearchTermsReport> getSearchFields() {
List<PortosSearchTermsReport> listaFields = new ArrayList<PortosSearchTermsReport>();
listaFields.add(new PortosSearchTermsReport(1, FieldType.DATE, "dateMin"));
listaFields.add(new PortosSearchTermsReport(2, FieldType.DATE, "dateMax"));
List<String> lista = new ArrayList<>();
lista.add("Autorizzazioni");
lista.add("Depositi a controllo obbligatorio");
lista.add("Depositi a sorteggio");
lista.add("Sanatorie");
listaFields.add(new PortosSearchTermsReport(3, FieldType.SELECT, "tipologiaPratica", lista));
return listaFields;
List<PortosSearchTermsReport> listaFields = new ArrayList<PortosSearchTermsReport>();
listaFields.add(new PortosSearchTermsReport(1, FieldType.DATE, "dateMin"));
listaFields.add(new PortosSearchTermsReport(2, FieldType.DATE, "dateMax"));
List<String> lista = new ArrayList<>();
lista.add("Autorizzazioni");
lista.add("Depositi a controllo obbligatorio");
lista.add("Depositi a sorteggio");
lista.add("Sanatorie");
listaFields.add(new PortosSearchTermsReport(3, FieldType.SELECT, "tipologiaPratica", lista));
return listaFields;
}
@Override
public boolean isCVSEnabled() {
return true;
}
@Override
public boolean isPDFEnabled() {
return false;
}
@Override
public boolean isExcelEnabled() {
return true;
}
@Override
public boolean isWordEnabled() {
return false;
}
}
}
}

317
liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java

@ -12,8 +12,6 @@ import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import com.liferay.portal.kernel.util.ParamUtil;
import net.sf.dynamicreports.report.base.expression.AbstractValueFormatter;
import net.sf.dynamicreports.report.builder.HyperLinkBuilder;
import net.sf.dynamicreports.report.builder.ReportTemplateBuilder;
@ -28,177 +26,148 @@ import net.sf.dynamicreports.report.constant.SplitType;
import net.sf.dynamicreports.report.constant.VerticalTextAlignment;
import net.sf.dynamicreports.report.definition.ReportParameters;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool;
public class TemplatesADV {
public static final StyleBuilder rootStyle;
public static final StyleBuilder rootCenterStyle;
public static final StyleBuilder boldStyle;
public static final StyleBuilder italicStyle;
public static final StyleBuilder boldCenteredStyle;
public static final StyleBuilder bold11CenteredStyle;
public static final StyleBuilder bold15CenteredStyle;
public static final StyleBuilder columnStyle;
public static final StyleBuilder columnTitleStyle;
public static final StyleBuilder groupStyle;
public static final StyleBuilder subtotalStyle;
public static final ReportTemplateBuilder reportTemplate;
public static final CurrencyType currencyType;
public static final ComponentBuilder<?, ?> dynamicReportsComponent;
public static final ComponentBuilder<?, ?> footerComponent;
static {
BorderBuilder border = stl.border();
border.setBottomPen(stl.penThin().setLineColor(new Color(129, 33, 33)))
.setLeftPen(stl.penThin().setLineColor(new Color(129, 33, 33)))
.setTopPen(stl.penThin().setLineColor(new Color(129, 33, 33)))
.setRightPen(stl.penThin().setLineColor(new Color(129, 33, 33)));
rootStyle = stl.style().setPadding(2).setFontSize(7);
rootCenterStyle =
stl.style(rootStyle).setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE);
boldStyle = stl.style(rootStyle).bold().setFontSize(7);
italicStyle = stl.style(rootStyle).italic().setFontSize(7);
boldCenteredStyle =
stl.style(boldStyle).setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE)
.setFontSize(7);
bold11CenteredStyle = stl.style(boldCenteredStyle).setFontSize(11).setForegroundColor(new Color(129, 33, 33));
bold15CenteredStyle = stl.style(boldCenteredStyle).setFontSize(15).setForegroundColor(new Color(129, 33, 33));
columnStyle = stl.style(rootCenterStyle).setVerticalTextAlignment(VerticalTextAlignment.TOP).setBorder(border);
columnTitleStyle =
stl.style(columnStyle).setBorder(stl.pen2Point()).setHorizontalTextAlignment(HorizontalTextAlignment.CENTER)
.setBackgroundColor(Color.WHITE).bold().setForegroundColor(new Color(129, 33, 33)).italic();
groupStyle = stl.style(boldStyle).setHorizontalTextAlignment(HorizontalTextAlignment.LEFT);
subtotalStyle = stl.style(boldStyle).setTopBorder(stl.pen1Point());
StyleBuilder crosstabGroupStyle = stl.style(columnTitleStyle);
StyleBuilder crosstabGroupTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(170, 170, 170));
StyleBuilder crosstabGrandTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(140, 140, 140));
StyleBuilder crosstabCellStyle = stl.style(columnStyle).setBorder(stl.pen1Point());
TableOfContentsCustomizerBuilder tableOfContentsCustomizer =
tableOfContentsCustomizer().setHeadingStyle(0, stl.style(rootStyle).bold());
reportTemplate =
template().setLocale(Locale.ENGLISH).setColumnStyle(columnStyle).setColumnTitleStyle(columnTitleStyle)
.setGroupStyle(groupStyle).setGroupTitleStyle(groupStyle).setSubtotalStyle(subtotalStyle)
.highlightDetailEvenRows().crosstabHighlightEvenRows().setCrosstabGroupStyle(crosstabGroupStyle)
.setCrosstabGroupTotalStyle(crosstabGroupTotalStyle).setCrosstabGrandTotalStyle(crosstabGrandTotalStyle)
.setCrosstabCellStyle(crosstabCellStyle).setTableOfContentsCustomizer(tableOfContentsCustomizer)
.setDefaultSplitType(SplitType.PREVENT).setDetailSplitType(SplitType.PREVENT);
currencyType = new CurrencyType();
HyperLinkBuilder link = hyperLink("");
dynamicReportsComponent =
cmp.horizontalList(
// cmp.image(TemplatesADV.class.getResource("images/aaa.png")).setFixedDimension(60, 60),
cmp.verticalList(
cmp.text("GENIO CIVILE").setStyle(bold15CenteredStyle)
.setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text("").setStyle(italicStyle)
.setHyperLink(link))).setFixedWidth(300);
footerComponent = cmp.pageXofY().setStyle(stl.style(boldCenteredStyle).setTopBorder(stl.pen1Point()));
}
/**
*
* Creates custom component which is possible to add to any report band component
*/
public static ComponentBuilder<?, ?> createTitleComponent(String label) {
HorizontalListBuilder horizontalListBuilder = cmp.horizontalList();
horizontalListBuilder.add(dynamicReportsComponent, cmp.text(label).setStyle(bold15CenteredStyle)
.setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT));
horizontalListBuilder.newRow();
return horizontalListBuilder;
}
/**
* ADT: BUG BO ID=34 REPORT PRATICHE VIDIMATE
*
* @param label
* @param className
* @param request
* @return
*/
public static ComponentBuilder<?, ?> createTitleComponentNew(String label,String className,HttpServletRequest request) {
if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())){
HorizontalListBuilder horizontalListBuilder = cmp.horizontalList();
HyperLinkBuilder link = hyperLink("");
StringBuilder stBuilder=new StringBuilder();
if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())){
String dateMinString = ParamUtil.getString(request, "dateMin", null);
String dateMaxString = ParamUtil.getString(request, "dateMax", null);
stBuilder.append("Periodo di Osservazione: dal ");
stBuilder.append(dateMinString);
stBuilder.append(" al ");
stBuilder.append(dateMaxString);
}
ComponentBuilder<?, ?> dynamicReportsComponentNew =
cmp.horizontalList(
// cmp.image(TemplatesADV.class.getResource("images/aaa.png")).setFixedDimension(60, 60),
cmp.verticalList(
cmp.text(stBuilder.toString()).setStyle(bold15CenteredStyle)
.setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text("").setStyle(italicStyle)
.setHyperLink(link))).setFixedWidth(300);
horizontalListBuilder.add(dynamicReportsComponentNew, cmp.text(label).setStyle(bold15CenteredStyle)
.setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT));
horizontalListBuilder.newRow();
return horizontalListBuilder;
}else{
return null;
}
}
public static CurrencyValueFormatter createCurrencyValueFormatter(String label) {
return new CurrencyValueFormatter(label);
}
public static class CurrencyType extends BigDecimalType {
private static final long serialVersionUID = 1L;
@Override
public String getPattern() {
return "€ #.###,00";
}
}
private static class CurrencyValueFormatter extends AbstractValueFormatter<String, Number> {
private static final long serialVersionUID = 1L;
private String label;
public CurrencyValueFormatter(String label) {
this.label = label;
}
@Override
public String format(Number value, ReportParameters reportParameters) {
return label + currencyType.valueToString(value, reportParameters.getLocale());
}
}
}
public static final StyleBuilder rootStyle;
public static final StyleBuilder rootCenterStyle;
public static final StyleBuilder boldStyle;
public static final StyleBuilder italicStyle;
public static final StyleBuilder boldCenteredStyle;
public static final StyleBuilder bold11CenteredStyle;
public static final StyleBuilder bold15CenteredStyle;
public static final StyleBuilder columnStyle;
public static final StyleBuilder columnTitleStyle;
public static final StyleBuilder groupStyle;
public static final StyleBuilder subtotalStyle;
public static final ReportTemplateBuilder reportTemplate;
public static final CurrencyType currencyType;
public static final ComponentBuilder<?, ?> dynamicReportsComponent;
public static final ComponentBuilder<?, ?> footerComponent;
static {
BorderBuilder border = stl.border();
border.setBottomPen(stl.penThin().setLineColor(new Color(129, 33, 33)))
.setLeftPen(stl.penThin().setLineColor(new Color(129, 33, 33)))
.setTopPen(stl.penThin().setLineColor(new Color(129, 33, 33)))
.setRightPen(stl.penThin().setLineColor(new Color(129, 33, 33)));
rootStyle = stl.style().setPadding(2).setFontSize(7);
rootCenterStyle = stl.style(rootStyle).setTextAlignment(HorizontalTextAlignment.CENTER,
VerticalTextAlignment.MIDDLE);
boldStyle = stl.style(rootStyle).bold().setFontSize(7);
italicStyle = stl.style(rootStyle).italic().setFontSize(7);
boldCenteredStyle = stl.style(boldStyle)
.setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE).setFontSize(7);
bold11CenteredStyle = stl.style(boldCenteredStyle).setFontSize(11).setForegroundColor(new Color(129, 33, 33));
bold15CenteredStyle = stl.style(boldCenteredStyle).setFontSize(15).setForegroundColor(new Color(129, 33, 33));
columnStyle = stl.style(rootCenterStyle).setVerticalTextAlignment(VerticalTextAlignment.TOP).setBorder(border);
columnTitleStyle = stl.style(columnStyle).setBorder(stl.pen2Point())
.setHorizontalTextAlignment(HorizontalTextAlignment.CENTER).setBackgroundColor(Color.WHITE).bold()
.setForegroundColor(new Color(129, 33, 33)).italic();
groupStyle = stl.style(boldStyle).setHorizontalTextAlignment(HorizontalTextAlignment.LEFT);
subtotalStyle = stl.style(boldStyle).setTopBorder(stl.pen1Point());
StyleBuilder crosstabGroupStyle = stl.style(columnTitleStyle);
StyleBuilder crosstabGroupTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(170, 170, 170));
StyleBuilder crosstabGrandTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(140, 140, 140));
StyleBuilder crosstabCellStyle = stl.style(columnStyle).setBorder(stl.pen1Point());
TableOfContentsCustomizerBuilder tableOfContentsCustomizer = tableOfContentsCustomizer().setHeadingStyle(0,
stl.style(rootStyle).bold());
reportTemplate = template().setLocale(Locale.ENGLISH).setColumnStyle(columnStyle)
.setColumnTitleStyle(columnTitleStyle).setGroupStyle(groupStyle).setGroupTitleStyle(groupStyle)
.setSubtotalStyle(subtotalStyle).highlightDetailEvenRows().crosstabHighlightEvenRows()
.setCrosstabGroupStyle(crosstabGroupStyle).setCrosstabGroupTotalStyle(crosstabGroupTotalStyle)
.setCrosstabGrandTotalStyle(crosstabGrandTotalStyle).setCrosstabCellStyle(crosstabCellStyle)
.setTableOfContentsCustomizer(tableOfContentsCustomizer).setDefaultSplitType(SplitType.PREVENT)
.setDetailSplitType(SplitType.PREVENT);
currencyType = new CurrencyType();
HyperLinkBuilder link = hyperLink(StringPool.BLANK);
dynamicReportsComponent = cmp.horizontalList(
cmp.verticalList(
cmp.text("GENIO CIVILE").setStyle(bold15CenteredStyle)
.setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text(StringPool.BLANK)
.setStyle(italicStyle).setHyperLink(link))).setFixedWidth(300);
footerComponent = cmp.pageXofY().setStyle(stl.style(boldCenteredStyle).setTopBorder(stl.pen1Point()));
}
// Creates custom component which is possible to add to any report band component
public static ComponentBuilder<?, ?> createTitleComponent(String label) {
HorizontalListBuilder horizontalListBuilder = cmp.horizontalList();
horizontalListBuilder.add(dynamicReportsComponent, cmp.text(label).setStyle(bold15CenteredStyle)
.setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT));
horizontalListBuilder.newRow();
return horizontalListBuilder;
}
// ADT: BUG BO ID=34 - REPORT PRATICHE VIDIMATE
public static ComponentBuilder<?, ?> createTitleComponentNew(String label, String className,
HttpServletRequest request) {
if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())) {
HorizontalListBuilder horizontalListBuilder = cmp.horizontalList();
HyperLinkBuilder link = hyperLink(StringPool.BLANK);
StringBuilder stBuilder = new StringBuilder();
if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())) {
String dateMinString = ParamUtil.getString(request, "dateMin", null);
String dateMaxString = ParamUtil.getString(request, "dateMax", null);
stBuilder.append("Periodo di Osservazione: dal ");
stBuilder.append(dateMinString);
stBuilder.append(" al ");
stBuilder.append(dateMaxString);
}
ComponentBuilder<?, ?> dynamicReportsComponentNew = cmp.horizontalList(
cmp.verticalList(cmp.text(stBuilder.toString()).setStyle(bold15CenteredStyle)
.setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text(StringPool.BLANK)
.setStyle(italicStyle).setHyperLink(link))).setFixedWidth(300);
horizontalListBuilder.add(dynamicReportsComponentNew, cmp.text(label).setStyle(bold15CenteredStyle)
.setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT));
horizontalListBuilder.newRow();
return horizontalListBuilder;
} else {
return null;
}
}
public static CurrencyValueFormatter createCurrencyValueFormatter(String label) {
return new CurrencyValueFormatter(label);
}
public static class CurrencyType extends BigDecimalType {
private static final long serialVersionUID = 1L;
@Override
public String getPattern() {
return "€ #.###,00";
}
}
private static class CurrencyValueFormatter extends AbstractValueFormatter<String, Number> {
private static final long serialVersionUID = 1L;
private String label;
public CurrencyValueFormatter(String label) {
this.label = label;
}
@Override
public String format(Number value, ReportParameters reportParameters) {
return label + currencyType.valueToString(value, reportParameters.getLocale());
}
}
}

132
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java

@ -6,12 +6,9 @@ import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportResu
import it.tref.liferay.portos.report.shared.dto.ReportDto;
import it.tref.liferay.portos.report.shared.dto.ReportResultDto;
import java.io.File;
import java.io.FileOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
@ -38,9 +35,9 @@ import com.liferay.portal.kernel.messaging.Message;
import com.liferay.portal.kernel.messaging.MessageBusUtil;
import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.util.ArrayUtil;
import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.MapUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.SystemProperties;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Company;
import com.liferay.portal.model.RoleConstants;
@ -56,6 +53,7 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
public class ProtocolloMessageListener extends BaseMessageListener {
private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
private static final Log _log = LogFactoryUtil.getLog(ProtocolloMessageListener.class);
@ -64,10 +62,8 @@ public class ProtocolloMessageListener extends BaseMessageListener {
long companyId = message.getLong(ReportConstants.COMPANY_ID);
long userId = message.getLong(ReportConstants.USER_ID);
Map<String, Serializable> taskContextMap = (Map<String, Serializable>) message
.get(ReportConstants.PARAMATERS);
@SuppressWarnings("unchecked")
Map<String, Serializable> taskContextMap = (Map<String, Serializable>) message.get(ReportConstants.PARAMATERS);
User user = UserLocalServiceUtil.getRoleUsers(
RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR).getRoleId()).get(0);
try {
@ -75,155 +71,91 @@ public class ProtocolloMessageListener extends BaseMessageListener {
} catch (Exception e) {
throw new SystemException(e);
}
try {
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(MapUtil.getString(taskContextMap,
ReportConstants.PARAM_REPORTS));
JSONObject jsonObject = jsonArray.getJSONObject(0);
ReportDto reportDto = JSONFactoryUtil.looseDeserialize(jsonObject.toString(), ReportDto.class);
String protocolloToAttach = "";
long dtPraticaString = 0L;
String oggetto = "";
String protocolloToAttach = StringPool.BLANK;
long dtPraticaLong = 0L;
String oggetto = StringPool.BLANK;
if (reportDto.getParameters() != null) {
protocolloToAttach = (String) reportDto.getParameters().get("protocollo");
dtPraticaString = (Long) reportDto.getParameters().get("dtProtocollo");
dtPraticaLong = (Long) reportDto.getParameters().get("dtProtocollo");
oggetto = (String) reportDto.getParameters().get("oggetto");
}
Date dtPratica = new Date(dtPraticaString);
protocolloToAttach = finalizzaProtocollazione(companyId, protocolloToAttach, dtPratica);
protocolloToAttach = finalizzaProtocollazione(companyId, protocolloToAttach, new Date(dtPraticaLong));
long fileEntryId = reportDto.getFileEntryIds()[0];
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId);
if (Validator.isNotNull(fileEntry)) {
InputStream is = fileEntry.getContentStream();
byte[] targetArray = new byte[is.available()];
is.read(targetArray);
String tempFileNameCopy = System.getProperty(SystemProperties.TMP_DIR) + File.separator
+ "copied-files" + System.currentTimeMillis() + ".pdf";
File tempFileCopy = new File(tempFileNameCopy);
OutputStream outStreamCopiedFile = new FileOutputStream(tempFileCopy);
outStreamCopiedFile.write(targetArray);
is.close();
outStreamCopiedFile.close();
String tempFileNameModified = System.getProperty(SystemProperties.TMP_DIR) + File.separator
+ "modified-files" + System.currentTimeMillis() + ".pdf";
File tempFileModified = new File(tempFileNameModified);
FileOutputStream fileOutputStream = new FileOutputStream(tempFileModified);
PdfReader reader = new PdfReader(tempFileNameCopy);
PdfStamper stamper = new PdfStamper(reader, fileOutputStream);
InputStream inputStream = fileEntry.getContentStream();
byte[] inputBytes = new byte[inputStream.available()];
inputStream.read(inputBytes);
inputStream.close();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
PdfReader reader = new PdfReader(inputBytes);
PdfStamper stamper = new PdfStamper(reader, outputStream);
PdfWriter writer = stamper.getWriter();
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
PdfContentByte cb = stamper.getOverContent(i);
PdfLayer protocollo = new PdfLayer("not printed", writer);
protocollo.setOnPanel(false);
protocollo.setPrint("Print", false);
cb.beginLayer(protocollo);
Font font = FontFactory.getFont(FontFactory.COURIER, 9.0f);
Font font = FontFactory.getFont(FontFactory.COURIER, 9.0F);
// Gestione stringa protocollo
Rectangle pageSize = reader.getPageSize(i);
float xProtocollo = pageSize.getWidth() - 8;
float yProtocollo = pageSize.getHeight() / 3;
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(protocolloToAttach, font),
xProtocollo, yProtocollo, 90);
// Gestion stringa oggetto
// Gestione stringa oggetto
float xOggetto = pageSize.getWidth() - 8;
float yOggetto = pageSize.getHeight() - 30;
if (oggetto != null) {
if (oggetto.length() >= 75) {
oggetto = oggetto.substring(0, 75);
}
} else {
oggetto = "";
oggetto = StringPool.BLANK;
}
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(oggetto, font), xOggetto,
yOggetto, 90);
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(oggetto, font), xOggetto, yOggetto,
90);
cb.endLayer();
}
stamper.close();
reader.close();
byte[] outputBytes = outputStream.toByteArray();
outputStream.close();
ServiceContext serviceContext = new ServiceContext();
serviceContext.setUserId(userId);
serviceContext.setCompanyId(companyId);
byte[] newFilesBytes = Files.readAllBytes(tempFileModified.toPath());
fileOutputStream.close();
tempFileCopy.delete();
tempFileModified.delete();
// ADT: BUG BO ID=28
FileEntry newFileEntry = null;
try {
newFileEntry = DLAppLocalServiceUtil.addFileEntry(userId, fileEntry.getRepositoryId(),
fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", "application/pdf",
reportDto.getFileName(), "", "", newFilesBytes, serviceContext);
fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", ContentTypes.APPLICATION_PDF,
reportDto.getFileName(), StringPool.BLANK, StringPool.BLANK, outputBytes, serviceContext);
} catch (DuplicateFileException e) {
FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(),
fileEntry.getFolderId(), reportDto.getFileName());
// DLAppLocalServiceUtil.deleteFileEntry(fe.getFileEntryId());
FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), fileEntry.getFolderId(),
reportDto.getFileName());
_log.info("File duplicato : " + fe.getFileEntryId());
return;
}
tempFileCopy.delete();
tempFileModified.delete();
if (Validator.isNotNull(newFileEntry)) {
long[] fileEntryIds = new long[0];
fileEntryIds = ArrayUtil.append(fileEntryIds, newFileEntry.getFileEntryId());
ReportResultDto dto = new ReportResultDto(0L, fileEntryIds,
ReportResult.SUCCESSFUL.toString(), null);
ReportResultDto dto = new ReportResultDto(0L, fileEntryIds, ReportResult.SUCCESSFUL.toString(),
null);
Message responseMessage = MessageBusUtil.createResponseMessage(message);
responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto));
MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage);
}
}
} catch (Exception e) {
_log.error(e, e);
ReportResultDto dto = new ReportResultDto(0L, null, ReportResult.FAILED.toString(),
e.getMessage());
ReportResultDto dto = new ReportResultDto(0L, null, ReportResult.FAILED.toString(), e.getMessage());
Message responseMessage = MessageBusUtil.createResponseMessage(message);
responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto));
MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage);
}
}
@ -231,8 +163,6 @@ public class ProtocolloMessageListener extends BaseMessageListener {
private String finalizzaProtocollazione(long companyId, String protocollo, Date dtProtocollo)
throws SystemException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Company company = CompanyLocalServiceUtil.fetchCompany(companyId);
StringBuilder sb = new StringBuilder();

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

@ -13,8 +13,8 @@
##
build.namespace=portos_rep
build.number=26
build.date=1611761568046
build.number=27
build.date=1618480427939
build.auto.upgrade=true
##

2
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java

@ -3,9 +3,7 @@ package it.tref.liferay.portos.bo.shared.util;
public class ConfigurazioneConstants {
public static final String TEMPLATE_FOLDER_ID = "conf.geniocivile.template.folder.id";
public static final String ATTACHMENT_FOLDER_ID = "conf.geniocivile.attachment.folder.id";
public static final String MANUAL_AVVISO_FOLDER_ID = "conf.geniocivile.avviso.folder.id.manual";
public static final String DIGITAL_SIGNATURE_SERVICE_ADDRESS_SIGN = "conf.geniocivile.digitalSignature.serviceAddressSign";

44
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/render_form_task.jsp

@ -19,6 +19,7 @@
<%@ include file="/html/portlet/workflow_tasks/init.jsp"%>
<%
String classPkForCarichiLavoro = (String) renderRequest.getAttribute("classPkForCarichiLavoro");
boolean hasFileUpload = false;
%>
<c:if test="<%=Validator.isNotNull(classPkForCarichiLavoro)%>">
<div class="container_header_text_attivita">
@ -44,7 +45,6 @@ String redirect = StringPool.BLANK;
DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getDDMStructure(ddmStructureId);
Fields fields = null;
String languageId = themeDisplay.getLanguageId();
boolean translating = false;
long classNameId = PortalUtil.getClassNameId(DDMStructure.class);
long classPK = ddmStructure.getStructureId();
if (ddmTemplateId > 0) {
@ -72,18 +72,24 @@ for (Entry<String, List<Map<String, Serializable>>> entry : fieldNameOptions.ent
if ((name.equals("istruttore") && value.equalsIgnoreCase(istruttore)) || MapUtil.getBoolean(option, "default")) {
select += " selected=\"selected\"";
}
select += StringPool.GREATER_THAN + HtmlUtil.escape(option.get("label").toString()) + "</option>\n";
}
html = html.replaceAll(regexSelect, "$1" + select + "</select>\n" + "$3");
} else {
String regexInput = "(?s)<input(.*?)\\sname=\"" + ns + name + "_INSTANCE_[^\"]+\"(.*?)value=\"[^\"]*([^>]+).*?</label>";
for (Map<String, Serializable> option : entry.getValue()) {
for (Entry<String, Serializable> x : option.entrySet()) {
System.out.println(x.getKey() + " = " + x.getValue());
}
String value = option.get("value").toString();
String replaceInput = "<input$1 name=\"" + prefix + name + suffix + "\"$2value=\"" + HtmlUtil.escape(value);
boolean checked = MapUtil.getBoolean(option, "default");
if ((name.equals("esito") && value.equalsIgnoreCase(esito)) || MapUtil.getBoolean(option, "default")) {
replaceInput += "\" checked=\"checked";
}
if (MapUtil.getBoolean(option, "upload")) {
hasFileUpload = true;
replaceInput += "\" data-upload=\"1";
}
replaceInput += "$3>" + HtmlUtil.escape(option.get("label").toString()) + "</label>";
html = html.replaceFirst(regexInput, replaceInput);
}
@ -98,5 +104,39 @@ for (Entry<String, Serializable> p : parameters.entrySet()) {
// Rimozione valori non utilizzati
html = html.replaceAll("(?s)<input[^>]*?value=\"Value[0-9]\"[^>]*>.*?</label>", "</label>");
html = html.replaceAll("(?s)<label[^>]*>[ \t\r\n]*</label>", StringPool.BLANK);
if (hasFileUpload) {
String replace =
"$1<div id=\"fileInputOn\" style=\"display:none\"><input id=\"allegatoManuale\" type=\"file\" /></div>" +
"<script>\n" +
"var els = document.querySelectorAll('input[type=radio].field');\n" +
"for (var i = 0; i < els.length; i++) {\n" +
"els[i].addEventListener('change', function(event) {\n" +
"var upload = (this.getAttribute('data-upload') === '1');\n" +
"document.querySelector(\"[data-fieldname='testo_del_documento']\").style.display = (upload ? 'none' : '')\n" +
"document.getElementById('fileInputOn').style.display = (upload ? '' : 'none')\n" +
"});\n" +
"}\n" +
"document.getElementById('allegatoManuale').addEventListener('change', function(event) {\n" +
"var files = document.getElementById('allegatoManuale').files;\n" +
"if (files.length > 0) {\n" +
"getBase64(files[0]);\n" +
"}\n" +
"});\n" +
"function getBase64(file) {\n" +
"var reader = new FileReader();\n" +
"reader.readAsDataURL(file);\n" +
"reader.onload = function () {\n" +
"document.getElementById('testo_del_documento').value = reader.result;\n" +
"};\n" +
"reader.onerror = function (error) {\n" +
"console.log('Error: ', error);\n" +
"};\n" +
"}" +
"</script>";
System.out.println(replace);
html = html.replaceAll("(?s)(<div[^>]*? data-fieldName=\"testo_del_documento\".*?</div>)", replace);
}
%>
<%= html %>

1
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java

@ -168,6 +168,7 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction {
String transitionName = ParamUtil.getString(actionRequest, "transitionName");
String comment = ParamUtil.getString(actionRequest, "comment");
boolean aggiorna = true;
aggiorna = false;
// ADT: bug mancata problema assegnazione WF
checkPresenzaIstruttore(transitionName, workflowTaskId);
// ADT: BUG ANOMALIA REGISTRA ESITO

1
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/RenderFormTaskPortletAction.java

@ -217,6 +217,7 @@ public class RenderFormTaskPortletAction extends BaseStrutsPortletAction {
optionFields.put("label", LanguageUtil.get(locale, optionJSON.getString("label")));
optionFields.put("value", optionJSON.getString("value"));
optionFields.put("default", optionJSON.getBoolean("default"));
optionFields.put("upload", optionJSON.getBoolean("upload"));
options.add(optionFields);
}
fieldNameOptions.put(key, options);

Caricamento…
Annulla
Salva