Sfoglia il codice sorgente

Correzioni workflow per pratiche sottoposte manualmente a parere

Salvatore La Manna 4 anni fa
parent
commit
67f834fe9e
  1. 23
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.classpath
  2. 36
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.project
  3. 12
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/.jsdtscope
  4. 7
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.jdt.core.prefs
  5. 8
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.common.component
  6. 7
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
  7. 11
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.common.project.facet.core.xml
  8. 1
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.jsdt.ui.superType.container
  9. 1
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.jsdt.ui.superType.name
  10. 6
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/build.xml
  11. 3
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/META-INF/MANIFEST.MF
  12. 34
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/META-INF/custom_jsps/html/portlet/portal_settings/authentication/arpa.jsp
  13. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-common-2.1.jar
  14. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-common-spagent-1.3.1.jar
  15. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-conditional-authentication-filter-1.0.jar
  16. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-saml-common-1.1.jar
  17. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-saml2-mapper-1.3.1.jar
  18. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-spagent-filter-1.3.1.jar
  19. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-spagent-shared-1.3.1.jar
  20. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/commons-collections.jar
  21. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/commons-configuration.jar
  22. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/commons-lang.jar
  23. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/commons-logging.jar
  24. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/log4j.jar
  25. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/util-bridges.jar
  26. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/util-java.jar
  27. BIN
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/util-taglib.jar
  28. 8
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/liferay-hook.xml
  29. 15
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/liferay-plugin-package.properties
  30. 4
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/content/language.properties
  31. 230
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/util/ArpaUtils.java
  32. 45
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/util/Constants.java
  33. 74
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/util/mapper/AttributeArpaUser.java
  34. 341
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/ArpaAutoLogin.java
  35. 40
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/action/LiferayLogUserAction.java
  36. 44
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/action/LiferayLogoutSessionAction.java
  37. 11
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/action/LogLoginPostAction.java
  38. 21
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/action/LogLogoutPreAction.java
  39. 41
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/portal.properties
  40. 4
      liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/web.xml
  41. 3
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/.settings/org.eclipse.wst.common.component
  42. 531
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/ControlloPraticaAdvancedSearch.java
  43. 3
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java
  44. 3
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceUtil.java
  45. 3
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java
  46. 7
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalService.java
  47. 7
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceUtil.java
  48. 7
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceWrapper.java
  49. 1031
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java
  50. 11
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/WorkflowUtil.java
  51. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/AllegatiUtil.java
  52. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java
  53. 51
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SorteggioPraticaUtil.java
  54. 244
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/ControlloPraticaIndexer.java
  55. 220
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/AmministrazionePortlet.java
  56. 291
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java
  57. 108
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaIstruttorePortlet.java
  58. 373
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java
  59. 156
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/TempistichePortlet.java
  60. 314
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java
  61. 96
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java
  62. 363
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java
  63. 53
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DelegaLocalServiceImpl.java
  64. 424
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java
  65. 151
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/PagamentiUtil.java
  66. 111
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java
  67. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  68. 58
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/miei_task.jsp
  69. 62
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/task_miei_ruoli.jsp
  70. 129
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/view_columns.jspf
  71. 972
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java
  72. 514
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/SoggettiPraticaPortlet.java
  73. 3
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/soggettipratica/edit_soggetto.jsp
  74. 53
      liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java
  75. 207
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java
  76. 63
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailSenderUtil.java
  77. 44
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java
  78. 18
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/modellistener/shared/core/ModelListenerHotDeployListener.java
  79. 61
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/modellistener/shared/core/ModelListenerInvocationHandler.java
  80. 10
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/modellistener/shared/core/ModelListenerPool.java
  81. 11
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/modellistener/shared/event/ModelListenerStartupAction.java
  82. 11
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/CronostoriaBean.java
  83. 1
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/CronostoriaLink.java
  84. 1
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/CronostoriaTypeEnum.java
  85. 8
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/IstruttoreBean.java
  86. 17
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/ParereGeologoBean.java
  87. 7
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/File.java
  88. 23
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/Constants.java
  89. 36
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/FascicoloURLUtil.java
  90. 16
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/FirmeUtil.java
  91. 17
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ParamUtil.java
  92. 44
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/TipoIntegrazioneUtil.java
  93. 78
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/TipoSoggettoUtil.java
  94. 20
      liferay-plugins-sdk-6.2/shared/portos-report-shared/src/it/tref/liferay/portos/report/shared/constants/ReportConstants.java
  95. 11
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/.classpath
  96. 7
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/.settings/org.eclipse.jdt.core.prefs
  97. 2
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/.settings/org.eclipse.wst.common.project.facet.core.xml
  98. 2
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/build.xml
  99. 75
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_instances/workflow_task_action.jsp
  100. 52
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_tasks/edit_workflow_task.jsp
  101. Some files were not shown because too many files have changed in this diff Show More

23
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.classpath

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="docroot/WEB-INF/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_79">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.liferay.ide.eclipse.server.tomcat.runtimeClasspathProvider/Liferay v6.2 CE (Tomcat 7)">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="com.liferay.ide.eclipse.server.plugin.container/hook">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/home/portos/sources/portos-src/liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-common-2.1.jar"/>
<classpathentry kind="output" path="docroot/WEB-INF/classes"/>
</classpath>

36
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.project

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lr-arpa-al-hook</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

12
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/.jsdtscope

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="docroot"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

7
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.jdt.core.prefs

@ -1,7 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

8
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.common.component

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="lr-arpa-al-hook">
<wb-resource deploy-path="/" source-path="/docroot" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/docroot/WEB-INF/src"/>
<property name="context-root" value="lr-arpa-al-hook"/>
<property name="java-output-path" value="/lr-arpa-al-hook/docroot/WEB-INF/classes"/>
</wb-module>
</project-modules>

7
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml

@ -1,7 +0,0 @@
<root>
<facet id="liferay.hook">
<node name="libprov">
<attribute name="provider-id" value="com.liferay.ide.eclipse.plugin.hook.libraryProvider"/>
</node>
</facet>
</root>

11
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.common.project.facet.core.xml

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Liferay v6.2 CE (Tomcat 7)"/>
<fixed facet="jst.web"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="java"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="liferay.hook" version="6.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

1
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.jsdt.ui.superType.container

@ -1 +0,0 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

1
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/.settings/org.eclipse.wst.jsdt.ui.superType.name

@ -1 +0,0 @@
Window

6
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/build.xml

@ -1,6 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="lr-arpa-al-hook" basedir="." default="deploy">
<import file="../build-common-hook.xml" />
</project>

3
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/META-INF/MANIFEST.MF

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Class-Path:

34
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/META-INF/custom_jsps/html/portlet/portal_settings/authentication/arpa.jsp

@ -1,34 +0,0 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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.
*/
--%>
<%@ include file="/html/portlet/portal_settings/init.jsp" %>
<%
boolean arpaAuthEnabled = PrefsPropsUtil.getBoolean(company.getCompanyId(), _ARPA_AUTH_ENABLED_KEY, _ARPA_AUTH_ENABLED_VALUE);
%>
<aui:fieldset>
<aui:input label="enabled" name='<%= "settings--" + _ARPA_AUTH_ENABLED_KEY + "--" %>' type="checkbox" value="<%= arpaAuthEnabled %>" />
</aui:fieldset>
<%!
private static final String _ARPA_AUTH_ENABLED_KEY = "arpa.auth.enabled";
private static final boolean _ARPA_AUTH_ENABLED_VALUE = GetterUtil.getBoolean(PropsUtil.get(_ARPA_AUTH_ENABLED_KEY));
%>

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-common-2.1.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-common-spagent-1.3.1.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-conditional-authentication-filter-1.0.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-saml-common-1.1.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-saml2-mapper-1.3.1.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-spagent-filter-1.3.1.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/arpa-spagent-shared-1.3.1.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/commons-collections.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/commons-configuration.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/commons-lang.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/commons-logging.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/log4j.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/util-bridges.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/util-java.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/lib/util-taglib.jar

File binario non mostrato.

8
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/liferay-hook.xml

@ -1,8 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook>
<portal-properties>portal.properties</portal-properties>
<language-properties>content/language.properties</language-properties>
<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
</hook>

15
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/liferay-plugin-package.properties

@ -1,15 +0,0 @@
name=ARPA AutoLogin
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
long-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=LGPL
liferay-versions=6.2+
portal-dependency-jars=\
commons-configuration.jar,\
commons-lang.jar,\
commons-collections.jar

4
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/content/language.properties

@ -1,4 +0,0 @@
arpa=Arpa
arpa-login-url = Url di Accreditamento
arpa-redirect-url = Chiave per il redirect
arpa-redirect-url-encoded = Redirect Url Codificato

230
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/util/ArpaUtils.java

@ -1,230 +0,0 @@
package it.toscana.regione.arpa.al.util;
import it.toscana.regione.arpa.common.ArpaSSOProxy;
import it.toscana.regione.arpa.common.ArpaUser;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.model.User;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.util.PortalUtil;
public class ArpaUtils {
protected static Log _log = LogFactoryUtil.getLog(ArpaUtils.class);
public static ArpaUser getUser(ArpaSSOProxy proxy) {
ArpaUser user = proxy.getAuthenticatedUser();
if (user != null) {
_log.debug("Authenticated User is : " + user);
} else {
_log.warn("Authenticated User is null");
}
ArpaUser delegatingUser = proxy.getDelegatingUser();
if (delegatingUser != null) {
_log.debug("Delegating User is : " + delegatingUser);
user = delegatingUser;
} else {
_log.debug("Delegating User is null");
}
return user;
}
public static String getUserInfo(HttpServletRequest request) {
String result = null;
try {
User user = PortalUtil.getUser(request);
String userId = "";
String screename = "";
if (user != null) {
userId = String.valueOf(user.getUserId());
screename = user.getScreenName();
} else {
_log.debug("Liferay User is null");
}
result = userId + "," + screename;
} catch (Exception e) {
_log.error("Error getting Liferay User ", e);
}
_log.debug("Returning message result = " + result);
return result;
}
public static String getUserInfo(HttpSession session) {
Long userId = (Long) session.getAttribute("USER_ID");
String result = null;
if (userId != null) {
try {
User user = UserLocalServiceUtil.fetchUserById(userId.longValue());
String screename = "";
if (user != null) {
screename = user.getScreenName();
} else {
_log.debug("Liferay User is null");
}
result = userId + "," + screename;
} catch (Exception e) {
_log.error("Error getting user with id " + userId, e);
}
}
return result;
}
public static boolean isArpaAuthenticated(HttpSession session) {
boolean isArpaAuthenticated = false;
if (session != null) {
_log.debug("Getting session attribute with key = _ARPA_AUTOLOGIN_AUTHENTICATED");
Object arpaAuthenticated = session.getAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED");
_log.debug("Getted session attribute with key = _ARPA_AUTOLOGIN_AUTHENTICATED and value = "
+ arpaAuthenticated);
if (arpaAuthenticated != null) {
if ((arpaAuthenticated instanceof Boolean)) {
isArpaAuthenticated = ((Boolean) arpaAuthenticated).booleanValue();
}
}
}
if (isArpaAuthenticated) {
_log.debug("User is authenticated width Arpa ");
} else {
_log.debug("User is not authenticated width Arpa ");
}
return isArpaAuthenticated;
}
public static boolean isArpaAuthenticated(HttpServletRequest request) {
HttpSession session = request.getSession();
return isArpaAuthenticated(session);
}
public static void markAuthenticated(HttpSession session, ArpaUser realUser, ArpaUser arpaUser) {
boolean authenticated = true;
if (arpaUser != null) {
_log.debug("Setting session attribute key = _ARPA_AUTOLOGIN_AUTHENTICATED_EMAIL value = "
+ arpaUser.getEmailAddress());
session.setAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED_EMAIL", arpaUser.getEmailAddress());
_log.debug("Setting session attribute key = _ARPA_AUTOLOGIN_AUTHENTICATED_CF value = "
+ arpaUser.getCf());
session.setAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED_CF", arpaUser.getCf());
}
if (realUser != null) {
_log.debug("Setting session attribute key = _ARPA_AUTOLOGIN_REAL_AUTHENTICATED_CF value = "
+ realUser.getCf());
session.setAttribute("_ARPA_AUTOLOGIN_REAL_AUTHENTICATED_CF", realUser.getCf());
}
if (arpaUser != null) {
_log.debug("Setting session attribute key = _ARPA_AUTOLOGIN_AUTHENTICATED value = "
+ authenticated);
}
session.setAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED", Boolean.valueOf(authenticated));
}
public static String getArpaUserInfo(HttpSession session) {
boolean isArpaAuthenticated = isArpaAuthenticated(session);
String result = null;
Object realCf = null;
Object cf = null;
if ((isArpaAuthenticated) && (session != null)) {
_log.debug("Getting session attribute with key = _ARPA_AUTOLOGIN_REAL_AUTHENTICATED_CF");
realCf = session.getAttribute("_ARPA_AUTOLOGIN_REAL_AUTHENTICATED_CF");
_log.debug("Getted session attribute with key = _ARPA_AUTOLOGIN_REAL_AUTHENTICATED_CF and value = "
+ realCf);
}
_log.debug("Getting session attribute with key = _ARPA_AUTOLOGIN_AUTHENTICATED_CF");
cf = session.getAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED_CF");
_log.debug("Getted session attribute with key = _ARPA_AUTOLOGIN_AUTHENTICATED_CF and value = " + cf);
if (cf == null) {
cf = "";
}
if (realCf == null) {
realCf = "";
}
result = isArpaAuthenticated + "," + cf + "," + realCf;
_log.debug("Returning result message = " + result);
return result;
}
public static String getArpaUserInfo(HttpServletRequest request) {
return getArpaUserInfo(request.getSession());
}
public static boolean isLogoutAlreadyCalled(HttpServletRequest request) {
boolean result = false;
HttpSession session = request.getSession(false);
result = isLogoutAlreadyCalled(session);
return result;
}
public static boolean isLogoutAlreadyCalled(HttpSession session) {
boolean result = false;
if (session != null) {
_log.debug("Getting session attribute _ARPA_AUTOLOGIN_LOGOUT_LOG_CALLED");
Object value = session.getAttribute("_ARPA_AUTOLOGIN_LOGOUT_LOG_CALLED");
if (_log.isDebugEnabled()) {
_log.debug("Session attribute _ARPA_AUTOLOGIN_LOGOUT_LOG_CALLED = " + value);
}
result = value != null;
}
return result;
}
public static void markLogoutCalled(HttpSession session) {
_log.debug("Setting session attribute _ARPA_AUTOLOGIN_LOGOUT_LOG_CALLED = true");
if (session != null) {
session.setAttribute("_ARPA_AUTOLOGIN_LOGOUT_LOG_CALLED", Boolean.valueOf(true));
} else if (_log.isDebugEnabled())
_log.debug("Could not set session attribute _ARPA_AUTOLOGIN_LOGOUT_LOG_CALLED = true because session is null");
}
public static void markLogoutCalled(HttpServletRequest request) {
HttpSession session = request.getSession(false);
markLogoutCalled(session);
}
}

45
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/util/Constants.java

@ -1,45 +0,0 @@
package it.toscana.regione.arpa.al.util;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.PropsUtil;
public interface Constants extends com.liferay.portal.kernel.util.Constants {
public static final String _ARPA_AUTH_ENABLED_KEY = "arpa.auth.enabled";
public static final boolean _ARPA_AUTH_ENABLED_VALUE = GetterUtil.getBoolean(PropsUtil.get(_ARPA_AUTH_ENABLED_KEY));
public static final String EMAIL_ATTRIBUTE = "emailAddress";
/*
* public static final String DEFAULT_PARAMETER_LOGOUT_LOG_ALREADY_CALLED =
* "_ARPA_AUTOLOGIN_LOGOUT_LOG_CALLED"; public static final String ARPA_AUTHENTICATED_PARAMETER =
* "_ARPA_AUTOLOGIN_AUTHENTICATED"; public static final String ARPA_AUTHENTICATED_CF_PARAMETER =
* "_ARPA_AUTOLOGIN_AUTHENTICATED_CF"; public static final String
* ARPA_AUTHENTICATED_REAL_CF_PARAMETER = "_ARPA_AUTOLOGIN_REAL_AUTHENTICATED_CF"; public static
* final String ARPA_AUTHENTICATED_EMAIL_PARAMETER = "_ARPA_AUTOLOGIN_AUTHENTICATED_EMAIL"; public
* static final String INVALIDATE_SESSION_DEFAULT_MESSAGE_PRE = "SessionInvalidated"; public
* static final String LOGIN_DEFAULT_MESSAGE_PRE = "Login"; public static final String
* LOGOUT_DEFAULT_MESSAGE_PRE = "Logout"; public static final String USER_UPDATE_USER_ASSOCIATION
* = "arpa.roledecoder.updateuserassociation"; public static final boolean
* DEFAULT_USER_UPDATE_USER_ASSOCIATION = true; public static final String AUTENTICATING_ARPA_USER
* = "arpa.agent.user.authenticating"; public static final String EMAIL_NULL_AUTOGENERATE =
* "arpa.createuser.null.email.autogenerate"; public static final String
* EMAIL_ADDRESS_USER_AUTHENTICATE_PARAMETER = "arpa.authenticate.emailaddress"; public static
* final boolean DEFAULT_EMAIL_SEND_AFTER_CREATE_USER = false; public static final String
* EMAIL_SEND_AFTER_CREATE_USER = "arpa.createuser.emailsend"; public static final String
* USER_NULL_AUTOGENERATE = "arpa.roledecoder.autocreateuser"; public static final boolean
* DEFAULT_USER_NULL_AUTOGENERATE = true; public static final boolean
* DEFAULT_EMAIL_NULL_AUTOGENERATE = true; public static final boolean
* DEFAULT_AGREED_TO_TERMS_AFTER_CREATE_USER = false; public static final boolean
* DEFAULT_AGREED_TO_TERMS_AUTOGENERATED_EMAIL = false; public static final String
* AGREED_TO_TERMS_AUTOGENERATED_EMAIL = "arpa.createuser.agreedToTerms.view.email.autogenerate";
* public static final String AGREED_TO_TERMS_AFTER_CREATE_USER =
* "arpa.createuser.agreedToTerms.ignore"; public static final String
* USERGROUP_AUTOCREATE_PARAMETER = "arpa.roledecoder.autocreateusergroup"; public static final
* String ORGANIZATION_AUTOCREATE_PARAMETER = "arpa.roledecoder.autocreateorganization"; public
* static final String USERDAO_IMPL_PARAMETER = "arpa.userdao.impl"; public static final String
* AUTO_LOGIN_REDIRECT_AND_CONTINUE_ENABLED_PARAMETER =
* "arpa.authenticate.loginredirectandcontinue.enabled"; public static final boolean
* DEFAULT_AUTO_LOGIN_REDIRECT_AND_CONTINUE_ENABLED_PARAMETER = true;
*/
// public static final String ROLE_DECODER_LOCATION_PARAMETER = "arpa.roledecoder.location";
// public static final String ROLE_AUTOCREATE_PARAMETER = "arpa.roledecoder.autocreaterole";
// public static final String AGENT_CHECK_PARAMETER = "arpa.agent.attribute.verify";
}

74
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/util/mapper/AttributeArpaUser.java

@ -1,74 +0,0 @@
package it.toscana.regione.arpa.al.util.mapper;
import it.toscana.regione.arpa.common.ArpaAttribute;
import it.toscana.regione.arpa.common.ArpaSSOProxy;
import it.toscana.regione.arpa.common.ArpaUser;
import java.util.Collection;
public class AttributeArpaUser implements ArpaUser {
private ArpaSSOProxy proxy;
private ArpaUser target;
public AttributeArpaUser(ArpaSSOProxy proxy, ArpaUser target) {
this.proxy = proxy;
this.target = target;
}
public String getBirthcc() {
return this.target == null ? null : this.target.getBirthcc();
}
public String getBirthday() {
return this.target == null ? null : this.target.getBirthday();
}
public String getCf() {
return this.target == null ? null : this.target.getCf();
}
public String getName() {
return this.target == null ? null : this.target.getName();
}
public String getSurname() {
return this.target == null ? null : this.target.getSurname();
}
public ArpaSSOProxy getProxy() {
return this.proxy;
}
public String getEmailAddress() {
String email = this.target == null ? null : this.target.getEmailAddress();
return email;
}
public String getAttribute(String attributeName) {
return getSingleAttribute(this.proxy.getWorkingAttributes(attributeName));
}
private static String getSingleAttribute(ArpaAttribute arpaAttribute) {
if (arpaAttribute != null) {
Collection values = arpaAttribute.getValues();
if ((values != null) && (values.size() > 0)) {
return values.iterator().next().toString();
}
}
return null;
}
private static String getSingleAttribute(Collection attributeSet) {
ArpaAttribute arpaAttribute = getArpaAttribute(attributeSet);
return getSingleAttribute(arpaAttribute);
}
private static ArpaAttribute getArpaAttribute(Collection attributeSet) {
if ((attributeSet != null) && (attributeSet.size() > 0)) {
ArpaAttribute atrribute = (ArpaAttribute) attributeSet.iterator().next();
return atrribute;
}
return null;
}
}

341
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/ArpaAutoLogin.java

@ -1,341 +0,0 @@
package it.toscana.regione.arpa.al.version6_2;
import it.toscana.regione.arpa.al.util.ArpaUtils;
import it.toscana.regione.arpa.al.util.Constants;
import it.toscana.regione.arpa.al.util.mapper.AttributeArpaUser;
import it.toscana.regione.arpa.common.ArpaException;
import it.toscana.regione.arpa.common.ArpaProxyFactoryLocator;
import it.toscana.regione.arpa.common.ArpaSSOProxy;
import it.toscana.regione.arpa.common.ArpaUser;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.NoSuchUserException;
import com.liferay.portal.kernel.exception.PortalException;
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.FriendlyURLNormalizerUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.PrefsPropsUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.User;
import com.liferay.portal.security.auth.AutoLogin;
import com.liferay.portal.security.auth.AutoLoginException;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.util.PortalUtil;
public class ArpaAutoLogin implements AutoLogin {
private static final Log _log = LogFactoryUtil.getLog(ArpaAutoLogin.class);
public final String[] login(HttpServletRequest request, HttpServletResponse response)
throws AutoLoginException {
String[] result = doLogin(request, response);
if ((result != null) && (result.length > 0)) {
long companyId = PortalUtil.getCompanyId(request);
boolean enabled = true;
try {
enabled = PrefsPropsUtil.getBoolean(companyId,
"arpa.authenticate.loginredirectandcontinue.enabled", Boolean.valueOf(true));
} catch (SystemException e) {
_log.error(e, e);
}
if (enabled) {
String currentURL = PortalUtil.getCurrentURL(request);
_log.trace("Cecking if currentURL " + currentURL + " contains /portal/login");
if (currentURL.contains("/portal/login")) {
String redirect = ParamUtil.getString(request, "redirect");
if (Validator.isNotNull(redirect)) {
_log.debug("Setting AUTO_LOGIN_REDIRECT_AND_CONTINUE parameter to " + redirect);
request.setAttribute("AUTO_LOGIN_REDIRECT_AND_CONTINUE", redirect);
}
}
} else {
_log.trace("Function AUTO_LOGIN_REDIRECT_AND_CONTINUE is not enabled");
}
}
return result;
}
protected String[] doLogin(HttpServletRequest request, HttpServletResponse response) {
String[] result = null;
User user = null;
long companyId = PortalUtil.getCompanyId(request);
boolean arpaAuthEnabled = false;
try {
arpaAuthEnabled = PrefsPropsUtil.getBoolean(companyId, Constants._ARPA_AUTH_ENABLED_KEY,
Constants._ARPA_AUTH_ENABLED_VALUE);
} catch (SystemException e) {
_log.error(e, e);
}
if (arpaAuthEnabled) {
_log.debug("3F: autenticazione arpa abilitata");
String agentCheckParameterName = StringPool.BLANK;
try {
agentCheckParameterName = PrefsPropsUtil.getString(companyId, "arpa.agent.attribute.verify");
} catch (SystemException e) {
_log.error(e, e);
}
boolean canContinue = true;
Object agentCheckValue = null;
if ((agentCheckParameterName != null) && (agentCheckParameterName.trim().length() > 0)) {
_log.debug("3F: entro qui");
_log.debug("Try to get agent Check attribute from request " + agentCheckParameterName);
canContinue = false;
agentCheckValue = request.getAttribute(agentCheckParameterName);
if (agentCheckValue != null) {
canContinue = true;
_log.debug("Value of AgentCheckParameter " + agentCheckValue);
if ((agentCheckValue instanceof Boolean)) {
canContinue = ((Boolean) agentCheckValue).booleanValue();
}
} else
_log.debug("Agent Check attribute is null");
}
boolean authenticated = false;
if (canContinue) {
_log.debug("3F: sono abilitato ad autenticare");
try {
ArpaSSOProxy proxy = ArpaProxyFactoryLocator.getInstance(request);
if (proxy != null) {
_log.debug("3F: provo ad autenticare");
ArpaUser arpaUser = ArpaUtils.getUser(proxy);
if (arpaUser != null) {
request.setAttribute("arpa.agent.user.authenticating", arpaUser);
arpaUser = new AttributeArpaUser(proxy, arpaUser);
_log.debug("Try to login user " + arpaUser);
try {
user = createUserIfnotExist(companyId, arpaUser);
} catch (Exception portalException) {
_log.error("Error Getting or Adding User " + arpaUser.getCf(),
portalException);
}
if (user != null) {
result = makeCredentials(user);
authenticated = true;
try {
_log.debug("Setting request and session attribute key = _ARPA_AUTOLOGIN_AUTHENTICATED_EMAIL value = "
+ arpaUser.getEmailAddress());
request.setAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED_EMAIL",
arpaUser.getEmailAddress());
request.getSession().setAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED_EMAIL",
arpaUser.getEmailAddress());
_log.debug("Setting request and session attribute key = _ARPA_AUTOLOGIN_AUTHENTICATED_CF value = "
+ arpaUser.getCf());
request.setAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED_CF", arpaUser.getCf());
request.getSession().setAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED_CF",
arpaUser.getCf());
ArpaUser realUser = proxy.getAuthenticatedUser();
_log.debug("Setting request and session attribute key = _ARPA_AUTOLOGIN_REAL_AUTHENTICATED_CF value = "
+ realUser.getCf());
request.setAttribute("_ARPA_AUTOLOGIN_REAL_AUTHENTICATED_CF",
realUser.getCf());
request.getSession().setAttribute(
"_ARPA_AUTOLOGIN_REAL_AUTHENTICATED_CF", realUser.getCf());
} catch (Exception e) {
_log.error("Cannot Setting Parameter on request and session, caused by",
e);
}
}
} else {
_log.warn("ArpaUser is null");
}
}
} catch (ArpaException e) {
_log.error("Error getting ArpaUser", e);
}
} else {
_log.debug("Request is not processed because request parameter " + agentCheckParameterName
+ " is = " + agentCheckValue);
}
if ((result != null) && (result.length >= 3)) {
_log.debug("Credentials:[" + result[0] + "][" + result[1] + "][" + result[2] + "]");
} else {
_log.debug("No Authenticated User");
}
_log.debug("Setting request and session attribute key = _ARPA_AUTOLOGIN_AUTHENTICATED value = "
+ authenticated);
request.setAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED", Boolean.valueOf(authenticated));
request.getSession()
.setAttribute("_ARPA_AUTOLOGIN_AUTHENTICATED", Boolean.valueOf(authenticated));
}
return result;
}
protected User createUserIfnotExist(long companyId, ArpaUser arpaUser) throws PortalException,
SystemException {
User user = null;
if (arpaUser != null) {
String screenName = arpaUser.getCf();
screenName = FriendlyURLNormalizerUtil.normalize(screenName);
user = UserLocalServiceUtil.fetchUserByScreenName(companyId, screenName);
if (user == null) {
_log.info("L'utente [" + arpaUser.getCf()
+ "] non e' censito. Tento Creazione Utente nel Sistema");
boolean male = true;
int birthdayMonth = 0;
int birthdayDay = 1;
int birthdayYear = 1970;
String jobTitle = StringPool.BLANK;
String openId = StringPool.BLANK;
long[] groupIds = null;
long[] organizationIds = null;
long[] roleIds = null;
long[] userGroupIds = null;
long facebookId = 0l;
boolean autoPassword = true;
String password1 = "replaceme";
String password2 = "replaceme";
boolean autoScreenName = false;
boolean sendEmailToUser = false;
Locale locale = Locale.ITALY;
ServiceContext serviceContext = new ServiceContext();
String userScreenName = arpaUser.getCf();
long creatorUserId = UserLocalServiceUtil.getDefaultUserId(companyId);
String emailAddress = arpaUser.getEmailAddress();
String firstName = arpaUser.getName();
if ((firstName == null) || (firstName.trim().length() <= 0)) {
firstName = screenName;
}
String middleName = StringPool.BLANK;
String lastName = arpaUser.getSurname();
if ((lastName == null) || (lastName.trim().length() <= 0)) {
lastName = screenName;
}
try {
user = UserLocalServiceUtil.addUser(creatorUserId, companyId, autoPassword, password1,
password2, autoScreenName, screenName, emailAddress, facebookId, openId, locale,
firstName, middleName, lastName, 0, 0, male, birthdayMonth, birthdayDay,
birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds,
sendEmailToUser, serviceContext);
_log.info("Ho aggiunto il nuovo utente [" + userScreenName + "].");
} catch (Exception e) {
throw new PortalException("Error Adding user on Liferay", e);
}
} else {
_log.warn("The User already Exist, Ignoring add user = " + user);
}
}
return user;
}
protected User loginUser(long companyId, ArpaUser arpaUser) throws PortalException, SystemException {
String userScreenName = arpaUser.getCf();
User user = null;
if (arpaUser != null) {
try {
user = UserLocalServiceUtil.getUserByScreenName(companyId, userScreenName);
_log.info("L'utente [" + userScreenName + "] e' gia' censito.");
} catch (NoSuchUserException ex) {
boolean authenticateWithEmailAddress = PrefsPropsUtil.getBoolean(companyId,
"arpa.authenticate.emailaddress", Boolean.valueOf(false));
if (authenticateWithEmailAddress) {
String emailAddress = arpaUser.getEmailAddress();
if ((emailAddress != null) && (emailAddress.trim().length() > 0)) {
try {
_log.info("L'utente [" + userScreenName
+ "] non e' censito con lo screename, Provo con l'email address.");
user = UserLocalServiceUtil.getUserByEmailAddress(companyId, emailAddress);
_log.info("L'utente [" + userScreenName
+ "] e' gia' censito con l'indirizzo email " + emailAddress + ".");
} catch (NoSuchUserException ex2) {
_log.info("L'utente [" + userScreenName
+ "] non e' censito con l'indirizzo email " + emailAddress + ". ");
} catch (PortalException e) {
_log.info("L'utente [" + userScreenName
+ "] non e' censito con l'indirizzo email " + emailAddress + ". ", e);
} catch (SystemException e) {
_log.info("L'utente [" + userScreenName
+ "] non e' censito con l'indirizzo email " + emailAddress + ". ", e);
}
}
} else {
_log.info("L'utente ["
+ userScreenName
+ "] non e' censito con lo screename, non provo con l'email address perche' la funzione e' disabilitata.");
}
}
}
return user;
}
protected String[] makeCredentials(User user) {
String[] retval = null;
if (user != null) {
retval = new String[3];
retval[0] = String.valueOf(user.getUserId());
retval[1] = user.getPassword();
retval[2] = Boolean.FALSE.toString();
}
return retval;
}
@Override
public String[] handleException(HttpServletRequest request, HttpServletResponse response, Exception e)
throws AutoLoginException {
_log.error(e);
return null;
}
}

40
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/action/LiferayLogUserAction.java

@ -1,40 +0,0 @@
package it.toscana.regione.arpa.al.version6_2.action;
import com.liferay.portal.kernel.events.Action;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import it.toscana.regione.arpa.al.util.ArpaUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public abstract class LiferayLogUserAction extends Action {
protected static Log _log = LogFactoryUtil.getLog(LiferayLogUserAction.class);
public abstract String getMessagePre(HttpServletRequest request);
public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {
try {
String remoteInfo = "Host = " + request.getRemoteHost() + ", Port= " + request.getRemotePort();
_log.debug("Running " + remoteInfo + ", User = " + request.getRemoteUser());
HttpSession session = request.getSession();
if (session != null) {
String message = "[" + getMessagePre(request) + "," + ArpaUtils.getUserInfo(request) + ","
+ ArpaUtils.getArpaUserInfo(request) + "]";
_log.info(message);
_log.debug("Getting session attribute with key = _ARPA_AUTOLOGIN_AUTHENTICATED");
}
} catch (Exception e) {
_log.error("Error executing operations", e);
}
}
}

44
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/action/LiferayLogoutSessionAction.java

@ -1,44 +0,0 @@
package it.toscana.regione.arpa.al.version6_2.action;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.SessionAction;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import it.toscana.regione.arpa.al.util.ArpaUtils;
import javax.servlet.http.HttpSession;
public class LiferayLogoutSessionAction extends SessionAction {
private static Log _log = LogFactoryUtil.getLog(LiferayLogoutSessionAction.class);
@Override
public void run(HttpSession session) throws ActionException {
if (_log.isDebugEnabled()) {
_log.debug("Called");
}
if (session != null) {
String userInfo = ArpaUtils.getUserInfo(session);
if (userInfo != null) {
if (!ArpaUtils.isLogoutAlreadyCalled(session)) {
String message =
"[" + getMessagePre(session) + "," + userInfo + "," + ArpaUtils.getArpaUserInfo(session) + "]";
_log.info(message);
} else {
_log.debug("Do no print message because session invalidation _log is already printed");
}
} else
_log.debug("Do no print message because user is not authenticated");
}
}
protected String getMessagePre(HttpSession session) {
return "SessionInvalidated";
}
}

11
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/action/LogLoginPostAction.java

@ -1,11 +0,0 @@
package it.toscana.regione.arpa.al.version6_2.action;
import javax.servlet.http.HttpServletRequest;
public class LogLoginPostAction extends LiferayLogUserAction {
@Override
public String getMessagePre(HttpServletRequest request) {
return "Login";
}
}

21
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/it/toscana/regione/arpa/al/version6_2/action/LogLogoutPreAction.java

@ -1,21 +0,0 @@
package it.toscana.regione.arpa.al.version6_2.action;
import com.liferay.portal.kernel.events.ActionException;
import it.toscana.regione.arpa.al.util.ArpaUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LogLogoutPreAction extends LiferayLogUserAction {
public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {
super.run(request, response);
ArpaUtils.markLogoutCalled(request);
}
@Override
public String getMessagePre(HttpServletRequest request) {
return "Logout";
}
}

41
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/src/portal.properties

@ -1,41 +0,0 @@
#Wed Feb 26 17:06:52 CET 2014
company.settings.form.authentication=arpa
#login.form.navigation.pre=arpa
# Se true vuol dire che il sistema ARPA è attivo
arpa.auth.enabled = true
# paramerto da passare per il backurl
arpa.redirect.url = backurl
# se true significa che manderò l'indirizzo di back codificato html
arpa.redirect.encoded = true
#########################################################################
# #
# Proprieta' ARPA PLUGIN da settare nel file portal-ext.properties #
# #
#########################################################################
#Se true, si salta la verifica dell'agent attribute nella request
#arpa.function.mode.test=false
#Indica se inviare la mail con password all'utente non registrato che accede con arpa
#arpa.createuser.emailsend=true
#Permette al sistema la generazione automatica di un indirizzo email nel caso non fosse presente in Arpa oppure già presente in liferay (default true)
#arpa.createuser.null.email.autogenerate=true
#Evita la visualizzazione del messaggio di accettazione delle policy
#arpa.createuser.agreedToTerms.ignore=true
#Per la versione 6.2 utilizzare questa configurazione
auto.login.hooks=it.toscana.regione.arpa.al.version6_2.ArpaAutoLogin
logout.events.pre=it.toscana.regione.arpa.al.version6_2.action.LogLogoutPreAction
logout.events.post=it.toscana.regione.arpa.al.version6_2.action.LogLoginPostAction
servlet.session.destroy.events=it.toscana.regione.arpa.al.version6_2.action.LiferayLogoutSessionAction
##OLD properties
#Indica al modulo di autenticazione dove cercare il file per il mapping dei ruoli
#arpa.roledecoder.location=liferayMapper.xml
#Se true, indica al modulo di autenticazione se creare automaticamente il ruolo nel caso non fosse trovato all'interno di Liferay
#arpa.roledecoder.autocreaterole=true
#Non permette la modifica via gui dell'attributo screename
#Indica il nome dell'attributo all'interno della request per verificare se la richiesta e' stata elaborata dall'agent.
#arpa.agent.attribute.verify=_ARPA_ENFORCED_URL

4
liferay-plugins-sdk-6.2/hooks/lr-arpa-al-hook/docroot/WEB-INF/web.xml

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
</web-app>

3
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/.settings/org.eclipse.wst.common.component

@ -6,9 +6,6 @@
<dependent-module archiveName="hms-taglib-hook-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/hms-taglib-hook/docroot/WEB-INF/lib/hms-taglib-hook-service.jar"> <dependent-module archiveName="hms-taglib-hook-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/hms-taglib-hook/docroot/WEB-INF/lib/hms-taglib-hook-service.jar">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="portos-mail-manager-portlet-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/portos-mail-manager-portlet/docroot/WEB-INF/lib/portos-mail-manager-portlet-service.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="portos-kaleo-portlet-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/portos-kaleo-portlet/docroot/WEB-INF/lib/portos-kaleo-portlet-service.jar"> <dependent-module archiveName="portos-kaleo-portlet-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/portos-kaleo-portlet/docroot/WEB-INF/lib/portos-kaleo-portlet-service.jar">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>

531
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/ControlloPraticaAdvancedSearch.java

File diff soppresso perché troppo grande Load Diff

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

@ -377,8 +377,7 @@ public interface ControlloPraticaLocalService extends BaseLocalService,
com.liferay.portal.kernel.exception.SystemException; com.liferay.portal.kernel.exception.SystemException;
/** /**
* I valori di ritorno possibili sono: * I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
* approvato,non_approvato,annullato,richiesta_integrazione
* *
* @throws SystemException * @throws SystemException
* @throws PortalException * @throws PortalException

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

@ -438,8 +438,7 @@ public class ControlloPraticaLocalServiceUtil {
} }
/** /**
* I valori di ritorno possibili sono: * I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
* approvato,non_approvato,annullato,richiesta_integrazione
* *
* @throws SystemException * @throws SystemException
* @throws PortalException * @throws PortalException

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

@ -466,8 +466,7 @@ public class ControlloPraticaLocalServiceWrapper
} }
/** /**
* I valori di ritorno possibili sono: * I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
* approvato,non_approvato,annullato,richiesta_integrazione
* *
* @throws SystemException * @throws SystemException
* @throws PortalException * @throws PortalException

7
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalService.java

@ -318,8 +318,8 @@ public interface IntPraticaLocalService extends BaseLocalService,
throws java.lang.Throwable; throws java.lang.Throwable;
/** /**
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per * Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia. Modificata secondo il
* codice provincia. Modificata secondo il D.D.G. 334/2020 * D.D.G. 334/2020
* *
* @author Manifattura Web Group per Regione Siciliana. * @author Manifattura Web Group per Regione Siciliana.
*/ */
@ -329,8 +329,7 @@ public interface IntPraticaLocalService extends BaseLocalService,
com.liferay.portal.kernel.exception.SystemException; com.liferay.portal.kernel.exception.SystemException;
/** /**
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per * Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia.
* codice provincia.
* *
* @author Manifattura Web Group per Regione Siciliana. * @author Manifattura Web Group per Regione Siciliana.
*/ */

7
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceUtil.java

@ -343,8 +343,8 @@ public class IntPraticaLocalServiceUtil {
} }
/** /**
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per * Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia. Modificata secondo il
* codice provincia. Modificata secondo il D.D.G. 334/2020 * D.D.G. 334/2020
* *
* @author Manifattura Web Group per Regione Siciliana. * @author Manifattura Web Group per Regione Siciliana.
*/ */
@ -356,8 +356,7 @@ public class IntPraticaLocalServiceUtil {
} }
/** /**
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per * Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia.
* codice provincia.
* *
* @author Manifattura Web Group per Regione Siciliana. * @author Manifattura Web Group per Regione Siciliana.
*/ */

7
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceWrapper.java

@ -363,8 +363,8 @@ public class IntPraticaLocalServiceWrapper implements IntPraticaLocalService,
} }
/** /**
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per * Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia. Modificata secondo il
* codice provincia. Modificata secondo il D.D.G. 334/2020 * D.D.G. 334/2020
* *
* @author Manifattura Web Group per Regione Siciliana. * @author Manifattura Web Group per Regione Siciliana.
*/ */
@ -378,8 +378,7 @@ public class IntPraticaLocalServiceWrapper implements IntPraticaLocalService,
} }
/** /**
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per * Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia.
* codice provincia.
* *
* @author Manifattura Web Group per Regione Siciliana. * @author Manifattura Web Group per Regione Siciliana.
*/ */

1031
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java

File diff soppresso perché troppo grande Load Diff

11
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/WorkflowUtil.java

@ -23,6 +23,7 @@ import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.json.JSONDeserializer; import com.liferay.portal.kernel.json.JSONDeserializer;
import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.workflow.WorkflowException; import com.liferay.portal.kernel.workflow.WorkflowException;
import com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil; import com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil;
@ -88,7 +89,7 @@ public class WorkflowUtil {
companyId, userId, workflowInstance.getWorkflowInstanceId(), true, QueryUtil.ALL_POS, companyId, userId, workflowInstance.getWorkflowInstanceId(), true, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null); QueryUtil.ALL_POS, null);
for (WorkflowTask workflowTask : listaTmp) { for (WorkflowTask workflowTask : listaTmp) {
if (workflowTask.getName().equalsIgnoreCase("approvazione")) { if (workflowTask.getName().equalsIgnoreCase(WorkflowConstants.WORKFLOW_TASKNAME_APPROVAZIONE)) {
return workflowTask; return workflowTask;
} }
} }
@ -294,15 +295,15 @@ public class WorkflowUtil {
throws NumberFormatException, PortalException, SystemException { throws NumberFormatException, PortalException, SystemException {
switch (key) { switch (key) {
case "istruttore": case "istruttore":
if (Validator.isNotNull(value) && !"0".equalsIgnoreCase(value)) { if (Validator.isNotNull(value) && !"0".equals(value)) {
User istruttore = UserLocalServiceUtil.getUser(Long.valueOf(value)); User istruttore = UserLocalServiceUtil.getUser(Long.valueOf(value));
value = istruttore.getFullName(); value = istruttore.getFullName();
} else { } else {
return "nessuno"; return "nessuno";
} }
break; break;
case "esito": case WorkflowConstants.WORKFLOW_TASKNAME_ESITO:
if (Validator.isNotNull(value) && !"0".equalsIgnoreCase(value)) { if (Validator.isNotNull(value) && !"0".equals(value)) {
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId);
@ -325,7 +326,7 @@ public class WorkflowUtil {
break; break;
default: default:
if (Validator.isNull(value)) { if (Validator.isNull(value)) {
return "-"; return StringPool.DASH;
} }
break; break;
} }

2
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/AllegatiUtil.java

@ -200,7 +200,7 @@ public class AllegatiUtil {
pagamento.setFileEntryId(fileEntry.getFileEntryId()); pagamento.setFileEntryId(fileEntry.getFileEntryId());
PagamentoLocalServiceUtil.updatePagamento(pagamento); PagamentoLocalServiceUtil.updatePagamento(pagamento);
esito.add("Pagamento " + pagamentoId + ": aggiunto file " + fileEntry.getFileEntryId() esito.add("Pagamento " + pagamentoId + ": aggiunto file " + fileEntry.getFileEntryId()
+ StringPool.BLANK + title); + StringPool.SPACE + title);
return esito; return esito;
} }

2
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java

@ -1112,7 +1112,7 @@ public class SismicaUtil {
+ " aggiunto ControlloPratica " + " aggiunto ControlloPratica "
+ controllo.getControlloPraticaId()); + controllo.getControlloPraticaId());
} }
AvvisoLocalServiceUtil.addAvviso(intPraticaId, "", avviso.getDtAvviso(), AvvisoLocalServiceUtil.addAvviso(intPraticaId, StringPool.BLANK, avviso.getDtAvviso(),
AvvisoUtil.TIPO_AVVISO_DIRETTO, avviso.getTipoDocumento(), AvvisoUtil.TIPO_AVVISO_DIRETTO, avviso.getTipoDocumento(),
templateId, controllo.getDettPraticaId(), templateId, controllo.getDettPraticaId(),
DettPratica.class.getName(), controllo.getControlloPraticaId(), DettPratica.class.getName(), controllo.getControlloPraticaId(),

51
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SorteggioPraticaUtil.java

@ -43,6 +43,7 @@ import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.repository.model.FileEntry; import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.repository.model.Folder; import com.liferay.portal.kernel.repository.model.Folder;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Company; import com.liferay.portal.model.Company;
import com.liferay.portal.model.Role; import com.liferay.portal.model.Role;
@ -69,8 +70,7 @@ public class SorteggioPraticaUtil {
/** /**
* *
* Implementazione della procedura di sorteggio secondo i requisiti della * Implementazione della procedura di sorteggio secondo i requisiti della Regione Siciliana.
* Regione Siciliana.
* *
* @author Manifattura Web Group per Regione Siciliana * @author Manifattura Web Group per Regione Siciliana
* @param companyId * @param companyId
@ -78,16 +78,15 @@ public class SorteggioPraticaUtil {
* @throws PortalException * @throws PortalException
* @throws SystemException * @throws SystemException
*/ */
public static List<String> sorteggio(long companyId, Date dtSorteggio) throws PortalException, public static List<String> sorteggio(long companyId, Date dtSorteggio) throws PortalException, SystemException {
SystemException {
List<String> esito = new ArrayList<>(); List<String> esito = new ArrayList<>();
if (lock.tryLock()) { if (lock.tryLock()) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_FORMAT); SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_FORMAT);
esito.add("Sorteggio iniziato in data " + sdf.format(dtSorteggio) + ".<br><br>"); esito.add("Sorteggio iniziato in data " + sdf.format(dtSorteggio) + ".<br><br>");
Map<String, List<IntPratica>> sorteggiabili = IntPraticaLocalServiceUtil.findSorteggiabiliNew( Map<String, List<IntPratica>> sorteggiabili = IntPraticaLocalServiceUtil.findSorteggiabiliNew(companyId,
companyId, dtSorteggio); dtSorteggio);
int numeroSorteggiabili = 0; int numeroSorteggiabili = 0;
for (Map.Entry<String, List<IntPratica>> s : sorteggiabili.entrySet()) { for (Map.Entry<String, List<IntPratica>> s : sorteggiabili.entrySet()) {
@ -128,8 +127,7 @@ public class SorteggioPraticaUtil {
for (Map.Entry<Integer, IntPratica> m : mescolate.entrySet()) { for (Map.Entry<Integer, IntPratica> m : mescolate.entrySet()) {
IntPratica pratica = m.getValue(); IntPratica pratica = m.getValue();
long intPraticaId = pratica.getIntPraticaId(); long intPraticaId = pratica.getIntPraticaId();
DettPratica dettPratica = DettPraticaLocalServiceUtil DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPraticaId);
.getLastCompletedByIntPratica(intPraticaId);
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(dettPratica.getCompanyId()); serviceContext.setCompanyId(dettPratica.getCompanyId());
@ -138,16 +136,14 @@ public class SorteggioPraticaUtil {
if (contatore++ < numeroSorteggiate) { if (contatore++ < numeroSorteggiate) {
sorteggiate.add(pratica); sorteggiate.add(pratica);
esito.add("<li>Sorteggiata: " + pratica.getNumeroProgetto() + " (id " + intPraticaId esito.add("<li>Sorteggiata: " + pratica.getNumeroProgetto() + " (id " + intPraticaId + ") del "
+ ") del " + sdf.format(pratica.getDtPratica()) + " (" + m.getKey() + sdf.format(pratica.getDtPratica()) + " (" + m.getKey() + ")</li>");
+ ")</li>");
} else { } else {
pratica.setDtSorteggio(dtSorteggio); pratica.setDtSorteggio(dtSorteggio);
IntPraticaLocalServiceUtil.updateIntPratica(pratica); IntPraticaLocalServiceUtil.updateIntPratica(pratica);
esito.add("<li>Non sorteggiata: " + pratica.getNumeroProgetto() + " (id " esito.add("<li>Non sorteggiata: " + pratica.getNumeroProgetto() + " (id " + intPraticaId
+ intPraticaId + ") del " + sdf.format(pratica.getDtPratica()) + " (" + ") del " + sdf.format(pratica.getDtPratica()) + " (" + m.getKey() + ")</li>");
+ m.getKey() + ")</li>");
} }
} }
esito.add("</ol>"); esito.add("</ol>");
@ -200,9 +196,9 @@ public class SorteggioPraticaUtil {
reportDto.setFolderId(folderReport.getFolderId()); reportDto.setFolderId(folderReport.getFolderId());
reportDto.setFileName(reportFileName(companyId, dtSorteggio)); reportDto.setFileName(reportFileName(companyId, dtSorteggio));
reportDto.setHeader(""); reportDto.setHeader(StringPool.BLANK);
reportDto.setHeaderHeight(1); reportDto.setHeaderHeight(1);
reportDto.setFooter(""); reportDto.setFooter(StringPool.BLANK);
reportDto.setFooterHeight(40); reportDto.setFooterHeight(40);
reportDto.setParameters(parameters); reportDto.setParameters(parameters);
@ -254,10 +250,9 @@ public class SorteggioPraticaUtil {
DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica
.getIntPraticaId()); .getIntPraticaId());
String committente = ""; String committente = StringPool.BLANK;
List<Soggetto> soggetti = SoggettoLocalServiceUtil List<Soggetto> soggetti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto_Aggiuntivo_Rimosso(
.findByIntPratica_TipologiaSoggetto_Aggiuntivo_Rimosso(pratica.getIntPraticaId(), pratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE, false, false);
TipoSoggettoUtil.COMMITTENTE, false, false);
if (soggetti.size() > 0) { if (soggetti.size() > 0) {
Soggetto soggetto = soggetti.get(0); Soggetto soggetto = soggetti.get(0);
@ -282,21 +277,19 @@ public class SorteggioPraticaUtil {
sc.setScopeGroupId(dettPratica.getGroupId()); sc.setScopeGroupId(dettPratica.getGroupId());
sc.setUserId(dettPratica.getUserId()); sc.setUserId(dettPratica.getUserId());
SorteggioLocalServiceUtil.addSorteggio(pratica.getIntPraticaId(), dettPratica.getDettPraticaId(), SorteggioLocalServiceUtil.addSorteggio(pratica.getIntPraticaId(), dettPratica.getDettPraticaId(), anno,
anno, mese, sett, dtSorteggio, "", APERTO, "", progressivoEstrazione++, mese, sett, dtSorteggio, StringPool.BLANK, APERTO, StringPool.BLANK, progressivoEstrazione++,
pratica.getNumeroProgetto(), committente, comune.getDenominazione(), pratica.getNumeroProgetto(), committente, comune.getDenominazione(), provincia.getProvincia(),
provincia.getProvincia(), false, pratica.getIntPraticaId(), false, sc); false, pratica.getIntPraticaId(), false, sc);
ControlloPratica controllo = ControlloPraticaLocalServiceUtil.addControlloPratica( ControlloPratica controllo = ControlloPraticaLocalServiceUtil.addControlloPratica(pratica.getGroupId(),
pratica.getGroupId(), pratica.getUserId(), pratica.getIntPraticaId(), pratica.getUserId(), pratica.getIntPraticaId(), dettPratica.getDettPraticaId(), true, sc);
dettPratica.getDettPraticaId(), true, sc);
long idTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(sc.getCompanyId(), long idTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(sc.getCompanyId(),
"conf.geniocivile.avviso.template.id.deposito.S"); "conf.geniocivile.avviso.template.id.deposito.S");
AvvisoLocalServiceUtil.addAvviso(pratica.getIntPraticaId(), "Avviso di sorteggio", dtSorteggio, AvvisoLocalServiceUtil.addAvviso(pratica.getIntPraticaId(), "Avviso di sorteggio", dtSorteggio,
AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.SOTTOPOSTA_A_PARERE, idTemplate, AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.SOTTOPOSTA_A_PARERE, idTemplate,
dettPratica.getDettPraticaId(), DettPratica.class.getName(), dettPratica.getDettPraticaId(), DettPratica.class.getName(), controllo.getControlloPraticaId(), sc);
controllo.getControlloPraticaId(), sc);
IntPraticaLocalServiceUtil.updateIntPraticaSorteggio(pratica.getIntPraticaId(), dtSorteggio, IntPraticaLocalServiceUtil.updateIntPraticaSorteggio(pratica.getIntPraticaId(), dtSorteggio,
StatoPraticaConstants.SOTTOPOSTA_A_PARERE); StatoPraticaConstants.SOTTOPOSTA_A_PARERE);

244
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/ControlloPraticaIndexer.java

@ -64,124 +64,93 @@ import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil;
import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortalUtil;
public class ControlloPraticaIndexer extends BaseIndexer { public class ControlloPraticaIndexer extends BaseIndexer {
public static final String[] CLASS_NAMES = { ControlloPratica.class.getName() }; public static final String[] CLASS_NAMES = { ControlloPratica.class.getName() };
public static final String PORTLET_ID = "1_WAR_portosfeportlet"; public static final String PORTLET_ID = "1_WAR_portosfeportlet";
public static final Format DATE_FORMAT = FastDateFormatFactoryUtil.getSimpleDateFormat("yyyyMMdd"); public static final Format DATE_FORMAT = FastDateFormatFactoryUtil.getSimpleDateFormat("yyyyMMdd");
private static final Log _log = LogFactoryUtil.getLog(ControlloPraticaIndexer.class); private static final Log _log = LogFactoryUtil.getLog(ControlloPraticaIndexer.class);
public ControlloPraticaIndexer() { public ControlloPraticaIndexer() {
setPermissionAware(true); setPermissionAware(true);
} }
@Override @Override
public String[] getClassNames() { public String[] getClassNames() {
return CLASS_NAMES; return CLASS_NAMES;
} }
@Override @Override
public String getPortletId() { public String getPortletId() {
return PORTLET_ID; return PORTLET_ID;
} }
@Override @Override
protected void doDelete(Object obj) throws Exception { protected void doDelete(Object obj) throws Exception {
if (Validator.isNotNull(obj)) { if (Validator.isNotNull(obj)) {
ControlloPratica controlloPratica = (ControlloPratica) obj; ControlloPratica controlloPratica = (ControlloPratica) obj;
deleteDocument(controlloPratica.getCompanyId(), controlloPratica.getControlloPraticaId()); deleteDocument(controlloPratica.getCompanyId(), controlloPratica.getControlloPraticaId());
} else { } else {
_log.warn("Received a null ControlloPratica to delete in input."); _log.warn("Received a null ControlloPratica to delete in input.");
} }
} }
@Override @Override
protected Document doGetDocument(Object obj) throws Exception { protected Document doGetDocument(Object obj) throws Exception {
Document document = null; Document document = null;
if (Validator.isNotNull(obj)) { if (Validator.isNotNull(obj)) {
ControlloPratica controlloPratica = (ControlloPratica) obj; ControlloPratica controlloPratica = (ControlloPratica) obj;
ControlloPratica controlloPraticaFromDB = ControlloPraticaLocalServiceUtil ControlloPratica controlloPraticaFromDB = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPratica.getControlloPraticaId()); .getControlloPratica(controlloPratica.getControlloPraticaId());
if (_log.isDebugEnabled()) { if (_log.isDebugEnabled()) {
_log.debug("Indexing ControlloPratica: " + controlloPratica.getControlloPraticaId()); _log.debug("Indexing ControlloPratica: " + controlloPratica.getControlloPraticaId());
} }
document = getBaseModelDocument(PORTLET_ID, controlloPratica); document = getBaseModelDocument(PORTLET_ID, controlloPratica);
document.addKeyword("entryClassName", ControlloPratica.class.getName()); document.addKeyword("entryClassName", ControlloPratica.class.getName());
document.addKeyword(PortosIndexField.CONTROLLO_PRATICA_ID, controlloPraticaFromDB.getControlloPraticaId());
document.addKeyword(PortosIndexField.CONTROLLO_PRATICA_ID,
controlloPraticaFromDB.getControlloPraticaId());
document.addKeyword(PortosIndexField.DETT_PRATICA_ID, controlloPraticaFromDB.getDettPraticaId()); document.addKeyword(PortosIndexField.DETT_PRATICA_ID, controlloPraticaFromDB.getDettPraticaId());
document.addKeyword(PortosIndexField.PARERE_GEOLOGO, controlloPraticaFromDB.getParereGeologo()); document.addKeyword(PortosIndexField.PARERE_GEOLOGO, controlloPraticaFromDB.getParereGeologo());
document.addKeyword(PortosIndexField.STATUS, controlloPraticaFromDB.getStatus()); document.addKeyword(PortosIndexField.STATUS, controlloPraticaFromDB.getStatus());
document.addKeyword(PortosIndexField.STATUS_BY_USERID, controlloPraticaFromDB.getStatusByUserId()); document.addKeyword(PortosIndexField.STATUS_BY_USERID, controlloPraticaFromDB.getStatusByUserId());
document.addKeyword(PortosIndexField.STATUS_BY_USERNAME, document.addKeyword(PortosIndexField.STATUS_BY_USERNAME, controlloPraticaFromDB.getStatusByUserName());
controlloPraticaFromDB.getStatusByUserName());
if (controlloPraticaFromDB.getStatusDate() != null) { if (controlloPraticaFromDB.getStatusDate() != null) {
document.addKeyword(PortosIndexField.STATUS_DATE, document.addKeyword(PortosIndexField.STATUS_DATE,
DATE_FORMAT.format(controlloPraticaFromDB.getStatusDate())); DATE_FORMAT.format(controlloPraticaFromDB.getStatusDate()));
} else { } else {
document.addKeyword(PortosIndexField.STATUS_DATE, 0); document.addKeyword(PortosIndexField.STATUS_DATE, 0);
} }
document.addKeyword(PortosIndexField.DATA_INIZIO_PROCEDIMENTO, document.addKeyword(PortosIndexField.DATA_INIZIO_PROCEDIMENTO,
DATE_FORMAT.format(controlloPraticaFromDB.getCreateDate())); DATE_FORMAT.format(controlloPraticaFromDB.getCreateDate()));
document.addKeywordSortable(PortosIndexField.DATA_INIZIO_PROCEDIMENTO, document.addKeywordSortable(PortosIndexField.DATA_INIZIO_PROCEDIMENTO,
DATE_FORMAT.format(controlloPraticaFromDB.getCreateDate())); DATE_FORMAT.format(controlloPraticaFromDB.getCreateDate()));
document.addDate(PortosIndexField.DATA_INIZIO_PROCEDIMENTO, controlloPraticaFromDB.getCreateDate());
document.addDate(PortosIndexField.DATA_INIZIO_PROCEDIMENTO,
controlloPraticaFromDB.getCreateDate());
// Indicizzo i campi relarivi a IntPratica // Indicizzo i campi relarivi a IntPratica
document.addKeyword(PortosIndexField.INT_PRATICA_ID, controlloPraticaFromDB.getIntPraticaId()); document.addKeyword(PortosIndexField.INT_PRATICA_ID, controlloPraticaFromDB.getIntPraticaId());
IntPratica intPratica = IntPraticaLocalServiceUtil
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPraticaFromDB .fetchIntPratica(controlloPraticaFromDB.getIntPraticaId());
.getIntPraticaId());
if (Validator.isNotNull(intPratica)) { if (Validator.isNotNull(intPratica)) {
if (intPratica.getStatusByUserId() != 0L) { if (intPratica.getStatusByUserId() != 0L) {
document.addKeyword(PortosIndexField.ISTRUTTORE_USER_ID, intPratica.getStatusByUserId()); document.addKeyword(PortosIndexField.ISTRUTTORE_USER_ID, intPratica.getStatusByUserId());
User userIstruttore = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId()); User userIstruttore = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (userIstruttore != null) { if (userIstruttore != null) {
document.addKeyword(PortosIndexField.ISTRUTTORE_FULL_NAME, userIstruttore document.addKeyword(PortosIndexField.ISTRUTTORE_FULL_NAME, userIstruttore.getFullName()
.getFullName().toUpperCase()); .toUpperCase());
} }
} }
if (intPratica.getUserId() != 0L) { if (intPratica.getUserId() != 0L) {
User proprietarioDigitale = UserLocalServiceUtil.fetchUser(intPratica.getUserId()); User proprietarioDigitale = UserLocalServiceUtil.fetchUser(intPratica.getUserId());
if (proprietarioDigitale != null) { if (proprietarioDigitale != null) {
document.addKeyword(PortosIndexField.PROPRIETARIO_DIGITALE_FULL_NAME, document.addKeyword(PortosIndexField.PROPRIETARIO_DIGITALE_FULL_NAME, proprietarioDigitale
proprietarioDigitale.getFullName().toUpperCase()); .getFullName().toUpperCase());
} }
} }
// Informazioni sullo stato della pratica // Informazioni sullo stato della pratica
boolean variata = false; boolean variata = false;
int countVariantiForIntPratica = DettPraticaLocalServiceUtil int countVariantiForIntPratica = DettPraticaLocalServiceUtil.countVariateByIntPratica(intPratica
.countVariateByIntPratica(intPratica.getIntPraticaId()); .getIntPraticaId());
if (countVariantiForIntPratica > 0) { if (countVariantiForIntPratica > 0) {
variata = true; variata = true;
} }
document.addKeyword(PortosIndexField.VARIATA, variata); document.addKeyword(PortosIndexField.VARIATA, variata);
document.addKeyword(PortosIndexField.COLLAUDO_COMPLETATO, intPratica.getCollaudoTotale()); document.addKeyword(PortosIndexField.COLLAUDO_COMPLETATO, intPratica.getCollaudoTotale());
document.addKeyword(PortosIndexField.COLLAUDO_PARZIALE, intPratica.getCollaudoParziale()); document.addKeyword(PortosIndexField.COLLAUDO_PARZIALE, intPratica.getCollaudoParziale());
document.addKeyword(PortosIndexField.FINE_LAVORI_COMPLETATI, intPratica.getFineLavoriTotale()); document.addKeyword(PortosIndexField.FINE_LAVORI_COMPLETATI, intPratica.getFineLavoriTotale());
@ -190,72 +159,51 @@ public class ControlloPraticaIndexer extends BaseIndexer {
checkSottopostaAParere(intPratica.getIntPraticaId())); checkSottopostaAParere(intPratica.getIntPraticaId()));
document.addKeyword(PortosIndexField.LAVORAZIONE_SORTEGGIATA, document.addKeyword(PortosIndexField.LAVORAZIONE_SORTEGGIATA,
checkLavorazioneSorteggiata(intPratica.getIntPraticaId())); checkLavorazioneSorteggiata(intPratica.getIntPraticaId()));
document.addKeyword(PortosIndexField.TIPO_PRATICA, intPratica.getTipoPratica()); document.addKeyword(PortosIndexField.TIPO_PRATICA, intPratica.getTipoPratica());
document.addKeywordSortable(PortosIndexField.TIPO_PRATICA, intPratica.getTipoPratica()); document.addKeywordSortable(PortosIndexField.TIPO_PRATICA, intPratica.getTipoPratica());
document.addKeyword(PortosIndexField.NUMERO_PROGETTO, document.addKeyword(PortosIndexField.NUMERO_PROGETTO, Integer.valueOf(intPratica.getNumeroProgetto()));
Integer.valueOf(intPratica.getNumeroProgetto())); document.addNumber(PortosIndexField.NUMERO_PROGETTO, Integer.valueOf(intPratica.getNumeroProgetto()));
document.addNumber(PortosIndexField.NUMERO_PROGETTO,
Integer.valueOf(intPratica.getNumeroProgetto()));
document.addNumberSortable(PortosIndexField.NUMERO_PROGETTO, document.addNumberSortable(PortosIndexField.NUMERO_PROGETTO,
Integer.valueOf(intPratica.getNumeroProgetto())); Integer.valueOf(intPratica.getNumeroProgetto()));
document.addKeyword(PortosIndexField.STATO_PRATICA, intPratica.getStatoPratica()); document.addKeyword(PortosIndexField.STATO_PRATICA, intPratica.getStatoPratica());
boolean sorteggiata = SorteggioLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()) != null;
boolean sorteggiata = SorteggioLocalServiceUtil
.findByIntPratica(intPratica.getIntPraticaId()) != null;
document.addKeyword("sorteggiata", sorteggiata); document.addKeyword("sorteggiata", sorteggiata);
document.addKeyword("controlloObbligatorio", intPratica.isControlloObbligatorio()); document.addKeyword("controlloObbligatorio", intPratica.isControlloObbligatorio());
String tipoProcedura = intPratica.getTipoProcedura(); String tipoProcedura = intPratica.getTipoProcedura();
if (Validator.isNotNull(tipoProcedura)) { if (Validator.isNotNull(tipoProcedura)) {
if (tipoProcedura.equalsIgnoreCase(Constants.PROCEDURA_B1)) if (tipoProcedura.equalsIgnoreCase(Constants.PROCEDURA_B1))
tipoProcedura = Constants.PROCEDURA_B; tipoProcedura = Constants.PROCEDURA_B;
document.addKeyword(PortosIndexField.TIPO_PROCEDURA, tipoProcedura); document.addKeyword(PortosIndexField.TIPO_PROCEDURA, tipoProcedura);
} }
// Prendo l ultimo DettPratica legato a IntPratica // Prendo l ultimo DettPratica legato a IntPratica
DettPratica lastDettPratica = DettPraticaLocalServiceUtil DettPratica lastDettPratica = DettPraticaLocalServiceUtil
.getLastCompletedByIntPraticaAndProtocolloNotEmpty(intPratica.getIntPraticaId()); .getLastCompletedByIntPraticaAndProtocolloNotEmpty(intPratica.getIntPraticaId());
if (Validator.isNull(lastDettPratica)) { if (Validator.isNull(lastDettPratica)) {
lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica
.getIntPraticaId()); .getIntPraticaId());
} }
if (Validator.isNotNull(lastDettPratica)) { if (Validator.isNotNull(lastDettPratica)) {
document.addKeyword("nuovaCostruzione", lastDettPratica.getTcNuovaCostruzione()); document.addKeyword("nuovaCostruzione", lastDettPratica.getTcNuovaCostruzione());
document.addKeyword("adeguamentoSismico", lastDettPratica.getTcAdeguamentoSismico()); document.addKeyword("adeguamentoSismico", lastDettPratica.getTcAdeguamentoSismico());
document.addKeyword("miglioramentoSismico", lastDettPratica.getTcMiglioramentoSismico()); document.addKeyword("miglioramentoSismico", lastDettPratica.getTcMiglioramentoSismico());
document.addKeyword("interventoLocale", document.addKeyword("interventoLocale", lastDettPratica.getTcRiparazioneInterventoLocale());
lastDettPratica.getTcRiparazioneInterventoLocale()); if (Validator.isNotNull(lastDettPratica.getProtocollo())) {
if (lastDettPratica.getProtocollo() != null
&& !lastDettPratica.getProtocollo().equals("")) {
document.addKeyword(PortosIndexField.PROTOCOLLO, document.addKeyword(PortosIndexField.PROTOCOLLO,
Long.parseLong(lastDettPratica.getProtocollo())); Long.parseLong(lastDettPratica.getProtocollo()));
document.addNumber(PortosIndexField.PROTOCOLLO, document.addNumber(PortosIndexField.PROTOCOLLO, Long.parseLong(lastDettPratica.getProtocollo()));
Long.parseLong(lastDettPratica.getProtocollo()));
document.addNumberSortable(PortosIndexField.PROTOCOLLO, document.addNumberSortable(PortosIndexField.PROTOCOLLO,
Long.parseLong(lastDettPratica.getProtocollo())); Long.parseLong(lastDettPratica.getProtocollo()));
} }
if (Validator.isNotNull(lastDettPratica.getVia())) {
if (lastDettPratica.getVia() != null && !lastDettPratica.getVia().equals("")) {
document.addKeyword(PortosIndexField.INDIRIZZO, lastDettPratica.getVia()); document.addKeyword(PortosIndexField.INDIRIZZO, lastDettPratica.getVia());
} }
if (Validator.isNotNull(lastDettPratica.getLocalita())) {
if (lastDettPratica.getLocalita() != null && !lastDettPratica.getLocalita().equals("")) {
document.addKeyword(PortosIndexField.LOCALITA, lastDettPratica.getLocalita()); document.addKeyword(PortosIndexField.LOCALITA, lastDettPratica.getLocalita());
} }
if (Validator.isNotNull(lastDettPratica.getDescLongIntervento())) { if (Validator.isNotNull(lastDettPratica.getDescLongIntervento())) {
document.addText(PortosIndexField.DESC_INTERVENTO, document.addText(PortosIndexField.DESC_INTERVENTO, lastDettPratica.getDescLongIntervento());
lastDettPratica.getDescLongIntervento()); document.addKeyword(PortosIndexField.DESC_INTERVENTO, lastDettPratica.getDescLongIntervento());
document.addKeyword(PortosIndexField.DESC_INTERVENTO, document.addKeyword(PortosIndexField.NUOVA_COSTRUZIONE, lastDettPratica.getTcNuovaCostruzione());
lastDettPratica.getDescLongIntervento());
document.addKeyword(PortosIndexField.NUOVA_COSTRUZIONE,
lastDettPratica.getTcNuovaCostruzione());
document.addKeyword(PortosIndexField.ADEGUAMENTO_SISMICO, document.addKeyword(PortosIndexField.ADEGUAMENTO_SISMICO,
lastDettPratica.getTcAdeguamentoSismico()); lastDettPratica.getTcAdeguamentoSismico());
document.addKeyword(PortosIndexField.MIGLIORAMENTO_SISMICO, document.addKeyword(PortosIndexField.MIGLIORAMENTO_SISMICO,
@ -264,7 +212,6 @@ public class ControlloPraticaIndexer extends BaseIndexer {
lastDettPratica.getTcRiparazioneInterventoLocale()); lastDettPratica.getTcRiparazioneInterventoLocale());
} }
} }
// Gestione pratica aperta/chiusa fine lavori // Gestione pratica aperta/chiusa fine lavori
if (intPratica.getCollaudoTotale()) { if (intPratica.getCollaudoTotale()) {
document.addKeyword(PortosIndexField.PRATICA_APERTA, false); document.addKeyword(PortosIndexField.PRATICA_APERTA, false);
@ -277,171 +224,109 @@ public class ControlloPraticaIndexer extends BaseIndexer {
} else { } else {
document.addKeyword(PortosIndexField.PRATICA_APERTA, true); document.addKeyword(PortosIndexField.PRATICA_APERTA, true);
} }
if (intPratica.getStatoPratica().equals(StatoPraticaConstants.INTEGRAZIONE)) { if (intPratica.getStatoPratica().equals(StatoPraticaConstants.INTEGRAZIONE)) {
document.addKeyword(PortosIndexField.PRATICA_APERTA, true); document.addKeyword(PortosIndexField.PRATICA_APERTA, true);
} }
// Prendo la lista dei soggetti committenti legati a IntPratica // Prendo la lista dei soggetti committenti legati a IntPratica
List<Soggetto> committenti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto( List<Soggetto> committenti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
intPratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE); intPratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE);
if (Validator.isNotNull(committenti) && committenti.size() > 0) { if (Validator.isNotNull(committenti) && committenti.size() > 0) {
// Creao una stringa contenente tutti i codFisc legati alla IntPratica separati da ,
// Creao una stringa contenente tutti i codFisc legati alla
// IntPratica separati da ,
List<String> listaSoggetti = new ArrayList<String>(); List<String> listaSoggetti = new ArrayList<String>();
for (Soggetto soggetto : committenti) { for (Soggetto soggetto : committenti) {
listaSoggetti.add(soggetto.getNome().toUpperCase() + " " + soggetto.getCognome().toUpperCase());
// listaSoggetti.add(soggetto.getCodiceFiscale().toUpperCase());
listaSoggetti.add(soggetto.getNome().toUpperCase() + " "
+ soggetto.getCognome().toUpperCase());
} }
document.addKeyword(PortosIndexField.SOGGETTI_INTERESSATI, listaSoggetti.toArray(new String[0]));
document.addKeyword(PortosIndexField.SOGGETTI_INTERESSATI,
listaSoggetti.toArray(new String[0]));
document.addKeyword(PortosIndexField.COMMITTENTI, listaSoggetti.toArray(new String[0])); document.addKeyword(PortosIndexField.COMMITTENTI, listaSoggetti.toArray(new String[0]));
} }
// Soggetti Interconnessi // Soggetti Interconnessi
List<Soggetto> listSoggettiInterconnessi = SoggettoLocalServiceUtil List<Soggetto> listSoggettiInterconnessi = SoggettoLocalServiceUtil
.getSoggettiByIntPraticaId_DtRimozioneNull(intPratica.getIntPraticaId()); .getSoggettiByIntPraticaId_DtRimozioneNull(intPratica.getIntPraticaId());
if (listSoggettiInterconnessi != null && !listSoggettiInterconnessi.isEmpty()) { if (listSoggettiInterconnessi != null && !listSoggettiInterconnessi.isEmpty()) {
List<String> listaStringata = new ArrayList<String>(); List<String> listaStringata = new ArrayList<String>();
for (Soggetto sog : listSoggettiInterconnessi) { for (Soggetto sog : listSoggettiInterconnessi) {
listaStringata listaStringata.add(sog.getNome().toUpperCase() + " " + sog.getCognome().toUpperCase());
.add(sog.getNome().toUpperCase() + " " + sog.getCognome().toUpperCase());
} }
document.addKeyword(PortosIndexField.SOGGETTI_INTERCONNESSI, listaStringata.toArray(new String[0]));
document.addKeyword(PortosIndexField.SOGGETTI_INTERCONNESSI,
listaStringata.toArray(new String[0]));
} }
// Prendo dati relativi al Territorio // Prendo dati relativi al Territorio
if (Validator.isNotNull(intPratica.getTerritorioId())) { if (Validator.isNotNull(intPratica.getTerritorioId())) {
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica
.getTerritorioId());
if (Validator.isNotNull(territorio)) { if (Validator.isNotNull(territorio)) {
if (Validator.isNotNull(territorio.getComuneId())) { if (Validator.isNotNull(territorio.getComuneId())) {
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId()); Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
if (Validator.isNotNull(comune)) { if (Validator.isNotNull(comune)) {
document.addKeyword(PortosIndexField.COMUNE_ID, comune.getComuneId()); document.addKeyword(PortosIndexField.COMUNE_ID, comune.getComuneId());
document.addKeyword(PortosIndexField.COMUNE_DENOMINAZIONE, document.addKeyword(PortosIndexField.COMUNE_DENOMINAZIONE, comune.getDenominazione());
comune.getDenominazione());
} }
if (Validator.isNotNull(territorio.getCodiceProvincia())) { if (Validator.isNotNull(territorio.getCodiceProvincia())) {
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C( territorio.getCodiceProvincia());
territorio.getCompanyId(), territorio.getCodiceProvincia());
if (Validator.isNotNull(provincia)) { if (Validator.isNotNull(provincia)) {
document.addKeyword(PortosIndexField.PROVINCIA_ID, provincia.getProvinciaId());
document.addKeyword(PortosIndexField.PROVINCIA_ID,
provincia.getProvinciaId());
document.addKeyword(PortosIndexField.PROVINCIA_CODICE, document.addKeyword(PortosIndexField.PROVINCIA_CODICE,
provincia.getCodiceProvincia()); provincia.getCodiceProvincia());
document.addKeyword(PortosIndexField.PROVINCIA_NAME, document.addKeyword(PortosIndexField.PROVINCIA_NAME, provincia.getProvincia());
provincia.getProvincia());
} }
} }
} }
} }
} }
} }
// Indicizzazione campi da Kaleo // Indicizzazione campi da Kaleo
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink(
.fetchWorkflowInstanceLink(controlloPraticaFromDB.getCompanyId(), controlloPraticaFromDB.getCompanyId(), controlloPraticaFromDB.getGroupId(),
controlloPraticaFromDB.getGroupId(), ControlloPratica.class.getName(), ControlloPratica.class.getName(), controlloPraticaFromDB.getPrimaryKey());
controlloPraticaFromDB.getPrimaryKey());
if (Validator.isNotNull(workflowInstanceLink)) { if (Validator.isNotNull(workflowInstanceLink)) {
long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId(); long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId();
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance( WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(
controlloPraticaFromDB.getCompanyId(), workflowInstanceId); controlloPraticaFromDB.getCompanyId(), workflowInstanceId);
if (Validator.isNotNull(workflowInstance)) { if (Validator.isNotNull(workflowInstance)) {
document.addKeyword(PortosIndexField.WORKFLOW_STATE, workflowInstance.getState()); document.addKeyword(PortosIndexField.WORKFLOW_STATE, workflowInstance.getState());
List<WorkflowTask> listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(
List<WorkflowTask> listaTask = WorkflowTaskManagerUtil controlloPraticaFromDB.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(),
.getWorkflowTasksByWorkflowInstance(controlloPraticaFromDB.getCompanyId(), null, false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
workflowInstance.getWorkflowInstanceId(), false, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null);
if (Validator.isNotNull(listaTask) && !listaTask.isEmpty()) { if (Validator.isNotNull(listaTask) && !listaTask.isEmpty()) {
WorkflowTask task = listaTask.get(0); WorkflowTask task = listaTask.get(0);
if (task.getAssigneeUserId() != 0L && task.getAssigneeUserId() != -1) { if (task.getAssigneeUserId() != 0L && task.getAssigneeUserId() != -1) {
document.addKeyword(PortosIndexField.TASK_ASSIGNEE_USER_ID, document.addKeyword(PortosIndexField.TASK_ASSIGNEE_USER_ID, task.getAssigneeUserId());
task.getAssigneeUserId());
} else if (workflowInstance.getState().equals("Esito")) { } else if (workflowInstance.getState().equals("Esito")) {
_log.warn("Fascicolo Disallineato su Kaleo : assenza assegnazione istruttore | kaleoInstanceId=" _log.warn("Fascicolo Disallineato su Kaleo : assenza assegnazione istruttore | kaleoInstanceId="
+ workflowInstance.getWorkflowInstanceId()); + workflowInstance.getWorkflowInstanceId());
} }
if (Validator.isNotNull(task.getWorkflowTaskAssignees()) if (Validator.isNotNull(task.getWorkflowTaskAssignees())
&& !task.getWorkflowTaskAssignees().isEmpty()) { && !task.getWorkflowTaskAssignees().isEmpty()) {
List<String> roleIdsAssignee = new ArrayList<String>(); List<String> roleIdsAssignee = new ArrayList<String>();
for (WorkflowTaskAssignee taskAssignee : task.getWorkflowTaskAssignees()) { for (WorkflowTaskAssignee taskAssignee : task.getWorkflowTaskAssignees()) {
if (taskAssignee.getAssigneeClassName().equals(Role.class.getName())) { if (taskAssignee.getAssigneeClassName().equals(Role.class.getName())) {
roleIdsAssignee.add("R" + taskAssignee.getAssigneeClassPK() + "G" roleIdsAssignee.add("R" + taskAssignee.getAssigneeClassPK() + "G"
+ controlloPraticaFromDB.getGroupId()); + controlloPraticaFromDB.getGroupId());
} }
} }
document.addKeyword(PortosIndexField.TASK_ASSIGNEE_ROLE_IDS, document.addKeyword(PortosIndexField.TASK_ASSIGNEE_ROLE_IDS,
roleIdsAssignee.toArray(new String[0])); roleIdsAssignee.toArray(new String[0]));
} }
document.addKeyword(PortosIndexField.WORKFLOW_DEFINITION_NAME, document.addKeyword(PortosIndexField.WORKFLOW_DEFINITION_NAME,
workflowInstance.getWorkflowDefinitionName()); workflowInstance.getWorkflowDefinitionName());
document.addKeyword(PortosIndexField.WORKFLOW_DEFINITION_VERSION, document.addKeyword(PortosIndexField.WORKFLOW_DEFINITION_VERSION,
workflowInstance.getWorkflowDefinitionVersion()); workflowInstance.getWorkflowDefinitionVersion());
document.addKeyword(PortosIndexField.TASK_NAME, task.getName()); document.addKeyword(PortosIndexField.TASK_NAME, task.getName());
document.addKeywordSortable(PortosIndexField.TASK_NAME, task.getName()); document.addKeywordSortable(PortosIndexField.TASK_NAME, task.getName());
} }
} }
} }
} else { } else {
_log.warn("Received a null ControlloPratica in input."); _log.warn("Received a null ControlloPratica in input.");
} }
return document; return document;
} }
@Override @Override
protected Document getBaseModelDocument(String portletId, BaseModel<?> baseModel) throws SystemException { protected Document getBaseModelDocument(String portletId, BaseModel<?> baseModel) throws SystemException {
Document document = newDocument(); Document document = newDocument();
String className = baseModel.getModelClassName(); String className = baseModel.getModelClassName();
long classPK = 0; long classPK = 0;
long resourcePrimKey = 0; long resourcePrimKey = 0;
if (baseModel instanceof ResourcedModel) { if (baseModel instanceof ResourcedModel) {
ResourcedModel resourcedModel = (ResourcedModel) baseModel; ResourcedModel resourcedModel = (ResourcedModel) baseModel;
classPK = resourcedModel.getResourcePrimKey(); classPK = resourcedModel.getResourcePrimKey();
@ -449,53 +334,36 @@ public class ControlloPraticaIndexer extends BaseIndexer {
} else { } else {
classPK = GetterUtil.getLong(baseModel.getPrimaryKeyObj()); classPK = GetterUtil.getLong(baseModel.getPrimaryKeyObj());
} }
document.addUID(portletId, classPK, className); document.addUID(portletId, classPK, className);
document.addKeyword(Field.ENTRY_CLASS_NAME, className); document.addKeyword(Field.ENTRY_CLASS_NAME, className);
document.addKeyword(Field.ENTRY_CLASS_PK, classPK); document.addKeyword(Field.ENTRY_CLASS_PK, classPK);
document.addKeyword(Field.PORTLET_ID, portletId); document.addKeyword(Field.PORTLET_ID, portletId);
if (resourcePrimKey > 0) { if (resourcePrimKey > 0) {
document.addKeyword(Field.ROOT_ENTRY_CLASS_PK, resourcePrimKey); document.addKeyword(Field.ROOT_ENTRY_CLASS_PK, resourcePrimKey);
} }
if (baseModel instanceof AuditedModel) { if (baseModel instanceof AuditedModel) {
AuditedModel auditedModel = (AuditedModel) baseModel; AuditedModel auditedModel = (AuditedModel) baseModel;
document.addKeyword(Field.COMPANY_ID, auditedModel.getCompanyId()); document.addKeyword(Field.COMPANY_ID, auditedModel.getCompanyId());
document.addDate(Field.CREATE_DATE, auditedModel.getCreateDate()); document.addDate(Field.CREATE_DATE, auditedModel.getCreateDate());
document.addDate(Field.MODIFIED_DATE, auditedModel.getModifiedDate()); document.addDate(Field.MODIFIED_DATE, auditedModel.getModifiedDate());
document.addKeyword(Field.USER_ID, auditedModel.getUserId()); document.addKeyword(Field.USER_ID, auditedModel.getUserId());
String userName = PortalUtil.getUserName(auditedModel.getUserId(), auditedModel.getUserName()); String userName = PortalUtil.getUserName(auditedModel.getUserId(), auditedModel.getUserName());
document.addKeyword(Field.USER_NAME, userName, true); document.addKeyword(Field.USER_NAME, userName, true);
} }
GroupedModel groupedModel = null; GroupedModel groupedModel = null;
if (baseModel instanceof GroupedModel) { if (baseModel instanceof GroupedModel) {
groupedModel = (GroupedModel) baseModel; groupedModel = (GroupedModel) baseModel;
document.addKeyword(Field.GROUP_ID, getSiteGroupId(groupedModel.getGroupId())); document.addKeyword(Field.GROUP_ID, getSiteGroupId(groupedModel.getGroupId()));
document.addKeyword(Field.SCOPE_GROUP_ID, groupedModel.getGroupId()); document.addKeyword(Field.SCOPE_GROUP_ID, groupedModel.getGroupId());
} }
if ((groupedModel != null) && (baseModel instanceof TrashedModel)) { if ((groupedModel != null) && (baseModel instanceof TrashedModel)) {
TrashedModel trashedModel = (TrashedModel) baseModel; TrashedModel trashedModel = (TrashedModel) baseModel;
if (trashedModel.isInTrash()) { if (trashedModel.isInTrash()) {
addTrashFields(document, trashedModel); addTrashFields(document, trashedModel);
} }
} }
addAssetFields(document, className, classPK); addAssetFields(document, className, classPK);
return document; return document;
} }
@Override @Override
@ -503,14 +371,11 @@ public class ControlloPraticaIndexer extends BaseIndexer {
throws Exception { throws Exception {
if (Validator.isNotNull(document)) { if (Validator.isNotNull(document)) {
String title = document.get(""); String title = document.get("");
String content = document.get(""); String content = document.get("");
String controlloPraticaId = document.get(PortosIndexField.CONTROLLO_PRATICA_ID); String controlloPraticaId = document.get(PortosIndexField.CONTROLLO_PRATICA_ID);
portletURL.setParameter("struts_action", "/web/TODO"); portletURL.setParameter("struts_action", "/web/TODO");
portletURL.setParameter("intPraticaId", controlloPraticaId); portletURL.setParameter("intPraticaId", controlloPraticaId);
return new Summary(title, content, portletURL); return new Summary(title, content, portletURL);
} else { } else {
_log.warn("Received a null document in input."); _log.warn("Received a null document in input.");
@ -520,14 +385,10 @@ public class ControlloPraticaIndexer extends BaseIndexer {
@Override @Override
protected void doReindex(Object obj) throws Exception { protected void doReindex(Object obj) throws Exception {
if (Validator.isNotNull(obj)) { if (Validator.isNotNull(obj)) {
ControlloPratica controlloPratica = (ControlloPratica) obj; ControlloPratica controlloPratica = (ControlloPratica) obj;
Document document = getDocument(controlloPratica); Document document = getDocument(controlloPratica);
SearchEngineUtil.updateDocument(getSearchEngineId(), controlloPratica.getCompanyId(), document, SearchEngineUtil.updateDocument(getSearchEngineId(), controlloPratica.getCompanyId(), document, false);
false);
} else { } else {
_log.warn("Received a null ControlloPratica in input."); _log.warn("Received a null ControlloPratica in input.");
} }
@ -535,24 +396,19 @@ public class ControlloPraticaIndexer extends BaseIndexer {
@Override @Override
protected void doReindex(String[] ids) throws Exception { protected void doReindex(String[] ids) throws Exception {
_log.debug("doReindex ControlloPratica"); _log.debug("doReindex ControlloPratica");
if (ids != null && ids.length > 0) { if (ids != null && ids.length > 0) {
long companyId = GetterUtil.getLong(ids[0]); long companyId = GetterUtil.getLong(ids[0]);
reindexControlloPratica(companyId); reindexControlloPratica(companyId);
} else { } else {
_log.warn("Received a null or empty set of ids."); _log.warn("Received a null or empty set of ids.");
} }
} }
protected void reindexControlloPratica(long companyId) throws PortalException, SystemException { protected void reindexControlloPratica(long companyId) throws PortalException, SystemException {
ActionableDynamicQuery actionableDynamicQuery = new ControlloPraticaActionableDynamicQuery() { ActionableDynamicQuery actionableDynamicQuery = new ControlloPraticaActionableDynamicQuery() {
@Override @Override
protected void performAction(Object object) throws PortalException { protected void performAction(Object object) throws PortalException {
if (object != null) { if (object != null) {
ControlloPratica controlloPratica = (ControlloPratica) object; ControlloPratica controlloPratica = (ControlloPratica) object;
if (controlloPratica != null) { if (controlloPratica != null) {
@ -574,9 +430,7 @@ public class ControlloPraticaIndexer extends BaseIndexer {
} }
} }
} }
}; };
actionableDynamicQuery.setCompanyId(companyId); actionableDynamicQuery.setCompanyId(companyId);
actionableDynamicQuery.setSearchEngineId(getSearchEngineId()); actionableDynamicQuery.setSearchEngineId(getSearchEngineId());
actionableDynamicQuery.performActions(); actionableDynamicQuery.performActions();
@ -584,29 +438,15 @@ public class ControlloPraticaIndexer extends BaseIndexer {
@Override @Override
protected void doReindex(String className, long id) throws Exception { protected void doReindex(String className, long id) throws Exception {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(id); ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(id);
doReindex(controlloPratica); doReindex(controlloPratica);
} }
private boolean checkSottopostaAParere(long intPraticaId) throws SystemException, PortalException { private boolean checkSottopostaAParere(long intPraticaId) throws SystemException, PortalException {
return WorkflowUtil.isWorkflowDisattivabile(intPraticaId); return WorkflowUtil.isWorkflowDisattivabile(intPraticaId);
// List<ControlloPratica> lista =
// ControlloPraticaLocalServiceUtil.findByIntPraticaId_Status(intPraticaId,
// WorkflowConstants.STATUS_APPROVED);
//
// if (Validator.isNotNull(lista) && !lista.isEmpty()) {
// return true;
// } else {
// return false;
// }
} }
private boolean checkLavorazioneSorteggiata(long intPraticaId) throws SystemException { private boolean checkLavorazioneSorteggiata(long intPraticaId) throws SystemException {
Sorteggio sorteggio = SorteggioLocalServiceUtil.findByIntPratica(intPraticaId); Sorteggio sorteggio = SorteggioLocalServiceUtil.findByIntPratica(intPraticaId);
if (Validator.isNotNull(sorteggio)) { if (Validator.isNotNull(sorteggio)) {
return true; return true;
@ -617,8 +457,6 @@ public class ControlloPraticaIndexer extends BaseIndexer {
@Override @Override
protected String getPortletId(SearchContext searchContext) { protected String getPortletId(SearchContext searchContext) {
return PORTLET_ID; return PORTLET_ID;
} }
} }

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

@ -32,6 +32,7 @@ import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.upload.UploadPortletRequest; import com.liferay.portal.kernel.upload.UploadPortletRequest;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory; import com.liferay.portal.service.ServiceContextFactory;
@ -44,29 +45,22 @@ public class AmministrazionePortlet extends MVCPortlet {
private static final Log _log = LogFactoryUtil.getLog(AmministrazionePortlet.class); private static final Log _log = LogFactoryUtil.getLog(AmministrazionePortlet.class);
public void saveProvincia(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void saveProvincia(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long provinciaId = ParamUtil.getLong(actionRequest, "provinciaId"); long provinciaId = ParamUtil.getLong(actionRequest, "provinciaId");
String codiceProvincia = ParamUtil.getString(actionRequest, "codiceProvincia"); String codiceProvincia = ParamUtil.getString(actionRequest, "codiceProvincia");
String provincia = ParamUtil.getString(actionRequest, "provincia"); String provincia = ParamUtil.getString(actionRequest, "provincia");
String regione = ParamUtil.getString(actionRequest, "regione"); String regione = ParamUtil.getString(actionRequest, "regione");
String sigla = ParamUtil.getString(actionRequest, "sigla"); String sigla = ParamUtil.getString(actionRequest, "sigla");
ServiceContext serviceContext = ServiceContextFactory.getInstance(Provincia.class.getName(), actionRequest);
ServiceContext serviceContext = ServiceContextFactory.getInstance(Provincia.class.getName(),
actionRequest);
long userId = PortalUtil.getUserId(actionRequest); long userId = PortalUtil.getUserId(actionRequest);
try { try {
Provincia provinciaO = null; Provincia provinciaO = null;
if (provinciaId == 0) { if (provinciaId == 0) {
provinciaO = ProvinciaLocalServiceUtil.addProvincia(userId, codiceProvincia, provincia, provinciaO = ProvinciaLocalServiceUtil.addProvincia(userId, codiceProvincia, provincia, regione, sigla,
regione, sigla, serviceContext); serviceContext);
} else { } else {
provinciaO = ProvinciaLocalServiceUtil.updateProvincia(userId, provinciaId, provincia, provinciaO = ProvinciaLocalServiceUtil.updateProvincia(userId, provinciaId, provincia, regione, sigla,
regione, sigla, serviceContext); serviceContext);
} }
String redirect = ParamUtil.getString(actionRequest, "redirect"); String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) { if (Validator.isNull(redirect)) {
actionRequest.setAttribute(WebKeys.PORTOS_AMM_PROVINCIA, provinciaO); actionRequest.setAttribute(WebKeys.PORTOS_AMM_PROVINCIA, provinciaO);
@ -74,76 +68,53 @@ public class AmministrazionePortlet extends MVCPortlet {
} }
} catch (PortalException e) { } catch (PortalException e) {
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/province/edit.jsp"); actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/province/edit.jsp");
throw e; throw e;
} }
} }
public void saveConfigScheduler(ActionRequest actionRequest, ActionResponse actionResponse) public void saveConfigScheduler(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
throws Exception {
try { try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
serviceContext.setScopeGroupId(-1L); serviceContext.setScopeGroupId(-1L);
serviceContext.setCompanyId(serviceContext.getCompanyId()); serviceContext.setCompanyId(serviceContext.getCompanyId());
String schedulerVersioning = ParamUtil.getString(actionRequest, String schedulerVersioning = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.SCHEDULER_VERSIONING); ConfigurazioneConstants.SCHEDULER_VERSIONING);
String schedulerGeneraDocumento = ParamUtil.getString(actionRequest, String schedulerGeneraDocumento = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.SCHEDULER_GENERA_DOCUMENTO); ConfigurazioneConstants.SCHEDULER_GENERA_DOCUMENTO);
String schedulerFirmaDocumento = ParamUtil.getString(actionRequest, String schedulerFirmaDocumento = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.SCHEDULER_FIRMA_DOCUMENTO); ConfigurazioneConstants.SCHEDULER_FIRMA_DOCUMENTO);
String schedulerInvioDocumento = ParamUtil.getString(actionRequest, String schedulerInvioDocumento = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.SCHEDULER_INVIO_DOCUMENTO); ConfigurazioneConstants.SCHEDULER_INVIO_DOCUMENTO);
String schedulerIris = ParamUtil.getString(actionRequest, ConfigurazioneConstants.SCHEDULER_IRIS); String schedulerIris = ParamUtil.getString(actionRequest, ConfigurazioneConstants.SCHEDULER_IRIS);
String irisVerificaPagamentiURL = ParamUtil.getString(actionRequest, String irisVerificaPagamentiURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.IRIS_VERIFICA_PAGAMENTI_URL); ConfigurazioneConstants.IRIS_VERIFICA_PAGAMENTI_URL);
String protocollazioneServiceURL = ParamUtil.getString(actionRequest, String protocollazioneServiceURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_URL); ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_URL);
String protocollazioneExportURL = ParamUtil.getString(actionRequest, String protocollazioneExportURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_EXPORT_URL); ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_EXPORT_URL);
String protocollazioneImportURL = ParamUtil.getString(actionRequest, String protocollazioneImportURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_IMPORT_URL); ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_IMPORT_URL);
String irisComunicazioniDebitorieURL = ParamUtil.getString(actionRequest, String irisComunicazioniDebitorieURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.IRIS_COMUNICAZIONI_DEBITORIE_URL); ConfigurazioneConstants.IRIS_COMUNICAZIONI_DEBITORIE_URL);
String irisGenerazioneIUVURL = ParamUtil.getString(actionRequest, String irisGenerazioneIUVURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.IRIS_GENERAZIONE_IUV_URL); ConfigurazioneConstants.IRIS_GENERAZIONE_IUV_URL);
String importoBollo = ParamUtil.getString(actionRequest, ConfigurazioneConstants.IMPORTO_BOLLO); String importoBollo = ParamUtil.getString(actionRequest, ConfigurazioneConstants.IMPORTO_BOLLO);
int dayOfWeekSorteggio = ParamUtil.getInteger(actionRequest, ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO);
int dayOfWeekSorteggio = ParamUtil.getInteger(actionRequest, int hourOfDaySorteggio = ParamUtil.getInteger(actionRequest, ConfigurazioneConstants.HOUR_OF_DAY_SORTEGGIO);
ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO);
int hourOfDaySorteggio = ParamUtil.getInteger(actionRequest,
ConfigurazioneConstants.HOUR_OF_DAY_SORTEGGIO);
hourOfDaySorteggio = Math.min(23, Math.max(0, hourOfDaySorteggio)); hourOfDaySorteggio = Math.min(23, Math.max(0, hourOfDaySorteggio));
int dayOfWeekPubblicazione = ParamUtil.getInteger(actionRequest, int dayOfWeekPubblicazione = ParamUtil.getInteger(actionRequest,
ConfigurazioneConstants.DAY_OF_WEEK_PUBBLICAZIONE); ConfigurazioneConstants.DAY_OF_WEEK_PUBBLICAZIONE);
int startDaySorteggio = ParamUtil.getInteger(actionRequest, ConfigurazioneConstants.START_DAY_SORTEGGIO);
int startDaySorteggio = ParamUtil.getInteger(actionRequest, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_VERSIONING, schedulerVersioning,
ConfigurazioneConstants.START_DAY_SORTEGGIO); serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_VERSIONING,
schedulerVersioning, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_GENERA_DOCUMENTO, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_GENERA_DOCUMENTO,
schedulerGeneraDocumento, serviceContext); schedulerGeneraDocumento, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_FIRMA_DOCUMENTO, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_FIRMA_DOCUMENTO,
schedulerFirmaDocumento, serviceContext); schedulerFirmaDocumento, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_INVIO_DOCUMENTO, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_INVIO_DOCUMENTO,
schedulerInvioDocumento, serviceContext); schedulerInvioDocumento, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_IRIS, schedulerIris, ConfigurazioneServiceUtil
serviceContext); .storeConfig(ConfigurazioneConstants.SCHEDULER_IRIS, schedulerIris, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IRIS_VERIFICA_PAGAMENTI_URL, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IRIS_VERIFICA_PAGAMENTI_URL,
irisVerificaPagamentiURL, serviceContext); irisVerificaPagamentiURL, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_URL, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_URL,
@ -156,77 +127,52 @@ public class AmministrazionePortlet extends MVCPortlet {
irisComunicazioniDebitorieURL, serviceContext); irisComunicazioniDebitorieURL, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IRIS_GENERAZIONE_IUV_URL, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IRIS_GENERAZIONE_IUV_URL,
irisGenerazioneIUVURL, serviceContext); irisGenerazioneIUVURL, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IMPORTO_BOLLO, importoBollo, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IMPORTO_BOLLO, importoBollo, serviceContext);
serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO,
String.valueOf(dayOfWeekSorteggio), serviceContext); String.valueOf(dayOfWeekSorteggio), serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.HOUR_OF_DAY_SORTEGGIO, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.HOUR_OF_DAY_SORTEGGIO,
String.valueOf(hourOfDaySorteggio), serviceContext); String.valueOf(hourOfDaySorteggio), serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.DAY_OF_WEEK_PUBBLICAZIONE, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.DAY_OF_WEEK_PUBBLICAZIONE,
String.valueOf(dayOfWeekPubblicazione), serviceContext); String.valueOf(dayOfWeekPubblicazione), serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.START_DAY_SORTEGGIO, ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.START_DAY_SORTEGGIO,
String.valueOf(startDaySorteggio), serviceContext); String.valueOf(startDaySorteggio), serviceContext);
String redirect = ParamUtil.getString(actionRequest, "redirect"); String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) { if (Validator.isNull(redirect)) {
actionResponse.setRenderParameter("tabs1", "parametri"); actionResponse.setRenderParameter("tabs1", "parametri");
} }
} catch (PortalException | SystemException e) {
} catch (PortalException e) {
_log.error("Error", e);
throw new PortletException(e);
} catch (SystemException e) {
_log.error("Error", e); _log.error("Error", e);
throw new PortletException(e); throw e;
} }
} }
public void saveConfigTemplate(ActionRequest actionRequest, ActionResponse actionResponse) public void saveConfigTemplate(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
throws Exception {
try { try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
final String _PREFIX_START_CONFIGURAZIONE = "configurazione--"; final String _PREFIX_START_CONFIGURAZIONE = "configurazione--";
final String _PREFIX_END_CONFIGURAZIONE = "--"; final String _PREFIX_END_CONFIGURAZIONE = "--";
Enumeration<String> enu = actionRequest.getParameterNames(); Enumeration<String> enu = actionRequest.getParameterNames();
while (enu.hasMoreElements()) { while (enu.hasMoreElements()) {
String name = enu.nextElement(); String name = enu.nextElement();
if (!name.startsWith(_PREFIX_START_CONFIGURAZIONE) && !name.endsWith("--")) { if (!name.startsWith(_PREFIX_START_CONFIGURAZIONE) && !name.endsWith("--")) {
continue; continue;
} }
String key = name.substring(_PREFIX_START_CONFIGURAZIONE.length(), name.length() String key = name.substring(_PREFIX_START_CONFIGURAZIONE.length(), name.length()
- _PREFIX_END_CONFIGURAZIONE.length()); - _PREFIX_END_CONFIGURAZIONE.length());
String value = ParamUtil.getString(actionRequest, name); String value = ParamUtil.getString(actionRequest, name);
ConfigurazioneServiceUtil.storeConfig(key, value, serviceContext); ConfigurazioneServiceUtil.storeConfig(key, value, serviceContext);
} }
String redirect = ParamUtil.getString(actionRequest, "redirect"); String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) { if (Validator.isNull(redirect)) {
actionResponse.setRenderParameter("tabs1", "parametri"); actionResponse.setRenderParameter("tabs1", "parametri");
} }
} catch (PortalException | SystemException e) {
} catch (PortalException e) {
_log.error("Error", e); _log.error("Error", e);
throw new PortletException(e); throw e;
} catch (SystemException e) {
_log.error("Error", e);
throw new PortletException(e);
} }
} }
public void saveComune(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void saveComune(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long comuneId = ParamUtil.getLong(actionRequest, "comuneId"); long comuneId = ParamUtil.getLong(actionRequest, "comuneId");
String codiceProvincia = ParamUtil.getString(actionRequest, "codiceProvincia"); String codiceProvincia = ParamUtil.getString(actionRequest, "codiceProvincia");
String codiceComune = ParamUtil.getString(actionRequest, "codiceComune"); String codiceComune = ParamUtil.getString(actionRequest, "codiceComune");
@ -236,24 +182,18 @@ public class AmministrazionePortlet extends MVCPortlet {
String mailSuap = ParamUtil.getString(actionRequest, "mailSuap"); String mailSuap = ParamUtil.getString(actionRequest, "mailSuap");
String mailSue = ParamUtil.getString(actionRequest, "mailSue"); String mailSue = ParamUtil.getString(actionRequest, "mailSue");
boolean provincia = ParamUtil.getBoolean(actionRequest, "provincia"); boolean provincia = ParamUtil.getBoolean(actionRequest, "provincia");
ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(), actionRequest);
ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(),
actionRequest);
long userId = PortalUtil.getUserId(actionRequest); long userId = PortalUtil.getUserId(actionRequest);
try { try {
Comune comune = null; Comune comune = null;
if (comuneId == 0) {// ADD if (comuneId == 0) {// ADD
codiceComune = codiceIstat.substring(0, 3); codiceComune = codiceIstat.substring(0, 3);
comune = ComuneLocalServiceUtil.addComune(userId, codiceProvincia, codiceComune, codiceIstat, comune = ComuneLocalServiceUtil.addComune(userId, codiceProvincia, codiceComune, codiceIstat,
codiceBelfiore, denominazione, provincia, mailSuap, mailSue, serviceContext); codiceBelfiore, denominazione, provincia, mailSuap, mailSue, serviceContext);
} else {// EDIT } else {// EDIT
ComuneLocalServiceUtil.updateComune(userId, comuneId, codiceProvincia, codiceComune, ComuneLocalServiceUtil.updateComune(userId, comuneId, codiceProvincia, codiceComune, codiceIstat,
codiceIstat, denominazione, provincia, mailSuap, mailSue, serviceContext); denominazione, provincia, mailSuap, mailSue, serviceContext);
} }
String redirect = ParamUtil.getString(actionRequest, "redirect"); String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) { if (Validator.isNull(redirect)) {
actionRequest.setAttribute(WebKeys.PORTOS_AMM_COMUNE, comune); actionRequest.setAttribute(WebKeys.PORTOS_AMM_COMUNE, comune);
@ -261,13 +201,11 @@ public class AmministrazionePortlet extends MVCPortlet {
} }
} catch (PortalException e) { } catch (PortalException e) {
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/comuni/edit.jsp"); actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/comuni/edit.jsp");
throw e; throw e;
} }
} }
public void saveTerritorio(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void saveTerritorio(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long territorioId = ParamUtil.getLong(actionRequest, "territorioId"); long territorioId = ParamUtil.getLong(actionRequest, "territorioId");
long comuneId = ParamUtil.getLong(actionRequest, "comuneId"); long comuneId = ParamUtil.getLong(actionRequest, "comuneId");
long groupId = ParamUtil.getLong(actionRequest, "groupId"); long groupId = ParamUtil.getLong(actionRequest, "groupId");
@ -279,27 +217,17 @@ public class AmministrazionePortlet extends MVCPortlet {
String agMax = ParamUtil.getString(actionRequest, "agMax"); String agMax = ParamUtil.getString(actionRequest, "agMax");
String agMin = ParamUtil.getString(actionRequest, "agMin"); String agMin = ParamUtil.getString(actionRequest, "agMin");
Comune comune = ComuneLocalServiceUtil.getComune(comuneId); Comune comune = ComuneLocalServiceUtil.getComune(comuneId);
Provincia provincia = ProvinciaLocalServiceUtil.findByC_C(comune.getCompanyId(), comune.getCodiceProvincia());
Provincia provincia = ProvinciaLocalServiceUtil.findByC_C(comune.getCompanyId(), ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(), actionRequest);
comune.getCodiceProvincia());
ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(),
actionRequest);
Territorio territorio = null; Territorio territorio = null;
if (territorioId == 0) { if (territorioId == 0) {
territorio = TerritorioServiceUtil.addTerritorio(comuneId, groupId, provincia.getCodiceProvincia(), zona,
territorio = TerritorioServiceUtil.addTerritorio(comuneId, groupId, fascia, articolo61, dtIni, dtFin, agMax, agMin, 0L, serviceContext);
provincia.getCodiceProvincia(), zona, fascia, articolo61, dtIni, dtFin, agMax, agMin, 0L,
serviceContext);
} else { } else {
territorio = TerritorioLocalServiceUtil.updateTerritorio(territorioId, groupId, comuneId, territorio = TerritorioLocalServiceUtil.updateTerritorio(territorioId, groupId, comuneId,
provincia.getCodiceProvincia(), zona, fascia, articolo61, dtIni, dtFin, agMax, agMin, provincia.getCodiceProvincia(), zona, fascia, articolo61, dtIni, dtFin, agMax, agMin,
serviceContext); serviceContext);
} }
String redirect = ParamUtil.getString(actionRequest, "redirect"); String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) { if (Validator.isNull(redirect)) {
actionRequest.setAttribute(WebKeys.PORTOS_AMM_TERRITORIO, territorio); actionRequest.setAttribute(WebKeys.PORTOS_AMM_TERRITORIO, territorio);
@ -308,148 +236,111 @@ public class AmministrazionePortlet extends MVCPortlet {
} }
public void deleteComune(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void deleteComune(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long comuneId = ParamUtil.getLong(actionRequest, "comuneId"); long comuneId = ParamUtil.getLong(actionRequest, "comuneId");
if (comuneId > 0) {
if (comuneId > 0)
ComuneLocalServiceUtil.deleteComune(comuneId); ComuneLocalServiceUtil.deleteComune(comuneId);
} }
}
public void deleteComunes(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void deleteComunes(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long[] deleteComuneIds = ParamUtil.getLongValues(actionRequest, "deleteComuneIds"); long[] deleteComuneIds = ParamUtil.getLongValues(actionRequest, "deleteComuneIds");
for (long deleteComuneId : deleteComuneIds) { for (long deleteComuneId : deleteComuneIds) {
ComuneLocalServiceUtil.deleteComune(deleteComuneId); ComuneLocalServiceUtil.deleteComune(deleteComuneId);
} }
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/comuni/view.jsp"); actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/comuni/view.jsp");
} }
public void deleteProvincia(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void deleteProvincia(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long provinciaId = ParamUtil.getLong(actionRequest, "provinciaId"); long provinciaId = ParamUtil.getLong(actionRequest, "provinciaId");
if (provinciaId > 0) { if (provinciaId > 0) {
ProvinciaLocalServiceUtil.deleteProvincia(provinciaId); ProvinciaLocalServiceUtil.deleteProvincia(provinciaId);
} }
} }
public void deleteProvincias(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void deleteProvincias(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long[] deleteProvinciaIds = ParamUtil.getLongValues(actionRequest, "deleteProvinciaIds"); long[] deleteProvinciaIds = ParamUtil.getLongValues(actionRequest, "deleteProvinciaIds");
for (long deleteProvinciaId : deleteProvinciaIds) { for (long deleteProvinciaId : deleteProvinciaIds) {
ProvinciaLocalServiceUtil.deleteProvincia(deleteProvinciaId); ProvinciaLocalServiceUtil.deleteProvincia(deleteProvinciaId);
} }
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/province/view.jsp"); actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/province/view.jsp");
} }
public void deleteTerritorio(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void deleteTerritorio(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long territorioId = ParamUtil.getLong(actionRequest, "territorioId"); long territorioId = ParamUtil.getLong(actionRequest, "territorioId");
if (territorioId > 0) { if (territorioId > 0) {
ComuneLocalServiceUtil.deleteComune(territorioId); ComuneLocalServiceUtil.deleteComune(territorioId);
} }
} }
public void importProvincias(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void importProvincias(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest); UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) uploadPortletRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) uploadPortletRequest.getAttribute(WebKeys.THEME_DISPLAY);
String delimiter = ParamUtil.getString(uploadPortletRequest, "delimiter"); String delimiter = ParamUtil.getString(uploadPortletRequest, "delimiter");
File file = uploadPortletRequest.getFile("file"); File file = uploadPortletRequest.getFile("file");
if (Validator.isNull(file)) { if (Validator.isNull(file)) {
throw new CSVFileNotFoundException(); throw new CSVFileNotFoundException();
} }
if (Validator.isNull(delimiter)) { if (Validator.isNull(delimiter)) {
throw new PortletException("Delimiter is null in request"); throw new PortletException("Delimiter is null in request");
} }
ServiceContext serviceContext = ServiceContextFactory.getInstance(Provincia.class.getName(), ServiceContext serviceContext = ServiceContextFactory.getInstance(Provincia.class.getName(),
uploadPortletRequest); uploadPortletRequest);
try { try {
_log.info("Inizio importazione province..."); _log.info("Inizio importazione province...");
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
CSVFormat format = CSVFormat.EXCEL.withDelimiter(delimiter.charAt(0)) CSVFormat format = CSVFormat.EXCEL.withDelimiter(delimiter.charAt(0))
.withHeader(Constants.AMMINISTRAZIONE_CSV_HEADERS_PROVINCE).withSkipHeaderRecord() .withHeader(Constants.AMMINISTRAZIONE_CSV_HEADERS_PROVINCE).withSkipHeaderRecord()
.withIgnoreEmptyLines().withIgnoreSurroundingSpaces(); .withIgnoreEmptyLines().withIgnoreSurroundingSpaces();
Iterable<CSVRecord> records = format.parse(new FileReader(file)); Iterable<CSVRecord> records = format.parse(new FileReader(file));
for (CSVRecord csvRecord : records) { for (CSVRecord csvRecord : records) {
try { try {
String codiceProvincia = StringUtils.leftPad( String codiceProvincia = StringUtils.leftPad(String.format(csvRecord.get("codice_provincia")), 3,
String.format(csvRecord.get("codice_provincia")), 3, '0'); '0');
String provincia = csvRecord.get("provincia"); String provincia = csvRecord.get("provincia");
String regione = csvRecord.get("regione"); String regione = csvRecord.get("regione");
String sigla = csvRecord.get("sigla"); String sigla = csvRecord.get("sigla");
Provincia provinciaO = null; Provincia provinciaO = null;
provinciaO = ProvinciaLocalServiceUtil.fetchByC_C(themeDisplay.getCompanyId(), provinciaO = ProvinciaLocalServiceUtil.fetchByC_C(themeDisplay.getCompanyId(), codiceProvincia);
codiceProvincia);
if (provinciaO == null) { if (provinciaO == null) {
provinciaO = ProvinciaLocalServiceUtil.fetchByC_S(themeDisplay.getCompanyId(), sigla); provinciaO = ProvinciaLocalServiceUtil.fetchByC_S(themeDisplay.getCompanyId(), sigla);
} }
if (provinciaO == null) { if (provinciaO == null) {
_log.info("La provincia non esiste e verrà creata: " + csvRecord); _log.info("La provincia non esiste e verrà creata: " + csvRecord);
ProvinciaLocalServiceUtil.addProvincia(themeDisplay.getUserId(), codiceProvincia, provincia,
ProvinciaLocalServiceUtil.addProvincia(themeDisplay.getUserId(), codiceProvincia, regione, sigla, serviceContext);
provincia, regione, sigla, serviceContext);
} else { } else {
_log.info("La provincia esiste e verrà aggiornata: " + csvRecord); _log.info("La provincia esiste e verrà aggiornata: " + csvRecord);
ProvinciaLocalServiceUtil.updateProvincia(themeDisplay.getUserId(), provinciaO.getPrimaryKey(),
ProvinciaLocalServiceUtil.updateProvincia(themeDisplay.getUserId(), provincia, regione, sigla, serviceContext);
provinciaO.getPrimaryKey(), provincia, regione, sigla, serviceContext);
} }
} catch (PortalException e) { } catch (PortalException e) {
_log.error("Errore di validazione: " + e.getClass().getName()); _log.error("Errore di validazione: " + e.getClass().getName());
} }
} }
long stop = System.currentTimeMillis(); long stop = System.currentTimeMillis();
_log.info("Importazione province terminata in " + (stop - start) + "ms"); _log.info("Importazione province terminata in " + (stop - start) + "ms");
} catch (Exception e) { } catch (Exception e) {
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/province/import.jsp"); actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/province/import.jsp");
throw e; throw e;
} }
} }
public void importComunes(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void importComunes(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest); UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) uploadPortletRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) uploadPortletRequest.getAttribute(WebKeys.THEME_DISPLAY);
String delimiter = ParamUtil.getString(uploadPortletRequest, "delimiter"); String delimiter = ParamUtil.getString(uploadPortletRequest, "delimiter");
File file = uploadPortletRequest.getFile("file"); File file = uploadPortletRequest.getFile("file");
if (Validator.isNull(delimiter) || Validator.isNull(file)) {
if (Validator.isNull(delimiter) || Validator.isNull(file))
throw new CSVFileNotFoundException(); throw new CSVFileNotFoundException();
}
ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(), ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(), uploadPortletRequest);
uploadPortletRequest);
try { try {
_log.info("Inizio importazione comuni..."); _log.info("Inizio importazione comuni...");
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
CSVFormat format = CSVFormat.EXCEL.withDelimiter(delimiter.charAt(0)) CSVFormat format = CSVFormat.EXCEL.withDelimiter(delimiter.charAt(0))
.withHeader(Constants.AMMINISTRAZIONE_CSV_HEADERS_COMUNI).withSkipHeaderRecord() .withHeader(Constants.AMMINISTRAZIONE_CSV_HEADERS_COMUNI).withSkipHeaderRecord()
.withIgnoreEmptyLines().withIgnoreSurroundingSpaces(); .withIgnoreEmptyLines().withIgnoreSurroundingSpaces();
Iterable<CSVRecord> records = format.parse(new FileReader(file)); Iterable<CSVRecord> records = format.parse(new FileReader(file));
for (CSVRecord csvRecord : records) { for (CSVRecord csvRecord : records) {
try { try {
String codiceProvincia = csvRecord.get("Codice Provincia (1)"); String codiceProvincia = csvRecord.get("Codice Provincia (1)");
@ -458,56 +349,45 @@ public class AmministrazionePortlet extends MVCPortlet {
String codiceBelfiore = csvRecord.get("Codice Catastale del comune"); String codiceBelfiore = csvRecord.get("Codice Catastale del comune");
String denominazione = csvRecord.get("Denominazione in italiano"); String denominazione = csvRecord.get("Denominazione in italiano");
String provincia = csvRecord.get("Flag Comune capoluogo di provincia"); String provincia = csvRecord.get("Flag Comune capoluogo di provincia");
boolean nazioneEstera = codiceBelfiore != null && codiceBelfiore.startsWith("Z"); boolean nazioneEstera = codiceBelfiore != null && codiceBelfiore.startsWith("Z");
if (Validator.isNull(codiceIstat) && nazioneEstera) { if (Validator.isNull(codiceIstat) && nazioneEstera) {
codiceIstat = codiceBelfiore; codiceIstat = codiceBelfiore;
} }
if (Validator.isNull(codiceIstat)) { if (Validator.isNull(codiceIstat)) {
_log.error("Il comune italiano non ha un codice istat assegnato e non sarà inserito: " _log.error("Il comune italiano non ha un codice istat assegnato e non sarà inserito: "
+ csvRecord); + csvRecord);
} else { } else {
boolean isProvincia = Validator.isNotNull(provincia) && provincia.equals("1") ? true boolean isProvincia = Validator.isNotNull(provincia) && provincia.equals("1") ? true : false;
: false; Comune comuneO = ComuneLocalServiceUtil
.fetchByC_CB(themeDisplay.getCompanyId(), codiceBelfiore);
Comune comuneO = ComuneLocalServiceUtil.fetchByC_CB(themeDisplay.getCompanyId(),
codiceBelfiore);
if (comuneO == null) if (comuneO == null)
comuneO = ComuneLocalServiceUtil.fetchByC_CI(themeDisplay.getCompanyId(), comuneO = ComuneLocalServiceUtil.fetchByC_CI(themeDisplay.getCompanyId(), codiceIstat);
codiceIstat);
if (comuneO == null) { if (comuneO == null) {
_log.debug("Il comune non esiste e verra' creato: " + csvRecord); _log.debug("Il comune non esiste e verra' creato: " + csvRecord);
if (nazioneEstera) if (nazioneEstera)
ComuneLocalServiceUtil.addComune(themeDisplay.getUserId(), codiceProvincia, ComuneLocalServiceUtil.addComune(themeDisplay.getUserId(), codiceProvincia,
codiceComune, codiceIstat, codiceBelfiore, denominazione, false, codiceComune, codiceIstat, codiceBelfiore, denominazione, false, true,
true, "", "", serviceContext); StringPool.BLANK, StringPool.BLANK, serviceContext);
else else
ComuneLocalServiceUtil.addComune(themeDisplay.getUserId(), codiceProvincia, ComuneLocalServiceUtil.addComune(themeDisplay.getUserId(), codiceProvincia,
codiceComune, codiceIstat, codiceBelfiore, denominazione, codiceComune, codiceIstat, codiceBelfiore, denominazione, isProvincia, false,
isProvincia, false, "", "", serviceContext); StringPool.BLANK, StringPool.BLANK, serviceContext);
} else { } else {
_log.debug("Il comune esiste e verra' aggiornato: " + csvRecord); _log.debug("Il comune esiste e verra' aggiornato: " + csvRecord);
ComuneLocalServiceUtil.updateComune(themeDisplay.getUserId(), ComuneLocalServiceUtil.updateComune(themeDisplay.getUserId(), comuneO.getPrimaryKey(),
comuneO.getPrimaryKey(), codiceProvincia, codiceComune, codiceIstat, codiceProvincia, codiceComune, codiceIstat, denominazione, isProvincia,
denominazione, isProvincia, nazioneEstera, "", "", serviceContext); nazioneEstera, StringPool.BLANK, StringPool.BLANK, serviceContext);
} }
} }
} catch (PortalException e) { } catch (PortalException e) {
_log.error("Errore di validazione: " + e.getClass().getName()); _log.error("Errore di validazione: " + e.getClass().getName());
} }
} }
long stop = System.currentTimeMillis(); long stop = System.currentTimeMillis();
_log.info("Importazione comuni terminata in " + (stop - start) + "ms"); _log.info("Importazione comuni terminata in " + (stop - start) + "ms");
} catch (Exception e) { } catch (Exception e) {
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/comunes/import.jsp"); actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/comunes/import.jsp");
throw e; throw e;
} }
} }
} }

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

@ -99,59 +99,45 @@ public class FascicoloPortlet extends MVCPortlet {
@Override @Override
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException { public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request));
.getHttpServletRequest(request));
String intPraticaId = httpReq.getParameter("intPraticaId"); String intPraticaId = httpReq.getParameter("intPraticaId");
if (Validator.isNotNull(intPraticaId)) {
if (Validator.isNotNull(intPraticaId) && !intPraticaId.equals("")) {
request.setAttribute("intPraticaId", intPraticaId); request.setAttribute("intPraticaId", intPraticaId);
} }
super.render(request, response); super.render(request, response);
} }
public void toggleWorkflow(ActionRequest actionRequest, ActionResponse actionResponse) { public void toggleWorkflow(ActionRequest actionRequest, ActionResponse actionResponse) {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
User user = themeDisplay.getUser(); User user = themeDisplay.getUser();
boolean attivare = ParamUtil.getBoolean(actionRequest, "avviare"); boolean attivare = ParamUtil.getBoolean(actionRequest, "avviare");
boolean sospendere = ParamUtil.getBoolean(actionRequest, "sospendere"); boolean sospendere = ParamUtil.getBoolean(actionRequest, "sospendere");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0);
String stato_pratica = ParamUtil.getString(actionRequest, "seleziona_stato"); String stato_pratica = ParamUtil.getString(actionRequest, "seleziona_stato");
try { try {
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId);
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPraticaId); DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPraticaId);
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
if (attivare && !sospendere) { if (attivare && !sospendere) {
WorkflowUtil.attivaWorkflow(intPraticaId, territorio.getGroupId(), WorkflowUtil.attivaWorkflow(intPraticaId, territorio.getGroupId(), serviceContext.getUserId(),
serviceContext.getUserId(), dettPratica.getDettPraticaId(), serviceContext, true); dettPratica.getDettPraticaId(), serviceContext, true);
addRowHistoryWorkflowAction(intPraticaId, dettPratica.getDettPraticaId(), themeDisplay.getCompanyId(),
addRowHistoryWorkflowAction(intPraticaId, dettPratica.getDettPraticaId(), intPratica.getGroupId(), user, true);
themeDisplay.getCompanyId(), intPratica.getGroupId(), user, true);
SessionMessages.add(actionRequest, "success-workflow-ripreso"); SessionMessages.add(actionRequest, "success-workflow-ripreso");
} else if (!attivare && sospendere) { } else if (!attivare && sospendere) {
WorkflowUtil.attivaWorkflow(intPraticaId, territorio.getGroupId(), WorkflowUtil.attivaWorkflow(intPraticaId, territorio.getGroupId(), serviceContext.getUserId(),
serviceContext.getUserId(), dettPratica.getDettPraticaId(), serviceContext, false); dettPratica.getDettPraticaId(), serviceContext, false);
addRowHistoryWorkflowAction(intPraticaId, dettPratica.getDettPraticaId(), themeDisplay.getCompanyId(),
addRowHistoryWorkflowAction(intPraticaId, dettPratica.getDettPraticaId(), intPratica.getGroupId(), user, false);
themeDisplay.getCompanyId(), intPratica.getGroupId(), user, false);
SessionMessages.add(actionRequest, "success-workflow-sospeso"); SessionMessages.add(actionRequest, "success-workflow-sospeso");
} else { } else {
SessionErrors.add(actionRequest, "error-workflow-stato-incosistente"); SessionErrors.add(actionRequest, "error-workflow-stato-incosistente");
} }
String redirectURL = ParamUtil.getString(actionRequest, "redirect"); String redirectURL = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNotNull(redirectURL)) { if (Validator.isNotNull(redirectURL)) {
actionResponse.sendRedirect(redirectURL); actionResponse.sendRedirect(redirectURL);
} }
if (!attivare) { if (!attivare) {
intPratica.setStatoPratica(stato_pratica); intPratica.setStatoPratica(stato_pratica);
IntPraticaLocalServiceUtil.updateStatoPratica(intPraticaId, 0, stato_pratica); IntPraticaLocalServiceUtil.updateStatoPratica(intPraticaId, 0, stato_pratica);
@ -160,23 +146,17 @@ public class FascicoloPortlet extends MVCPortlet {
IntPraticaLocalServiceUtil.updateStatoPratica(intPraticaId, 0, IntPraticaLocalServiceUtil.updateStatoPratica(intPraticaId, 0,
StatoPraticaConstants.SOTTOPOSTA_A_PARERE); StatoPraticaConstants.SOTTOPOSTA_A_PARERE);
} }
IntPraticaLocalServiceUtil.reIndexFasciolo(intPraticaId, intPratica.getCompanyId()); IntPraticaLocalServiceUtil.reIndexFasciolo(intPraticaId, intPratica.getCompanyId());
} catch (Exception e) { } catch (Exception e) {
_log.error("error-workflow-sospeso", e); _log.error("error-workflow-sospeso", e);
SessionErrors.add(actionRequest, attivare ? "error-workflow-sospeso" : "error-workflow-ripreso"); SessionErrors.add(actionRequest, attivare ? "error-workflow-sospeso" : "error-workflow-ripreso");
} }
} }
private void addRowHistoryWorkflowAction(long intPraticaId, long dettPraticaId, long companyId, private void addRowHistoryWorkflowAction(long intPraticaId, long dettPraticaId, long companyId, long groupId,
long groupId, User user, boolean attivato) throws SystemException { User user, boolean attivato) throws SystemException {
HistoryWorkflowAction historyWorkflowAction = HistoryWorkflowActionLocalServiceUtil HistoryWorkflowAction historyWorkflowAction = HistoryWorkflowActionLocalServiceUtil
.createHistoryWorkflowAction(CounterLocalServiceUtil.increment(HistoryWorkflowAction.class .createHistoryWorkflowAction(CounterLocalServiceUtil.increment(HistoryWorkflowAction.class.getName()));
.getName()));
historyWorkflowAction.setAttivato(attivato); historyWorkflowAction.setAttivato(attivato);
historyWorkflowAction.setCompanyId(companyId); historyWorkflowAction.setCompanyId(companyId);
historyWorkflowAction.setCreateDate(new Date()); historyWorkflowAction.setCreateDate(new Date());
@ -186,33 +166,24 @@ public class FascicoloPortlet extends MVCPortlet {
historyWorkflowAction.setIntPraticaId(intPraticaId); historyWorkflowAction.setIntPraticaId(intPraticaId);
historyWorkflowAction.setDettPraticaId(dettPraticaId); historyWorkflowAction.setDettPraticaId(dettPraticaId);
historyWorkflowAction.setGroupId(groupId); historyWorkflowAction.setGroupId(groupId);
HistoryWorkflowActionLocalServiceUtil.updateHistoryWorkflowAction(historyWorkflowAction); HistoryWorkflowActionLocalServiceUtil.updateHistoryWorkflowAction(historyWorkflowAction);
} }
public void toggleSospensione(ActionRequest actionRequest, ActionResponse actionResponse) { public void toggleSospensione(ActionRequest actionRequest, ActionResponse actionResponse) {
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0);
boolean sospesa = ParamUtil.getBoolean(actionRequest, "sospesa"); boolean sospesa = ParamUtil.getBoolean(actionRequest, "sospesa");
try { try {
IntPraticaServiceUtil.sospendiPratica(intPraticaId, sospesa); IntPraticaServiceUtil.sospendiPratica(intPraticaId, sospesa);
SessionMessages.add(actionRequest, sospesa ? "success-sospesa" : "success-ripresa"); SessionMessages.add(actionRequest, sospesa ? "success-sospesa" : "success-ripresa");
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
_log.error("error-workflow-sospeso", e); _log.error("error-workflow-sospeso", e);
SessionErrors.add(actionRequest, sospesa ? "error-sospesa" : "error-ripresa"); SessionErrors.add(actionRequest, sospesa ? "error-sospesa" : "error-ripresa");
} }
} }
public void cambiaStato(ActionRequest actionRequest, ActionResponse actionResponse) { public void cambiaStato(ActionRequest actionRequest, ActionResponse actionResponse) {
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0);
String statoPratica = ParamUtil.getString(actionRequest, "nuovoStatoPratica"); String statoPratica = ParamUtil.getString(actionRequest, "nuovoStatoPratica");
_log.info("cambiaSospendiRiprendi: INTPRATICAID" + intPraticaId); _log.info("cambiaSospendiRiprendi: INTPRATICAID" + intPraticaId);
try { try {
_log.info("cambiaSospendiRiprendi: INTPRATICAID" + intPraticaId + " NUOVO STATO: " + statoPratica); _log.info("cambiaSospendiRiprendi: INTPRATICAID" + intPraticaId + " NUOVO STATO: " + statoPratica);
@ -222,15 +193,12 @@ public class FascicoloPortlet extends MVCPortlet {
_log.error("error-workflow-sospeso", e); _log.error("error-workflow-sospeso", e);
SessionErrors.add(actionRequest, "error-cambio-stato"); SessionErrors.add(actionRequest, "error-cambio-stato");
} }
} }
public void aggiungiRichiestaParere(ActionRequest actionRequest, ActionResponse actionResponse) { public void aggiungiRichiestaParere(ActionRequest actionRequest, ActionResponse actionResponse) {
long geologoId = ParamUtil.getLong(actionRequest, "geologoId"); long geologoId = ParamUtil.getLong(actionRequest, "geologoId");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId"); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId"); long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
try { try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
serviceContext.setCreateDate(new Date()); serviceContext.setCreateDate(new Date());
@ -243,37 +211,32 @@ public class FascicoloPortlet extends MVCPortlet {
} }
public void cambiaTitolare(ActionRequest actionRequest, ActionResponse actionResponse) { public void cambiaTitolare(ActionRequest actionRequest, ActionResponse actionResponse) {
String nuovoSoggettoCF = ParamUtil.getString(actionRequest, "nuovoSoggettoCF"); String nuovoSoggettoCF = ParamUtil.getString(actionRequest, "nuovoSoggettoCF");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0);
long companyId = ParamUtil.getLong(actionRequest, "companyId"); long companyId = ParamUtil.getLong(actionRequest, "companyId");
try { try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
User user = UserLocalServiceUtil.fetchUserByScreenName(companyId, nuovoSoggettoCF); User user = UserLocalServiceUtil.fetchUserByScreenName(companyId, nuovoSoggettoCF);
if (Validator.isNotNull(user)) { if (Validator.isNotNull(user)) {
if (!ValidazionePraticaUtil.praticaInProgress(intPraticaId)) { if (!ValidazionePraticaUtil.praticaInProgress(intPraticaId)) {
_log.info("cambiaTitolare: cfNuovoTitolare " + nuovoSoggettoCF + " intpratica" _log.info("cambiaTitolare: cfNuovoTitolare " + nuovoSoggettoCF + " intpratica" + intPraticaId);
+ intPraticaId);
IntPraticaServiceUtil.cambiaTitolare(intPraticaId, user.getUserId(), serviceContext); IntPraticaServiceUtil.cambiaTitolare(intPraticaId, user.getUserId(), serviceContext);
SessionMessages.add(actionRequest, "success-cambio-titolare"); SessionMessages.add(actionRequest, "success-cambio-titolare");
} else { } else {
SessionErrors.add(actionRequest, "error-cambio-titolare-pratica-in-progress"); SessionErrors.add(actionRequest, "error-cambio-titolare-pratica-in-progress");
} }
} else { } else {
_log.error("[FASCICOLO ACTION - CAMBIO TITOLARE] Nessun utente trovato con company " _log.error("[FASCICOLO ACTION - CAMBIO TITOLARE] Nessun utente trovato con company " + companyId
+ companyId + " e codice fiscale " + nuovoSoggettoCF); + " e codice fiscale " + nuovoSoggettoCF);
SessionErrors.add(actionRequest, "error-cambio-titolare-no-such-user"); SessionErrors.add(actionRequest, "error-cambio-titolare-no-such-user");
} }
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
_log.error("error-cambio-titolare", e); _log.error("error-cambio-titolare", e);
SessionErrors.add(actionRequest, "error-cambio-titolare"); SessionErrors.add(actionRequest, "error-cambio-titolare");
} }
} }
public void searchURL(ActionRequest actionRequest, ActionResponse actionResponse) { public void searchURL(ActionRequest actionRequest, ActionResponse actionResponse) {
String numeroProgetto = actionRequest.getParameter("numeroProgetto"); String numeroProgetto = actionRequest.getParameter("numeroProgetto");
String protocollo = actionRequest.getParameter("protocollo"); String protocollo = actionRequest.getParameter("protocollo");
String tipoPratica = actionRequest.getParameter("tipoPratica"); String tipoPratica = actionRequest.getParameter("tipoPratica");
@ -290,35 +253,26 @@ public class FascicoloPortlet extends MVCPortlet {
String comune = actionRequest.getParameter("comune"); String comune = actionRequest.getParameter("comune");
String tipoIntervento = actionRequest.getParameter("tipoIntervento"); String tipoIntervento = actionRequest.getParameter("tipoIntervento");
String indirizzo = actionRequest.getParameter("indirizzo"); String indirizzo = actionRequest.getParameter("indirizzo");
if (Validator.isNotNull(dataRichiestaInizio)) {
if (dataRichiestaInizio != null && !dataRichiestaInizio.equals("")) { String[] dataRichiestaInizioSplitted = dataRichiestaInizio.split(StringPool.FORWARD_SLASH);
String[] dataRichiestaInizioSplitted = dataRichiestaInizio.split("/"); int month = Integer.valueOf(dataRichiestaInizioSplitted[1]) - 1;
int mounth = Integer.valueOf(dataRichiestaInizioSplitted[1]) - 1;
actionResponse.setRenderParameter("dataRichiestaInizioDay", dataRichiestaInizioSplitted[0]); actionResponse.setRenderParameter("dataRichiestaInizioDay", dataRichiestaInizioSplitted[0]);
actionResponse.setRenderParameter("dataRichiestaInizioMonth", mounth + ""); actionResponse.setRenderParameter("dataRichiestaInizioMonth", String.valueOf(month));
actionResponse.setRenderParameter("dataRichiestaInizioYear", dataRichiestaInizioSplitted[2]); actionResponse.setRenderParameter("dataRichiestaInizioYear", dataRichiestaInizioSplitted[2]);
} }
if (Validator.isNotNull(dataRichiestaFine)) {
if (dataRichiestaFine != null && !dataRichiestaFine.equals("")) { String[] dataRichiestaFineSplitted = dataRichiestaFine.split(StringPool.FORWARD_SLASH);
String[] dataRichiestaFineSplitted = dataRichiestaFine.split("/"); int month = Integer.valueOf(dataRichiestaFineSplitted[1]) - 1;
int mounth = Integer.valueOf(dataRichiestaFineSplitted[1]) - 1;
actionResponse.setRenderParameter("dataRichiestaFineDay", dataRichiestaFineSplitted[0]); actionResponse.setRenderParameter("dataRichiestaFineDay", dataRichiestaFineSplitted[0]);
actionResponse.setRenderParameter("dataRichiestaFineMonth", mounth + ""); actionResponse.setRenderParameter("dataRichiestaFineMonth", String.valueOf(month));
actionResponse.setRenderParameter("dataRichiestaFineYear", dataRichiestaFineSplitted[2]); actionResponse.setRenderParameter("dataRichiestaFineYear", dataRichiestaFineSplitted[2]);
} }
String ufficio = actionRequest.getParameter("ufficio"); String ufficio = actionRequest.getParameter("ufficio");
String ordinaPer = actionRequest.getParameter("ordinaPer"); String ordinaPer = actionRequest.getParameter("ordinaPer");
String ordinaTipo = actionRequest.getParameter("ordinaTipo"); String ordinaTipo = actionRequest.getParameter("ordinaTipo");
if (Validator.isNotNull(tipoIntervento)) {
if (tipoIntervento != null && !tipoIntervento.equals("")) {
actionResponse.setRenderParameter("tipoIntervento", tipoIntervento); actionResponse.setRenderParameter("tipoIntervento", tipoIntervento);
} }
actionResponse.setRenderParameter("numeroProgetto", numeroProgetto); actionResponse.setRenderParameter("numeroProgetto", numeroProgetto);
actionResponse.setRenderParameter("praticaAperta", praticaAperta); actionResponse.setRenderParameter("praticaAperta", praticaAperta);
actionResponse.setRenderParameter("descIntervento", descInterventoSearch); actionResponse.setRenderParameter("descIntervento", descInterventoSearch);
@ -327,65 +281,51 @@ public class FascicoloPortlet extends MVCPortlet {
actionResponse.setRenderParameter("tipoPratica", tipoPratica); actionResponse.setRenderParameter("tipoPratica", tipoPratica);
actionResponse.setRenderParameter("statoPratica", statoPratica); actionResponse.setRenderParameter("statoPratica", statoPratica);
actionResponse.setRenderParameter("committente", committente); actionResponse.setRenderParameter("committente", committente);
if (Validator.isNotNull(provincia)) {
if (provincia != null && !provincia.equals("")) {
actionResponse.setRenderParameter("provincia", provincia); actionResponse.setRenderParameter("provincia", provincia);
} }
if (Validator.isNotNull(comune)) {
if (comune != null && !comune.equals("")) {
actionResponse.setRenderParameter("comune", comune); actionResponse.setRenderParameter("comune", comune);
} }
actionResponse.setRenderParameter("indirizzo", indirizzo); actionResponse.setRenderParameter("indirizzo", indirizzo);
if (Validator.isNull(tecnicoIstruttore)) {
if (tecnicoIstruttore != null && !tecnicoIstruttore.equals("")) {
actionResponse.setRenderParameter("tecnicoIstruttore", tecnicoIstruttore);
} else {
actionResponse.setRenderParameter("tecnicoIstruttore", StringPool.BLANK); actionResponse.setRenderParameter("tecnicoIstruttore", StringPool.BLANK);
} else {
actionResponse.setRenderParameter("tecnicoIstruttore", tecnicoIstruttore);
} }
actionResponse.setRenderParameter("titolareDigitale", titolareDigitale); actionResponse.setRenderParameter("titolareDigitale", titolareDigitale);
actionResponse.setRenderParameter("soggettiInterconnessi", soggettiInterconnessi); actionResponse.setRenderParameter("soggettiInterconnessi", soggettiInterconnessi);
actionResponse.setRenderParameter("dataRichiestaInizio", dataRichiestaInizio); actionResponse.setRenderParameter("dataRichiestaInizio", dataRichiestaInizio);
actionResponse.setRenderParameter("dataRichiestaFine", dataRichiestaFine); actionResponse.setRenderParameter("dataRichiestaFine", dataRichiestaFine);
if (Validator.isNull(ufficio)) {
if (ufficio != null && !ufficio.equals("")) { actionResponse.setRenderParameter("ufficio", "-1");
actionResponse.setRenderParameter("ufficio", ufficio);
} else { } else {
actionResponse.setRenderParameter("ufficio", -1 + ""); actionResponse.setRenderParameter("ufficio", ufficio);
} }
actionResponse.setRenderParameter("ordinaPer", ordinaPer); actionResponse.setRenderParameter("ordinaPer", ordinaPer);
actionResponse.setRenderParameter("ordinaTipo", ordinaTipo); actionResponse.setRenderParameter("ordinaTipo", ordinaTipo);
} }
public void versiona(ActionRequest actionRequest, ActionResponse actionResponse) { public void versiona(ActionRequest actionRequest, ActionResponse actionResponse) {
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId", 0); long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId", 0);
long companyId = ParamUtil.getLong(actionRequest, "companyId"); long companyId = ParamUtil.getLong(actionRequest, "companyId");
try { try {
DettPraticaServiceUtil.sendToVersioning(dettPraticaId, companyId); DettPraticaServiceUtil.sendToVersioning(dettPraticaId, companyId);
} catch (Exception e) { } catch (Exception e) {
_log.error("error-versioning", e); _log.error("error-versioning", e);
SessionErrors.add(actionRequest, "error-versioning"); SessionErrors.add(actionRequest, "error-versioning");
} }
PortalUtil.copyRequestParameters(actionRequest, actionResponse); PortalUtil.copyRequestParameters(actionRequest, actionResponse);
} }
@Override @Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
throws IOException, PortletException { PortletException {
String id = resourceRequest.getResourceID(); String id = resourceRequest.getResourceID();
ServiceContext serviceContext; ServiceContext serviceContext;
try { try {
serviceContext = ServiceContextFactory.getInstance(resourceRequest); serviceContext = ServiceContextFactory.getInstance(resourceRequest);
if ("downloadAllDocPratica".equals(id)) { if ("downloadAllDocPratica".equals(id)) {
long intPraticaId = ParamUtil.getLong(resourceRequest, "intPraticaId"); long intPraticaId = ParamUtil.getLong(resourceRequest, "intPraticaId");
long classPk = ParamUtil.getLong(resourceRequest, "classPk"); long classPk = ParamUtil.getLong(resourceRequest, "classPk");
String comingFrom = ParamUtil.getString(resourceRequest, "comingFrom"); String comingFrom = ParamUtil.getString(resourceRequest, "comingFrom");
@ -403,14 +343,11 @@ public class FascicoloPortlet extends MVCPortlet {
} else if ("page_collaudo".equals(comingFrom)) { } else if ("page_collaudo".equals(comingFrom)) {
tipologieAllegati = DocumentiPraticaUtil.getDocCollaudo(); tipologieAllegati = DocumentiPraticaUtil.getDocCollaudo();
} }
docs = DocPraticaLocalServiceUtil.findByIntPratica_ClassPk_Tipologie(intPraticaId, docs = DocPraticaLocalServiceUtil.findByIntPratica_ClassPk_Tipologie(intPraticaId, classPk,
classPk, tipologieAllegati); tipologieAllegati);
} }
ZipWriter zipWriter = ZipWriterFactoryUtil.getZipWriter(); ZipWriter zipWriter = ZipWriterFactoryUtil.getZipWriter();
for (DocPratica doc : docs) { for (DocPratica doc : docs) {
InputStream inputStream = null; InputStream inputStream = null;
try { try {
if (Validator.isNull(doc.getDlFileEntryId())) { if (Validator.isNull(doc.getDlFileEntryId())) {
@ -419,31 +356,23 @@ public class FascicoloPortlet extends MVCPortlet {
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(doc.getDlFileEntryId()); FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(doc.getDlFileEntryId());
inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(),
fileEntry.getVersion(), false); fileEntry.getVersion(), false);
// String name = fileEntry.getTitle() +
// StringPool.PERIOD + fileEntry.getExtension();
String name = fileEntry.getTitle(); String name = fileEntry.getTitle();
zipWriter.addEntry(name, inputStream); zipWriter.addEntry(name, inputStream);
} finally { } finally {
StreamUtil.cleanUp(inputStream); StreamUtil.cleanUp(inputStream);
} }
} }
resourceResponse.reset(); resourceResponse.reset();
File file = zipWriter.getFile(); File file = zipWriter.getFile();
byte[] data = Files.readAllBytes(file.toPath()); byte[] data = Files.readAllBytes(file.toPath());
resourceResponse.setContentType(ContentTypes.APPLICATION_ZIP); resourceResponse.setContentType(ContentTypes.APPLICATION_ZIP);
resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate"); resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate");
resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION,
+ file.getName() + "\""); "attachment; filename=\"" + file.getName() + "\"");
resourceResponse.setContentLength(data.length); resourceResponse.setContentLength(data.length);
resourceResponse.getPortletOutputStream().write(data); resourceResponse.getPortletOutputStream().write(data);
resourceResponse.getPortletOutputStream().flush(); resourceResponse.getPortletOutputStream().flush();
resourceResponse.getPortletOutputStream().close(); resourceResponse.getPortletOutputStream().close();
} else if ("importFile".equals(id)) { } else if ("importFile".equals(id)) {
PortletResponseUtil PortletResponseUtil
.write(resourceResponse, .write(resourceResponse,
@ -452,27 +381,23 @@ public class FascicoloPortlet extends MVCPortlet {
} else if ("importAllFascicoloFiles".equals(id)) { } else if ("importAllFascicoloFiles".equals(id)) {
long intPraticaId = ParamUtil.getLong(resourceRequest, "intPraticaId"); long intPraticaId = ParamUtil.getLong(resourceRequest, "intPraticaId");
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
if (Validator.isNull(intPratica)) { if (Validator.isNull(intPratica)) {
_log.error("error.no.intpratica.exist with intpraticaid=" + intPraticaId); _log.error("error.no.intpratica.exist with intpraticaid=" + intPraticaId);
} }
String comingFrom = ParamUtil.getString(resourceRequest, "comingFrom", "bo"); String comingFrom = ParamUtil.getString(resourceRequest, "comingFrom", "bo");
InfoFascicolo infoFascicolo = InfoFascicoloLocalServiceUtil.fetchByIntPratica(intPratica InfoFascicolo infoFascicolo = InfoFascicoloLocalServiceUtil.fetchByIntPratica(intPratica
.getIntPraticaId()); .getIntPraticaId());
if (Validator.isNull(infoFascicolo)) { if (Validator.isNull(infoFascicolo)) {
infoFascicolo = InfoFascicoloLocalServiceUtil.addInfoFascicolo( infoFascicolo = InfoFascicoloLocalServiceUtil.addInfoFascicolo(intPratica.getIntPraticaId(),
intPratica.getIntPraticaId(), intPratica.getNumeroProgetto(), serviceContext); intPratica.getNumeroProgetto(), serviceContext);
} else { } else {
if (infoFascicolo.getAlreadyImported() && comingFrom.equalsIgnoreCase("fe")) { if (infoFascicolo.getAlreadyImported() && comingFrom.equalsIgnoreCase("fe")) {
_log.error("intpratica.import.file.already-clicked with intpraticaid=" + intPraticaId); _log.error("intpratica.import.file.already-clicked with intpraticaid=" + intPraticaId);
return; return;
} }
} }
infoFascicolo.setAlreadyImported(true); infoFascicolo.setAlreadyImported(true);
infoFascicolo = InfoFascicoloLocalServiceUtil.updateInfoFascicolo(infoFascicolo); infoFascicolo = InfoFascicoloLocalServiceUtil.updateInfoFascicolo(infoFascicolo);
PortletResponseUtil PortletResponseUtil
.write(resourceResponse, .write(resourceResponse,
"<p style='margin-bottom:20px'><strong>Completato</strong></p><a href='#' class='btn btn-success' onclick=\"Liferay.Portlet.refresh('#p_p_id_" "<p style='margin-bottom:20px'><strong>Completato</strong></p><a href='#' class='btn btn-success' onclick=\"Liferay.Portlet.refresh('#p_p_id_"
@ -481,51 +406,37 @@ public class FascicoloPortlet extends MVCPortlet {
String provinciaId = ParamUtil.getString(resourceRequest, "provinciaId"); String provinciaId = ParamUtil.getString(resourceRequest, "provinciaId");
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
if (Validator.isNotNull(provinciaId) && !provinciaId.equals("0")) { if (Validator.isNotNull(provinciaId) && !provinciaId.equals("0")) {
List<Long> comuniIds = TerritorioLocalServiceUtil List<Long> comuniIds = TerritorioLocalServiceUtil.getActiveComuniByCodiceProvincia(provinciaId);
.getActiveComuniByCodiceProvincia(provinciaId);
// ADT BUG-ID=15 Sezione Ricerca / Ordinamento Filtro // ADT BUG-ID=15 Sezione Ricerca / Ordinamento Filtro
List<Comune> comumeList = new ArrayList<Comune>(); List<Comune> comumeList = new ArrayList<Comune>();
for (long comuneId : comuniIds) { for (long comuneId : comuniIds) {
Comune comune = ComuneLocalServiceUtil.getComune(comuneId); Comune comune = ComuneLocalServiceUtil.getComune(comuneId);
comumeList.add(comune); comumeList.add(comune);
} }
Collections.sort(comumeList, new Comparator<Comune>() { Collections.sort(comumeList, new Comparator<Comune>() {
@Override @Override
public int compare(Comune o1, Comune o2) { public int compare(Comune o1, Comune o2) {
return o1.getDenominazione().compareTo(o2.getDenominazione()); return o1.getDenominazione().compareTo(o2.getDenominazione());
} }
}); });
for (Comune comune : comumeList) { for (Comune comune : comumeList) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("comuneId", comune.getComuneId()); jsonObject.put("comuneId", comune.getComuneId());
jsonObject.put("descLong", comune.getDenominazione()); jsonObject.put("descLong", comune.getDenominazione());
jsonArray.put(jsonObject); jsonArray.put(jsonObject);
} }
} }
writeJSON(resourceRequest, resourceResponse, jsonArray); writeJSON(resourceRequest, resourceResponse, jsonArray);
} else if ("exportRicerca".equals(id)) { } else if ("exportRicerca".equals(id)) {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest
.getAttribute(WebKeys.THEME_DISPLAY);
Locale locale = themeDisplay.getLocale(); Locale locale = themeDisplay.getLocale();
User user = themeDisplay.getUser(); User user = themeDisplay.getUser();
String csv = StringPool.BLANK; String csv = StringPool.BLANK;
HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest);
HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse); HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse);
csv = exportSearch(locale, resourceRequest, user); csv = exportSearch(locale, resourceRequest, user);
ServletResponseUtil.sendFile(request, response, "export_ricerca.csv", csv.getBytes(StringPool.UTF8),
ServletResponseUtil.sendFile(request, response, "export_ricerca.csv", ContentTypes.TEXT_CSV_UTF8);
csv.getBytes(StringPool.UTF8), ContentTypes.TEXT_CSV_UTF8);
} else { } else {
super.serveResource(resourceRequest, resourceResponse); super.serveResource(resourceRequest, resourceResponse);
} }
@ -533,108 +444,74 @@ public class FascicoloPortlet extends MVCPortlet {
_log.error(e, e); _log.error(e, e);
throw new IOException(e); throw new IOException(e);
} }
} }
private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user) { private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user) {
String method = "exportSearch"; String method = "exportSearch";
HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
List<IntPratica> lista = new ArrayList<IntPratica>(); List<IntPratica> lista = new ArrayList<IntPratica>();
// try {
Hits hits = IntPraticaAdvancedSearch.searchProgettiBO(httpRequest, user, -1, -1); Hits hits = IntPraticaAdvancedSearch.searchProgettiBO(httpRequest, user, -1, -1);
for (Document doc : hits.toList()) { for (Document doc : hits.toList()) {
String intPraticaId = doc.get("intPraticaId"); String intPraticaId = doc.get("intPraticaId");
try { try {
if (Validator.isNotNull(intPraticaId)) { if (Validator.isNotNull(intPraticaId)) {
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(GetterUtil IntPratica intPratica = IntPraticaLocalServiceUtil
.getLong(intPraticaId)); .fetchIntPratica(GetterUtil.getLong(intPraticaId));
if (Validator.isNotNull(intPratica)) { if (Validator.isNotNull(intPratica)) {
lista.add(intPratica); lista.add(intPratica);
} }
} }
} catch (Throwable e) { } catch (Throwable e) {
_log.error(method + " IntPraticaLocalServiceUtil.fetchIntPratica IntPraticaId: " _log.error(method + " IntPraticaLocalServiceUtil.fetchIntPratica IntPraticaId: " + intPraticaId, e);
+ intPraticaId, e);
} }
} }
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.sorteggiata")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.sorteggiata")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.pratica")));
"label.scadenzegeniocivile.pratica")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.titolare")));
"label.scadenzegeniocivile.titolare")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.committenti")));
"label.scadenzegeniocivile.committenti")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.istruttore")));
"label.scadenzegeniocivile.istruttore")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.statoPratica")));
"label.scadenzegeniocivile.statoPratica")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
// ADT BUG-ID=15 Sezione Ricerca / Export csv // ADT BUG-ID=15 Sezione Ricerca / Export csv
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
"label.scadenzegeniocivile.provincia")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.comune")));
"label.scadenzegeniocivile.comune")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.descrizioneIntervento"))); "label.scadenzegeniocivile.descrizioneIntervento")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
for (IntPratica intPratica : lista) { for (IntPratica intPratica : lista) {
try { try {
DettPratica lastDettPratica = DettPraticaLocalServiceUtil DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica
.getLastCompletedByIntPratica(intPratica.getIntPraticaId()); .getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica
.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId()); Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia()); territorio.getCodiceProvincia());
boolean sorteggiata = SorteggioLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()) != null;
boolean sorteggiata = SorteggioLocalServiceUtil
.findByIntPratica(intPratica.getIntPraticaId()) != null;
sb.append(CSVUtil.encode((sorteggiata) ? "Si" : "No")); sb.append(CSVUtil.encode((sorteggiata) ? "Si" : "No"));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
String praticaLabel = intPratica.getTitle(locale, true); String praticaLabel = intPratica.getTitle(locale, true);
sb.append(CSVUtil.encode(praticaLabel)); sb.append(CSVUtil.encode(praticaLabel));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
List<Soggetto> titolari = SoggettoLocalServiceUtil.getValidByIntPratica_CodiceFiscale( List<Soggetto> titolari = SoggettoLocalServiceUtil.getValidByIntPratica_CodiceFiscale(
lastDettPratica.getIntPraticaId(), lastDettPratica.getIntPraticaId(), lastDettPratica.getCodiceFiscaleDelegatoCommittente());
lastDettPratica.getCodiceFiscaleDelegatoCommittente());
Soggetto titolare = null; Soggetto titolare = null;
if (!titolari.isEmpty()) { if (!titolari.isEmpty()) {
titolare = titolari.get(0); titolare = titolari.get(0);
} }
if (titolare != null) { if (titolare != null) {
sb.append(titolare.getTitle() + " - " + titolare.getCodiceFiscale()); sb.append(titolare.getTitle()).append(" - ").append(titolare.getCodiceFiscale());
} else {
sb.append("");
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
List<Soggetto> committenti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto( List<Soggetto> committenti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
lastDettPratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE); lastDettPratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE);
for (Soggetto committente : committenti) { for (Soggetto committente : committenti) {
@ -643,63 +520,39 @@ public class FascicoloPortlet extends MVCPortlet {
} }
if (builder.length() > 0) if (builder.length() > 0)
builder.setLength(builder.length() - 12); builder.setLength(builder.length() - 12);
sb.append(builder.toString()); sb.append(builder.toString());
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
User istruttore = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId()); User istruttore = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (istruttore != null) { if (istruttore != null) {
sb.append(istruttore.getFullName()); sb.append(istruttore.getFullName());
} else {
sb.append("");
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(LanguageUtil.get(locale, sb.append(LanguageUtil.get(locale,
PraticaUtil.getStatoPraticaLabel(intPratica.getStatoPratica(), intPratica))); PraticaUtil.getStatoPraticaLabel(intPratica.getStatoPratica(), intPratica)));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
// ADT BUG-ID=15 Sezione Ricerca / Export csv // ADT BUG-ID=15 Sezione Ricerca / Export csv
sb.append(provincia != null ? provincia.getProvincia() : ""); if (Validator.isNotNull(provincia)) {
sb.append(provincia.getProvincia());
}
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(comune != null ? comune.getDenominazione() : ""); if (Validator.isNotNull(comune)) {
sb.append(comune.getDenominazione());
}
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
// sb.append("Territorio: "
// ).append(comune.getDenominazione()).append(!lastDettPratica.getLocalita().isEmpty()
// ? "(Loc. "+lastDettPratica.getLocalita()+" ) " :
// "").append(" - ").append(provincia.getProvincia());
// ADT BUG-ID=15 Sezione Ricerca / Export csv - Max 30 chars // ADT BUG-ID=15 Sezione Ricerca / Export csv - Max 30 chars
int MAX_LENGHT_DESCR_INTERVENTO = 30; int MAX_LENGHT_DESCR_INTERVENTO = 30;
sb.append(lastDettPratica.getDescLongIntervento() == null ? "" : lastDettPratica if (Validator.isNotNull(lastDettPratica.getDescLongIntervento())) {
.getDescLongIntervento().length() > MAX_LENGHT_DESCR_INTERVENTO ? lastDettPratica sb.append(lastDettPratica.getDescLongIntervento().length() > MAX_LENGHT_DESCR_INTERVENTO ? lastDettPratica
.getDescLongIntervento().substring(0, MAX_LENGHT_DESCR_INTERVENTO) : lastDettPratica .getDescLongIntervento().substring(0, MAX_LENGHT_DESCR_INTERVENTO) : lastDettPratica
.getDescLongIntervento()); .getDescLongIntervento());
}
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
// Territorio: <strong><%= comune.getDenominazione() %> <%=
// !lastDettPratica.getLocalita().isEmpty() ?
// "(Loc. "+lastDettPratica.getLocalita()+" ) " : "" %>- <%=
// provincia.getProvincia() %></strong><br>
// Localizzazione: <strong><%= lastDettPratica.getVia()
// %></strong><br><br>
// <%= lastDettPratica.getDescLongIntervento() %>
} catch (Throwable e) { } catch (Throwable e) {
_log.error(method + " IntPraticaId: " + intPratica != null ? intPratica.getIntPraticaId() _log.error(method + " IntPraticaId: " + intPratica != null ? intPratica.getIntPraticaId() : "", e);
: "", e);
} finally { } finally {
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
} }
} }
// } catch (PortalException e) {
// _log.error(e, e);
// } catch (SystemException e) {
// _log.error(e, e);
// }
return sb.toString(); return sb.toString();
} }
} }

108
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.portlet.ResourceResponse;
import javax.servlet.http.HttpServletRequest; 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.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.json.JSONArray; import com.liferay.portal.kernel.json.JSONArray;
@ -67,7 +68,6 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
public void searchURL(ActionRequest actionRequest, ActionResponse actionResponse) { public void searchURL(ActionRequest actionRequest, ActionResponse actionResponse) {
String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto"); String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto");
String tipoPratica = ParamUtil.getString(actionRequest, "tipoPratica"); String tipoPratica = ParamUtil.getString(actionRequest, "tipoPratica");
String statoPratica = ParamUtil.getString(actionRequest, "statoPratica"); String statoPratica = ParamUtil.getString(actionRequest, "statoPratica");
@ -81,14 +81,12 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
String ordinaTipo = ParamUtil.getString(actionRequest, "ordinaTipo"); String ordinaTipo = ParamUtil.getString(actionRequest, "ordinaTipo");
String comune = ParamUtil.getString(actionRequest, "comune"); String comune = ParamUtil.getString(actionRequest, "comune");
String praticaAperta = ParamUtil.getString(actionRequest, "praticaAperta"); String praticaAperta = ParamUtil.getString(actionRequest, "praticaAperta");
String interventoTutti = ParamUtil.getString(actionRequest, "interventoTutti"); String interventoTutti = ParamUtil.getString(actionRequest, "interventoTutti");
String interventoNuovaCostruzione = ParamUtil.getString(actionRequest, "interventoNuovaCostruzione"); String interventoNuovaCostruzione = ParamUtil.getString(actionRequest, "interventoNuovaCostruzione");
String interventoAdeguamentoSismico = ParamUtil.getString(actionRequest, "interventoAdeguamentoSismico"); String interventoAdeguamentoSismico = ParamUtil.getString(actionRequest, "interventoAdeguamentoSismico");
String interventoMiglioramentoSismico = ParamUtil.getString(actionRequest, "interventoMiglioramentoSismico"); String interventoMiglioramentoSismico = ParamUtil.getString(actionRequest, "interventoMiglioramentoSismico");
String interventoRiparazioneInterventoLocale = String interventoRiparazioneInterventoLocale = ParamUtil.getString(actionRequest,
ParamUtil.getString(actionRequest, "interventoRiparazioneInterventoLocale"); "interventoRiparazioneInterventoLocale");
actionResponse.setRenderParameter("numeroProgetto", numeroProgetto); actionResponse.setRenderParameter("numeroProgetto", numeroProgetto);
actionResponse.setRenderParameter("tipoPratica", tipoPratica); actionResponse.setRenderParameter("tipoPratica", tipoPratica);
actionResponse.setRenderParameter("statoPratica", statoPratica); actionResponse.setRenderParameter("statoPratica", statoPratica);
@ -107,26 +105,21 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
actionResponse.setRenderParameter("interventoNuovaCostruzione", interventoNuovaCostruzione); actionResponse.setRenderParameter("interventoNuovaCostruzione", interventoNuovaCostruzione);
actionResponse.setRenderParameter("interventoAdeguamentoSismico", interventoAdeguamentoSismico); actionResponse.setRenderParameter("interventoAdeguamentoSismico", interventoAdeguamentoSismico);
actionResponse.setRenderParameter("interventoMiglioramentoSismico", interventoMiglioramentoSismico); actionResponse.setRenderParameter("interventoMiglioramentoSismico", interventoMiglioramentoSismico);
actionResponse.setRenderParameter("interventoRiparazioneInterventoLocale", interventoRiparazioneInterventoLocale); actionResponse.setRenderParameter("interventoRiparazioneInterventoLocale",
interventoRiparazioneInterventoLocale);
} }
@Override @Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
PortletException { PortletException {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
// ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV - Esportazione tutte i record // ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV - Esportazione tutte i record
String resourceId = GetterUtil.getString(resourceRequest.getResourceID()); String resourceId = GetterUtil.getString(resourceRequest.getResourceID());
boolean isExport = "exportCVS".equals(resourceId); boolean isExport = "exportCVS".equals(resourceId);
HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest);
List<IntPratica> lista = new ArrayList<>(); List<IntPratica> lista = new ArrayList<>();
Hits hits = Hits hits = IntPraticaAdvancedSearch.searchAttivitaIstruttore(request, themeDisplay.getUser(), 0,
IntPraticaAdvancedSearch.searchAttivitaIstruttore(request, themeDisplay.getUser(), 0,
// ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV - Esportazione tutte i record // ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV - Esportazione tutte i record
//Bug 33248
GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)), isExport); GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)), isExport);
try { try {
for (Document doc : hits.toList()) { for (Document doc : hits.toList()) {
@ -149,163 +142,117 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
} }
if (isExport && Validator.isNotNull(lista) && !lista.isEmpty()) { if (isExport && Validator.isNotNull(lista) && !lista.isEmpty()) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (String columnName : FIELD_NAMES) { for (String columnName : FIELD_NAMES) {
sb.append(columnName); sb.append(columnName);
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
} }
sb.append(CharPool.NEW_LINE); sb.append(CharPool.NEW_LINE);
sb.append(CharPool.NEW_LINE); sb.append(CharPool.NEW_LINE);
for (IntPratica pratica : lista) { for (IntPratica pratica : lista) {
try { try {
DettPratica lastDettPratica = DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica
DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica.getIntPraticaId()); .getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(pratica.getTerritorioId()); Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(pratica.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId()); Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
Provincia provincia = territorio.getCodiceProvincia());
ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), territorio.getCodiceProvincia()); List<Soggetto> committenti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
pratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE);
List<Soggetto> committenti = List<Soggetto> direttoreLavori = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(pratica.getIntPraticaId(), pratica.getIntPraticaId(), TipoSoggettoUtil.DIRETTORE_LAVORI);
TipoSoggettoUtil.COMMITTENTE); List<Soggetto> collaudatori = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
List<Soggetto> direttoreLavori = pratica.getIntPraticaId(), TipoSoggettoUtil.COLLAUDATORE);
SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(pratica.getIntPraticaId(), List<FineLavori> fineLavoriList = FineLavoriLocalServiceUtil.findByIntPraticaId(
TipoSoggettoUtil.DIRETTORE_LAVORI); pratica.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
List<Soggetto> collaudatori =
SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(pratica.getIntPraticaId(),
TipoSoggettoUtil.COLLAUDATORE);
List<FineLavori> fineLavoriList =
FineLavoriLocalServiceUtil.findByIntPraticaId(pratica.getIntPraticaId(), -1, -1, null);
boolean compleatata = false; boolean compleatata = false;
for (FineLavori fineLavori : fineLavoriList) { for (FineLavori fineLavori : fineLavoriList) {
if (fineLavori.isCompletata() && !fineLavori.isParziale()) { if (fineLavori.isCompletata() && !fineLavori.isParziale()) {
compleatata = true; compleatata = true;
} }
} }
boolean collaudoPrevisto = false; boolean collaudoPrevisto = false;
if (collaudatori != null && !collaudatori.isEmpty()) { if (collaudatori != null && !collaudatori.isEmpty()) {
collaudoPrevisto = true; collaudoPrevisto = true;
} }
sb.append(pratica.getTipoPratica()); sb.append(pratica.getTipoPratica());
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(pratica.getNumeroProgetto()); sb.append(pratica.getNumeroProgetto());
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(pratica.getDtPratica())) { if (Validator.isNotNull(pratica.getDtPratica())) {
sb.append(sdf.format(pratica.getDtPratica())); sb.append(sdf.format(pratica.getDtPratica()));
} else {
sb.append("");
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(comune.getDenominazione()); sb.append(comune.getDenominazione());
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(provincia.getProvincia()); sb.append(provincia.getProvincia());
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(pratica.getStatoPratica()); sb.append(pratica.getStatoPratica());
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
for (Soggetto soggetto : committenti) { for (Soggetto soggetto : committenti) {
// ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV // ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV
// sb.append(soggetto.getCodiceFiscale().toUpperCase()); // sb.append(soggetto.getCodiceFiscale().toUpperCase());
sb.append(soggetto.getDescrizioneCompleta().toUpperCase()); sb.append(soggetto.getDescrizioneCompleta().toUpperCase());
sb.append(" "); sb.append(StringPool.SPACE);
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
for (Soggetto soggetto : direttoreLavori) { for (Soggetto soggetto : direttoreLavori) {
// ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV // ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV
// sb.append(soggetto.getCodiceFiscale().toUpperCase());
sb.append(soggetto.getDescrizioneCompleta().toUpperCase()); sb.append(soggetto.getDescrizioneCompleta().toUpperCase());
sb.append(" "); sb.append(StringPool.SPACE);
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(lastDettPratica)) { if (Validator.isNotNull(lastDettPratica)) {
if (lastDettPratica.getTcNuovaCostruzione()) { if (lastDettPratica.getTcNuovaCostruzione()) {
sb.append("Nuova Costruzione "); sb.append("Nuova Costruzione ");
sb.append(" ");
} }
if (lastDettPratica.getTcAdeguamentoSismico()) { if (lastDettPratica.getTcAdeguamentoSismico()) {
sb.append("Adeguamento Sismico "); sb.append("Adeguamento Sismico ");
sb.append(" ");
} }
if (lastDettPratica.getTcMiglioramentoSismico()) { if (lastDettPratica.getTcMiglioramentoSismico()) {
sb.append("Miglioramento Sismico "); sb.append("Miglioramento Sismico ");
sb.append(" ");
} }
if (lastDettPratica.getTcRiparazioneInterventoLocale()) { if (lastDettPratica.getTcRiparazioneInterventoLocale()) {
sb.append("Riparazione Intervento Locale "); sb.append("Riparazione Intervento Locale ");
sb.append(" ");
} }
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (compleatata) { if (compleatata) {
sb.append("SI"); sb.append("SI");
} else { } else {
sb.append("NO"); sb.append("NO");
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (collaudoPrevisto) { if (collaudoPrevisto) {
sb.append("SI"); sb.append("SI");
} else { } else {
sb.append("NO"); sb.append("NO");
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(pratica.getStatusDate())) { if (Validator.isNotNull(pratica.getStatusDate())) {
sb.append(sdf.format(pratica.getStatusDate())); sb.append(sdf.format(pratica.getStatusDate()));
} else {
sb.append("");
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
} catch (SystemException e) { } catch (SystemException e) {
_log.error(e, e); _log.error(e, e);
} }
sb.append(CharPool.NEW_LINE); sb.append(CharPool.NEW_LINE);
} }
String fileName = "exportActivity_" + new Date().getTime() + ".csv"; String fileName = "exportActivity_" + new Date().getTime() + ".csv";
byte[] bytes = sb.toString().getBytes(); byte[] bytes = sb.toString().getBytes();
String contentType = ContentTypes.TEXT_CSV; String contentType = ContentTypes.TEXT_CSV;
ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length); ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length);
baos.write(bytes, 0, bytes.length); baos.write(bytes, 0, bytes.length);
resourceResponse.setContentType(contentType); resourceResponse.setContentType(contentType);
resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate"); resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate");
resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + "\"" + fileName + "\""); resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileName
+ StringPool.QUOTE);
resourceResponse.setContentLength(baos.size()); resourceResponse.setContentLength(baos.size());
OutputStream out = resourceResponse.getPortletOutputStream(); OutputStream out = resourceResponse.getPortletOutputStream();
baos.writeTo(out); baos.writeTo(out);
out.flush(); out.flush();
out.close(); out.close();
// PortletResponseUtil.sendFile(resourceRequest, resourceResponse, fileName, bytes,
// contentType);
} }
// ADT BUG-ID=16 Sezione Pratiche Assegnate // ADT BUG-ID=16 Sezione Pratiche Assegnate
User user = themeDisplay.getUser(); User user = themeDisplay.getUser();
if ("comuniForUfficio".equals(resourceId)) { if ("comuniForUfficio".equals(resourceId)) {
@ -316,12 +263,12 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
try { try {
if (!ufficio.equals("-1")) { if (!ufficio.equals("-1")) {
long ufficioId = Long.parseLong(ufficio); long ufficioId = Long.parseLong(ufficio);
comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId(user.getUserId(), ufficioId); comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId(user.getUserId(),
ufficioId);
for (Comune comune : comuni) { for (Comune comune : comuni) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("comuneId", comune.getComuneId()); jsonObject.put("comuneId", comune.getComuneId());
jsonObject.put("descLong", comune.getDenominazione()); jsonObject.put("descLong", comune.getDenominazione());
jsonArray.put(jsonObject); jsonArray.put(jsonObject);
} }
writeJSON(resourceRequest, resourceResponse, jsonArray); writeJSON(resourceRequest, resourceResponse, jsonArray);
@ -336,19 +283,12 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
} }
writeJSON(resourceRequest, resourceResponse, jsonArray); writeJSON(resourceRequest, resourceResponse, jsonArray);
} }
} }
catch (Exception e) { catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
super.serveResource(resourceRequest, resourceResponse); super.serveResource(resourceRequest, resourceResponse);
} }
} }

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

@ -19,7 +19,9 @@ import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil;
import it.tref.liferay.portos.bo.service.permission.IntPraticaPermission; 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.ActionKeys;
import it.tref.liferay.portos.bo.shared.util.Constants; import it.tref.liferay.portos.bo.shared.util.Constants;
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants;
import it.tref.liferay.portos.bo.util.MailUtil; import it.tref.liferay.portos.bo.util.MailUtil;
import it.tref.liferay.portos.bo.util.WorkflowConstants;
import it.tref.liferay.portos.bo.util.WorkflowUtil; import it.tref.liferay.portos.bo.util.WorkflowUtil;
import java.io.IOException; import java.io.IOException;
@ -80,7 +82,6 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
private Log _log = LogFactoryUtil.getLog(GestioneAttivitaPortlet.class); private Log _log = LogFactoryUtil.getLog(GestioneAttivitaPortlet.class);
public void search2URL(ActionRequest actionRequest, ActionResponse actionResponse) { public void search2URL(ActionRequest actionRequest, ActionResponse actionResponse) {
String tabs1 = ParamUtil.getString(actionRequest, "tabs1"); String tabs1 = ParamUtil.getString(actionRequest, "tabs1");
String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto"); String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto");
String protocollo = ParamUtil.getString(actionRequest, "protocollo"); String protocollo = ParamUtil.getString(actionRequest, "protocollo");
@ -88,7 +89,6 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
String statoPratica = ParamUtil.getString(actionRequest, "statoPratica"); String statoPratica = ParamUtil.getString(actionRequest, "statoPratica");
String committente = ParamUtil.getString(actionRequest, "committente"); String committente = ParamUtil.getString(actionRequest, "committente");
String soggettiInterconnessi = ParamUtil.getString(actionRequest, "soggettiInterconnessi"); String soggettiInterconnessi = ParamUtil.getString(actionRequest, "soggettiInterconnessi");
// ADT BUG BO ID = 8
String istruttore = ParamUtil.getString(actionRequest, "istruttore"); String istruttore = ParamUtil.getString(actionRequest, "istruttore");
String dataRichiestaInizio = ParamUtil.getString(actionRequest, "dataRichiestaInizio"); String dataRichiestaInizio = ParamUtil.getString(actionRequest, "dataRichiestaInizio");
String dataRichiestaFine = ParamUtil.getString(actionRequest, "dataRichiestaFine"); String dataRichiestaFine = ParamUtil.getString(actionRequest, "dataRichiestaFine");
@ -98,51 +98,41 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
String comune = ParamUtil.getString(actionRequest, "comune"); String comune = ParamUtil.getString(actionRequest, "comune");
String tipoAttivita = ParamUtil.getString(actionRequest, "tipoAttivita"); String tipoAttivita = ParamUtil.getString(actionRequest, "tipoAttivita");
String tipoProcedura = ParamUtil.getString(actionRequest, "tipoProcedura"); String tipoProcedura = ParamUtil.getString(actionRequest, "tipoProcedura");
actionResponse.setRenderParameter("tabs1", tabs1); actionResponse.setRenderParameter("tabs1", tabs1);
actionResponse.setRenderParameter("numeroProgetto", numeroProgetto); actionResponse.setRenderParameter("numeroProgetto", numeroProgetto);
actionResponse.setRenderParameter("protocollo", protocollo); actionResponse.setRenderParameter("protocollo", protocollo);
// ADT - BUG-11 Aggiunta filtro ricerca // ADT - BUG-11 Aggiunta filtro ricerca
if (Validator.isNotNull(tipoPratica)) { if (Validator.isNotNull(tipoPratica)) {
if ("co".equalsIgnoreCase(tipoPratica)) { if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(tipoPratica)) {
tipoPratica = Constants.TIPO_PRATICA_DEPOSITO; tipoPratica = Constants.TIPO_PRATICA_DEPOSITO;
actionResponse.setRenderParameter("controlloObbligatorio", Boolean.TRUE.toString()); actionResponse.setRenderParameter("controlloObbligatorio", StringPool.TRUE);
} else if ("sorteggio".equalsIgnoreCase(tipoPratica)) { } else if ("sorteggio".equalsIgnoreCase(tipoPratica)) {
tipoPratica = Constants.TIPO_PRATICA_DEPOSITO; tipoPratica = Constants.TIPO_PRATICA_DEPOSITO;
actionResponse.setRenderParameter("sorteggiata", Boolean.TRUE.toString()); actionResponse.setRenderParameter("sorteggiata", StringPool.TRUE);
} }
actionResponse.setRenderParameter("tipoPratica", tipoPratica); actionResponse.setRenderParameter("tipoPratica", tipoPratica);
} }
actionResponse.setRenderParameter("statoPratica", statoPratica); actionResponse.setRenderParameter("statoPratica", statoPratica);
actionResponse.setRenderParameter("committente", committente); actionResponse.setRenderParameter("committente", committente);
actionResponse.setRenderParameter("soggettiInterconnessi", soggettiInterconnessi); actionResponse.setRenderParameter("soggettiInterconnessi", soggettiInterconnessi);
actionResponse.setRenderParameter("istruttore", istruttore); actionResponse.setRenderParameter("istruttore", istruttore);
actionResponse.setRenderParameter("dataRichiestaInizio", dataRichiestaInizio); actionResponse.setRenderParameter("dataRichiestaInizio", dataRichiestaInizio);
actionResponse.setRenderParameter("dataRichiestaFine", dataRichiestaFine); actionResponse.setRenderParameter("dataRichiestaFine", dataRichiestaFine);
if (Validator.isNotNull(dataRichiestaInizio)) {
if (dataRichiestaInizio != null && !dataRichiestaInizio.equals("")) { String[] dataRichiestaInizioSplitted = dataRichiestaInizio.split(StringPool.FORWARD_SLASH);
String[] dataRichiestaInizioSplitted = dataRichiestaInizio.split("/"); int month = Integer.valueOf(dataRichiestaInizioSplitted[1]) - 1;
int mounth = Integer.valueOf(dataRichiestaInizioSplitted[1]) - 1;
actionResponse.setRenderParameter("dataRichiestaInizioDay", dataRichiestaInizioSplitted[0]); actionResponse.setRenderParameter("dataRichiestaInizioDay", dataRichiestaInizioSplitted[0]);
actionResponse.setRenderParameter("dataRichiestaInizioMonth", mounth + ""); actionResponse.setRenderParameter("dataRichiestaInizioMonth", String.valueOf(month));
actionResponse.setRenderParameter("dataRichiestaInizioYear", dataRichiestaInizioSplitted[2]); actionResponse.setRenderParameter("dataRichiestaInizioYear", dataRichiestaInizioSplitted[2]);
} }
if (dataRichiestaFine != null && !dataRichiestaFine.equals("")) { if (Validator.isNotNull(dataRichiestaFine)) {
String[] dataRichiestaFineSplitted = dataRichiestaFine.split("/"); String[] dataRichiestaFineSplitted = dataRichiestaFine.split(StringPool.FORWARD_SLASH);
int month = Integer.valueOf(dataRichiestaFineSplitted[1]) - 1;
int mounth = Integer.valueOf(dataRichiestaFineSplitted[1]) - 1;
actionResponse.setRenderParameter("dataRichiestaFineDay", dataRichiestaFineSplitted[0]); actionResponse.setRenderParameter("dataRichiestaFineDay", dataRichiestaFineSplitted[0]);
actionResponse.setRenderParameter("dataRichiestaFineMonth", mounth + ""); actionResponse.setRenderParameter("dataRichiestaFineMonth", String.valueOf(month));
actionResponse.setRenderParameter("dataRichiestaFineYear", dataRichiestaFineSplitted[2]); actionResponse.setRenderParameter("dataRichiestaFineYear", dataRichiestaFineSplitted[2]);
} }
actionResponse.setRenderParameter("ufficio", ufficio); actionResponse.setRenderParameter("ufficio", ufficio);
actionResponse.setRenderParameter("ordinaPer", ordinaPer); actionResponse.setRenderParameter("ordinaPer", ordinaPer);
actionResponse.setRenderParameter("ordinaTipo", ordinaTipo); actionResponse.setRenderParameter("ordinaTipo", ordinaTipo);
@ -152,14 +142,12 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
} }
public void cambioIstruttore(ActionRequest actionRequest, ActionResponse actionResponse) { public void cambioIstruttore(ActionRequest actionRequest, ActionResponse actionResponse) {
long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId"); long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId"); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
long istruttoreId = ParamUtil.getLong(actionRequest, "istruttoreId"); long istruttoreId = ParamUtil.getLong(actionRequest, "istruttoreId");
try { try {
IntPratica intPratica = IntPraticaServiceUtil.getIntPratica(intPraticaId); IntPratica intPratica = IntPraticaServiceUtil.getIntPratica(intPraticaId);
if (Validator.isNotNull(intPratica.getStatusByUserId()) if (Validator.isNotNull(intPratica.getStatusByUserId()) && intPratica.getStatusByUserId() != istruttoreId) {
&& intPratica.getStatusByUserId() != istruttoreId) {
IntPraticaServiceUtil.cambiaIstruttore(intPraticaId, controlloPraticaId, istruttoreId); IntPraticaServiceUtil.cambiaIstruttore(intPraticaId, controlloPraticaId, istruttoreId);
} else { } else {
throw new SystemException("cambio istruttore non possibile"); throw new SystemException("cambio istruttore non possibile");
@ -170,77 +158,14 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
} }
} }
// public void assegnamiTask(ActionRequest actionRequest, ActionResponse
// actionResponse) {
//
// long controlloPraticaId = ParamUtil.getLong(actionRequest,
// "controlloPraticaId");
// long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId");
//
//
// try {
// ServiceContext serviceContext =
// ServiceContextFactory.getInstance(actionRequest);
// ControlloPratica controlloPratica =
// ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
//
// IntPratica intPratica =
// IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId());
// Territorio territorio =
// TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
// IntPraticaPermission.check(PermissionThreadLocal.getPermissionChecker(),
// territorio.getGroupId(),
// ActionKeys.ASSEGNA_A_ME);
//
//
// WorkflowTask lastWorkflowTask =
// WorkflowUtil.getLastTask(controlloPratica.getCompanyId(),
// controlloPratica.getGroupId(), null,
// controlloPratica);
// if (lastWorkflowTask != null && lastWorkflowTask.getWorkflowTaskId() ==
// workflowTaskId
// && !lastWorkflowTask.getWorkflowTaskAssignees().isEmpty()) {
// boolean assegnazionePossibile = false;
// for (WorkflowTaskAssignee workflowTaskAssignee :
// lastWorkflowTask.getWorkflowTaskAssignees()) {
// if
// (workflowTaskAssignee.getAssigneeClassName().equalsIgnoreCase(Role.class.getName())
// &&
// UserGroupRoleLocalServiceUtil.hasUserGroupRole(serviceContext.getUserId(),
// controlloPratica.getGroupId(), workflowTaskAssignee.getAssigneeClassPK(),
// true)) {
// assegnazionePossibile = true;
// }
// }
// if (assegnazionePossibile) {
// WorkflowTaskManagerUtil.assignWorkflowTaskToUser(controlloPratica.getCompanyId(),
// serviceContext.getUserId(),
// workflowTaskId, serviceContext.getUserId(), StringPool.BLANK, null,
// WorkflowUtil.getWorkflowContext(controlloPratica));
// } else {
// throw new
// SystemException("assegnazione task non possibile per il ruolo");
// }
// } else {
// throw new SystemException("assegnazione task non possibile");
// }
// } catch (PortalException | SystemException e) {
// _log.error("error-cambio-istruttore", e);
// SessionErrors.add(actionRequest, "error-assegnami-task");
// }
// }
public void riassegnaAlRuolo(ActionRequest actionRequest, ActionResponse actionResponse) { public void riassegnaAlRuolo(ActionRequest actionRequest, ActionResponse actionResponse) {
long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId"); long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId");
long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId");
try { try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPraticaId); .getControlloPratica(controlloPraticaId);
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId());
.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
IntPraticaPermission.check(PermissionThreadLocal.getPermissionChecker(), territorio.getGroupId(), IntPraticaPermission.check(PermissionThreadLocal.getPermissionChecker(), territorio.getGroupId(),
ActionKeys.ASSEGNA_AL_RUOLO); ActionKeys.ASSEGNA_AL_RUOLO);
@ -250,23 +175,22 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
&& !lastWorkflowTask.getWorkflowTaskAssignees().isEmpty()) { && !lastWorkflowTask.getWorkflowTaskAssignees().isEmpty()) {
Role role = null; Role role = null;
// TODO listare meglio // TODO listare meglio
switch (lastWorkflowTask.getName()) { switch (lastWorkflowTask.getName().toLowerCase()) {
case "Assegnazione": case WorkflowConstants.WORKFLOW_TASKNAME_ASSEGNAZIONE:
role = RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), "portos_assegnatore"); role = RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), "portos_assegnatore");
break; break;
case "Esito": case WorkflowConstants.WORKFLOW_TASKNAME_ESITO:
// role = // role =
// RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), // RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(),
// "portos_istruttore"); // "portos_istruttore");
// break; // break;
return; return;
case "Approvazione": case WorkflowConstants.WORKFLOW_TASKNAME_APPROVAZIONE:
role = RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), "portos_approvatore"); role = RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), "portos_approvatore");
break; break;
default: default:
break; break;
} }
WorkflowTaskManagerUtil.assignWorkflowTaskToRole(controlloPratica.getCompanyId(), WorkflowTaskManagerUtil.assignWorkflowTaskToRole(controlloPratica.getCompanyId(),
serviceContext.getUserId(), workflowTaskId, role.getRoleId(), StringPool.BLANK, null, serviceContext.getUserId(), workflowTaskId, role.getRoleId(), StringPool.BLANK, null,
WorkflowUtil.getWorkflowContext(controlloPratica)); WorkflowUtil.getWorkflowContext(controlloPratica));
@ -280,9 +204,7 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
} }
public void annullaRichiestaParere(ActionRequest actionRequest, ActionResponse actionResponse) { public void annullaRichiestaParere(ActionRequest actionRequest, ActionResponse actionResponse) {
long parereGeologoId = ParamUtil.getLong(actionRequest, "parereGeologoId"); long parereGeologoId = ParamUtil.getLong(actionRequest, "parereGeologoId");
try { try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
serviceContext.setCreateDate(new Date()); serviceContext.setCreateDate(new Date());
@ -300,18 +222,16 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
} }
public void aggiungiRichiestaParere(ActionRequest actionRequest, ActionResponse actionResponse) { public void aggiungiRichiestaParere(ActionRequest actionRequest, ActionResponse actionResponse) {
long geologoId = ParamUtil.getLong(actionRequest, "geologoId"); long geologoId = ParamUtil.getLong(actionRequest, "geologoId");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId"); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId"); long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
try { try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
serviceContext.setCreateDate(new Date()); serviceContext.setCreateDate(new Date());
serviceContext.setModifiedDate(new Date()); serviceContext.setModifiedDate(new Date());
if (ParereGeologoLocalServiceUtil.countByIntPraticaIdParereVuoto(intPraticaId) == 0) { if (ParereGeologoLocalServiceUtil.countByIntPraticaIdParereVuoto(intPraticaId) == 0) {
ParereGeologo parereGeologo = ParereGeologoServiceUtil.addParereGeologo(geologoId, ParereGeologo parereGeologo = ParereGeologoServiceUtil.addParereGeologo(geologoId, intPraticaId,
intPraticaId, dettPraticaId, serviceContext); dettPraticaId, serviceContext);
// ADT: aggiunta notifica geologo // ADT: aggiunta notifica geologo
MailUtil.invioNotificaGeologo(parereGeologo, serviceContext); MailUtil.invioNotificaGeologo(parereGeologo, serviceContext);
} else { } else {
@ -325,41 +245,32 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
public void aggiungiDettPraticheAlControllo(ActionRequest actionRequest, ActionResponse actionResponse) public void aggiungiDettPraticheAlControllo(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortalException, SystemException { throws PortalException, SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId"); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId"); long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId");
long lastDettPraticaId = ParamUtil.getLong(actionRequest, "lastDettPraticaId"); long lastDettPraticaId = ParamUtil.getLong(actionRequest, "lastDettPraticaId");
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId);
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId);
if (lastDettPraticaId != controlloPratica.getDettPraticaId() if (lastDettPraticaId != controlloPratica.getDettPraticaId()
&& intPratica.getStatusByUserId() == serviceContext.getUserId()) { && intPratica.getStatusByUserId() == serviceContext.getUserId()) {
// ADT: BUG ID=5 ControlloPraticaLocalServiceUtil.addPraticheAlControlloVarianti(controlloPraticaId, lastDettPraticaId,
ControlloPraticaLocalServiceUtil.addPraticheAlControlloVarianti(controlloPraticaId, serviceContext);
lastDettPraticaId, serviceContext);
} else { } else {
SessionErrors.add(actionRequest, "error-aggiunta-pratiche-al-controllo"); SessionErrors.add(actionRequest, "error-aggiunta-pratiche-al-controllo");
} }
} }
@Override @Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
throws IOException, PortletException { PortletException {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
Locale locale = themeDisplay.getLocale(); Locale locale = themeDisplay.getLocale();
User user = themeDisplay.getUser(); User user = themeDisplay.getUser();
String cmd = ParamUtil.getString(resourceRequest, "cmd"); String cmd = ParamUtil.getString(resourceRequest, "cmd");
String id = resourceRequest.getResourceID(); String id = resourceRequest.getResourceID();
String csv = StringPool.BLANK; String csv = StringPool.BLANK;
HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest);
HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse); HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse);
if (cmd.equals("dirigente")) { if (cmd.equals("dirigente")) {
csv = exportToCSV(locale, resourceRequest, true, user); csv = exportToCSV(locale, resourceRequest, true, user);
} else if (cmd.equals("po")) { } else if (cmd.equals("po")) {
@ -377,8 +288,8 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
try { try {
if (!ufficio.equals("-1")) { if (!ufficio.equals("-1")) {
long ufficioId = Long.parseLong(ufficio); long ufficioId = Long.parseLong(ufficio);
comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId( comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId(user.getUserId(),
user.getUserId(), ufficioId); ufficioId);
for (Comune comune : comuni) { for (Comune comune : comuni) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("comuneId", comune.getComuneId()); jsonObject.put("comuneId", comune.getComuneId());
@ -398,34 +309,21 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
} }
writeJSON(resourceRequest, resourceResponse, jsonArray); writeJSON(resourceRequest, resourceResponse, jsonArray);
} }
} catch (Exception e) {
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
ServletResponseUtil.sendFile(request, response, "export_pratiche.csv", csv.getBytes(StringPool.UTF8), ServletResponseUtil.sendFile(request, response, "export_pratiche.csv", csv.getBytes(StringPool.UTF8),
ContentTypes.TEXT_CSV_UTF8); ContentTypes.TEXT_CSV_UTF8);
// super.serveResource(resourceRequest, resourceResponse);
} }
private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user, String cmd) { private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user, String cmd) {
HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
List<ControlloPratica> lista = new ArrayList<ControlloPratica>(); List<ControlloPratica> lista = new ArrayList<ControlloPratica>();
try { try {
Hits hits = null; Hits hits = null;
if (cmd.equals("exportRicercaMieAttivita")) { if (cmd.equals("exportRicercaMieAttivita")) {
hits = ControlloPraticaAdvancedSearch.searchMieiTask(httpRequest, user, -1, -1); hits = ControlloPraticaAdvancedSearch.searchMieiTask(httpRequest, user, -1, -1);
} else if (cmd.equals("exportRicercaMieiRuoli")) { } else if (cmd.equals("exportRicercaMieiRuoli")) {
@ -435,41 +333,30 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
} else if (cmd.equals("exportRicercaAttivitaConcluse")) { } else if (cmd.equals("exportRicercaAttivitaConcluse")) {
hits = ControlloPraticaAdvancedSearch.searchTaskConclusi(httpRequest, user, -1, -1); hits = ControlloPraticaAdvancedSearch.searchTaskConclusi(httpRequest, user, -1, -1);
} }
for (Document doc : hits.toList()) { for (Document doc : hits.toList()) {
String controlloPraticaId = doc.get("controlloPraticaId"); String controlloPraticaId = doc.get("controlloPraticaId");
if (Validator.isNotNull(controlloPraticaId)) { if (Validator.isNotNull(controlloPraticaId)) {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId)); .fetchControlloPratica(GetterUtil.getLong(controlloPraticaId));
if (Validator.isNotNull(controlloPratica)) { if (Validator.isNotNull(controlloPratica)) {
lista.add(controlloPratica); lista.add(controlloPratica);
} }
} }
} }
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.attivita")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.attivita")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.esito")));
"label.scadenzegeniocivile.esito")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
// ADT - BUG-13 Aggiunta colonna Data Esito // ADT - BUG-13 Aggiunta colonna Data Esito
// Bug 33264
if (cmd.equals("exportRicercaAttivitaConcluse")) { if (cmd.equals("exportRicercaAttivitaConcluse")) {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.dataesito"))); "label.scadenzegeniocivile.dataesito")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
} }
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.sorteggiata"))); "label.scadenzegeniocivile.sorteggiata")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.pratica")));
"label.scadenzegeniocivile.pratica")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.istruttore"))); "label.scadenzegeniocivile.istruttore")));
@ -480,102 +367,75 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.avvioprocedimento"))); "label.scadenzegeniocivile.avvioprocedimento")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil
"label.scadenzegeniocivile.provincia"))); .get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.gg")));
"label.scadenzegeniocivile.gg")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
for (ControlloPratica controlloPratica : lista) { for (ControlloPratica controlloPratica : lista) {
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica.getIntPraticaId());
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica
.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId()); Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia()); territorio.getCodiceProvincia());
// Informazioni relative al workflow // Informazioni relative al workflow
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil
.fetchWorkflowInstanceLink(controlloPratica.getCompanyId(), .fetchWorkflowInstanceLink(controlloPratica.getCompanyId(), controlloPratica.getGroupId(),
controlloPratica.getGroupId(), ControlloPratica.class.getName(), ControlloPratica.class.getName(), controlloPratica.getPrimaryKey());
controlloPratica.getPrimaryKey());
long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId(); long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId();
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance( WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(
controlloPratica.getCompanyId(), workflowInstanceId); controlloPratica.getCompanyId(), workflowInstanceId);
List<WorkflowTask> listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance( List<WorkflowTask> listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(
controlloPratica.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(), controlloPratica.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(), false,
false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
WorkflowTask task = null; WorkflowTask task = null;
if (listaTask != null && !listaTask.isEmpty()) { if (listaTask != null && !listaTask.isEmpty()) {
task = listaTask.get(0); task = listaTask.get(0);
} }
String taskName = StringPool.BLANK; String taskName = StringPool.BLANK;
if (task != null) { if (task != null) {
User userTask = UserLocalServiceUtil.fetchUser(task.getAssigneeUserId()); User userTask = UserLocalServiceUtil.fetchUser(task.getAssigneeUserId());
// Bug 33264
taskName = LanguageUtil.get(getPortletConfig(), locale, task.getName()); taskName = LanguageUtil.get(getPortletConfig(), locale, task.getName());
if (userTask != null) { if (userTask != null) {
taskName += " (" + userTask.getFullName() + ")"; taskName += " (" + userTask.getFullName() + StringPool.CLOSE_PARENTHESIS;
} }
} else { } else {
// Bug 33264
taskName = LanguageUtil.get(getPortletConfig(), locale, workflowInstance.getState()); taskName = LanguageUtil.get(getPortletConfig(), locale, workflowInstance.getState());
} }
sb.append(CSVUtil.encode(taskName)); sb.append(CSVUtil.encode(taskName));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
String tipoEsito = ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica String tipoEsito = ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica
.getControlloPraticaId()); .getControlloPraticaId());
sb.append(CSVUtil.encode(tipoEsito)); sb.append(CSVUtil.encode(tipoEsito));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
// ADT - BUG-13 Aggiunta colonna Data Esito // ADT - BUG-13 Aggiunta colonna Data Esito
// Bug 33264
if (cmd.equals("exportRicercaAttivitaConcluse")) { if (cmd.equals("exportRicercaAttivitaConcluse")) {
sb.append(CSVUtil.encode(controlloPratica.getStatusDate() != null ? sdf sb.append(CSVUtil.encode(controlloPratica.getStatusDate() != null ? sdf.format(controlloPratica
.format(controlloPratica.getStatusDate()) : "")); .getStatusDate()) : StringPool.BLANK));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
} }
boolean sorteggiata = SorteggioLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()) != null;
boolean sorteggiata = SorteggioLocalServiceUtil
.findByIntPratica(intPratica.getIntPraticaId()) != null;
sb.append(CSVUtil.encode((sorteggiata) ? "Si" : "No")); sb.append(CSVUtil.encode((sorteggiata) ? "Si" : "No"));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
String praticaLabel = intPratica.getTitle(locale, true); String praticaLabel = intPratica.getTitle(locale, true);
sb.append(CSVUtil.encode(praticaLabel)); sb.append(CSVUtil.encode(praticaLabel));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
String istruttore = StringPool.DASH;
String istruttore = "-"; if (intPratica.getStatusByUserId() != 0L) {
if (intPratica.getStatusByUserId() != 0l) {
User istruttoreUser = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId()); User istruttoreUser = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (istruttoreUser != null) { if (istruttoreUser != null) {
istruttore = istruttoreUser.getFullName(); istruttore = istruttoreUser.getFullName();
} else { } else {
istruttore = " [" + intPratica.getStatusByUserId() + "]"; istruttore = " [" + intPratica.getStatusByUserId() + StringPool.CLOSE_BRACKET;
} }
} }
sb.append(CSVUtil.encode(istruttore)); sb.append(CSVUtil.encode(istruttore));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
StringBuilder provenienzaLabel = new StringBuilder(); StringBuilder provenienzaLabel = new StringBuilder();
WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask( WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask(controlloPratica.getCompanyId(),
controlloPratica.getCompanyId(), controlloPratica.getGroupId(), null, controlloPratica.getGroupId(), null, controlloPratica);
controlloPratica);
if (workflowTask != null) { if (workflowTask != null) {
User approvatore = UserLocalServiceUtil.fetchUser(workflowTask.getAssigneeUserId()); User approvatore = UserLocalServiceUtil.fetchUser(workflowTask.getAssigneeUserId());
if (approvatore != null) { if (approvatore != null) {
@ -584,185 +444,135 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
if (workflowTask.getAssigneeUserId() == -1) { if (workflowTask.getAssigneeUserId() == -1) {
provenienzaLabel.append(" [Portos 1]"); provenienzaLabel.append(" [Portos 1]");
} else { } else {
provenienzaLabel.append(" [" + workflowTask.getAssigneeUserId() + "]"); provenienzaLabel.append(" [").append(workflowTask.getAssigneeUserId())
.append(StringPool.CLOSE_BRACKET);
} }
} }
provenienzaLabel.append(" (" + workflowTask.getName() + ")"); provenienzaLabel.append(" (").append(workflowTask.getName()).append(StringPool.CLOSE_PARENTHESIS);
} else { } else {
provenienzaLabel.append("-"); provenienzaLabel.append(StringPool.DASH);
} }
sb.append(CSVUtil.encode(provenienzaLabel.toString())); sb.append(CSVUtil.encode(provenienzaLabel.toString()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(sdf.format(controlloPratica.getCreateDate()))); sb.append(CSVUtil.encode(sdf.format(controlloPratica.getCreateDate())));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(provincia.getProvincia() + " - " + comune.getDenominazione())); sb.append(CSVUtil.encode(provincia.getProvincia() + " - " + comune.getDenominazione()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
Date data = controlloPratica.getCreateDate(); Date data = controlloPratica.getCreateDate();
Date now = new Date(); Date now = new Date();
long diff = now.getTime() - data.getTime(); long diff = now.getTime() - data.getTime();
long days = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); long days = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
sb.append(CSVUtil.encode(days)); sb.append(CSVUtil.encode(days));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
} }
} catch (PortalException | SystemException e) {
} catch (PortalException e) {
_log.error(e, e);
} catch (SystemException e) {
_log.error(e, e); _log.error(e, e);
} }
return sb.toString(); return sb.toString();
} }
private String exportToCSV(Locale locale, ResourceRequest resourceRequest, boolean dirigente, User user) { private String exportToCSV(Locale locale, ResourceRequest resourceRequest, boolean dirigente, User user) {
HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest);
String currentTab = ParamUtil.getString(httpRequest, "tabs1"); String currentTab = ParamUtil.getString(httpRequest, "tabs1");
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
List<ControlloPratica> listaControlloPratica = new ArrayList<ControlloPratica>(); List<ControlloPratica> listaControlloPratica = new ArrayList<ControlloPratica>();
if (dirigente) { if (dirigente) {
listaControlloPratica = ControlloPraticaAdvancedSearch.searchTaskPerEsportazioneDirigente( listaControlloPratica = ControlloPraticaAdvancedSearch.searchTaskPerEsportazioneDirigente(httpRequest,
httpRequest, user, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
} else {
listaControlloPratica = ControlloPraticaAdvancedSearch.searchTaskPerEsportazionePO(httpRequest,
user, QueryUtil.ALL_POS, QueryUtil.ALL_POS); user, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
} else {
listaControlloPratica = ControlloPraticaAdvancedSearch.searchTaskPerEsportazionePO(httpRequest, user,
QueryUtil.ALL_POS, QueryUtil.ALL_POS);
} }
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.attivita")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.attivita")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.esito")));
"label.scadenzegeniocivile.esito")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
// ADT - BUG-13 Aggiunta colonna Data Esito // ADT - BUG-13 Aggiunta colonna Data Esito
// Bug 33264
if ("Tab_TaskCompletati".equals(currentTab)) { if ("Tab_TaskCompletati".equals(currentTab)) {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil
"label.scadenzegeniocivile.dataesito"))); .get(getPortletConfig(), locale, "label.scadenzegeniocivile.dataesito")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
} }
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.sorteggiata")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.sorteggiata")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.pratica")));
"label.scadenzegeniocivile.pratica")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.istruttore")));
"label.scadenzegeniocivile.istruttore")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.provenienza")));
"label.scadenzegeniocivile.provenienza")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.avvioprocedimento"))); "label.scadenzegeniocivile.avvioprocedimento")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
"label.scadenzegeniocivile.provincia")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.gg"))); sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.gg")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
try { try {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
for (ControlloPratica controlloPratica : listaControlloPratica) { for (ControlloPratica controlloPratica : listaControlloPratica) {
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica.getIntPraticaId());
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica
.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId()); Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia()); territorio.getCodiceProvincia());
// Informazioni relative al workflow // Informazioni relative al workflow
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil
.fetchWorkflowInstanceLink(controlloPratica.getCompanyId(), .fetchWorkflowInstanceLink(controlloPratica.getCompanyId(), controlloPratica.getGroupId(),
controlloPratica.getGroupId(), ControlloPratica.class.getName(), ControlloPratica.class.getName(), controlloPratica.getPrimaryKey());
controlloPratica.getPrimaryKey());
long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId(); long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId();
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance( WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(
controlloPratica.getCompanyId(), workflowInstanceId); controlloPratica.getCompanyId(), workflowInstanceId);
List<WorkflowTask> listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance( List<WorkflowTask> listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(
controlloPratica.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(), controlloPratica.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(), false,
false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
WorkflowTask task = null; WorkflowTask task = null;
if (listaTask != null && !listaTask.isEmpty()) { if (listaTask != null && !listaTask.isEmpty()) {
task = listaTask.get(0); task = listaTask.get(0);
} }
String taskName = StringPool.BLANK; String taskName = StringPool.BLANK;
if (task != null) { if (task != null) {
User userTask = UserLocalServiceUtil.fetchUser(task.getAssigneeUserId()); User userTask = UserLocalServiceUtil.fetchUser(task.getAssigneeUserId());
taskName = LanguageUtil.get(locale, task.getName()); taskName = LanguageUtil.get(locale, task.getName());
if (userTask != null) { if (userTask != null) {
taskName += " (" + userTask.getFullName() + ")"; taskName += " (" + userTask.getFullName() + StringPool.CLOSE_PARENTHESIS;
} }
} else { } else {
taskName = LanguageUtil.get(locale, workflowInstance.getState()); taskName = LanguageUtil.get(locale, workflowInstance.getState());
} }
sb.append(CSVUtil.encode(taskName)); sb.append(CSVUtil.encode(taskName));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
String tipoEsito = ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica String tipoEsito = ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica
.getControlloPraticaId()); .getControlloPraticaId());
sb.append(CSVUtil.encode(tipoEsito)); sb.append(CSVUtil.encode(tipoEsito));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
// ADT - BUG-13 Aggiunta colonna Data Esito // ADT - BUG-13 Aggiunta colonna Data Esito
// Bug 33264
if ("Tab_TaskCompletati".equals(currentTab)) { if ("Tab_TaskCompletati".equals(currentTab)) {
sb.append(CSVUtil.encode(sdf.format(controlloPratica.getStatusDate()))); sb.append(CSVUtil.encode(sdf.format(controlloPratica.getStatusDate())));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
} }
boolean sorteggiata = SorteggioLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()) != null;
boolean sorteggiata = SorteggioLocalServiceUtil
.findByIntPratica(intPratica.getIntPraticaId()) != null;
sb.append(CSVUtil.encode((sorteggiata) ? "Si" : "No")); sb.append(CSVUtil.encode((sorteggiata) ? "Si" : "No"));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
String praticaLabel = intPratica.getTitle(locale, true); String praticaLabel = intPratica.getTitle(locale, true);
sb.append(CSVUtil.encode(praticaLabel)); sb.append(CSVUtil.encode(praticaLabel));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
String istruttore = StringPool.DASH;
String istruttore = "-"; if (intPratica.getStatusByUserId() != 0L) {
if (intPratica.getStatusByUserId() != 0l) {
User istruttoreUser = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId()); User istruttoreUser = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (istruttoreUser != null) { if (istruttoreUser != null) {
istruttore = istruttoreUser.getFullName(); istruttore = istruttoreUser.getFullName();
} else { } else {
istruttore = " [" + intPratica.getStatusByUserId() + "]"; istruttore = " [" + intPratica.getStatusByUserId() + StringPool.CLOSE_BRACKET;
} }
} }
sb.append(CSVUtil.encode(istruttore)); sb.append(CSVUtil.encode(istruttore));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
StringBuilder provenienzaLabel = new StringBuilder(); StringBuilder provenienzaLabel = new StringBuilder();
WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask( WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask(controlloPratica.getCompanyId(),
controlloPratica.getCompanyId(), controlloPratica.getGroupId(), null, controlloPratica.getGroupId(), null, controlloPratica);
controlloPratica);
if (workflowTask != null) { if (workflowTask != null) {
User approvatore = UserLocalServiceUtil.fetchUser(workflowTask.getAssigneeUserId()); User approvatore = UserLocalServiceUtil.fetchUser(workflowTask.getAssigneeUserId());
if (approvatore != null) { if (approvatore != null) {
@ -771,42 +581,31 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
if (workflowTask.getAssigneeUserId() == -1) { if (workflowTask.getAssigneeUserId() == -1) {
provenienzaLabel.append(" [Portos 1]"); provenienzaLabel.append(" [Portos 1]");
} else { } else {
provenienzaLabel.append(" [" + workflowTask.getAssigneeUserId() + "]"); provenienzaLabel.append(" [").append(workflowTask.getAssigneeUserId())
.append(StringPool.CLOSE_BRACKET);
} }
} }
provenienzaLabel.append(" (" + workflowTask.getName() + ")"); provenienzaLabel.append(" (").append(workflowTask.getName()).append(StringPool.CLOSE_PARENTHESIS);
} else { } else {
provenienzaLabel.append("-"); provenienzaLabel.append(StringPool.DASH);
} }
sb.append(CSVUtil.encode(provenienzaLabel.toString())); sb.append(CSVUtil.encode(provenienzaLabel.toString()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(sdf.format(controlloPratica.getCreateDate()))); sb.append(CSVUtil.encode(sdf.format(controlloPratica.getCreateDate())));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(provincia.getProvincia() + " - " + comune.getDenominazione())); sb.append(CSVUtil.encode(provincia.getProvincia() + " - " + comune.getDenominazione()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
Date data = controlloPratica.getCreateDate(); Date data = controlloPratica.getCreateDate();
Date now = new Date(); Date now = new Date();
long diff = now.getTime() - data.getTime(); long diff = now.getTime() - data.getTime();
long days = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); long days = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
sb.append(CSVUtil.encode(days)); sb.append(CSVUtil.encode(days));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
} }
} catch (PortalException | SystemException e) {
} catch (PortalException e) {
_log.error(e, e);
} catch (SystemException e) {
_log.error(e, e); _log.error(e, e);
} }
return sb.toString(); return sb.toString();
} }
} }

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

@ -60,45 +60,32 @@ import com.liferay.util.bridges.mvc.MVCPortlet;
public class TempistichePortlet extends MVCPortlet { public class TempistichePortlet extends MVCPortlet {
@Override @Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
throws IOException, PortletException { PortletException {
String resourceId = GetterUtil.getString(resourceRequest.getResourceID()); String resourceId = GetterUtil.getString(resourceRequest.getResourceID());
if (resourceId.equals("exportCSV") || resourceId.equals("exportAllCSV")) { if (resourceId.equals("exportCSV") || resourceId.equals("exportAllCSV")) {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
long companyId = themeDisplay.getCompanyId(); long companyId = themeDisplay.getCompanyId();
long groupId = ParamUtil.getLong(resourceRequest, "groupId", 0l); long groupId = ParamUtil.getLong(resourceRequest, "groupId", 0L);
Locale locale = themeDisplay.getLocale(); Locale locale = themeDisplay.getLocale();
String tipoTempistica = ParamUtil.getString(resourceRequest, "tipoTempistica"); String tipoTempistica = ParamUtil.getString(resourceRequest, "tipoTempistica");
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca // ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
Integer statoPratica = Validator.isNotNull(resourceRequest.getParameter("statoPratica")) Integer statoPratica = Validator.isNull(resourceRequest.getParameter("statoPratica")) ? null : ParamUtil
&& !"".equals(resourceRequest.getParameter("statoPratica")) ? ParamUtil.getInteger( .getInteger(resourceRequest, "statoPratica");
resourceRequest, "statoPratica") : null;
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca // ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
String tipoPratica = ParamUtil.getString(resourceRequest, "tipoPratica"); String tipoPratica = ParamUtil.getString(resourceRequest, "tipoPratica");
String istruttore = ParamUtil.getString(resourceRequest, "istruttore"); String istruttore = ParamUtil.getString(resourceRequest, "istruttore");
try { try {
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca // ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
String csv = exportToCSV(companyId, groupId, locale, tipoTempistica, statoPratica, String csv = exportToCSV(companyId, groupId, locale, tipoTempistica, statoPratica, tipoPratica,
tipoPratica, istruttore, resourceId.equals("exportAllCSV")); istruttore, resourceId.equals("exportAllCSV"));
HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest);
HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse); HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse);
ServletResponseUtil.sendFile(request, response, "export_scadenze_" + tipoTempistica + ".csv", ServletResponseUtil.sendFile(request, response, "export_scadenze_" + tipoTempistica + ".csv",
csv.getBytes(StringPool.UTF8), ContentTypes.TEXT_CSV_UTF8); csv.getBytes(StringPool.UTF8), ContentTypes.TEXT_CSV_UTF8);
} catch (Exception e) { } catch (Exception e) {
throw new IOException(e); throw new IOException(e);
} }
} else { } else {
super.serveResource(resourceRequest, resourceResponse); super.serveResource(resourceRequest, resourceResponse);
} }
@ -106,11 +93,9 @@ public class TempistichePortlet extends MVCPortlet {
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca // ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
public void search(ActionRequest actionRequest, ActionResponse actionResponse) { public void search(ActionRequest actionRequest, ActionResponse actionResponse) {
String tipoPratica = ParamUtil.getString(actionRequest, "tipoPratica", StringPool.BLANK); String tipoPratica = ParamUtil.getString(actionRequest, "tipoPratica", StringPool.BLANK);
String istruttore = ParamUtil.getString(actionRequest, "istruttore", StringPool.BLANK); String istruttore = ParamUtil.getString(actionRequest, "istruttore", StringPool.BLANK);
String statoPratica = ParamUtil.getString(actionRequest, "statoPratica", StringPool.BLANK); String statoPratica = ParamUtil.getString(actionRequest, "statoPratica", StringPool.BLANK);
actionResponse.setRenderParameter("tipoPratica", tipoPratica); actionResponse.setRenderParameter("tipoPratica", tipoPratica);
actionResponse.setRenderParameter("istruttore", istruttore); actionResponse.setRenderParameter("istruttore", istruttore);
actionResponse.setRenderParameter("statoPratica", statoPratica); actionResponse.setRenderParameter("statoPratica", statoPratica);
@ -118,29 +103,23 @@ public class TempistichePortlet extends MVCPortlet {
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca // ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
private String exportToCSV(long companyId, long groupId, Locale locale, String tipoTempistica, private String exportToCSV(long companyId, long groupId, Locale locale, String tipoTempistica,
Integer statoPratica, String tipoPratica, String istruttore, boolean isBackCompatibility) Integer statoPratica, String tipoPratica, String istruttore, boolean isBackCompatibility) throws Exception {
throws Exception {
Format dateFormat = FastDateFormatFactoryUtil.getDate(locale); Format dateFormat = FastDateFormatFactoryUtil.getDate(locale);
Format dateTimeFormat = FastDateFormatFactoryUtil.getDateTime(locale); Format dateTimeFormat = FastDateFormatFactoryUtil.getDateTime(locale);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (tipoTempistica.equals(TempisticaConstants.TIPO_PRATICA)) { if (tipoTempistica.equals(TempisticaConstants.TIPO_PRATICA)) {
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca // ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
List<Object[]> tempistiche = isBackCompatibility ? TempisticaLocalServiceUtil List<Object[]> tempistiche = isBackCompatibility ? TempisticaLocalServiceUtil
.scadenzePraticheForBackwardCompatibility(companyId, groupId, QueryUtil.ALL_POS, .scadenzePraticheForBackwardCompatibility(companyId, groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS)
QueryUtil.ALL_POS) : TempisticaLocalServiceUtil.getScadenzePratiche(companyId, : TempisticaLocalServiceUtil.getScadenzePratiche(companyId, groupId, QueryUtil.ALL_POS,
groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, statoPratica, tipoPratica, istruttore); QueryUtil.ALL_POS, statoPratica, tipoPratica, istruttore);
sb.append(CSVUtil.encode(LanguageUtil
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, .get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
"label.scadenzegeniocivile.provincia")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.tipopratica"))); "label.scadenzegeniocivile.tipopratica")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.progetto")));
"label.scadenzegeniocivile.progetto")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.istruttore"))); "label.scadenzegeniocivile.istruttore")));
@ -151,8 +130,7 @@ public class TempistichePortlet extends MVCPortlet {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.datasorteggio"))); "label.scadenzegeniocivile.datasorteggio")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.start")));
"label.scadenzegeniocivile.start")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.tempoattivita"))); "label.scadenzegeniocivile.tempoattivita")));
@ -160,67 +138,46 @@ public class TempistichePortlet extends MVCPortlet {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.timerfermo"))); "label.scadenzegeniocivile.timerfermo")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza")));
"label.scadenzegeniocivile.scadenza")));
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
List<Long> alreadyInserted = new ArrayList<Long>(); List<Long> alreadyInserted = new ArrayList<Long>();
for (Object[] tempistica : tempistiche) { for (Object[] tempistica : tempistiche) {
Long intPraticaId = (Long) tempistica[0]; Long intPraticaId = (Long) tempistica[0];
Long stop = (Long) tempistica[2]; Long stop = (Long) tempistica[2];
// Long wait = (Long) tempistica[3];
Long calcoloTempo = (Long) tempistica[4]; Long calcoloTempo = (Long) tempistica[4];
Integer stato = (Integer) tempistica[5]; Integer stato = (Integer) tempistica[5];
Long dettPraticaId = 0L; Long dettPraticaId = 0L;
DynamicQuery query = DynamicQueryFactoryUtil.forClass(Tempistica.class); DynamicQuery query = DynamicQueryFactoryUtil.forClass(Tempistica.class);
query.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); query.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId));
query.add(RestrictionsFactoryUtil.eq("tipo", "P")); query.add(RestrictionsFactoryUtil.eq("tipo", "P"));
Order defaultOrderDettPrtatica = OrderFactoryUtil.desc("createDate"); Order defaultOrderDettPrtatica = OrderFactoryUtil.desc("createDate");
query.addOrder(defaultOrderDettPrtatica); query.addOrder(defaultOrderDettPrtatica);
List<Tempistica> lista = TempisticaLocalServiceUtil.dynamicQuery(query); List<Tempistica> lista = TempisticaLocalServiceUtil.dynamicQuery(query);
if (lista != null && !lista.isEmpty() && lista.size() > 1) { if (lista != null && !lista.isEmpty() && lista.size() > 1) {
intPraticaId = lista.get(0).getIntPraticaId(); intPraticaId = lista.get(0).getIntPraticaId();
dettPraticaId = lista.get(0).getDettPraticaId(); dettPraticaId = lista.get(0).getDettPraticaId();
stop = lista.get(0).getStop(); stop = lista.get(0).getStop();
if (alreadyInserted.contains(intPraticaId)) { if (alreadyInserted.contains(intPraticaId)) {
continue; continue;
} }
alreadyInserted.add(intPraticaId); alreadyInserted.add(intPraticaId);
} else { } else {
dettPraticaId = lista.get(0).getDettPraticaId(); dettPraticaId = lista.get(0).getDettPraticaId();
alreadyInserted.add(intPraticaId); alreadyInserted.add(intPraticaId);
} }
// DettPratica dettPratica =
// DettPraticaLocalServiceUtil.getDettPratica(dettPraticaId);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
.getTerritorioId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia()); territorio.getCodiceProvincia());
sb.append(CSVUtil.encode(provincia.getProvincia())); sb.append(CSVUtil.encode(provincia.getProvincia()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "tipo-pratica-" "tipo-pratica-" + intPratica.getTipoPratica())));
+ intPratica.getTipoPratica())));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(intPratica.getNumeroProgetto())); sb.append(CSVUtil.encode(intPratica.getNumeroProgetto()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
long statusByUserId = intPratica.getStatusByUserId(); long statusByUserId = intPratica.getStatusByUserId();
if (Validator.isNotNull(statusByUserId) if (Validator.isNotNull(statusByUserId) && intPratica.getStatus() != WorkflowConstants.STATUS_DRAFT) {
&& intPratica.getStatus() != WorkflowConstants.STATUS_DRAFT) {
try { try {
User istruttoreUser = UserLocalServiceUtil.getUser(statusByUserId); User istruttoreUser = UserLocalServiceUtil.getUser(statusByUserId);
sb.append(CSVUtil.encode(istruttoreUser.getFullName() + StringPool.SPACE sb.append(CSVUtil.encode(istruttoreUser.getFullName() + StringPool.SPACE
@ -230,40 +187,28 @@ public class TempistichePortlet extends MVCPortlet {
} }
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(dateTimeFormat.format(intPratica.getDtPratica()))); sb.append(CSVUtil.encode(dateTimeFormat.format(intPratica.getDtPratica())));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(intPratica.getDtSorteggio())) { if (Validator.isNotNull(intPratica.getDtSorteggio())) {
sb.append(CSVUtil.encode(dateFormat.format(intPratica.getDtSorteggio()))); sb.append(CSVUtil.encode(dateFormat.format(intPratica.getDtSorteggio())));
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
DynamicQuery queryAvv = DynamicQueryFactoryUtil.forClass(Avviso.class); DynamicQuery queryAvv = DynamicQueryFactoryUtil.forClass(Avviso.class);
queryAvv.add(RestrictionsFactoryUtil.eq("intPraticaId", intPratica.getIntPraticaId())); queryAvv.add(RestrictionsFactoryUtil.eq("intPraticaId", intPratica.getIntPraticaId()));
queryAvv.add(RestrictionsFactoryUtil.eq("tipoDocumento", "SP")); queryAvv.add(RestrictionsFactoryUtil.eq("tipoDocumento", StatoPraticaConstants.SOTTOPOSTA_A_PARERE));
queryAvv.add(RestrictionsFactoryUtil.eq("className", DettPratica.class.getName())); queryAvv.add(RestrictionsFactoryUtil.eq("className", DettPratica.class.getName()));
if (dettPraticaId != 0L) { if (dettPraticaId != 0L) {
queryAvv.add(RestrictionsFactoryUtil.eq("classPk", dettPraticaId)); queryAvv.add(RestrictionsFactoryUtil.eq("classPk", dettPraticaId));
} }
Order defaultOrder = OrderFactoryUtil.desc("createDate"); Order defaultOrder = OrderFactoryUtil.desc("createDate");
queryAvv.addOrder(defaultOrder); queryAvv.addOrder(defaultOrder);
List<Avviso> listaAvv = AvvisoLocalServiceUtil.dynamicQuery(queryAvv); List<Avviso> listaAvv = AvvisoLocalServiceUtil.dynamicQuery(queryAvv);
if (listaAvv != null && !listaAvv.isEmpty() && listaAvv.get(0).getDtInvio() != null) { if (listaAvv != null && !listaAvv.isEmpty() && listaAvv.get(0).getDtInvio() != null) {
sb.append(CSVUtil.encode(dateFormat.format(listaAvv.get(0).getDtInvio()))); sb.append(CSVUtil.encode(dateFormat.format(listaAvv.get(0).getDtInvio())));
} else {
sb.append("");
} }
// sb.append(CSVUtil.encode(dateFormat.format(new
// Date(start))));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(String.valueOf(TimeUnit.MILLISECONDS.toDays(calcoloTempo)))); sb.append(CSVUtil.encode(String.valueOf(TimeUnit.MILLISECONDS.toDays(calcoloTempo))));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(stop)) { if (Validator.isNotNull(stop)) {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.si"))); "label.scadenzegeniocivile.scadenza.si")));
@ -275,7 +220,6 @@ public class TempistichePortlet extends MVCPortlet {
"label.scadenzegeniocivile.scadenza.no"))); "label.scadenzegeniocivile.scadenza.no")));
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(stop)) { if (Validator.isNotNull(stop)) {
sb.append(LanguageUtil.get(getPortletConfig(), locale, sb.append(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.inattesa")); "label.scadenzegeniocivile.scadenza.inattesa"));
@ -283,70 +227,51 @@ public class TempistichePortlet extends MVCPortlet {
sb.append(LanguageUtil.get(getPortletConfig(), locale, sb.append(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.inscadenza")); "label.scadenzegeniocivile.scadenza.inscadenza"));
} else if (stato.intValue() == TempisticaConstants.STATO_SCADUTA) { } else if (stato.intValue() == TempisticaConstants.STATO_SCADUTA) {
sb.append(LanguageUtil.get(getPortletConfig(), locale, sb.append(LanguageUtil
"label.scadenzegeniocivile.scadenza.scaduto")); .get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza.scaduto"));
} else if (stato.intValue() == TempisticaConstants.STATO_ATTIVA) { } else if (stato.intValue() == TempisticaConstants.STATO_ATTIVA) {
sb.append(LanguageUtil.get(getPortletConfig(), locale, sb.append(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza.attivo"));
"label.scadenzegeniocivile.scadenza.attivo"));
} }
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
} }
} else if (tipoTempistica.equals(TempisticaConstants.TIPO_INTEGRAZIONE)) { } else if (tipoTempistica.equals(TempisticaConstants.TIPO_INTEGRAZIONE)) {
List<Object[]> tempistiche = TempisticaLocalServiceUtil.getScadenzeIntegrazioni(companyId, List<Object[]> tempistiche = TempisticaLocalServiceUtil.getScadenzeIntegrazioni(companyId, groupId,
groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, statoPratica); QueryUtil.ALL_POS, QueryUtil.ALL_POS, statoPratica);
sb.append(CSVUtil.encode(LanguageUtil
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, .get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
"label.scadenzegeniocivile.provincia")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.tipopratica"))); "label.scadenzegeniocivile.tipopratica")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.progetto")));
"label.scadenzegeniocivile.progetto")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.istruttore"))); "label.scadenzegeniocivile.istruttore")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.start")));
"label.scadenzegeniocivile.start")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.tempoattivita"))); "label.scadenzegeniocivile.tempoattivita")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza")));
"label.scadenzegeniocivile.scadenza")));
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
for (Object[] tempistica : tempistiche) { for (Object[] tempistica : tempistiche) {
Long intPraticaId = (Long) tempistica[0]; Long intPraticaId = (Long) tempistica[0];
Long calcoloTempo = (Long) tempistica[2]; Long calcoloTempo = (Long) tempistica[2];
Integer stato = (Integer) tempistica[3]; Integer stato = (Integer) tempistica[3];
Long dettPraticaId = (Long) tempistica[4]; Long dettPraticaId = (Long) tempistica[4];
// DettPratica dettPratica =
// DettPraticaLocalServiceUtil.getDettPratica(dettPraticaId);
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId);
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
.getTerritorioId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia()); territorio.getCodiceProvincia());
sb.append(CSVUtil.encode(provincia.getProvincia())); sb.append(CSVUtil.encode(provincia.getProvincia()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(intPratica.getTipoPratica())); sb.append(CSVUtil.encode(intPratica.getTipoPratica()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(intPratica.getNumeroProgetto())); sb.append(CSVUtil.encode(intPratica.getNumeroProgetto()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
long statusByUserId = intPratica.getStatusByUserId(); long statusByUserId = intPratica.getStatusByUserId();
if (Validator.isNotNull(statusByUserId) if (Validator.isNotNull(statusByUserId) && intPratica.getStatus() != WorkflowConstants.STATUS_DRAFT) {
&& intPratica.getStatus() != WorkflowConstants.STATUS_DRAFT) {
try { try {
User istruttoreUser = UserLocalServiceUtil.getUser(statusByUserId); User istruttoreUser = UserLocalServiceUtil.getUser(statusByUserId);
sb.append(CSVUtil.encode(istruttoreUser.getFullName() + StringPool.SPACE sb.append(CSVUtil.encode(istruttoreUser.getFullName() + StringPool.SPACE
@ -356,32 +281,25 @@ public class TempistichePortlet extends MVCPortlet {
} }
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
List<Avviso> avvisi = AvvisoLocalServiceUtil.findByClassPk_tipoDocumento(dettPraticaId, List<Avviso> avvisi = AvvisoLocalServiceUtil.findByClassPk_tipoDocumento(dettPraticaId,
StatoPraticaConstants.SOTTOPOSTA_A_PARERE); StatoPraticaConstants.SOTTOPOSTA_A_PARERE);
if (avvisi.size() > 0 && avvisi.get(0).getDtAvviso() != null) { if (avvisi.size() > 0 && avvisi.get(0).getDtAvviso() != null) {
sb.append(CSVUtil.encode(dateFormat.format(avvisi.get(0).getDtInvio()))); sb.append(CSVUtil.encode(dateFormat.format(avvisi.get(0).getDtInvio())));
} else { } else {
sb.append("-"); sb.append(StringPool.DASH);
} }
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(String.valueOf(TimeUnit.MILLISECONDS.toDays(calcoloTempo)))); sb.append(CSVUtil.encode(String.valueOf(TimeUnit.MILLISECONDS.toDays(calcoloTempo))));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (stato.intValue() == TempisticaConstants.STATO_SCADUTA) { if (stato.intValue() == TempisticaConstants.STATO_SCADUTA) {
sb.append(LanguageUtil.get(getPortletConfig(), locale, sb.append(LanguageUtil
"label.scadenzegeniocivile.scadenza.scaduto")); .get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza.scaduto"));
} else if (stato.intValue() == TempisticaConstants.STATO_ATTIVA) { } else if (stato.intValue() == TempisticaConstants.STATO_ATTIVA) {
sb.append(LanguageUtil.get(getPortletConfig(), locale, sb.append(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza.attivo"));
"label.scadenzegeniocivile.scadenza.attivo"));
} }
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
} }
} }
return sb.toString(); return sb.toString();
} }
} }

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

@ -1,13 +1,13 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. * 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 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* GNU Lesser General Public License as published by the Free Software Foundation; either version * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
* 2.1 of the License, or (at your option) any later version. * any later version.
* *
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* Lesser General Public License for more details. * details.
*/ */
package it.tref.liferay.portos.bo.service.impl; package it.tref.liferay.portos.bo.service.impl;
@ -70,15 +70,12 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
* The implementation of the asseverazione local service. * The implementation of the asseverazione local service.
* *
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* added, rerun ServiceBuilder to copy their definitions into the * their definitions into the {@link it.tref.liferay.portos.bo.service.AsseverazioneLocalService} interface.
* {@link it.tref.liferay.portos.bo.service.AsseverazioneLocalService}
* interface.
* *
* <p> * <p>
* This is a local service. Methods of this service will not have security * This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* checks based on the propagated JAAS credentials because this service can only * credentials because this service can only be accessed from within the same VM.
* be accessed from within the same VM.
* </p> * </p>
* *
* @author Davide Barbagallo, 3F Consulting * @author Davide Barbagallo, 3F Consulting
@ -87,11 +84,12 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
*/ */
public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBaseImpl { public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* {@link it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil} * it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil} to access the asseverazione local service.
* to access the asseverazione local service.
*/ */
private static final String CHECKED = "X";
@Override @Override
public String anteprimaAsseverazione(String tipo, User user, DettPratica dettPratica, String relazioni) public String anteprimaAsseverazione(String tipo, User user, DettPratica dettPratica, String relazioni)
throws IOException, SystemException, PortalException { throws IOException, SystemException, PortalException {
@ -112,24 +110,22 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
} }
@Override @Override
public String testoAsseverazione(String tipo, String codiceFiscale, DettPratica dettPratica, public String testoAsseverazione(String tipo, String codiceFiscale, DettPratica dettPratica, String relazioni)
String relazioni) throws SystemException, PortalException, IOException { throws SystemException, PortalException, IOException {
return testoAsseverazione(tipo, codiceFiscale, dettPratica, relazioni, false); return testoAsseverazione(tipo, codiceFiscale, dettPratica, relazioni, false);
} }
private String testoAsseverazione(String tipo, String codiceFiscale, DettPratica dettPratica, private String testoAsseverazione(String tipo, String codiceFiscale, DettPratica dettPratica, String relazioni,
String relazioni, boolean anteprima) throws SystemException, PortalException, IOException { boolean anteprima) throws SystemException, PortalException, IOException {
List<Soggetto> soggetti = SoggettoLocalServiceUtil.getValidTmpByIntPratica_CodiceFiscale( List<Soggetto> soggetti = SoggettoLocalServiceUtil.getValidTmpByIntPratica_CodiceFiscale(
dettPratica.getIntPraticaId(), codiceFiscale, 0L); dettPratica.getIntPraticaId(), codiceFiscale, 0L);
if (soggetti.size() > 0) { if (soggetti.size() > 0) {
Soggetto soggetto = soggetti.get(0); Soggetto soggetto = soggetti.get(0);
String nome = Validator.isNull(soggetto.getCognome()) ? soggetto.getLegaleRap() : soggetto String nome = Validator.isNull(soggetto.getCognome()) ? soggetto.getLegaleRap() : soggetto.getNome();
.getNome(); String cognome = Validator.isNull(soggetto.getCognome()) ? StringPool.BLANK : soggetto.getCognome();
String cognome = Validator.isNull(soggetto.getCognome()) ? StringPool.BLANK : soggetto
.getCognome();
return testoAsseverazione(tipo, nome, cognome, codiceFiscale, soggetto.getAmbitoProfessione(), return testoAsseverazione(tipo, nome, cognome, codiceFiscale, soggetto.getAmbitoProfessione(), dettPratica,
dettPratica, relazioni, false); relazioni, false);
} }
User user = UserLocalServiceUtil.fetchUserByScreenName(dettPratica.getCompanyId(), codiceFiscale); User user = UserLocalServiceUtil.fetchUserByScreenName(dettPratica.getCompanyId(), codiceFiscale);
if (Validator.isNotNull(user)) { if (Validator.isNotNull(user)) {
@ -140,8 +136,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
} }
private String testoAsseverazione(String tipo, String nome, String cognome, String codiceFiscale, private String testoAsseverazione(String tipo, String nome, String cognome, String codiceFiscale,
String ambitoProfessione, DettPratica dettPratica, String relazioni, boolean anteprima) String ambitoProfessione, DettPratica dettPratica, String relazioni, boolean anteprima) throws IOException,
throws IOException, SystemException, PortalException { SystemException, PortalException {
String file = null; String file = null;
switch (tipo) { switch (tipo) {
@ -171,8 +167,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
return null; return null;
} }
InputStream input = getClass().getClassLoader().getResourceAsStream( InputStream input = getClass().getClassLoader()
"/resource/asseverazioni/" + file + ".html"); .getResourceAsStream("/resource/asseverazioni/" + file + ".html");
if (Validator.isNull(input)) { if (Validator.isNull(input)) {
return null; return null;
} }
@ -189,9 +185,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
String PG = dettPratica.getGeoPericolositaGeomorfica(); String PG = dettPratica.getGeoPericolositaGeomorfica();
String PI = dettPratica.getGeoPericolositaIdraulica(); String PI = dettPratica.getGeoPericolositaIdraulica();
boolean rischio = (RG.equals("3") || RG.equals("4") || RG.equals("5") || RI.equals("3") boolean rischio = (RG.equals("3") || RG.equals("4") || RG.equals("5") || RI.equals("3") || RI.equals("4")
|| RI.equals("4") || PG.equals("3") || PG.equals("4") || PI.equals("3") || PI.equals("4") || PI || PG.equals("3") || PG.equals("4") || PI.equals("3") || PI.equals("4") || PI.equals("5"));
.equals("5"));
boolean coniugio = Validator.isNotNull(relazioni); boolean coniugio = Validator.isNotNull(relazioni);
@ -225,8 +220,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
if (!rilevanti) { if (!rilevanti) {
agMedio = (dettPratica.getTcAdeguamentoSismico() || dettPratica.getTcMiglioramentoSismico()) agMedio = (dettPratica.getTcAdeguamentoSismico() || dettPratica.getTcMiglioramentoSismico())
&& ((territorio.getZona().equals("2") && (ag >= 0.15) && (ag <= 0.2)) || territorio && ((territorio.getZona().equals("2") && (ag >= 0.15) && (ag <= 0.2)) || territorio.getZona()
.getZona().equals("3")); .equals("3"));
riparazioni = dettPratica.getTcRiparazioneInterventoLocale(); riparazioni = dettPratica.getTcRiparazioneInterventoLocale();
nuove = dettPratica.getTcNuovaCostruzione(); nuove = dettPratica.getTcNuovaCostruzione();
agricoli = dettPratica.getDestinazione().equals("1"); agricoli = dettPratica.getDestinazione().equals("1");
@ -234,39 +229,41 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
nonRilevanti = agMedio || riparazioni || nuove || agricoli; nonRilevanti = agMedio || riparazioni || nuove || agricoli;
} }
String html = buffer.toString().replaceAll("##anteprima(.*?)##", anteprima ? "" : "$1") String html = buffer.toString().replaceAll("##anteprima(.*?)##", anteprima ? StringPool.BLANK : "$1")
.replaceAll("##lavoripubblici(.*?)##", dettPratica.getLavoriPubblici() ? "" : "$1") .replaceAll("##lavoripubblici(.*?)##", dettPratica.getLavoriPubblici() ? StringPool.BLANK : "$1")
.replace("{{agalto}}", agAlto ? "X" : " ").replace("{{agmedio}}", agMedio ? "X" : " ") .replace("{{agalto}}", agAlto ? CHECKED : StringPool.SPACE)
.replace("{{agricoli}}", agricoli ? "X" : " ").replace("{{codicefiscale}}", codiceFiscale) .replace("{{agmedio}}", agMedio ? CHECKED : StringPool.SPACE)
.replace("{{cognome}}", cognome).replace("{{complesse}}", complesse ? "X" : " ") .replace("{{agricoli}}", agricoli ? CHECKED : StringPool.SPACE)
.replace("{{nome}}", nome).replace("{{nuove}}", nuove ? "X" : " ") .replace("{{codicefiscale}}", codiceFiscale).replace("{{cognome}}", cognome)
.replace("{{rilevanti}}", rilevanti ? "X" : " ") .replace("{{complesse}}", complesse ? CHECKED : StringPool.SPACE).replace("{{nome}}", nome)
.replace("{{nonrilevanti}}", nonRilevanti ? "X" : " ") .replace("{{nuove}}", nuove ? CHECKED : StringPool.SPACE)
.replace("{{riparazioni}}", riparazioni ? "X" : " ") .replace("{{rilevanti}}", rilevanti ? CHECKED : StringPool.SPACE)
.replace("{{rischio}}", rischio ? "X" : " ").replace("{{!rischio}}", rischio ? " " : "X") .replace("{{nonrilevanti}}", nonRilevanti ? CHECKED : StringPool.SPACE)
.replace("{{strategico}}", strategico ? "X" : " "); .replace("{{riparazioni}}", riparazioni ? CHECKED : StringPool.SPACE)
.replace("{{rischio}}", rischio ? CHECKED : StringPool.SPACE)
.replace("{{!rischio}}", rischio ? StringPool.SPACE : CHECKED)
.replace("{{strategico}}", strategico ? CHECKED : StringPool.SPACE);
if (null == relazioni) { if (null == relazioni) {
html = html.replace("{{coniugio}}", " ").replace("{{!coniugio}}", " ") html = html.replace("{{coniugio}}", StringPool.SPACE).replace("{{!coniugio}}", StringPool.SPACE)
.replace("{{relazioni}}", ""); .replace("{{relazioni}}", StringPool.BLANK);
} else { } else {
html = html.replace("{{coniugio}}", coniugio ? "X" : " ") html = html.replace("{{coniugio}}", coniugio ? CHECKED : StringPool.SPACE)
.replace("{{!coniugio}}", coniugio ? " " : "X") .replace("{{!coniugio}}", coniugio ? StringPool.SPACE : CHECKED)
.replace("{{relazioni}}", relazioni.trim().replace("\n", ", ")); .replace("{{relazioni}}", relazioni.trim().replace(StringPool.NEW_LINE, ", "));
} }
return html; return html;
} }
@Override @Override
public Asseverazione addAsseverazione(long userId, long intPraticaId, long dettPraticaId, public Asseverazione addAsseverazione(long userId, long intPraticaId, long dettPraticaId, String tipologia,
String tipologia, String codiceFiscale, ServiceContext serviceContext) throws PortalException, String codiceFiscale, ServiceContext serviceContext) throws PortalException, SystemException {
SystemException {
User user = userPersistence.findByPrimaryKey(userId); User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date(); Date now = new Date();
Asseverazione asseverazione = asseverazionePersistence.create(counterLocalService Asseverazione asseverazione = asseverazionePersistence.create(counterLocalService.increment(Asseverazione.class
.increment(Asseverazione.class.getName())); .getName()));
asseverazione.setCompanyId(serviceContext.getCompanyId()); asseverazione.setCompanyId(serviceContext.getCompanyId());
asseverazione.setUserId(user.getUserId()); asseverazione.setUserId(user.getUserId());
@ -280,8 +277,7 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
asseverazione.setTipologia(tipologia); asseverazione.setTipologia(tipologia);
asseverazione.setEsito(DelegheUtil.STATO_ASSEGNATA); asseverazione.setEsito(DelegheUtil.STATO_ASSEGNATA);
asseverazione.setCodiceFiscale(codiceFiscale); asseverazione.setCodiceFiscale(codiceFiscale);
List<Soggetto> soggetti = soggettoLocalService.findByIntPratica_CodiceFiscale(intPraticaId, List<Soggetto> soggetti = soggettoLocalService.findByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale);
codiceFiscale);
if (!soggetti.isEmpty()) { if (!soggetti.isEmpty()) {
asseverazione.setSoggettoId(soggetti.get(0).getUserId()); asseverazione.setSoggettoId(soggetti.get(0).getUserId());
} }
@ -292,34 +288,32 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
} }
@Override @Override
public void richiediAsseverazioni(long dettPraticaId, ServiceContext serviceContext) public void richiediAsseverazioni(long dettPraticaId, ServiceContext serviceContext) throws SystemException,
throws SystemException, PortalException { PortalException {
DettPratica dettPratica = dettPraticaLocalService.getDettPratica(dettPraticaId); DettPratica dettPratica = dettPraticaLocalService.getDettPratica(dettPraticaId);
long intPraticaId = dettPratica.getIntPraticaId(); long intPraticaId = dettPratica.getIntPraticaId();
IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId); IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId);
if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica.getTipoIntegrazione()) if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())
|| TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPratica.getTipoIntegrazione()) || TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())
|| TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO.equalsIgnoreCase(dettPratica || TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) {
.getTipoIntegrazione())) {
List<Soggetto> nuoviSoggetti = new ArrayList<Soggetto>( List<Soggetto> nuoviSoggetti = new ArrayList<Soggetto>(
soggettoLocalService.getValidTmpByDettPratica(dettPraticaId)); soggettoLocalService.getValidTmpByDettPratica(dettPraticaId));
List<String> cfNuoviSoggetti = soggettoLocalService.getCfValidTmpByDettPratica(dettPraticaId); List<String> cfNuoviSoggetti = soggettoLocalService.getCfValidTmpByDettPratica(dettPraticaId);
List<String> nuoviDelegati = new ArrayList<String>( List<String> nuoviDelegati = new ArrayList<String>(
DelegaLocalServiceUtil.findCfByDettPratica_Tipologia_InEsito(dettPraticaId, new String[] { DelegaLocalServiceUtil.findCfByDettPratica_Tipologia_InEsito(dettPraticaId, new String[] {
TipoSoggettoUtil.COMMITTENTE, TipoSoggettoUtil.DIRETTORE_LAVORI, TipoSoggettoUtil.COMMITTENTE, TipoSoggettoUtil.DIRETTORE_LAVORI, TipoSoggettoUtil.GEOLOGO,
TipoSoggettoUtil.GEOLOGO, TipoSoggettoUtil.DITTA, TipoSoggettoUtil.PROGETTISTA }, TipoSoggettoUtil.DITTA, TipoSoggettoUtil.PROGETTISTA },
new String[] { AsseverazioniUtil.STATO_ESEGUITA })); new String[] { AsseverazioniUtil.STATO_ESEGUITA }));
nuoviDelegati.removeAll(cfNuoviSoggetti); nuoviDelegati.removeAll(cfNuoviSoggetti);
for (String cfDelegato : nuoviDelegati) { for (String cfDelegato : nuoviDelegati) {
List<Soggetto> delegato = soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale( List<Soggetto> delegato = soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale(intPraticaId,
intPraticaId, cfDelegato, 0l); cfDelegato, 0l);
GenericUtils.addAllIfnotExist(nuoviSoggetti, delegato); GenericUtils.addAllIfnotExist(nuoviSoggetti, delegato);
} }
if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) {
.getTipoIntegrazione())) {
User titolaredigitaleUser = UserLocalServiceUtil.getUser(intPratica.getUserId()); User titolaredigitaleUser = UserLocalServiceUtil.getUser(intPratica.getUserId());
// Soggetto titolareDigitale = // Soggetto titolareDigitale =
// soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale(intPraticaId, // soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale(intPraticaId,
@ -335,58 +329,50 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
List<Soggetto> titolareDigitali = soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale( List<Soggetto> titolareDigitali = soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale(
intPraticaId, titolaredigitaleUser.getScreenName(), 0l); intPraticaId, titolaredigitaleUser.getScreenName(), 0l);
for (Soggetto titolareDigitale : titolareDigitali) { for (Soggetto titolareDigitale : titolareDigitali) {
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), dettPraticaId,
dettPraticaId, titolareDigitale.getTipologiaSoggetto(), titolareDigitale.getTipologiaSoggetto(), titolareDigitale.getCodiceFiscale(),
titolareDigitale.getCodiceFiscale(), serviceContext); serviceContext);
} }
} else if (TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) { } else if (TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) {
String[] tipoSoggetti = new String[] { TipoSoggettoUtil.COMMITTENTE, String[] tipoSoggetti = new String[] { TipoSoggettoUtil.COMMITTENTE, TipoSoggettoUtil.DIRETTORE_LAVORI,
TipoSoggettoUtil.DIRETTORE_LAVORI, TipoSoggettoUtil.DITTA, TipoSoggettoUtil.DITTA, TipoSoggettoUtil.PROGETTISTA };
TipoSoggettoUtil.PROGETTISTA };
// if (SoggettiUtil.isTitolareInCommittenti(intPraticaId)) { // if (SoggettiUtil.isTitolareInCommittenti(intPraticaId)) {
if (ValidazionePraticaUtil.isA98Required(dettPratica)) { if (ValidazionePraticaUtil.isA98Required(dettPratica)) {
tipoSoggetti = (String[]) ArrayUtils.removeElement(tipoSoggetti, tipoSoggetti = (String[]) ArrayUtils.removeElement(tipoSoggetti, TipoSoggettoUtil.COMMITTENTE);
TipoSoggettoUtil.COMMITTENTE);
} }
List<Soggetto> soggettiPrincipali = soggettoLocalService List<Soggetto> soggettiPrincipali = soggettoLocalService
.getSoggettiPrincipaliValidTmpByDettPratica_TipologiaSoggetto(dettPraticaId, .getSoggettiPrincipaliValidTmpByDettPratica_TipologiaSoggetto(dettPraticaId, tipoSoggetti);
tipoSoggetti);
GenericUtils.addAllIfnotExist(nuoviSoggetti, soggettiPrincipali); GenericUtils.addAllIfnotExist(nuoviSoggetti, soggettiPrincipali);
} }
for (Soggetto soggetto : nuoviSoggetti) { for (Soggetto soggetto : nuoviSoggetti) {
if (TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(soggetto.getTipologiaSoggetto())) { if (TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(soggetto.getTipologiaSoggetto())) {
if (!ValidazionePraticaUtil.isA98Required(dettPratica)) { if (!ValidazionePraticaUtil.isA98Required(dettPratica)) {
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), dettPraticaId,
dettPraticaId, soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(), soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(), serviceContext);
serviceContext);
} }
} else { } else {
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), dettPraticaId,
dettPraticaId, soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(), soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(), serviceContext);
serviceContext);
} }
} }
} else { } else {
List<Soggetto> soggetti = soggettoLocalService.getValidTmpByIntPratica(dettPratica List<Soggetto> soggetti = soggettoLocalService.getValidTmpByIntPratica(dettPratica.getIntPraticaId());
.getIntPraticaId());
for (Soggetto soggetto : soggetti) { for (Soggetto soggetto : soggetti) {
if ((TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(soggetto.getTipologiaSoggetto()) && !ValidazionePraticaUtil if ((TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(soggetto.getTipologiaSoggetto()) && !ValidazionePraticaUtil
.isA98Required(dettPratica)) .isA98Required(dettPratica))
|| TipoSoggettoUtil.DITTA.equalsIgnoreCase(soggetto.getTipologiaSoggetto()) || TipoSoggettoUtil.DITTA.equalsIgnoreCase(soggetto.getTipologiaSoggetto())
|| TipoSoggettoUtil.DIRETTORE_LAVORI || TipoSoggettoUtil.DIRETTORE_LAVORI.equalsIgnoreCase(soggetto.getTipologiaSoggetto())
.equalsIgnoreCase(soggetto.getTipologiaSoggetto())
|| TipoSoggettoUtil.PROGETTISTA.equalsIgnoreCase(soggetto.getTipologiaSoggetto()) || TipoSoggettoUtil.PROGETTISTA.equalsIgnoreCase(soggetto.getTipologiaSoggetto())
|| (TipoSoggettoUtil.COLLAUDATORE.equalsIgnoreCase(soggetto.getTipologiaSoggetto()) && !soggetto || (TipoSoggettoUtil.COLLAUDATORE.equalsIgnoreCase(soggetto.getTipologiaSoggetto()) && !soggetto
.isAggiuntivo())) { .isAggiuntivo())) {
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), dettPraticaId,
dettPraticaId, soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(), soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(), serviceContext);
serviceContext);
} }
} }
@ -436,8 +422,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
} }
@Override @Override
public Asseverazione generateReportAsseverazione(Asseverazione asseverazione, long userId) public Asseverazione generateReportAsseverazione(Asseverazione asseverazione, long userId) throws IOException,
throws IOException, SystemException, PortalException { SystemException, PortalException {
if (Validator.isNotNull(asseverazione.getFileEntryId())) { if (Validator.isNotNull(asseverazione.getFileEntryId())) {
dlAppLocalService.deleteFileEntry(asseverazione.getFileEntryId()); dlAppLocalService.deleteFileEntry(asseverazione.getFileEntryId());
@ -446,26 +432,25 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
String tipoDocumento = "AS"; String tipoDocumento = "AS";
String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(tipoDocumento); String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(tipoDocumento);
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong( long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(asseverazione.getCompanyId(),
asseverazione.getCompanyId(), propertiesTemplate); propertiesTemplate);
String propertiesFolder = AvvisoUtil.getAllTipoDocumentoFolderProps().get(tipoDocumento); String propertiesFolder = AvvisoUtil.getAllTipoDocumentoFolderProps().get(tipoDocumento);
long fileEntryIdFolder = configurazioneLocalService.findByC_ChiaveLong(asseverazione.getCompanyId(), long fileEntryIdFolder = configurazioneLocalService.findByC_ChiaveLong(asseverazione.getCompanyId(),
propertiesFolder); propertiesFolder);
String fileName = StringUtils.leftPad(String.valueOf(asseverazione.getDettPraticaId()), 10, '0') String fileName = StringUtils.leftPad(String.valueOf(asseverazione.getDettPraticaId()), 10, '0')
+ (Validator.isNotNull(tipoDocumento) ? StringPool.UNDERLINE + tipoDocumento + (Validator.isNotNull(tipoDocumento) ? StringPool.UNDERLINE + tipoDocumento : StringPool.BLANK)
: StringPool.BLANK)
+ StringPool.UNDERLINE + StringPool.UNDERLINE
+ (Validator.isNotNull(asseverazione.getAsseverazioneId()) ? asseverazione + (Validator.isNotNull(asseverazione.getAsseverazioneId()) ? asseverazione.getAsseverazioneId()
.getAsseverazioneId() : System.currentTimeMillis()); : System.currentTimeMillis());
ReportDto reportDto = new ReportDto(); ReportDto reportDto = new ReportDto();
reportDto.setFileEntryIds(new long[] { fileEntryIdTemplate }); reportDto.setFileEntryIds(new long[] { fileEntryIdTemplate });
reportDto.setFolderId(fileEntryIdFolder); reportDto.setFolderId(fileEntryIdFolder);
reportDto.setFileName(fileName); reportDto.setFileName(fileName);
reportDto.setHeader(""); reportDto.setHeader(StringPool.BLANK);
reportDto.setHeaderHeight(1); reportDto.setHeaderHeight(1);
reportDto.setFooter(""); reportDto.setFooter(StringPool.BLANK);
reportDto.setFooterHeight(40); reportDto.setFooterHeight(40);
Map<String, Object> parameters = new HashMap<String, Object>(); Map<String, Object> parameters = new HashMap<String, Object>();
@ -477,12 +462,12 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
relazioni = (String) dichiarazioniMap.get("relazioni"); relazioni = (String) dichiarazioniMap.get("relazioni");
} }
} else { } else {
relazioni = ""; relazioni = StringPool.BLANK;
} }
} }
String testoAsseverazione = testoAsseverazione(asseverazione.getTipologia(), String testoAsseverazione = testoAsseverazione(asseverazione.getTipologia(), asseverazione.getCodiceFiscale(),
asseverazione.getCodiceFiscale(), asseverazione.getDettPraticaId(), relazioni); asseverazione.getDettPraticaId(), relazioni);
if (Validator.isNull(testoAsseverazione)) { if (Validator.isNull(testoAsseverazione)) {
testoAsseverazione = AsseverazioniUtil.retrieveAsseverazioneText(asseverazione, testoAsseverazione = AsseverazioniUtil.retrieveAsseverazioneText(asseverazione,
asseverazione.getCodiceFiscale()); asseverazione.getCodiceFiscale());
@ -499,8 +484,7 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
.replace(getClass().getSimpleName(), "resource/asseverazioni"); .replace(getClass().getSimpleName(), "resource/asseverazioni");
reportDto.setPortalURL(getClass().getResource(resourcePath).getPath()); reportDto.setPortalURL(getClass().getResource(resourcePath).getPath());
ReportResultDto result = ReportUtil.generateReport(asseverazione.getCompanyId(), userId, reportDto, ReportResultDto result = ReportUtil.generateReport(asseverazione.getCompanyId(), userId, reportDto, null);
null);
long idFileEntry = result.getFileEntryIds()[0]; long idFileEntry = result.getFileEntryIds()[0];
asseverazione.setFileEntryId(idFileEntry); asseverazione.setFileEntryId(idFileEntry);
@ -510,8 +494,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
} }
@Override @Override
public void cambioStatoAsseverazioni(long dettPraticaId, String stato) throws IOException, public void cambioStatoAsseverazioni(long dettPraticaId, String stato) throws IOException, SystemException,
SystemException, PortalException { PortalException {
List<Asseverazione> asseverazioni = asseverazionePersistence.findByDettPratica(dettPraticaId); List<Asseverazione> asseverazioni = asseverazionePersistence.findByDettPratica(dettPraticaId);
for (Asseverazione asseverazione : asseverazioni) { for (Asseverazione asseverazione : asseverazioni) {
@ -520,12 +504,10 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
} }
@Override @Override
public void concludiAsseverazioniExpired(long dettPraticaId) throws IOException, SystemException, public void concludiAsseverazioniExpired(long dettPraticaId) throws IOException, SystemException, PortalException {
PortalException {
List<Asseverazione> asseverazioni = asseverazioneLocalService.findByDettPratica_InEsito( List<Asseverazione> asseverazioni = asseverazioneLocalService.findByDettPratica_InEsito(dettPraticaId,
dettPraticaId, new String[] { AsseverazioniUtil.STATO_ASSEGNATA }, QueryUtil.ALL_POS, new String[] { AsseverazioniUtil.STATO_ASSEGNATA }, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
QueryUtil.ALL_POS, null);
for (Asseverazione asseverazione : asseverazioni) { for (Asseverazione asseverazione : asseverazioni) {
cambioStatoAsseverazione(asseverazione.getUserId(), asseverazione.getAsseverazioneId(), cambioStatoAsseverazione(asseverazione.getUserId(), asseverazione.getAsseverazioneId(),
AsseverazioniUtil.STATO_EXPIRED); AsseverazioniUtil.STATO_EXPIRED);
@ -570,14 +552,13 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
ServiceContext serviceContext) throws SystemException, PortalException { ServiceContext serviceContext) throws SystemException, PortalException {
Asseverazione asseverazione = asseverazioneLocalService.getAsseverazione(asseverazioneId); Asseverazione asseverazione = asseverazioneLocalService.getAsseverazione(asseverazioneId);
DettPratica dettPratica = dettPraticaLocalService.getLastEditableByIntPratica(asseverazione DettPratica dettPratica = dettPraticaLocalService.getLastEditableByIntPratica(asseverazione.getIntPraticaId());
.getIntPraticaId());
// TODO forse dobbiamo mettere i permesssi ma non mi pare sicuro. // TODO forse dobbiamo mettere i permesssi ma non mi pare sicuro.
FileEntry fileEntry = null; FileEntry fileEntry = null;
if (asseverazione.getEsito().equalsIgnoreCase(AsseverazioniUtil.STATO_ASSEGNATA)) { if (asseverazione.getEsito().equalsIgnoreCase(AsseverazioniUtil.STATO_ASSEGNATA)) {
long defaultFolderId = configurazioneLocalService.findByC_ChiaveLong( long defaultFolderId = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
serviceContext.getCompanyId(), ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId); Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId);
@ -586,19 +567,18 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
Folder folder = null; Folder folder = null;
try { try {
folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), defaultFolder.getFolderId(),
defaultFolder.getFolderId(), folderName); folderName);
} catch (NoSuchFolderException e) { } catch (NoSuchFolderException e) {
// cartella non presente -> creo cartella // cartella non presente -> creo cartella
folder = dlAppLocalService.addFolder(serviceContext.getUserId(), folder = dlAppLocalService.addFolder(serviceContext.getUserId(), defaultFolder.getRepositoryId(),
defaultFolder.getRepositoryId(), defaultFolder.getFolderId(), folderName, defaultFolder.getFolderId(), folderName, StringPool.BLANK, serviceContext);
StringPool.BLANK, serviceContext);
} }
Date now = new Date(); Date now = new Date();
String tipologiaUtente = asseverazione.getTipologia(); String tipologiaUtente = asseverazione.getTipologia();
String title = now.getTime() + StringPool.UNDERLINE + "asseverazione" + StringPool.UNDERLINE String title = now.getTime() + StringPool.UNDERLINE + "asseverazione" + StringPool.UNDERLINE
+ tipologiaUtente + StringPool.UNDERLINE + sourceFileName; + tipologiaUtente + StringPool.UNDERLINE + sourceFileName;
String description = ""; String description = StringPool.BLANK;
String mimeType = MimeTypesUtil.getContentType(sourceFileName); String mimeType = MimeTypesUtil.getContentType(sourceFileName);
String changeLog = StringPool.BLANK; String changeLog = StringPool.BLANK;
@ -641,26 +621,25 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
} }
@Override @Override
public List<Asseverazione> findByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale, public List<Asseverazione> findByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale, int start,
int start, int end, OrderByComparator orderByComparator) throws SystemException { int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale, start, return asseverazionePersistence.findByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale, start, end,
end, orderByComparator); orderByComparator);
} }
@Override @Override
public int countByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale) public int countByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale) throws SystemException {
throws SystemException {
return asseverazionePersistence.countByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale); return asseverazionePersistence.countByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale);
} }
@Override @Override
public List<Asseverazione> findByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti, int start, public List<Asseverazione> findByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti, int start, int end,
int end, OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByCodiceFiscale_InEsito(codiceFiscale, esiti, start, end, return asseverazionePersistence
orderByComparator); .findByCodiceFiscale_InEsito(codiceFiscale, esiti, start, end, orderByComparator);
} }
@Override @Override
@ -670,45 +649,40 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
} }
@Override @Override
public List<Asseverazione> findByIntPratica_CodiceFiscale_InEsito(long intPraticaId, public List<Asseverazione> findByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale,
String codiceFiscale, String[] esiti, int start, int end, OrderByComparator orderByComparator) String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
throws SystemException {
return asseverazionePersistence.findByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, return asseverazionePersistence.findByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti,
esiti, start, end, orderByComparator); start, end, orderByComparator);
} }
@Override @Override
public List<Asseverazione> findByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, public List<Asseverazione> findByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale,
String codiceFiscale, String[] esiti, int start, int end, OrderByComparator orderByComparator) String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
throws SystemException {
return asseverazionePersistence.findByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, return asseverazionePersistence.findByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti,
esiti, start, end, orderByComparator); start, end, orderByComparator);
} }
@Override @Override
public int countByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale, String[] esiti) public int countByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale, String[] esiti)
throws SystemException { throws SystemException {
return asseverazionePersistence.countByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, return asseverazionePersistence.countByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti);
esiti);
} }
@Override @Override
public int countByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale, public int countByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale, String[] esiti)
String[] esiti) throws SystemException { throws SystemException {
return asseverazionePersistence.countByIntPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, return asseverazionePersistence.countByIntPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti);
esiti);
} }
@Override @Override
public List<Asseverazione> findByIntPratica_InEsito(long intPraticaId, String[] esiti, int start, public List<Asseverazione> findByIntPratica_InEsito(long intPraticaId, String[] esiti, int start, int end,
int end, OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByIntPratica_InEsito(intPraticaId, esiti, start, end, return asseverazionePersistence.findByIntPratica_InEsito(intPraticaId, esiti, start, end, orderByComparator);
orderByComparator);
} }
@Override @Override
@ -718,11 +692,10 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
} }
@Override @Override
public List<Asseverazione> findByDettPratica_InEsito(long dettPraticaId, String[] esiti, int start, public List<Asseverazione> findByDettPratica_InEsito(long dettPraticaId, String[] esiti, int start, int end,
int end, OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByDettPratica_InEsito(dettPraticaId, esiti, start, end, return asseverazionePersistence.findByDettPratica_InEsito(dettPraticaId, esiti, start, end, orderByComparator);
orderByComparator);
} }
@Override @Override
@ -735,16 +708,15 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
public List<Asseverazione> findByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia, public List<Asseverazione> findByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException { String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, return asseverazionePersistence.findByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti, start,
esiti, start, end, orderByComparator); end, orderByComparator);
} }
@Override @Override
public int countByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia, String[] esiti) public int countByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia, String[] esiti)
throws SystemException { throws SystemException {
return asseverazionePersistence.countByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, return asseverazionePersistence.countByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti);
esiti);
} }
@Override @Override
@ -752,32 +724,32 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
String codiceFiscale, String tipologia, String[] esiti, int start, int end, String codiceFiscale, String tipologia, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId, return asseverazionePersistence.findByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId, codiceFiscale,
codiceFiscale, tipologia, esiti, start, end, orderByComparator); tipologia, esiti, start, end, orderByComparator);
} }
@Override @Override
public int countByIntPratica_CodiceFiscale_Tipologia_InEsito(long intPraticaId, String codiceFiscale, public int countByIntPratica_CodiceFiscale_Tipologia_InEsito(long intPraticaId, String codiceFiscale,
String tipologia, String[] esiti) throws SystemException { String tipologia, String[] esiti) throws SystemException {
return asseverazionePersistence.countByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId, return asseverazionePersistence.countByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId, codiceFiscale,
codiceFiscale, tipologia, esiti); tipologia, esiti);
} }
@Override @Override
public List<Asseverazione> findByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia, public List<Asseverazione> findByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia, String[] esiti,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException { int start, int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti, return asseverazionePersistence.findByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti, start, end,
start, end, orderByComparator); orderByComparator);
} }
@Override @Override
public List<Asseverazione> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String tipologia, public List<Asseverazione> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException { String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByDettPratica_Tipologia_InEsito(dettPraticaId, tipologia, esiti, return asseverazionePersistence.findByDettPratica_Tipologia_InEsito(dettPraticaId, tipologia, esiti, start,
start, end, orderByComparator); end, orderByComparator);
} }
@Override @Override

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

@ -15,6 +15,7 @@ package it.tref.liferay.portos.bo.service.impl;
import it.tref.liferay.portos.bo.model.Avviso; import it.tref.liferay.portos.bo.model.Avviso;
import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.model.IntPratica;
import it.tref.liferay.portos.bo.model.Sorteggio;
import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.base.AvvisoLocalServiceBaseImpl; import it.tref.liferay.portos.bo.service.base.AvvisoLocalServiceBaseImpl;
@ -108,7 +109,6 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
String statoPratica = intPratica.getStatoPratica(); String statoPratica = intPratica.getStatoPratica();
if (AvvisoUtil.isStatoPraticaValidoNuovoAvviso(statoPratica)) { if (AvvisoUtil.isStatoPraticaValidoNuovoAvviso(statoPratica)) {
if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(statoPratica) if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(statoPratica)
&& AzioniPraticheUtil.isAutorizzazione(intPratica.getIntPraticaId())) { && AzioniPraticheUtil.isAutorizzazione(intPratica.getIntPraticaId())) {
statoPratica = StatoPraticaConstants.AUTORIZZATA; statoPratica = StatoPraticaConstants.AUTORIZZATA;
@ -116,12 +116,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
&& AzioniPraticheUtil.isAutorizzazione(intPratica.getIntPraticaId())) { && AzioniPraticheUtil.isAutorizzazione(intPratica.getIntPraticaId())) {
statoPratica = StatoPraticaConstants.NON_AUTORIZZATA; statoPratica = StatoPraticaConstants.NON_AUTORIZZATA;
} }
String propertiesTemplate = null; String propertiesTemplate = null;
String tipoProcedura = intPratica.getTipoProcedura(); String tipoProcedura = intPratica.getTipoProcedura();
switch (statoPratica) { switch (statoPratica) {
case StatoPraticaConstants.SOTTOPOSTA_A_PARERE: case StatoPraticaConstants.SOTTOPOSTA_A_PARERE:
if (Validator.isNull(tipoProcedura) || tipoProcedura.equalsIgnoreCase(Constants.PROCEDURA_A)) { Sorteggio sorteggio = sorteggioLocalService.findByIntPratica(intPratica.getIntPraticaId());
if (Validator.isNull(tipoProcedura) || tipoProcedura.equalsIgnoreCase(Constants.PROCEDURA_A)
|| Validator.isNull(sorteggio)) {
propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPratica); propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPratica);
} else { } else {
propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get("DPPS"); propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get("DPPS");
@ -165,7 +166,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
propertiesTemplate); propertiesTemplate);
_log.info("debugAvviso: " + propertiesTemplate + " (" + statoPraticaCode + ")" _log.info("debugAvviso: " + propertiesTemplate + " (" + statoPraticaCode + ")"
+ (varianteNonSostanziale ? " non sostanziale" : "")); + (varianteNonSostanziale ? " non sostanziale" : StringPool.BLANK));
return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate, classPk, return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate, classPk,
className, userCodiceFiscalePrimaFirma, jsonParameters, controlloPraticaId, serviceContext); className, userCodiceFiscalePrimaFirma, jsonParameters, controlloPraticaId, serviceContext);
} }
@ -502,7 +503,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
dynamicQuery.add(PropertyFactoryUtil.forName("rifiutato").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("rifiutato").eq(false));
Disjunction disjunction = RestrictionsFactoryUtil.disjunction(); Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
disjunction.add(RestrictionsFactoryUtil.eq("userCodiceFiscalePrimaFirma", "")); disjunction.add(RestrictionsFactoryUtil.eq("userCodiceFiscalePrimaFirma", StringPool.BLANK));
disjunction.add(RestrictionsFactoryUtil.isNull("userCodiceFiscalePrimaFirma")); disjunction.add(RestrictionsFactoryUtil.isNull("userCodiceFiscalePrimaFirma"));
dynamicQuery.add(disjunction); dynamicQuery.add(disjunction);
@ -1156,115 +1157,76 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
throws ParseException, SystemException { throws ParseException, SystemException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
List<Avviso> lista = new ArrayList<Avviso>(); List<Avviso> lista = new ArrayList<Avviso>();
DynamicQuery query = DynamicQueryFactoryUtil.forClass(Avviso.class); DynamicQuery query = DynamicQueryFactoryUtil.forClass(Avviso.class);
if (Validator.isNotNull(numeroProtocollo)) {
if (numeroProtocollo != null && !numeroProtocollo.equals("")) {
query.add(RestrictionsFactoryUtil.eq("protocollo", numeroProtocollo)); query.add(RestrictionsFactoryUtil.eq("protocollo", numeroProtocollo));
} }
Calendar calendarDa = Calendar.getInstance(); Calendar calendarDa = Calendar.getInstance();
calendarDa.set(Calendar.DAY_OF_MONTH, 1); calendarDa.set(Calendar.DAY_OF_MONTH, 1);
calendarDa.set(Calendar.MONTH, 1); calendarDa.set(Calendar.MONTH, 1);
calendarDa.set(Calendar.YEAR, 2014); calendarDa.set(Calendar.YEAR, 2014);
if (Validator.isNotNull(dataDa) && Validator.isNotNull(dataA)) {
if (dataDa != null && !dataDa.equals("") && dataA != null && !dataA.equals("")) {
Date dateDa = sdf.parse(dataDa); Date dateDa = sdf.parse(dataDa);
Date dateA = sdf.parse(dataA); Date dateA = sdf.parse(dataA);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo"); Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(dateDa, dateA)); query.add(createDateProperty.between(dateDa, dateA));
} }
if (Validator.isNotNull(dataDa) && Validator.isNull(dataA)) {
if (dataDa != null && !dataDa.equals("") && (dataA == null || dataA.equals(""))) {
Date dateDa = sdf.parse(dataDa); Date dateDa = sdf.parse(dataDa);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo"); Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(dateDa, new Date())); query.add(createDateProperty.between(dateDa, new Date()));
} }
if (Validator.isNull(dataDa) && Validator.isNotNull(dataA)) {
if ((dataDa == null || dataDa.equals("")) && dataA != null && !dataA.equals("")) {
Date dateA = sdf.parse(dataA); Date dateA = sdf.parse(dataA);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo"); Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(calendarDa.getTime(), dateA)); query.add(createDateProperty.between(calendarDa.getTime(), dateA));
} }
if (Validator.isNotNull(numeroProtocollo) || Validator.isNotNull(dataDa) || Validator.isNotNull(dataA)) {
if ((numeroProtocollo != null && !numeroProtocollo.equals("")) || (dataDa != null && !dataDa.equals(""))
|| (dataA != null && !dataA.equals(""))) {
Order defaultOrder = OrderFactoryUtil.asc("dtProtocollo"); Order defaultOrder = OrderFactoryUtil.asc("dtProtocollo");
query.addOrder(defaultOrder); query.addOrder(defaultOrder);
lista = AvvisoLocalServiceUtil.dynamicQuery(query, start, end); lista = AvvisoLocalServiceUtil.dynamicQuery(query, start, end);
} }
return lista; return lista;
} }
@Override @Override
public int countProtocolliSearch(String dataDa, String dataA, String numeroProtocollo) throws SystemException, public int countProtocolliSearch(String dataDa, String dataA, String numeroProtocollo) throws SystemException,
ParseException { ParseException {
int count = 0; int count = 0;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery query = DynamicQueryFactoryUtil.forClass(Avviso.class); DynamicQuery query = DynamicQueryFactoryUtil.forClass(Avviso.class);
if (Validator.isNotNull(numeroProtocollo)) {
if (numeroProtocollo != null && !numeroProtocollo.equals("")) {
query.add(RestrictionsFactoryUtil.eq("protocollo", numeroProtocollo)); query.add(RestrictionsFactoryUtil.eq("protocollo", numeroProtocollo));
} }
Calendar calendarDa = Calendar.getInstance(); Calendar calendarDa = Calendar.getInstance();
calendarDa.set(Calendar.DAY_OF_MONTH, 1); calendarDa.set(Calendar.DAY_OF_MONTH, 1);
calendarDa.set(Calendar.MONTH, 1); calendarDa.set(Calendar.MONTH, 1);
calendarDa.set(Calendar.YEAR, 2014); calendarDa.set(Calendar.YEAR, 2014);
if (Validator.isNotNull(dataDa) && Validator.isNotNull(dataA)) {
if (dataDa != null && !dataDa.equals("") && dataA != null && !dataA.equals("")) {
Date dateDa = sdf.parse(dataDa); Date dateDa = sdf.parse(dataDa);
Date dateA = sdf.parse(dataA); Date dateA = sdf.parse(dataA);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo"); Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(dateDa, dateA)); query.add(createDateProperty.between(dateDa, dateA));
} }
if (Validator.isNotNull(dataDa) && Validator.isNull(dataA)) {
if (dataDa != null && !dataDa.equals("") && (dataA == null || dataA.equals(""))) {
Date dateDa = sdf.parse(dataDa); Date dateDa = sdf.parse(dataDa);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo"); Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(dateDa, new Date())); query.add(createDateProperty.between(dateDa, new Date()));
} }
if (Validator.isNull(dataDa) && Validator.isNotNull(dataA)) {
if ((dataDa == null || dataDa.equals("")) && dataA != null && !dataA.equals("")) {
Date dateA = sdf.parse(dataA); Date dateA = sdf.parse(dataA);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo"); Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(calendarDa.getTime(), dateA)); query.add(createDateProperty.between(calendarDa.getTime(), dateA));
} }
if (Validator.isNotNull(numeroProtocollo) || Validator.isNotNull(dataDa) || Validator.isNotNull(dataA)) {
if ((numeroProtocollo != null && !numeroProtocollo.equals("")) || (dataDa != null && !dataDa.equals(""))
|| (dataA != null && !dataA.equals(""))) {
count = (int) avvisoPersistence.countWithDynamicQuery(query); count = (int) avvisoPersistence.countWithDynamicQuery(query);
} }
return count; return count;
} }
@Override @Override
public List<Avviso> getAvvisiPerAggiuntaProtocollo(int start, int end) throws SystemException { public List<Avviso> getAvvisiPerAggiuntaProtocollo(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAggiuntaProtocollo(); DynamicQuery dynamicQuery = dynamicQueryAggiuntaProtocollo();
dynamicQuery.addOrder(OrderFactoryUtil.asc("dtAvviso")); dynamicQuery.addOrder(OrderFactoryUtil.asc("dtAvviso"));
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
@ -1272,28 +1234,22 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
@Override @Override
public DynamicQuery dynamicQueryAggiuntaProtocollo() throws SystemException { public DynamicQuery dynamicQueryAggiuntaProtocollo() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("inviato").eq(AvvisoUtil.DOCUMENTO_NON_INVIATO)); dynamicQuery.add(PropertyFactoryUtil.forName("inviato").eq(AvvisoUtil.DOCUMENTO_NON_INVIATO));
dynamicQuery.add(PropertyFactoryUtil.forName("protocollo").ne("")); dynamicQuery.add(PropertyFactoryUtil.forName("protocollo").ne(StringPool.BLANK));
dynamicQuery.add(PropertyFactoryUtil.forName("fileEntryIdBase").ne(0L)); dynamicQuery.add(PropertyFactoryUtil.forName("fileEntryIdBase").ne(0L));
dynamicQuery.add(PropertyFactoryUtil.forName("oldAvvisoId").eq(0L)); dynamicQuery.add(PropertyFactoryUtil.forName("oldAvvisoId").eq(0L));
dynamicQuery.add(PropertyFactoryUtil.forName("fileEntryIdProtocollo").eq(0L)); dynamicQuery.add(PropertyFactoryUtil.forName("fileEntryIdProtocollo").eq(0L));
dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
return dynamicQuery; return dynamicQuery;
} }
@Override @Override
public List<Avviso> findByClassPk(long classPk) throws SystemException { public List<Avviso> findByClassPk(long classPk) throws SystemException {
return avvisoPersistence.findByClassPk(classPk); return avvisoPersistence.findByClassPk(classPk);
} }
// ///////////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////////
// NUOVI METODI ADT // NUOVI METODI ADT
/** /**
* ADT * ADT
@ -1310,11 +1266,9 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
*/ */
@Override @Override
public List<Avviso> getAvvisiInvioTecnicoNew(int start, int end) throws SystemException { public List<Avviso> getAvvisiInvioTecnicoNew(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnicoNew(null); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnicoNew(null);
dynamicQuery.addOrder(OrderFactoryUtil.asc("dtAvviso")); dynamicQuery.addOrder(OrderFactoryUtil.asc("dtAvviso"));
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
/** /**
@ -1326,7 +1280,6 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
* @throws SystemException * @throws SystemException
*/ */
private DynamicQuery dynamicQueryAvvisiInvioTecnicoNew(Long avvisoId) throws SystemException { private DynamicQuery dynamicQueryAvvisiInvioTecnicoNew(Long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("inviatoTecnico").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("inviatoTecnico").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in( dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
@ -1336,17 +1289,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
if (Validator.isNotNull(avvisoId)) { if (Validator.isNotNull(avvisoId)) {
dynamicQuery.add(PropertyFactoryUtil.forName("avvisoId").eq(avvisoId)); dynamicQuery.add(PropertyFactoryUtil.forName("avvisoId").eq(avvisoId));
} }
// evito di prendere i vecchi avvisi, in alternativa aggiornare il campo // evito di prendere i vecchi avvisi, in alternativa aggiornare il campo inviatotecnico sulla tabella degli
// inviatotecnico sulla tabella // avvisi
// degli avvisi
Calendar gc = GregorianCalendar.getInstance(); Calendar gc = GregorianCalendar.getInstance();
gc.set(Calendar.YEAR, 2018); gc.set(Calendar.YEAR, 2018);
gc.set(Calendar.MONTH, 10);// NOVEMBRE gc.set(Calendar.MONTH, 10);// NOVEMBRE
gc.set(Calendar.DAY_OF_MONTH, 24); gc.set(Calendar.DAY_OF_MONTH, 24);
dynamicQuery.add(PropertyFactoryUtil.forName("createDate").ge(gc.getTime())); dynamicQuery.add(PropertyFactoryUtil.forName("createDate").ge(gc.getTime()));
// /////////////////////////////////////////
return dynamicQuery; return dynamicQuery;
} }
/** /**
@ -1359,7 +1309,6 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
*/ */
@Override @Override
public Avviso getAvvisoVidimazione(long intPraticaId, long dettPraticaID) throws SystemException { public Avviso getAvvisoVidimazione(long intPraticaId, long dettPraticaID) throws SystemException {
DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery(); DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in( dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
new String[] { StatoPraticaConstants.VIDIMATA })); new String[] { StatoPraticaConstants.VIDIMATA }));
@ -1368,16 +1317,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("classPk", dettPraticaID)); dynamicQuery.add(RestrictionsFactoryUtil.eq("classPk", dettPraticaID));
dynamicQuery.addOrder(OrderFactoryUtil.asc("avvisoId")); dynamicQuery.addOrder(OrderFactoryUtil.asc("avvisoId"));
List<Avviso> ritorno = dynamicQuery(dynamicQuery, 0, 1); List<Avviso> ritorno = dynamicQuery(dynamicQuery, 0, 1);
if (ritorno.isEmpty()) { if (ritorno.isEmpty()) {
return null; return null;
} else { } else {
return ritorno.get(0); return ritorno.get(0);
} }
} }
/** /**
@ -1389,7 +1335,6 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
*/ */
@Override @Override
public Avviso getLastAvvisoIntegrazione(long intPraticaId) throws SystemException { public Avviso getLastAvvisoIntegrazione(long intPraticaId) throws SystemException {
DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery(); DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in( dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
new String[] { StatoPraticaConstants.INTEGRAZIONE })); new String[] { StatoPraticaConstants.INTEGRAZIONE }));
@ -1397,15 +1342,12 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId));
dynamicQuery.addOrder(OrderFactoryUtil.desc("avvisoId")); dynamicQuery.addOrder(OrderFactoryUtil.desc("avvisoId"));
List<Avviso> ritorno = dynamicQuery(dynamicQuery, 0, 1); List<Avviso> ritorno = dynamicQuery(dynamicQuery, 0, 1);
if (ritorno.isEmpty()) { if (ritorno.isEmpty()) {
return null; return null;
} else { } else {
return ritorno.get(0); return ritorno.get(0);
} }
} }
} }

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

@ -1,13 +1,13 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. * 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 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* GNU Lesser General Public License as published by the Free Software Foundation; either version * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
* 2.1 of the License, or (at your option) any later version. * any later version.
* *
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* Lesser General Public License for more details. * details.
*/ */
package it.tref.liferay.portos.bo.service.impl; package it.tref.liferay.portos.bo.service.impl;
@ -83,15 +83,12 @@ import com.liferay.portlet.asset.model.AssetLinkConstants;
* The implementation of the controllo pratica local service. * The implementation of the controllo pratica local service.
* *
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* added, rerun ServiceBuilder to copy their definitions into the * their definitions into the {@link it.tref.liferay.portos.bo.service.ControlloPraticaLocalService} interface.
* {@link it.tref.liferay.portos.bo.service.ControlloPraticaLocalService}
* interface.
* *
* <p> * <p>
* This is a local service. Methods of this service will not have security * This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* checks based on the propagated JAAS credentials because this service can only * credentials because this service can only be accessed from within the same VM.
* be accessed from within the same VM.
* </p> * </p>
* *
* @author Davide Barbagallo, 3F Consulting * @author Davide Barbagallo, 3F Consulting
@ -100,18 +97,17 @@ import com.liferay.portlet.asset.model.AssetLinkConstants;
*/ */
public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServiceBaseImpl { public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* {@link * it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil} to access the controllo pratica local
* it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil} to * service.
* access the controllo pratica local service.
*/ */
private static final Log _log = LogFactoryUtil.getLog(ControlloPraticaLocalServiceImpl.class); private static final Log _log = LogFactoryUtil.getLog(ControlloPraticaLocalServiceImpl.class);
@Override @Override
public ControlloPratica addControlloPratica(long groupId, long userId, long intPraticaId, public ControlloPratica addControlloPratica(long groupId, long userId, long intPraticaId, long dettPraticaId,
long dettPraticaId, boolean updateFlagControlloObbligatorio, ServiceContext serviceContext) boolean updateFlagControlloObbligatorio, ServiceContext serviceContext) throws PortalException,
throws PortalException, SystemException { SystemException {
User user = userPersistence.findByPrimaryKey(userId); User user = userPersistence.findByPrimaryKey(userId);
// In creazione del sito viene avviato il workflow sul sito principale // In creazione del sito viene avviato il workflow sul sito principale
@ -147,8 +143,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
// aggiorno int e dett pratica per avvio workflow // aggiorno int e dett pratica per avvio workflow
IntPratica intPratica = intPraticaLocalService.updateStatoPratica(intPraticaId, dettPraticaId, IntPratica intPratica = intPraticaLocalService.updateStatoPratica(intPraticaId, dettPraticaId,
StatoPraticaConstants.SOTTOPOSTA_A_PARERE); StatoPraticaConstants.SOTTOPOSTA_A_PARERE);
if (updateFlagControlloObbligatorio if (updateFlagControlloObbligatorio && Constants.TIPO_PRATICA_DEPOSITO.equals(intPratica.getTipoPratica())) {
&& Constants.TIPO_PRATICA_DEPOSITO.equals(intPratica.getTipoPratica())) {
intPratica.setControlloObbligatorio(true); intPratica.setControlloObbligatorio(true);
intPratica = intPraticaLocalService.updateIntPratica(intPratica); intPratica = intPraticaLocalService.updateIntPratica(intPratica);
} }
@ -166,9 +161,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
// /////////// // ///////////
// Workflow // Workflow
WorkflowHandlerRegistryUtil.startWorkflowInstance(entry.getCompanyId(), entry.getGroupId(), WorkflowHandlerRegistryUtil.startWorkflowInstance(entry.getCompanyId(), entry.getGroupId(), entry.getUserId(),
entry.getUserId(), ControlloPratica.class.getName(), entry.getPrimaryKey(), entry, ControlloPratica.class.getName(), entry.getPrimaryKey(), entry, serviceContext, wfContextMap);
serviceContext, wfContextMap);
Date dtInvio = null; Date dtInvio = null;
if (intPratica.getDtSorteggio() != null) { if (intPratica.getDtSorteggio() != null) {
@ -177,15 +171,14 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
dtInvio = entry.getCreateDate(); dtInvio = entry.getCreateDate();
} }
TempisticaLocalServiceUtil.addTempistica(intPraticaId, dettPraticaId, TempisticaLocalServiceUtil.addTempistica(intPraticaId, dettPraticaId, TempisticaConstants.TIPO_PRATICA,
TempisticaConstants.TIPO_PRATICA, dtInvio, serviceContext); dtInvio, serviceContext);
return entry; return entry;
} }
@Override @Override
public ControlloPratica deleteControlloPratica(long controlloPraticaId) throws PortalException, public ControlloPratica deleteControlloPratica(long controlloPraticaId) throws PortalException, SystemException {
SystemException {
ControlloPratica entry = controlloPraticaPersistence.findByPrimaryKey(controlloPraticaId); ControlloPratica entry = controlloPraticaPersistence.findByPrimaryKey(controlloPraticaId);
@ -193,8 +186,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
@Override @Override
public ControlloPratica deleteControlloPratica(ControlloPratica entry) throws SystemException, public ControlloPratica deleteControlloPratica(ControlloPratica entry) throws SystemException, PortalException {
PortalException {
// Resources // Resources
resourceLocalService.deleteResource(entry.getCompanyId(), ControlloPratica.class.getName(), resourceLocalService.deleteResource(entry.getCompanyId(), ControlloPratica.class.getName(),
@ -206,8 +198,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
// Workflow // Workflow
workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(entry.getCompanyId(), workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(entry.getCompanyId(), entry.getGroupId(),
entry.getGroupId(), ControlloPratica.class.getName(), entry.getControlloPraticaId()); ControlloPratica.class.getName(), entry.getControlloPraticaId());
controlloPraticaPersistence.remove(entry); controlloPraticaPersistence.remove(entry);
@ -215,8 +207,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
@Override @Override
public List<ControlloPratica> findByIntPraticaId_Status(long intPraticaId, int status) public List<ControlloPratica> findByIntPraticaId_Status(long intPraticaId, int status) throws SystemException {
throws SystemException {
return controlloPraticaPersistence.findByIntPraticaId_Status(intPraticaId, status); return controlloPraticaPersistence.findByIntPraticaId_Status(intPraticaId, status);
} }
@ -228,9 +219,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
@Override @Override
public void updateAsset(long userId, ControlloPratica entry, long[] assetCategoryIds, public void updateAsset(long userId, ControlloPratica entry, long[] assetCategoryIds, String[] assetTagNames,
String[] assetTagNames, long[] assetLinkEntryIds, Date now) throws PortalException, long[] assetLinkEntryIds, Date now) throws PortalException, SystemException {
SystemException {
boolean visible = false; boolean visible = false;
@ -248,10 +238,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, entry.getGroupId(), now, now, AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, entry.getGroupId(), now, now,
ControlloPratica.class.getName(), entry.getControlloPraticaId(), entry.getUuid(), 0, ControlloPratica.class.getName(), entry.getControlloPraticaId(), entry.getUuid(), 0, assetCategoryIds,
assetCategoryIds, assetTagNames, visible, null, null, null, null, ContentTypes.TEXT_PLAIN, assetTagNames, visible, null, null, null, null, ContentTypes.TEXT_PLAIN,
String.valueOf(entry.getPrimaryKey()), String.valueOf(entry.getPrimaryKey()), null, null, 0, String.valueOf(entry.getPrimaryKey()), String.valueOf(entry.getPrimaryKey()), null, null, 0, 0, null,
0, null, false); false);
assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds, assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds,
AssetLinkConstants.TYPE_RELATED); AssetLinkConstants.TYPE_RELATED);
@ -264,9 +254,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
@Override @Override
public ControlloPratica updateStatus(long userId, long resourcePrimKey, int status, public ControlloPratica updateStatus(long userId, long resourcePrimKey, int status, ServiceContext serviceContext,
ServiceContext serviceContext, List<ControlloPratica> wfNewListVarianti) throws PortalException, List<ControlloPratica> wfNewListVarianti) throws PortalException, SystemException {
SystemException {
User user = userPersistence.findByPrimaryKey(userId); User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date(); Date now = new Date();
@ -287,8 +276,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
List<DettPratica> successivePratiche = dettPraticaLocalService List<DettPratica> successivePratiche = dettPraticaLocalService
.findCompletedByIntPraticaAndSuccessivoDettPratica(entry.getIntPraticaId(), .findCompletedByIntPraticaAndSuccessivoDettPratica(entry.getIntPraticaId(),
entry.getDettPraticaId()); entry.getDettPraticaId());
boolean autorizzazione = Constants.TIPO_PRATICA_AUTORIZZAZIONE.equalsIgnoreCase(intPratica boolean autorizzazione = Constants.TIPO_PRATICA_AUTORIZZAZIONE
.getTipoPratica()); .equalsIgnoreCase(intPratica.getTipoPratica());
boolean avvioWorkflow = false; boolean avvioWorkflow = false;
for (DettPratica dettPraticaSuc : successivePratiche) { for (DettPratica dettPraticaSuc : successivePratiche) {
if (TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPraticaSuc.getTipoIntegrazione()) if (TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPraticaSuc.getTipoIntegrazione())
@ -324,13 +313,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
@Override @Override
public boolean generazioneDocumento(long controlloPraticaId, String jsonParams, String tipoAvviso, public boolean generazioneDocumento(long controlloPraticaId, String jsonParams, String tipoAvviso,
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, SystemException {
SystemException {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId); DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica.getDettPraticaId());
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica
.getDettPraticaId());
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(controlloPratica.getCompanyId()); serviceContext.setCompanyId(controlloPratica.getCompanyId());
@ -354,8 +340,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
@Override @Override
@Deprecated @Deprecated
public boolean updateStatoPraticaGeneraDocumentoFinale(long controlloPraticaId, String jsonParams, public boolean updateStatoPraticaGeneraDocumentoFinale(long controlloPraticaId, String jsonParams,
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, SystemException {
SystemException {
return generaDocumentoFinale(controlloPraticaId, jsonParams, userIdFirma, workflowContext); return generaDocumentoFinale(controlloPraticaId, jsonParams, userIdFirma, workflowContext);
} }
@ -364,10 +349,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public boolean generaDocumentoFinale(long controlloPraticaId, String jsonParams, long userIdFirma, public boolean generaDocumentoFinale(long controlloPraticaId, String jsonParams, long userIdFirma,
Map<String, Serializable> workflowContext) throws PortalException, SystemException { Map<String, Serializable> workflowContext) throws PortalException, SystemException {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId); DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica.getDettPraticaId());
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica
.getDettPraticaId());
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(controlloPratica.getCompanyId()); serviceContext.setCompanyId(controlloPratica.getCompanyId());
@ -401,11 +384,9 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public void updateIstruttore(long controlloPraticaId, Map<String, Serializable> workflowContext) public void updateIstruttore(long controlloPraticaId, Map<String, Serializable> workflowContext)
throws PortalException, SystemException { throws PortalException, SystemException {
ControlloPratica controlloPratica = controlloPraticaLocalService ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, String> parametri = (Map<String, String>) workflowContext Map<String, String> parametri = (Map<String, String>) workflowContext.get("CONTEXT_TASK_FORM_PARAMETERS");
.get("CONTEXT_TASK_FORM_PARAMETERS");
IntPratica intPratica = intPraticaLocalService.getIntPratica(controlloPratica.getIntPraticaId()); IntPratica intPratica = intPraticaLocalService.getIntPratica(controlloPratica.getIntPraticaId());
long istruttore = GetterUtil.getLong(parametri.get("istruttore")); long istruttore = GetterUtil.getLong(parametri.get("istruttore"));
intPratica.setStatusByUserId(istruttore); intPratica.setStatusByUserId(istruttore);
@ -423,8 +404,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
/** /**
* I valori di ritorno possibili sono: * I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
* approvato,non_approvato,annullato,richiesta_integrazione
* *
* @throws SystemException * @throws SystemException
* @throws PortalException * @throws PortalException
@ -435,11 +415,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
String esito = getEsitoFinale(controlloPraticaId, workflowContext); String esito = getEsitoFinale(controlloPraticaId, workflowContext);
String ramoWorkflow = StringPool.BLANK; String ramoWorkflow = StringPool.BLANK;
ControlloPratica controlloPratica = controlloPraticaLocalService ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId);
Avviso avviso = avvisoLocalService.fetchLastAvvisoByIntPraticaPerStatoFinale(controlloPratica Avviso avviso = avvisoLocalService
.getIntPraticaId()); .fetchLastAvvisoByIntPraticaPerStatoFinale(controlloPratica.getIntPraticaId());
if (avviso != null && avviso.getRifiutato()) { if (avviso != null && avviso.getRifiutato()) {
ramoWorkflow = "rifiuto_firma"; ramoWorkflow = "rifiuto_firma";
} else { } else {
@ -483,10 +462,9 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
// Map<String, String> parametri = (Map<String, String>) // Map<String, String> parametri = (Map<String, String>)
// workflowContext.get("CONTEXT_TASK_FORM_PARAMETERS"); // workflowContext.get("CONTEXT_TASK_FORM_PARAMETERS");
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId);
Map<String, Serializable> parametri = WorkflowUtil.getFormParameters(controlloPratica); Map<String, Serializable> parametri = WorkflowUtil.getFormParameters(controlloPratica);
String esitoScelta = (String) parametri.get("esito"); String esitoScelta = (String) parametri.get(WorkflowConstants.WORKFLOW_TASKNAME_ESITO);
if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(esitoScelta) if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(esitoScelta)
&& AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) { && AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) {
@ -500,11 +478,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
@Override @Override
public void aggiornaStatoPerRichiestaIntegrazione(long controlloPraticaId, public void aggiornaStatoPerRichiestaIntegrazione(long controlloPraticaId, Map<String, Serializable> workflowContext)
Map<String, Serializable> workflowContext) throws PortalException, SystemException { throws PortalException, SystemException {
ControlloPratica controlloPratica = controlloPraticaLocalService ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId);
IntPratica intPratica = intPraticaLocalService.getIntPratica(controlloPratica.getIntPraticaId()); IntPratica intPratica = intPraticaLocalService.getIntPratica(controlloPratica.getIntPraticaId());
intPratica.setStatoPratica(StatoPraticaConstants.INTEGRAZIONE); intPratica.setStatoPratica(StatoPraticaConstants.INTEGRAZIONE);
intPraticaLocalService.updateIntPratica(intPratica); intPraticaLocalService.updateIntPratica(intPratica);
@ -514,8 +491,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public String getJsonListaIstruttori(long controlloPraticaId, Map<String, Serializable> workflowContext) public String getJsonListaIstruttori(long controlloPraticaId, Map<String, Serializable> workflowContext)
throws PortalException, SystemException { throws PortalException, SystemException {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId);
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
@ -540,69 +516,60 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public String getJsonEsitoPratica(long controlloPraticaId, Map<String, Serializable> workflowContext) public String getJsonEsitoPratica(long controlloPraticaId, Map<String, Serializable> workflowContext)
throws PortalException, SystemException { throws PortalException, SystemException {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId);
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
jsonObject.put("esito", jsonArray); jsonObject.put(WorkflowConstants.WORKFLOW_TASKNAME_ESITO, jsonArray);
if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) {
JSONObject etichette = JSONFactoryUtil.createJSONObject(); JSONObject etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "CONFORME"); etichette.put("label", "CONFORME");
etichette.put("value", "CO"); etichette.put("value", StatoPraticaConstants.CONFORME);
etichette.put("default", false); etichette.put("default", false);
jsonArray.put(etichette); jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject(); etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "NON CONFORME"); etichette.put("label", "NON CONFORME");
etichette.put("value", "NC"); etichette.put("value", StatoPraticaConstants.NON_CONFORME);
etichette.put("default", false); etichette.put("default", false);
jsonArray.put(etichette); jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject(); etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "RICHIESTA INTEGRAZIONE"); etichette.put("label", "RICHIESTA INTEGRAZIONE");
etichette.put("value", "IN"); etichette.put("value", StatoPraticaConstants.INTEGRAZIONE);
etichette.put("default", false); etichette.put("default", false);
jsonArray.put(etichette); jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject(); etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "ANNULLATA"); etichette.put("label", "ANNULLATA");
etichette.put("value", "AL"); etichette.put("value", StatoPraticaConstants.ANNULLATA);
etichette.put("default", false); etichette.put("default", false);
jsonArray.put(etichette); jsonArray.put(etichette);
} else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) { } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) {
JSONObject etichette = JSONFactoryUtil.createJSONObject(); JSONObject etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "AUTORIZZATA"); etichette.put("label", "AUTORIZZATA");
// etichette.put("value", "CO"); etichette.put("value", StatoPraticaConstants.AUTORIZZATA);
etichette.put("value", "AU");
etichette.put("default", false); etichette.put("default", false);
jsonArray.put(etichette); jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject(); etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "NON AUTORIZZATA"); etichette.put("label", "NON AUTORIZZATA");
// etichette.put("value", "NC"); etichette.put("value", StatoPraticaConstants.NON_AUTORIZZATA);
etichette.put("value", "AN");
etichette.put("default", false); etichette.put("default", false);
jsonArray.put(etichette); jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject(); etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "RICHIESTA INTEGRAZIONE"); etichette.put("label", "RICHIESTA INTEGRAZIONE");
etichette.put("value", "IN"); etichette.put("value", StatoPraticaConstants.INTEGRAZIONE);
etichette.put("default", false); etichette.put("default", false);
jsonArray.put(etichette); jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject(); etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "ANNULLATA"); etichette.put("label", "ANNULLATA");
etichette.put("value", "AL"); etichette.put("value", StatoPraticaConstants.ANNULLATA);
etichette.put("default", false); etichette.put("default", false);
jsonArray.put(etichette); jsonArray.put(etichette);
} }
return jsonObject.toString(); return jsonObject.toString();
} }
@Override @Override
public ControlloPratica addPraticheAlControllo(long controlloPraticaId, long dettPraticaId) public ControlloPratica addPraticheAlControllo(long controlloPraticaId, long dettPraticaId) throws PortalException,
throws PortalException, SystemException { SystemException {
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = controlloPraticaLocalService
.getControlloPratica(controlloPraticaId);
controlloPratica.setDettPraticaId(dettPraticaId); controlloPratica.setDettPraticaId(dettPraticaId);
controlloPratica.setModifiedDate(new Date()); controlloPratica.setModifiedDate(new Date());
@ -622,8 +589,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public ControlloPratica addPraticheAlControlloVarianti(long controlloPraticaId, long dettPraticaId, public ControlloPratica addPraticheAlControlloVarianti(long controlloPraticaId, long dettPraticaId,
ServiceContext serviceContext) throws PortalException, SystemException { ServiceContext serviceContext) throws PortalException, SystemException {
_log.info("start addPraticheAlControlloVarianti per controlloPraticaId=" + controlloPraticaId); _log.info("start addPraticheAlControlloVarianti per controlloPraticaId=" + controlloPraticaId);
ControlloPratica controlloPratica = controlloPraticaLocalService ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId);
controlloPratica.setDettPraticaId(dettPraticaId); controlloPratica.setDettPraticaId(dettPraticaId);
controlloPratica.setModifiedDate(new Date()); controlloPratica.setModifiedDate(new Date());
ControlloPratica result = controlloPraticaPersistence.update(controlloPratica); ControlloPratica result = controlloPraticaPersistence.update(controlloPratica);
@ -648,8 +614,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
FormLogLocalServiceUtil.addFormLog(lastTask.getWorkflowInstanceId(), 0l, "cambio-istruttore", FormLogLocalServiceUtil.addFormLog(lastTask.getWorkflowInstanceId(), 0l, "cambio-istruttore",
jsonFormParameters, serviceContext); jsonFormParameters, serviceContext);
} catch (Exception e) { } catch (Exception e) {
_log.error( _log.error("Errore in addPraticheAlControlloVarianti - inserimento log non riuscito -controlloPraticaId = "
"Errore in addPraticheAlControlloVarianti - inserimento log non riuscito -controlloPraticaId = "
+ controlloPraticaId, e); + controlloPraticaId, e);
} }
@ -657,21 +622,17 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
/* /*
* TODO Controllare bene il processo. Ci deve essere un modo per capire se * TODO Controllare bene il processo. Ci deve essere un modo per capire se sono pratiche da importare o nuove. A mio
* sono pratiche da importare o nuove. A mio parere (scuti) dovrebbe essere: * parere (scuti) dovrebbe essere: if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE
* if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE * .equalsIgnoreCase(dettPratica.getTipoIntegrazione())) { return "portos1_integrazioni"; } else { return
* .equalsIgnoreCase(dettPratica.getTipoIntegrazione())) { return * "portos1_esito"; }
* "portos1_integrazioni"; } else { return "portos1_esito"; }
*/ */
@Override @Override
public String getReturnValueScriptIniziale(long controlloPraticaId) throws PortalException, public String getReturnValueScriptIniziale(long controlloPraticaId) throws PortalException, SystemException {
SystemException {
ControlloPratica controlloPratica = controlloPraticaLocalService ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
.getControlloPratica(controlloPraticaId);
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica.getDettPraticaId());
.getDettPraticaId());
if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) { if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) {
// return "portos1_esito"; // return "portos1_esito";
@ -686,12 +647,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
String tipoEsito = ""; String tipoEsito = "";
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.fetchControlloPratica(controlloPraticaId);
.fetchControlloPratica(controlloPraticaId);
ClassLoader classLoaderKaleo = (ClassLoader) PortletBeanLocatorUtil.locate( ClassLoader classLoaderKaleo = (ClassLoader) PortletBeanLocatorUtil.locate(
com.liferay.portal.workflow.kaleo.service.ClpSerializer.getServletContextName(), com.liferay.portal.workflow.kaleo.service.ClpSerializer.getServletContextName(), "portletClassLoader");
"portletClassLoader");
DynamicQuery dqKaleo = DynamicQueryFactoryUtil.forClass(KaleoInstance.class, classLoaderKaleo); DynamicQuery dqKaleo = DynamicQueryFactoryUtil.forClass(KaleoInstance.class, classLoaderKaleo);
dqKaleo.add(RestrictionsFactoryUtil.eq("classPK", controlloPraticaId)); dqKaleo.add(RestrictionsFactoryUtil.eq("classPK", controlloPraticaId));
@ -706,10 +665,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
it.tref.liferay.portos.kaleo.service.ClpSerializer.getServletContextName(), it.tref.liferay.portos.kaleo.service.ClpSerializer.getServletContextName(),
"portletClassLoader"); "portletClassLoader");
DynamicQuery dqKaleoLog = DynamicQueryFactoryUtil DynamicQuery dqKaleoLog = DynamicQueryFactoryUtil.forClass(FormLog.class, classLoaderKaleoLog);
.forClass(FormLog.class, classLoaderKaleoLog); dqKaleoLog.add(RestrictionsFactoryUtil.eq("workflowInstanceId", kaleoInstance.getKaleoInstanceId()));
dqKaleoLog.add(RestrictionsFactoryUtil.eq("workflowInstanceId",
kaleoInstance.getKaleoInstanceId()));
dqKaleoLog.add(RestrictionsFactoryUtil.eq("transitionName", "registra-esito")); dqKaleoLog.add(RestrictionsFactoryUtil.eq("transitionName", "registra-esito"));
Order defaultOrder = OrderFactoryUtil.desc("createDate"); Order defaultOrder = OrderFactoryUtil.desc("createDate");
@ -719,33 +676,27 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
if (listaKaleoLog != null && !listaKaleoLog.isEmpty()) { if (listaKaleoLog != null && !listaKaleoLog.isEmpty()) {
FormLog formLog = listaKaleoLog.get(0); FormLog formLog = listaKaleoLog.get(0);
JSONObject json = JSONFactoryUtil.createJSONObject(formLog.getFormParameters()); JSONObject json = JSONFactoryUtil.createJSONObject(formLog.getFormParameters());
if (json.has(WorkflowConstants.WORKFLOW_TASKNAME_ESITO)) {
if (json.has("esito")) { String appString = json.getString(WorkflowConstants.WORKFLOW_TASKNAME_ESITO);
String appStirng = json.getString("esito"); switch (appString) {
switch (appStirng) { case StatoPraticaConstants.INTEGRAZIONE:
case "IN":
tipoEsito = "Richiesta Integrazione"; tipoEsito = "Richiesta Integrazione";
break; break;
case StatoPraticaConstants.CONFORME:
case "CO":
if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) {
tipoEsito = "Conforme"; tipoEsito = "Conforme";
} else if (AzioniPraticheUtil } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) {
.isAutorizzazione(controlloPratica.getIntPraticaId())) {
tipoEsito = "Autorizzata"; tipoEsito = "Autorizzata";
} }
break; break;
case StatoPraticaConstants.NON_CONFORME:
case "NC":
if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) { if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) {
tipoEsito = "Non conforme"; tipoEsito = "Non conforme";
} else if (AzioniPraticheUtil } else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) {
.isAutorizzazione(controlloPratica.getIntPraticaId())) {
tipoEsito = "Non autorizzata"; tipoEsito = "Non autorizzata";
} }
break; break;
case StatoPraticaConstants.ANNULLATA:
case "AL":
tipoEsito = "Annullata"; tipoEsito = "Annullata";
break; break;
@ -753,13 +704,9 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
break; break;
} }
} }
} }
} }
} }
return tipoEsito; return tipoEsito;
} }
@ -769,11 +716,9 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
@Override @Override
public Long calculateDateAvvioProcedimento(long controlloPraticaId) throws SystemException, public Long calculateDateAvvioProcedimento(long controlloPraticaId) throws SystemException, PortalException {
PortalException {
ControlloPratica controllo = ControlloPraticaLocalServiceUtil ControlloPratica controllo = ControlloPraticaLocalServiceUtil.fetchControlloPratica(controlloPraticaId);
.fetchControlloPratica(controlloPraticaId);
IntPratica pratica = IntPraticaLocalServiceUtil.fetchIntPratica(controllo.getIntPraticaId()); IntPratica pratica = IntPraticaLocalServiceUtil.fetchIntPratica(controllo.getIntPraticaId());
@ -785,9 +730,12 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
Date chiusura = null; Date chiusura = null;
long stop = 0L; long stop = 0L;
List<Avviso> avvisi = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(), List<Avviso> avvisi = AvvisoLocalServiceUtil.findByIntPratica(
QueryUtil.ALL_POS, QueryUtil.ALL_POS, OrderByComparatorFactoryUtil pratica.getIntPraticaId(),
.getOrderByComparatorFactory().create("portos_bo_Avviso", "createDate", true)); QueryUtil.ALL_POS,
QueryUtil.ALL_POS,
OrderByComparatorFactoryUtil.getOrderByComparatorFactory().create("portos_bo_Avviso", "createDate",
true));
Date start = null; Date start = null;
Date end = null; Date end = null;
@ -856,35 +804,28 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
} }
/* /*
* public long calculateDateAvvioProcedimentoOld(long controlloPraticaId) * public long calculateDateAvvioProcedimentoOld(long controlloPraticaId) throws SystemException, PortalException {
* throws SystemException, PortalException {
* *
* long giorni = 0; * long giorni = 0;
* *
* ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil * ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil .fetchControlloPratica(controlloPraticaId);
* .fetchControlloPratica(controlloPraticaId);
* *
* Long intPraticaId = controlloPratica.getIntPraticaId(); * Long intPraticaId = controlloPratica.getIntPraticaId();
* *
* List<Tempistica> tempisticaList = * List<Tempistica> tempisticaList = TempisticaLocalServiceUtil.findByIntPratica_Tipo(intPraticaId,
* TempisticaLocalServiceUtil.findByIntPratica_Tipo(intPraticaId,
* TempisticaConstants.TIPO_PRATICA); * TempisticaConstants.TIPO_PRATICA);
* *
* if (tempisticaList != null && tempisticaList.size() > 0) { Tempistica * if (tempisticaList != null && tempisticaList.size() > 0) { Tempistica temp = null;
* temp = null;
* *
* for (Iterator iterator = tempisticaList.iterator(); iterator.hasNext();) * for (Iterator iterator = tempisticaList.iterator(); iterator.hasNext();) { Tempistica tempistica = (Tempistica)
* { Tempistica tempistica = (Tempistica) iterator.next(); if (temp == null * iterator.next(); if (temp == null || temp.getCreateDate().before(tempistica.getCreateDate())) temp = tempistica;
* || temp.getCreateDate().before(tempistica.getCreateDate())) temp = * }
* tempistica; }
* *
* long giorniMillisecFormat = 0; if (temp.getStop() > 0) * long giorniMillisecFormat = 0; if (temp.getStop() > 0) giorniMillisecFormat = temp.getStop() - (temp.getStart() +
* giorniMillisecFormat = temp.getStop() - (temp.getStart() + * temp.getWait()); else if (temp.getStop() == 0) giorniMillisecFormat = System.currentTimeMillis() -
* temp.getWait()); else if (temp.getStop() == 0) giorniMillisecFormat = * (temp.getStart() + temp.getWait());
* System.currentTimeMillis() - (temp.getStart() + temp.getWait());
* *
* giorni = TimeUnit.DAYS.convert(giorniMillisecFormat, * giorni = TimeUnit.DAYS.convert(giorniMillisecFormat, TimeUnit.MILLISECONDS); }
* TimeUnit.MILLISECONDS); }
* *
* return giorni; } * return giorni; }
*/ */
@ -899,78 +840,50 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public void gestioneWFVarianti(ControlloPratica cp) { public void gestioneWFVarianti(ControlloPratica cp) {
try { try {
/* /*
* DettPratica * DettPratica dettPratica=DettPraticaLocalServiceUtil.getDettPratica (cp.getDettPraticaId());
* dettPratica=DettPraticaLocalServiceUtil.getDettPratica * if(dettPratica.getTipoIntegrazione().equals (TipoIntegrazioneUtil.VARIANTE)){ _log.info(
* (cp.getDettPraticaId());
* if(dettPratica.getTipoIntegrazione().equals
* (TipoIntegrazioneUtil.VARIANTE)){ _log.info(
* "gestioneWFVarianti - avviato workflow per variante dettPraticaId=" * "gestioneWFVarianti - avviato workflow per variante dettPraticaId="
* +cp.getDettPraticaId()+" -ControlloPraticaId="+cp. * +cp.getDettPraticaId()+" -ControlloPraticaId="+cp. getControlloPraticaId()); IntPratica intPratica=
* getControlloPraticaId()); IntPratica intPratica= * IntPraticaLocalServiceUtil.fetchIntPratica(cp.getIntPraticaId()); long
* IntPraticaLocalServiceUtil.fetchIntPratica(cp.getIntPraticaId()); * statusByuserId=intPratica.getStatusByUserId(); _log.info("gestioneWFVarianti -statusByuserId="
* long statusByuserId=intPratica.getStatusByUserId(); * +statusByuserId+" per int pratica=" +intPratica.getIntPraticaId()); //WorkflowInstanceLink
* _log.info("gestioneWFVarianti -statusByuserId=" * workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink( //
* +statusByuserId+" per int pratica=" * cp.getCompanyId(),cp.getGroupId(), ControlloPratica.class.getName(),cp.getPrimaryKey()); //_log.info(
* +intPratica.getIntPraticaId()); //WorkflowInstanceLink * "gestioneWFVarianti - workflowInstanceLink=="+workflowInstanceLink .getWorkflowInstanceId()); if
* workflowInstanceLink = * (statusByuserId==0){ _log.info("gestioneWFVarianti - KO - statusByuserId=" +statusByuserId); return;
* WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink( * }else{ _log.info("gestioneWFVarianti - statusByuserId determinato =" +statusByuserId); } long
* // cp.getCompanyId(),cp.getGroupId(), * workflowInstanceId = WorkflowUtil.getWorkflowInstanceId(cp);
* ControlloPratica.class.getName(),cp.getPrimaryKey());
* //_log.info(
* "gestioneWFVarianti - workflowInstanceLink=="+workflowInstanceLink
* .getWorkflowInstanceId()); if (statusByuserId==0){
* _log.info("gestioneWFVarianti - KO - statusByuserId="
* +statusByuserId); return; }else{
* _log.info("gestioneWFVarianti - statusByuserId determinato ="
* +statusByuserId); } long workflowInstanceId =
* WorkflowUtil.getWorkflowInstanceId(cp);
* *
* //creazione record KaleoTaskInstanceToken di tipo ESITO * //creazione record KaleoTaskInstanceToken di tipo ESITO ServiceContext serviceContext = new
* ServiceContext serviceContext = new ServiceContext(); * ServiceContext(); serviceContext.setCompanyId(cp.getCompanyId()); KaleoInstance kaleoInstance =
* serviceContext.setCompanyId(cp.getCompanyId()); KaleoInstance * KaleoInstanceLocalServiceUtil.getKaleoInstance(workflowInstanceId ); KaleoInstanceToken
* kaleoInstance = * rootKaleoInstanceToken = kaleoInstance.getRootKaleoInstanceToken(serviceContext);
* KaleoInstanceLocalServiceUtil.getKaleoInstance(workflowInstanceId
* ); KaleoInstanceToken rootKaleoInstanceToken =
* kaleoInstance.getRootKaleoInstanceToken(serviceContext);
* _log.info("gestioneWFVarianti - rootKaleoInstanceToken="+ * _log.info("gestioneWFVarianti - rootKaleoInstanceToken="+
* rootKaleoInstanceToken.getCurrentKaleoNodeName()); long * rootKaleoInstanceToken.getCurrentKaleoNodeName()); long
* kaleoTaskInstanceTokenID=CounterLocalServiceUtil.increment( * kaleoTaskInstanceTokenID=CounterLocalServiceUtil.increment( "com.liferay.counter.model.Counter");
* "com.liferay.counter.model.Counter"); * _log.info("kaleoTaskInstanceTokenID="+kaleoTaskInstanceTokenID); KaleoTaskInstanceToken x =
* _log.info("kaleoTaskInstanceTokenID="+kaleoTaskInstanceTokenID); * KaleoTaskInstanceTokenLocalServiceUtil. createKaleoTaskInstanceToken(kaleoTaskInstanceTokenID);
* KaleoTaskInstanceToken x = * x.setKaleoTaskId(21642); x.setKaleoTaskName("Esito"); x.setCompleted(false);
* KaleoTaskInstanceTokenLocalServiceUtil. * x.setGroupId(cp.getGroupId()); x.setClassName ("it.tref.liferay.portos.bo.model.ControlloPratica");
* createKaleoTaskInstanceToken(kaleoTaskInstanceTokenID); * x.setClassPK(kaleoInstance.getClassPK()); x.setCompanyId(kaleoInstance.getCompanyId());
* x.setKaleoTaskId(21642); x.setKaleoTaskName("Esito"); * x.setUserId(kaleoInstance.getUserId()); x.setUserName(kaleoInstance.getUserName()); x.setCreateDate(new
* x.setCompleted(false); x.setGroupId(cp.getGroupId()); * Date()); x.setKaleoInstanceId(kaleoInstance.getKaleoInstanceId());
* x.setClassName * x.setKaleoDefinitionId(kaleoInstance.getKaleoDefinitionId()); x.setKaleoInstanceTokenId
* ("it.tref.liferay.portos.bo.model.ControlloPratica");
* x.setClassPK(kaleoInstance.getClassPK());
* x.setCompanyId(kaleoInstance.getCompanyId());
* x.setUserId(kaleoInstance.getUserId());
* x.setUserName(kaleoInstance.getUserName()); x.setCreateDate(new
* Date());
* x.setKaleoInstanceId(kaleoInstance.getKaleoInstanceId());
* x.setKaleoDefinitionId(kaleoInstance.getKaleoDefinitionId());
* x.setKaleoInstanceTokenId
* (rootKaleoInstanceToken.getKaleoInstanceTokenId()); * (rootKaleoInstanceToken.getKaleoInstanceTokenId());
* x.setWorkflowContext(kaleoInstance.getWorkflowContext()); * x.setWorkflowContext(kaleoInstance.getWorkflowContext()); x=KaleoTaskInstanceTokenLocalServiceUtil
* x=KaleoTaskInstanceTokenLocalServiceUtil
* .updateKaleoTaskInstanceToken(x); _log.info( * .updateKaleoTaskInstanceToken(x); _log.info(
* "gestioneWFVarianti - KaleoTaskInstanceToken di tipo ESITO creato - KaleoTaskInstanceTokenId = " * "gestioneWFVarianti - KaleoTaskInstanceToken di tipo ESITO creato - KaleoTaskInstanceTokenId = "
* +x.getKaleoTaskInstanceTokenId()); _log.info( * +x.getKaleoTaskInstanceTokenId()); _log.info(
* "gestioneWFVarianti - correttamente eseguito - ControlloPraticaId = " * "gestioneWFVarianti - correttamente eseguito - ControlloPraticaId = " +cp.getControlloPraticaId());
* +cp.getControlloPraticaId()); * //////////////////////////////////// /////////////////////////////////
* ////////////////////////////////////
* /////////////////////////////////
* *
* *
* *
* } * }
*/ */
} catch (Exception e) { } catch (Exception e) {
_log.error( _log.error("gestioneWFVarianti - Errore in gestioneWFVarianti - dettaPratiacaId=" + cp.getDettPraticaId(),
"gestioneWFVarianti - Errore in gestioneWFVarianti - dettaPratiacaId=" e);
+ cp.getDettPraticaId(), e);
// throw e; // throw e;
} }
} }

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

@ -80,6 +80,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
private Log _log = LogFactoryUtil.getLog(DelegaLocalServiceImpl.class); private Log _log = LogFactoryUtil.getLog(DelegaLocalServiceImpl.class);
@Override
public Delega addDelega(long userId, long intPraticaId, long dettPraticaId, String tipologia, public Delega addDelega(long userId, long intPraticaId, long dettPraticaId, String tipologia,
String codiceFiscale, ServiceContext serviceContext) throws PortalException, SystemException { String codiceFiscale, ServiceContext serviceContext) throws PortalException, SystemException {
@ -109,6 +110,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delega; return delega;
} }
@Override
public Delega cambioStato(long delegaId, String esito) throws PortalException, SystemException { public Delega cambioStato(long delegaId, String esito) throws PortalException, SystemException {
Date now = new Date(); Date now = new Date();
@ -122,6 +124,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delega; return delega;
} }
@Override
public void concludiDeleghePagamento(long dettPraticaId) throws PortalException, SystemException { public void concludiDeleghePagamento(long dettPraticaId) throws PortalException, SystemException {
List<Delega> deleghe = this.findByDettPratica_Tipologia_InEsito(dettPraticaId, List<Delega> deleghe = this.findByDettPratica_Tipologia_InEsito(dettPraticaId,
new String[] { DelegheUtil.TIPO_PAGAMENTO }, new String[] { DelegheUtil.STATO_ASSEGNATA }); new String[] { DelegheUtil.TIPO_PAGAMENTO }, new String[] { DelegheUtil.STATO_ASSEGNATA });
@ -145,90 +148,106 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
private void validate(String tipologia, String codiceFiscale) throws PortalException, SystemException { private void validate(String tipologia, String codiceFiscale) throws PortalException, SystemException {
// TODO Write your own validation code // TODO Write your own validation code
} }
@Override
public List<Delega> findByIntPratica(long intPraticaId, int start, int end, public List<Delega> findByIntPratica(long intPraticaId, int start, int end,
OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica(intPraticaId, start, end, orderByComparator); return delegaPersistence.findByIntPratica(intPraticaId, start, end, orderByComparator);
} }
@Override
public List<Delega> findByDettPratica(long dettPraticaId, int start, int end, public List<Delega> findByDettPratica(long dettPraticaId, int start, int end,
OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica(dettPraticaId, start, end, orderByComparator); return delegaPersistence.findByDettPratica(dettPraticaId, start, end, orderByComparator);
} }
@Override
public int countByIntPratica(long intPraticaId) throws SystemException { public int countByIntPratica(long intPraticaId) throws SystemException {
return delegaPersistence.countByIntPratica(intPraticaId); return delegaPersistence.countByIntPratica(intPraticaId);
} }
@Override
public int countByDettPratica(long dettPraticaId) throws SystemException { public int countByDettPratica(long dettPraticaId) throws SystemException {
return delegaPersistence.countByIntPratica(dettPraticaId); return delegaPersistence.countByIntPratica(dettPraticaId);
} }
@Override
public List<Delega> findByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale, int start, public List<Delega> findByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale, int start,
int end, OrderByComparator orderByComparator) throws SystemException { int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale, start, end, return delegaPersistence.findByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale, start, end,
orderByComparator); orderByComparator);
} }
@Override
public List<Delega> findByCodiceFiscale(String codiceFiscale) throws SystemException { public List<Delega> findByCodiceFiscale(String codiceFiscale) throws SystemException {
return delegaPersistence.findByCodiceFiscale(codiceFiscale); return delegaPersistence.findByCodiceFiscale(codiceFiscale);
} }
@Override
public int countByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale) public int countByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale)
throws SystemException { throws SystemException {
return delegaPersistence.countByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale); return delegaPersistence.countByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale);
} }
@Override
public List<Delega> findByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti, int start, int end, public List<Delega> findByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByCodiceFiscale_InEsito(codiceFiscale, esiti, start, end, return delegaPersistence.findByCodiceFiscale_InEsito(codiceFiscale, esiti, start, end,
orderByComparator); orderByComparator);
} }
@Override
public int countByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti) throws SystemException { public int countByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti) throws SystemException {
return delegaPersistence.countByCodiceFiscale_InEsito(codiceFiscale, esiti); return delegaPersistence.countByCodiceFiscale_InEsito(codiceFiscale, esiti);
} }
@Override
public List<Delega> findByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale, public List<Delega> findByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException { String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti, return delegaPersistence.findByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti,
start, end, orderByComparator); start, end, orderByComparator);
} }
@Override
public int countByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale, String[] esiti) public int countByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale, String[] esiti)
throws SystemException { throws SystemException {
return delegaPersistence.countByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti); return delegaPersistence.countByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti);
} }
@Override
public List<Delega> findByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale, public List<Delega> findByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException { String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti, return delegaPersistence.findByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti,
start, end, orderByComparator); start, end, orderByComparator);
} }
@Override
public int countByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale, public int countByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale,
String[] esiti) throws SystemException { String[] esiti) throws SystemException {
return delegaPersistence return delegaPersistence
.countByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti); .countByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti);
} }
@Override
public List<Delega> findByIntPratica_InEsito(long intPraticaId, String[] esiti, int start, int end, public List<Delega> findByIntPratica_InEsito(long intPraticaId, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica_InEsito(intPraticaId, esiti, start, end, orderByComparator); return delegaPersistence.findByIntPratica_InEsito(intPraticaId, esiti, start, end, orderByComparator);
} }
@Override
public int countByIntPratica_InEsito(long intPraticaId, String[] esiti) throws SystemException { public int countByIntPratica_InEsito(long intPraticaId, String[] esiti) throws SystemException {
return delegaPersistence.countByIntPratica_InEsito(intPraticaId, esiti); return delegaPersistence.countByIntPratica_InEsito(intPraticaId, esiti);
} }
@Override
public List<Delega> findByDettPratica_InEsito(long dettPraticaId, String[] esiti, int start, int end, public List<Delega> findByDettPratica_InEsito(long dettPraticaId, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica_InEsito(dettPraticaId, esiti, start, end, return delegaPersistence.findByDettPratica_InEsito(dettPraticaId, esiti, start, end,
orderByComparator); orderByComparator);
} }
@Override
public List<String> findCfByDettPratica_InEsito(long dettPraticaId, String[] esiti) public List<String> findCfByDettPratica_InEsito(long dettPraticaId, String[] esiti)
throws SystemException { throws SystemException {
@ -239,6 +258,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delegaPersistence.findWithDynamicQuery(dynamicQuery); return delegaPersistence.findWithDynamicQuery(dynamicQuery);
} }
@Override
public List<Delega> findByDettPratica_InEsito(long dettPraticaId, String[] esiti) throws SystemException { public List<Delega> findByDettPratica_InEsito(long dettPraticaId, String[] esiti) throws SystemException {
DynamicQuery dynamicQuery = createQueryByDettPratica_InEsito(dettPraticaId, esiti); DynamicQuery dynamicQuery = createQueryByDettPratica_InEsito(dettPraticaId, esiti);
@ -246,6 +266,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delegaPersistence.findWithDynamicQuery(dynamicQuery); return delegaPersistence.findWithDynamicQuery(dynamicQuery);
} }
@Override
public List<String> findCfByDettPratica_Tipologia_InEsito(long dettPraticaId, String[] tipologie, public List<String> findCfByDettPratica_Tipologia_InEsito(long dettPraticaId, String[] tipologie,
String[] esiti) throws SystemException { String[] esiti) throws SystemException {
@ -257,6 +278,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delegaPersistence.findWithDynamicQuery(dynamicQuery); return delegaPersistence.findWithDynamicQuery(dynamicQuery);
} }
@Override
public List<Delega> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String[] tipologie, public List<Delega> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String[] tipologie,
String[] esiti) throws SystemException { String[] esiti) throws SystemException {
@ -274,21 +296,25 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public int countByDettPratica_InEsito(long dettPraticaId, String[] esiti) throws SystemException { public int countByDettPratica_InEsito(long dettPraticaId, String[] esiti) throws SystemException {
return delegaPersistence.countByDettPratica_InEsito(dettPraticaId, esiti); return delegaPersistence.countByDettPratica_InEsito(dettPraticaId, esiti);
} }
@Override
public List<Delega> findByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia, public List<Delega> findByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException { String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti, return delegaPersistence.findByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti,
start, end, orderByComparator); start, end, orderByComparator);
} }
@Override
public int countByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia, String[] esiti) public int countByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia, String[] esiti)
throws SystemException { throws SystemException {
return delegaPersistence.countByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti); return delegaPersistence.countByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti);
} }
@Override
public List<Delega> findByIntPratica_CodiceFiscale_Tipologia_InEsito(long intPraticaId, public List<Delega> findByIntPratica_CodiceFiscale_Tipologia_InEsito(long intPraticaId,
String codiceFiscale, String tipologia, String[] esiti, int start, int end, String codiceFiscale, String tipologia, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
@ -296,12 +322,14 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
codiceFiscale, tipologia, esiti, start, end, orderByComparator); codiceFiscale, tipologia, esiti, start, end, orderByComparator);
} }
@Override
public int countByIntPratica_CodiceFiscale_Tipologia_InEsito(long intPraticaId, String codiceFiscale, public int countByIntPratica_CodiceFiscale_Tipologia_InEsito(long intPraticaId, String codiceFiscale,
String tipologia, String[] esiti) throws SystemException { String tipologia, String[] esiti) throws SystemException {
return delegaPersistence.countByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId, return delegaPersistence.countByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId,
codiceFiscale, tipologia, esiti); codiceFiscale, tipologia, esiti);
} }
@Override
public List<Delega> findByDettPratica_CodiceFiscale_Tipologia_InEsito(long dettPraticaId, public List<Delega> findByDettPratica_CodiceFiscale_Tipologia_InEsito(long dettPraticaId,
String codiceFiscale, String[] tipologie, String[] esiti, int start, int end, String codiceFiscale, String[] tipologie, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
@ -309,35 +337,41 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
codiceFiscale, tipologie, esiti, start, end, orderByComparator); codiceFiscale, tipologie, esiti, start, end, orderByComparator);
} }
@Override
public int countByDettPratica_CodiceFiscale_Tipologia_InEsito(long dettPraticaId, String codiceFiscale, public int countByDettPratica_CodiceFiscale_Tipologia_InEsito(long dettPraticaId, String codiceFiscale,
String[] tipologie, String[] esiti) throws SystemException { String[] tipologie, String[] esiti) throws SystemException {
return delegaPersistence.countByDettPratica_CodiceFiscale_Tipologia_InEsito(dettPraticaId, return delegaPersistence.countByDettPratica_CodiceFiscale_Tipologia_InEsito(dettPraticaId,
codiceFiscale, tipologie, esiti); codiceFiscale, tipologie, esiti);
} }
@Override
public List<Delega> findByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia, public List<Delega> findByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException { String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti, start, return delegaPersistence.findByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti, start,
end, orderByComparator); end, orderByComparator);
} }
@Override
public List<Delega> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String tipologia, public List<Delega> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException { String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica_Tipologia_InEsito(dettPraticaId, tipologia, esiti, start, return delegaPersistence.findByDettPratica_Tipologia_InEsito(dettPraticaId, tipologia, esiti, start,
end, orderByComparator); end, orderByComparator);
} }
@Override
public int countByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia, String[] esiti) public int countByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia, String[] esiti)
throws SystemException { throws SystemException {
return delegaPersistence.countByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti); return delegaPersistence.countByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti);
} }
@Override
public List<Delega> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String[] tipologie, public List<Delega> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String[] tipologie,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException { String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica_Tipologie_InEsiti(dettPraticaId, tipologie, esiti, start, return delegaPersistence.findByDettPratica_Tipologie_InEsiti(dettPraticaId, tipologie, esiti, start,
end, orderByComparator); end, orderByComparator);
} }
@Override
public int countByDettPratica_Tipologia_InEsito(long intPraticaId, String[] tipologie, String[] esiti) public int countByDettPratica_Tipologia_InEsito(long intPraticaId, String[] tipologie, String[] esiti)
throws SystemException { throws SystemException {
return delegaPersistence.countByDettPratica_Tipologie_InEsiti(intPraticaId, tipologie, esiti); return delegaPersistence.countByDettPratica_Tipologie_InEsiti(intPraticaId, tipologie, esiti);
@ -347,6 +381,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
* *
* ADT: nuovo metodo generazione documento conclusione delega * ADT: nuovo metodo generazione documento conclusione delega
*/ */
@Override
public void generaDocumentoConcludiDelegaGeologo(long dettPraticaId, Delega delega, public void generaDocumentoConcludiDelegaGeologo(long dettPraticaId, Delega delega,
ServiceContext serviceContext) throws PortalException, SystemException { ServiceContext serviceContext) throws PortalException, SystemException {
@ -373,9 +408,9 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
reportDto.setFileEntryIds(new long[] { fileEntryIdTemplate.getFileEntryId() }); reportDto.setFileEntryIds(new long[] { fileEntryIdTemplate.getFileEntryId() });
reportDto.setFolderId(folderAllegati.getFolderId()); reportDto.setFolderId(folderAllegati.getFolderId());
reportDto.setFileName(fileName); reportDto.setFileName(fileName);
reportDto.setHeader(""); reportDto.setHeader(StringPool.BLANK);
reportDto.setHeaderHeight(1); reportDto.setHeaderHeight(1);
reportDto.setFooter(""); reportDto.setFooter(StringPool.BLANK);
reportDto.setFooterHeight(40); reportDto.setFooterHeight(40);
reportDto.setParameters(parameters); reportDto.setParameters(parameters);
@ -386,7 +421,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
.replace(getClass().getSimpleName(), "resource/asseverazioni"); .replace(getClass().getSimpleName(), "resource/asseverazioni");
reportDto.setPortalURL(getClass().getResource(resourcePath).getPath()); reportDto.setPortalURL(getClass().getResource(resourcePath).getPath());
String relazioni = ""; String relazioni = StringPool.BLANK;
Map<String, Serializable> dichiarazioniMap = delega.getDichiarazioniMap(); Map<String, Serializable> dichiarazioniMap = delega.getDichiarazioniMap();
if (dichiarazioniMap.containsKey("coniugio") && ((Boolean) dichiarazioniMap.get("coniugio")) if (dichiarazioniMap.containsKey("coniugio") && ((Boolean) dichiarazioniMap.get("coniugio"))
&& dichiarazioniMap.containsKey("relazioni")) { && dichiarazioniMap.containsKey("relazioni")) {
@ -402,15 +437,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
null); null);
long fileEntryId = result.getFileEntryIds()[0]; long fileEntryId = result.getFileEntryIds()[0];
// DLFileEntry fileEntry = String sha256 = StringPool.BLANK;
// DLFileEntryLocalServiceUtil.getFileEntry(fileEntryId);
// byte[] fileBytes =
// FileUtil.getBytes(fileEntry.getContentStream());
// File file = new File(PropsUtil.get("user.home") +
// "/asseverazione.pdf");
// FileUtils.writeByteArrayToFile(file, fileBytes);
String sha256 = "";
try { try {
sha256 = DigestUtils.sha256Hex(dlAppLocalService.getFileEntry(fileEntryId) sha256 = DigestUtils.sha256Hex(dlAppLocalService.getFileEntry(fileEntryId)
.getContentStream()); .getContentStream());

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

File diff soppresso perché troppo grande Load Diff

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

@ -52,147 +52,6 @@ public abstract class PagamentiUtil {
public static void verificaPagamentoIRIS(Pagamento pagamento) throws IOException, SystemException, public static void verificaPagamentoIRIS(Pagamento pagamento) throws IOException, SystemException,
PortalException { PortalException {
// long companyId = pagamento.getCompanyId();
// long groupId = pagamento.getGroupId();
//
// InformazioniPagamentoType[] statoPagamentiType =
// IrisVerificaPagamenti
// .verificaPagamenti(companyId, groupId, pagamento.getCodice(),
// pagamento.getTipoPagamento());
// List<InformazioniPagamentoType> infoPagamentoTypes =
// IrisVerificaPagamenti
// .verificaPagamenti(companyId, groupId, pagamento.getCodice(),
// pagamento.getTipoPagamento());
// String statoPagamento = StringPool.BLANK;
// if (infoPagamentoTypes != null) {
// InformazioniPagamentoType infoPagamentoType =
// infoPagamentoTypes.get(0);
// if
// (infoPagamentoType.getStato().equals(VerificaStatoPagamentoDettagliato.POSIZIONE_NON_PRESENTE))
// {
// // "Posizione non presente" -> si riprova successivamente
// return;
// } else if
// (infoPagamentoType.getStato().equals(VerificaStatoPagamentoDettagliato.POSIZIONE_NON_PAGABILE))
// {
// // "Posizione non pagabile" -> esito negativo
// statoPagamento = PagamentoConstants.UTILIZZATA_NON_PAGABILE;
// } else if
// (infoPagamentoType.getStato().equals(VerificaStatoPagamentoDettagliato.POSIZIONE_NON_PAGATA))
// {
// // "Pagamento non eseguito" -> esito negativo
// statoPagamento = PagamentoConstants.UTILIZZATA_RIFIUTATA;
// } else if
// (infoPagamentoType.getStato().equals(VerificaStatoPagamentoDettagliato.POSIZIONE_CON_PAG_IN_CORSO))
// {
// // "Pagamento non eseguito" -> esito in corso
// statoPagamento = PagamentoConstants.UTILIZZATA_IN_CORSO;
// return;
// } else if
// (infoPagamentoType.getStato().equals(VerificaStatoPagamentoDettagliato.POSIZIONE_PAGATA)
// ||
// infoPagamentoType.getStato().equals(VerificaStatoPagamentoDettagliato.POSIZIONE_PAGATA_SBF))
// {
// // "Pagamento eseguito" -> esito positivo
// statoPagamento = PagamentoConstants.UTILIZZATA_PAGATA;
// }
// String statoPagamento = StringPool.BLANK;
// if (statoPagamentiType != null) {
// InformazioniPagamentoType statoPagamentoType = statoPagamentiType[0];
// String statoPendenza = statoPagamentoType.getStato().getValue();
//
// if
// (statoPendenza.equals(VerificaStatoPagamentoDettagliato._POSIZIONE_NON_PAGATA))
// {
// if (statoPagamentoType.getDescrizioneStato().equalsIgnoreCase(
// VerificaStatoPagamentoDettagliato._POSIZIONE_NON_PAGATA)) {
// // "Posizione non presente" -> si riprova successivamente
// return;
// } else if
// (statoPagamentoType.getDescrizioneStato().equalsIgnoreCase("PAG_NON_ESEGUITO"))
// {
// statoPagamento = PagamentoConstants.UTILIZZATA_RIFIUTATA;
// }
// } else if
// (statoPendenza.equals(VerificaStatoPagamentoDettagliato._POSIZIONE_NON_PAGABILE))
// {
// // "Posizione non pagabile" -> esito negativo
// statoPagamento = PagamentoConstants.UTILIZZATA_NON_PAGABILE;
// // } else if (statoPendenza.equals(StatoPagamentoType._value3)) {
// // "Pagamento non ancora eseguito" -> si riprova successivamente
// // if (!pagamento.getOtf()) {
// // return;
// // }
// // "Pagamento non eseguito" -> esito negativo
// // statoPagamento = PagamentoConstants.UTILIZZATA_RIFIUTATA;
// } else if
// (statoPendenza.equals(VerificaStatoPagamentoDettagliato._POSIZIONE_PAGATA)
// ||
// statoPendenza.equals(VerificaStatoPagamentoDettagliato._POSIZIONE_PAGATA_SBF))
// {
// // "Pagamento eseguito" -> esito positivo
// statoPagamento = PagamentoConstants.UTILIZZATA_PAGATA;
// } else if
// (statoPendenza.equals(VerificaStatoPagamentoDettagliato.POSIZIONE_CON_PAG_IN_CORSO))
// {
// // "Pagamento non eseguito" -> esito in corso
// statoPagamento = PagamentoConstants.UTILIZZATA_IN_CORSO;
// return;
// }
// StatoPagamentoType statoPagamentoType = statoPagamentiType[0];
// if
// (statoPagamentoType.enumValue().equals(VerificaStatoPagamento.POSIZIONE_NON_PRESENTE))
// {
// // "Posizione non presente" -> si riprova successivamente
// return;
// } else if
// (statoPagamentoType.enumValue().equals(VerificaStatoPagamento.POSIZIONE_NON_PAGABILE))
// {
// // "Posizione non pagabile" -> esito negativo
// statoPagamento = PagamentoConstants.UTILIZZATA_NON_PAGABILE;
// } else if
// (statoPagamentoType.enumValue().equals(VerificaStatoPagamento.PAGAMENTO_NON_ESEGUITO))
// {
// // "Pagamento non ancora eseguito" -> si riprova successivamente
// if (!pagamento.getOtf()) {
// return;
// }
// // "Pagamento non eseguito" -> esito negativo
// statoPagamento = PagamentoConstants.UTILIZZATA_RIFIUTATA;
// } else if
// (statoPagamentoType.enumValue().equals(VerificaStatoPagamento.POSIZIONE_NON_PAGABILE))
// {
// // "Pagamento eseguito" -> esito positivo
// statoPagamento = PagamentoConstants.UTILIZZATA_PAGATA;
// }
// if (DettPratica.class.getName().equals(pagamento.getClassName())) {
// DettPraticaLocalServiceUtil.updateEsitoPagamento(pagamento.getPagamentoId(),
// pagamento.getClassPk(),
// statoPagamento);
// } else if
// (FineLavori.class.getName().equals(pagamento.getClassName())) {
// FineLavoriLocalServiceUtil.updateEsitoPagamento(pagamento.getPagamentoId(),
// pagamento.getClassPk(),
// statoPagamento);
// } else if (Collaudo.class.getName().equals(pagamento.getClassName()))
// {
// CollaudoLocalServiceUtil.updateEsitoPagamento(pagamento.getPagamentoId(),
// pagamento.getClassPk(),
// statoPagamento);
// } else {
// throw new
// RuntimeException("unable to update pagamento esito for entity type "
// +
// pagamento.getClassName()
// + " with id " + pagamento.getClassPk());
// }
//
// }
String statoPagamento = callVerificaPagamenti(pagamento); String statoPagamento = callVerificaPagamenti(pagamento);
if (Validator.isNotNull(statoPagamento)) { if (Validator.isNotNull(statoPagamento)) {
if (DettPratica.class.getName().equals(pagamento.getClassName())) { if (DettPratica.class.getName().equals(pagamento.getClassName())) {
@ -322,7 +181,6 @@ public abstract class PagamentiUtil {
long pagamentoId = 0l; long pagamentoId = 0l;
long intPraticaId = 0l; long intPraticaId = 0l;
// long dettPraticaId = 0l;
if (DettPratica.class.getName().equals(className)) { if (DettPratica.class.getName().equals(className)) {
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(classPk); DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(classPk);
esenzioneBolli = dettPratica.isNormEsenteBollo(); esenzioneBolli = dettPratica.isNormEsenteBollo();
@ -334,7 +192,6 @@ public abstract class PagamentiUtil {
pagamentoId = dettPratica.getPagamentoIdBolli(); pagamentoId = dettPratica.getPagamentoIdBolli();
} }
intPraticaId = dettPratica.getIntPraticaId(); intPraticaId = dettPratica.getIntPraticaId();
// dettPraticaId = classPk;
} else if (FineLavori.class.getName().equals(className)) { } else if (FineLavori.class.getName().equals(className)) {
FineLavori fineLavori = FineLavoriLocalServiceUtil.getFineLavori(classPk); FineLavori fineLavori = FineLavoriLocalServiceUtil.getFineLavori(classPk);
esenzioneBolli = fineLavori.isNormEsenteBollo(); esenzioneBolli = fineLavori.isNormEsenteBollo();
@ -345,8 +202,6 @@ public abstract class PagamentiUtil {
} else if (PagamentoConstants.PAGAMENTO_BOLLI.equals(tipoPagamento)) { } else if (PagamentoConstants.PAGAMENTO_BOLLI.equals(tipoPagamento)) {
pagamentoId = fineLavori.getPagamentoId(); pagamentoId = fineLavori.getPagamentoId();
} }
// dettPraticaId =
// DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(fineLavori.getIntPraticaId()).getDettPraticaId();
intPraticaId = fineLavori.getIntPraticaId(); intPraticaId = fineLavori.getIntPraticaId();
} else if (Collaudo.class.getName().equals(className)) { } else if (Collaudo.class.getName().equals(className)) {
Collaudo collaudo = CollaudoLocalServiceUtil.getCollaudo(classPk); Collaudo collaudo = CollaudoLocalServiceUtil.getCollaudo(classPk);
@ -358,8 +213,6 @@ public abstract class PagamentiUtil {
} else if (PagamentoConstants.PAGAMENTO_BOLLI.equals(tipoPagamento)) { } else if (PagamentoConstants.PAGAMENTO_BOLLI.equals(tipoPagamento)) {
pagamentoId = collaudo.getPagamentoId(); pagamentoId = collaudo.getPagamentoId();
} }
// dettPraticaId =
// DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(collaudo.getIntPraticaId()).getDettPraticaId();
intPraticaId = collaudo.getIntPraticaId(); intPraticaId = collaudo.getIntPraticaId();
} else { } else {
throw new SystemException("error.fields.pratica.pagamento.classPk.invalid"); throw new SystemException("error.fields.pratica.pagamento.classPk.invalid");
@ -459,7 +312,7 @@ public abstract class PagamentiUtil {
serviceContext.getUserId(), codice, causale, codiceFiscaleCommittente, tipoPagamento, serviceContext.getUserId(), codice, causale, codiceFiscaleCommittente, tipoPagamento,
importi, iuvs, currentURL, currentURL, provincia); importi, iuvs, currentURL, currentURL, provincia);
String urlPagamento = ""; String urlPagamento = StringPool.BLANK;
if (idpOTFType == null) { if (idpOTFType == null) {
urlPagamento = currentURL; urlPagamento = currentURL;
@ -474,11 +327,9 @@ public abstract class PagamentiUtil {
PagamentoConstants.MEZZO_IRIS, codiceFiscaleCommittente, tipoPagamento, importo, PagamentoConstants.MEZZO_IRIS, codiceFiscaleCommittente, tipoPagamento, importo,
PagamentoConstants.UTILIZZATA_IN_CORSO, classPk, className, 0l, urlPagamento, iuvs, PagamentoConstants.UTILIZZATA_IN_CORSO, classPk, className, 0l, urlPagamento, iuvs,
serviceContext); serviceContext);
// actionResponse.sendRedirect(idpOTFType.getUrlGW().toString());
} else { } else {
return PagamentoLocalServiceUtil.getPagamento(pagamentoId); return PagamentoLocalServiceUtil.getPagamento(pagamentoId);
} }
// }
} else { } else {
boolean add = true; boolean add = true;
if (Validator.isNotNull(pagamentoId)) { if (Validator.isNotNull(pagamentoId)) {

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

@ -53,42 +53,28 @@ import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
public class ProtocollazioneUtil { public class ProtocollazioneUtil {
public static String protocollaPartenza(Avviso avviso, Long fileEntryId) throws Exception { public static String protocollaPartenza(Avviso avviso, Long fileEntryId) throws Exception {
String protocollo = null; String protocollo = null;
InputStream inputStream = null; InputStream inputStream = null;
try { try {
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(avviso.getIntPraticaId()); IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(avviso.getIntPraticaId());
long groupId = avviso.getGroupId(); long groupId = avviso.getGroupId();
File allegato = new File(); File allegato = new File();
if (Validator.isNotNull(fileEntryId)) { if (Validator.isNotNull(fileEntryId)) {
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId); FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId);
inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(),
fileEntry.getVersion()); fileEntry.getVersion());
String sha256 = DigestUtils.sha256Hex(inputStream); String sha256 = DigestUtils.sha256Hex(inputStream);
allegato.setFileId(String.valueOf(fileEntryId)); allegato.setFileId(String.valueOf(fileEntryId));
allegato.setFileSha256(sha256); allegato.setFileSha256(sha256);
} else { } else {
String doc = String.valueOf(avviso.getAvvisoId()); String doc = String.valueOf(avviso.getAvvisoId());
String sha256 = DigestUtils.sha256Hex(doc); String sha256 = DigestUtils.sha256Hex(doc);
allegato.setFileId("0"); allegato.setFileId("0");
allegato.setFileSha256(sha256); allegato.setFileSha256(sha256);
} }
// utilizzato anche come discriminate tra la 1a e la 2a chiamata 1a recupero numero protocollo -> 1 allegato
// utilizzato anche come discriminate tra la 1a e la 2a chiamata 1a // finto 2a aggiorno dati del documento prodotto -> 2 allegati, il 1o giusto e il 2o per recupero num
// recupero numero protocollo -> 1 allegato finto 2a aggiorno dati // protocollo
// del documento prodotto -> 2 allegati, il 1o giusto e il 2o per
// recupero num protocollo
Protocollo protocolloBean = new Protocollo(); Protocollo protocolloBean = new Protocollo();
protocolloBean.setOggetto(generaOggettoProtocollo(avviso.getClassName(), avviso.getAvvisoId())); protocolloBean.setOggetto(generaOggettoProtocollo(avviso.getClassName(), avviso.getAvvisoId()));
protocolloBean.setChiuso(false); protocolloBean.setChiuso(false);
@ -102,15 +88,13 @@ public class ProtocollazioneUtil {
} finally { } finally {
StreamUtil.cleanUp(inputStream); StreamUtil.cleanUp(inputStream);
} }
return protocollo; return protocollo;
} }
public static String protocollaArrivo(Object praticaInstance, String title) throws Exception { public static String protocollaArrivo(Object praticaInstance, String title) throws Exception {
long groupId = 0L;
long groupId = 0l; long praticaId = 0L;
long praticaId = 0l; long companyId = 0L;
long companyId = 0l;
String utenteScreenName = StringPool.BLANK; String utenteScreenName = StringPool.BLANK;
String className = StringPool.BLANK; String className = StringPool.BLANK;
if (praticaInstance instanceof DettPratica) { if (praticaInstance instanceof DettPratica) {
@ -122,20 +106,17 @@ public class ProtocollazioneUtil {
className = DettPratica.class.getName(); className = DettPratica.class.getName();
} else if (praticaInstance instanceof FineLavori) { } else if (praticaInstance instanceof FineLavori) {
groupId = ((FineLavori) praticaInstance).getGroupId(); groupId = ((FineLavori) praticaInstance).getGroupId();
utenteScreenName = UserLocalServiceUtil.getUser(((FineLavori) praticaInstance).getUserId()) utenteScreenName = UserLocalServiceUtil.getUser(((FineLavori) praticaInstance).getUserId()).getScreenName();
.getScreenName();
praticaId = ((FineLavori) praticaInstance).getFineLavoriId(); praticaId = ((FineLavori) praticaInstance).getFineLavoriId();
companyId = ((FineLavori) praticaInstance).getCompanyId(); companyId = ((FineLavori) praticaInstance).getCompanyId();
className = FineLavori.class.getName(); className = FineLavori.class.getName();
} else if (praticaInstance instanceof Collaudo) { } else if (praticaInstance instanceof Collaudo) {
groupId = ((Collaudo) praticaInstance).getGroupId(); groupId = ((Collaudo) praticaInstance).getGroupId();
utenteScreenName = UserLocalServiceUtil.getUser(((Collaudo) praticaInstance).getUserId()) utenteScreenName = UserLocalServiceUtil.getUser(((Collaudo) praticaInstance).getUserId()).getScreenName();
.getScreenName();
praticaId = ((Collaudo) praticaInstance).getCollaudoId(); praticaId = ((Collaudo) praticaInstance).getCollaudoId();
companyId = ((Collaudo) praticaInstance).getCompanyId(); companyId = ((Collaudo) praticaInstance).getCompanyId();
className = Collaudo.class.getName(); className = Collaudo.class.getName();
} }
List<File> allegati = new ArrayList<File>(); List<File> allegati = new ArrayList<File>();
List<DocPratica> docPraticas = DocPraticaLocalServiceUtil.findByClassPk(praticaId); List<DocPratica> docPraticas = DocPraticaLocalServiceUtil.findByClassPk(praticaId);
for (DocPratica docPratica : docPraticas) { for (DocPratica docPratica : docPraticas) {
@ -144,11 +125,9 @@ public class ProtocollazioneUtil {
if (Validator.isNull(sha256)) { if (Validator.isNull(sha256)) {
InputStream inputStream = null; InputStream inputStream = null;
try { try {
if (docPratica.getDlFileEntryId() == 0L) { if (docPratica.getDlFileEntryId() == 0L) {
FilesImporter.importaFile(docPratica.getDocPraticaId(), DocPratica.class.getName()); FilesImporter.importaFile(docPratica.getDocPraticaId(), DocPratica.class.getName());
} }
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(docPratica.getDlFileEntryId()); FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(docPratica.getDlFileEntryId());
inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(),
fileEntry.getVersion()); fileEntry.getVersion());
@ -159,12 +138,10 @@ public class ProtocollazioneUtil {
StreamUtil.cleanUp(inputStream); StreamUtil.cleanUp(inputStream);
} }
} }
allegato.setFileId(String.valueOf(docPratica.getDlFileEntryId())); allegato.setFileId(String.valueOf(docPratica.getDlFileEntryId()));
allegato.setFileSha256(sha256); allegato.setFileSha256(sha256);
allegati.add(allegato); allegati.add(allegato);
} }
Protocollo protocolloBean = new Protocollo(); Protocollo protocolloBean = new Protocollo();
protocolloBean.setOggetto(generaOggettoProtocollo(className, praticaId)); protocolloBean.setOggetto(generaOggettoProtocollo(className, praticaId));
protocolloBean.setChiuso(false); protocolloBean.setChiuso(false);
@ -172,15 +149,13 @@ public class ProtocollazioneUtil {
protocolloBean.setUtenteId(utenteScreenName); protocolloBean.setUtenteId(utenteScreenName);
protocolloBean.setUfficioId(String.valueOf(groupId)); protocolloBean.setUfficioId(String.valueOf(groupId));
protocolloBean.setPraticaId(String.valueOf(praticaId)); protocolloBean.setPraticaId(String.valueOf(praticaId));
protocolloBean.setFiles(allegati); protocolloBean.setFiles(allegati);
JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean); JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean);
return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero")); return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero"));
} }
public static String protocollaArrivoAccessoAtti(long groupId, long companyId, String userName, public static String protocollaArrivoAccessoAtti(long groupId, long companyId, String userName, long accessoAttiId,
long accessoAttiId, String className) throws Exception { String className) throws Exception {
List<File> allegati = new ArrayList<File>(); List<File> allegati = new ArrayList<File>();
File allegato = new File(); File allegato = new File();
String doc = String.valueOf(accessoAttiId); String doc = String.valueOf(accessoAttiId);
@ -188,7 +163,6 @@ public class ProtocollazioneUtil {
allegato.setFileId("0"); allegato.setFileId("0");
allegato.setFileSha256(sha256); allegato.setFileSha256(sha256);
allegati.add(allegato); allegati.add(allegato);
Protocollo protocolloBean = new Protocollo(); Protocollo protocolloBean = new Protocollo();
protocolloBean.setOggetto(generaOggettoProtocollo(className, accessoAttiId)); protocolloBean.setOggetto(generaOggettoProtocollo(className, accessoAttiId));
protocolloBean.setChiuso(false); protocolloBean.setChiuso(false);
@ -196,14 +170,12 @@ public class ProtocollazioneUtil {
protocolloBean.setUtenteId(userName); protocolloBean.setUtenteId(userName);
protocolloBean.setUfficioId(String.valueOf(groupId)); protocolloBean.setUfficioId(String.valueOf(groupId));
protocolloBean.setPraticaId(String.valueOf(accessoAttiId)); protocolloBean.setPraticaId(String.valueOf(accessoAttiId));
protocolloBean.setFiles(allegati); protocolloBean.setFiles(allegati);
JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean); JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean);
return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero")); return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero"));
} }
public static String generaOggettoProtocollo(String className, long classPk) { public static String generaOggettoProtocollo(String className, long classPk) {
try { try {
Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(classPk); Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(classPk);
if (Validator.isNotNull(avviso)) { if (Validator.isNotNull(avviso)) {
@ -212,113 +184,76 @@ public class ProtocollazioneUtil {
} catch (SystemException | PortalException e) { } catch (SystemException | PortalException e) {
e.printStackTrace(); e.printStackTrace();
} }
return "Oggetto: " + className + StringPool.SPACE + classPk;
return "Oggetto: " + className + " " + classPk;
} }
public static List<OggettoProtocollo> csvToOggettoProtocollo(java.io.File file) public static List<OggettoProtocollo> csvToOggettoProtocollo(java.io.File file) throws FileNotFoundException,
throws FileNotFoundException, IOException, ParseException { IOException, ParseException {
String[] FILE_PROTOCOLLO_HEADER = { "id", "mittente/destinatario id", "ufficio id", "oggetto", String[] FILE_PROTOCOLLO_HEADER = { "id", "mittente/destinatario id", "ufficio id", "oggetto",
"numero fascicolo", "data inserimento", "tipo" }; "numero fascicolo", "data inserimento", "tipo" };
CSVFormat format = CSVFormat.EXCEL.withTrailingDelimiter().withHeader(FILE_PROTOCOLLO_HEADER) CSVFormat format = CSVFormat.EXCEL.withTrailingDelimiter().withHeader(FILE_PROTOCOLLO_HEADER)
.withSkipHeaderRecord().withIgnoreEmptyLines().withIgnoreSurroundingSpaces(); .withSkipHeaderRecord().withIgnoreEmptyLines().withIgnoreSurroundingSpaces();
Iterable<CSVRecord> records = format.parse(new FileReader(file)); Iterable<CSVRecord> records = format.parse(new FileReader(file));
List<OggettoProtocollo> listaOggettoProtocollo = new ArrayList<>(); List<OggettoProtocollo> listaOggettoProtocollo = new ArrayList<>();
for (CSVRecord csvRecord : records) { for (CSVRecord csvRecord : records) {
listaOggettoProtocollo.add(new OggettoProtocollo(csvRecord.get("id"), csvRecord listaOggettoProtocollo.add(new OggettoProtocollo(csvRecord.get("id"), csvRecord
.get("mittente/destinatario id"), csvRecord.get("ufficio id"), csvRecord.get("oggetto"), .get("mittente/destinatario id"), csvRecord.get("ufficio id"), csvRecord.get("oggetto"), csvRecord
csvRecord.get("numero fascicolo"), csvRecord.get("data inserimento"), csvRecord .get("numero fascicolo"), csvRecord.get("data inserimento"), csvRecord.get("tipo")));
.get("tipo")));
} }
return listaOggettoProtocollo; return listaOggettoProtocollo;
} }
public static List<OggettoProtocollo> searchProtocolli(HttpServletRequest request, long companyId, public static List<OggettoProtocollo> searchProtocolli(HttpServletRequest request, long companyId, long userId) {
long userId) {
List<OggettoProtocollo> result = Collections.emptyList(); List<OggettoProtocollo> result = Collections.emptyList();
String ufficioIds = StringPool.BLANK;
String ufficioIds = "";
String anno = ParamUtil.getString(request, "annoRiferimento"); String anno = ParamUtil.getString(request, "annoRiferimento");
String numeroProtocollo = ParamUtil.getString(request, "numeroProtocollo"); String numeroProtocollo = ParamUtil.getString(request, "numeroProtocollo");
int ufficioId = ParamUtil.getInteger(request, "ufficio"); int ufficioId = ParamUtil.getInteger(request, "ufficio");
if ((anno.equals("0000") || anno.equals(StringPool.BLANK)) && (numeroProtocollo.equals(StringPool.BLANK))) {
if ((anno.equals("0000") || anno.equals(StringPool.BLANK))
&& (numeroProtocollo.equals(StringPool.BLANK))) {
return result; return result;
} }
try { try {
if (ufficioId == -1) { if (ufficioId == -1) {
List<Organization> organizationList = OrganizationLocalServiceUtil List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(userId);
.getUserOrganizations(userId);
if (organizationList != null && !organizationList.isEmpty()) { if (organizationList != null && !organizationList.isEmpty()) {
List<Integer> lista = new ArrayList<Integer>(); List<Integer> lista = new ArrayList<Integer>();
for (Organization org : organizationList) { for (Organization org : organizationList) {
lista.add(GetterUtil.getInteger(org.getGroupId())); lista.add(GetterUtil.getInteger(org.getGroupId()));
} }
ufficioIds = lista.toString().substring(1, lista.toString().length() - 1); ufficioIds = lista.toString().substring(1, lista.toString().length() - 1);
} }
} else { } else {
ufficioIds = "" + ufficioId; ufficioIds = String.valueOf(ufficioId);
} }
ufficioIds = ufficioIds.replaceAll(StringPool.SPACE, StringPool.BLANK);
ufficioIds = ufficioIds.replaceAll(" ", "");
// String urlCSVService = PortletProps.get("protocollo.cvs.url");
String urlCSVService = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, String urlCSVService = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId,
ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_EXPORT_URL); ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_EXPORT_URL);
String numeroFascicoloEntity = StringPool.BLANK; String numeroFascicoloEntity = StringPool.BLANK;
if (Validator.isNotNull(numeroProtocollo)) { if (Validator.isNotNull(numeroProtocollo)) {
anno = numeroProtocollo.substring(0, 4); anno = numeroProtocollo.substring(0, 4);
numeroFascicoloEntity = numeroProtocollo.substring(4, numeroProtocollo.length()) numeroFascicoloEntity = numeroProtocollo.substring(4, numeroProtocollo.length()).replaceFirst(
.replaceFirst("^0+(?!$)", StringPool.BLANK); "^0+(?!$)", StringPool.BLANK);
} }
String data = String.format("?anno=%s&ufficioIds=%s&numeroFascicolo=%s", anno, ufficioIds, String data = String.format("?anno=%s&ufficioIds=%s&numeroFascicolo=%s", anno, ufficioIds,
numeroFascicoloEntity); numeroFascicoloEntity);
URL url = new URL(urlCSVService + data); URL url = new URL(urlCSVService + data);
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true); conn.setDoOutput(true);
conn.setRequestMethod("POST"); conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Content-Type", "application/json");
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
} }
byte[] bytes = IOUtils.toByteArray(conn.getInputStream()); byte[] bytes = IOUtils.toByteArray(conn.getInputStream());
java.io.File tempFile = java.io.File.createTempFile("prefix", "suffix", null); java.io.File tempFile = java.io.File.createTempFile("prefix", "suffix", null);
FileOutputStream fos = new FileOutputStream(tempFile); FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(bytes); fos.write(bytes);
fos.flush(); fos.flush();
fos.close(); fos.close();
conn.disconnect(); conn.disconnect();
return ProtocollazioneUtil.csvToOggettoProtocollo(tempFile); return ProtocollazioneUtil.csvToOggettoProtocollo(tempFile);
} catch (Exception e) { } catch (Exception e) {
} }
return result; return result;
} }
} }

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.namespace=portos_bo
build.number=2555 build.number=2565
build.date=1615540150045 build.date=1615988331406
build.auto.upgrade=true build.auto.upgrade=true
## ##

58
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/miei_task.jsp

@ -1,15 +1,11 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.kernel.search.Document"%>
<%@page import="com.liferay.portal.kernel.search.IndexerRegistryUtil"%>
<%@page import="com.liferay.portal.kernel.search.Indexer"%> <%@page import="com.liferay.portal.kernel.search.Indexer"%>
<%@page import="com.liferay.portal.kernel.search.IndexerRegistryUtil"%>
<%@page import="com.liferay.portal.kernel.search.Hits"%> <%@page import="com.liferay.portal.kernel.search.Hits"%>
<%@page import="com.liferay.portal.kernel.search.Document"%>
<%@page import="java.util.ArrayList"%> <%@page import="java.util.ArrayList"%>
<%@include file="/html/gestioneattivita/init.jsp"%> <%@include file="/html/gestioneattivita/init.jsp"%>
<% <%
boolean doSearch = true;
PortletURL iteratorURL = liferayPortletResponse.createRenderURL(); PortletURL iteratorURL = liferayPortletResponse.createRenderURL();
//GESTIONE RICERCA CON PAGINATORE SEARCH CONTAINER //GESTIONE RICERCA CON PAGINATORE SEARCH CONTAINER
@ -19,7 +15,6 @@ String tipoPratica = ParamUtil.getString(request, "tipoPratica", StringPool.BLAN
String statoPratica = ParamUtil.getString(request, "statoPratica", StringPool.BLANK); String statoPratica = ParamUtil.getString(request, "statoPratica", StringPool.BLANK);
String committente = ParamUtil.getString(request, "committente", StringPool.BLANK); String committente = ParamUtil.getString(request, "committente", StringPool.BLANK);
String soggettiInterconnessi = ParamUtil.getString(request, "soggettiInterconnessi", StringPool.BLANK); String soggettiInterconnessi = ParamUtil.getString(request, "soggettiInterconnessi", StringPool.BLANK);
//ADT ADT BUG BO ID = 8
String istruttore = ParamUtil.getString(request, "istruttore", StringPool.BLANK); String istruttore = ParamUtil.getString(request, "istruttore", StringPool.BLANK);
String ufficio = ParamUtil.getString(request, "ufficio", StringPool.BLANK); String ufficio = ParamUtil.getString(request, "ufficio", StringPool.BLANK);
String ordinaPer = ParamUtil.getString(request, "ordinaPer", StringPool.BLANK); String ordinaPer = ParamUtil.getString(request, "ordinaPer", StringPool.BLANK);
@ -34,7 +29,6 @@ iteratorURL.setParameter("tipoPratica", tipoPratica);
iteratorURL.setParameter("statoPratica", statoPratica); iteratorURL.setParameter("statoPratica", statoPratica);
iteratorURL.setParameter("committente", committente); iteratorURL.setParameter("committente", committente);
iteratorURL.setParameter("soggettiInterconnessi", soggettiInterconnessi); iteratorURL.setParameter("soggettiInterconnessi", soggettiInterconnessi);
//ADT ADT BUG BO ID = 8
iteratorURL.setParameter("istruttore", istruttore); iteratorURL.setParameter("istruttore", istruttore);
iteratorURL.setParameter("dataRichiestaInizio", dataRichiestaInizio); iteratorURL.setParameter("dataRichiestaInizio", dataRichiestaInizio);
iteratorURL.setParameter("dataRichiestaFine", dataRichiestaFine); iteratorURL.setParameter("dataRichiestaFine", dataRichiestaFine);
@ -45,8 +39,6 @@ iteratorURL.setParameter("tipoProcedura", tipoProcedura);
iteratorURL.setParameter("ordinaPer", ordinaPer); iteratorURL.setParameter("ordinaPer", ordinaPer);
iteratorURL.setParameter("ordinaTipo", ordinaTipo); iteratorURL.setParameter("ordinaTipo", ordinaTipo);
iteratorURL.setParameter("tabs1", tabs1); iteratorURL.setParameter("tabs1", tabs1);
String orderByType = ParamUtil.getString(request, "orderByType", "asc"); String orderByType = ParamUtil.getString(request, "orderByType", "asc");
String orderByCol = ParamUtil.getString(request, "orderByCol", "nome"); String orderByCol = ParamUtil.getString(request, "orderByCol", "nome");
@ -54,8 +46,7 @@ String keywords = StringPool.BLANK;
request.setAttribute("tabs1", "Tab_MieiTask"); request.setAttribute("tabs1", "Tab_MieiTask");
%> %>
<%-- Funzione per esportare la ricerca --%>
<!-- Funzione per esportare la ricerca -->
<liferay-portlet:resourceURL id="exportRicercaMieAttivita" var="exportRicercaMieAttivitaURL"> <liferay-portlet:resourceURL id="exportRicercaMieAttivita" var="exportRicercaMieAttivitaURL">
<liferay-portlet:param name="dataRichiestaInizio" value="<%= dataRichiestaInizio %>" /> <liferay-portlet:param name="dataRichiestaInizio" value="<%= dataRichiestaInizio %>" />
<liferay-portlet:param name="dataRichiestaFine" value="<%= dataRichiestaFine %>" /> <liferay-portlet:param name="dataRichiestaFine" value="<%= dataRichiestaFine %>" />
@ -75,33 +66,26 @@ request.setAttribute("tabs1", "Tab_MieiTask");
<liferay-portlet:param name="searchForExport" value="true" /> <liferay-portlet:param name="searchForExport" value="true" />
<liferay-portlet:param name="cmd" value="exportRicercaMieAttivita" /> <liferay-portlet:param name="cmd" value="exportRicercaMieAttivita" />
</liferay-portlet:resourceURL> </liferay-portlet:resourceURL>
<div class="row-fluid" style="margin-top:10px;"> <div class="row-fluid" style="margin-top:10px;">
<div class="span10"></div> <div class="span10"></div>
<div class="span2"> <div class="span2">
<aui:button-row cssClass="margin-top-0"> <aui:button-row cssClass="margin-top-0">
<liferay-ui:icon linkCssClass="btn btn-action btn-primary pull-right" iconCssClass="fa fa-floppy-o" message="Esporta Ricerca" label="<%= true %>" url="<%= exportRicercaMieAttivitaURL %>" target="_blank" /> <liferay-ui:icon linkCssClass="btn btn-action btn-primary pull-right" iconCssClass="fa fa-floppy-o"
message="Esporta Ricerca" label="true" url="<%= exportRicercaMieAttivitaURL %>" target="_blank" />
</aui:button-row> </aui:button-row>
</div> </div>
</div> </div>
<liferay-ui:search-container emptyResultsMessage="no-entries-were-found" iteratorURL="<%= iteratorURL %>"
<liferay-ui:search-container orderByType="<%= orderByType %>" orderByCol="<%= orderByCol %>">
emptyResultsMessage="no-entries-were-found"
iteratorURL="<%= iteratorURL %>"
orderByType="<%= orderByType %>" orderByCol="<%= orderByCol %>"
>
<% <%
List<ControlloPratica> listaControlloPratica = new ArrayList<ControlloPratica>(); List<ControlloPratica> listaControlloPratica = new ArrayList<ControlloPratica>();
Hits hits = ControlloPraticaAdvancedSearch.searchMieiTask(request, user, searchContainer.getStart(),
Hits hits = ControlloPraticaAdvancedSearch.searchMieiTask(request, user, searchContainer.getStart(), searchContainer.getEnd()); searchContainer.getEnd());
for (Document doc : hits.toList()) { for (Document doc : hits.toList()) {
String controlloPraticaId = doc.get("controlloPraticaId"); String controlloPraticaId = doc.get("controlloPraticaId");
if (Validator.isNotNull(controlloPraticaId)) { if (Validator.isNotNull(controlloPraticaId)) {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.fetchControlloPratica(
ControlloPratica controlloPratica = GetterUtil.getLong(controlloPraticaId));
ControlloPraticaLocalServiceUtil.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId));
if (Validator.isNotNull(controlloPratica)) { if (Validator.isNotNull(controlloPratica)) {
listaControlloPratica.add(controlloPratica); listaControlloPratica.add(controlloPratica);
} else { } else {
@ -109,25 +93,13 @@ request.setAttribute("tabs1", "Tab_MieiTask");
indexer.delete(company.getCompanyId(), doc.getUID()); indexer.delete(company.getCompanyId(), doc.getUID());
} }
} }
} }
searchContainer.setTotal(hits.getLength()); searchContainer.setTotal(hits.getLength());
%> %>
<liferay-ui:search-container-results results="<%= listaControlloPratica %>" />
<liferay-ui:search-container-results <liferay-ui:search-container-row className="it.tref.liferay.portos.bo.model.ControlloPratica"
results="<%=listaControlloPratica%>" modelVar="controlloPratica">
/>
<liferay-ui:search-container-row
className="it.tref.liferay.portos.bo.model.ControlloPratica"
modelVar="controlloPratica"
>
<%@include file="/html/gestioneattivita/view_columns.jspf"%> <%@include file="/html/gestioneattivita/view_columns.jspf"%>
</liferay-ui:search-container-row> </liferay-ui:search-container-row>
<liferay-ui:search-iterator paginate="true" />
<liferay-ui:search-iterator paginate="<%= true %>" />
</liferay-ui:search-container> </liferay-ui:search-container>

62
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/task_miei_ruoli.jsp

@ -1,14 +1,11 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.kernel.search.IndexerRegistryUtil"%>
<%@page import="com.liferay.portal.kernel.search.Indexer"%>
<%@page import="com.liferay.portal.kernel.search.Document"%> <%@page import="com.liferay.portal.kernel.search.Document"%>
<%@page import="com.liferay.portal.kernel.search.Hits"%> <%@page import="com.liferay.portal.kernel.search.Hits"%>
<%@page import="com.liferay.portal.kernel.search.Indexer"%>
<%@page import="com.liferay.portal.kernel.search.IndexerRegistryUtil"%>
<%@page import="java.util.ArrayList"%> <%@page import="java.util.ArrayList"%>
<%@include file="/html/gestioneattivita/init.jsp"%> <%@include file="/html/gestioneattivita/init.jsp"%>
<% <%
boolean doSearch = true;
PortletURL iteratorURL = liferayPortletResponse.createRenderURL(); PortletURL iteratorURL = liferayPortletResponse.createRenderURL();
//GESTIONE RICERCA CON PAGINATORE SEARCH CONTAINER //GESTIONE RICERCA CON PAGINATORE SEARCH CONTAINER
@ -18,7 +15,6 @@ String tipoPratica = ParamUtil.getString(request, "tipoPratica", StringPool.BLAN
String statoPratica = ParamUtil.getString(request, "statoPratica", StringPool.BLANK); String statoPratica = ParamUtil.getString(request, "statoPratica", StringPool.BLANK);
String committente = ParamUtil.getString(request, "committente", StringPool.BLANK); String committente = ParamUtil.getString(request, "committente", StringPool.BLANK);
String soggettiInterconnessi = ParamUtil.getString(request, "soggettiInterconnessi", StringPool.BLANK); String soggettiInterconnessi = ParamUtil.getString(request, "soggettiInterconnessi", StringPool.BLANK);
//ADT ADT BUG BO ID = 8
String istruttore = ParamUtil.getString(request, "istruttore", StringPool.BLANK); String istruttore = ParamUtil.getString(request, "istruttore", StringPool.BLANK);
String ufficio = ParamUtil.getString(request, "ufficio", StringPool.BLANK); String ufficio = ParamUtil.getString(request, "ufficio", StringPool.BLANK);
String ordinaPer = ParamUtil.getString(request, "ordinaPer", StringPool.BLANK); String ordinaPer = ParamUtil.getString(request, "ordinaPer", StringPool.BLANK);
@ -33,7 +29,6 @@ iteratorURL.setParameter("tipoPratica", tipoPratica);
iteratorURL.setParameter("statoPratica", statoPratica); iteratorURL.setParameter("statoPratica", statoPratica);
iteratorURL.setParameter("committente", committente); iteratorURL.setParameter("committente", committente);
iteratorURL.setParameter("soggettiInterconnessi", soggettiInterconnessi); iteratorURL.setParameter("soggettiInterconnessi", soggettiInterconnessi);
//ADT ADT BUG BO ID = 8
iteratorURL.setParameter("istruttore", istruttore); iteratorURL.setParameter("istruttore", istruttore);
iteratorURL.setParameter("dataRichiestaInizio", dataRichiestaInizio); iteratorURL.setParameter("dataRichiestaInizio", dataRichiestaInizio);
iteratorURL.setParameter("dataRichiestaFine", dataRichiestaFine); iteratorURL.setParameter("dataRichiestaFine", dataRichiestaFine);
@ -44,19 +39,14 @@ iteratorURL.setParameter("tipoProcedura", tipoProcedura);
iteratorURL.setParameter("ordinaPer", ordinaPer); iteratorURL.setParameter("ordinaPer", ordinaPer);
iteratorURL.setParameter("ordinaTipo", ordinaTipo); iteratorURL.setParameter("ordinaTipo", ordinaTipo);
iteratorURL.setParameter("tabs1", tabs1); iteratorURL.setParameter("tabs1", tabs1);
String orderByType = ParamUtil.getString(request, "orderByType", "asc"); String orderByType = ParamUtil.getString(request, "orderByType", "asc");
String orderByCol = ParamUtil.getString(request, "orderByCol", "nome"); String orderByCol = ParamUtil.getString(request, "orderByCol", "nome");
String keywords = StringPool.BLANK; String keywords = StringPool.BLANK;
request.setAttribute("tabs1", "Tab_TaskMieiRuoli"); request.setAttribute("tabs1", "Tab_TaskMieiRuoli");
%> %>
<%-- Funzione per esportare la ricerca --%>
<!-- Funzione per esportare la ricerca -->
<liferay-portlet:resourceURL id="exportRicercaMieiRuoli" var="exportRicercaMieiRuoliURL"> <liferay-portlet:resourceURL id="exportRicercaMieiRuoli" var="exportRicercaMieiRuoliURL">
<liferay-portlet:param name="dataRichiestaInizio" value="<%= dataRichiestaInizio %>" /> <liferay-portlet:param name="dataRichiestaInizio" value="<%= dataRichiestaInizio %>" />
<liferay-portlet:param name="dataRichiestaFine" value="<%= dataRichiestaFine %>" /> <liferay-portlet:param name="dataRichiestaFine" value="<%= dataRichiestaFine %>" />
@ -66,7 +56,6 @@ request.setAttribute("tabs1", "Tab_TaskMieiRuoli");
<liferay-portlet:param name="statoPratica" value="<%= statoPratica %>" /> <liferay-portlet:param name="statoPratica" value="<%= statoPratica %>" />
<liferay-portlet:param name="committente" value="<%= committente %>" /> <liferay-portlet:param name="committente" value="<%= committente %>" />
<liferay-portlet:param name="soggettiInterconnessi" value="<%= soggettiInterconnessi %>" /> <liferay-portlet:param name="soggettiInterconnessi" value="<%= soggettiInterconnessi %>" />
<!-- ADT BUG BO ID = 8 -->
<liferay-portlet:param name="istruttore" value="<%= istruttore %>" /> <liferay-portlet:param name="istruttore" value="<%= istruttore %>" />
<liferay-portlet:param name="ufficio" value="<%= ufficio %>" /> <liferay-portlet:param name="ufficio" value="<%= ufficio %>" />
<liferay-portlet:param name="comune" value="<%= comuneSearch %>" /> <liferay-portlet:param name="comune" value="<%= comuneSearch %>" />
@ -77,32 +66,26 @@ request.setAttribute("tabs1", "Tab_TaskMieiRuoli");
<liferay-portlet:param name="searchForExport" value="true" /> <liferay-portlet:param name="searchForExport" value="true" />
<liferay-portlet:param name="cmd" value="exportRicercaMieiRuoli" /> <liferay-portlet:param name="cmd" value="exportRicercaMieiRuoli" />
</liferay-portlet:resourceURL> </liferay-portlet:resourceURL>
<div class="row-fluid" style="margin-top:10px">
<div class="row-fluid" style="margin-top:10px;">
<div class="span10"></div> <div class="span10"></div>
<div class="span2"> <div class="span2">
<aui:button-row cssClass="margin-top-0"> <aui:button-row cssClass="margin-top-0">
<liferay-ui:icon linkCssClass="btn btn-action btn-primary pull-right" iconCssClass="fa fa-floppy-o" message="Esporta Ricerca" label="<%= true %>" url="<%= exportRicercaMieiRuoliURL %>" target="_blank" /> <liferay-ui:icon linkCssClass="btn btn-action btn-primary pull-right" iconCssClass="fa fa-floppy-o"
message="Esporta Ricerca" label="true" url="<%= exportRicercaMieiRuoliURL %>" target="_blank" />
</aui:button-row> </aui:button-row>
</div> </div>
</div> </div>
<liferay-ui:search-container emptyResultsMessage="no-entries-were-found" iteratorURL="<%= iteratorURL %>"
<liferay-ui:search-container orderByType="<%= orderByType %>" orderByCol="<%= orderByCol %>">
emptyResultsMessage="no-entries-were-found"
iteratorURL="<%= iteratorURL %>"
orderByType="<%= orderByType %>" orderByCol="<%= orderByCol %>"
>
<% <%
List<ControlloPratica> listaControlloPratica = new ArrayList<ControlloPratica>(); List<ControlloPratica> listaControlloPratica = new ArrayList<ControlloPratica>();
Hits hits = ControlloPraticaAdvancedSearch.searchTaskMieiRuoli(request, user, searchContainer.getStart(), searchContainer.getEnd()); Hits hits = ControlloPraticaAdvancedSearch.searchTaskMieiRuoli(request, user, searchContainer.getStart(),
searchContainer.getEnd());
for (Document doc : hits.toList()) { for (Document doc : hits.toList()) {
String controlloPraticaId = doc.get("controlloPraticaId"); String controlloPraticaId = doc.get("controlloPraticaId");
if (Validator.isNotNull(controlloPraticaId)) { if (Validator.isNotNull(controlloPraticaId)) {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.fetchControlloPratica(
ControlloPratica controlloPratica = GetterUtil.getLong(controlloPraticaId));
ControlloPraticaLocalServiceUtil.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId));
if (Validator.isNotNull(controlloPratica)) { if (Validator.isNotNull(controlloPratica)) {
listaControlloPratica.add(controlloPratica); listaControlloPratica.add(controlloPratica);
} else { } else {
@ -110,26 +93,13 @@ request.setAttribute("tabs1", "Tab_TaskMieiRuoli");
indexer.delete(company.getCompanyId(), doc.getUID()); indexer.delete(company.getCompanyId(), doc.getUID());
} }
} }
} }
searchContainer.setTotal(hits.getLength()); searchContainer.setTotal(hits.getLength());
%> %>
<liferay-ui:search-container-results results="<%= listaControlloPratica %>" />
<liferay-ui:search-container-results <liferay-ui:search-container-row className="it.tref.liferay.portos.bo.model.ControlloPratica"
results="<%=listaControlloPratica%>" modelVar="controlloPratica">
/>
<liferay-ui:search-container-row
className="it.tref.liferay.portos.bo.model.ControlloPratica"
modelVar="controlloPratica"
>
<%@include file="/html/gestioneattivita/view_columns.jspf"%> <%@include file="/html/gestioneattivita/view_columns.jspf"%>
</liferay-ui:search-container-row> </liferay-ui:search-container-row>
<liferay-ui:search-iterator paginate="true" />
<liferay-ui:search-iterator paginate="<%= true %>" />
</liferay-ui:search-container> </liferay-ui:search-container>

129
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/view_columns.jspf

@ -1,87 +1,65 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.liferay.portos.bo.shared.util.TipoIntegrazioneUtil"%> <%@page import="com.liferay.portal.kernel.dao.orm.QueryUtil"%>
<%@page import="com.liferay.portal.kernel.util.LocaleUtil"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowConstants"%>
<%@page import="it.tref.liferay.portos.bo.model.DettPratica"%>
<%@page import="it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil"%>
<%@page import="com.liferay.portal.workflow.kaleo.service.KaleoInstanceLocalServiceUtil"%>
<%@page import="com.liferay.portal.workflow.kaleo.model.KaleoInstance"%>
<%@page import="java.text.DateFormat"%>
<%@page import="com.liferay.portal.kernel.language.LanguageUtil"%> <%@page import="com.liferay.portal.kernel.language.LanguageUtil"%>
<%@page import="com.liferay.portal.kernel.util.StringPool"%> <%@page import="com.liferay.portal.kernel.util.StringPool"%>
<%@page import="it.tref.liferay.portos.bo.util.WorkflowUtil"%> <%@page import="com.liferay.portal.kernel.util.Validator"%>
<%@page import="it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil"%> <%@page import="com.liferay.portal.kernel.workflow.WorkflowConstants"%>
<%@page import="it.tref.liferay.portos.bo.service.impl.DettPraticaLocalServiceImpl"%> <%@page import="com.liferay.portal.kernel.workflow.WorkflowInstance"%>
<%@page import="it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil"%> <%@page import="com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil"%>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%> <%@page import="com.liferay.portal.kernel.workflow.WorkflowTask"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil"%>
<%@page import="com.liferay.portal.model.User"%> <%@page import="com.liferay.portal.model.User"%>
<%@page import="java.util.concurrent.TimeUnit"%> <%@page import="com.liferay.portal.model.WorkflowInstanceLink"%>
<%@page import="java.util.Date"%> <%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil"%> <%@page import="com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.model.Provincia"%>
<%@page import="it.tref.liferay.portos.bo.service.ComuneLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.model.Comune"%> <%@page import="it.tref.liferay.portos.bo.model.Comune"%>
<%@page import="it.tref.liferay.portos.bo.model.ControlloPratica"%>
<%@page import="it.tref.liferay.portos.bo.model.DettPratica"%>
<%@page import="it.tref.liferay.portos.bo.model.IntPratica"%>
<%@page import="it.tref.liferay.portos.bo.model.Provincia"%>
<%@page import="it.tref.liferay.portos.bo.model.Territorio"%> <%@page import="it.tref.liferay.portos.bo.model.Territorio"%>
<%@page import="it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil"%> <%@page import="it.tref.liferay.portos.bo.service.ComuneLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil"%> <%@page import="it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.model.IntPratica"%> <%@page import="it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil"%>
<%@page import="com.liferay.portal.kernel.dao.orm.QueryUtil"%> <%@page import="it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil"%> <%@page import="it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTask"%> <%@page import="it.tref.liferay.portos.bo.shared.util.TipoIntegrazioneUtil"%>
<%@page import="it.tref.liferay.portos.bo.util.WorkflowUtil"%>
<%@page import="java.util.List"%> <%@page import="java.util.List"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowInstance"%>
<%@page import="it.tref.liferay.portos.bo.model.ControlloPratica"%>
<%@page import="com.liferay.portal.model.WorkflowInstanceLink"%>
<%@page import="com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil"%>
<% <%
String rowUrl = StringPool.BLANK; String rowUrl = StringPool.BLANK;
//ADT - BUG-12 Aggiunta colonna Data Esito
String currentTab = (String)request.getAttribute("tabs1"); String currentTab = (String)request.getAttribute("tabs1");
%>
<%
//Informazioni relative alla pratica //Informazioni relative alla pratica
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica.getIntPraticaId()); IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica.getIntPraticaId());
DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica.getIntPraticaId()); DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica.getIntPraticaId());
%> %>
<c:if test="<%= Validator.isNotNull(intPratica) %>"> <c:if test="<%= Validator.isNotNull(intPratica) %>">
<% <%
ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(controlloPratica.getControlloPraticaId()); ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(controlloPratica.getControlloPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId()); Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId()); Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), territorio.getCodiceProvincia()); territorio.getCodiceProvincia());
if(controlloPratica.getStatus() == 0 || controlloPratica.getStatus() == 4 || controlloPratica.getStatus() == 6){
}
//Informazioni relative al workflow //Informazioni relative al workflow
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink( WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink(
controlloPratica.getCompanyId(), controlloPratica.getGroupId(), ControlloPratica.class.getName(), controlloPratica.getCompanyId(), controlloPratica.getGroupId(), ControlloPratica.class.getName(),
controlloPratica.getPrimaryKey()); controlloPratica.getPrimaryKey());
List<WorkflowTask> listaTask = null; List<WorkflowTask> listaTask = null;
WorkflowInstance workflowInstance = null; WorkflowInstance workflowInstance = null;
if (workflowInstanceLink != null) { if (workflowInstanceLink != null) {
long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId(); long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId();
workflowInstance = workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(controlloPratica.getCompanyId(),
WorkflowInstanceManagerUtil.getWorkflowInstance(controlloPratica.getCompanyId(), workflowInstanceId); workflowInstanceId);
listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(controlloPratica.getCompanyId(), null, listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(controlloPratica.getCompanyId(), null,
workflowInstance.getWorkflowInstanceId(), false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); workflowInstance.getWorkflowInstanceId(), false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} }
WorkflowTask task = null; WorkflowTask task = null;
if (listaTask != null && !listaTask.isEmpty()) { if (listaTask != null && !listaTask.isEmpty()) {
task = listaTask.get(0); task = listaTask.get(0);
} }
%> %>
<liferay-ui:search-container-column-text name="taskName"> <liferay-ui:search-container-column-text name="taskName">
<% <%
String taskName = StringPool.BLANK; String taskName = StringPool.BLANK;
@ -94,81 +72,65 @@ DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntP
} else if (workflowInstance != null) { } else if (workflowInstance != null) {
taskName = LanguageUtil.get(pageContext, workflowInstance.getState()); taskName = LanguageUtil.get(pageContext, workflowInstance.getState());
} }
if (lastDettPratica != null) { if (lastDettPratica != null) {
if (lastDettPratica.getTipoIntegrazione() != null) { if (lastDettPratica.getTipoIntegrazione() != null) {
//BUG BO ID=14: NOME TASK SEZIONE ATTIVITA' //BUG BO ID=14: NOME TASK SEZIONE ATTIVITA'
if (lastDettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE)) { if (lastDettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE)) {
taskName = taskName + " - Integrazione #" + (lastDettPratica.getIntegrazione()); taskName = taskName + " - Integrazione #" + lastDettPratica.getIntegrazione();
} else if (lastDettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIANTE)) { } else if (lastDettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIANTE)) {
taskName = taskName + " - Variante #" + (lastDettPratica.getVarianteNumero()); taskName = taskName + " - Variante #" + lastDettPratica.getVarianteNumero();
} }
} }
} }
out.print(taskName); out.print(taskName);
%> %>
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="Esito"> <liferay-ui:search-container-column-text name="Esito">
<% <%= ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica.getControlloPraticaId()) %>
String tipoEsito = ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica.getControlloPraticaId());
out.print(tipoEsito);
%>
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
<%-- ADT - BUG-12 Aggiunta colonna Data Esito --%> <%-- ADT - BUG-12 Aggiunta colonna Data Esito --%>
<%-- Bug 33264 --%> <%-- Bug 33264 --%>
<c:if test='<%= "Tab_TaskCompletati".equals(currentTab) %>'> <c:if test='<%= "Tab_TaskCompletati".equals(currentTab) %>'>
<liferay-ui:search-container-column-text name="Data Esito" value='<%= <liferay-ui:search-container-column-text name="Data Esito" value='<%= controlloPratica.getStatusDate() != null ?
controlloPratica.getStatusDate()!=null ? dateFormatDate.format(controlloPratica.getStatusDate()): "" %>' > dateFormatDate.format(controlloPratica.getStatusDate()) : StringPool.BLANK %>' >
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
</c:if> </c:if>
<liferay-ui:search-container-column-text name="Sorteggiata"> <liferay-ui:search-container-column-text name="Sorteggiata">
<% <%
boolean sorteggiata = SorteggioLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()) != null; boolean sorteggiata = SorteggioLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()) != null;
String clazz = StringPool.BLANK;
if (sorteggiata) { if (sorteggiata) {
out.print("<span><i class=\"relative fa fa-check-square txt-green\"></i></span>"); out.print("<span><i class=\"relative fa fa-check-square txt-green\"></i></span>");
} }
%> %>
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="Pratica"> <liferay-ui:search-container-column-text name="Pratica">
<% <%
if (lastDettPratica != null) { if (lastDettPratica != null) {
long lastDettPraticaId = lastDettPratica.getDettPraticaId(); long lastDettPraticaId = lastDettPratica.getDettPraticaId();
if (lastDettPraticaId != controlloPratica.getDettPraticaId()) { if (lastDettPraticaId != controlloPratica.getDettPraticaId()) {
String messageLabel = LanguageUtil.get(pageContext, "sono-presenti-aggiornamenti-fuori-dal-controllo-obbligatorio"); String messageLabel = LanguageUtil.get(pageContext,
if(controlloPratica.getStatus() == WorkflowConstants.STATUS_APPROVED || controlloPratica.getStatus() == WorkflowConstants.STATUS_INCOMPLETE || controlloPratica.getStatus() == WorkflowConstants.STATUS_DENIED){ "sono-presenti-aggiornamenti-fuori-dal-controllo-obbligatorio");
messageLabel = LanguageUtil.get(pageContext, "sono-presenti-aggiornamenti-fuori-dal-controllo-obbligatorio-closed"); if (controlloPratica.getStatus() == WorkflowConstants.STATUS_APPROVED
|| controlloPratica.getStatus() == WorkflowConstants.STATUS_INCOMPLETE
|| controlloPratica.getStatus() == WorkflowConstants.STATUS_DENIED) {
messageLabel = LanguageUtil.get(pageContext,
"sono-presenti-aggiornamenti-fuori-dal-controllo-obbligatorio-closed");
} }
%> %>
<span class="txt-bold avviso-aggiornamenti"> <span class="txt-bold avviso-aggiornamenti">
<i class="fa fa-exclamation-triangle txt-orange"></i> <i class="fa fa-exclamation-triangle txt-orange"></i>
<%= messageLabel %> <%= messageLabel %>
</span> </span>
<% <%
} }
} }
%> %>
<%= intPratica.getTitle(locale, true) %> <%= intPratica.getTitle(locale, true) %>
<%= Validator.isNull(intPratica.getTipoProcedura()) ? <%= Validator.isNull(intPratica.getTipoProcedura()) ? StringPool.BLANK :
"" :
"<br><small>Procedura " + intPratica.getTipoProcedura() + "</small>" %> "<br><small>Procedura " + intPratica.getTipoProcedura() + "</small>" %>
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="istruttore"> <liferay-ui:search-container-column-text name="istruttore">
<c:if test="<%=intPratica.getStatusByUserId()!=0l %>"> <c:if test="<%= intPratica.getStatusByUserId() != 0L %>">
<% <%
User tecnico = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId()); User tecnico = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (tecnico != null) { if (tecnico != null) {
@ -178,14 +140,14 @@ DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntP
} }
%> %>
</c:if> </c:if>
<c:if test="<%=intPratica.getStatusByUserId()==0l %>"> <c:if test="<%= intPratica.getStatusByUserId() == 0L %>">
- -
</c:if> </c:if>
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="provenienza"> <liferay-ui:search-container-column-text name="provenienza">
<% <%
WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask(controlloPratica.getCompanyId(),controlloPratica.getGroupId(), null, controlloPratica); WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask(controlloPratica.getCompanyId(),
controlloPratica.getGroupId(), null, controlloPratica);
%> %>
<c:if test="<%= workflowTask != null %>"> <c:if test="<%= workflowTask != null %>">
<% <%
@ -206,13 +168,10 @@ DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntP
- -
</c:if> </c:if>
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="data-inizio-procedimento" value="<%= dateFormatDate.format(controlloPratica.getCreateDate()) %>" /> <liferay-ui:search-container-column-text name="data-inizio-procedimento" value="<%= dateFormatDate.format(controlloPratica.getCreateDate()) %>" />
<liferay-ui:search-container-column-text name="provincia" > <liferay-ui:search-container-column-text name="provincia" >
<%= provincia.getProvincia() + " - " + comune.getDenominazione() %> <%= provincia.getProvincia() + " - " + comune.getDenominazione() %>
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="GG*" cssClass="text-center"> <liferay-ui:search-container-column-text name="GG*" cssClass="text-center">
<% <%
long days = ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(controlloPratica.getControlloPraticaId()); long days = ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(controlloPratica.getControlloPraticaId());
@ -221,7 +180,5 @@ DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntP
} }
%> %>
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-jsp path="/html/gestioneattivita/action_button.jsp" align="right" cssClass="text-center"/> <liferay-ui:search-container-column-jsp path="/html/gestioneattivita/action_button.jsp" align="right" cssClass="text-center"/>
</c:if> </c:if>

972
liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java

File diff soppresso perché troppo grande Load Diff

514
liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/SoggettiPraticaPortlet.java

@ -1,32 +1,5 @@
package it.tref.liferay.portos.fe.portlet; package it.tref.liferay.portos.fe.portlet;
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;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.json.JSONSerializer;
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.servlet.SessionErrors;
import com.liferay.portal.kernel.upload.UploadPortletRequest;
import com.liferay.portal.kernel.util.DateFormatFactoryUtil;
import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.HttpUtil;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.OrderByComparatorFactoryUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.User;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.util.PortalUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import it.tref.liferay.portos.bo.model.Comune; import it.tref.liferay.portos.bo.model.Comune;
import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.model.DocPratica; import it.tref.liferay.portos.bo.model.DocPratica;
@ -58,32 +31,52 @@ import javax.portlet.PortletException;
import javax.portlet.ResourceRequest; import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse; import javax.portlet.ResourceResponse;
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;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.json.JSONSerializer;
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.servlet.SessionErrors;
import com.liferay.portal.kernel.upload.UploadPortletRequest;
import com.liferay.portal.kernel.util.DateFormatFactoryUtil;
import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.HttpUtil;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.OrderByComparatorFactoryUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.User;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.util.PortalUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
public class SoggettiPraticaPortlet extends MVCPortlet { public class SoggettiPraticaPortlet extends MVCPortlet {
private static Log _log = LogFactoryUtil.getLog(SoggettiPraticaPortlet.class); private static Log _log = LogFactoryUtil.getLog(SoggettiPraticaPortlet.class);
public void deleteSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void deleteSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try { try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId"); long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
SoggettoServiceUtil.deleteSoggetto(soggettoId); SoggettoServiceUtil.deleteSoggetto(soggettoId);
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
_log.error(e, e); _log.error(e, e);
throw e; throw e;
} }
} }
public void invalidaSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void invalidaSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try { try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId"); long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
long dettPraticaIdRimozione = ParamUtil.getLong(actionRequest, "dettPraticaId"); long dettPraticaIdRimozione = ParamUtil.getLong(actionRequest, "dettPraticaId");
SoggettoLocalServiceUtil.invalidaSoggetto(soggettoId, dettPraticaIdRimozione); SoggettoLocalServiceUtil.invalidaSoggetto(soggettoId, dettPraticaIdRimozione);
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
_log.error(e, e); _log.error(e, e);
throw e; throw e;
@ -91,13 +84,10 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
} }
public void validaSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void validaSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try { try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId"); long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId"); long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
SoggettoLocalServiceUtil.validaSoggetto(soggettoId, dettPraticaId); SoggettoLocalServiceUtil.validaSoggetto(soggettoId, dettPraticaId);
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
_log.error(e, e); _log.error(e, e);
throw e; throw e;
@ -105,14 +95,12 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
} }
public void makePrincipale(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void makePrincipale(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try { try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId"); long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId"); long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
Soggetto soggetto = SoggettoServiceUtil.getSoggetto(soggettoId); Soggetto soggetto = SoggettoServiceUtil.getSoggetto(soggettoId);
SoggettoServiceUtil.updatePrincipale(dettPraticaId, soggetto.getCodiceFiscale(), SoggettoServiceUtil.updatePrincipale(dettPraticaId, soggetto.getCodiceFiscale(),
soggetto.getTipologiaSoggetto()); soggetto.getTipologiaSoggetto());
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
_log.error(e, e); _log.error(e, e);
throw e; throw e;
@ -120,318 +108,20 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
} }
public void removePrincipale(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void removePrincipale(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try { try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId"); long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
Soggetto soggetto = SoggettoServiceUtil.getSoggetto(soggettoId); Soggetto soggetto = SoggettoServiceUtil.getSoggetto(soggettoId);
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId"); long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
DettPraticaServiceUtil.updatePrincipale(dettPraticaId, StringPool.BLANK, DettPraticaServiceUtil.updatePrincipale(dettPraticaId, StringPool.BLANK, soggetto.getTipologiaSoggetto());
soggetto.getTipologiaSoggetto());
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
_log.error(e, e); _log.error(e, e);
throw e; throw e;
} }
} }
// public void updateSoggetto(ActionRequest actionRequest, ActionResponse
// actionResponse) throws
// Exception {
//
// boolean requiredDoc = ParamUtil.getBoolean(actionRequest, "requiredDoc");
// long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
//
// long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
// long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
// String tipologiaSoggetto = ParamUtil.getString(actionRequest,
// "tipologiaSoggetto");
// String nome = ParamUtil.getString(actionRequest, "nome");
// String cognome = ParamUtil.getString(actionRequest, "cognome");
// String codiceFiscale = ParamUtil.getString(actionRequest,
// "codiceFiscale");
// if (Validator.isNotNull(ParamUtil.getString(actionRequest,
// "codiceFiscaleDitta"))) {
// codiceFiscale = ParamUtil.getString(actionRequest, "codiceFiscaleDitta");
// } else {
// codiceFiscale = ParamUtil.getString(actionRequest,
// "codiceFiscalePersone");
// }
// boolean isSigned = false;
// String sourceFileName = StringPool.BLANK;
// byte[] content = null;
// String jsonFirmatari = "";
//
// if (requiredDoc) {
// UploadPortletRequest uploadRequest =
// PortalUtil.getUploadPortletRequest(actionRequest);
// ServiceContext serviceContext =
// ServiceContextFactory.getInstance(uploadRequest);
// sourceFileName = uploadRequest.getFileName("docFile");
// File file = uploadRequest.getFile("docFile");
// boolean applicaFirma = ParamUtil.getBoolean(actionRequest,
// "applicaFirma");
//
// try {
// if (Validator.isNotNull(sourceFileName) && file != null) {
// // validazione: solo alcune estensioni
// String ext = FileUtil.getExtension(sourceFileName);
// if (!ext.equalsIgnoreCase("p7m") && !ext.equalsIgnoreCase("pdf")) {
// SessionErrors.add(actionRequest,
// "error.geniocivilefe.variazione-soggetto.allegato.ext.valid");
// }
// // lunghezza fissata a 200
// if (sourceFileName.length() > 200) {
// SessionErrors.add(actionRequest,
// "error.geniocivilefe.variazione-soggetto.allegato.length.valid");
// }
// } else {
// SessionErrors.add(actionRequest,
// "error.geniocivilefe.variazione-soggetto.allegato.is.request");
// }
//
// if (!SessionErrors.isEmpty(actionRequest)) {
// throw new
// SystemException("error.geniocivilefe.variazione-soggetto.allegato");
// } else {
// content = FileUtil.getBytes(file);
// // Per poter completare l'aggiunta di un soggetto è necessario allegare
// file firmato dal
// // nuovo soggetto e almeno uno dei soggetti già inseriti nella pratica.
// // SOLO nel caso in cui il soggetto che viene inserito è di tipo
// COMMITTENTE, la sua firma
// // sul file allegato NON è OBBLIGATORIA; inoltre la firma OBBLIGATORIA
// che deve essere
// // presente sul file allegato è SOLO quella del TITOLARE DIGITALE DELLA
// PRATICA.
// if (TipoSoggettoUtil.COMMITTENTE.equals(tipologiaSoggetto)) {
// DettPratica dettPratica =
// DettPraticaLocalServiceUtil.getDettPratica(dettPraticaId);
// String[] titolare = new String[]
// {dettPratica.getCodiceFiscaleDelegatoCommittente()};
// isSigned =
// ValidazionePraticaUtil.isAllegatoSignedBySubjects(sourceFileName,
// content,
// serviceContext.getCompanyId(), Arrays.asList(titolare));
// } else {
// List<Soggetto> soggettiValidi =
// SoggettoServiceUtil.getValidTmpByIntPratica(intPraticaId);
// List<String> codiciFiscaliValidi = new ArrayList<String>();
// for (Soggetto soggetto : soggettiValidi) {
// if (!codiciFiscaliValidi.contains(soggetto.getCodiceFiscale())) {
// codiciFiscaliValidi.add(soggetto.getCodiceFiscale());
// }
// }
//
// isSigned =
// ValidazionePraticaUtil.isAllegatoSignedBySubjectsAndPerson(sourceFileName,
// content,
// serviceContext.getCompanyId(), codiciFiscaliValidi, codiceFiscale);
// }
//
// FirmeBean firmeBean = new FirmeBean();
// if (applicaFirma) {
// User user = UserLocalServiceUtil.getUser(serviceContext.getUserId());
// jsonFirmatari = FirmeUtil.addFirma(firmeBean, user.getScreenName());
// } else {
// jsonFirmatari = FirmeUtil.serialize(firmeBean);
// }
//
// if (!isSigned) {
// SessionErrors.add(actionRequest,
// "error.geniocivilefe.variazione-soggetto.add.file.non.firmato");
// throw new
// SystemException("error.geniocivilefe.variazione-soggetto.add.file.non.firmato");
// }
//
// }
//
// } catch (Exception e) {
// SessionErrors.add(actionRequest,
// "error.geniocivilefe.variazione-soggetto");
// String redirectURL = ParamUtil.getString(actionRequest, "errorUrl");
// redirectURL =
// HttpUtil.addParameter(redirectURL, actionResponse.getNamespace() +
// "isEditable",
// String.valueOf(true));
//
// actionResponse.sendRedirect(redirectURL);
// return;
// }
//
// }
//
// String codiceFiscaleDelegato = ParamUtil.getString(actionRequest,
// "codiceFiscaleDelegato");
// Date dataNascita =
// ParamUtil.getDate(actionRequest, "dataNascita",
// DateFormatFactoryUtil.getDate(actionRequest.getLocale()));
// String comuneNascita = ParamUtil.getString(actionRequest,
// "comuneNascita");
// String comuneDomicilio = ParamUtil.getString(actionRequest,
// "comuneDomicilio");
// String provinciaDomicilio = ParamUtil.getString(actionRequest,
// "provinciaDomicilio");
// String viaDomicilio = ParamUtil.getString(actionRequest, "viaDomicilio");
// String numeroCivicoDomicilio = ParamUtil.getString(actionRequest,
// "numeroCivicoDomicilio");
// String capDomicilio = ParamUtil.getString(actionRequest, "capDomicilio");
// String domicilioExtra = ParamUtil.getString(actionRequest,
// "domicilioExtra");
// String comune = ParamUtil.getString(actionRequest, "comune");
// String provincia = ParamUtil.getString(actionRequest, "provincia");
// String via = ParamUtil.getString(actionRequest, "via");
// String numeroCivico = ParamUtil.getString(actionRequest, "numeroCivico");
// String cap = ParamUtil.getString(actionRequest, "cap");
// String denominazione = ParamUtil.getString(actionRequest,
// "denominazione");
// String sedeLegale = ParamUtil.getString(actionRequest, "sedeLegale");
// String legaleRap = ParamUtil.getString(actionRequest, "legaleRap");
// Date dataNascitaRap =
// ParamUtil.getDate(actionRequest, "dataNascitaRap",
// DateFormatFactoryUtil.getDate(actionRequest.getLocale()));
// String comuneNascitaRap = ParamUtil.getString(actionRequest,
// "comuneNascitaRap");
// String viaRap = ParamUtil.getString(actionRequest, "viaRap");
// String numeroCivicoRap = ParamUtil.getString(actionRequest,
// "numeroCivicoRap");
// String capRap = ParamUtil.getString(actionRequest, "capRap");
// String provinciaRap = ParamUtil.getString(actionRequest, "provinciaRap");
// String comuneRap = ParamUtil.getString(actionRequest, "comuneRap");
// String albo = ParamUtil.getString(actionRequest, "albo");
// String regAlbo = ParamUtil.getString(actionRequest, "regAlbo");
// String provinciaAlbo = ParamUtil.getString(actionRequest,
// "provinciaAlbo");
// String numIscrAlbo = ParamUtil.getString(actionRequest, "numIscrAlbo");
// String telefono = ParamUtil.getString(actionRequest, "telefono");
// String fax = ParamUtil.getString(actionRequest, "fax");
// String email = ParamUtil.getString(actionRequest, "email");
// boolean aggiuntivo = ParamUtil.getBoolean(actionRequest, "aggiuntivo");
// boolean rimosso = ParamUtil.getBoolean(actionRequest, "rimosso");
// String ambitoAttivita = ParamUtil.getString(actionRequest,
// "ambitoAttivita");
// String ambitoProfessioneDitta = ParamUtil.getString(actionRequest,
// "ambitoProfessioneDitta");
// String ambitoProfessioneAltro = ParamUtil.getString(actionRequest,
// "ambitoProfessioneAltro");
// String ambitoProfessione =
// Validator.isNotNull(ambitoProfessioneDitta) ? ambitoProfessioneDitta :
// ambitoProfessioneAltro;
// long intPraticaIdRimozione = ParamUtil.getLong(actionRequest,
// "intPraticaIdRimozione");
// long dettPraticaIdRimozione = ParamUtil.getLong(actionRequest,
// "dettPraticaIdRimozione");
// // Date dtDataRimozione =
// // ParamUtil.getDate(actionRequest, "dtDataRimozione",
// // DateFormatFactoryUtil.getDate(actionRequest.getLocale());
//
// ServiceContext serviceContext =
// ServiceContextFactory.getInstance(Soggetto.class.getName(),
// actionRequest);
//
// long userId = PortalUtil.getUserId(actionRequest);
//
// try {
//
// actionResponse.setRenderParameter("mvcPath",
// "html/soggettipratica/edit_soggetto.jsp");
// if (soggettoId == 0) {
// if (isSigned) {
// SoggettoLocalServiceUtil.addSoggettoValidatedByFile(userId,
// dettPraticaId, intPraticaId, nome,
// cognome,
// codiceFiscale, codiceFiscaleDelegato, dataNascita, comuneNascita,
// comuneDomicilio,
// provinciaDomicilio,
// viaDomicilio, numeroCivicoDomicilio, capDomicilio, domicilioExtra,
// comune, provincia, via,
// numeroCivico,
// cap, denominazione, sedeLegale, legaleRap, dataNascitaRap,
// comuneNascitaRap, viaRap,
// numeroCivicoRap,
// capRap, provinciaRap, comuneRap, albo, regAlbo, provinciaAlbo,
// numIscrAlbo, telefono, fax,
// email,
// tipologiaSoggetto, aggiuntivo, rimosso, ambitoAttivita,
// ambitoProfessione,
// intPraticaIdRimozione,
// dettPraticaIdRimozione, null, 0L, content, sourceFileName, jsonFirmatari,
// serviceContext);
// } else {
// SoggettoLocalServiceUtil.addSoggetto(userId, dettPraticaId, intPraticaId,
// nome, cognome,
// codiceFiscale,
// codiceFiscaleDelegato, dataNascita, comuneNascita, comuneDomicilio,
// provinciaDomicilio,
// viaDomicilio,
// numeroCivicoDomicilio, capDomicilio, domicilioExtra, comune, provincia,
// via, numeroCivico, cap,
// denominazione, sedeLegale, legaleRap, dataNascitaRap, comuneNascitaRap,
// viaRap,
// numeroCivicoRap, capRap,
// provinciaRap, comuneRap, albo, regAlbo, provinciaAlbo, numIscrAlbo,
// telefono, fax, email,
// tipologiaSoggetto, aggiuntivo, rimosso, ambitoAttivita,
// ambitoProfessione,
// intPraticaIdRimozione,
// dettPraticaIdRimozione, null, 0L, serviceContext);
// }
// } else {
// if (isSigned) {
// SoggettoLocalServiceUtil.updateSoggettoValidatedByFile(userId,
// soggettoId, dettPraticaId,
// intPraticaId, nome,
// cognome, codiceFiscale, codiceFiscaleDelegato, dataNascita,
// comuneNascita, comuneDomicilio,
// provinciaDomicilio, viaDomicilio, numeroCivicoDomicilio, capDomicilio,
// domicilioExtra, comune,
// provincia,
// via, numeroCivico, cap, denominazione, sedeLegale, legaleRap,
// dataNascitaRap, comuneNascitaRap,
// viaRap,
// numeroCivicoRap, capRap, provinciaRap, comuneRap, albo, regAlbo,
// provinciaAlbo, numIscrAlbo,
// telefono,
// fax, email, tipologiaSoggetto, aggiuntivo, rimosso, ambitoAttivita,
// ambitoProfessione,
// intPraticaIdRimozione, dettPraticaIdRimozione, null, 0L, content,
// sourceFileName,
// jsonFirmatari,
// serviceContext);
// } else {
// SoggettoLocalServiceUtil.updateSoggetto(userId, soggettoId,
// dettPraticaId, intPraticaId, nome,
// cognome,
// codiceFiscale, codiceFiscaleDelegato, dataNascita, comuneNascita,
// comuneDomicilio,
// provinciaDomicilio,
// viaDomicilio, numeroCivicoDomicilio, capDomicilio, domicilioExtra,
// comune, provincia, via,
// numeroCivico,
// cap, denominazione, sedeLegale, legaleRap, dataNascitaRap,
// comuneNascitaRap, viaRap,
// numeroCivicoRap,
// capRap, provinciaRap, comuneRap, albo, regAlbo, provinciaAlbo,
// numIscrAlbo, telefono, fax,
// email,
// tipologiaSoggetto, aggiuntivo, rimosso, ambitoAttivita,
// ambitoProfessione,
// intPraticaIdRimozione,
// dettPraticaIdRimozione, null, 0L, serviceContext);
// }
// }
// PortalUtil.copyRequestParameters(actionRequest, actionResponse);
// } catch (PortalException e) {
// _log.error(e, e);
//
// throw e;
// }
// }
public void updateSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void updateSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
boolean requiredDoc = ParamUtil.getBoolean(actionRequest, "requiredDoc"); boolean requiredDoc = ParamUtil.getBoolean(actionRequest, "requiredDoc");
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId"); long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId"); long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId"); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
String tipologiaSoggetto = ParamUtil.getString(actionRequest, "tipologiaSoggetto"); String tipologiaSoggetto = ParamUtil.getString(actionRequest, "tipologiaSoggetto");
@ -443,7 +133,6 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
} else { } else {
codiceFiscale = ParamUtil.getString(actionRequest, "codiceFiscalePersone"); codiceFiscale = ParamUtil.getString(actionRequest, "codiceFiscalePersone");
} }
String codiceFiscaleDelegato = ParamUtil.getString(actionRequest, "codiceFiscaleDelegato"); String codiceFiscaleDelegato = ParamUtil.getString(actionRequest, "codiceFiscaleDelegato");
Date dataNascita = ParamUtil.getDate(actionRequest, "dataNascita", Date dataNascita = ParamUtil.getDate(actionRequest, "dataNascita",
DateFormatFactoryUtil.getDate(actionRequest.getLocale())); DateFormatFactoryUtil.getDate(actionRequest.getLocale()));
@ -474,22 +163,18 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
String capRap = ParamUtil.getString(actionRequest, "capRap"); String capRap = ParamUtil.getString(actionRequest, "capRap");
String provinciaRap = ParamUtil.getString(actionRequest, "provinciaRap"); String provinciaRap = ParamUtil.getString(actionRequest, "provinciaRap");
String comuneRap = ParamUtil.getString(actionRequest, "comuneRap"); String comuneRap = ParamUtil.getString(actionRequest, "comuneRap");
String comuneRapEstero = ParamUtil.getString(actionRequest, "comuneRapEstero");
String albo = ParamUtil.getString(actionRequest, "albo"); String albo = ParamUtil.getString(actionRequest, "albo");
String alboDescr = ParamUtil.getString(actionRequest, "alboDescr"); String alboDescr = ParamUtil.getString(actionRequest, "alboDescr");
String regAlbo = ParamUtil.getString(actionRequest, "regAlbo"); String regAlbo = ParamUtil.getString(actionRequest, "regAlbo");
String provinciaAlbo = ParamUtil.getString(actionRequest, "provinciaAlbo"); String provinciaAlbo = ParamUtil.getString(actionRequest, "provinciaAlbo");
String numIscrAlbo = ParamUtil.getString(actionRequest, "numIscrAlbo"); String numIscrAlbo = ParamUtil.getString(actionRequest, "numIscrAlbo");
String fax = ParamUtil.getString(actionRequest, "fax"); String fax = ParamUtil.getString(actionRequest, "fax");
String telefonoResidenza = ParamUtil.getString(actionRequest, "telefonoResidenza"); String telefonoResidenza = ParamUtil.getString(actionRequest, "telefonoResidenza");
String telefono = Validator.isNotNull(telefonoResidenza) ? telefonoResidenza : ParamUtil.getString( String telefono = Validator.isNotNull(telefonoResidenza) ? telefonoResidenza : ParamUtil.getString(
actionRequest, "telefonoGiuridico"); actionRequest, "telefonoGiuridico");
String emailResidenza = ParamUtil.getString(actionRequest, "emailResidenza"); String emailResidenza = ParamUtil.getString(actionRequest, "emailResidenza");
String email = Validator.isNotNull(emailResidenza) ? emailResidenza : ParamUtil.getString( String email = Validator.isNotNull(emailResidenza) ? emailResidenza : ParamUtil.getString(actionRequest,
actionRequest, "emailGiuridica"); "emailGiuridica");
boolean aggiuntivo = ParamUtil.getBoolean(actionRequest, "aggiuntivo"); boolean aggiuntivo = ParamUtil.getBoolean(actionRequest, "aggiuntivo");
boolean rimosso = ParamUtil.getBoolean(actionRequest, "rimosso"); boolean rimosso = ParamUtil.getBoolean(actionRequest, "rimosso");
String ambitoAttivita = ParamUtil.getString(actionRequest, "ambitoAttivita"); String ambitoAttivita = ParamUtil.getString(actionRequest, "ambitoAttivita");
@ -499,110 +184,82 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
: ambitoProfessioneAltro; : ambitoProfessioneAltro;
long intPraticaIdRimozione = ParamUtil.getLong(actionRequest, "intPraticaIdRimozione"); long intPraticaIdRimozione = ParamUtil.getLong(actionRequest, "intPraticaIdRimozione");
long dettPraticaIdRimozione = ParamUtil.getLong(actionRequest, "dettPraticaIdRimozione"); long dettPraticaIdRimozione = ParamUtil.getLong(actionRequest, "dettPraticaIdRimozione");
// Date dtDataRimozione =
// ParamUtil.getDate(actionRequest, "dtDataRimozione",
// DateFormatFactoryUtil.getDate(actionRequest.getLocale());
long soggettoSostituitoId = ParamUtil.getLong(actionRequest, "soggettoSostituitoId"); long soggettoSostituitoId = ParamUtil.getLong(actionRequest, "soggettoSostituitoId");
ServiceContext serviceContext = ServiceContextFactory.getInstance(Soggetto.class.getName(), actionRequest);
ServiceContext serviceContext = ServiceContextFactory.getInstance(Soggetto.class.getName(),
actionRequest);
long userId = PortalUtil.getUserId(actionRequest); long userId = PortalUtil.getUserId(actionRequest);
try { try {
actionResponse.setRenderParameter("mvcPath", "html/soggettipratica/edit_soggetto.jsp"); actionResponse.setRenderParameter("mvcPath", "html/soggettipratica/edit_soggetto.jsp");
boolean tmp = false; boolean tmp = false;
if (requiredDoc) { if (requiredDoc) {
tmp = true; tmp = true;
} }
Soggetto soggetto = null; Soggetto soggetto = null;
if (soggettoId == 0) { if (soggettoId == 0) {
soggetto = SoggettoServiceUtil.addSoggetto(userId, dettPraticaId, intPraticaId, nome, soggetto = SoggettoServiceUtil.addSoggetto(userId, dettPraticaId, intPraticaId, nome, cognome,
cognome, codiceFiscale, codiceFiscaleDelegato, dataNascita, provinciaNascita, codiceFiscale, codiceFiscaleDelegato, dataNascita, provinciaNascita, comuneNascita,
comuneNascita, comuneDomicilio, comuneDomicilioEstero, provinciaDomicilio, comuneDomicilio, comuneDomicilioEstero, provinciaDomicilio, viaDomicilio,
viaDomicilio, numeroCivicoDomicilio, capDomicilio, domicilioExtra, comune, numeroCivicoDomicilio, capDomicilio, domicilioExtra, comune, comuneEstero, provincia, via,
comuneEstero, provincia, via, numeroCivico, cap, denominazione, sedeLegale, numeroCivico, cap, denominazione, sedeLegale, legaleRap, dataNascitaRap, provinciaNascitaRap,
legaleRap, dataNascitaRap, provinciaNascitaRap, comuneNascitaRap, viaRap, comuneNascitaRap, viaRap, numeroCivicoRap, capRap, provinciaRap, comuneRap, comuneEstero, albo,
numeroCivicoRap, capRap, provinciaRap, comuneRap, comuneEstero, albo, alboDescr, alboDescr, regAlbo, provinciaAlbo, numIscrAlbo, telefono, fax, email, tipologiaSoggetto,
regAlbo, provinciaAlbo, numIscrAlbo, telefono, fax, email, tipologiaSoggetto,
aggiuntivo, rimosso, ambitoAttivita, ambitoProfessione, intPraticaIdRimozione, aggiuntivo, rimosso, ambitoAttivita, ambitoProfessione, intPraticaIdRimozione,
dettPraticaIdRimozione, null, soggettoSostituitoId, 0L, tmp, serviceContext); dettPraticaIdRimozione, null, soggettoSostituitoId, 0L, tmp, serviceContext);
} else { } else {
soggetto = SoggettoServiceUtil.updateSoggetto(userId, soggettoId, dettPraticaId, soggetto = SoggettoServiceUtil.updateSoggetto(userId, soggettoId, dettPraticaId, intPraticaId, nome,
intPraticaId, nome, cognome, codiceFiscale, codiceFiscaleDelegato, dataNascita, cognome, codiceFiscale, codiceFiscaleDelegato, dataNascita, provinciaNascita, comuneNascita,
provinciaNascita, comuneNascita, comuneDomicilio, comuneDomicilioEstero, comuneDomicilio, comuneDomicilioEstero, provinciaDomicilio, viaDomicilio,
provinciaDomicilio, viaDomicilio, numeroCivicoDomicilio, capDomicilio, numeroCivicoDomicilio, capDomicilio, domicilioExtra, comune, comuneEstero, provincia, via,
domicilioExtra, comune, comuneEstero, provincia, via, numeroCivico, cap, numeroCivico, cap, denominazione, sedeLegale, legaleRap, dataNascitaRap, provinciaNascitaRap,
denominazione, sedeLegale, legaleRap, dataNascitaRap, provinciaNascitaRap, comuneNascitaRap, viaRap, numeroCivicoRap, capRap, provinciaRap, comuneRap, comuneEstero, albo,
comuneNascitaRap, viaRap, numeroCivicoRap, capRap, provinciaRap, comuneRap, alboDescr, regAlbo, provinciaAlbo, numIscrAlbo, telefono, fax, email, tipologiaSoggetto,
comuneEstero, albo, alboDescr, regAlbo, provinciaAlbo, numIscrAlbo, telefono, fax, aggiuntivo, rimosso, ambitoAttivita, ambitoProfessione, intPraticaIdRimozione,
email, tipologiaSoggetto, aggiuntivo, rimosso, ambitoAttivita, ambitoProfessione, dettPraticaIdRimozione, null, soggettoSostituitoId, 0L, tmp, serviceContext);
intPraticaIdRimozione, dettPraticaIdRimozione, null, soggettoSostituitoId, 0L, tmp,
serviceContext);
} }
PortalUtil.copyRequestParameters(actionRequest, actionResponse); PortalUtil.copyRequestParameters(actionRequest, actionResponse);
actionResponse.setRenderParameter("soggettoId", String.valueOf(soggetto.getSoggettoId())); actionResponse.setRenderParameter("soggettoId", String.valueOf(soggetto.getSoggettoId()));
actionResponse.setRenderParameter("closePopup", String.valueOf(true)); actionResponse.setRenderParameter("closePopup", String.valueOf(true));
} catch (PortalException e) { } catch (PortalException e) {
_log.error(e, e); _log.error(e, e);
throw e; throw e;
} }
} }
public void updateAllegatoSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) public void updateAllegatoSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
throws Exception {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId"); long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
Soggetto soggetto = SoggettoLocalServiceUtil.getSoggetto(soggettoId); Soggetto soggetto = SoggettoLocalServiceUtil.getSoggetto(soggettoId);
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId"); long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(dettPraticaId); DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(dettPraticaId);
long intPraticaId = dettPratica.getIntPraticaId(); long intPraticaId = dettPratica.getIntPraticaId();
ServiceContext serviceContext = ServiceContextFactory.getInstance(Soggetto.class.getName(), ServiceContext serviceContext = ServiceContextFactory.getInstance(Soggetto.class.getName(), actionRequest);
actionRequest);
String sourceFileName = StringPool.BLANK; String sourceFileName = StringPool.BLANK;
byte[] content = null; byte[] content = null;
String jsonFirmatari = ""; String jsonFirmatari = StringPool.BLANK;
boolean isSigned = false; boolean isSigned = false;
boolean applicaFirma = ParamUtil.getBoolean(actionRequest, "applicaFirma"); boolean applicaFirma = ParamUtil.getBoolean(actionRequest, "applicaFirma");
try { try {
FirmeBean firmeBean = new FirmeBean(); FirmeBean firmeBean = new FirmeBean();
if (Validator.isNotNull(soggetto.getFileVariazioneId())) { if (Validator.isNotNull(soggetto.getFileVariazioneId())) {
DocPratica fileAllegato = DocPraticaLocalServiceUtil.getDocPratica(soggetto DocPratica fileAllegato = DocPraticaLocalServiceUtil.getDocPratica(soggetto.getFileVariazioneId());
.getFileVariazioneId());
sourceFileName = fileAllegato.getFileName(); sourceFileName = fileAllegato.getFileName();
FileEntry attachment = DocPraticaLocalServiceUtil.getAttachment(soggetto FileEntry attachment = DocPraticaLocalServiceUtil.getAttachment(soggetto.getFileVariazioneId());
.getFileVariazioneId());
// content = IOUtils.toByteArray(attachment.getContentStream());
content = FileUtil.getBytes(attachment.getContentStream()); content = FileUtil.getBytes(attachment.getContentStream());
firmeBean = FirmeUtil.deserialize(fileAllegato.getJsonFirmatari()); firmeBean = FirmeUtil.deserialize(fileAllegato.getJsonFirmatari());
} }
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
sourceFileName = uploadRequest.getFileName("docFile"); sourceFileName = uploadRequest.getFileName("docFile");
File file = uploadRequest.getFile("docFile"); File file = uploadRequest.getFile("docFile");
User user = UserLocalServiceUtil.getUser(serviceContext.getUserId()); User user = UserLocalServiceUtil.getUser(serviceContext.getUserId());
if (applicaFirma && !firmeBean.allSignatures().contains(user.getScreenName())) { if (applicaFirma && !firmeBean.allSignatures().contains(user.getScreenName())) {
jsonFirmatari = FirmeUtil.addFirma(firmeBean, user.getScreenName()); jsonFirmatari = FirmeUtil.addFirma(firmeBean, user.getScreenName());
} else { } else {
jsonFirmatari = FirmeUtil.serialize(firmeBean); jsonFirmatari = FirmeUtil.serialize(firmeBean);
} }
if (file.exists()) { if (file.exists()) {
if (Validator.isNotNull(sourceFileName) && file != null) { if (Validator.isNotNull(sourceFileName) && file != null) {
// validazione: solo alcune estensioni // validazione: solo alcune estensioni
String ext = FileUtil.getExtension(sourceFileName); String ext = FileUtil.getExtension(sourceFileName);
if (!ext.equalsIgnoreCase("p7m") && !ext.equalsIgnoreCase("pdf")) { if (!ext.equalsIgnoreCase("p7m") && !ext.equalsIgnoreCase("pdf")) {
SessionErrors.add(actionRequest, SessionErrors.add(actionRequest, "error.geniocivilefe.variazione-soggetto.allegato.ext.valid");
"error.geniocivilefe.variazione-soggetto.allegato.ext.valid");
} }
// lunghezza fissata a 200 // lunghezza fissata a 200
if (sourceFileName.length() > 200) { if (sourceFileName.length() > 200) {
@ -610,28 +267,19 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
"error.geniocivilefe.variazione-soggetto.allegato.length.valid"); "error.geniocivilefe.variazione-soggetto.allegato.length.valid");
} }
} else if (!TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(soggetto.getTipologiaSoggetto())) { } else if (!TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(soggetto.getTipologiaSoggetto())) {
SessionErrors.add(actionRequest, SessionErrors.add(actionRequest, "error.geniocivilefe.variazione-soggetto.allegato.is.request");
"error.geniocivilefe.variazione-soggetto.allegato.is.request");
} }
if (!SessionErrors.isEmpty(actionRequest)) { if (!SessionErrors.isEmpty(actionRequest)) {
throw new SystemException("error.geniocivilefe.variazione-soggetto.allegato"); throw new SystemException("error.geniocivilefe.variazione-soggetto.allegato");
} else if (file != null) { } else if (file != null) {
content = FileUtil.getBytes(file); content = FileUtil.getBytes(file);
} }
} }
// Per poter completare l'aggiunta di un soggetto è necessario allegare file firmato dal nuovo soggetto e
// Per poter completare l'aggiunta di un soggetto è necessario // almeno uno dei soggetti già inseriti nella pratica.
// allegare file firmato dal // SOLO nel caso in cui il soggetto che viene inserito è di tipo COMMITTENTE, la sua firma sul file allegato
// nuovo soggetto e almeno uno dei soggetti già inseriti nella // NON è OBBLIGATORIA; inoltre la firma OBBLIGATORIA che deve essere presente sul file allegato è SOLO
// pratica. // quella del TITOLARE DIGITALE DELLA PRATICA.
// SOLO nel caso in cui il soggetto che viene inserito è di tipo
// COMMITTENTE, la sua firma
// sul file allegato NON è OBBLIGATORIA; inoltre la firma
// OBBLIGATORIA che deve essere
// presente sul file allegato è SOLO quella del TITOLARE DIGITALE
// DELLA PRATICA.
if (TipoSoggettoUtil.COMMITTENTE.equals(soggetto.getTipologiaSoggetto())) { if (TipoSoggettoUtil.COMMITTENTE.equals(soggetto.getTipologiaSoggetto())) {
String[] titolare = new String[] { dettPratica.getCodiceFiscaleDelegatoCommittente() }; String[] titolare = new String[] { dettPratica.getCodiceFiscaleDelegatoCommittente() };
isSigned = ValidazionePraticaUtil.isAllegatoSignedBySubjects(sourceFileName, content, isSigned = ValidazionePraticaUtil.isAllegatoSignedBySubjects(sourceFileName, content,
@ -645,11 +293,9 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
codiciFiscaliValidi.add(valido.getCodiceFiscale()); codiciFiscaliValidi.add(valido.getCodiceFiscale());
} }
} }
isSigned = ValidazionePraticaUtil.isAllegatoSignedBySubjectsAndPerson(sourceFileName, isSigned = ValidazionePraticaUtil.isAllegatoSignedBySubjectsAndPerson(sourceFileName, content,
content, serviceContext.getCompanyId(), codiciFiscaliValidi, serviceContext.getCompanyId(), codiciFiscaliValidi, soggetto.getCodiceFiscale(), jsonFirmatari);
soggetto.getCodiceFiscale(), jsonFirmatari);
} }
if (!isSigned) { if (!isSigned) {
if (TipoSoggettoUtil.COMMITTENTE.equals(soggetto.getTipologiaSoggetto())) { if (TipoSoggettoUtil.COMMITTENTE.equals(soggetto.getTipologiaSoggetto())) {
SessionErrors.add(actionRequest, SessionErrors.add(actionRequest,
@ -657,31 +303,24 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
throw new SystemException( throw new SystemException(
"error.geniocivilefe.variazione-soggetto.add.file.non.firmato.committente"); "error.geniocivilefe.variazione-soggetto.add.file.non.firmato.committente");
} else { } else {
SessionErrors.add(actionRequest, SessionErrors.add(actionRequest, "error.geniocivilefe.variazione-soggetto.add.file.non.firmato");
"error.geniocivilefe.variazione-soggetto.add.file.non.firmato");
throw new SystemException("error.geniocivilefe.variazione-soggetto.add.file.non.firmato"); throw new SystemException("error.geniocivilefe.variazione-soggetto.add.file.non.firmato");
} }
} }
} catch (Exception e) { } catch (Exception e) {
SessionErrors.add(actionRequest, "error.geniocivilefe.variazione-soggetto"); SessionErrors.add(actionRequest, "error.geniocivilefe.variazione-soggetto");
String redirectURL = ParamUtil.getString(actionRequest, "errorUrl"); String redirectURL = ParamUtil.getString(actionRequest, "errorUrl");
actionResponse.sendRedirect(redirectURL); actionResponse.sendRedirect(redirectURL);
return; return;
} }
long userId = PortalUtil.getUserId(actionRequest); long userId = PortalUtil.getUserId(actionRequest);
try { try {
SoggettoServiceUtil.allegaFileModifica(soggettoId, userId, intPraticaId, content, sourceFileName, SoggettoServiceUtil.allegaFileModifica(soggettoId, userId, intPraticaId, content, sourceFileName,
jsonFirmatari, serviceContext); jsonFirmatari, serviceContext);
String successUrl = ParamUtil.getString(actionRequest, "successUrl"); String successUrl = ParamUtil.getString(actionRequest, "successUrl");
successUrl = HttpUtil.addParameter(successUrl, actionResponse.getNamespace() + "closePopup", successUrl = HttpUtil.addParameter(successUrl, actionResponse.getNamespace() + "closePopup",
String.valueOf(applicaFirma)); String.valueOf(applicaFirma));
actionResponse.sendRedirect(successUrl); actionResponse.sendRedirect(successUrl);
} catch (PortalException e) { } catch (PortalException e) {
_log.error(e, e); _log.error(e, e);
throw e; throw e;
@ -689,24 +328,22 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
} }
@Override @Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
throws IOException, PortletException { PortletException {
String id = resourceRequest.getResourceID(); String id = resourceRequest.getResourceID();
try { try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(resourceRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(resourceRequest);
if ("compilaSoggetti".equals(id)) { if ("compilaSoggetti".equals(id)) {
long userId = ParamUtil.getLong(resourceRequest, "userId", 0l); long userId = ParamUtil.getLong(resourceRequest, "userId", 0L);
String codiceFiscale = ParamUtil.getString(resourceRequest, "codiceFiscale"); String codiceFiscale = ParamUtil.getString(resourceRequest, "codiceFiscale");
String tipologiaSoggetto = ParamUtil.getString(resourceRequest, "tipologiaSoggetto"); String tipologiaSoggetto = ParamUtil.getString(resourceRequest, "tipologiaSoggetto");
JSONArray jsonSoggetti = JSONFactoryUtil.createJSONArray(); JSONArray jsonSoggetti = JSONFactoryUtil.createJSONArray();
if (Validator.isNotNull(userId) && Validator.isNotNull(codiceFiscale) if (Validator.isNotNull(userId) && Validator.isNotNull(codiceFiscale)
&& Validator.isNotNull(tipologiaSoggetto)) { && Validator.isNotNull(tipologiaSoggetto)) {
OrderByComparator orderByComparator = OrderByComparatorFactoryUtil.create( OrderByComparator orderByComparator = OrderByComparatorFactoryUtil.create("portos_bo_soggetto",
"portos_bo_soggetto", "createDate", false); "createDate", false);
List<Soggetto> soggetti = SoggettoLocalServiceUtil List<Soggetto> soggetti = SoggettoLocalServiceUtil.findByUserId_CodiceFiscale_TipologiaSoggetto(
.findByUserId_CodiceFiscale_TipologiaSoggetto(userId, codiceFiscale, userId, codiceFiscale, tipologiaSoggetto, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
tipologiaSoggetto, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
orderByComparator); orderByComparator);
if (soggetti.isEmpty()) { if (soggetti.isEmpty()) {
soggetti = SoggettoLocalServiceUtil.findByUserId_CodiceFiscale(userId, codiceFiscale, soggetti = SoggettoLocalServiceUtil.findByUserId_CodiceFiscale(userId, codiceFiscale,
@ -720,36 +357,28 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
} }
} }
writeJSON(resourceRequest, resourceResponse, jsonSoggetti); writeJSON(resourceRequest, resourceResponse, jsonSoggetti);
} else if ("province".equals(id)) { } else if ("province".equals(id)) {
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
List<Provincia> province = ProvinciaLocalServiceUtil.findAll(QueryUtil.ALL_POS, List<Provincia> province = ProvinciaLocalServiceUtil.findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS,
QueryUtil.ALL_POS,
OrderByComparatorFactoryUtil.create("portos_bo_Provincia", "provincia", true)); OrderByComparatorFactoryUtil.create("portos_bo_Provincia", "provincia", true));
for (Provincia provincia : province) { for (Provincia provincia : province) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("provinciaId", provincia.getCodiceProvincia()); jsonObject.put("provinciaId", provincia.getCodiceProvincia());
jsonObject.put("descLong", provincia.getSigla() + "- " + provincia.getProvincia()); jsonObject.put("descLong", provincia.getSigla() + "- " + provincia.getProvincia());
jsonArray.put(jsonObject); jsonArray.put(jsonObject);
} }
writeJSON(resourceRequest, resourceResponse, jsonArray); writeJSON(resourceRequest, resourceResponse, jsonArray);
} else if ("comuni".equals(id)) { } else if ("comuni".equals(id)) {
String codiceProvincia = ParamUtil.getString(resourceRequest, "provinciaId"); String codiceProvincia = ParamUtil.getString(resourceRequest, "provinciaId");
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
if (Validator.isNotNull(codiceProvincia) && Validator.isNotNull(codiceProvincia)) { if (Validator.isNotNull(codiceProvincia) && Validator.isNotNull(codiceProvincia)) {
List<Comune> comuni = ComuneLocalServiceUtil.findByCompanyIdCodiceProvincia( List<Comune> comuni = ComuneLocalServiceUtil.findByCompanyIdCodiceProvincia(
serviceContext.getCompanyId(), codiceProvincia, QueryUtil.ALL_POS, serviceContext.getCompanyId(), codiceProvincia, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
QueryUtil.ALL_POS,
OrderByComparatorFactoryUtil.create("portos_bo_Comune", "denominazione", true)); OrderByComparatorFactoryUtil.create("portos_bo_Comune", "denominazione", true));
for (Comune comune : comuni) { for (Comune comune : comuni) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("comuneId", comune.getComuneId()); jsonObject.put("comuneId", comune.getComuneId());
jsonObject.put("descLong", comune.getDenominazione()); jsonObject.put("descLong", comune.getDenominazione());
jsonArray.put(jsonObject); jsonArray.put(jsonObject);
} }
} }
@ -762,5 +391,4 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
throw new IOException(e); throw new IOException(e);
} }
} }
} }

3
liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/soggettipratica/edit_soggetto.jsp

@ -51,7 +51,6 @@ String dialogId = ParamUtil.getString(request, "dialogId");
boolean closePopup = ParamUtil.getBoolean(request, "closePopup"); boolean closePopup = ParamUtil.getBoolean(request, "closePopup");
boolean inBO = ParamUtil.getBoolean(request, "inBO"); boolean inBO = ParamUtil.getBoolean(request, "inBO");
%> %>
<liferay-portlet:renderURL var="redirectErrorURL"> <liferay-portlet:renderURL var="redirectErrorURL">
<liferay-portlet:param name="mvcPath" value="/html/soggettipratica/edit_soggetto.jsp" /> <liferay-portlet:param name="mvcPath" value="/html/soggettipratica/edit_soggetto.jsp" />
<liferay-portlet:param name="dettPraticaId" value="<%= String.valueOf(dettPraticaId) %>" /> <liferay-portlet:param name="dettPraticaId" value="<%= String.valueOf(dettPraticaId) %>" />
@ -133,7 +132,7 @@ boolean inBO = ParamUtil.getBoolean(request, "inBO");
Soggetto sogg = soggetti.get(0); Soggetto sogg = soggetti.get(0);
tooltipTile.append("<li>") tooltipTile.append("<li>")
.append(sogg.getNome()) .append(sogg.getNome())
.append(StringPool.BLANK) .append(StringPool.SPACE)
.append(sogg.getCognome()); .append(sogg.getCognome());
} }
tooltipTile.append("<li>"+firma.getCfFirmatario()); tooltipTile.append("<li>"+firma.getCfFirmatario());

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

@ -1,28 +1,27 @@
package it.tref.liferay.portos.firma.util; package it.tref.liferay.portos.firma.util;
import com.fasterxml.jackson.databind.ObjectMapper;
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.model.PortletPreferences;
import com.liferay.portal.service.PortletPreferencesLocalServiceUtil;
import com.liferay.portal.util.PortletKeys;
import com.liferay.portlet.PortletPreferencesFactoryUtil;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity; 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.ContentBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import com.fasterxml.jackson.databind.ObjectMapper;
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.model.PortletPreferences;
import com.liferay.portal.service.PortletPreferencesLocalServiceUtil;
import com.liferay.portal.util.PortletKeys;
import com.liferay.portlet.PortletPreferencesFactoryUtil;
public class FirmaUtil { public class FirmaUtil {
private static final Log _log = LogFactoryUtil.getLog(FirmaUtil.class); private static final Log _log = LogFactoryUtil.getLog(FirmaUtil.class);
@ -33,8 +32,8 @@ public class FirmaUtil {
String preferencesXML; String preferencesXML;
javax.portlet.PortletPreferences jxPortletPreferences = null; javax.portlet.PortletPreferences jxPortletPreferences = null;
try { try {
pr = PortletPreferencesLocalServiceUtil.getPortletPreferences( pr = PortletPreferencesLocalServiceUtil.getPortletPreferences(PortletKeys.PREFS_OWNER_TYPE_COMPANY, 0,
PortletKeys.PREFS_OWNER_TYPE_COMPANY, 0, "firma_WAR_portosfirmaportlet"); "firma_WAR_portosfirmaportlet");
preferencesXML = pr.get(0).getPreferences(); preferencesXML = pr.get(0).getPreferences();
jxPortletPreferences = PortletPreferencesFactoryUtil.fromDefaultXML(preferencesXML); jxPortletPreferences = PortletPreferencesFactoryUtil.fromDefaultXML(preferencesXML);
} catch (SystemException e) { } catch (SystemException e) {
@ -45,44 +44,30 @@ public class FirmaUtil {
} }
public static List<String> getCodiceFiscale(byte[] fileArray, String urlPdfExtractor) { public static List<String> getCodiceFiscale(byte[] fileArray, String urlPdfExtractor) {
List<String> listaCodiciFiscali = null; List<String> listaCodiciFiscali = null;
HttpClient client = null;
try { try {
File file = File.createTempFile("codicefiscale", ".p7m");
FileUtils.writeByteArrayToFile(file, fileArray);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
ContentBody body = new ByteArrayBody(fileArray, "codicefiscale" + (new Date()).getTime() + ".p7m");
// long companyId = CompanyThreadLocal.getCompanyId();
ContentBody body = new FileBody(file);
MultipartEntity entity = new MultipartEntity(); MultipartEntity entity = new MultipartEntity();
entity.addPart("file", body); entity.addPart("file", body);
HttpPost request = new HttpPost(urlPdfExtractor); HttpPost request = new HttpPost(urlPdfExtractor);
request.setEntity(entity); request.setEntity(entity);
client = new DefaultHttpClient();
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(request); HttpResponse response = client.execute(request);
if (response.getStatusLine().getStatusCode() != 200) { if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : " throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
+ response.getStatusLine().getStatusCode());
} }
InputStream inputStream = response.getEntity().getContent(); InputStream inputStream = response.getEntity().getContent();
ExtractorResponse extractorResponse = mapper.readValue(inputStream, ExtractorResponse.class); ExtractorResponse extractorResponse = mapper.readValue(inputStream, ExtractorResponse.class);
if (extractorResponse.isSuccess()) { if (extractorResponse.isSuccess()) {
listaCodiciFiscali = extractorResponse.getCf(); listaCodiciFiscali = extractorResponse.getCf();
} }
} catch (IOException e) { } catch (IOException e) {
_log.error(e.getMessage()); _log.error(e.getMessage());
} finally {
client.getConnectionManager().shutdown();
} }
return listaCodiciFiscali; return listaCodiciFiscali;
} }
} }

207
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java

@ -12,26 +12,6 @@
package it.tref.liferay.portos.mailmanager.util; package it.tref.liferay.portos.mailmanager.util;
import com.liferay.mail.model.FileAttachment;
import com.liferay.mail.service.MailServiceUtil;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayInputStream;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.log.LogUtil;
import com.liferay.portal.kernel.mail.Account;
import com.liferay.portal.kernel.mail.MailMessage;
import com.liferay.portal.kernel.mail.SMTPAccount;
import com.liferay.portal.kernel.util.ArrayUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.InfrastructureUtil;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.util.mail.InternetAddressUtil;
import com.liferay.util.mail.LiferayMimeMessage;
import com.liferay.util.mail.MailEngineException;
import java.io.File; import java.io.File;
import java.net.SocketException; import java.net.SocketException;
import java.util.Arrays; import java.util.Arrays;
@ -55,6 +35,26 @@ import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart; import javax.mail.internet.MimeMultipart;
import com.liferay.mail.model.FileAttachment;
import com.liferay.mail.service.MailServiceUtil;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayInputStream;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.log.LogUtil;
import com.liferay.portal.kernel.mail.Account;
import com.liferay.portal.kernel.mail.MailMessage;
import com.liferay.portal.kernel.mail.SMTPAccount;
import com.liferay.portal.kernel.util.ArrayUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.InfrastructureUtil;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.util.mail.InternetAddressUtil;
import com.liferay.util.mail.LiferayMimeMessage;
import com.liferay.util.mail.MailEngineException;
/** /**
* @author Brian Wing Shun Chan * @author Brian Wing Shun Chan
* @author Brian Myunghun Kim * @author Brian Myunghun Kim
@ -71,46 +71,35 @@ public class MailEngine {
public static Session getSession(Account account) { public static Session getSession(Account account) {
Properties properties = _getProperties(account); Properties properties = _getProperties(account);
Session session = Session.getInstance(properties); Session session = Session.getInstance(properties);
if (_log.isDebugEnabled()) { if (_log.isDebugEnabled()) {
session.setDebug(true); session.setDebug(true);
session.getProperties().list(System.out); session.getProperties().list(System.out);
} }
return session; return session;
} }
public static Session getSession(boolean cache) { public static Session getSession(boolean cache) {
Session session = null; Session session = null;
try { try {
session = MailServiceUtil.getSession(); session = MailServiceUtil.getSession();
} catch (SystemException se) { } catch (SystemException se) {
if (_log.isWarnEnabled()) { if (_log.isWarnEnabled()) {
_log.warn(se, se); _log.warn(se, se);
} }
session = InfrastructureUtil.getMailSession(); session = InfrastructureUtil.getMailSession();
} }
if (_log.isDebugEnabled()) { if (_log.isDebugEnabled()) {
session.setDebug(true); session.setDebug(true);
session.getProperties().list(System.out); session.getProperties().list(System.out);
} }
return session; return session;
} }
public static void send(byte[] bytes) throws MailEngineException { public static void send(byte[] bytes) throws MailEngineException {
try { try {
Session session = getSession(); Session session = getSession();
Message message = new MimeMessage(session, new UnsyncByteArrayInputStream(bytes)); Message message = new MimeMessage(session, new UnsyncByteArrayInputStream(bytes));
_send(session, message, null, _BATCH_SIZE); _send(session, message, null, _BATCH_SIZE);
} catch (Exception e) { } catch (Exception e) {
throw new MailEngineException(e); throw new MailEngineException(e);
@ -119,40 +108,34 @@ public class MailEngine {
public static void send(InternetAddress from, InternetAddress to, String subject, String body) public static void send(InternetAddress from, InternetAddress to, String subject, String body)
throws MailEngineException { throws MailEngineException {
send(from, new InternetAddress[] { to }, null, null, subject, body, false, null, null, null); send(from, new InternetAddress[] { to }, null, null, subject, body, false, null, null, null);
} }
public static void send(InternetAddress from, InternetAddress to, String subject, String body, public static void send(InternetAddress from, InternetAddress to, String subject, String body, boolean htmlFormat)
boolean htmlFormat) throws MailEngineException { throws MailEngineException {
send(from, new InternetAddress[] { to }, null, null, subject, body, htmlFormat, null, null, null); send(from, new InternetAddress[] { to }, null, null, subject, body, htmlFormat, null, null, null);
} }
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
InternetAddress[] bcc, InternetAddress[] bulkAddresses, String subject, String body, InternetAddress[] bulkAddresses, String subject, String body, boolean htmlFormat,
boolean htmlFormat, InternetAddress[] replyTo, String messageId, String inReplyTo) InternetAddress[] replyTo, String messageId, String inReplyTo) throws MailEngineException {
throws MailEngineException {
send(from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, replyTo, messageId, inReplyTo, null); send(from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, replyTo, messageId, inReplyTo, null);
} }
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
InternetAddress[] bcc, InternetAddress[] bulkAddresses, String subject, String body, InternetAddress[] bulkAddresses, String subject, String body, boolean htmlFormat,
boolean htmlFormat, InternetAddress[] replyTo, String messageId, String inReplyTo, InternetAddress[] replyTo, String messageId, String inReplyTo, List<FileAttachment> fileAttachments)
List<FileAttachment> fileAttachments) throws MailEngineException { throws MailEngineException {
send(from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, replyTo, messageId, inReplyTo, send(from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, replyTo, messageId, inReplyTo,
fileAttachments, null); fileAttachments, null);
} }
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
InternetAddress[] bcc, InternetAddress[] bulkAddresses, String subject, String body, InternetAddress[] bulkAddresses, String subject, String body, boolean htmlFormat,
boolean htmlFormat, InternetAddress[] replyTo, String messageId, String inReplyTo, InternetAddress[] replyTo, String messageId, String inReplyTo, List<FileAttachment> fileAttachments,
List<FileAttachment> fileAttachments, SMTPAccount smtpAccount) throws MailEngineException { SMTPAccount smtpAccount) throws MailEngineException {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
if (_log.isDebugEnabled()) { if (_log.isDebugEnabled()) {
_log.debug("From: " + from); _log.debug("From: " + from);
_log.debug("To: " + Arrays.toString(to)); _log.debug("To: " + Arrays.toString(to));
@ -165,132 +148,92 @@ public class MailEngine {
_log.debug("Reply to: " + Arrays.toString(replyTo)); _log.debug("Reply to: " + Arrays.toString(replyTo));
_log.debug("Message ID: " + messageId); _log.debug("Message ID: " + messageId);
_log.debug("In Reply To: " + inReplyTo); _log.debug("In Reply To: " + inReplyTo);
if ((fileAttachments != null) && _log.isDebugEnabled()) { if ((fileAttachments != null) && _log.isDebugEnabled()) {
for (int i = 0; i < fileAttachments.size(); i++) { for (int i = 0; i < fileAttachments.size(); i++) {
FileAttachment fileAttachment = fileAttachments.get(i); FileAttachment fileAttachment = fileAttachments.get(i);
if (fileAttachment instanceof it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) { if (fileAttachment instanceof it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) {
((it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) fileAttachment) ((it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) fileAttachment)
.generateFile(); .generateFile();
} }
File file = fileAttachment.getFile(); File file = fileAttachment.getFile();
if (file == null) { if (file == null) {
continue; continue;
} }
_log.debug("Attachment " + i + " file " + file.getAbsolutePath() + " and file name " _log.debug("Attachment " + i + " file " + file.getAbsolutePath() + " and file name "
+ fileAttachment.getFileName()); + fileAttachment.getFileName());
} }
} }
} }
try { try {
InternetAddressUtil.validateAddress(from); InternetAddressUtil.validateAddress(from);
if (ArrayUtil.isNotEmpty(to)) { if (ArrayUtil.isNotEmpty(to)) {
InternetAddressUtil.validateAddresses(to); InternetAddressUtil.validateAddresses(to);
} }
if (ArrayUtil.isNotEmpty(cc)) { if (ArrayUtil.isNotEmpty(cc)) {
InternetAddressUtil.validateAddresses(cc); InternetAddressUtil.validateAddresses(cc);
} }
if (ArrayUtil.isNotEmpty(bcc)) { if (ArrayUtil.isNotEmpty(bcc)) {
InternetAddressUtil.validateAddresses(bcc); InternetAddressUtil.validateAddresses(bcc);
} }
if (ArrayUtil.isNotEmpty(replyTo)) { if (ArrayUtil.isNotEmpty(replyTo)) {
InternetAddressUtil.validateAddresses(replyTo); InternetAddressUtil.validateAddresses(replyTo);
} }
if (ArrayUtil.isNotEmpty(bulkAddresses)) { if (ArrayUtil.isNotEmpty(bulkAddresses)) {
InternetAddressUtil.validateAddresses(bulkAddresses); InternetAddressUtil.validateAddresses(bulkAddresses);
} }
Session session = null; Session session = null;
if (smtpAccount == null) { if (smtpAccount == null) {
session = getSession(); session = getSession();
} else { } else {
session = getSession(smtpAccount); session = getSession(smtpAccount);
} }
Message message = new LiferayMimeMessage(session); Message message = new LiferayMimeMessage(session);
message.addHeader("X-Auto-Response-Suppress", "AutoReply, DR, NDR, NRN, OOF, RN"); message.addHeader("X-Auto-Response-Suppress", "AutoReply, DR, NDR, NRN, OOF, RN");
message.setFrom(from); message.setFrom(from);
if (ArrayUtil.isNotEmpty(to)) { if (ArrayUtil.isNotEmpty(to)) {
message.setRecipients(Message.RecipientType.TO, to); message.setRecipients(Message.RecipientType.TO, to);
} }
if (ArrayUtil.isNotEmpty(cc)) { if (ArrayUtil.isNotEmpty(cc)) {
message.setRecipients(Message.RecipientType.CC, cc); message.setRecipients(Message.RecipientType.CC, cc);
} }
if (ArrayUtil.isNotEmpty(bcc)) { if (ArrayUtil.isNotEmpty(bcc)) {
message.setRecipients(Message.RecipientType.BCC, bcc); message.setRecipients(Message.RecipientType.BCC, bcc);
} }
subject = GetterUtil.getString(subject); subject = GetterUtil.getString(subject);
message.setSubject(subject); message.setSubject(subject);
if ((fileAttachments != null) && (fileAttachments.size() > 0)) { if ((fileAttachments != null) && (fileAttachments.size() > 0)) {
MimeMultipart rootMultipart = new MimeMultipart(_MULTIPART_TYPE_MIXED); MimeMultipart rootMultipart = new MimeMultipart(_MULTIPART_TYPE_MIXED);
MimeMultipart messageMultipart = new MimeMultipart(_MULTIPART_TYPE_ALTERNATIVE); MimeMultipart messageMultipart = new MimeMultipart(_MULTIPART_TYPE_ALTERNATIVE);
MimeBodyPart messageBodyPart = new MimeBodyPart(); MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(messageMultipart); messageBodyPart.setContent(messageMultipart);
rootMultipart.addBodyPart(messageBodyPart); rootMultipart.addBodyPart(messageBodyPart);
if (htmlFormat) { if (htmlFormat) {
MimeBodyPart bodyPart = new MimeBodyPart(); MimeBodyPart bodyPart = new MimeBodyPart();
bodyPart.setContent(body, _TEXT_HTML); bodyPart.setContent(body, _TEXT_HTML);
messageMultipart.addBodyPart(bodyPart); messageMultipart.addBodyPart(bodyPart);
} else { } else {
MimeBodyPart bodyPart = new MimeBodyPart(); MimeBodyPart bodyPart = new MimeBodyPart();
bodyPart.setText(body); bodyPart.setText(body);
messageMultipart.addBodyPart(bodyPart); messageMultipart.addBodyPart(bodyPart);
} }
for (int i = 0; i < fileAttachments.size(); i++) { for (int i = 0; i < fileAttachments.size(); i++) {
FileAttachment fileAttachment = fileAttachments.get(i); FileAttachment fileAttachment = fileAttachments.get(i);
File file = fileAttachment.getFile(); File file = fileAttachment.getFile();
if (file == null) { if (file == null) {
continue; continue;
} }
MimeBodyPart mimeBodyPart = new MimeBodyPart(); MimeBodyPart mimeBodyPart = new MimeBodyPart();
DataSource dataSource = new FileDataSource(file); DataSource dataSource = new FileDataSource(file);
mimeBodyPart.setDataHandler(new DataHandler(dataSource)); mimeBodyPart.setDataHandler(new DataHandler(dataSource));
mimeBodyPart.setDisposition(Part.ATTACHMENT); mimeBodyPart.setDisposition(Part.ATTACHMENT);
if (fileAttachment.getFileName() != null) { if (fileAttachment.getFileName() != null) {
mimeBodyPart.setFileName(fileAttachment.getFileName()); mimeBodyPart.setFileName(fileAttachment.getFileName());
} else { } else {
mimeBodyPart.setFileName(file.getName()); mimeBodyPart.setFileName(file.getName());
} }
rootMultipart.addBodyPart(mimeBodyPart); rootMultipart.addBodyPart(mimeBodyPart);
} }
message.setContent(rootMultipart); message.setContent(rootMultipart);
message.saveChanges(); message.saveChanges();
} else { } else {
if (htmlFormat) { if (htmlFormat) {
@ -299,80 +242,62 @@ public class MailEngine {
message.setContent(body, _TEXT_PLAIN); message.setContent(body, _TEXT_PLAIN);
} }
} }
message.setSentDate(new Date()); message.setSentDate(new Date());
if (ArrayUtil.isNotEmpty(replyTo)) { if (ArrayUtil.isNotEmpty(replyTo)) {
message.setReplyTo(replyTo); message.setReplyTo(replyTo);
} }
if (messageId != null) { if (messageId != null) {
message.setHeader("Message-ID", messageId); message.setHeader("Message-ID", messageId);
} }
if (inReplyTo != null) { if (inReplyTo != null) {
message.setHeader("In-Reply-To", inReplyTo); message.setHeader("In-Reply-To", inReplyTo);
message.setHeader("References", inReplyTo); message.setHeader("References", inReplyTo);
} }
int batchSize = GetterUtil.getInteger(PropsUtil.get(PropsKeys.MAIL_BATCH_SIZE), _BATCH_SIZE); int batchSize = GetterUtil.getInteger(PropsUtil.get(PropsKeys.MAIL_BATCH_SIZE), _BATCH_SIZE);
_send(session, message, bulkAddresses, batchSize); _send(session, message, bulkAddresses, batchSize);
} catch (SendFailedException sfe) { } catch (SendFailedException sfe) {
_log.error(sfe); _log.error(sfe);
// if (_isThrowsExceptionOnFailure()) {
// throw new MailEngineException(sfe);
// }
throw new MailEngineException(sfe); throw new MailEngineException(sfe);
} catch (Exception e) { } catch (Exception e) {
throw new MailEngineException(e); throw new MailEngineException(e);
} }
if (_log.isDebugEnabled()) { if (_log.isDebugEnabled()) {
_log.debug("Sending mail takes " + (System.currentTimeMillis() - startTime) + " ms"); _log.debug("Sending mail takes " + (System.currentTimeMillis() - startTime) + " ms");
} }
} }
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
InternetAddress[] bcc, String subject, String body) throws MailEngineException { String subject, String body) throws MailEngineException {
send(from, to, cc, bcc, subject, body, false, null, null, null); send(from, to, cc, bcc, subject, body, false, null, null, null);
} }
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
InternetAddress[] bcc, String subject, String body, boolean htmlFormat, String subject, String body, boolean htmlFormat, InternetAddress[] replyTo, String messageId,
InternetAddress[] replyTo, String messageId, String inReplyTo) throws MailEngineException { String inReplyTo) throws MailEngineException {
send(from, to, cc, bcc, null, subject, body, htmlFormat, replyTo, messageId, inReplyTo, null); send(from, to, cc, bcc, null, subject, body, htmlFormat, replyTo, messageId, inReplyTo, null);
} }
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, String subject, public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, String subject,
String body) throws MailEngineException { String body) throws MailEngineException {
send(from, to, cc, null, subject, body, false, null, null, null); send(from, to, cc, null, subject, body, false, null, null, null);
} }
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, String subject, public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, String subject,
String body, boolean htmlFormat) throws MailEngineException { String body, boolean htmlFormat) throws MailEngineException {
send(from, to, cc, null, subject, body, htmlFormat, null, null, null); send(from, to, cc, null, subject, body, htmlFormat, null, null, null);
} }
public static void send(InternetAddress from, InternetAddress[] to, String subject, String body) public static void send(InternetAddress from, InternetAddress[] to, String subject, String body)
throws MailEngineException { throws MailEngineException {
send(from, to, null, null, subject, body, false, null, null, null); send(from, to, null, null, subject, body, false, null, null, null);
} }
public static void send(InternetAddress from, InternetAddress[] to, String subject, String body, public static void send(InternetAddress from, InternetAddress[] to, String subject, String body, boolean htmlFormat)
boolean htmlFormat) throws MailEngineException { throws MailEngineException {
send(from, to, null, null, subject, body, htmlFormat, null, null, null); send(from, to, null, null, subject, body, htmlFormat, null, null, null);
} }
public static void send(MailMessage mailMessage) throws MailEngineException { public static void send(MailMessage mailMessage) throws MailEngineException {
send(mailMessage.getFrom(), mailMessage.getTo(), mailMessage.getCC(), mailMessage.getBCC(), send(mailMessage.getFrom(), mailMessage.getTo(), mailMessage.getCC(), mailMessage.getBCC(),
mailMessage.getBulkAddresses(), mailMessage.getSubject(), mailMessage.getBody(), mailMessage.getBulkAddresses(), mailMessage.getSubject(), mailMessage.getBody(),
mailMessage.isHTMLFormat(), mailMessage.getReplyTo(), mailMessage.getMessageId(), mailMessage.isHTMLFormat(), mailMessage.getReplyTo(), mailMessage.getMessageId(),
@ -380,7 +305,6 @@ public class MailEngine {
} }
public static void send(String from, String to, String subject, String body) throws MailEngineException { public static void send(String from, String to, String subject, String body) throws MailEngineException {
try { try {
send(new InternetAddress(from), new InternetAddress(to), subject, body); send(new InternetAddress(from), new InternetAddress(to), subject, body);
} catch (AddressException ae) { } catch (AddressException ae) {
@ -389,57 +313,43 @@ public class MailEngine {
} }
private static Address[] _getBatchAddresses(Address[] addresses, int index, int batchSize) { private static Address[] _getBatchAddresses(Address[] addresses, int index, int batchSize) {
if ((batchSize == _BATCH_SIZE) && (index == 0)) { if ((batchSize == _BATCH_SIZE) && (index == 0)) {
return addresses; return addresses;
} else if (batchSize == _BATCH_SIZE) { } else if (batchSize == _BATCH_SIZE) {
return null; return null;
} }
int start = index * batchSize; int start = index * batchSize;
if (start > addresses.length) { if (start > addresses.length) {
return null; return null;
} }
int end = ((index + 1) * batchSize); int end = ((index + 1) * batchSize);
if (end > addresses.length) { if (end > addresses.length) {
end = addresses.length; end = addresses.length;
} }
return ArrayUtil.subset(addresses, start, end); return ArrayUtil.subset(addresses, start, end);
} }
private static Properties _getProperties(Account account) { private static Properties _getProperties(Account account) {
Properties properties = new Properties(); Properties properties = new Properties();
String protocol = account.getProtocol(); String protocol = account.getProtocol();
properties.setProperty("mail.transport.protocol", protocol); properties.setProperty("mail.transport.protocol", protocol);
properties.setProperty("mail." + protocol + ".host", account.getHost()); properties.setProperty("mail." + protocol + ".host", account.getHost());
properties.setProperty("mail." + protocol + ".port", String.valueOf(account.getPort())); properties.setProperty("mail." + protocol + ".port", String.valueOf(account.getPort()));
if (account.isRequiresAuthentication()) { if (account.isRequiresAuthentication()) {
properties.setProperty("mail." + protocol + ".auth", "true"); properties.setProperty("mail." + protocol + ".auth", "true");
properties.setProperty("mail." + protocol + ".user", account.getUser()); properties.setProperty("mail." + protocol + ".user", account.getUser());
properties.setProperty("mail." + protocol + ".password", account.getPassword()); properties.setProperty("mail." + protocol + ".password", account.getPassword());
} }
if (account.isSecure()) { if (account.isSecure()) {
properties.setProperty("mail." + protocol + ".socketFactory.class", properties.setProperty("mail." + protocol + ".socketFactory.class", "javax.net.ssl.SSLSocketFactory");
"javax.net.ssl.SSLSocketFactory");
properties.setProperty("mail." + protocol + ".socketFactory.fallback", "false"); properties.setProperty("mail." + protocol + ".socketFactory.fallback", "false");
properties.setProperty("mail." + protocol + ".socketFactory.port", properties.setProperty("mail." + protocol + ".socketFactory.port", String.valueOf(account.getPort()));
String.valueOf(account.getPort()));
} }
return properties; return properties;
} }
private static String _getSMTPProperty(Session session, String suffix) { private static String _getSMTPProperty(Session session, String suffix) {
String protocol = GetterUtil.getString(session.getProperty("mail.transport.protocol")); String protocol = GetterUtil.getString(session.getProperty("mail.transport.protocol"));
if (protocol.equals(Account.PROTOCOL_SMTPS)) { if (protocol.equals(Account.PROTOCOL_SMTPS)) {
return session.getProperty("mail.smtps." + suffix); return session.getProperty("mail.smtps." + suffix);
} else { } else {
@ -447,60 +357,40 @@ public class MailEngine {
} }
} }
// private static boolean _isThrowsExceptionOnFailure() {
// return
// GetterUtil.getBoolean(PropsUtil.get(PropsKeys.MAIL_THROWS_EXCEPTION_ON_FAILURE));
// }
private static void _send(Session session, Message message, InternetAddress[] bulkAddresses, int batchSize) private static void _send(Session session, Message message, InternetAddress[] bulkAddresses, int batchSize)
throws MailEngineException { throws MailEngineException {
try { try {
boolean smtpAuth = GetterUtil.getBoolean(_getSMTPProperty(session, "auth"), false); boolean smtpAuth = GetterUtil.getBoolean(_getSMTPProperty(session, "auth"), false);
String smtpHost = _getSMTPProperty(session, "host"); String smtpHost = _getSMTPProperty(session, "host");
int smtpPort = GetterUtil.getInteger(_getSMTPProperty(session, "port"), Account.PORT_SMTP); int smtpPort = GetterUtil.getInteger(_getSMTPProperty(session, "port"), Account.PORT_SMTP);
String user = _getSMTPProperty(session, "user"); String user = _getSMTPProperty(session, "user");
String password = _getSMTPProperty(session, "password"); String password = _getSMTPProperty(session, "password");
if (smtpAuth && Validator.isNotNull(user) && Validator.isNotNull(password)) { if (smtpAuth && Validator.isNotNull(user) && Validator.isNotNull(password)) {
String protocol = GetterUtil.getString(session.getProperty("mail.transport.protocol"), String protocol = GetterUtil.getString(session.getProperty("mail.transport.protocol"),
Account.PROTOCOL_SMTP); Account.PROTOCOL_SMTP);
Transport transport = session.getTransport(protocol); Transport transport = session.getTransport(protocol);
transport.connect(smtpHost, smtpPort, user, password); transport.connect(smtpHost, smtpPort, user, password);
Address[] addresses = null; Address[] addresses = null;
if (ArrayUtil.isNotEmpty(bulkAddresses)) { if (ArrayUtil.isNotEmpty(bulkAddresses)) {
addresses = bulkAddresses; addresses = bulkAddresses;
} else { } else {
addresses = message.getAllRecipients(); addresses = message.getAllRecipients();
} }
for (int i = 0;; i++) { for (int i = 0;; i++) {
Address[] batchAddresses = _getBatchAddresses(addresses, i, batchSize); Address[] batchAddresses = _getBatchAddresses(addresses, i, batchSize);
if (ArrayUtil.isEmpty(batchAddresses)) { if (ArrayUtil.isEmpty(batchAddresses)) {
break; break;
} }
transport.sendMessage(message, batchAddresses); transport.sendMessage(message, batchAddresses);
} }
transport.close(); transport.close();
} else { } else {
if (ArrayUtil.isNotEmpty(bulkAddresses)) { if (ArrayUtil.isNotEmpty(bulkAddresses)) {
int curBatch = 0; int curBatch = 0;
Address[] portion = _getBatchAddresses(bulkAddresses, curBatch, batchSize); Address[] portion = _getBatchAddresses(bulkAddresses, curBatch, batchSize);
while (ArrayUtil.isNotEmpty(portion)) { while (ArrayUtil.isNotEmpty(portion)) {
Transport.send(message, portion); Transport.send(message, portion);
curBatch++; curBatch++;
portion = _getBatchAddresses(bulkAddresses, curBatch, batchSize); portion = _getBatchAddresses(bulkAddresses, curBatch, batchSize);
} }
} else { } else {
@ -516,25 +406,14 @@ public class MailEngine {
} else { } else {
LogUtil.log(_log, me); LogUtil.log(_log, me);
} }
// if (_isThrowsExceptionOnFailure()) {
// throw new MailEngineException(me);
// }
throw new MailEngineException(me); throw new MailEngineException(me);
} }
} }
private static final int _BATCH_SIZE = 0; private static final int _BATCH_SIZE = 0;
private static final String _MULTIPART_TYPE_ALTERNATIVE = "alternative"; private static final String _MULTIPART_TYPE_ALTERNATIVE = "alternative";
private static final String _MULTIPART_TYPE_MIXED = "mixed"; private static final String _MULTIPART_TYPE_MIXED = "mixed";
private static final String _TEXT_HTML = "text/html;charset=\"UTF-8\""; private static final String _TEXT_HTML = "text/html;charset=\"UTF-8\"";
private static final String _TEXT_PLAIN = "text/plain;charset=\"UTF-8\""; private static final String _TEXT_PLAIN = "text/plain;charset=\"UTF-8\"";
private static final Log _log = LogFactoryUtil.getLog(MailEngine.class);
private static Log _log = LogFactoryUtil.getLog(MailEngine.class);
} }

63
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailSenderUtil.java

@ -1,19 +1,5 @@
package it.tref.liferay.portos.mailmanager.util; package it.tref.liferay.portos.mailmanager.util;
import com.liferay.mail.model.FileAttachment;
import com.liferay.portal.kernel.exception.PortalException;
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.mail.Account;
import com.liferay.portal.kernel.mail.SMTPAccount;
import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.StreamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
import it.tref.liferay.portos.mailmanager.model.Email; import it.tref.liferay.portos.mailmanager.model.Email;
import it.tref.liferay.portos.mailmanager.model.EmailAttachment; import it.tref.liferay.portos.mailmanager.model.EmailAttachment;
@ -28,54 +14,55 @@ import javax.mail.internet.InternetAddress;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import com.liferay.mail.model.FileAttachment;
import com.liferay.portal.kernel.exception.PortalException;
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.mail.Account;
import com.liferay.portal.kernel.mail.SMTPAccount;
import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.StreamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
public class MailSenderUtil { public class MailSenderUtil {
private static final Log _log = LogFactoryUtil.getLog(MailSenderUtil.class); private static final Log _log = LogFactoryUtil.getLog(MailSenderUtil.class);
public static void sendMail(Email email) throws Exception { public static void sendMail(Email email) throws Exception {
_log.info("sendMail to: " + StringUtils.join(email.getToArray(), ", ")); _log.info("sendMail to: " + StringUtils.join(email.getToArray(), ", "));
InternetAddress from = toInternetAddress(email.getFrom()); InternetAddress from = toInternetAddress(email.getFrom());
InternetAddress[] to = toInternetAddresses(email.getToArray()); InternetAddress[] to = toInternetAddresses(email.getToArray());
InternetAddress[] cc = toInternetAddresses(email.getCcArray()); InternetAddress[] cc = toInternetAddresses(email.getCcArray());
InternetAddress[] bcc = toInternetAddresses(email.getBccArray()); InternetAddress[] bcc = toInternetAddresses(email.getBccArray());
InternetAddress[] bulAddresses = toInternetAddresses(email.getBulkAddressesArray()); InternetAddress[] bulAddresses = toInternetAddresses(email.getBulkAddressesArray());
String subject = email.getSubject(); String subject = email.getSubject();
String body = email.getBody(); String body = email.getBody();
boolean htmlFormat = email.isHtmlFormat(); boolean htmlFormat = email.isHtmlFormat();
InternetAddress[] replyTo = toInternetAddresses(email.getReplyToArray()); InternetAddress[] replyTo = toInternetAddresses(email.getReplyToArray());
String messageId = email.getMessageId(); String messageId = email.getMessageId();
String inReplyTo = email.getInReplyTo(); String inReplyTo = email.getInReplyTo();
List<EmailAttachment> emailAttachments = email.getEmailAttachments(); List<EmailAttachment> emailAttachments = email.getEmailAttachments();
List<FileAttachment> fileAttachments = toFileAttachments(emailAttachments); List<FileAttachment> fileAttachments = toFileAttachments(emailAttachments);
try { try {
SMTPAccount smtpAccount = null; SMTPAccount smtpAccount = null;
if (Validator.isNotNull(email.getSmtpHost())) { if (Validator.isNotNull(email.getSmtpHost())) {
String protocol = Account.PROTOCOL_SMTP; String protocol = Account.PROTOCOL_SMTP;
if (email.getSmtpHost().startsWith(Account.PROTOCOL_SMTPS)) { if (email.getSmtpHost().startsWith(Account.PROTOCOL_SMTPS)) {
protocol = Account.PROTOCOL_SMTPS; protocol = Account.PROTOCOL_SMTPS;
} }
smtpAccount = (SMTPAccount) SMTPAccount.getInstance(protocol, email.getSmtpPort()); smtpAccount = (SMTPAccount) SMTPAccount.getInstance(protocol, email.getSmtpPort());
if (email.isSmtpSecure()) { if (email.isSmtpSecure()) {
smtpAccount.setUser(email.getSmtpUsername()); smtpAccount.setUser(email.getSmtpUsername());
smtpAccount.setPassword(email.getSmtpPassword()); smtpAccount.setPassword(email.getSmtpPassword());
} }
} }
MailEngine.send(from, to, cc, bcc, bulAddresses, subject, body, htmlFormat, replyTo, messageId, MailEngine.send(from, to, cc, bcc, bulAddresses, subject, body, htmlFormat, replyTo, messageId,
inReplyTo, fileAttachments, smtpAccount); inReplyTo, fileAttachments, smtpAccount);
} finally { } finally {
for (FileAttachment fileAttachment : fileAttachments) { for (FileAttachment fileAttachment : fileAttachments) {
FileUtil.delete(fileAttachment.getFile()); FileUtil.delete(fileAttachment.getFile());
} }
@ -83,51 +70,43 @@ public class MailSenderUtil {
} }
private static InternetAddress toInternetAddress(String address) throws AddressException { private static InternetAddress toInternetAddress(String address) throws AddressException {
if (Validator.isNotNull(address)) { if (Validator.isNull(address)) {
return new InternetAddress(address);
}
return null; return null;
} }
return new InternetAddress(address);
}
private static InternetAddress[] toInternetAddresses(String[] addresses) throws AddressException { private static InternetAddress[] toInternetAddresses(String[] addresses) throws AddressException {
if (addresses != null && addresses.length > 0) { if (addresses == null || addresses.length == 0) {
return null;
}
InternetAddress[] internetAddresses = new InternetAddress[addresses.length]; InternetAddress[] internetAddresses = new InternetAddress[addresses.length];
for (int i = 0; i < addresses.length; i++) { for (int i = 0; i < addresses.length; i++) {
internetAddresses[i] = new InternetAddress(addresses[i]); internetAddresses[i] = new InternetAddress(addresses[i]);
} }
return internetAddresses; return internetAddresses;
} }
return null;
}
private static List<FileAttachment> toFileAttachments(List<EmailAttachment> emailAttachments) private static List<FileAttachment> toFileAttachments(List<EmailAttachment> emailAttachments)
throws PortalException, SystemException, IOException { throws PortalException, SystemException, IOException {
List<FileAttachment> fileAttachments = new ArrayList<>(emailAttachments.size());
List<FileAttachment> fileAttachments = new ArrayList<FileAttachment>(emailAttachments.size());
for (EmailAttachment emailAttachment : emailAttachments) { for (EmailAttachment emailAttachment : emailAttachments) {
InputStream inputStream = null; InputStream inputStream = null;
try { try {
FileEntry fileEntry = emailAttachment.getFileEntry(); FileEntry fileEntry = emailAttachment.getFileEntry();
inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(),
fileEntry.getVersion(), false); fileEntry.getVersion(), false);
File file = FileUtil.createTempFile(inputStream); File file = FileUtil.createTempFile(inputStream);
String fileName = fileEntry.getTitle(); String fileName = fileEntry.getTitle();
String extension = FileUtil.getExtension(fileName); String extension = FileUtil.getExtension(fileName);
if (Validator.isNull(extension) && Validator.isNotNull(fileEntry.getExtension())) { if (Validator.isNull(extension) && Validator.isNotNull(fileEntry.getExtension())) {
fileName += StringPool.PERIOD + fileEntry.getExtension(); fileName += StringPool.PERIOD + fileEntry.getExtension();
} }
fileAttachments.add(new FileAttachment(file, fileName)); fileAttachments.add(new FileAttachment(file, fileName));
} finally { } finally {
StreamUtil.cleanUp(inputStream); StreamUtil.cleanUp(inputStream);
} }
} }
return fileAttachments; return fileAttachments;
} }
} }

44
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.ReportDto;
import it.tref.liferay.portos.report.shared.dto.ReportResultDto; import it.tref.liferay.portos.report.shared.dto.ReportResultDto;
import java.io.File; import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable; import java.io.Serializable;
import java.nio.file.Files;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -40,7 +37,6 @@ import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.util.ArrayUtil; import com.liferay.portal.kernel.util.ArrayUtil;
import com.liferay.portal.kernel.util.MapUtil; import com.liferay.portal.kernel.util.MapUtil;
import com.liferay.portal.kernel.util.StringPool; 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.kernel.util.Validator;
import com.liferay.portal.model.Company; import com.liferay.portal.model.Company;
import com.liferay.portal.model.RoleConstants; import com.liferay.portal.model.RoleConstants;
@ -56,6 +52,7 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
public class ProtocolloMessageListener extends BaseMessageListener { public class ProtocolloMessageListener extends BaseMessageListener {
private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
private static final Log _log = LogFactoryUtil.getLog(ProtocolloMessageListener.class); private static final Log _log = LogFactoryUtil.getLog(ProtocolloMessageListener.class);
@ -93,22 +90,13 @@ public class ProtocolloMessageListener extends BaseMessageListener {
long fileEntryId = reportDto.getFileEntryIds()[0]; long fileEntryId = reportDto.getFileEntryIds()[0];
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId); FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId);
if (Validator.isNotNull(fileEntry)) { if (Validator.isNotNull(fileEntry)) {
InputStream is = fileEntry.getContentStream(); InputStream inputStream = fileEntry.getContentStream();
byte[] targetArray = new byte[is.available()]; byte[] inputBytes = new byte[inputStream.available()];
is.read(targetArray); inputStream.read(inputBytes);
String tempFileNameCopy = System.getProperty(SystemProperties.TMP_DIR) + File.separator inputStream.close();
+ "copied-files" + System.currentTimeMillis() + ".pdf"; ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
File tempFileCopy = new File(tempFileNameCopy); PdfReader reader = new PdfReader(inputBytes);
OutputStream outStreamCopiedFile = new FileOutputStream(tempFileCopy); PdfStamper stamper = new PdfStamper(reader, outputStream);
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);
PdfWriter writer = stamper.getWriter(); PdfWriter writer = stamper.getWriter();
for (int i = 1; i <= reader.getNumberOfPages(); i++) { for (int i = 1; i <= reader.getNumberOfPages(); i++) {
PdfContentByte cb = stamper.getOverContent(i); PdfContentByte cb = stamper.getOverContent(i);
@ -139,30 +127,23 @@ public class ProtocolloMessageListener extends BaseMessageListener {
} }
stamper.close(); stamper.close();
reader.close(); reader.close();
byte[] outputBytes = outputStream.toByteArray();
outputStream.close();
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setUserId(userId); serviceContext.setUserId(userId);
serviceContext.setCompanyId(companyId); serviceContext.setCompanyId(companyId);
byte[] newFilesBytes = Files.readAllBytes(tempFileModified.toPath());
fileOutputStream.close();
tempFileCopy.delete();
tempFileModified.delete();
FileEntry newFileEntry = null; FileEntry newFileEntry = null;
try { try {
newFileEntry = DLAppLocalServiceUtil.addFileEntry(userId, fileEntry.getRepositoryId(), newFileEntry = DLAppLocalServiceUtil.addFileEntry(userId, fileEntry.getRepositoryId(),
fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", "application/pdf", fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", "application/pdf",
reportDto.getFileName(), "", "", newFilesBytes, serviceContext); reportDto.getFileName(), StringPool.BLANK, StringPool.BLANK, outputBytes, serviceContext);
} catch (DuplicateFileException e) { } catch (DuplicateFileException e) {
FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), fileEntry.getFolderId(), FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), fileEntry.getFolderId(),
reportDto.getFileName()); reportDto.getFileName());
// DLAppLocalServiceUtil.deleteFileEntry(fe.getFileEntryId());
_log.info("File duplicato : " + fe.getFileEntryId()); _log.info("File duplicato : " + fe.getFileEntryId());
return; return;
} }
tempFileCopy.delete();
tempFileModified.delete();
if (Validator.isNotNull(newFileEntry)) { if (Validator.isNotNull(newFileEntry)) {
long[] fileEntryIds = new long[0]; long[] fileEntryIds = new long[0];
fileEntryIds = ArrayUtil.append(fileEntryIds, newFileEntry.getFileEntryId()); fileEntryIds = ArrayUtil.append(fileEntryIds, newFileEntry.getFileEntryId());
@ -185,7 +166,6 @@ public class ProtocolloMessageListener extends BaseMessageListener {
private String finalizzaProtocollazione(long companyId, String protocollo, Date dtProtocollo) private String finalizzaProtocollazione(long companyId, String protocollo, Date dtProtocollo)
throws SystemException { throws SystemException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Company company = CompanyLocalServiceUtil.fetchCompany(companyId); Company company = CompanyLocalServiceUtil.fetchCompany(companyId);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append((String) company.getExpandoBridge().getAttribute( sb.append((String) company.getExpandoBridge().getAttribute(

18
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/modellistener/shared/core/ModelListenerHotDeployListener.java

@ -1,12 +1,12 @@
package it.tref.liferay.portos.bo.modellistener.shared.core; package it.tref.liferay.portos.bo.modellistener.shared.core;
import it.tref.liferay.portos.bo.modellistener.shared.model.ModelListenerWrapper;
import com.liferay.portal.kernel.messaging.BaseMessageListener; import com.liferay.portal.kernel.messaging.BaseMessageListener;
import com.liferay.portal.kernel.messaging.DestinationNames; import com.liferay.portal.kernel.messaging.DestinationNames;
import com.liferay.portal.kernel.messaging.Message; import com.liferay.portal.kernel.messaging.Message;
import com.liferay.portal.kernel.messaging.MessageBusUtil; import com.liferay.portal.kernel.messaging.MessageBusUtil;
import it.tref.liferay.portos.bo.modellistener.shared.model.ModelListenerWrapper;
public class ModelListenerHotDeployListener extends BaseMessageListener { public class ModelListenerHotDeployListener extends BaseMessageListener {
private String currentContextName; private String currentContextName;
@ -19,33 +19,19 @@ public class ModelListenerHotDeployListener extends BaseMessageListener {
@Override @Override
protected void doReceive(Message message) throws Exception { protected void doReceive(Message message) throws Exception {
String command = message.getString("command"); String command = message.getString("command");
String servletContextName = message.getString("servletContextName"); String servletContextName = message.getString("servletContextName");
if (command.equals("deploy")) { if (command.equals("deploy")) {
for (int i = 0; modelListenerWrappers != null && i < modelListenerWrappers.length; i++) { for (int i = 0; modelListenerWrappers != null && i < modelListenerWrappers.length; i++) {
if (servletContextName.equals(modelListenerWrappers[i].getServletContextName())) { if (servletContextName.equals(modelListenerWrappers[i].getServletContextName())) {
ModelListenerUtil.registerModelListener(modelListenerWrappers[i]); ModelListenerUtil.registerModelListener(modelListenerWrappers[i]);
// _log.info("[" + servletContextName + "/" + command + "]" + "Sto registrando il wrapper
// "
// + modelListenerWrappers[i].getModelClassName() + " - "
// + modelListenerWrappers[i].getServletContextName());
} }
} }
} else if (command.equals("undeploy")) { } else if (command.equals("undeploy")) {
if (servletContextName.equals(currentContextName)) { if (servletContextName.equals(currentContextName)) {
ModelListenerUtil.unregisterModelListeners(); ModelListenerUtil.unregisterModelListeners();
// _log.info("[" + servletContextName + "/" + command + "]" + "Sto effettuando undeploy ");
MessageBusUtil.unregisterMessageListener(DestinationNames.HOT_DEPLOY, this); MessageBusUtil.unregisterMessageListener(DestinationNames.HOT_DEPLOY, this);
} }
} }
} }
// private final static Log _log = LogFactoryUtil.getLog(ModelListenerHotDeployListener.class);
} }

61
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/modellistener/shared/core/ModelListenerInvocationHandler.java

@ -27,10 +27,6 @@ public class ModelListenerInvocationHandler implements InvocationHandler {
@Override @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
/**
* @see com.liferay.portal.kernel.bean.ClassLoaderBeanHandler
*/
if (method.getDeclaringClass() == Object.class) { if (method.getDeclaringClass() == Object.class) {
String methodName = method.getName(); String methodName = method.getName();
@ -42,85 +38,60 @@ public class ModelListenerInvocationHandler implements InvocationHandler {
} }
} }
} }
// _log.info("invocato il metodo " + method.getName());
if (ArrayUtil.contains(MODEL_METHOD_NAMES, method.getName())) { if (ArrayUtil.contains(MODEL_METHOD_NAMES, method.getName())) {
try { try {
BaseModel<?> baseModel = (BaseModel<?>) args[0]; BaseModel<?> baseModel = (BaseModel<?>) args[0];
Serializable primaryKeyObj = baseModel.getPrimaryKeyObj(); Serializable primaryKeyObj = baseModel.getPrimaryKeyObj();
Class<?> primaryKeyObjClass = primaryKeyObj.getClass(); Class<?> primaryKeyObjClass = primaryKeyObj.getClass();
ClassLoader classLoader = modelListener.getClass().getClassLoader(); ClassLoader classLoader = modelListener.getClass().getClassLoader();
String modelClassName = baseModel.getModelClassName(); String modelClassName = baseModel.getModelClassName();
String modelName = modelClassName.substring(modelClassName.lastIndexOf(".") + 1); String modelName = modelClassName.substring(modelClassName.lastIndexOf(".") + 1);
String localServiceUtilClassName = String localServiceUtilClassName = StringUtil.replace(modelClassName, ".model.", ".service.")
StringUtil.replace(modelClassName, ".model.", ".service.") + "LocalServiceUtil"; + "LocalServiceUtil";
String createMethodName = "create" + modelName; String createMethodName = "create" + modelName;
// _log.info("localServiceUtilClassName " + localServiceUtilClassName);
Class<?> localServiceUtilClass = ClassResolverUtil.resolve(localServiceUtilClassName, classLoader); Class<?> localServiceUtilClass = ClassResolverUtil.resolve(localServiceUtilClassName, classLoader);
boolean isSimpleColumnType = isSimpleColumnType(primaryKeyObjClass); boolean isSimpleColumnType = isSimpleColumnType(primaryKeyObjClass);
if (isSimpleColumnType) { if (isSimpleColumnType) {
try { try {
args[0] = ReflectionUtil args[0] = ReflectionUtil.getDeclaredMethod(localServiceUtilClass, createMethodName,
.getDeclaredMethod(localServiceUtilClass, createMethodName, toPrimitive(primaryKeyObjClass)) toPrimitive(primaryKeyObjClass)).invoke(null, primaryKeyObj);
.invoke(null, primaryKeyObj);
} catch (Exception e) { } catch (Exception e) {
args[0] = ReflectionUtil.getDeclaredMethod(localServiceUtilClass, createMethodName, primaryKeyObjClass) args[0] = ReflectionUtil.getDeclaredMethod(localServiceUtilClass, createMethodName,
.invoke(null, primaryKeyObj); primaryKeyObjClass).invoke(null, primaryKeyObj);
} }
} else { } else {
List<Class<?>> parameterTypes = new ArrayList<Class<?>>(); List<Class<?>> parameterTypes = new ArrayList<Class<?>>();
List<Object> arguments = new ArrayList<Object>(); List<Object> arguments = new ArrayList<Object>();
Field[] fields = primaryKeyObjClass.getFields(); Field[] fields = primaryKeyObjClass.getFields();
for (Field field : fields) { for (Field field : fields) {
// public fields -> [entity-name]PK // public fields -> [entity-name]PK
parameterTypes.add(field.getType()); parameterTypes.add(field.getType());
arguments.add(field.get(primaryKeyObj)); arguments.add(field.get(primaryKeyObj));
} }
try { try {
// custom method // custom method
args[0] = ReflectionUtil args[0] = ReflectionUtil.getDeclaredMethod(localServiceUtilClass, createMethodName,
.getDeclaredMethod(localServiceUtilClass, createMethodName, parameterTypes.toArray(new Class<?>[parameterTypes.size()])).invoke(null,
parameterTypes.toArray(new Class<?>[parameterTypes.size()])) arguments.toArray(new Object[arguments.size()]));
.invoke(null, arguments.toArray(new Object[arguments.size()]));
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new ClassNotFoundException(); throw new ClassNotFoundException();
} }
} }
ReflectionUtil.getDeclaredMethod(args[0].getClass(), "setModelAttributes", Map.class).invoke(args[0], ReflectionUtil.getDeclaredMethod(args[0].getClass(), "setModelAttributes", Map.class).invoke(args[0],
baseModel.getModelAttributes()); baseModel.getModelAttributes());
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
// plugin is not related to other plugin // plugin is not related to other plugin
} }
} }
Thread currentThread = Thread.currentThread(); Thread currentThread = Thread.currentThread();
ClassLoader contextClassLoader = currentThread.getContextClassLoader(); ClassLoader contextClassLoader = currentThread.getContextClassLoader();
ClassLoader classLoader = modelListener.getClass().getClassLoader(); ClassLoader classLoader = modelListener.getClass().getClassLoader();
try { try {
if (classLoader != contextClassLoader) { if (classLoader != contextClassLoader) {
currentThread.setContextClassLoader(classLoader); currentThread.setContextClassLoader(classLoader);
} }
return ReflectionUtil.getDeclaredMethod(modelListener.getClass(), method.getName(),
return ReflectionUtil.getDeclaredMethod(modelListener.getClass(), method.getName(), method.getParameterTypes()) method.getParameterTypes()).invoke(modelListener, args);
.invoke(modelListener, args);
} finally { } finally {
if (classLoader != contextClassLoader) { if (classLoader != contextClassLoader) {
currentThread.setContextClassLoader(contextClassLoader); currentThread.setContextClassLoader(contextClassLoader);
@ -129,7 +100,6 @@ public class ModelListenerInvocationHandler implements InvocationHandler {
} }
private Class<?> toPrimitive(Class<?> clazz) { private Class<?> toPrimitive(Class<?> clazz) {
if (clazz.equals(Long.class)) { if (clazz.equals(Long.class)) {
return long.class; return long.class;
} else if (clazz.equals(Integer.class)) { } else if (clazz.equals(Integer.class)) {
@ -148,7 +118,6 @@ public class ModelListenerInvocationHandler implements InvocationHandler {
} }
private boolean isSimpleColumnType(Class<?> clazz) { private boolean isSimpleColumnType(Class<?> clazz) {
if (clazz.equals(Long.class)) { if (clazz.equals(Long.class)) {
return true; return true;
} else if (clazz.equals(Integer.class)) { } else if (clazz.equals(Integer.class)) {
@ -166,13 +135,9 @@ public class ModelListenerInvocationHandler implements InvocationHandler {
} else if (clazz.equals(Blob.class)) { } else if (clazz.equals(Blob.class)) {
return true; return true;
} }
return false; return false;
} }
private final static String[] MODEL_METHOD_NAMES = private final static String[] MODEL_METHOD_NAMES = { "onAfterCreate", "onAfterRemove", "onAfterUpdate",
{"onAfterCreate", "onAfterRemove", "onAfterUpdate", "onBeforeCreate", "onBeforeRemove", "onBeforeUpdate"}; "onBeforeCreate", "onBeforeRemove", "onBeforeUpdate" };
// private final static Log _log = LogFactoryUtil.getLog(ModelListenerHotDeployListener.class);
} }

10
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/modellistener/shared/core/ModelListenerPool.java

@ -13,9 +13,7 @@ public class ModelListenerPool {
protected static void register(String servletContextName, String modelClassName, protected static void register(String servletContextName, String modelClassName,
ModelListener<BaseModel<?>> modelListener) { ModelListener<BaseModel<?>> modelListener) {
_servletContextNameMap.put(modelClassName, servletContextName); _servletContextNameMap.put(modelClassName, servletContextName);
if (!_modelListenersMap.containsKey(modelClassName)) { if (!_modelListenersMap.containsKey(modelClassName)) {
_modelListenersMap.put(modelClassName, new ArrayList<ModelListener<BaseModel<?>>>()); _modelListenersMap.put(modelClassName, new ArrayList<ModelListener<BaseModel<?>>>());
} }
@ -23,29 +21,23 @@ public class ModelListenerPool {
} }
protected static void unregister(String modelClassName) { protected static void unregister(String modelClassName) {
_servletContextNameMap.remove(modelClassName); _servletContextNameMap.remove(modelClassName);
_modelListenersMap.remove(modelClassName); _modelListenersMap.remove(modelClassName);
} }
protected static Set<String> getModelClassNames() { protected static Set<String> getModelClassNames() {
return _modelListenersMap.keySet(); return _modelListenersMap.keySet();
} }
protected static List<ModelListener<BaseModel<?>>> getModelListeners(String modelClassName) { protected static List<ModelListener<BaseModel<?>>> getModelListeners(String modelClassName) {
return _modelListenersMap.get(modelClassName); return _modelListenersMap.get(modelClassName);
} }
protected static String getServletContextName(String modelClassName) { protected static String getServletContextName(String modelClassName) {
return _servletContextNameMap.get(modelClassName); return _servletContextNameMap.get(modelClassName);
} }
private final static Map<String, List<ModelListener<BaseModel<?>>>> _modelListenersMap = private final static Map<String, List<ModelListener<BaseModel<?>>>> _modelListenersMap = new ConcurrentHashMap<String, List<ModelListener<BaseModel<?>>>>();
new ConcurrentHashMap<String, List<ModelListener<BaseModel<?>>>>();
private final static Map<String, String> _servletContextNameMap = new ConcurrentHashMap<String, String>(); private final static Map<String, String> _servletContextNameMap = new ConcurrentHashMap<String, String>();
} }

11
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/modellistener/shared/event/ModelListenerStartupAction.java

@ -15,25 +15,18 @@ public abstract class ModelListenerStartupAction extends SimpleAction {
@Override @Override
public void run(String[] ids) throws ActionException { public void run(String[] ids) throws ActionException {
Thread thread = Thread.currentThread(); Thread thread = Thread.currentThread();
ClassLoader currentClassLoader = thread.getContextClassLoader(); ClassLoader currentClassLoader = thread.getContextClassLoader();
String currentContextName = ClassLoaderPool.getContextName(currentClassLoader); String currentContextName = ClassLoaderPool.getContextName(currentClassLoader);
ModelListenerWrapper[] modelListenerWrappers = getModelListenerWrappers(); ModelListenerWrapper[] modelListenerWrappers = getModelListenerWrappers();
for (int i = 0; modelListenerWrappers != null && i < modelListenerWrappers.length; i++) { for (int i = 0; modelListenerWrappers != null && i < modelListenerWrappers.length; i++) {
if (ServletContextPool.containsKey(modelListenerWrappers[i].getServletContextName())) { if (ServletContextPool.containsKey(modelListenerWrappers[i].getServletContextName())) {
ModelListenerUtil.registerModelListener(modelListenerWrappers[i]); ModelListenerUtil.registerModelListener(modelListenerWrappers[i]);
} }
} }
MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, new ModelListenerHotDeployListener(
MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, currentContextName, modelListenerWrappers));
new ModelListenerHotDeployListener(currentContextName, modelListenerWrappers));
} }
public abstract ModelListenerWrapper[] getModelListenerWrappers(); public abstract ModelListenerWrapper[] getModelListenerWrappers();
} }

11
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/CronostoriaBean.java

@ -28,8 +28,8 @@ public class CronostoriaBean implements Serializable {
this.tipoLink = tipoLink; this.tipoLink = tipoLink;
} }
public CronostoriaBean(Date dataEvento, String tipoEvento, String testoEvento, String tipoLink, String classPK, String className, public CronostoriaBean(Date dataEvento, String tipoEvento, String testoEvento, String tipoLink, String classPK,
CronostoriaLink... links) { String className, CronostoriaLink... links) {
super(); super();
this.dataEvento = dataEvento; this.dataEvento = dataEvento;
this.tipoEvento = tipoEvento; this.tipoEvento = tipoEvento;
@ -40,7 +40,6 @@ public class CronostoriaBean implements Serializable {
this.className = className; this.className = className;
} }
public Date getDataEvento() { public Date getDataEvento() {
return dataEvento; return dataEvento;
} }
@ -81,25 +80,19 @@ public class CronostoriaBean implements Serializable {
this.tipoLink = tipoLink; this.tipoLink = tipoLink;
} }
public String getClassPK() { public String getClassPK() {
return classPK; return classPK;
} }
public void setClassPK(String classPK) { public void setClassPK(String classPK) {
this.classPK = classPK; this.classPK = classPK;
} }
public String getClassName() { public String getClassName() {
return className; return className;
} }
public void setClassName(String className) { public void setClassName(String className) {
this.className = className; this.className = className;
} }
} }

1
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/CronostoriaLink.java

@ -30,5 +30,4 @@ public class CronostoriaLink implements Serializable {
public void setLink(String link) { public void setLink(String link) {
this.link = link; this.link = link;
} }
} }

1
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/CronostoriaTypeEnum.java

@ -20,5 +20,4 @@ public enum CronostoriaTypeEnum {
public String getName() { public String getName() {
return name; return name;
} }
} }

8
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/IstruttoreBean.java

@ -7,26 +7,26 @@ public class IstruttoreBean implements Comparable<IstruttoreBean>{
public long getIdIstruttore() { public long getIdIstruttore() {
return idIstruttore; return idIstruttore;
} }
public void setIdIstruttore(long idIstruttore) { public void setIdIstruttore(long idIstruttore) {
this.idIstruttore = idIstruttore; this.idIstruttore = idIstruttore;
} }
public String getDenominazione() { public String getDenominazione() {
return denominazione; return denominazione;
} }
public void setDenominazione(String denominazione) { public void setDenominazione(String denominazione) {
this.denominazione = denominazione; this.denominazione = denominazione;
} }
@Override @Override
public int compareTo(IstruttoreBean o) { public int compareTo(IstruttoreBean o) {
int value = 0; int value = 0;
value = getDenominazione().compareTo(o.getDenominazione()); value = getDenominazione().compareTo(o.getDenominazione());
if (value != 0) { if (value != 0) {
return value; return value;
} }
return 0; return 0;
} }
} }

17
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/ParereGeologoBean.java

@ -10,22 +10,18 @@ public class ParereGeologoBean implements Comparable<ParereGeologoBean>{
private long userId; private long userId;
private String parere; private String parere;
public long getIntPraticaId() { public long getIntPraticaId() {
return intPraticaId; return intPraticaId;
} }
public void setIntPraticaId(long intPraticaId) { public void setIntPraticaId(long intPraticaId) {
this.intPraticaId = intPraticaId; this.intPraticaId = intPraticaId;
} }
public Date getDataCreazione() { public Date getDataCreazione() {
return dataCreazione; return dataCreazione;
} }
public void setDataCreazione(Date dataCreazione) { public void setDataCreazione(Date dataCreazione) {
this.dataCreazione = dataCreazione; this.dataCreazione = dataCreazione;
} }
@ -34,53 +30,40 @@ public class ParereGeologoBean implements Comparable<ParereGeologoBean>{
return userId; return userId;
} }
public void setUserId(long userId) { public void setUserId(long userId) {
this.userId = userId; this.userId = userId;
} }
public long getParereGeologoId() { public long getParereGeologoId() {
return parereGeologoId; return parereGeologoId;
} }
public void setParereGeologoId(long parereGeologoId) { public void setParereGeologoId(long parereGeologoId) {
this.parereGeologoId = parereGeologoId; this.parereGeologoId = parereGeologoId;
} }
@Override @Override
public int compareTo(ParereGeologoBean o) { public int compareTo(ParereGeologoBean o) {
int value = 0; int value = 0;
value = getDataCreazione().compareTo(o.getDataCreazione()); value = getDataCreazione().compareTo(o.getDataCreazione());
if (value != 0) { if (value != 0) {
return value; return value;
} }
return 0; return 0;
} }
public long getDettPraticaId() { public long getDettPraticaId() {
return dettPraticaId; return dettPraticaId;
} }
public void setDettPraticaId(long dettPraticaId) { public void setDettPraticaId(long dettPraticaId) {
this.dettPraticaId = dettPraticaId; this.dettPraticaId = dettPraticaId;
} }
public String getParere() { public String getParere() {
return parere; return parere;
} }
public void setParere(String parere) { public void setParere(String parere) {
this.parere = parere; this.parere = parere;
} }

7
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/File.java

@ -1,29 +1,22 @@
package it.tref.liferay.portos.bo.shared.protocollo.model; package it.tref.liferay.portos.bo.shared.protocollo.model;
public class File { public class File {
private String fileId; private String fileId;
private String fileSha256; private String fileSha256;
public String getFileId() { public String getFileId() {
return fileId; return fileId;
} }
public void setFileId(String fileId) { public void setFileId(String fileId) {
this.fileId = fileId; this.fileId = fileId;
} }
public String getFileSha256() { public String getFileSha256() {
return fileSha256; return fileSha256;
} }
public void setFileSha256(String fileSha256) { public void setFileSha256(String fileSha256) {
this.fileSha256 = fileSha256; this.fileSha256 = fileSha256;
} }
} }

23
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/Constants.java

@ -22,9 +22,7 @@ public class Constants implements com.liferay.portal.kernel.util.Constants {
public static final String TIPO_PRATICA_AUTORIZZAZIONE = "02"; public static final String TIPO_PRATICA_AUTORIZZAZIONE = "02";
public static final String TIPO_PRATICA_SANATORIA = "03"; public static final String TIPO_PRATICA_SANATORIA = "03";
//Bug 33461 @SuppressWarnings("serial")
// public static final String TIPO_PRATICA_OPERE_MINORE_IMPORTANZA = "05";
public static final HashMap<String, String> PRATICA_ZONE = new HashMap<String, String>() { public static final HashMap<String, String> PRATICA_ZONE = new HashMap<String, String>() {
{ {
put(PROCEDURA_A, TIPO_PRATICA_AUTORIZZAZIONE); put(PROCEDURA_A, TIPO_PRATICA_AUTORIZZAZIONE);
@ -38,8 +36,6 @@ public class Constants implements com.liferay.portal.kernel.util.Constants {
} }
}; };
// public static final String TIPO_PRATICA_DEPOSITO_CO = TIPO_PRATICA_DEPOSITO + "_CO";
public static final String FIRMA = "FIRMA"; public static final String FIRMA = "FIRMA";
public static final String[] AMMINISTRAZIONE_CSV_HEADERS_COMUNI = { "Codice Regione", "Codice Città Metropolitana", public static final String[] AMMINISTRAZIONE_CSV_HEADERS_COMUNI = { "Codice Regione", "Codice Città Metropolitana",
@ -55,18 +51,6 @@ public class Constants implements com.liferay.portal.kernel.util.Constants {
public static final String[] AMMINISTRAZIONE_CSV_HEADERS_PROVINCE = { "codice_provincia", "provincia", "regione", public static final String[] AMMINISTRAZIONE_CSV_HEADERS_PROVINCE = { "codice_provincia", "provincia", "regione",
"sigla" }; "sigla" };
// public static final String CHECK_FIRMA = "checkFirma";
// public static final String ASSOCIATE_WITH_WORKFLOW = "associateWithWorkflow";
// public static final String ADD_UPLOAD_FILE_AVVISO = "addUploadFileAvviso";
//
// public static final String PROTOCOLLO_KEY_DB = "protocollo.key.db";
// public static final String PROTOCOLLO_AVVISO_KEY_DB = "protocollo.avviso.key.db";
// public static final String NOME_VOCABOLARIO = "Genio Civile";
// public static final String NOME_VOCABOLARIO_STATO = "Stato Attuale";
//
// public static final String CUSTOM_FIELD_TABLE_NAME = ExpandoTableConstants.DEFAULT_TABLE_NAME;
// public static final String CUSTOM_FIELD_GC_USERID = "GC_USERID";
public static final String ROLE_NAME_GEOLOGO = "portos_geologo"; public static final String ROLE_NAME_GEOLOGO = "portos_geologo";
public static final String ROLE_NAME_FIRMA = "portos_firma"; public static final String ROLE_NAME_FIRMA = "portos_firma";
@ -76,7 +60,6 @@ public class Constants implements com.liferay.portal.kernel.util.Constants {
public static final String ROLE_NAME_APPROVATORE = "portos_approvatore"; public static final String ROLE_NAME_APPROVATORE = "portos_approvatore";
public static final String ROLE_NAME_ISTRUTTORE = "portos_istruttore"; public static final String ROLE_NAME_ISTRUTTORE = "portos_istruttore";
public static final String COMPANY_CUSTOM_FIELD_VERSIONING_CHANGES = "VERSIONING CHANGES URL"; public static final String COMPANY_CUSTOM_FIELD_VERSIONING_CHANGES = "VERSIONING CHANGES URL";
public static final String COMPANY_CUSTOM_FIELD_VERSIONING_SNAPSHOTS = "VERSIONING SNAPSHOT URL"; public static final String COMPANY_CUSTOM_FIELD_VERSIONING_SNAPSHOTS = "VERSIONING SNAPSHOT URL";
public static final String COMPANY_CUSTOM_FIELD_VERSIONING_SNAPSHOTS_COUNT = "VERSIONING SNAPSHOT COUNT URL"; public static final String COMPANY_CUSTOM_FIELD_VERSIONING_SNAPSHOTS_COUNT = "VERSIONING SNAPSHOT COUNT URL";
@ -86,8 +69,8 @@ public class Constants implements com.liferay.portal.kernel.util.Constants {
public static final String COMPANY_CUSTOM_FIELD_VERSIONING_SNAPSHOTS_COUNT_URL = "http://172.16.20.148:8080/portos-versioning/v1/fascicolo/snapshots/count/"; public static final String COMPANY_CUSTOM_FIELD_VERSIONING_SNAPSHOTS_COUNT_URL = "http://172.16.20.148:8080/portos-versioning/v1/fascicolo/snapshots/count/";
public static final String COMPANY_CUSTOM_FIELD_VERSIONING_COMMIT_URL = "http://172.16.20.148:8080/portos-versioning/v1/fascicolo/commit/"; public static final String COMPANY_CUSTOM_FIELD_VERSIONING_COMMIT_URL = "http://172.16.20.148:8080/portos-versioning/v1/fascicolo/commit/";
// Manifattura Web Group, mofidica per rendere la dimensione massima degli allegati configurabile // Manifattura Web Group, mofidica per rendere la dimensione massima degli allegati configurabile da pannello di
// da pannello di controllo. In origine era hardcoded a 20971520 byte. // controllo. In origine era hardcoded a 20971520 byte.
public static final String COMPANY_CUSTOM_FIELD_DIMENSIONE_MASSIMA_ALLEGATI_IN_MIB = "DIMENSIONE MASSIMA ALLEGATI IN MIB"; public static final String COMPANY_CUSTOM_FIELD_DIMENSIONE_MASSIMA_ALLEGATI_IN_MIB = "DIMENSIONE MASSIMA ALLEGATI IN MIB";
public static final String COMPANY_CUSTOM_FIELD_DIMENSIONE_MASSIMA_ALLEGATI_DEFAULT = "100"; public static final String COMPANY_CUSTOM_FIELD_DIMENSIONE_MASSIMA_ALLEGATI_DEFAULT = "100";

36
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/FascicoloURLUtil.java

@ -3,6 +3,7 @@ package it.tref.liferay.portos.bo.shared.util;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.HttpUtil; import com.liferay.portal.kernel.util.HttpUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Company; import com.liferay.portal.model.Company;
import com.liferay.portal.service.CompanyLocalServiceUtil; import com.liferay.portal.service.CompanyLocalServiceUtil;
@ -11,53 +12,36 @@ public class FascicoloURLUtil {
@Deprecated @Deprecated
public static String getFascicoloViewURL(long companyId, long intPraticaId) throws PortalException, SystemException { public static String getFascicoloViewURL(long companyId, long intPraticaId) throws PortalException, SystemException {
// Company company = CompanyLocalServiceUtil.getCompany(companyId);
//
// String urlToBack =
// GetterUtil.getString(company.getExpandoBridge().getAttribute("url-bo-gestione-pratica-firma",
// false));
//
// urlToBack = urlToBack + "&_" + PortletKeys.FASCICOLO + "_intPraticaId=" + intPraticaId;
return getFascicoloBOViewURL(companyId, intPraticaId); return getFascicoloBOViewURL(companyId, intPraticaId);
} }
public static String getFascicoloFEViewURL(long companyId, long intPraticaId, String mvcPath, String queryString) public static String getFascicoloFEViewURL(long companyId, long intPraticaId, String mvcPath, String queryString)
throws PortalException, SystemException { throws PortalException, SystemException {
Company company = CompanyLocalServiceUtil.getCompany(companyId); Company company = CompanyLocalServiceUtil.getCompany(companyId);
String urlToBack = (String) company.getExpandoBridge().getAttribute(Constants.GESTIONE_PRATICA_URL_FE, false); String urlToBack = (String) company.getExpandoBridge().getAttribute(Constants.GESTIONE_PRATICA_URL_FE, false);
urlToBack = HttpUtil.addParameter(urlToBack, StringPool.UNDERLINE + PortletKeys.FASCICOLOFE + "_intPraticaId",
urlToBack = HttpUtil.addParameter(urlToBack, "_" + PortletKeys.FASCICOLOFE + "_intPraticaId", intPraticaId); intPraticaId);
if (Validator.isNotNull(mvcPath)) { if (Validator.isNotNull(mvcPath)) {
urlToBack = HttpUtil.addParameter(urlToBack, "_" + PortletKeys.FASCICOLOFE + "_mvcPath", mvcPath); urlToBack = HttpUtil.addParameter(urlToBack, StringPool.UNDERLINE + PortletKeys.FASCICOLOFE + "_mvcPath",
mvcPath);
} }
if (Validator.isNotNull(queryString)) { if (Validator.isNotNull(queryString)) {
if (queryString.startsWith(StringPool.QUESTION)) {
if (queryString.startsWith("?")) {
queryString = queryString.substring(1); queryString = queryString.substring(1);
} }
if (queryString.startsWith("&")) { if (queryString.startsWith(StringPool.AMPERSAND)) {
queryString = queryString.substring(1); queryString = queryString.substring(1);
} }
urlToBack = urlToBack + StringPool.AMPERSAND + queryString;
urlToBack = urlToBack + "&" + queryString;
} }
return urlToBack; return urlToBack;
} }
public static String getFascicoloBOViewURL(long companyId, long intPraticaId) throws PortalException, SystemException { public static String getFascicoloBOViewURL(long companyId, long intPraticaId) throws PortalException,
SystemException {
Company company = CompanyLocalServiceUtil.getCompany(companyId); Company company = CompanyLocalServiceUtil.getCompany(companyId);
String urlToBack = (String) company.getExpandoBridge().getAttribute(Constants.GESTIONE_PRATICA_URL_BO, false); String urlToBack = (String) company.getExpandoBridge().getAttribute(Constants.GESTIONE_PRATICA_URL_BO, false);
urlToBack = urlToBack + "&_" + PortletKeys.FASCICOLO + "_intPraticaId=" + intPraticaId; urlToBack = urlToBack + "&_" + PortletKeys.FASCICOLO + "_intPraticaId=" + intPraticaId;
return urlToBack; return urlToBack;
} }
} }

16
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/FirmeUtil.java

@ -1,10 +1,5 @@
package it.tref.liferay.portos.bo.shared.util; package it.tref.liferay.portos.bo.shared.util;
import com.liferay.portal.kernel.json.JSONDeserializer;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONSerializer;
import com.liferay.portal.kernel.util.UniqueList;
import it.tref.liferay.portos.bo.shared.bean.FirmeBean; import it.tref.liferay.portos.bo.shared.bean.FirmeBean;
import it.tref.liferay.portos.bo.shared.bean.FirmeDetail; import it.tref.liferay.portos.bo.shared.bean.FirmeDetail;
@ -12,22 +7,25 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.liferay.portal.kernel.json.JSONDeserializer;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONSerializer;
import com.liferay.portal.kernel.util.UniqueList;
public class FirmeUtil { public class FirmeUtil {
public static String addFirma(FirmeBean firmeBean, String codiceFiscale) { public static String addFirma(FirmeBean firmeBean, String codiceFiscale) {
Date now = new Date();
List<FirmeDetail> firme = new UniqueList<FirmeDetail>(); List<FirmeDetail> firme = new UniqueList<FirmeDetail>();
firme.addAll(firmeBean.getFirmeApplicativo()); firme.addAll(firmeBean.getFirmeApplicativo());
firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), now)); firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), new Date()));
firmeBean.setFirmeApplicativo(firme); firmeBean.setFirmeApplicativo(firme);
return serialize(firmeBean); return serialize(firmeBean);
} }
public static String addFirmaDigitale(FirmeBean firmeBean, String codiceFiscale) { public static String addFirmaDigitale(FirmeBean firmeBean, String codiceFiscale) {
Date now = null;
List<FirmeDetail> firme = new UniqueList<FirmeDetail>(); List<FirmeDetail> firme = new UniqueList<FirmeDetail>();
firme.addAll(firmeBean.getFirmeDigitali()); firme.addAll(firmeBean.getFirmeDigitali());
firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), now)); firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), null));
firmeBean.setFirmeDigitali(firme); firmeBean.setFirmeDigitali(firme);
return serialize(firmeBean); return serialize(firmeBean);
} }

17
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ParamUtil.java

@ -1,50 +1,39 @@
package it.tref.liferay.portos.bo.shared.util; package it.tref.liferay.portos.bo.shared.util;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.util.PortalUtil;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import javax.portlet.PortletRequest; import javax.portlet.PortletRequest;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.util.PortalUtil;
public class ParamUtil extends com.liferay.portal.kernel.util.ParamUtil { public class ParamUtil extends com.liferay.portal.kernel.util.ParamUtil {
public static Date getDate(PortletRequest request, String param) throws PortalException { public static Date getDate(PortletRequest request, String param) throws PortalException {
int day = ParamUtil.getInteger(request, param + "Day"); int day = ParamUtil.getInteger(request, param + "Day");
int month = ParamUtil.getInteger(request, param + "Month"); int month = ParamUtil.getInteger(request, param + "Month");
int year = ParamUtil.getInteger(request, param + "Year"); int year = ParamUtil.getInteger(request, param + "Year");
int hour = ParamUtil.getInteger(request, param + "Hour"); int hour = ParamUtil.getInteger(request, param + "Hour");
int minute = ParamUtil.getInteger(request, param + "Minute"); int minute = ParamUtil.getInteger(request, param + "Minute");
int amPm = ParamUtil.getInteger(request, param + "AmPM"); int amPm = ParamUtil.getInteger(request, param + "AmPM");
if (amPm == Calendar.PM) { if (amPm == Calendar.PM) {
hour += 12; hour += 12;
} }
return PortalUtil.getDate(month, day, year, hour, minute, null); return PortalUtil.getDate(month, day, year, hour, minute, null);
} }
public static Date getDate(HttpServletRequest request, String param) throws PortalException { public static Date getDate(HttpServletRequest request, String param) throws PortalException {
int day = ParamUtil.getInteger(request, param + "Day"); int day = ParamUtil.getInteger(request, param + "Day");
int month = ParamUtil.getInteger(request, param + "Month"); int month = ParamUtil.getInteger(request, param + "Month");
int year = ParamUtil.getInteger(request, param + "Year"); int year = ParamUtil.getInteger(request, param + "Year");
int hour = ParamUtil.getInteger(request, param + "Hour"); int hour = ParamUtil.getInteger(request, param + "Hour");
int minute = ParamUtil.getInteger(request, param + "Minute"); int minute = ParamUtil.getInteger(request, param + "Minute");
int amPm = ParamUtil.getInteger(request, param + "AmPM"); int amPm = ParamUtil.getInteger(request, param + "AmPM");
if (amPm == Calendar.PM) { if (amPm == Calendar.PM) {
hour += 12; hour += 12;
} }
return PortalUtil.getDate(month, day, year, hour, minute, null); return PortalUtil.getDate(month, day, year, hour, minute, null);
} }
} }

44
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/TipoIntegrazioneUtil.java

@ -1,9 +1,8 @@
package it.tref.liferay.portos.bo.shared.util; package it.tref.liferay.portos.bo.shared.util;
import java.util.Arrays; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class TipoIntegrazioneUtil { public class TipoIntegrazioneUtil {
public static final String RICHIESTA_INTEGRAZIONE = "05"; public static final String RICHIESTA_INTEGRAZIONE = "05";
@ -15,40 +14,13 @@ public class TipoIntegrazioneUtil {
public static final String VARIAZIONE_SOGGETTO = "12"; public static final String VARIAZIONE_SOGGETTO = "12";
public static final String VARIANTE = "13"; public static final String VARIANTE = "13";
// private final static Map<String, String> integrazioneToStato = new HashMap<String, String>(); @SuppressWarnings("serial")
// private static final List<String> outOfWorkflow = new ArrayList<String>() {
// private final static Map<String, String> labels = new HashMap<String, String>(); {
// add(VARIAZIONE_SOGGETTO);
// static { add(ANNULLA);
// integrazioneToStato.put(RICHIESTA_INTEGRAZIONE, StatoPraticaConstants.INTEGRAZIONE); }
// integrazioneToStato.put(FINE_LAVORO, StatoPraticaConstants.FINE_LAVORI); };
// integrazioneToStato.put(COLLAUDO, StatoPraticaConstants.COLLAUDO);
// integrazioneToStato.put(FINE_LAVORO_PARZIALE, StatoPraticaConstants.FINE_LAVORI_PARZIALE);
// integrazioneToStato.put(COLLAUDO_PARZIALE, StatoPraticaConstants.COLLAUDO_PARZIALE);
// integrazioneToStato.put(ANNULLA, StatoPraticaConstants.ANNULLATA);
//
// labels.put(RICHIESTA_INTEGRAZIONE, "Richiesta Integrazione");
// labels.put(FINE_LAVORO, "Fine Lavori");
// labels.put(COLLAUDO, "Collaudo");
// labels.put(FINE_LAVORO_PARZIALE, "Fine Lavori Parziale");
// labels.put(COLLAUDO_PARZIALE, "Collaudo Parziale");
// labels.put(ANNULLA, "Annullamento");
// labels.put(VARIAZIONE_SOGGETTO, "Variazione Soggetto");
// }
// public static String tipoIntegrazioneToStatoPratica(String tipoIntegrazione) {
// return integrazioneToStato.get(tipoIntegrazione);
// }
// public static Map<String, String> getLabels(){
// return labels;
// }
//
// public static String toLabel(String tipoIntegrazione) {
// return labels.get(tipoIntegrazione);
// }
private static List<String> outOfWorkflow = Arrays.asList(new String[] {VARIAZIONE_SOGGETTO, ANNULLA});
public static boolean isOutOfWorkflow(String tipoIntegrazione) { public static boolean isOutOfWorkflow(String tipoIntegrazione) {
return outOfWorkflow.contains(tipoIntegrazione); return outOfWorkflow.contains(tipoIntegrazione);

78
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/TipoSoggettoUtil.java

@ -1,7 +1,6 @@
package it.tref.liferay.portos.bo.shared.util; package it.tref.liferay.portos.bo.shared.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -17,41 +16,41 @@ public class TipoSoggettoUtil {
public static final String JSON_CODICE_FISCALE = "codiceFiscale"; public static final String JSON_CODICE_FISCALE = "codiceFiscale";
public static final String JSON_CODICE_RUOLO = "codiceRuolo"; public static final String JSON_CODICE_RUOLO = "codiceRuolo";
@SuppressWarnings("serial")
private static final List<String> allSubjects = new ArrayList<String>() {
{
add(TipoSoggettoUtil.COMMITTENTE);
add(TipoSoggettoUtil.DITTA);
add(TipoSoggettoUtil.PROGETTISTA);
add(TipoSoggettoUtil.DIRETTORE_LAVORI);
add(TipoSoggettoUtil.GEOLOGO);
add(TipoSoggettoUtil.COLLAUDATORE);
}
};
public static List<String> getAllSubjects() { public static List<String> getAllSubjects() {
return Arrays.asList(TipoSoggettoUtil.COMMITTENTE, TipoSoggettoUtil.DITTA, TipoSoggettoUtil.PROGETTISTA, return allSubjects;
TipoSoggettoUtil.DIRETTORE_LAVORI, TipoSoggettoUtil.GEOLOGO, TipoSoggettoUtil.COLLAUDATORE);
} }
public static boolean validaCodiceFiscale(String codiceFiscale, boolean ultimoCarattere) { public static boolean validaCodiceFiscale(String codiceFiscale, boolean ultimoCarattere) {
// conversione della stringa in caratteri maiuscoli // conversione della stringa in caratteri maiuscoli
try { try {
String cf = codiceFiscale.toUpperCase().replaceAll(" ", ""); String cf = codiceFiscale.toUpperCase().replaceAll(" ", "");
/* // verifica della lunghezza del codice fiscale
* verifica della lunghezza del codice fiscale
*/
if (cf.length() == 16) { if (cf.length() == 16) {
String cfMask = "^[a-zA-Z]{6}[0-9lmnpqrstuvLMNPQRSTUV]{2}[abcdehlmprstABCDEHLMPRST]{1}[0-9lmnpqrstuvLMNPQRSTUV]{2}([a-zA-Z]{1}[0-9lmnpqrstuvLMNPQRSTUV]{3})[a-zA-Z]{1}$";
String cfMask =
"^[a-zA-Z]{6}[0-9lmnpqrstuvLMNPQRSTUV]{2}[abcdehlmprstABCDEHLMPRST]{1}[0-9lmnpqrstuvLMNPQRSTUV]{2}([a-zA-Z]{1}[0-9lmnpqrstuvLMNPQRSTUV]{3})[a-zA-Z]{1}$";
if (!Pattern.matches(cfMask, codiceFiscale)) if (!Pattern.matches(cfMask, codiceFiscale))
return false; return false;
/* // creazione della matrice con i caratteri dell'alfabeto
* creazione della matrice con i caratteri dell'alfabeto char[] Carattere = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
*/ 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8',
char[] Carattere = '9' };
{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', // creazione della matrice con i valori attribuiti ai caratteri dispari, corrispondenti alla matrice di
'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; // caratteri
/* int[] ValoriDispari = { 1, 0, 5, 7, 9, 13, 15, 17, 19, 21, 2, 4, 18, 20, 11, 3, 6, 8, 12, 14, 16, 10,
* creazione della matrice con i valori attribuiti ai caratteri dispari, corrispondenti alla 22, 25, 24, 23, 1, 0, 5, 7, 9, 13, 15, 17, 19, 21 };
* matrice di caratteri // creazione della matrice con i valori attribuiti ai caratteri pari, corrispondenti alla matrice di
*/ // caratteri
int[] ValoriDispari =
{1, 0, 5, 7, 9, 13, 15, 17, 19, 21, 2, 4, 18, 20, 11, 3, 6, 8, 12, 14, 16, 10, 22, 25, 24, 23, 1, 0, 5, 7,
9, 13, 15, 17, 19, 21};
/*
* creazione della matrice con i valori attribuiti ai caratteri pari, corrispondenti alla
* matrice di caratteri
*/
int[] ValoriPari = new int[36]; int[] ValoriPari = new int[36];
for (int i = 0; i < 26; i++) { for (int i = 0; i < 26; i++) {
ValoriPari[i] = i; ValoriPari[i] = i;
@ -63,22 +62,17 @@ public class TipoSoggettoUtil {
char[] caratteriCF = cf.toCharArray(); char[] caratteriCF = cf.toCharArray();
int valore = 0; int valore = 0;
for (int i = 0; i < caratteriCF.length - 1; i++) { for (int i = 0; i < caratteriCF.length - 1; i++) {
/* // somma delle posizioni pari in base ai valori corrispondenti contenuti nell'array ValoriPari
* somma delle posizioni pari in base ai valori corrispondenti contenuti nell'array // (tranne l'ultimo carattere che è quello di controllo)
* ValoriPari (tranne l'ultimo carattere che è quello di controllo)
*/
if ((i + 1) % 2 == 0) { if ((i + 1) % 2 == 0) {
for (int j = 0; j < Carattere.length; j++) { for (int j = 0; j < Carattere.length; j++) {
if (caratteriCF[i] == Carattere[j]) { if (caratteriCF[i] == Carattere[j]) {
valore += ValoriPari[j]; valore += ValoriPari[j];
} }
} }
/*
* somma delle posizioni dispari in base ai valori corrispondenti contenuti nell'array
* ValoriDispari
*/
} else { } else {
// somma delle posizioni dispari in base ai valori corrispondenti contenuti nell'array
// ValoriDispari
for (int j = 0; j < Carattere.length; j++) { for (int j = 0; j < Carattere.length; j++) {
if (caratteriCF[i] == Carattere[j]) { if (caratteriCF[i] == Carattere[j]) {
valore += ValoriDispari[j]; valore += ValoriDispari[j];
@ -86,16 +80,12 @@ public class TipoSoggettoUtil {
} }
} }
} }
/* // ottenimento del resto della divisione per 26 e valutazione del carattere di controllo (ultimo
* ottenimento del resto della divisione per 26 e valutazione del carattere di controllo // carattere)
* (ultimo carattere)
*/
valore %= 26; valore %= 26;
for (int i = 0; i < 26; i++) { for (int i = 0; i < 26; i++) {
/* // verifica che il valore dell'ultimo carattere corrisponda al valore ottenuto attraverso
* verifica che il valore dell'ultimo carattere corrisponda al valore ottenuto attraverso // l'algoritmo di somma precedente
* l'algoritmo di somma precedente
*/
if (ultimoCarattere) { if (ultimoCarattere) {
if (caratteriCF[caratteriCF.length - 1] == Carattere[i]) { if (caratteriCF[caratteriCF.length - 1] == Carattere[i]) {
if (valore == i) { if (valore == i) {

20
liferay-plugins-sdk-6.2/shared/portos-report-shared/src/it/tref/liferay/portos/report/shared/constants/ReportConstants.java

@ -1,26 +1,16 @@
package it.tref.liferay.portos.report.shared.constants; package it.tref.liferay.portos.report.shared.constants;
public class ReportConstants { public class ReportConstants {
/*
* Message
*/
public enum ReportProcessMode { public enum ReportProcessMode {
ASYNC, ASYNC, SYNC
SYNC
} }
public enum ReportResult { public enum ReportResult {
FAILED, FAILED, SUCCESSFUL
SUCCESSFUL
} }
public enum ReportType { public enum ReportType {
HTML_TO_PDF, HTML_TO_PDF, JRXML_TO_PDF, VELOCITY_TO_PDF, ODT_TO_PDF
JRXML_TO_PDF,
VELOCITY_TO_PDF,
ODT_TO_PDF
} }
public final static String COMPANY_ID = "companyId"; public final static String COMPANY_ID = "companyId";
@ -31,7 +21,6 @@ public class ReportConstants {
public final static String PARAM_PROCESS_MODE = "processMode"; public final static String PARAM_PROCESS_MODE = "processMode";
public final static String PARAM_RESPONSE_DESTINATION_NAME = "responseDestinationName"; public final static String PARAM_RESPONSE_DESTINATION_NAME = "responseDestinationName";
public final static String SERVICE_CONTEXT = "serviceContext"; public final static String SERVICE_CONTEXT = "serviceContext";
public final static String FILE_ENTRY_ID_TEMPLATE = "fileEntryIdTemplate"; public final static String FILE_ENTRY_ID_TEMPLATE = "fileEntryIdTemplate";
public final static String REPORT_PARAMETERS = "reportParameters"; public final static String REPORT_PARAMETERS = "reportParameters";
@ -39,9 +28,6 @@ public class ReportConstants {
public final static String REPORT_NAME = "reportName"; public final static String REPORT_NAME = "reportName";
public final static String FOLDER_ID_REPORT = "folderIdReport"; public final static String FOLDER_ID_REPORT = "folderIdReport";
/*
* Genio Civile
*/
public final static String LOGO_REGIONE = "LOGO_REGIONE"; public final static String LOGO_REGIONE = "LOGO_REGIONE";
public final static String PATH_LOGO_REGIONE = "resource/report/LOGO_REGIONE.png"; public final static String PATH_LOGO_REGIONE = "resource/report/LOGO_REGIONE.png";
} }

11
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/.classpath

@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="docroot/WEB-INF/src"/> <classpathentry kind="src" path="docroot/WEB-INF/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_80">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="com.liferay.ide.eclipse.server.plugin.container/web"> <classpathentry kind="con" path="com.liferay.ide.eclipse.server.plugin.container/web">
<attributes> <attributes>
@ -18,5 +13,11 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="lib" path="/home/portos/bin/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT/WEB-INF/lib/portal-impl.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_80">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="docroot/WEB-INF/classes"/> <classpathentry kind="output" path="docroot/WEB-INF/classes"/>
</classpath> </classpath>

7
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/.settings/org.eclipse.jdt.core.prefs

@ -1,7 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

2
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/.settings/org.eclipse.wst.common.project.facet.core.xml

@ -2,8 +2,8 @@
<faceted-project> <faceted-project>
<runtime name="Liferay v6.2 CE (Tomcat 7)"/> <runtime name="Liferay v6.2 CE (Tomcat 7)"/>
<fixed facet="wst.jsdt.web"/> <fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/> <installed facet="jst.web" version="2.5"/>
<installed facet="liferay.web" version="6.0"/> <installed facet="liferay.web" version="6.0"/>
<installed facet="wst.jsdt.web" version="1.0"/> <installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
</faceted-project> </faceted-project>

2
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/build.xml

@ -6,6 +6,6 @@
<property name="original.war.file" value="kaleo-web-6.2.0.3.war" /> <property name="original.war.file" value="kaleo-web-6.2.0.3.war" />
<property name="import.shared" value="portos-kaleo-shared" /> <property name="import.shared" value="portos-bo-shared,portos-kaleo-shared" />
</project> </project>

75
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_instances/workflow_task_action.jsp

@ -1,4 +1,16 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.compat.portal.kernel.util.StringUtil"%>
<%@page import="com.liferay.portal.kernel.dao.search.ResultRow"%>
<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>
<%@page import="com.liferay.portal.kernel.util.Constants"%>
<%@page import="com.liferay.portal.kernel.util.Validator"%>
<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTask"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil"%>
<%@page import="com.liferay.portal.util.PortletKeys"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Map"%>
<%-- <%--
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
@ -14,19 +26,15 @@
* details. * details.
*/ */
--%> --%>
<%@ include file="/html/portlet/workflow_instances/init.jsp" %> <%@ include file="/html/portlet/workflow_instances/init.jsp" %>
<% <%
String randomId = StringUtil.randomId(); String randomId = StringUtil.randomId();
ResultRow row = (ResultRow)request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW); ResultRow row = (ResultRow)request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
WorkflowTask workflowTask = (WorkflowTask)row.getObject(); WorkflowTask workflowTask = (WorkflowTask)row.getObject();
%> %>
<liferay-ui:icon-menu> <liferay-ui:icon-menu>
<c:if test="<%= portletName.equals(PortletKeys.WORKFLOW_DEFINITIONS) && !workflowTask.isCompleted() && !_isAssignedToUser(workflowTask, user) %>"> <c:if test="<%= portletName.equals(PortletKeys.WORKFLOW_DEFINITIONS) && !workflowTask.isCompleted()
&& !_isAssignedToUser(workflowTask, user) %>">
<portlet:actionURL var="assignToMeURL"> <portlet:actionURL var="assignToMeURL">
<portlet:param name="struts_action" value="/workflow_instances/edit_workflow_instance_task" /> <portlet:param name="struts_action" value="/workflow_instances/edit_workflow_instance_task" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.ASSIGN %>" /> <portlet:param name="<%= Constants.CMD %>" value="<%= Constants.ASSIGN %>" />
@ -34,82 +42,56 @@ WorkflowTask workflowTask = (WorkflowTask)row.getObject();
<portlet:param name="workflowTaskId" value="<%= String.valueOf(workflowTask.getWorkflowTaskId()) %>" /> <portlet:param name="workflowTaskId" value="<%= String.valueOf(workflowTask.getWorkflowTaskId()) %>" />
<portlet:param name="assigneeUserId" value="<%= String.valueOf(user.getUserId()) %>" /> <portlet:param name="assigneeUserId" value="<%= String.valueOf(user.getUserId()) %>" />
</portlet:actionURL> </portlet:actionURL>
<liferay-ui:icon cssClass='<%= "workflow-task-" + randomId + " task-assign-to-me-link" %>' image="assign"
<liferay-ui:icon message="assign-to-me" method="get" url="<%= assignToMeURL %>" />
cssClass='<%= "workflow-task-" + randomId + " task-assign-to-me-link" %>'
image="assign"
message="assign-to-me"
method="get"
url="<%= assignToMeURL %>"
/>
</c:if> </c:if>
<c:if test="<%= !workflowTask.isCompleted() && _isAssignedToUser(workflowTask, user) %>"> <c:if test="<%= !workflowTask.isCompleted() && _isAssignedToUser(workflowTask, user) %>">
<% <%
List<String> transitionNames = WorkflowTaskManagerUtil.getNextTransitionNames(company.getCompanyId(), user.getUserId(), workflowTask.getWorkflowTaskId()); List<String> transitionNames = WorkflowTaskManagerUtil.getNextTransitionNames(company.getCompanyId(),
user.getUserId(), workflowTask.getWorkflowTaskId());
for (String transitionName : transitionNames) { for (String transitionName : transitionNames) {
String message = "proceed"; String message = "proceed";
if (Validator.isNotNull(transitionName)) { if (Validator.isNotNull(transitionName)) {
message = transitionName; message = transitionName;
} }
%> %>
<portlet:actionURL var="editURL"> <portlet:actionURL var="editURL">
<portlet:param name="struts_action" value="/workflow_instances/edit_workflow_instance_task" /> <portlet:param name="struts_action" value="/workflow_instances/edit_workflow_instance_task" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.SAVE %>" /> <portlet:param name="<%= Constants.CMD %>" value="<%= Constants.SAVE %>" />
<portlet:param name="redirect" value="<%= currentURL %>" /> <portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" /> <portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" />
<portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" /> <portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" />
<c:if test="<%= transitionName != null %>"> <c:if test="<%= transitionName != null %>">
<portlet:param name="transitionName" value="<%= transitionName %>" /> <portlet:param name="transitionName" value="<%= transitionName %>" />
</c:if> </c:if>
</portlet:actionURL> </portlet:actionURL>
<portlet:renderURL var="renderFormURL" windowState="<%= LiferayWindowState.POP_UP.toString() %>"> <portlet:renderURL var="renderFormURL" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
<portlet:param name="struts_action" value="/workflow_tasks/render_form_task" /> <portlet:param name="struts_action" value="/workflow_tasks/render_form_task" />
<portlet:param name="formName" value='<%= "fm_"+ randomId %>' /> <portlet:param name="formName" value='<%= "fm_"+ randomId %>' />
<portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" /> <portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" />
<portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" /> <portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" />
<c:if test="<%= transitionName != null %>"> <c:if test="<%= transitionName != null %>">
<portlet:param name="transitionName" value="<%= transitionName %>" /> <portlet:param name="transitionName" value="<%= transitionName %>" />
</c:if> </c:if>
</portlet:renderURL> </portlet:renderURL>
<portlet:resourceURL var="validationURL"> <portlet:resourceURL var="validationURL">
<portlet:param name="struts_action" value="/workflow_tasks/render_form_task" /> <portlet:param name="struts_action" value="/workflow_tasks/render_form_task" />
<portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" /> <portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" />
<portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" /> <portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" />
<c:if test="<%= transitionName != null %>"> <c:if test="<%= transitionName != null %>">
<portlet:param name="transitionName" value="<%= transitionName %>" /> <portlet:param name="transitionName" value="<%= transitionName %>" />
</c:if> </c:if>
</portlet:resourceURL> </portlet:resourceURL>
<% <%
Map<String, Object> data = new HashMap<String, Object>(); Map<String, Object> data = new HashMap<String, Object>();
data.put("href-validation", validationURL); data.put("href-validation", validationURL);
data.put("href-render-form", renderFormURL); data.put("href-render-form", renderFormURL);
%> %>
<liferay-ui:icon cssClass='<%= "workflow-task-" + randomId + " task-change-status-link" %>'
<liferay-ui:icon image="../aui/random" message="<%= message %>" method="get" url="<%= editURL %>" data="<%= data %>" />
cssClass='<%= "workflow-task-" + randomId + " task-change-status-link" %>'
image="../aui/random"
message="<%= message %>"
method="get"
url="<%= editURL %>"
data="<%= data %>"
/>
<% <%
} }
%> %>
</c:if> </c:if>
</liferay-ui:icon-menu> </liferay-ui:icon-menu>
<div class="hide" id="<%= randomId %>updateComments"> <div class="hide" id="<%= randomId %>updateComments">
@ -118,19 +100,14 @@ WorkflowTask workflowTask = (WorkflowTask)row.getObject();
<div id="<%= randomId %>form"></div> <div id="<%= randomId %>form"></div>
<aui:input cols="105" name="comment" rows="10" type="textarea" /> <aui:input cols="105" name="comment" rows="10" type="textarea" />
</div> </div>
<aui:script use="aui-io-plugin-deprecated,liferay-util-window"> <aui:script use="aui-io-plugin-deprecated,liferay-util-window">
var showPopup = function(url, title, renderFormURL, validationURL) { var showPopup = function(url, title, renderFormURL, validationURL) {
var form = A.Node.create('<form />'); var form = A.Node.create('<form />');
form.setAttribute('action', url); form.setAttribute('action', url);
form.setAttribute('method', 'POST'); form.setAttribute('method', 'POST');
var comments = A.one('#<%= randomId %>updateComments'); var comments = A.one('#<%= randomId %>updateComments');
if (comments) { if (comments) {
form.append(comments); form.append(comments);
comments.show(); comments.show();
} }
@ -139,13 +116,13 @@ WorkflowTask workflowTask = (WorkflowTask)row.getObject();
if (formDiv) { if (formDiv) {
formDiv.empty(); formDiv.empty();
} }
var formErrorDiv = A.one('#<%= randomId %>formError'); var formErrorDiv = A.one('#<%= randomId %>formError');
if (formErrorDiv) { if (formErrorDiv) {
formErrorDiv.empty(); formErrorDiv.empty();
} }
var dialog = Liferay.Util.Window.getWindow( var dialog = Liferay.Util.Window.getWindow({
{
dialog: { dialog: {
bodyContent: form, bodyContent: form,
height: 620, height: 620,
@ -209,11 +186,8 @@ WorkflowTask workflowTask = (WorkflowTask)row.getObject();
width: 550 width: 550
}, },
title: title title: title
} });
);
A.one('#<%= randomId %>updateComments').plug(A.LoadingMask, {}); A.one('#<%= randomId %>updateComments').plug(A.LoadingMask, {});
A.io.request(renderFormURL, { A.io.request(renderFormURL, {
dataType: 'html', dataType: 'html',
on: { on: {
@ -247,13 +221,10 @@ WorkflowTask workflowTask = (WorkflowTask)row.getObject();
'click', 'click',
function(event) { function(event) {
event.preventDefault(); event.preventDefault();
var icon = event.currentTarget; var icon = event.currentTarget;
var title = icon.text(); var title = icon.text();
var renderFormURL = icon.attr('data-href-render-form'); var renderFormURL = icon.attr('data-href-render-form');
var validationURL = icon.attr('data-href-validation'); var validationURL = icon.attr('data-href-validation');
showPopup(icon.attr('href'), title, renderFormURL, validationURL); showPopup(icon.attr('href'), title, renderFormURL, validationURL);
} }
); );

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

@ -14,38 +14,52 @@
* details. * details.
*/ */
--%> --%>
<%@page import="com.liferay.portal.kernel.language.LanguageUtil"%>
<%@page import="com.liferay.portal.kernel.portlet.LiferayPortletRequest"%>
<%@page import="com.liferay.portal.kernel.portlet.LiferayPortletResponse"%>
<%@page import="com.liferay.portal.kernel.util.GetterUtil"%>
<%@page import="com.liferay.portal.kernel.util.ParamUtil"%> <%@page import="com.liferay.portal.kernel.util.ParamUtil"%>
<%@page import="com.liferay.portal.kernel.util.StringPool"%>
<%@page import="com.liferay.portal.kernel.util.StringUtil"%>
<%@page import="com.liferay.portal.kernel.util.Validator"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowConstants"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowHandler"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowInstance"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowLog"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTask"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTaskDueDateException"%>
<%@page import="com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil"%>
<%@page import="com.liferay.portal.util.PortalUtil"%>
<%@page import="com.liferay.portal.util.WebKeys"%>
<%@page import="com.liferay.portlet.asset.model.AssetEntry"%>
<%@page import="com.liferay.portlet.asset.model.AssetRenderer"%>
<%@page import="com.liferay.portlet.asset.model.AssetRendererFactory"%>
<%@page import="java.io.Serializable"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Map"%>
<%@page import="javax.portlet.PortletURL"%>
<%@ include file="/html/portlet/workflow_tasks/init.jsp" %> <%@ include file="/html/portlet/workflow_tasks/init.jsp" %>
<% <%
String randomId = StringUtil.randomId(); String randomId = StringUtil.randomId();
String redirect = ParamUtil.getString(request, "redirect"); String redirect = ParamUtil.getString(request, "redirect");
WorkflowTask workflowTask = (WorkflowTask)request.getAttribute(WebKeys.WORKFLOW_TASK); WorkflowTask workflowTask = (WorkflowTask)request.getAttribute(WebKeys.WORKFLOW_TASK);
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(company.getCompanyId(), workflowTask.getWorkflowInstanceId()); WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(company.getCompanyId(), workflowTask.getWorkflowInstanceId());
Map<String, Serializable> workflowContext = workflowInstance.getWorkflowContext(); Map<String, Serializable> workflowContext = workflowInstance.getWorkflowContext();
long companyId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID)); long companyId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
long groupId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_GROUP_ID)); long groupId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_GROUP_ID));
String className = (String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME); String className = (String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME);
long classPK = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK)); long classPK = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
WorkflowHandler workflowHandler = WorkflowHandlerRegistryUtil.getWorkflowHandler(className); WorkflowHandler workflowHandler = WorkflowHandlerRegistryUtil.getWorkflowHandler(className);
AssetRenderer assetRenderer = workflowHandler.getAssetRenderer(classPK); AssetRenderer assetRenderer = workflowHandler.getAssetRenderer(classPK);
AssetRendererFactory assetRendererFactory = workflowHandler.getAssetRendererFactory(); AssetRendererFactory assetRendererFactory = workflowHandler.getAssetRendererFactory();
AssetEntry assetEntry = null; AssetEntry assetEntry = null;
if (assetRenderer != null) { if (assetRenderer != null) {
assetEntry = assetRendererFactory.getAssetEntry(assetRendererFactory.getClassName(), assetRenderer.getClassPK()); assetEntry = assetRendererFactory.getAssetEntry(assetRendererFactory.getClassName(), assetRenderer.getClassPK());
} }
String headerTitle = LanguageUtil.get(pageContext, workflowTask.getName()); String headerTitle = LanguageUtil.get(pageContext, workflowTask.getName());
headerTitle = headerTitle.concat(StringPool.COLON + StringPool.SPACE + workflowHandler.getTitle(classPK, locale)); headerTitle = headerTitle.concat(StringPool.COLON + StringPool.SPACE + workflowHandler.getTitle(classPK, locale));
@ -203,22 +217,16 @@ request.setAttribute(WebKeys.WORKFLOW_ASSET_PREVIEW, Boolean.TRUE);
<h2 class="title-action">Azioni</h2> <h2 class="title-action">Azioni</h2>
<div class="separator"></div> <div class="separator"></div>
</div> </div>
<% <%
request.removeAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW); request.removeAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
%> %>
<liferay-util:include page="/html/portlet/workflow_tasks/workflow_task_action.jsp"> <liferay-util:include page="/html/portlet/workflow_tasks/workflow_task_action.jsp">
<liferay-portlet:param name="viewFullContentURLString" value="<%= viewFullContentURLString %>"/> <liferay-portlet:param name="viewFullContentURLString" value="<%= viewFullContentURLString %>"/>
<!-- ADT BUG BO ID= 27 --> <!-- ADT BUG BO ID= 27 -->
<liferay-portlet:param name="classPkForCarichiLavoro" value="<%= String.valueOf(classPK) %>"/> <liferay-portlet:param name="classPkForCarichiLavoro" value="<%= String.valueOf(classPK) %>"/>
</liferay-util:include> </liferay-util:include>
</div> </div>
</div> </div>
<style> <style>
html { html {
padding: 0!important; padding: 0!important;
@ -333,11 +341,6 @@ color: #333!important;
color: black color: black
} }
</style> </style>
<aui:script use="liferay-workflow-tasks"> <aui:script use="liferay-workflow-tasks">
var onTaskClickFn = A.rbind('onTaskClick', Liferay.WorkflowTasks, ''); var onTaskClickFn = A.rbind('onTaskClick', Liferay.WorkflowTasks, '');
@ -345,7 +348,6 @@ color: #333!important;
Liferay.delegateClick('<portlet:namespace /><%= randomId %>taskAssignLink', onTaskClickFn); Liferay.delegateClick('<portlet:namespace /><%= randomId %>taskAssignLink', onTaskClickFn);
<%-- Liferay.delegateClick('<portlet:namespace /><%= randomId %>taskDueDateLink', onTaskClickFn); --%> <%-- Liferay.delegateClick('<portlet:namespace /><%= randomId %>taskDueDateLink', onTaskClickFn); --%>
</aui:script> </aui:script>
<% <%
PortalUtil.addPortletBreadcrumbEntry(request, headerTitle, currentURL); PortalUtil.addPortletBreadcrumbEntry(request, headerTitle, currentURL);
%> %>

Some files were not shown because too many files have changed in this diff Show More

Caricamento…
Annulla
Salva