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. 132
      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. 98
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/miei_task.jsp
  69. 102
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/task_miei_ruoli.jsp
  70. 173
      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. 10
      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. 33
      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. 83
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_instances/workflow_task_action.jsp
  100. 54
      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">
<dependency-type>uses</dependency-type>
</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">
<dependency-type>uses</dependency-type>
</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;
/**
* I valori di ritorno possibili sono:
* approvato,non_approvato,annullato,richiesta_integrazione
* I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
*
* @throws SystemException
* @throws PortalException

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:
* approvato,non_approvato,annullato,richiesta_integrazione
* I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
*
* @throws SystemException
* @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:
* approvato,non_approvato,annullato,richiesta_integrazione
* I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
*
* @throws SystemException
* @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;
/**
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per
* codice provincia. Modificata secondo il D.D.G. 334/2020
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia. Modificata secondo il
* D.D.G. 334/2020
*
* @author Manifattura Web Group per Regione Siciliana.
*/
@ -329,8 +329,7 @@ public interface IntPraticaLocalService extends BaseLocalService,
com.liferay.portal.kernel.exception.SystemException;
/**
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per
* codice provincia.
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia.
*
* @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
* codice provincia. Modificata secondo il D.D.G. 334/2020
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia. Modificata secondo il
* D.D.G. 334/2020
*
* @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
* codice provincia.
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia.
*
* @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
* codice provincia. Modificata secondo il D.D.G. 334/2020
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia. Modificata secondo il
* D.D.G. 334/2020
*
* @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
* codice provincia.
* Restituisce la lista di pratiche da sottoporre a sorteggio suddivisa per codice provincia.
*
* @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.json.JSONDeserializer;
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.workflow.WorkflowException;
import com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil;
@ -88,7 +89,7 @@ public class WorkflowUtil {
companyId, userId, workflowInstance.getWorkflowInstanceId(), true, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null);
for (WorkflowTask workflowTask : listaTmp) {
if (workflowTask.getName().equalsIgnoreCase("approvazione")) {
if (workflowTask.getName().equalsIgnoreCase(WorkflowConstants.WORKFLOW_TASKNAME_APPROVAZIONE)) {
return workflowTask;
}
}
@ -294,15 +295,15 @@ public class WorkflowUtil {
throws NumberFormatException, PortalException, SystemException {
switch (key) {
case "istruttore":
if (Validator.isNotNull(value) && !"0".equalsIgnoreCase(value)) {
if (Validator.isNotNull(value) && !"0".equals(value)) {
User istruttore = UserLocalServiceUtil.getUser(Long.valueOf(value));
value = istruttore.getFullName();
} else {
return "nessuno";
}
break;
case "esito":
if (Validator.isNotNull(value) && !"0".equalsIgnoreCase(value)) {
case WorkflowConstants.WORKFLOW_TASKNAME_ESITO:
if (Validator.isNotNull(value) && !"0".equals(value)) {
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId);
@ -325,7 +326,7 @@ public class WorkflowUtil {
break;
default:
if (Validator.isNull(value)) {
return "-";
return StringPool.DASH;
}
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());
PagamentoLocalServiceUtil.updatePagamento(pagamento);
esito.add("Pagamento " + pagamentoId + ": aggiunto file " + fileEntry.getFileEntryId()
+ StringPool.BLANK + title);
+ StringPool.SPACE + title);
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 "
+ controllo.getControlloPraticaId());
}
AvvisoLocalServiceUtil.addAvviso(intPraticaId, "", avviso.getDtAvviso(),
AvvisoLocalServiceUtil.addAvviso(intPraticaId, StringPool.BLANK, avviso.getDtAvviso(),
AvvisoUtil.TIPO_AVVISO_DIRETTO, avviso.getTipoDocumento(),
templateId, controllo.getDettPraticaId(),
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.repository.model.FileEntry;
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.model.Company;
import com.liferay.portal.model.Role;
@ -69,8 +70,7 @@ public class SorteggioPraticaUtil {
/**
*
* Implementazione della procedura di sorteggio secondo i requisiti della
* Regione Siciliana.
* Implementazione della procedura di sorteggio secondo i requisiti della Regione Siciliana.
*
* @author Manifattura Web Group per Regione Siciliana
* @param companyId
@ -78,16 +78,15 @@ public class SorteggioPraticaUtil {
* @throws PortalException
* @throws SystemException
*/
public static List<String> sorteggio(long companyId, Date dtSorteggio) throws PortalException,
SystemException {
public static List<String> sorteggio(long companyId, Date dtSorteggio) throws PortalException, SystemException {
List<String> esito = new ArrayList<>();
if (lock.tryLock()) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_FORMAT);
esito.add("Sorteggio iniziato in data " + sdf.format(dtSorteggio) + ".<br><br>");
Map<String, List<IntPratica>> sorteggiabili = IntPraticaLocalServiceUtil.findSorteggiabiliNew(
companyId, dtSorteggio);
Map<String, List<IntPratica>> sorteggiabili = IntPraticaLocalServiceUtil.findSorteggiabiliNew(companyId,
dtSorteggio);
int numeroSorteggiabili = 0;
for (Map.Entry<String, List<IntPratica>> s : sorteggiabili.entrySet()) {
@ -128,8 +127,7 @@ public class SorteggioPraticaUtil {
for (Map.Entry<Integer, IntPratica> m : mescolate.entrySet()) {
IntPratica pratica = m.getValue();
long intPraticaId = pratica.getIntPraticaId();
DettPratica dettPratica = DettPraticaLocalServiceUtil
.getLastCompletedByIntPratica(intPraticaId);
DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPraticaId);
ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(dettPratica.getCompanyId());
@ -138,16 +136,14 @@ public class SorteggioPraticaUtil {
if (contatore++ < numeroSorteggiate) {
sorteggiate.add(pratica);
esito.add("<li>Sorteggiata: " + pratica.getNumeroProgetto() + " (id " + intPraticaId
+ ") del " + sdf.format(pratica.getDtPratica()) + " (" + m.getKey()
+ ")</li>");
esito.add("<li>Sorteggiata: " + pratica.getNumeroProgetto() + " (id " + intPraticaId + ") del "
+ sdf.format(pratica.getDtPratica()) + " (" + m.getKey() + ")</li>");
} else {
pratica.setDtSorteggio(dtSorteggio);
IntPraticaLocalServiceUtil.updateIntPratica(pratica);
esito.add("<li>Non sorteggiata: " + pratica.getNumeroProgetto() + " (id "
+ intPraticaId + ") del " + sdf.format(pratica.getDtPratica()) + " ("
+ m.getKey() + ")</li>");
esito.add("<li>Non sorteggiata: " + pratica.getNumeroProgetto() + " (id " + intPraticaId
+ ") del " + sdf.format(pratica.getDtPratica()) + " (" + m.getKey() + ")</li>");
}
}
esito.add("</ol>");
@ -200,9 +196,9 @@ public class SorteggioPraticaUtil {
reportDto.setFolderId(folderReport.getFolderId());
reportDto.setFileName(reportFileName(companyId, dtSorteggio));
reportDto.setHeader("");
reportDto.setHeader(StringPool.BLANK);
reportDto.setHeaderHeight(1);
reportDto.setFooter("");
reportDto.setFooter(StringPool.BLANK);
reportDto.setFooterHeight(40);
reportDto.setParameters(parameters);
@ -254,10 +250,9 @@ public class SorteggioPraticaUtil {
DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica
.getIntPraticaId());
String committente = "";
List<Soggetto> soggetti = SoggettoLocalServiceUtil
.findByIntPratica_TipologiaSoggetto_Aggiuntivo_Rimosso(pratica.getIntPraticaId(),
TipoSoggettoUtil.COMMITTENTE, false, false);
String committente = StringPool.BLANK;
List<Soggetto> soggetti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto_Aggiuntivo_Rimosso(
pratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE, false, false);
if (soggetti.size() > 0) {
Soggetto soggetto = soggetti.get(0);
@ -282,21 +277,19 @@ public class SorteggioPraticaUtil {
sc.setScopeGroupId(dettPratica.getGroupId());
sc.setUserId(dettPratica.getUserId());
SorteggioLocalServiceUtil.addSorteggio(pratica.getIntPraticaId(), dettPratica.getDettPraticaId(),
anno, mese, sett, dtSorteggio, "", APERTO, "", progressivoEstrazione++,
pratica.getNumeroProgetto(), committente, comune.getDenominazione(),
provincia.getProvincia(), false, pratica.getIntPraticaId(), false, sc);
SorteggioLocalServiceUtil.addSorteggio(pratica.getIntPraticaId(), dettPratica.getDettPraticaId(), anno,
mese, sett, dtSorteggio, StringPool.BLANK, APERTO, StringPool.BLANK, progressivoEstrazione++,
pratica.getNumeroProgetto(), committente, comune.getDenominazione(), provincia.getProvincia(),
false, pratica.getIntPraticaId(), false, sc);
ControlloPratica controllo = ControlloPraticaLocalServiceUtil.addControlloPratica(
pratica.getGroupId(), pratica.getUserId(), pratica.getIntPraticaId(),
dettPratica.getDettPraticaId(), true, sc);
ControlloPratica controllo = ControlloPraticaLocalServiceUtil.addControlloPratica(pratica.getGroupId(),
pratica.getUserId(), pratica.getIntPraticaId(), dettPratica.getDettPraticaId(), true, sc);
long idTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(sc.getCompanyId(),
"conf.geniocivile.avviso.template.id.deposito.S");
AvvisoLocalServiceUtil.addAvviso(pratica.getIntPraticaId(), "Avviso di sorteggio", dtSorteggio,
AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.SOTTOPOSTA_A_PARERE, idTemplate,
dettPratica.getDettPraticaId(), DettPratica.class.getName(),
controllo.getControlloPraticaId(), sc);
dettPratica.getDettPraticaId(), DettPratica.class.getName(), controllo.getControlloPraticaId(), sc);
IntPraticaLocalServiceUtil.updateIntPraticaSorteggio(pratica.getIntPraticaId(), dtSorteggio,
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;
public class ControlloPraticaIndexer extends BaseIndexer {
public static final String[] CLASS_NAMES = { ControlloPratica.class.getName() };
public static final String PORTLET_ID = "1_WAR_portosfeportlet";
public static final Format DATE_FORMAT = FastDateFormatFactoryUtil.getSimpleDateFormat("yyyyMMdd");
private static final Log _log = LogFactoryUtil.getLog(ControlloPraticaIndexer.class);
public ControlloPraticaIndexer() {
setPermissionAware(true);
}
@Override
public String[] getClassNames() {
return CLASS_NAMES;
}
@Override
public String getPortletId() {
return PORTLET_ID;
}
@Override
protected void doDelete(Object obj) throws Exception {
if (Validator.isNotNull(obj)) {
ControlloPratica controlloPratica = (ControlloPratica) obj;
deleteDocument(controlloPratica.getCompanyId(), controlloPratica.getControlloPraticaId());
} else {
_log.warn("Received a null ControlloPratica to delete in input.");
}
}
@Override
protected Document doGetDocument(Object obj) throws Exception {
Document document = null;
if (Validator.isNotNull(obj)) {
ControlloPratica controlloPratica = (ControlloPratica) obj;
ControlloPratica controlloPraticaFromDB = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPratica.getControlloPraticaId());
if (_log.isDebugEnabled()) {
_log.debug("Indexing ControlloPratica: " + controlloPratica.getControlloPraticaId());
}
document = getBaseModelDocument(PORTLET_ID, controlloPratica);
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.PARERE_GEOLOGO, controlloPraticaFromDB.getParereGeologo());
document.addKeyword(PortosIndexField.STATUS, controlloPraticaFromDB.getStatus());
document.addKeyword(PortosIndexField.STATUS_BY_USERID, controlloPraticaFromDB.getStatusByUserId());
document.addKeyword(PortosIndexField.STATUS_BY_USERNAME,
controlloPraticaFromDB.getStatusByUserName());
document.addKeyword(PortosIndexField.STATUS_BY_USERNAME, controlloPraticaFromDB.getStatusByUserName());
if (controlloPraticaFromDB.getStatusDate() != null) {
document.addKeyword(PortosIndexField.STATUS_DATE,
DATE_FORMAT.format(controlloPraticaFromDB.getStatusDate()));
} else {
document.addKeyword(PortosIndexField.STATUS_DATE, 0);
}
document.addKeyword(PortosIndexField.DATA_INIZIO_PROCEDIMENTO,
DATE_FORMAT.format(controlloPraticaFromDB.getCreateDate()));
document.addKeywordSortable(PortosIndexField.DATA_INIZIO_PROCEDIMENTO,
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
document.addKeyword(PortosIndexField.INT_PRATICA_ID, controlloPraticaFromDB.getIntPraticaId());
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPraticaFromDB
.getIntPraticaId());
IntPratica intPratica = IntPraticaLocalServiceUtil
.fetchIntPratica(controlloPraticaFromDB.getIntPraticaId());
if (Validator.isNotNull(intPratica)) {
if (intPratica.getStatusByUserId() != 0L) {
document.addKeyword(PortosIndexField.ISTRUTTORE_USER_ID, intPratica.getStatusByUserId());
User userIstruttore = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (userIstruttore != null) {
document.addKeyword(PortosIndexField.ISTRUTTORE_FULL_NAME, userIstruttore
.getFullName().toUpperCase());
document.addKeyword(PortosIndexField.ISTRUTTORE_FULL_NAME, userIstruttore.getFullName()
.toUpperCase());
}
}
if (intPratica.getUserId() != 0L) {
User proprietarioDigitale = UserLocalServiceUtil.fetchUser(intPratica.getUserId());
if (proprietarioDigitale != null) {
document.addKeyword(PortosIndexField.PROPRIETARIO_DIGITALE_FULL_NAME,
proprietarioDigitale.getFullName().toUpperCase());
document.addKeyword(PortosIndexField.PROPRIETARIO_DIGITALE_FULL_NAME, proprietarioDigitale
.getFullName().toUpperCase());
}
}
// Informazioni sullo stato della pratica
boolean variata = false;
int countVariantiForIntPratica = DettPraticaLocalServiceUtil
.countVariateByIntPratica(intPratica.getIntPraticaId());
int countVariantiForIntPratica = DettPraticaLocalServiceUtil.countVariateByIntPratica(intPratica
.getIntPraticaId());
if (countVariantiForIntPratica > 0) {
variata = true;
}
document.addKeyword(PortosIndexField.VARIATA, variata);
document.addKeyword(PortosIndexField.COLLAUDO_COMPLETATO, intPratica.getCollaudoTotale());
document.addKeyword(PortosIndexField.COLLAUDO_PARZIALE, intPratica.getCollaudoParziale());
document.addKeyword(PortosIndexField.FINE_LAVORI_COMPLETATI, intPratica.getFineLavoriTotale());
@ -190,72 +159,51 @@ public class ControlloPraticaIndexer extends BaseIndexer {
checkSottopostaAParere(intPratica.getIntPraticaId()));
document.addKeyword(PortosIndexField.LAVORAZIONE_SORTEGGIATA,
checkLavorazioneSorteggiata(intPratica.getIntPraticaId()));
document.addKeyword(PortosIndexField.TIPO_PRATICA, intPratica.getTipoPratica());
document.addKeywordSortable(PortosIndexField.TIPO_PRATICA, intPratica.getTipoPratica());
document.addKeyword(PortosIndexField.NUMERO_PROGETTO,
Integer.valueOf(intPratica.getNumeroProgetto()));
document.addNumber(PortosIndexField.NUMERO_PROGETTO,
Integer.valueOf(intPratica.getNumeroProgetto()));
document.addKeyword(PortosIndexField.NUMERO_PROGETTO, Integer.valueOf(intPratica.getNumeroProgetto()));
document.addNumber(PortosIndexField.NUMERO_PROGETTO, Integer.valueOf(intPratica.getNumeroProgetto()));
document.addNumberSortable(PortosIndexField.NUMERO_PROGETTO,
Integer.valueOf(intPratica.getNumeroProgetto()));
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("controlloObbligatorio", intPratica.isControlloObbligatorio());
String tipoProcedura = intPratica.getTipoProcedura();
if (Validator.isNotNull(tipoProcedura)) {
if (tipoProcedura.equalsIgnoreCase(Constants.PROCEDURA_B1))
tipoProcedura = Constants.PROCEDURA_B;
document.addKeyword(PortosIndexField.TIPO_PROCEDURA, tipoProcedura);
}
// Prendo l ultimo DettPratica legato a IntPratica
DettPratica lastDettPratica = DettPraticaLocalServiceUtil
.getLastCompletedByIntPraticaAndProtocolloNotEmpty(intPratica.getIntPraticaId());
if (Validator.isNull(lastDettPratica)) {
lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica
.getIntPraticaId());
}
if (Validator.isNotNull(lastDettPratica)) {
document.addKeyword("nuovaCostruzione", lastDettPratica.getTcNuovaCostruzione());
document.addKeyword("adeguamentoSismico", lastDettPratica.getTcAdeguamentoSismico());
document.addKeyword("miglioramentoSismico", lastDettPratica.getTcMiglioramentoSismico());
document.addKeyword("interventoLocale",
lastDettPratica.getTcRiparazioneInterventoLocale());
if (lastDettPratica.getProtocollo() != null
&& !lastDettPratica.getProtocollo().equals("")) {
document.addKeyword("interventoLocale", lastDettPratica.getTcRiparazioneInterventoLocale());
if (Validator.isNotNull(lastDettPratica.getProtocollo())) {
document.addKeyword(PortosIndexField.PROTOCOLLO,
Long.parseLong(lastDettPratica.getProtocollo()));
document.addNumber(PortosIndexField.PROTOCOLLO,
Long.parseLong(lastDettPratica.getProtocollo()));
document.addNumber(PortosIndexField.PROTOCOLLO, Long.parseLong(lastDettPratica.getProtocollo()));
document.addNumberSortable(PortosIndexField.PROTOCOLLO,
Long.parseLong(lastDettPratica.getProtocollo()));
}
if (lastDettPratica.getVia() != null && !lastDettPratica.getVia().equals("")) {
if (Validator.isNotNull(lastDettPratica.getVia())) {
document.addKeyword(PortosIndexField.INDIRIZZO, lastDettPratica.getVia());
}
if (lastDettPratica.getLocalita() != null && !lastDettPratica.getLocalita().equals("")) {
if (Validator.isNotNull(lastDettPratica.getLocalita())) {
document.addKeyword(PortosIndexField.LOCALITA, lastDettPratica.getLocalita());
}
if (Validator.isNotNull(lastDettPratica.getDescLongIntervento())) {
document.addText(PortosIndexField.DESC_INTERVENTO,
lastDettPratica.getDescLongIntervento());
document.addKeyword(PortosIndexField.DESC_INTERVENTO,
lastDettPratica.getDescLongIntervento());
document.addKeyword(PortosIndexField.NUOVA_COSTRUZIONE,
lastDettPratica.getTcNuovaCostruzione());
document.addText(PortosIndexField.DESC_INTERVENTO, lastDettPratica.getDescLongIntervento());
document.addKeyword(PortosIndexField.DESC_INTERVENTO, lastDettPratica.getDescLongIntervento());
document.addKeyword(PortosIndexField.NUOVA_COSTRUZIONE, lastDettPratica.getTcNuovaCostruzione());
document.addKeyword(PortosIndexField.ADEGUAMENTO_SISMICO,
lastDettPratica.getTcAdeguamentoSismico());
document.addKeyword(PortosIndexField.MIGLIORAMENTO_SISMICO,
@ -264,7 +212,6 @@ public class ControlloPraticaIndexer extends BaseIndexer {
lastDettPratica.getTcRiparazioneInterventoLocale());
}
}
// Gestione pratica aperta/chiusa fine lavori
if (intPratica.getCollaudoTotale()) {
document.addKeyword(PortosIndexField.PRATICA_APERTA, false);
@ -277,171 +224,109 @@ public class ControlloPraticaIndexer extends BaseIndexer {
} else {
document.addKeyword(PortosIndexField.PRATICA_APERTA, true);
}
if (intPratica.getStatoPratica().equals(StatoPraticaConstants.INTEGRAZIONE)) {
document.addKeyword(PortosIndexField.PRATICA_APERTA, true);
}
// Prendo la lista dei soggetti committenti legati a IntPratica
List<Soggetto> committenti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
intPratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE);
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>();
for (Soggetto soggetto : committenti) {
// listaSoggetti.add(soggetto.getCodiceFiscale().toUpperCase());
listaSoggetti.add(soggetto.getNome().toUpperCase() + " "
+ soggetto.getCognome().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]));
}
// Soggetti Interconnessi
List<Soggetto> listSoggettiInterconnessi = SoggettoLocalServiceUtil
.getSoggettiByIntPraticaId_DtRimozioneNull(intPratica.getIntPraticaId());
if (listSoggettiInterconnessi != null && !listSoggettiInterconnessi.isEmpty()) {
List<String> listaStringata = new ArrayList<String>();
for (Soggetto sog : listSoggettiInterconnessi) {
listaStringata
.add(sog.getNome().toUpperCase() + " " + sog.getCognome().toUpperCase());
listaStringata.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
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.getComuneId())) {
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
if (Validator.isNotNull(comune)) {
document.addKeyword(PortosIndexField.COMUNE_ID, comune.getComuneId());
document.addKeyword(PortosIndexField.COMUNE_DENOMINAZIONE,
comune.getDenominazione());
document.addKeyword(PortosIndexField.COMUNE_DENOMINAZIONE, comune.getDenominazione());
}
if (Validator.isNotNull(territorio.getCodiceProvincia())) {
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(
territorio.getCompanyId(), territorio.getCodiceProvincia());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia());
if (Validator.isNotNull(provincia)) {
document.addKeyword(PortosIndexField.PROVINCIA_ID,
provincia.getProvinciaId());
document.addKeyword(PortosIndexField.PROVINCIA_ID, provincia.getProvinciaId());
document.addKeyword(PortosIndexField.PROVINCIA_CODICE,
provincia.getCodiceProvincia());
document.addKeyword(PortosIndexField.PROVINCIA_NAME,
provincia.getProvincia());
document.addKeyword(PortosIndexField.PROVINCIA_NAME, provincia.getProvincia());
}
}
}
}
}
}
// Indicizzazione campi da Kaleo
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil
.fetchWorkflowInstanceLink(controlloPraticaFromDB.getCompanyId(),
controlloPraticaFromDB.getGroupId(), ControlloPratica.class.getName(),
controlloPraticaFromDB.getPrimaryKey());
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink(
controlloPraticaFromDB.getCompanyId(), controlloPraticaFromDB.getGroupId(),
ControlloPratica.class.getName(), controlloPraticaFromDB.getPrimaryKey());
if (Validator.isNotNull(workflowInstanceLink)) {
long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId();
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(
controlloPraticaFromDB.getCompanyId(), workflowInstanceId);
if (Validator.isNotNull(workflowInstance)) {
document.addKeyword(PortosIndexField.WORKFLOW_STATE, workflowInstance.getState());
List<WorkflowTask> listaTask = WorkflowTaskManagerUtil
.getWorkflowTasksByWorkflowInstance(controlloPraticaFromDB.getCompanyId(), null,
workflowInstance.getWorkflowInstanceId(), false, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null);
List<WorkflowTask> listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(
controlloPraticaFromDB.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(),
false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
if (Validator.isNotNull(listaTask) && !listaTask.isEmpty()) {
WorkflowTask task = listaTask.get(0);
if (task.getAssigneeUserId() != 0L && task.getAssigneeUserId() != -1) {
document.addKeyword(PortosIndexField.TASK_ASSIGNEE_USER_ID,
task.getAssigneeUserId());
document.addKeyword(PortosIndexField.TASK_ASSIGNEE_USER_ID, task.getAssigneeUserId());
} else if (workflowInstance.getState().equals("Esito")) {
_log.warn("Fascicolo Disallineato su Kaleo : assenza assegnazione istruttore | kaleoInstanceId="
+ workflowInstance.getWorkflowInstanceId());
}
if (Validator.isNotNull(task.getWorkflowTaskAssignees())
&& !task.getWorkflowTaskAssignees().isEmpty()) {
List<String> roleIdsAssignee = new ArrayList<String>();
for (WorkflowTaskAssignee taskAssignee : task.getWorkflowTaskAssignees()) {
if (taskAssignee.getAssigneeClassName().equals(Role.class.getName())) {
roleIdsAssignee.add("R" + taskAssignee.getAssigneeClassPK() + "G"
+ controlloPraticaFromDB.getGroupId());
}
}
document.addKeyword(PortosIndexField.TASK_ASSIGNEE_ROLE_IDS,
roleIdsAssignee.toArray(new String[0]));
}
document.addKeyword(PortosIndexField.WORKFLOW_DEFINITION_NAME,
workflowInstance.getWorkflowDefinitionName());
document.addKeyword(PortosIndexField.WORKFLOW_DEFINITION_VERSION,
workflowInstance.getWorkflowDefinitionVersion());
document.addKeyword(PortosIndexField.TASK_NAME, task.getName());
document.addKeywordSortable(PortosIndexField.TASK_NAME, task.getName());
}
}
}
} else {
_log.warn("Received a null ControlloPratica in input.");
}
return document;
}
@Override
protected Document getBaseModelDocument(String portletId, BaseModel<?> baseModel) throws SystemException {
Document document = newDocument();
String className = baseModel.getModelClassName();
long classPK = 0;
long resourcePrimKey = 0;
if (baseModel instanceof ResourcedModel) {
ResourcedModel resourcedModel = (ResourcedModel) baseModel;
classPK = resourcedModel.getResourcePrimKey();
@ -449,53 +334,36 @@ public class ControlloPraticaIndexer extends BaseIndexer {
} else {
classPK = GetterUtil.getLong(baseModel.getPrimaryKeyObj());
}
document.addUID(portletId, classPK, className);
document.addKeyword(Field.ENTRY_CLASS_NAME, className);
document.addKeyword(Field.ENTRY_CLASS_PK, classPK);
document.addKeyword(Field.PORTLET_ID, portletId);
if (resourcePrimKey > 0) {
document.addKeyword(Field.ROOT_ENTRY_CLASS_PK, resourcePrimKey);
}
if (baseModel instanceof AuditedModel) {
AuditedModel auditedModel = (AuditedModel) baseModel;
document.addKeyword(Field.COMPANY_ID, auditedModel.getCompanyId());
document.addDate(Field.CREATE_DATE, auditedModel.getCreateDate());
document.addDate(Field.MODIFIED_DATE, auditedModel.getModifiedDate());
document.addKeyword(Field.USER_ID, auditedModel.getUserId());
String userName = PortalUtil.getUserName(auditedModel.getUserId(), auditedModel.getUserName());
document.addKeyword(Field.USER_NAME, userName, true);
}
GroupedModel groupedModel = null;
if (baseModel instanceof GroupedModel) {
groupedModel = (GroupedModel) baseModel;
document.addKeyword(Field.GROUP_ID, getSiteGroupId(groupedModel.getGroupId()));
document.addKeyword(Field.SCOPE_GROUP_ID, groupedModel.getGroupId());
}
if ((groupedModel != null) && (baseModel instanceof TrashedModel)) {
TrashedModel trashedModel = (TrashedModel) baseModel;
if (trashedModel.isInTrash()) {
addTrashFields(document, trashedModel);
}
}
addAssetFields(document, className, classPK);
return document;
}
@Override
@ -503,14 +371,11 @@ public class ControlloPraticaIndexer extends BaseIndexer {
throws Exception {
if (Validator.isNotNull(document)) {
String title = document.get("");
String content = document.get("");
String controlloPraticaId = document.get(PortosIndexField.CONTROLLO_PRATICA_ID);
portletURL.setParameter("struts_action", "/web/TODO");
portletURL.setParameter("intPraticaId", controlloPraticaId);
return new Summary(title, content, portletURL);
} else {
_log.warn("Received a null document in input.");
@ -520,14 +385,10 @@ public class ControlloPraticaIndexer extends BaseIndexer {
@Override
protected void doReindex(Object obj) throws Exception {
if (Validator.isNotNull(obj)) {
ControlloPratica controlloPratica = (ControlloPratica) obj;
Document document = getDocument(controlloPratica);
SearchEngineUtil.updateDocument(getSearchEngineId(), controlloPratica.getCompanyId(), document,
false);
SearchEngineUtil.updateDocument(getSearchEngineId(), controlloPratica.getCompanyId(), document, false);
} else {
_log.warn("Received a null ControlloPratica in input.");
}
@ -535,24 +396,19 @@ public class ControlloPraticaIndexer extends BaseIndexer {
@Override
protected void doReindex(String[] ids) throws Exception {
_log.debug("doReindex ControlloPratica");
if (ids != null && ids.length > 0) {
long companyId = GetterUtil.getLong(ids[0]);
reindexControlloPratica(companyId);
} else {
_log.warn("Received a null or empty set of ids.");
}
}
protected void reindexControlloPratica(long companyId) throws PortalException, SystemException {
ActionableDynamicQuery actionableDynamicQuery = new ControlloPraticaActionableDynamicQuery() {
@Override
protected void performAction(Object object) throws PortalException {
if (object != null) {
ControlloPratica controlloPratica = (ControlloPratica) object;
if (controlloPratica != null) {
@ -574,9 +430,7 @@ public class ControlloPraticaIndexer extends BaseIndexer {
}
}
}
};
actionableDynamicQuery.setCompanyId(companyId);
actionableDynamicQuery.setSearchEngineId(getSearchEngineId());
actionableDynamicQuery.performActions();
@ -584,29 +438,15 @@ public class ControlloPraticaIndexer extends BaseIndexer {
@Override
protected void doReindex(String className, long id) throws Exception {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(id);
doReindex(controlloPratica);
}
private boolean checkSottopostaAParere(long intPraticaId) throws SystemException, PortalException {
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 {
Sorteggio sorteggio = SorteggioLocalServiceUtil.findByIntPratica(intPraticaId);
if (Validator.isNotNull(sorteggio)) {
return true;
@ -617,8 +457,6 @@ public class ControlloPraticaIndexer extends BaseIndexer {
@Override
protected String getPortletId(SearchContext searchContext) {
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.LogFactoryUtil;
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.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory;
@ -44,29 +45,22 @@ public class AmministrazionePortlet extends MVCPortlet {
private static final Log _log = LogFactoryUtil.getLog(AmministrazionePortlet.class);
public void saveProvincia(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long provinciaId = ParamUtil.getLong(actionRequest, "provinciaId");
String codiceProvincia = ParamUtil.getString(actionRequest, "codiceProvincia");
String provincia = ParamUtil.getString(actionRequest, "provincia");
String regione = ParamUtil.getString(actionRequest, "regione");
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);
try {
Provincia provinciaO = null;
if (provinciaId == 0) {
provinciaO = ProvinciaLocalServiceUtil.addProvincia(userId, codiceProvincia, provincia,
regione, sigla, serviceContext);
provinciaO = ProvinciaLocalServiceUtil.addProvincia(userId, codiceProvincia, provincia, regione, sigla,
serviceContext);
} else {
provinciaO = ProvinciaLocalServiceUtil.updateProvincia(userId, provinciaId, provincia,
regione, sigla, serviceContext);
provinciaO = ProvinciaLocalServiceUtil.updateProvincia(userId, provinciaId, provincia, regione, sigla,
serviceContext);
}
String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) {
actionRequest.setAttribute(WebKeys.PORTOS_AMM_PROVINCIA, provinciaO);
@ -74,76 +68,53 @@ public class AmministrazionePortlet extends MVCPortlet {
}
} catch (PortalException e) {
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/province/edit.jsp");
throw e;
}
}
public void saveConfigScheduler(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
public void saveConfigScheduler(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
serviceContext.setScopeGroupId(-1L);
serviceContext.setCompanyId(serviceContext.getCompanyId());
String schedulerVersioning = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.SCHEDULER_VERSIONING);
String schedulerGeneraDocumento = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.SCHEDULER_GENERA_DOCUMENTO);
String schedulerFirmaDocumento = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.SCHEDULER_FIRMA_DOCUMENTO);
String schedulerInvioDocumento = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.SCHEDULER_INVIO_DOCUMENTO);
String schedulerIris = ParamUtil.getString(actionRequest, ConfigurazioneConstants.SCHEDULER_IRIS);
String irisVerificaPagamentiURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.IRIS_VERIFICA_PAGAMENTI_URL);
String protocollazioneServiceURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_URL);
String protocollazioneExportURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_EXPORT_URL);
String protocollazioneImportURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_IMPORT_URL);
String irisComunicazioniDebitorieURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.IRIS_COMUNICAZIONI_DEBITORIE_URL);
String irisGenerazioneIUVURL = ParamUtil.getString(actionRequest,
ConfigurazioneConstants.IRIS_GENERAZIONE_IUV_URL);
String importoBollo = ParamUtil.getString(actionRequest, ConfigurazioneConstants.IMPORTO_BOLLO);
int dayOfWeekSorteggio = ParamUtil.getInteger(actionRequest,
ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO);
int hourOfDaySorteggio = ParamUtil.getInteger(actionRequest,
ConfigurazioneConstants.HOUR_OF_DAY_SORTEGGIO);
int dayOfWeekSorteggio = ParamUtil.getInteger(actionRequest, ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO);
int hourOfDaySorteggio = ParamUtil.getInteger(actionRequest, ConfigurazioneConstants.HOUR_OF_DAY_SORTEGGIO);
hourOfDaySorteggio = Math.min(23, Math.max(0, hourOfDaySorteggio));
int dayOfWeekPubblicazione = ParamUtil.getInteger(actionRequest,
ConfigurazioneConstants.DAY_OF_WEEK_PUBBLICAZIONE);
int startDaySorteggio = ParamUtil.getInteger(actionRequest,
ConfigurazioneConstants.START_DAY_SORTEGGIO);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_VERSIONING,
schedulerVersioning, serviceContext);
int startDaySorteggio = ParamUtil.getInteger(actionRequest, ConfigurazioneConstants.START_DAY_SORTEGGIO);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_VERSIONING, schedulerVersioning,
serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_GENERA_DOCUMENTO,
schedulerGeneraDocumento, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_FIRMA_DOCUMENTO,
schedulerFirmaDocumento, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_INVIO_DOCUMENTO,
schedulerInvioDocumento, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.SCHEDULER_IRIS, schedulerIris,
serviceContext);
ConfigurazioneServiceUtil
.storeConfig(ConfigurazioneConstants.SCHEDULER_IRIS, schedulerIris, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IRIS_VERIFICA_PAGAMENTI_URL,
irisVerificaPagamentiURL, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_URL,
@ -156,77 +127,52 @@ public class AmministrazionePortlet extends MVCPortlet {
irisComunicazioniDebitorieURL, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IRIS_GENERAZIONE_IUV_URL,
irisGenerazioneIUVURL, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IMPORTO_BOLLO, importoBollo,
serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.IMPORTO_BOLLO, importoBollo, serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO,
String.valueOf(dayOfWeekSorteggio), serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.HOUR_OF_DAY_SORTEGGIO,
String.valueOf(hourOfDaySorteggio), serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.DAY_OF_WEEK_PUBBLICAZIONE,
String.valueOf(dayOfWeekPubblicazione), serviceContext);
ConfigurazioneServiceUtil.storeConfig(ConfigurazioneConstants.START_DAY_SORTEGGIO,
String.valueOf(startDaySorteggio), serviceContext);
String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) {
actionResponse.setRenderParameter("tabs1", "parametri");
}
} catch (PortalException e) {
_log.error("Error", e);
throw new PortletException(e);
} catch (SystemException e) {
} catch (PortalException | SystemException e) {
_log.error("Error", e);
throw new PortletException(e);
throw e;
}
}
public void saveConfigTemplate(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
public void saveConfigTemplate(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
final String _PREFIX_START_CONFIGURAZIONE = "configurazione--";
final String _PREFIX_END_CONFIGURAZIONE = "--";
Enumeration<String> enu = actionRequest.getParameterNames();
while (enu.hasMoreElements()) {
String name = enu.nextElement();
if (!name.startsWith(_PREFIX_START_CONFIGURAZIONE) && !name.endsWith("--")) {
continue;
}
String key = name.substring(_PREFIX_START_CONFIGURAZIONE.length(), name.length()
- _PREFIX_END_CONFIGURAZIONE.length());
String value = ParamUtil.getString(actionRequest, name);
ConfigurazioneServiceUtil.storeConfig(key, value, serviceContext);
}
String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) {
actionResponse.setRenderParameter("tabs1", "parametri");
}
} catch (PortalException e) {
} catch (PortalException | SystemException e) {
_log.error("Error", e);
throw new PortletException(e);
} catch (SystemException e) {
_log.error("Error", e);
throw new PortletException(e);
throw e;
}
}
public void saveComune(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long comuneId = ParamUtil.getLong(actionRequest, "comuneId");
String codiceProvincia = ParamUtil.getString(actionRequest, "codiceProvincia");
String codiceComune = ParamUtil.getString(actionRequest, "codiceComune");
@ -236,24 +182,18 @@ public class AmministrazionePortlet extends MVCPortlet {
String mailSuap = ParamUtil.getString(actionRequest, "mailSuap");
String mailSue = ParamUtil.getString(actionRequest, "mailSue");
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);
try {
Comune comune = null;
if (comuneId == 0) {// ADD
codiceComune = codiceIstat.substring(0, 3);
comune = ComuneLocalServiceUtil.addComune(userId, codiceProvincia, codiceComune, codiceIstat,
codiceBelfiore, denominazione, provincia, mailSuap, mailSue, serviceContext);
} else {// EDIT
ComuneLocalServiceUtil.updateComune(userId, comuneId, codiceProvincia, codiceComune,
codiceIstat, denominazione, provincia, mailSuap, mailSue, serviceContext);
ComuneLocalServiceUtil.updateComune(userId, comuneId, codiceProvincia, codiceComune, codiceIstat,
denominazione, provincia, mailSuap, mailSue, serviceContext);
}
String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) {
actionRequest.setAttribute(WebKeys.PORTOS_AMM_COMUNE, comune);
@ -261,13 +201,11 @@ public class AmministrazionePortlet extends MVCPortlet {
}
} catch (PortalException e) {
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/comuni/edit.jsp");
throw e;
}
}
public void saveTerritorio(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long territorioId = ParamUtil.getLong(actionRequest, "territorioId");
long comuneId = ParamUtil.getLong(actionRequest, "comuneId");
long groupId = ParamUtil.getLong(actionRequest, "groupId");
@ -279,27 +217,17 @@ public class AmministrazionePortlet extends MVCPortlet {
String agMax = ParamUtil.getString(actionRequest, "agMax");
String agMin = ParamUtil.getString(actionRequest, "agMin");
Comune comune = ComuneLocalServiceUtil.getComune(comuneId);
Provincia provincia = ProvinciaLocalServiceUtil.findByC_C(comune.getCompanyId(),
comune.getCodiceProvincia());
ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(),
actionRequest);
Provincia provincia = ProvinciaLocalServiceUtil.findByC_C(comune.getCompanyId(), comune.getCodiceProvincia());
ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(), actionRequest);
Territorio territorio = null;
if (territorioId == 0) {
territorio = TerritorioServiceUtil.addTerritorio(comuneId, groupId,
provincia.getCodiceProvincia(), zona, fascia, articolo61, dtIni, dtFin, agMax, agMin, 0L,
serviceContext);
territorio = TerritorioServiceUtil.addTerritorio(comuneId, groupId, provincia.getCodiceProvincia(), zona,
fascia, articolo61, dtIni, dtFin, agMax, agMin, 0L, serviceContext);
} else {
territorio = TerritorioLocalServiceUtil.updateTerritorio(territorioId, groupId, comuneId,
provincia.getCodiceProvincia(), zona, fascia, articolo61, dtIni, dtFin, agMax, agMin,
serviceContext);
}
String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) {
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 {
long comuneId = ParamUtil.getLong(actionRequest, "comuneId");
if (comuneId > 0)
if (comuneId > 0) {
ComuneLocalServiceUtil.deleteComune(comuneId);
}
}
public void deleteComunes(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long[] deleteComuneIds = ParamUtil.getLongValues(actionRequest, "deleteComuneIds");
for (long deleteComuneId : deleteComuneIds) {
ComuneLocalServiceUtil.deleteComune(deleteComuneId);
}
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/comuni/view.jsp");
}
public void deleteProvincia(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long provinciaId = ParamUtil.getLong(actionRequest, "provinciaId");
if (provinciaId > 0) {
ProvinciaLocalServiceUtil.deleteProvincia(provinciaId);
}
}
public void deleteProvincias(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long[] deleteProvinciaIds = ParamUtil.getLongValues(actionRequest, "deleteProvinciaIds");
for (long deleteProvinciaId : deleteProvinciaIds) {
ProvinciaLocalServiceUtil.deleteProvincia(deleteProvinciaId);
}
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/province/view.jsp");
}
public void deleteTerritorio(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long territorioId = ParamUtil.getLong(actionRequest, "territorioId");
if (territorioId > 0) {
ComuneLocalServiceUtil.deleteComune(territorioId);
}
}
public void importProvincias(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) uploadPortletRequest.getAttribute(WebKeys.THEME_DISPLAY);
String delimiter = ParamUtil.getString(uploadPortletRequest, "delimiter");
File file = uploadPortletRequest.getFile("file");
if (Validator.isNull(file)) {
throw new CSVFileNotFoundException();
}
if (Validator.isNull(delimiter)) {
throw new PortletException("Delimiter is null in request");
}
ServiceContext serviceContext = ServiceContextFactory.getInstance(Provincia.class.getName(),
uploadPortletRequest);
try {
_log.info("Inizio importazione province...");
long start = System.currentTimeMillis();
CSVFormat format = CSVFormat.EXCEL.withDelimiter(delimiter.charAt(0))
.withHeader(Constants.AMMINISTRAZIONE_CSV_HEADERS_PROVINCE).withSkipHeaderRecord()
.withIgnoreEmptyLines().withIgnoreSurroundingSpaces();
Iterable<CSVRecord> records = format.parse(new FileReader(file));
for (CSVRecord csvRecord : records) {
try {
String codiceProvincia = StringUtils.leftPad(
String.format(csvRecord.get("codice_provincia")), 3, '0');
String codiceProvincia = StringUtils.leftPad(String.format(csvRecord.get("codice_provincia")), 3,
'0');
String provincia = csvRecord.get("provincia");
String regione = csvRecord.get("regione");
String sigla = csvRecord.get("sigla");
Provincia provinciaO = null;
provinciaO = ProvinciaLocalServiceUtil.fetchByC_C(themeDisplay.getCompanyId(),
codiceProvincia);
provinciaO = ProvinciaLocalServiceUtil.fetchByC_C(themeDisplay.getCompanyId(), codiceProvincia);
if (provinciaO == null) {
provinciaO = ProvinciaLocalServiceUtil.fetchByC_S(themeDisplay.getCompanyId(), sigla);
}
if (provinciaO == null) {
_log.info("La provincia non esiste e verrà creata: " + csvRecord);
ProvinciaLocalServiceUtil.addProvincia(themeDisplay.getUserId(), codiceProvincia,
provincia, regione, sigla, serviceContext);
ProvinciaLocalServiceUtil.addProvincia(themeDisplay.getUserId(), codiceProvincia, provincia,
regione, sigla, serviceContext);
} else {
_log.info("La provincia esiste e verrà aggiornata: " + csvRecord);
ProvinciaLocalServiceUtil.updateProvincia(themeDisplay.getUserId(),
provinciaO.getPrimaryKey(), provincia, regione, sigla, serviceContext);
ProvinciaLocalServiceUtil.updateProvincia(themeDisplay.getUserId(), provinciaO.getPrimaryKey(),
provincia, regione, sigla, serviceContext);
}
} catch (PortalException e) {
_log.error("Errore di validazione: " + e.getClass().getName());
}
}
long stop = System.currentTimeMillis();
_log.info("Importazione province terminata in " + (stop - start) + "ms");
} catch (Exception e) {
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/province/import.jsp");
throw e;
}
}
public void importComunes(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) uploadPortletRequest.getAttribute(WebKeys.THEME_DISPLAY);
String delimiter = ParamUtil.getString(uploadPortletRequest, "delimiter");
File file = uploadPortletRequest.getFile("file");
if (Validator.isNull(delimiter) || Validator.isNull(file))
if (Validator.isNull(delimiter) || Validator.isNull(file)) {
throw new CSVFileNotFoundException();
ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(),
uploadPortletRequest);
}
ServiceContext serviceContext = ServiceContextFactory.getInstance(Comune.class.getName(), uploadPortletRequest);
try {
_log.info("Inizio importazione comuni...");
long start = System.currentTimeMillis();
CSVFormat format = CSVFormat.EXCEL.withDelimiter(delimiter.charAt(0))
.withHeader(Constants.AMMINISTRAZIONE_CSV_HEADERS_COMUNI).withSkipHeaderRecord()
.withIgnoreEmptyLines().withIgnoreSurroundingSpaces();
Iterable<CSVRecord> records = format.parse(new FileReader(file));
for (CSVRecord csvRecord : records) {
try {
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 denominazione = csvRecord.get("Denominazione in italiano");
String provincia = csvRecord.get("Flag Comune capoluogo di provincia");
boolean nazioneEstera = codiceBelfiore != null && codiceBelfiore.startsWith("Z");
if (Validator.isNull(codiceIstat) && nazioneEstera) {
codiceIstat = codiceBelfiore;
}
if (Validator.isNull(codiceIstat)) {
_log.error("Il comune italiano non ha un codice istat assegnato e non sarà inserito: "
+ csvRecord);
} else {
boolean isProvincia = Validator.isNotNull(provincia) && provincia.equals("1") ? true
: false;
Comune comuneO = ComuneLocalServiceUtil.fetchByC_CB(themeDisplay.getCompanyId(),
codiceBelfiore);
boolean isProvincia = Validator.isNotNull(provincia) && provincia.equals("1") ? true : false;
Comune comuneO = ComuneLocalServiceUtil
.fetchByC_CB(themeDisplay.getCompanyId(), codiceBelfiore);
if (comuneO == null)
comuneO = ComuneLocalServiceUtil.fetchByC_CI(themeDisplay.getCompanyId(),
codiceIstat);
comuneO = ComuneLocalServiceUtil.fetchByC_CI(themeDisplay.getCompanyId(), codiceIstat);
if (comuneO == null) {
_log.debug("Il comune non esiste e verra' creato: " + csvRecord);
if (nazioneEstera)
ComuneLocalServiceUtil.addComune(themeDisplay.getUserId(), codiceProvincia,
codiceComune, codiceIstat, codiceBelfiore, denominazione, false,
true, "", "", serviceContext);
codiceComune, codiceIstat, codiceBelfiore, denominazione, false, true,
StringPool.BLANK, StringPool.BLANK, serviceContext);
else
ComuneLocalServiceUtil.addComune(themeDisplay.getUserId(), codiceProvincia,
codiceComune, codiceIstat, codiceBelfiore, denominazione,
isProvincia, false, "", "", serviceContext);
codiceComune, codiceIstat, codiceBelfiore, denominazione, isProvincia, false,
StringPool.BLANK, StringPool.BLANK, serviceContext);
} else {
_log.debug("Il comune esiste e verra' aggiornato: " + csvRecord);
ComuneLocalServiceUtil.updateComune(themeDisplay.getUserId(),
comuneO.getPrimaryKey(), codiceProvincia, codiceComune, codiceIstat,
denominazione, isProvincia, nazioneEstera, "", "", serviceContext);
ComuneLocalServiceUtil.updateComune(themeDisplay.getUserId(), comuneO.getPrimaryKey(),
codiceProvincia, codiceComune, codiceIstat, denominazione, isProvincia,
nazioneEstera, StringPool.BLANK, StringPool.BLANK, serviceContext);
}
}
} catch (PortalException e) {
_log.error("Errore di validazione: " + e.getClass().getName());
}
}
long stop = System.currentTimeMillis();
_log.info("Importazione comuni terminata in " + (stop - start) + "ms");
} catch (Exception e) {
actionResponse.setRenderParameter("mvcPath", "/html/amministrazione/tabs/comunes/import.jsp");
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
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil
.getHttpServletRequest(request));
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request));
String intPraticaId = httpReq.getParameter("intPraticaId");
if (Validator.isNotNull(intPraticaId) && !intPraticaId.equals("")) {
if (Validator.isNotNull(intPraticaId)) {
request.setAttribute("intPraticaId", intPraticaId);
}
super.render(request, response);
}
public void toggleWorkflow(ActionRequest actionRequest, ActionResponse actionResponse) {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
User user = themeDisplay.getUser();
boolean attivare = ParamUtil.getBoolean(actionRequest, "avviare");
boolean sospendere = ParamUtil.getBoolean(actionRequest, "sospendere");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0);
String stato_pratica = ParamUtil.getString(actionRequest, "seleziona_stato");
try {
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId);
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPraticaId);
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
if (attivare && !sospendere) {
WorkflowUtil.attivaWorkflow(intPraticaId, territorio.getGroupId(),
serviceContext.getUserId(), dettPratica.getDettPraticaId(), serviceContext, true);
addRowHistoryWorkflowAction(intPraticaId, dettPratica.getDettPraticaId(),
themeDisplay.getCompanyId(), intPratica.getGroupId(), user, true);
WorkflowUtil.attivaWorkflow(intPraticaId, territorio.getGroupId(), serviceContext.getUserId(),
dettPratica.getDettPraticaId(), serviceContext, true);
addRowHistoryWorkflowAction(intPraticaId, dettPratica.getDettPraticaId(), themeDisplay.getCompanyId(),
intPratica.getGroupId(), user, true);
SessionMessages.add(actionRequest, "success-workflow-ripreso");
} else if (!attivare && sospendere) {
WorkflowUtil.attivaWorkflow(intPraticaId, territorio.getGroupId(),
serviceContext.getUserId(), dettPratica.getDettPraticaId(), serviceContext, false);
addRowHistoryWorkflowAction(intPraticaId, dettPratica.getDettPraticaId(),
themeDisplay.getCompanyId(), intPratica.getGroupId(), user, false);
WorkflowUtil.attivaWorkflow(intPraticaId, territorio.getGroupId(), serviceContext.getUserId(),
dettPratica.getDettPraticaId(), serviceContext, false);
addRowHistoryWorkflowAction(intPraticaId, dettPratica.getDettPraticaId(), themeDisplay.getCompanyId(),
intPratica.getGroupId(), user, false);
SessionMessages.add(actionRequest, "success-workflow-sospeso");
} else {
SessionErrors.add(actionRequest, "error-workflow-stato-incosistente");
}
String redirectURL = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNotNull(redirectURL)) {
actionResponse.sendRedirect(redirectURL);
}
if (!attivare) {
intPratica.setStatoPratica(stato_pratica);
IntPraticaLocalServiceUtil.updateStatoPratica(intPraticaId, 0, stato_pratica);
@ -160,23 +146,17 @@ public class FascicoloPortlet extends MVCPortlet {
IntPraticaLocalServiceUtil.updateStatoPratica(intPraticaId, 0,
StatoPraticaConstants.SOTTOPOSTA_A_PARERE);
}
IntPraticaLocalServiceUtil.reIndexFasciolo(intPraticaId, intPratica.getCompanyId());
} catch (Exception e) {
_log.error("error-workflow-sospeso", e);
SessionErrors.add(actionRequest, attivare ? "error-workflow-sospeso" : "error-workflow-ripreso");
}
}
private void addRowHistoryWorkflowAction(long intPraticaId, long dettPraticaId, long companyId,
long groupId, User user, boolean attivato) throws SystemException {
private void addRowHistoryWorkflowAction(long intPraticaId, long dettPraticaId, long companyId, long groupId,
User user, boolean attivato) throws SystemException {
HistoryWorkflowAction historyWorkflowAction = HistoryWorkflowActionLocalServiceUtil
.createHistoryWorkflowAction(CounterLocalServiceUtil.increment(HistoryWorkflowAction.class
.getName()));
.createHistoryWorkflowAction(CounterLocalServiceUtil.increment(HistoryWorkflowAction.class.getName()));
historyWorkflowAction.setAttivato(attivato);
historyWorkflowAction.setCompanyId(companyId);
historyWorkflowAction.setCreateDate(new Date());
@ -186,33 +166,24 @@ public class FascicoloPortlet extends MVCPortlet {
historyWorkflowAction.setIntPraticaId(intPraticaId);
historyWorkflowAction.setDettPraticaId(dettPraticaId);
historyWorkflowAction.setGroupId(groupId);
HistoryWorkflowActionLocalServiceUtil.updateHistoryWorkflowAction(historyWorkflowAction);
}
public void toggleSospensione(ActionRequest actionRequest, ActionResponse actionResponse) {
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0);
boolean sospesa = ParamUtil.getBoolean(actionRequest, "sospesa");
try {
IntPraticaServiceUtil.sospendiPratica(intPraticaId, sospesa);
SessionMessages.add(actionRequest, sospesa ? "success-sospesa" : "success-ripresa");
} catch (PortalException | SystemException e) {
_log.error("error-workflow-sospeso", e);
SessionErrors.add(actionRequest, sospesa ? "error-sospesa" : "error-ripresa");
}
}
public void cambiaStato(ActionRequest actionRequest, ActionResponse actionResponse) {
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0);
String statoPratica = ParamUtil.getString(actionRequest, "nuovoStatoPratica");
_log.info("cambiaSospendiRiprendi: INTPRATICAID" + intPraticaId);
try {
_log.info("cambiaSospendiRiprendi: INTPRATICAID" + intPraticaId + " NUOVO STATO: " + statoPratica);
@ -222,15 +193,12 @@ public class FascicoloPortlet extends MVCPortlet {
_log.error("error-workflow-sospeso", e);
SessionErrors.add(actionRequest, "error-cambio-stato");
}
}
public void aggiungiRichiestaParere(ActionRequest actionRequest, ActionResponse actionResponse) {
long geologoId = ParamUtil.getLong(actionRequest, "geologoId");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
serviceContext.setCreateDate(new Date());
@ -243,37 +211,32 @@ public class FascicoloPortlet extends MVCPortlet {
}
public void cambiaTitolare(ActionRequest actionRequest, ActionResponse actionResponse) {
String nuovoSoggettoCF = ParamUtil.getString(actionRequest, "nuovoSoggettoCF");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0);
long companyId = ParamUtil.getLong(actionRequest, "companyId");
try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
User user = UserLocalServiceUtil.fetchUserByScreenName(companyId, nuovoSoggettoCF);
if (Validator.isNotNull(user)) {
if (!ValidazionePraticaUtil.praticaInProgress(intPraticaId)) {
_log.info("cambiaTitolare: cfNuovoTitolare " + nuovoSoggettoCF + " intpratica"
+ intPraticaId);
_log.info("cambiaTitolare: cfNuovoTitolare " + nuovoSoggettoCF + " intpratica" + intPraticaId);
IntPraticaServiceUtil.cambiaTitolare(intPraticaId, user.getUserId(), serviceContext);
SessionMessages.add(actionRequest, "success-cambio-titolare");
} else {
SessionErrors.add(actionRequest, "error-cambio-titolare-pratica-in-progress");
}
} else {
_log.error("[FASCICOLO ACTION - CAMBIO TITOLARE] Nessun utente trovato con company "
+ companyId + " e codice fiscale " + nuovoSoggettoCF);
_log.error("[FASCICOLO ACTION - CAMBIO TITOLARE] Nessun utente trovato con company " + companyId
+ " e codice fiscale " + nuovoSoggettoCF);
SessionErrors.add(actionRequest, "error-cambio-titolare-no-such-user");
}
} catch (PortalException | SystemException e) {
_log.error("error-cambio-titolare", e);
SessionErrors.add(actionRequest, "error-cambio-titolare");
}
}
public void searchURL(ActionRequest actionRequest, ActionResponse actionResponse) {
String numeroProgetto = actionRequest.getParameter("numeroProgetto");
String protocollo = actionRequest.getParameter("protocollo");
String tipoPratica = actionRequest.getParameter("tipoPratica");
@ -290,35 +253,26 @@ public class FascicoloPortlet extends MVCPortlet {
String comune = actionRequest.getParameter("comune");
String tipoIntervento = actionRequest.getParameter("tipoIntervento");
String indirizzo = actionRequest.getParameter("indirizzo");
if (dataRichiestaInizio != null && !dataRichiestaInizio.equals("")) {
String[] dataRichiestaInizioSplitted = dataRichiestaInizio.split("/");
int mounth = Integer.valueOf(dataRichiestaInizioSplitted[1]) - 1;
if (Validator.isNotNull(dataRichiestaInizio)) {
String[] dataRichiestaInizioSplitted = dataRichiestaInizio.split(StringPool.FORWARD_SLASH);
int month = Integer.valueOf(dataRichiestaInizioSplitted[1]) - 1;
actionResponse.setRenderParameter("dataRichiestaInizioDay", dataRichiestaInizioSplitted[0]);
actionResponse.setRenderParameter("dataRichiestaInizioMonth", mounth + "");
actionResponse.setRenderParameter("dataRichiestaInizioMonth", String.valueOf(month));
actionResponse.setRenderParameter("dataRichiestaInizioYear", dataRichiestaInizioSplitted[2]);
}
if (dataRichiestaFine != null && !dataRichiestaFine.equals("")) {
String[] dataRichiestaFineSplitted = dataRichiestaFine.split("/");
int mounth = Integer.valueOf(dataRichiestaFineSplitted[1]) - 1;
if (Validator.isNotNull(dataRichiestaFine)) {
String[] dataRichiestaFineSplitted = dataRichiestaFine.split(StringPool.FORWARD_SLASH);
int month = Integer.valueOf(dataRichiestaFineSplitted[1]) - 1;
actionResponse.setRenderParameter("dataRichiestaFineDay", dataRichiestaFineSplitted[0]);
actionResponse.setRenderParameter("dataRichiestaFineMonth", mounth + "");
actionResponse.setRenderParameter("dataRichiestaFineMonth", String.valueOf(month));
actionResponse.setRenderParameter("dataRichiestaFineYear", dataRichiestaFineSplitted[2]);
}
String ufficio = actionRequest.getParameter("ufficio");
String ordinaPer = actionRequest.getParameter("ordinaPer");
String ordinaTipo = actionRequest.getParameter("ordinaTipo");
if (tipoIntervento != null && !tipoIntervento.equals("")) {
if (Validator.isNotNull(tipoIntervento)) {
actionResponse.setRenderParameter("tipoIntervento", tipoIntervento);
}
actionResponse.setRenderParameter("numeroProgetto", numeroProgetto);
actionResponse.setRenderParameter("praticaAperta", praticaAperta);
actionResponse.setRenderParameter("descIntervento", descInterventoSearch);
@ -327,65 +281,51 @@ public class FascicoloPortlet extends MVCPortlet {
actionResponse.setRenderParameter("tipoPratica", tipoPratica);
actionResponse.setRenderParameter("statoPratica", statoPratica);
actionResponse.setRenderParameter("committente", committente);
if (provincia != null && !provincia.equals("")) {
if (Validator.isNotNull(provincia)) {
actionResponse.setRenderParameter("provincia", provincia);
}
if (comune != null && !comune.equals("")) {
if (Validator.isNotNull(comune)) {
actionResponse.setRenderParameter("comune", comune);
}
actionResponse.setRenderParameter("indirizzo", indirizzo);
if (tecnicoIstruttore != null && !tecnicoIstruttore.equals("")) {
actionResponse.setRenderParameter("tecnicoIstruttore", tecnicoIstruttore);
} else {
if (Validator.isNull(tecnicoIstruttore)) {
actionResponse.setRenderParameter("tecnicoIstruttore", StringPool.BLANK);
} else {
actionResponse.setRenderParameter("tecnicoIstruttore", tecnicoIstruttore);
}
actionResponse.setRenderParameter("titolareDigitale", titolareDigitale);
actionResponse.setRenderParameter("soggettiInterconnessi", soggettiInterconnessi);
actionResponse.setRenderParameter("dataRichiestaInizio", dataRichiestaInizio);
actionResponse.setRenderParameter("dataRichiestaFine", dataRichiestaFine);
if (ufficio != null && !ufficio.equals("")) {
actionResponse.setRenderParameter("ufficio", ufficio);
if (Validator.isNull(ufficio)) {
actionResponse.setRenderParameter("ufficio", "-1");
} else {
actionResponse.setRenderParameter("ufficio", -1 + "");
actionResponse.setRenderParameter("ufficio", ufficio);
}
actionResponse.setRenderParameter("ordinaPer", ordinaPer);
actionResponse.setRenderParameter("ordinaTipo", ordinaTipo);
}
public void versiona(ActionRequest actionRequest, ActionResponse actionResponse) {
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId", 0);
long companyId = ParamUtil.getLong(actionRequest, "companyId");
try {
DettPraticaServiceUtil.sendToVersioning(dettPraticaId, companyId);
} catch (Exception e) {
_log.error("error-versioning", e);
SessionErrors.add(actionRequest, "error-versioning");
}
PortalUtil.copyRequestParameters(actionRequest, actionResponse);
}
@Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
throws IOException, PortletException {
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
PortletException {
String id = resourceRequest.getResourceID();
ServiceContext serviceContext;
try {
serviceContext = ServiceContextFactory.getInstance(resourceRequest);
if ("downloadAllDocPratica".equals(id)) {
long intPraticaId = ParamUtil.getLong(resourceRequest, "intPraticaId");
long classPk = ParamUtil.getLong(resourceRequest, "classPk");
String comingFrom = ParamUtil.getString(resourceRequest, "comingFrom");
@ -403,14 +343,11 @@ public class FascicoloPortlet extends MVCPortlet {
} else if ("page_collaudo".equals(comingFrom)) {
tipologieAllegati = DocumentiPraticaUtil.getDocCollaudo();
}
docs = DocPraticaLocalServiceUtil.findByIntPratica_ClassPk_Tipologie(intPraticaId,
classPk, tipologieAllegati);
docs = DocPraticaLocalServiceUtil.findByIntPratica_ClassPk_Tipologie(intPraticaId, classPk,
tipologieAllegati);
}
ZipWriter zipWriter = ZipWriterFactoryUtil.getZipWriter();
for (DocPratica doc : docs) {
InputStream inputStream = null;
try {
if (Validator.isNull(doc.getDlFileEntryId())) {
@ -419,31 +356,23 @@ public class FascicoloPortlet extends MVCPortlet {
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(doc.getDlFileEntryId());
inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(),
fileEntry.getVersion(), false);
// String name = fileEntry.getTitle() +
// StringPool.PERIOD + fileEntry.getExtension();
String name = fileEntry.getTitle();
zipWriter.addEntry(name, inputStream);
} finally {
StreamUtil.cleanUp(inputStream);
}
}
resourceResponse.reset();
File file = zipWriter.getFile();
byte[] data = Files.readAllBytes(file.toPath());
resourceResponse.setContentType(ContentTypes.APPLICATION_ZIP);
resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate");
resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\""
+ file.getName() + "\"");
resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + file.getName() + "\"");
resourceResponse.setContentLength(data.length);
resourceResponse.getPortletOutputStream().write(data);
resourceResponse.getPortletOutputStream().flush();
resourceResponse.getPortletOutputStream().close();
} else if ("importFile".equals(id)) {
PortletResponseUtil
.write(resourceResponse,
@ -452,27 +381,23 @@ public class FascicoloPortlet extends MVCPortlet {
} else if ("importAllFascicoloFiles".equals(id)) {
long intPraticaId = ParamUtil.getLong(resourceRequest, "intPraticaId");
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
if (Validator.isNull(intPratica)) {
_log.error("error.no.intpratica.exist with intpraticaid=" + intPraticaId);
}
String comingFrom = ParamUtil.getString(resourceRequest, "comingFrom", "bo");
InfoFascicolo infoFascicolo = InfoFascicoloLocalServiceUtil.fetchByIntPratica(intPratica
.getIntPraticaId());
if (Validator.isNull(infoFascicolo)) {
infoFascicolo = InfoFascicoloLocalServiceUtil.addInfoFascicolo(
intPratica.getIntPraticaId(), intPratica.getNumeroProgetto(), serviceContext);
infoFascicolo = InfoFascicoloLocalServiceUtil.addInfoFascicolo(intPratica.getIntPraticaId(),
intPratica.getNumeroProgetto(), serviceContext);
} else {
if (infoFascicolo.getAlreadyImported() && comingFrom.equalsIgnoreCase("fe")) {
_log.error("intpratica.import.file.already-clicked with intpraticaid=" + intPraticaId);
return;
}
}
infoFascicolo.setAlreadyImported(true);
infoFascicolo = InfoFascicoloLocalServiceUtil.updateInfoFascicolo(infoFascicolo);
PortletResponseUtil
.write(resourceResponse,
"<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");
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
if (Validator.isNotNull(provinciaId) && !provinciaId.equals("0")) {
List<Long> comuniIds = TerritorioLocalServiceUtil
.getActiveComuniByCodiceProvincia(provinciaId);
List<Long> comuniIds = TerritorioLocalServiceUtil.getActiveComuniByCodiceProvincia(provinciaId);
// ADT BUG-ID=15 Sezione Ricerca / Ordinamento Filtro
List<Comune> comumeList = new ArrayList<Comune>();
for (long comuneId : comuniIds) {
Comune comune = ComuneLocalServiceUtil.getComune(comuneId);
comumeList.add(comune);
}
Collections.sort(comumeList, new Comparator<Comune>() {
@Override
public int compare(Comune o1, Comune o2) {
return o1.getDenominazione().compareTo(o2.getDenominazione());
}
});
for (Comune comune : comumeList) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("comuneId", comune.getComuneId());
jsonObject.put("descLong", comune.getDenominazione());
jsonArray.put(jsonObject);
}
}
writeJSON(resourceRequest, resourceResponse, jsonArray);
} 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();
User user = themeDisplay.getUser();
String csv = StringPool.BLANK;
HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest);
HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse);
csv = exportSearch(locale, resourceRequest, user);
ServletResponseUtil.sendFile(request, response, "export_ricerca.csv",
csv.getBytes(StringPool.UTF8), ContentTypes.TEXT_CSV_UTF8);
ServletResponseUtil.sendFile(request, response, "export_ricerca.csv", csv.getBytes(StringPool.UTF8),
ContentTypes.TEXT_CSV_UTF8);
} else {
super.serveResource(resourceRequest, resourceResponse);
}
@ -533,108 +444,74 @@ public class FascicoloPortlet extends MVCPortlet {
_log.error(e, e);
throw new IOException(e);
}
}
private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user) {
String method = "exportSearch";
HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest);
StringBuilder sb = new StringBuilder();
List<IntPratica> lista = new ArrayList<IntPratica>();
// try {
Hits hits = IntPraticaAdvancedSearch.searchProgettiBO(httpRequest, user, -1, -1);
for (Document doc : hits.toList()) {
String intPraticaId = doc.get("intPraticaId");
try {
if (Validator.isNotNull(intPraticaId)) {
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(GetterUtil
.getLong(intPraticaId));
IntPratica intPratica = IntPraticaLocalServiceUtil
.fetchIntPratica(GetterUtil.getLong(intPraticaId));
if (Validator.isNotNull(intPratica)) {
lista.add(intPratica);
}
}
} catch (Throwable e) {
_log.error(method + " IntPraticaLocalServiceUtil.fetchIntPratica IntPraticaId: "
+ intPraticaId, e);
_log.error(method + " IntPraticaLocalServiceUtil.fetchIntPratica IntPraticaId: " + 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(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.pratica")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.pratica")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.titolare")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.titolare")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.committenti")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.committenti")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.istruttore")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.istruttore")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.statoPratica")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.statoPratica")));
sb.append(StringPool.SEMICOLON);
// ADT BUG-ID=15 Sezione Ricerca / Export csv
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.provincia")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.comune")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.comune")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.descrizioneIntervento")));
sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE);
for (IntPratica intPratica : lista) {
try {
DettPratica lastDettPratica = DettPraticaLocalServiceUtil
.getLastCompletedByIntPratica(intPratica.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica
.getTerritorioId());
DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica
.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
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(StringPool.SEMICOLON);
String praticaLabel = intPratica.getTitle(locale, true);
sb.append(CSVUtil.encode(praticaLabel));
sb.append(StringPool.SEMICOLON);
List<Soggetto> titolari = SoggettoLocalServiceUtil.getValidByIntPratica_CodiceFiscale(
lastDettPratica.getIntPraticaId(),
lastDettPratica.getCodiceFiscaleDelegatoCommittente());
lastDettPratica.getIntPraticaId(), lastDettPratica.getCodiceFiscaleDelegatoCommittente());
Soggetto titolare = null;
if (!titolari.isEmpty()) {
titolare = titolari.get(0);
}
if (titolare != null) {
sb.append(titolare.getTitle() + " - " + titolare.getCodiceFiscale());
} else {
sb.append("");
sb.append(titolare.getTitle()).append(" - ").append(titolare.getCodiceFiscale());
}
sb.append(StringPool.SEMICOLON);
StringBuilder builder = new StringBuilder();
List<Soggetto> committenti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
lastDettPratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE);
for (Soggetto committente : committenti) {
@ -643,63 +520,39 @@ public class FascicoloPortlet extends MVCPortlet {
}
if (builder.length() > 0)
builder.setLength(builder.length() - 12);
sb.append(builder.toString());
sb.append(StringPool.SEMICOLON);
User istruttore = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (istruttore != null) {
sb.append(istruttore.getFullName());
} else {
sb.append("");
}
sb.append(StringPool.SEMICOLON);
sb.append(LanguageUtil.get(locale,
PraticaUtil.getStatoPraticaLabel(intPratica.getStatoPratica(), intPratica)));
sb.append(StringPool.SEMICOLON);
// 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(comune != null ? comune.getDenominazione() : "");
if (Validator.isNotNull(comune)) {
sb.append(comune.getDenominazione());
}
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
int MAX_LENGHT_DESCR_INTERVENTO = 30;
sb.append(lastDettPratica.getDescLongIntervento() == null ? "" : lastDettPratica
.getDescLongIntervento().length() > MAX_LENGHT_DESCR_INTERVENTO ? lastDettPratica
if (Validator.isNotNull(lastDettPratica.getDescLongIntervento())) {
sb.append(lastDettPratica.getDescLongIntervento().length() > MAX_LENGHT_DESCR_INTERVENTO ? lastDettPratica
.getDescLongIntervento().substring(0, MAX_LENGHT_DESCR_INTERVENTO) : lastDettPratica
.getDescLongIntervento());
}
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) {
_log.error(method + " IntPraticaId: " + intPratica != null ? intPratica.getIntPraticaId()
: "", e);
_log.error(method + " IntPraticaId: " + intPratica != null ? intPratica.getIntPraticaId() : "", e);
} finally {
sb.append(StringPool.NEW_LINE);
}
}
// } catch (PortalException e) {
// _log.error(e, e);
// } catch (SystemException e) {
// _log.error(e, e);
// }
return sb.toString();
}
}

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

@ -32,6 +32,7 @@ import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;
import javax.servlet.http.HttpServletRequest;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.json.JSONArray;
@ -60,14 +61,13 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
private static final Log _log = LogFactoryUtil.getLog(GestioneAttivitaIstruttorePortlet.class);
private static final String[] FIELD_NAMES = {"Tipo Pratica", "Numero Progetto", "Data Pratica", "Comune",
private static final String[] FIELD_NAMES = { "Tipo Pratica", "Numero Progetto", "Data Pratica", "Comune",
"Provincia", "Stato Pratica", "Committenti", "Direttore Lavori", "Tipologia Intervento", "Aperta",
"Collaudo Previsto", "Data Assegnazione" };
private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
public void searchURL(ActionRequest actionRequest, ActionResponse actionResponse) {
String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto");
String tipoPratica = ParamUtil.getString(actionRequest, "tipoPratica");
String statoPratica = ParamUtil.getString(actionRequest, "statoPratica");
@ -81,14 +81,12 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
String ordinaTipo = ParamUtil.getString(actionRequest, "ordinaTipo");
String comune = ParamUtil.getString(actionRequest, "comune");
String praticaAperta = ParamUtil.getString(actionRequest, "praticaAperta");
String interventoTutti = ParamUtil.getString(actionRequest, "interventoTutti");
String interventoNuovaCostruzione = ParamUtil.getString(actionRequest, "interventoNuovaCostruzione");
String interventoAdeguamentoSismico = ParamUtil.getString(actionRequest, "interventoAdeguamentoSismico");
String interventoMiglioramentoSismico = ParamUtil.getString(actionRequest, "interventoMiglioramentoSismico");
String interventoRiparazioneInterventoLocale =
ParamUtil.getString(actionRequest, "interventoRiparazioneInterventoLocale");
String interventoRiparazioneInterventoLocale = ParamUtil.getString(actionRequest,
"interventoRiparazioneInterventoLocale");
actionResponse.setRenderParameter("numeroProgetto", numeroProgetto);
actionResponse.setRenderParameter("tipoPratica", tipoPratica);
actionResponse.setRenderParameter("statoPratica", statoPratica);
@ -107,26 +105,21 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
actionResponse.setRenderParameter("interventoNuovaCostruzione", interventoNuovaCostruzione);
actionResponse.setRenderParameter("interventoAdeguamentoSismico", interventoAdeguamentoSismico);
actionResponse.setRenderParameter("interventoMiglioramentoSismico", interventoMiglioramentoSismico);
actionResponse.setRenderParameter("interventoRiparazioneInterventoLocale", interventoRiparazioneInterventoLocale);
actionResponse.setRenderParameter("interventoRiparazioneInterventoLocale",
interventoRiparazioneInterventoLocale);
}
@Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
PortletException {
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());
boolean isExport = "exportCVS".equals(resourceId);
HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest);
List<IntPratica> lista = new ArrayList<>();
Hits hits =
IntPraticaAdvancedSearch.searchAttivitaIstruttore(request, themeDisplay.getUser(), 0,
//ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV - Esportazione tutte i record
//Bug 33248
Hits hits = IntPraticaAdvancedSearch.searchAttivitaIstruttore(request, themeDisplay.getUser(), 0,
// ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV - Esportazione tutte i record
GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)), isExport);
try {
for (Document doc : hits.toList()) {
@ -149,164 +142,118 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
}
if (isExport && Validator.isNotNull(lista) && !lista.isEmpty()) {
StringBuilder sb = new StringBuilder();
for (String columnName : FIELD_NAMES) {
sb.append(columnName);
sb.append(StringPool.SEMICOLON);
}
sb.append(CharPool.NEW_LINE);
sb.append(CharPool.NEW_LINE);
for (IntPratica pratica : lista) {
try {
DettPratica lastDettPratica =
DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica.getIntPraticaId());
DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica
.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(pratica.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia =
ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), territorio.getCodiceProvincia());
List<Soggetto> committenti =
SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(pratica.getIntPraticaId(),
TipoSoggettoUtil.COMMITTENTE);
List<Soggetto> direttoreLavori =
SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(pratica.getIntPraticaId(),
TipoSoggettoUtil.DIRETTORE_LAVORI);
List<Soggetto> collaudatori =
SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(pratica.getIntPraticaId(),
TipoSoggettoUtil.COLLAUDATORE);
List<FineLavori> fineLavoriList =
FineLavoriLocalServiceUtil.findByIntPraticaId(pratica.getIntPraticaId(), -1, -1, null);
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia());
List<Soggetto> committenti = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
pratica.getIntPraticaId(), TipoSoggettoUtil.COMMITTENTE);
List<Soggetto> direttoreLavori = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
pratica.getIntPraticaId(), TipoSoggettoUtil.DIRETTORE_LAVORI);
List<Soggetto> collaudatori = SoggettoLocalServiceUtil.findByIntPratica_TipologiaSoggetto(
pratica.getIntPraticaId(), TipoSoggettoUtil.COLLAUDATORE);
List<FineLavori> fineLavoriList = FineLavoriLocalServiceUtil.findByIntPraticaId(
pratica.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
boolean compleatata = false;
for (FineLavori fineLavori : fineLavoriList) {
if (fineLavori.isCompletata() && !fineLavori.isParziale()) {
compleatata = true;
}
}
boolean collaudoPrevisto = false;
if (collaudatori != null && !collaudatori.isEmpty()) {
collaudoPrevisto = true;
}
sb.append(pratica.getTipoPratica());
sb.append(StringPool.SEMICOLON);
sb.append(pratica.getNumeroProgetto());
sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(pratica.getDtPratica())) {
sb.append(sdf.format(pratica.getDtPratica()));
} else {
sb.append("");
}
sb.append(StringPool.SEMICOLON);
sb.append(comune.getDenominazione());
sb.append(StringPool.SEMICOLON);
sb.append(provincia.getProvincia());
sb.append(StringPool.SEMICOLON);
sb.append(pratica.getStatoPratica());
sb.append(StringPool.SEMICOLON);
for (Soggetto soggetto : committenti) {
//ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV
// sb.append(soggetto.getCodiceFiscale().toUpperCase());
// ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV
// sb.append(soggetto.getCodiceFiscale().toUpperCase());
sb.append(soggetto.getDescrizioneCompleta().toUpperCase());
sb.append(" ");
sb.append(StringPool.SPACE);
}
sb.append(StringPool.SEMICOLON);
for (Soggetto soggetto : direttoreLavori) {
//ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV
// sb.append(soggetto.getCodiceFiscale().toUpperCase());
// ADT BUG-ID=16 Sezione Pratiche Assegnate / Export CSV
sb.append(soggetto.getDescrizioneCompleta().toUpperCase());
sb.append(" ");
sb.append(StringPool.SPACE);
}
sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(lastDettPratica)) {
if (lastDettPratica.getTcNuovaCostruzione()) {
sb.append("Nuova Costruzione");
sb.append(" ");
sb.append("Nuova Costruzione ");
}
if (lastDettPratica.getTcAdeguamentoSismico()) {
sb.append("Adeguamento Sismico");
sb.append(" ");
sb.append("Adeguamento Sismico ");
}
if (lastDettPratica.getTcMiglioramentoSismico()) {
sb.append("Miglioramento Sismico");
sb.append(" ");
sb.append("Miglioramento Sismico ");
}
if (lastDettPratica.getTcRiparazioneInterventoLocale()) {
sb.append("Riparazione Intervento Locale");
sb.append(" ");
sb.append("Riparazione Intervento Locale ");
}
}
sb.append(StringPool.SEMICOLON);
if (compleatata) {
sb.append("SI");
} else {
sb.append("NO");
}
sb.append(StringPool.SEMICOLON);
if (collaudoPrevisto) {
sb.append("SI");
} else {
sb.append("NO");
}
sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(pratica.getStatusDate())) {
sb.append(sdf.format(pratica.getStatusDate()));
} else {
sb.append("");
}
sb.append(StringPool.SEMICOLON);
} catch (SystemException e) {
_log.error(e, e);
}
sb.append(CharPool.NEW_LINE);
}
String fileName = "exportActivity_" + new Date().getTime() + ".csv";
byte[] bytes = sb.toString().getBytes();
String contentType = ContentTypes.TEXT_CSV;
ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length);
baos.write(bytes, 0, bytes.length);
resourceResponse.setContentType(contentType);
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());
OutputStream out = resourceResponse.getPortletOutputStream();
baos.writeTo(out);
out.flush();
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();
if ("comuniForUfficio".equals(resourceId)) {
String ufficio = ParamUtil.getString(resourceRequest, "ufficioId");
@ -314,14 +261,14 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
List<Comune> comuni;
if (Validator.isNotNull(ufficio) && !ufficio.equals("0")) {
try {
if(!ufficio.equals("-1")){
if (!ufficio.equals("-1")) {
long ufficioId = Long.parseLong(ufficio);
comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId(user.getUserId(), ufficioId);
comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId(user.getUserId(),
ufficioId);
for (Comune comune : comuni) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("comuneId", comune.getComuneId());
jsonObject.put("descLong", comune.getDenominazione());
jsonArray.put(jsonObject);
}
writeJSON(resourceRequest, resourceResponse, jsonArray);
@ -336,19 +283,12 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet {
}
writeJSON(resourceRequest, resourceResponse, jsonArray);
}
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
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.shared.util.ActionKeys;
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.WorkflowConstants;
import it.tref.liferay.portos.bo.util.WorkflowUtil;
import java.io.IOException;
@ -80,7 +82,6 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
private Log _log = LogFactoryUtil.getLog(GestioneAttivitaPortlet.class);
public void search2URL(ActionRequest actionRequest, ActionResponse actionResponse) {
String tabs1 = ParamUtil.getString(actionRequest, "tabs1");
String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto");
String protocollo = ParamUtil.getString(actionRequest, "protocollo");
@ -88,7 +89,6 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
String statoPratica = ParamUtil.getString(actionRequest, "statoPratica");
String committente = ParamUtil.getString(actionRequest, "committente");
String soggettiInterconnessi = ParamUtil.getString(actionRequest, "soggettiInterconnessi");
// ADT BUG BO ID = 8
String istruttore = ParamUtil.getString(actionRequest, "istruttore");
String dataRichiestaInizio = ParamUtil.getString(actionRequest, "dataRichiestaInizio");
String dataRichiestaFine = ParamUtil.getString(actionRequest, "dataRichiestaFine");
@ -98,51 +98,41 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
String comune = ParamUtil.getString(actionRequest, "comune");
String tipoAttivita = ParamUtil.getString(actionRequest, "tipoAttivita");
String tipoProcedura = ParamUtil.getString(actionRequest, "tipoProcedura");
actionResponse.setRenderParameter("tabs1", tabs1);
actionResponse.setRenderParameter("numeroProgetto", numeroProgetto);
actionResponse.setRenderParameter("protocollo", protocollo);
// ADT - BUG-11 Aggiunta filtro ricerca
if (Validator.isNotNull(tipoPratica)) {
if ("co".equalsIgnoreCase(tipoPratica)) {
if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(tipoPratica)) {
tipoPratica = Constants.TIPO_PRATICA_DEPOSITO;
actionResponse.setRenderParameter("controlloObbligatorio", Boolean.TRUE.toString());
actionResponse.setRenderParameter("controlloObbligatorio", StringPool.TRUE);
} else if ("sorteggio".equalsIgnoreCase(tipoPratica)) {
tipoPratica = Constants.TIPO_PRATICA_DEPOSITO;
actionResponse.setRenderParameter("sorteggiata", Boolean.TRUE.toString());
actionResponse.setRenderParameter("sorteggiata", StringPool.TRUE);
}
actionResponse.setRenderParameter("tipoPratica", tipoPratica);
}
actionResponse.setRenderParameter("statoPratica", statoPratica);
actionResponse.setRenderParameter("committente", committente);
actionResponse.setRenderParameter("soggettiInterconnessi", soggettiInterconnessi);
actionResponse.setRenderParameter("istruttore", istruttore);
actionResponse.setRenderParameter("dataRichiestaInizio", dataRichiestaInizio);
actionResponse.setRenderParameter("dataRichiestaFine", dataRichiestaFine);
if (dataRichiestaInizio != null && !dataRichiestaInizio.equals("")) {
String[] dataRichiestaInizioSplitted = dataRichiestaInizio.split("/");
int mounth = Integer.valueOf(dataRichiestaInizioSplitted[1]) - 1;
if (Validator.isNotNull(dataRichiestaInizio)) {
String[] dataRichiestaInizioSplitted = dataRichiestaInizio.split(StringPool.FORWARD_SLASH);
int month = Integer.valueOf(dataRichiestaInizioSplitted[1]) - 1;
actionResponse.setRenderParameter("dataRichiestaInizioDay", dataRichiestaInizioSplitted[0]);
actionResponse.setRenderParameter("dataRichiestaInizioMonth", mounth + "");
actionResponse.setRenderParameter("dataRichiestaInizioMonth", String.valueOf(month));
actionResponse.setRenderParameter("dataRichiestaInizioYear", dataRichiestaInizioSplitted[2]);
}
if (dataRichiestaFine != null && !dataRichiestaFine.equals("")) {
String[] dataRichiestaFineSplitted = dataRichiestaFine.split("/");
int mounth = Integer.valueOf(dataRichiestaFineSplitted[1]) - 1;
if (Validator.isNotNull(dataRichiestaFine)) {
String[] dataRichiestaFineSplitted = dataRichiestaFine.split(StringPool.FORWARD_SLASH);
int month = Integer.valueOf(dataRichiestaFineSplitted[1]) - 1;
actionResponse.setRenderParameter("dataRichiestaFineDay", dataRichiestaFineSplitted[0]);
actionResponse.setRenderParameter("dataRichiestaFineMonth", mounth + "");
actionResponse.setRenderParameter("dataRichiestaFineMonth", String.valueOf(month));
actionResponse.setRenderParameter("dataRichiestaFineYear", dataRichiestaFineSplitted[2]);
}
actionResponse.setRenderParameter("ufficio", ufficio);
actionResponse.setRenderParameter("ordinaPer", ordinaPer);
actionResponse.setRenderParameter("ordinaTipo", ordinaTipo);
@ -152,14 +142,12 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
}
public void cambioIstruttore(ActionRequest actionRequest, ActionResponse actionResponse) {
long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
long istruttoreId = ParamUtil.getLong(actionRequest, "istruttoreId");
try {
IntPratica intPratica = IntPraticaServiceUtil.getIntPratica(intPraticaId);
if (Validator.isNotNull(intPratica.getStatusByUserId())
&& intPratica.getStatusByUserId() != istruttoreId) {
if (Validator.isNotNull(intPratica.getStatusByUserId()) && intPratica.getStatusByUserId() != istruttoreId) {
IntPraticaServiceUtil.cambiaIstruttore(intPraticaId, controlloPraticaId, istruttoreId);
} else {
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) {
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());
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
IntPraticaPermission.check(PermissionThreadLocal.getPermissionChecker(), territorio.getGroupId(),
ActionKeys.ASSEGNA_AL_RUOLO);
@ -250,23 +175,22 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
&& !lastWorkflowTask.getWorkflowTaskAssignees().isEmpty()) {
Role role = null;
// TODO listare meglio
switch (lastWorkflowTask.getName()) {
case "Assegnazione":
switch (lastWorkflowTask.getName().toLowerCase()) {
case WorkflowConstants.WORKFLOW_TASKNAME_ASSEGNAZIONE:
role = RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), "portos_assegnatore");
break;
case "Esito":
case WorkflowConstants.WORKFLOW_TASKNAME_ESITO:
// role =
// RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(),
// "portos_istruttore");
// break;
return;
case "Approvazione":
case WorkflowConstants.WORKFLOW_TASKNAME_APPROVAZIONE:
role = RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), "portos_approvatore");
break;
default:
break;
}
WorkflowTaskManagerUtil.assignWorkflowTaskToRole(controlloPratica.getCompanyId(),
serviceContext.getUserId(), workflowTaskId, role.getRoleId(), StringPool.BLANK, null,
WorkflowUtil.getWorkflowContext(controlloPratica));
@ -280,9 +204,7 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
}
public void annullaRichiestaParere(ActionRequest actionRequest, ActionResponse actionResponse) {
long parereGeologoId = ParamUtil.getLong(actionRequest, "parereGeologoId");
try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
serviceContext.setCreateDate(new Date());
@ -300,18 +222,16 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
}
public void aggiungiRichiestaParere(ActionRequest actionRequest, ActionResponse actionResponse) {
long geologoId = ParamUtil.getLong(actionRequest, "geologoId");
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
serviceContext.setCreateDate(new Date());
serviceContext.setModifiedDate(new Date());
if (ParereGeologoLocalServiceUtil.countByIntPraticaIdParereVuoto(intPraticaId) == 0) {
ParereGeologo parereGeologo = ParereGeologoServiceUtil.addParereGeologo(geologoId,
intPraticaId, dettPraticaId, serviceContext);
ParereGeologo parereGeologo = ParereGeologoServiceUtil.addParereGeologo(geologoId, intPraticaId,
dettPraticaId, serviceContext);
// ADT: aggiunta notifica geologo
MailUtil.invioNotificaGeologo(parereGeologo, serviceContext);
} else {
@ -325,41 +245,32 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
public void aggiungiDettPraticheAlControllo(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortalException, SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
long controlloPraticaId = ParamUtil.getLong(actionRequest, "controlloPraticaId");
long lastDettPraticaId = ParamUtil.getLong(actionRequest, "lastDettPraticaId");
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId);
if (lastDettPraticaId != controlloPratica.getDettPraticaId()
&& intPratica.getStatusByUserId() == serviceContext.getUserId()) {
// ADT: BUG ID=5
ControlloPraticaLocalServiceUtil.addPraticheAlControlloVarianti(controlloPraticaId,
lastDettPraticaId, serviceContext);
ControlloPraticaLocalServiceUtil.addPraticheAlControlloVarianti(controlloPraticaId, lastDettPraticaId,
serviceContext);
} else {
SessionErrors.add(actionRequest, "error-aggiunta-pratiche-al-controllo");
}
}
@Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
throws IOException, PortletException {
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
PortletException {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
Locale locale = themeDisplay.getLocale();
User user = themeDisplay.getUser();
String cmd = ParamUtil.getString(resourceRequest, "cmd");
String id = resourceRequest.getResourceID();
String csv = StringPool.BLANK;
HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest);
HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse);
if (cmd.equals("dirigente")) {
csv = exportToCSV(locale, resourceRequest, true, user);
} else if (cmd.equals("po")) {
@ -377,8 +288,8 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
try {
if (!ufficio.equals("-1")) {
long ufficioId = Long.parseLong(ufficio);
comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId(
user.getUserId(), ufficioId);
comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId(user.getUserId(),
ufficioId);
for (Comune comune : comuni) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("comuneId", comune.getComuneId());
@ -398,34 +309,21 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
}
writeJSON(resourceRequest, resourceResponse, jsonArray);
}
}
catch (Exception e) {
// TODO Auto-generated catch block
} catch (Exception e) {
e.printStackTrace();
}
}
}
ServletResponseUtil.sendFile(request, response, "export_pratiche.csv", csv.getBytes(StringPool.UTF8),
ContentTypes.TEXT_CSV_UTF8);
// super.serveResource(resourceRequest, resourceResponse);
}
private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user, String cmd) {
HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest);
StringBuilder sb = new StringBuilder();
List<ControlloPratica> lista = new ArrayList<ControlloPratica>();
try {
Hits hits = null;
if (cmd.equals("exportRicercaMieAttivita")) {
hits = ControlloPraticaAdvancedSearch.searchMieiTask(httpRequest, user, -1, -1);
} else if (cmd.equals("exportRicercaMieiRuoli")) {
@ -435,41 +333,30 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
} else if (cmd.equals("exportRicercaAttivitaConcluse")) {
hits = ControlloPraticaAdvancedSearch.searchTaskConclusi(httpRequest, user, -1, -1);
}
for (Document doc : hits.toList()) {
String controlloPraticaId = doc.get("controlloPraticaId");
if (Validator.isNotNull(controlloPraticaId)) {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId));
if (Validator.isNotNull(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(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.esito")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.esito")));
sb.append(StringPool.SEMICOLON);
// ADT - BUG-13 Aggiunta colonna Data Esito
// Bug 33264
if (cmd.equals("exportRicercaAttivitaConcluse")) {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.dataesito")));
sb.append(StringPool.SEMICOLON);
}
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.sorteggiata")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.pratica")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.pratica")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.istruttore")));
@ -480,102 +367,75 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.avvioprocedimento")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.provincia")));
sb.append(CSVUtil.encode(LanguageUtil
.get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
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.NEW_LINE);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
for (ControlloPratica controlloPratica : lista) {
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica
.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica
.getTerritorioId());
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia());
// Informazioni relative al workflow
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil
.fetchWorkflowInstanceLink(controlloPratica.getCompanyId(),
controlloPratica.getGroupId(), ControlloPratica.class.getName(),
controlloPratica.getPrimaryKey());
.fetchWorkflowInstanceLink(controlloPratica.getCompanyId(), controlloPratica.getGroupId(),
ControlloPratica.class.getName(), controlloPratica.getPrimaryKey());
long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId();
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(
controlloPratica.getCompanyId(), workflowInstanceId);
List<WorkflowTask> listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(
controlloPratica.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(),
false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
controlloPratica.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(), false,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
WorkflowTask task = null;
if (listaTask != null && !listaTask.isEmpty()) {
task = listaTask.get(0);
}
String taskName = StringPool.BLANK;
if (task != null) {
User userTask = UserLocalServiceUtil.fetchUser(task.getAssigneeUserId());
// Bug 33264
taskName = LanguageUtil.get(getPortletConfig(), locale, task.getName());
if (userTask != null) {
taskName += " (" + userTask.getFullName() + ")";
taskName += " (" + userTask.getFullName() + StringPool.CLOSE_PARENTHESIS;
}
} else {
// Bug 33264
taskName = LanguageUtil.get(getPortletConfig(), locale, workflowInstance.getState());
}
sb.append(CSVUtil.encode(taskName));
sb.append(StringPool.SEMICOLON);
String tipoEsito = ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica
.getControlloPraticaId());
sb.append(CSVUtil.encode(tipoEsito));
sb.append(StringPool.SEMICOLON);
// ADT - BUG-13 Aggiunta colonna Data Esito
// Bug 33264
if (cmd.equals("exportRicercaAttivitaConcluse")) {
sb.append(CSVUtil.encode(controlloPratica.getStatusDate() != null ? sdf
.format(controlloPratica.getStatusDate()) : ""));
sb.append(CSVUtil.encode(controlloPratica.getStatusDate() != null ? sdf.format(controlloPratica
.getStatusDate()) : StringPool.BLANK));
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(StringPool.SEMICOLON);
String praticaLabel = intPratica.getTitle(locale, true);
sb.append(CSVUtil.encode(praticaLabel));
sb.append(StringPool.SEMICOLON);
String istruttore = "-";
if (intPratica.getStatusByUserId() != 0l) {
String istruttore = StringPool.DASH;
if (intPratica.getStatusByUserId() != 0L) {
User istruttoreUser = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (istruttoreUser != null) {
istruttore = istruttoreUser.getFullName();
} else {
istruttore = " [" + intPratica.getStatusByUserId() + "]";
istruttore = " [" + intPratica.getStatusByUserId() + StringPool.CLOSE_BRACKET;
}
}
sb.append(CSVUtil.encode(istruttore));
sb.append(StringPool.SEMICOLON);
StringBuilder provenienzaLabel = new StringBuilder();
WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask(
controlloPratica.getCompanyId(), controlloPratica.getGroupId(), null,
controlloPratica);
WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask(controlloPratica.getCompanyId(),
controlloPratica.getGroupId(), null, controlloPratica);
if (workflowTask != null) {
User approvatore = UserLocalServiceUtil.fetchUser(workflowTask.getAssigneeUserId());
if (approvatore != null) {
@ -584,185 +444,135 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
if (workflowTask.getAssigneeUserId() == -1) {
provenienzaLabel.append(" [Portos 1]");
} 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 {
provenienzaLabel.append("-");
provenienzaLabel.append(StringPool.DASH);
}
sb.append(CSVUtil.encode(provenienzaLabel.toString()));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(sdf.format(controlloPratica.getCreateDate())));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(provincia.getProvincia() + " - " + comune.getDenominazione()));
sb.append(StringPool.SEMICOLON);
Date data = controlloPratica.getCreateDate();
Date now = new Date();
long diff = now.getTime() - data.getTime();
long days = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
sb.append(CSVUtil.encode(days));
sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE);
}
} catch (PortalException e) {
_log.error(e, e);
} catch (SystemException e) {
} catch (PortalException | SystemException e) {
_log.error(e, e);
}
return sb.toString();
}
private String exportToCSV(Locale locale, ResourceRequest resourceRequest, boolean dirigente, User user) {
HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest);
String currentTab = ParamUtil.getString(httpRequest, "tabs1");
StringBuilder sb = new StringBuilder();
List<ControlloPratica> listaControlloPratica = new ArrayList<ControlloPratica>();
if (dirigente) {
listaControlloPratica = ControlloPraticaAdvancedSearch.searchTaskPerEsportazioneDirigente(
httpRequest, user, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
} else {
listaControlloPratica = ControlloPraticaAdvancedSearch.searchTaskPerEsportazionePO(httpRequest,
listaControlloPratica = ControlloPraticaAdvancedSearch.searchTaskPerEsportazioneDirigente(httpRequest,
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(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.esito")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.esito")));
sb.append(StringPool.SEMICOLON);
// ADT - BUG-13 Aggiunta colonna Data Esito
// Bug 33264
if ("Tab_TaskCompletati".equals(currentTab)) {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.dataesito")));
sb.append(CSVUtil.encode(LanguageUtil
.get(getPortletConfig(), locale, "label.scadenzegeniocivile.dataesito")));
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(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.pratica")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.pratica")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.istruttore")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.istruttore")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.provenienza")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.provenienza")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.avvioprocedimento")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.provincia")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.gg")));
sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE);
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
for (ControlloPratica controlloPratica : listaControlloPratica) {
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica
.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica
.getTerritorioId());
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica.getIntPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia());
// Informazioni relative al workflow
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil
.fetchWorkflowInstanceLink(controlloPratica.getCompanyId(),
controlloPratica.getGroupId(), ControlloPratica.class.getName(),
controlloPratica.getPrimaryKey());
.fetchWorkflowInstanceLink(controlloPratica.getCompanyId(), controlloPratica.getGroupId(),
ControlloPratica.class.getName(), controlloPratica.getPrimaryKey());
long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId();
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(
controlloPratica.getCompanyId(), workflowInstanceId);
List<WorkflowTask> listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(
controlloPratica.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(),
false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
controlloPratica.getCompanyId(), null, workflowInstance.getWorkflowInstanceId(), false,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
WorkflowTask task = null;
if (listaTask != null && !listaTask.isEmpty()) {
task = listaTask.get(0);
}
String taskName = StringPool.BLANK;
if (task != null) {
User userTask = UserLocalServiceUtil.fetchUser(task.getAssigneeUserId());
taskName = LanguageUtil.get(locale, task.getName());
if (userTask != null) {
taskName += " (" + userTask.getFullName() + ")";
taskName += " (" + userTask.getFullName() + StringPool.CLOSE_PARENTHESIS;
}
} else {
taskName = LanguageUtil.get(locale, workflowInstance.getState());
}
sb.append(CSVUtil.encode(taskName));
sb.append(StringPool.SEMICOLON);
String tipoEsito = ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica
.getControlloPraticaId());
sb.append(CSVUtil.encode(tipoEsito));
sb.append(StringPool.SEMICOLON);
// ADT - BUG-13 Aggiunta colonna Data Esito
// Bug 33264
if ("Tab_TaskCompletati".equals(currentTab)) {
sb.append(CSVUtil.encode(sdf.format(controlloPratica.getStatusDate())));
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(StringPool.SEMICOLON);
String praticaLabel = intPratica.getTitle(locale, true);
sb.append(CSVUtil.encode(praticaLabel));
sb.append(StringPool.SEMICOLON);
String istruttore = "-";
if (intPratica.getStatusByUserId() != 0l) {
String istruttore = StringPool.DASH;
if (intPratica.getStatusByUserId() != 0L) {
User istruttoreUser = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (istruttoreUser != null) {
istruttore = istruttoreUser.getFullName();
} else {
istruttore = " [" + intPratica.getStatusByUserId() + "]";
istruttore = " [" + intPratica.getStatusByUserId() + StringPool.CLOSE_BRACKET;
}
}
sb.append(CSVUtil.encode(istruttore));
sb.append(StringPool.SEMICOLON);
StringBuilder provenienzaLabel = new StringBuilder();
WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask(
controlloPratica.getCompanyId(), controlloPratica.getGroupId(), null,
controlloPratica);
WorkflowTask workflowTask = WorkflowUtil.getLastCompletedTask(controlloPratica.getCompanyId(),
controlloPratica.getGroupId(), null, controlloPratica);
if (workflowTask != null) {
User approvatore = UserLocalServiceUtil.fetchUser(workflowTask.getAssigneeUserId());
if (approvatore != null) {
@ -771,42 +581,31 @@ public class GestioneAttivitaPortlet extends MVCPortlet {
if (workflowTask.getAssigneeUserId() == -1) {
provenienzaLabel.append(" [Portos 1]");
} 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 {
provenienzaLabel.append("-");
provenienzaLabel.append(StringPool.DASH);
}
sb.append(CSVUtil.encode(provenienzaLabel.toString()));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(sdf.format(controlloPratica.getCreateDate())));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(provincia.getProvincia() + " - " + comune.getDenominazione()));
sb.append(StringPool.SEMICOLON);
Date data = controlloPratica.getCreateDate();
Date now = new Date();
long diff = now.getTime() - data.getTime();
long days = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
sb.append(CSVUtil.encode(days));
sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE);
}
} catch (PortalException e) {
_log.error(e, e);
} catch (SystemException e) {
} catch (PortalException | SystemException e) {
_log.error(e, e);
}
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 {
@Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
throws IOException, PortletException {
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
PortletException {
String resourceId = GetterUtil.getString(resourceRequest.getResourceID());
if (resourceId.equals("exportCSV") || resourceId.equals("exportAllCSV")) {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
long companyId = themeDisplay.getCompanyId();
long groupId = ParamUtil.getLong(resourceRequest, "groupId", 0l);
long groupId = ParamUtil.getLong(resourceRequest, "groupId", 0L);
Locale locale = themeDisplay.getLocale();
String tipoTempistica = ParamUtil.getString(resourceRequest, "tipoTempistica");
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
Integer statoPratica = Validator.isNotNull(resourceRequest.getParameter("statoPratica"))
&& !"".equals(resourceRequest.getParameter("statoPratica")) ? ParamUtil.getInteger(
resourceRequest, "statoPratica") : null;
Integer statoPratica = Validator.isNull(resourceRequest.getParameter("statoPratica")) ? null : ParamUtil
.getInteger(resourceRequest, "statoPratica");
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
String tipoPratica = ParamUtil.getString(resourceRequest, "tipoPratica");
String istruttore = ParamUtil.getString(resourceRequest, "istruttore");
try {
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
String csv = exportToCSV(companyId, groupId, locale, tipoTempistica, statoPratica,
tipoPratica, istruttore, resourceId.equals("exportAllCSV"));
String csv = exportToCSV(companyId, groupId, locale, tipoTempistica, statoPratica, tipoPratica,
istruttore, resourceId.equals("exportAllCSV"));
HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest);
HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse);
ServletResponseUtil.sendFile(request, response, "export_scadenze_" + tipoTempistica + ".csv",
csv.getBytes(StringPool.UTF8), ContentTypes.TEXT_CSV_UTF8);
} catch (Exception e) {
throw new IOException(e);
}
} else {
super.serveResource(resourceRequest, resourceResponse);
}
@ -106,11 +93,9 @@ public class TempistichePortlet extends MVCPortlet {
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
public void search(ActionRequest actionRequest, ActionResponse actionResponse) {
String tipoPratica = ParamUtil.getString(actionRequest, "tipoPratica", StringPool.BLANK);
String istruttore = ParamUtil.getString(actionRequest, "istruttore", StringPool.BLANK);
String statoPratica = ParamUtil.getString(actionRequest, "statoPratica", StringPool.BLANK);
actionResponse.setRenderParameter("tipoPratica", tipoPratica);
actionResponse.setRenderParameter("istruttore", istruttore);
actionResponse.setRenderParameter("statoPratica", statoPratica);
@ -118,29 +103,23 @@ public class TempistichePortlet extends MVCPortlet {
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
private String exportToCSV(long companyId, long groupId, Locale locale, String tipoTempistica,
Integer statoPratica, String tipoPratica, String istruttore, boolean isBackCompatibility)
throws Exception {
Integer statoPratica, String tipoPratica, String istruttore, boolean isBackCompatibility) throws Exception {
Format dateFormat = FastDateFormatFactoryUtil.getDate(locale);
Format dateTimeFormat = FastDateFormatFactoryUtil.getDateTime(locale);
StringBuilder sb = new StringBuilder();
if (tipoTempistica.equals(TempisticaConstants.TIPO_PRATICA)) {
// ADT - BUG-29 - Scadenziario / Creazione Filtri Ricerca
List<Object[]> tempistiche = isBackCompatibility ? TempisticaLocalServiceUtil
.scadenzePraticheForBackwardCompatibility(companyId, groupId, QueryUtil.ALL_POS,
QueryUtil.ALL_POS) : TempisticaLocalServiceUtil.getScadenzePratiche(companyId,
groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, statoPratica, tipoPratica, istruttore);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.provincia")));
.scadenzePraticheForBackwardCompatibility(companyId, groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS)
: TempisticaLocalServiceUtil.getScadenzePratiche(companyId, groupId, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, statoPratica, tipoPratica, istruttore);
sb.append(CSVUtil.encode(LanguageUtil
.get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.tipopratica")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.progetto")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.progetto")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.istruttore")));
@ -151,8 +130,7 @@ public class TempistichePortlet extends MVCPortlet {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.datasorteggio")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.start")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.start")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.tempoattivita")));
@ -160,67 +138,46 @@ public class TempistichePortlet extends MVCPortlet {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.timerfermo")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza")));
sb.append(StringPool.NEW_LINE);
List<Long> alreadyInserted = new ArrayList<Long>();
for (Object[] tempistica : tempistiche) {
Long intPraticaId = (Long) tempistica[0];
Long stop = (Long) tempistica[2];
// Long wait = (Long) tempistica[3];
Long calcoloTempo = (Long) tempistica[4];
Integer stato = (Integer) tempistica[5];
Long dettPraticaId = 0L;
DynamicQuery query = DynamicQueryFactoryUtil.forClass(Tempistica.class);
query.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId));
query.add(RestrictionsFactoryUtil.eq("tipo", "P"));
Order defaultOrderDettPrtatica = OrderFactoryUtil.desc("createDate");
query.addOrder(defaultOrderDettPrtatica);
List<Tempistica> lista = TempisticaLocalServiceUtil.dynamicQuery(query);
if (lista != null && !lista.isEmpty() && lista.size() > 1) {
intPraticaId = lista.get(0).getIntPraticaId();
dettPraticaId = lista.get(0).getDettPraticaId();
stop = lista.get(0).getStop();
if (alreadyInserted.contains(intPraticaId)) {
continue;
}
alreadyInserted.add(intPraticaId);
} else {
dettPraticaId = lista.get(0).getDettPraticaId();
alreadyInserted.add(intPraticaId);
}
// DettPratica dettPratica =
// DettPraticaLocalServiceUtil.getDettPratica(dettPraticaId);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica
.getTerritorioId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia());
sb.append(CSVUtil.encode(provincia.getProvincia()));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "tipo-pratica-"
+ intPratica.getTipoPratica())));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"tipo-pratica-" + intPratica.getTipoPratica())));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(intPratica.getNumeroProgetto()));
sb.append(StringPool.SEMICOLON);
long statusByUserId = intPratica.getStatusByUserId();
if (Validator.isNotNull(statusByUserId)
&& intPratica.getStatus() != WorkflowConstants.STATUS_DRAFT) {
if (Validator.isNotNull(statusByUserId) && intPratica.getStatus() != WorkflowConstants.STATUS_DRAFT) {
try {
User istruttoreUser = UserLocalServiceUtil.getUser(statusByUserId);
sb.append(CSVUtil.encode(istruttoreUser.getFullName() + StringPool.SPACE
@ -230,40 +187,28 @@ public class TempistichePortlet extends MVCPortlet {
}
}
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(dateTimeFormat.format(intPratica.getDtPratica())));
sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(intPratica.getDtSorteggio())) {
sb.append(CSVUtil.encode(dateFormat.format(intPratica.getDtSorteggio())));
}
sb.append(StringPool.SEMICOLON);
DynamicQuery queryAvv = DynamicQueryFactoryUtil.forClass(Avviso.class);
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()));
if (dettPraticaId != 0L) {
queryAvv.add(RestrictionsFactoryUtil.eq("classPk", dettPraticaId));
}
Order defaultOrder = OrderFactoryUtil.desc("createDate");
queryAvv.addOrder(defaultOrder);
List<Avviso> listaAvv = AvvisoLocalServiceUtil.dynamicQuery(queryAvv);
if (listaAvv != null && !listaAvv.isEmpty() && listaAvv.get(0).getDtInvio() != null) {
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(CSVUtil.encode(String.valueOf(TimeUnit.MILLISECONDS.toDays(calcoloTempo))));
sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(stop)) {
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.si")));
@ -275,7 +220,6 @@ public class TempistichePortlet extends MVCPortlet {
"label.scadenzegeniocivile.scadenza.no")));
}
sb.append(StringPool.SEMICOLON);
if (Validator.isNotNull(stop)) {
sb.append(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.inattesa"));
@ -283,70 +227,51 @@ public class TempistichePortlet extends MVCPortlet {
sb.append(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.inscadenza"));
} else if (stato.intValue() == TempisticaConstants.STATO_SCADUTA) {
sb.append(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.scaduto"));
sb.append(LanguageUtil
.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza.scaduto"));
} else if (stato.intValue() == TempisticaConstants.STATO_ATTIVA) {
sb.append(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.attivo"));
sb.append(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza.attivo"));
}
sb.append(StringPool.NEW_LINE);
}
} else if (tipoTempistica.equals(TempisticaConstants.TIPO_INTEGRAZIONE)) {
List<Object[]> tempistiche = TempisticaLocalServiceUtil.getScadenzeIntegrazioni(companyId,
groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, statoPratica);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.provincia")));
List<Object[]> tempistiche = TempisticaLocalServiceUtil.getScadenzeIntegrazioni(companyId, groupId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, statoPratica);
sb.append(CSVUtil.encode(LanguageUtil
.get(getPortletConfig(), locale, "label.scadenzegeniocivile.provincia")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.tipopratica")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.progetto")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.progetto")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.istruttore")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.start")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.start")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.tempoattivita")));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza")));
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza")));
sb.append(StringPool.NEW_LINE);
for (Object[] tempistica : tempistiche) {
Long intPraticaId = (Long) tempistica[0];
Long calcoloTempo = (Long) tempistica[2];
Integer stato = (Integer) tempistica[3];
Long dettPraticaId = (Long) tempistica[4];
// DettPratica dettPratica =
// DettPraticaLocalServiceUtil.getDettPratica(dettPraticaId);
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId);
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica
.getTerritorioId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia());
sb.append(CSVUtil.encode(provincia.getProvincia()));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(intPratica.getTipoPratica()));
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(intPratica.getNumeroProgetto()));
sb.append(StringPool.SEMICOLON);
long statusByUserId = intPratica.getStatusByUserId();
if (Validator.isNotNull(statusByUserId)
&& intPratica.getStatus() != WorkflowConstants.STATUS_DRAFT) {
if (Validator.isNotNull(statusByUserId) && intPratica.getStatus() != WorkflowConstants.STATUS_DRAFT) {
try {
User istruttoreUser = UserLocalServiceUtil.getUser(statusByUserId);
sb.append(CSVUtil.encode(istruttoreUser.getFullName() + StringPool.SPACE
@ -356,32 +281,25 @@ public class TempistichePortlet extends MVCPortlet {
}
}
sb.append(StringPool.SEMICOLON);
List<Avviso> avvisi = AvvisoLocalServiceUtil.findByClassPk_tipoDocumento(dettPraticaId,
StatoPraticaConstants.SOTTOPOSTA_A_PARERE);
if (avvisi.size() > 0 && avvisi.get(0).getDtAvviso() != null) {
sb.append(CSVUtil.encode(dateFormat.format(avvisi.get(0).getDtInvio())));
} else {
sb.append("-");
sb.append(StringPool.DASH);
}
sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(String.valueOf(TimeUnit.MILLISECONDS.toDays(calcoloTempo))));
sb.append(StringPool.SEMICOLON);
if (stato.intValue() == TempisticaConstants.STATO_SCADUTA) {
sb.append(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.scaduto"));
sb.append(LanguageUtil
.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza.scaduto"));
} else if (stato.intValue() == TempisticaConstants.STATO_ATTIVA) {
sb.append(LanguageUtil.get(getPortletConfig(), locale,
"label.scadenzegeniocivile.scadenza.attivo"));
sb.append(LanguageUtil.get(getPortletConfig(), locale, "label.scadenzegeniocivile.scadenza.attivo"));
}
sb.append(StringPool.NEW_LINE);
}
}
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.
*
* This library is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.liferay.portos.bo.service.impl;
@ -70,15 +70,12 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
* The implementation of the asseverazione local service.
*
* <p>
* All custom service methods should be put in this class. Whenever methods are
* added, rerun ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.bo.service.AsseverazioneLocalService}
* interface.
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* their definitions into the {@link it.tref.liferay.portos.bo.service.AsseverazioneLocalService} interface.
*
* <p>
* This is a local service. Methods of this service will not have security
* checks based on the propagated JAAS credentials because this service can only
* be accessed from within the same VM.
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* credentials because this service can only be accessed from within the same VM.
* </p>
*
* @author Davide Barbagallo, 3F Consulting
@ -87,11 +84,12 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
*/
public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use
* {@link it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil}
* to access the asseverazione local service.
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil} to access the asseverazione local service.
*/
private static final String CHECKED = "X";
@Override
public String anteprimaAsseverazione(String tipo, User user, DettPratica dettPratica, String relazioni)
throws IOException, SystemException, PortalException {
@ -112,24 +110,22 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
}
@Override
public String testoAsseverazione(String tipo, String codiceFiscale, DettPratica dettPratica,
String relazioni) throws SystemException, PortalException, IOException {
public String testoAsseverazione(String tipo, String codiceFiscale, DettPratica dettPratica, String relazioni)
throws SystemException, PortalException, IOException {
return testoAsseverazione(tipo, codiceFiscale, dettPratica, relazioni, false);
}
private String testoAsseverazione(String tipo, String codiceFiscale, DettPratica dettPratica,
String relazioni, boolean anteprima) throws SystemException, PortalException, IOException {
private String testoAsseverazione(String tipo, String codiceFiscale, DettPratica dettPratica, String relazioni,
boolean anteprima) throws SystemException, PortalException, IOException {
List<Soggetto> soggetti = SoggettoLocalServiceUtil.getValidTmpByIntPratica_CodiceFiscale(
dettPratica.getIntPraticaId(), codiceFiscale, 0L);
if (soggetti.size() > 0) {
Soggetto soggetto = soggetti.get(0);
String nome = Validator.isNull(soggetto.getCognome()) ? soggetto.getLegaleRap() : soggetto
.getNome();
String cognome = Validator.isNull(soggetto.getCognome()) ? StringPool.BLANK : soggetto
.getCognome();
String nome = Validator.isNull(soggetto.getCognome()) ? soggetto.getLegaleRap() : soggetto.getNome();
String cognome = Validator.isNull(soggetto.getCognome()) ? StringPool.BLANK : soggetto.getCognome();
return testoAsseverazione(tipo, nome, cognome, codiceFiscale, soggetto.getAmbitoProfessione(),
dettPratica, relazioni, false);
return testoAsseverazione(tipo, nome, cognome, codiceFiscale, soggetto.getAmbitoProfessione(), dettPratica,
relazioni, false);
}
User user = UserLocalServiceUtil.fetchUserByScreenName(dettPratica.getCompanyId(), codiceFiscale);
if (Validator.isNotNull(user)) {
@ -140,8 +136,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
}
private String testoAsseverazione(String tipo, String nome, String cognome, String codiceFiscale,
String ambitoProfessione, DettPratica dettPratica, String relazioni, boolean anteprima)
throws IOException, SystemException, PortalException {
String ambitoProfessione, DettPratica dettPratica, String relazioni, boolean anteprima) throws IOException,
SystemException, PortalException {
String file = null;
switch (tipo) {
@ -171,8 +167,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
return null;
}
InputStream input = getClass().getClassLoader().getResourceAsStream(
"/resource/asseverazioni/" + file + ".html");
InputStream input = getClass().getClassLoader()
.getResourceAsStream("/resource/asseverazioni/" + file + ".html");
if (Validator.isNull(input)) {
return null;
}
@ -189,9 +185,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
String PG = dettPratica.getGeoPericolositaGeomorfica();
String PI = dettPratica.getGeoPericolositaIdraulica();
boolean rischio = (RG.equals("3") || RG.equals("4") || RG.equals("5") || RI.equals("3")
|| RI.equals("4") || PG.equals("3") || PG.equals("4") || PI.equals("3") || PI.equals("4") || PI
.equals("5"));
boolean rischio = (RG.equals("3") || RG.equals("4") || RG.equals("5") || RI.equals("3") || RI.equals("4")
|| PG.equals("3") || PG.equals("4") || PI.equals("3") || PI.equals("4") || PI.equals("5"));
boolean coniugio = Validator.isNotNull(relazioni);
@ -225,8 +220,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
if (!rilevanti) {
agMedio = (dettPratica.getTcAdeguamentoSismico() || dettPratica.getTcMiglioramentoSismico())
&& ((territorio.getZona().equals("2") && (ag >= 0.15) && (ag <= 0.2)) || territorio
.getZona().equals("3"));
&& ((territorio.getZona().equals("2") && (ag >= 0.15) && (ag <= 0.2)) || territorio.getZona()
.equals("3"));
riparazioni = dettPratica.getTcRiparazioneInterventoLocale();
nuove = dettPratica.getTcNuovaCostruzione();
agricoli = dettPratica.getDestinazione().equals("1");
@ -234,39 +229,41 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
nonRilevanti = agMedio || riparazioni || nuove || agricoli;
}
String html = buffer.toString().replaceAll("##anteprima(.*?)##", anteprima ? "" : "$1")
.replaceAll("##lavoripubblici(.*?)##", dettPratica.getLavoriPubblici() ? "" : "$1")
.replace("{{agalto}}", agAlto ? "X" : " ").replace("{{agmedio}}", agMedio ? "X" : " ")
.replace("{{agricoli}}", agricoli ? "X" : " ").replace("{{codicefiscale}}", codiceFiscale)
.replace("{{cognome}}", cognome).replace("{{complesse}}", complesse ? "X" : " ")
.replace("{{nome}}", nome).replace("{{nuove}}", nuove ? "X" : " ")
.replace("{{rilevanti}}", rilevanti ? "X" : " ")
.replace("{{nonrilevanti}}", nonRilevanti ? "X" : " ")
.replace("{{riparazioni}}", riparazioni ? "X" : " ")
.replace("{{rischio}}", rischio ? "X" : " ").replace("{{!rischio}}", rischio ? " " : "X")
.replace("{{strategico}}", strategico ? "X" : " ");
String html = buffer.toString().replaceAll("##anteprima(.*?)##", anteprima ? StringPool.BLANK : "$1")
.replaceAll("##lavoripubblici(.*?)##", dettPratica.getLavoriPubblici() ? StringPool.BLANK : "$1")
.replace("{{agalto}}", agAlto ? CHECKED : StringPool.SPACE)
.replace("{{agmedio}}", agMedio ? CHECKED : StringPool.SPACE)
.replace("{{agricoli}}", agricoli ? CHECKED : StringPool.SPACE)
.replace("{{codicefiscale}}", codiceFiscale).replace("{{cognome}}", cognome)
.replace("{{complesse}}", complesse ? CHECKED : StringPool.SPACE).replace("{{nome}}", nome)
.replace("{{nuove}}", nuove ? CHECKED : StringPool.SPACE)
.replace("{{rilevanti}}", rilevanti ? CHECKED : StringPool.SPACE)
.replace("{{nonrilevanti}}", nonRilevanti ? CHECKED : StringPool.SPACE)
.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) {
html = html.replace("{{coniugio}}", " ").replace("{{!coniugio}}", " ")
.replace("{{relazioni}}", "");
html = html.replace("{{coniugio}}", StringPool.SPACE).replace("{{!coniugio}}", StringPool.SPACE)
.replace("{{relazioni}}", StringPool.BLANK);
} else {
html = html.replace("{{coniugio}}", coniugio ? "X" : " ")
.replace("{{!coniugio}}", coniugio ? " " : "X")
.replace("{{relazioni}}", relazioni.trim().replace("\n", ", "));
html = html.replace("{{coniugio}}", coniugio ? CHECKED : StringPool.SPACE)
.replace("{{!coniugio}}", coniugio ? StringPool.SPACE : CHECKED)
.replace("{{relazioni}}", relazioni.trim().replace(StringPool.NEW_LINE, ", "));
}
return html;
}
@Override
public Asseverazione addAsseverazione(long userId, long intPraticaId, long dettPraticaId,
String tipologia, String codiceFiscale, ServiceContext serviceContext) throws PortalException,
SystemException {
public Asseverazione addAsseverazione(long userId, long intPraticaId, long dettPraticaId, String tipologia,
String codiceFiscale, ServiceContext serviceContext) throws PortalException, SystemException {
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
Asseverazione asseverazione = asseverazionePersistence.create(counterLocalService
.increment(Asseverazione.class.getName()));
Asseverazione asseverazione = asseverazionePersistence.create(counterLocalService.increment(Asseverazione.class
.getName()));
asseverazione.setCompanyId(serviceContext.getCompanyId());
asseverazione.setUserId(user.getUserId());
@ -280,8 +277,7 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
asseverazione.setTipologia(tipologia);
asseverazione.setEsito(DelegheUtil.STATO_ASSEGNATA);
asseverazione.setCodiceFiscale(codiceFiscale);
List<Soggetto> soggetti = soggettoLocalService.findByIntPratica_CodiceFiscale(intPraticaId,
codiceFiscale);
List<Soggetto> soggetti = soggettoLocalService.findByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale);
if (!soggetti.isEmpty()) {
asseverazione.setSoggettoId(soggetti.get(0).getUserId());
}
@ -292,34 +288,32 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
}
@Override
public void richiediAsseverazioni(long dettPraticaId, ServiceContext serviceContext)
throws SystemException, PortalException {
public void richiediAsseverazioni(long dettPraticaId, ServiceContext serviceContext) throws SystemException,
PortalException {
DettPratica dettPratica = dettPraticaLocalService.getDettPratica(dettPraticaId);
long intPraticaId = dettPratica.getIntPraticaId();
IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId);
if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())
|| TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())
|| TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO.equalsIgnoreCase(dettPratica
.getTipoIntegrazione())) {
|| TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) {
List<Soggetto> nuoviSoggetti = new ArrayList<Soggetto>(
soggettoLocalService.getValidTmpByDettPratica(dettPraticaId));
List<String> cfNuoviSoggetti = soggettoLocalService.getCfValidTmpByDettPratica(dettPraticaId);
List<String> nuoviDelegati = new ArrayList<String>(
DelegaLocalServiceUtil.findCfByDettPratica_Tipologia_InEsito(dettPraticaId, new String[] {
TipoSoggettoUtil.COMMITTENTE, TipoSoggettoUtil.DIRETTORE_LAVORI,
TipoSoggettoUtil.GEOLOGO, TipoSoggettoUtil.DITTA, TipoSoggettoUtil.PROGETTISTA },
TipoSoggettoUtil.COMMITTENTE, TipoSoggettoUtil.DIRETTORE_LAVORI, TipoSoggettoUtil.GEOLOGO,
TipoSoggettoUtil.DITTA, TipoSoggettoUtil.PROGETTISTA },
new String[] { AsseverazioniUtil.STATO_ESEGUITA }));
nuoviDelegati.removeAll(cfNuoviSoggetti);
for (String cfDelegato : nuoviDelegati) {
List<Soggetto> delegato = soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale(
intPraticaId, cfDelegato, 0l);
List<Soggetto> delegato = soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale(intPraticaId,
cfDelegato, 0l);
GenericUtils.addAllIfnotExist(nuoviSoggetti, delegato);
}
if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica
.getTipoIntegrazione())) {
if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) {
User titolaredigitaleUser = UserLocalServiceUtil.getUser(intPratica.getUserId());
// Soggetto titolareDigitale =
// soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale(intPraticaId,
@ -335,58 +329,50 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
List<Soggetto> titolareDigitali = soggettoLocalService.getValidTmpByIntPratica_CodiceFiscale(
intPraticaId, titolaredigitaleUser.getScreenName(), 0l);
for (Soggetto titolareDigitale : titolareDigitali) {
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(),
dettPraticaId, titolareDigitale.getTipologiaSoggetto(),
titolareDigitale.getCodiceFiscale(), serviceContext);
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), dettPraticaId,
titolareDigitale.getTipologiaSoggetto(), titolareDigitale.getCodiceFiscale(),
serviceContext);
}
} else if (TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) {
String[] tipoSoggetti = new String[] { TipoSoggettoUtil.COMMITTENTE,
TipoSoggettoUtil.DIRETTORE_LAVORI, TipoSoggettoUtil.DITTA,
TipoSoggettoUtil.PROGETTISTA };
String[] tipoSoggetti = new String[] { TipoSoggettoUtil.COMMITTENTE, TipoSoggettoUtil.DIRETTORE_LAVORI,
TipoSoggettoUtil.DITTA, TipoSoggettoUtil.PROGETTISTA };
// if (SoggettiUtil.isTitolareInCommittenti(intPraticaId)) {
if (ValidazionePraticaUtil.isA98Required(dettPratica)) {
tipoSoggetti = (String[]) ArrayUtils.removeElement(tipoSoggetti,
TipoSoggettoUtil.COMMITTENTE);
tipoSoggetti = (String[]) ArrayUtils.removeElement(tipoSoggetti, TipoSoggettoUtil.COMMITTENTE);
}
List<Soggetto> soggettiPrincipali = soggettoLocalService
.getSoggettiPrincipaliValidTmpByDettPratica_TipologiaSoggetto(dettPraticaId,
tipoSoggetti);
.getSoggettiPrincipaliValidTmpByDettPratica_TipologiaSoggetto(dettPraticaId, tipoSoggetti);
GenericUtils.addAllIfnotExist(nuoviSoggetti, soggettiPrincipali);
}
for (Soggetto soggetto : nuoviSoggetti) {
if (TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(soggetto.getTipologiaSoggetto())) {
if (!ValidazionePraticaUtil.isA98Required(dettPratica)) {
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(),
dettPraticaId, soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(),
serviceContext);
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), dettPraticaId,
soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(), serviceContext);
}
} else {
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(),
dettPraticaId, soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(),
serviceContext);
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), dettPraticaId,
soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(), serviceContext);
}
}
} else {
List<Soggetto> soggetti = soggettoLocalService.getValidTmpByIntPratica(dettPratica
.getIntPraticaId());
List<Soggetto> soggetti = soggettoLocalService.getValidTmpByIntPratica(dettPratica.getIntPraticaId());
for (Soggetto soggetto : soggetti) {
if ((TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(soggetto.getTipologiaSoggetto()) && !ValidazionePraticaUtil
.isA98Required(dettPratica))
|| TipoSoggettoUtil.DITTA.equalsIgnoreCase(soggetto.getTipologiaSoggetto())
|| TipoSoggettoUtil.DIRETTORE_LAVORI
.equalsIgnoreCase(soggetto.getTipologiaSoggetto())
|| TipoSoggettoUtil.DIRETTORE_LAVORI.equalsIgnoreCase(soggetto.getTipologiaSoggetto())
|| TipoSoggettoUtil.PROGETTISTA.equalsIgnoreCase(soggetto.getTipologiaSoggetto())
|| (TipoSoggettoUtil.COLLAUDATORE.equalsIgnoreCase(soggetto.getTipologiaSoggetto()) && !soggetto
.isAggiuntivo())) {
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(),
dettPraticaId, soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(),
serviceContext);
addAsseverazione(serviceContext.getUserId(), dettPratica.getIntPraticaId(), dettPraticaId,
soggetto.getTipologiaSoggetto(), soggetto.getCodiceFiscale(), serviceContext);
}
}
@ -436,8 +422,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
}
@Override
public Asseverazione generateReportAsseverazione(Asseverazione asseverazione, long userId)
throws IOException, SystemException, PortalException {
public Asseverazione generateReportAsseverazione(Asseverazione asseverazione, long userId) throws IOException,
SystemException, PortalException {
if (Validator.isNotNull(asseverazione.getFileEntryId())) {
dlAppLocalService.deleteFileEntry(asseverazione.getFileEntryId());
@ -446,26 +432,25 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
String tipoDocumento = "AS";
String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(tipoDocumento);
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(
asseverazione.getCompanyId(), propertiesTemplate);
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(asseverazione.getCompanyId(),
propertiesTemplate);
String propertiesFolder = AvvisoUtil.getAllTipoDocumentoFolderProps().get(tipoDocumento);
long fileEntryIdFolder = configurazioneLocalService.findByC_ChiaveLong(asseverazione.getCompanyId(),
propertiesFolder);
String fileName = StringUtils.leftPad(String.valueOf(asseverazione.getDettPraticaId()), 10, '0')
+ (Validator.isNotNull(tipoDocumento) ? StringPool.UNDERLINE + tipoDocumento
: StringPool.BLANK)
+ (Validator.isNotNull(tipoDocumento) ? StringPool.UNDERLINE + tipoDocumento : StringPool.BLANK)
+ StringPool.UNDERLINE
+ (Validator.isNotNull(asseverazione.getAsseverazioneId()) ? asseverazione
.getAsseverazioneId() : System.currentTimeMillis());
+ (Validator.isNotNull(asseverazione.getAsseverazioneId()) ? asseverazione.getAsseverazioneId()
: System.currentTimeMillis());
ReportDto reportDto = new ReportDto();
reportDto.setFileEntryIds(new long[] { fileEntryIdTemplate });
reportDto.setFolderId(fileEntryIdFolder);
reportDto.setFileName(fileName);
reportDto.setHeader("");
reportDto.setHeader(StringPool.BLANK);
reportDto.setHeaderHeight(1);
reportDto.setFooter("");
reportDto.setFooter(StringPool.BLANK);
reportDto.setFooterHeight(40);
Map<String, Object> parameters = new HashMap<String, Object>();
@ -477,12 +462,12 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
relazioni = (String) dichiarazioniMap.get("relazioni");
}
} else {
relazioni = "";
relazioni = StringPool.BLANK;
}
}
String testoAsseverazione = testoAsseverazione(asseverazione.getTipologia(),
asseverazione.getCodiceFiscale(), asseverazione.getDettPraticaId(), relazioni);
String testoAsseverazione = testoAsseverazione(asseverazione.getTipologia(), asseverazione.getCodiceFiscale(),
asseverazione.getDettPraticaId(), relazioni);
if (Validator.isNull(testoAsseverazione)) {
testoAsseverazione = AsseverazioniUtil.retrieveAsseverazioneText(asseverazione,
asseverazione.getCodiceFiscale());
@ -499,8 +484,7 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
.replace(getClass().getSimpleName(), "resource/asseverazioni");
reportDto.setPortalURL(getClass().getResource(resourcePath).getPath());
ReportResultDto result = ReportUtil.generateReport(asseverazione.getCompanyId(), userId, reportDto,
null);
ReportResultDto result = ReportUtil.generateReport(asseverazione.getCompanyId(), userId, reportDto, null);
long idFileEntry = result.getFileEntryIds()[0];
asseverazione.setFileEntryId(idFileEntry);
@ -510,8 +494,8 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
}
@Override
public void cambioStatoAsseverazioni(long dettPraticaId, String stato) throws IOException,
SystemException, PortalException {
public void cambioStatoAsseverazioni(long dettPraticaId, String stato) throws IOException, SystemException,
PortalException {
List<Asseverazione> asseverazioni = asseverazionePersistence.findByDettPratica(dettPraticaId);
for (Asseverazione asseverazione : asseverazioni) {
@ -520,12 +504,10 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
}
@Override
public void concludiAsseverazioniExpired(long dettPraticaId) throws IOException, SystemException,
PortalException {
public void concludiAsseverazioniExpired(long dettPraticaId) throws IOException, SystemException, PortalException {
List<Asseverazione> asseverazioni = asseverazioneLocalService.findByDettPratica_InEsito(
dettPraticaId, new String[] { AsseverazioniUtil.STATO_ASSEGNATA }, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null);
List<Asseverazione> asseverazioni = asseverazioneLocalService.findByDettPratica_InEsito(dettPraticaId,
new String[] { AsseverazioniUtil.STATO_ASSEGNATA }, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
for (Asseverazione asseverazione : asseverazioni) {
cambioStatoAsseverazione(asseverazione.getUserId(), asseverazione.getAsseverazioneId(),
AsseverazioniUtil.STATO_EXPIRED);
@ -570,14 +552,13 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
ServiceContext serviceContext) throws SystemException, PortalException {
Asseverazione asseverazione = asseverazioneLocalService.getAsseverazione(asseverazioneId);
DettPratica dettPratica = dettPraticaLocalService.getLastEditableByIntPratica(asseverazione
.getIntPraticaId());
DettPratica dettPratica = dettPraticaLocalService.getLastEditableByIntPratica(asseverazione.getIntPraticaId());
// TODO forse dobbiamo mettere i permesssi ma non mi pare sicuro.
FileEntry fileEntry = null;
if (asseverazione.getEsito().equalsIgnoreCase(AsseverazioniUtil.STATO_ASSEGNATA)) {
long defaultFolderId = configurazioneLocalService.findByC_ChiaveLong(
serviceContext.getCompanyId(), ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
long defaultFolderId = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId);
@ -586,19 +567,18 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
Folder folder = null;
try {
folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(),
defaultFolder.getFolderId(), folderName);
folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), defaultFolder.getFolderId(),
folderName);
} catch (NoSuchFolderException e) {
// cartella non presente -> creo cartella
folder = dlAppLocalService.addFolder(serviceContext.getUserId(),
defaultFolder.getRepositoryId(), defaultFolder.getFolderId(), folderName,
StringPool.BLANK, serviceContext);
folder = dlAppLocalService.addFolder(serviceContext.getUserId(), defaultFolder.getRepositoryId(),
defaultFolder.getFolderId(), folderName, StringPool.BLANK, serviceContext);
}
Date now = new Date();
String tipologiaUtente = asseverazione.getTipologia();
String title = now.getTime() + StringPool.UNDERLINE + "asseverazione" + StringPool.UNDERLINE
+ tipologiaUtente + StringPool.UNDERLINE + sourceFileName;
String description = "";
String description = StringPool.BLANK;
String mimeType = MimeTypesUtil.getContentType(sourceFileName);
String changeLog = StringPool.BLANK;
@ -641,26 +621,25 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
}
@Override
public List<Asseverazione> findByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale,
int start, int end, OrderByComparator orderByComparator) throws SystemException {
public List<Asseverazione> findByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale, int start,
int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale, start,
end, orderByComparator);
return asseverazionePersistence.findByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale, start, end,
orderByComparator);
}
@Override
public int countByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale)
throws SystemException {
public int countByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale) throws SystemException {
return asseverazionePersistence.countByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale);
}
@Override
public List<Asseverazione> findByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti, int start,
int end, OrderByComparator orderByComparator) throws SystemException {
public List<Asseverazione> findByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByCodiceFiscale_InEsito(codiceFiscale, esiti, start, end,
orderByComparator);
return asseverazionePersistence
.findByCodiceFiscale_InEsito(codiceFiscale, esiti, start, end, orderByComparator);
}
@Override
@ -670,45 +649,40 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
}
@Override
public List<Asseverazione> findByIntPratica_CodiceFiscale_InEsito(long intPraticaId,
String codiceFiscale, String[] esiti, int start, int end, OrderByComparator orderByComparator)
throws SystemException {
public List<Asseverazione> findByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale,
esiti, start, end, orderByComparator);
return asseverazionePersistence.findByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti,
start, end, orderByComparator);
}
@Override
public List<Asseverazione> findByDettPratica_CodiceFiscale_InEsito(long dettPraticaId,
String codiceFiscale, String[] esiti, int start, int end, OrderByComparator orderByComparator)
throws SystemException {
public List<Asseverazione> findByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale,
esiti, start, end, orderByComparator);
return asseverazionePersistence.findByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti,
start, end, orderByComparator);
}
@Override
public int countByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale, String[] esiti)
throws SystemException {
return asseverazionePersistence.countByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale,
esiti);
return asseverazionePersistence.countByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti);
}
@Override
public int countByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale,
String[] esiti) throws SystemException {
public int countByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale, String[] esiti)
throws SystemException {
return asseverazionePersistence.countByIntPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale,
esiti);
return asseverazionePersistence.countByIntPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti);
}
@Override
public List<Asseverazione> findByIntPratica_InEsito(long intPraticaId, String[] esiti, int start,
int end, OrderByComparator orderByComparator) throws SystemException {
public List<Asseverazione> findByIntPratica_InEsito(long intPraticaId, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByIntPratica_InEsito(intPraticaId, esiti, start, end,
orderByComparator);
return asseverazionePersistence.findByIntPratica_InEsito(intPraticaId, esiti, start, end, orderByComparator);
}
@Override
@ -718,11 +692,10 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
}
@Override
public List<Asseverazione> findByDettPratica_InEsito(long dettPraticaId, String[] esiti, int start,
int end, OrderByComparator orderByComparator) throws SystemException {
public List<Asseverazione> findByDettPratica_InEsito(long dettPraticaId, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByDettPratica_InEsito(dettPraticaId, esiti, start, end,
orderByComparator);
return asseverazionePersistence.findByDettPratica_InEsito(dettPraticaId, esiti, start, end, orderByComparator);
}
@Override
@ -735,16 +708,15 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
public List<Asseverazione> findByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia,
esiti, start, end, orderByComparator);
return asseverazionePersistence.findByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti, start,
end, orderByComparator);
}
@Override
public int countByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia, String[] esiti)
throws SystemException {
return asseverazionePersistence.countByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia,
esiti);
return asseverazionePersistence.countByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti);
}
@Override
@ -752,32 +724,32 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
String codiceFiscale, String tipologia, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId,
codiceFiscale, tipologia, esiti, start, end, orderByComparator);
return asseverazionePersistence.findByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId, codiceFiscale,
tipologia, esiti, start, end, orderByComparator);
}
@Override
public int countByIntPratica_CodiceFiscale_Tipologia_InEsito(long intPraticaId, String codiceFiscale,
String tipologia, String[] esiti) throws SystemException {
return asseverazionePersistence.countByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId,
codiceFiscale, tipologia, esiti);
return asseverazionePersistence.countByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId, codiceFiscale,
tipologia, esiti);
}
@Override
public List<Asseverazione> findByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
public List<Asseverazione> findByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia, String[] esiti,
int start, int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti,
start, end, orderByComparator);
return asseverazionePersistence.findByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti, start, end,
orderByComparator);
}
@Override
public List<Asseverazione> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return asseverazionePersistence.findByDettPratica_Tipologia_InEsito(dettPraticaId, tipologia, esiti,
start, end, orderByComparator);
return asseverazionePersistence.findByDettPratica_Tipologia_InEsito(dettPraticaId, tipologia, esiti, start,
end, orderByComparator);
}
@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.DettPratica;
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.ConfigurazioneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.base.AvvisoLocalServiceBaseImpl;
@ -108,7 +109,6 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
String statoPratica = intPratica.getStatoPratica();
if (AvvisoUtil.isStatoPraticaValidoNuovoAvviso(statoPratica)) {
if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(statoPratica)
&& AzioniPraticheUtil.isAutorizzazione(intPratica.getIntPraticaId())) {
statoPratica = StatoPraticaConstants.AUTORIZZATA;
@ -116,12 +116,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
&& AzioniPraticheUtil.isAutorizzazione(intPratica.getIntPraticaId())) {
statoPratica = StatoPraticaConstants.NON_AUTORIZZATA;
}
String propertiesTemplate = null;
String tipoProcedura = intPratica.getTipoProcedura();
switch (statoPratica) {
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);
} else {
propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get("DPPS");
@ -165,7 +166,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
propertiesTemplate);
_log.info("debugAvviso: " + propertiesTemplate + " (" + statoPraticaCode + ")"
+ (varianteNonSostanziale ? " non sostanziale" : ""));
+ (varianteNonSostanziale ? " non sostanziale" : StringPool.BLANK));
return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate, classPk,
className, userCodiceFiscalePrimaFirma, jsonParameters, controlloPraticaId, serviceContext);
}
@ -502,7 +503,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
dynamicQuery.add(PropertyFactoryUtil.forName("rifiutato").eq(false));
Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
disjunction.add(RestrictionsFactoryUtil.eq("userCodiceFiscalePrimaFirma", ""));
disjunction.add(RestrictionsFactoryUtil.eq("userCodiceFiscalePrimaFirma", StringPool.BLANK));
disjunction.add(RestrictionsFactoryUtil.isNull("userCodiceFiscalePrimaFirma"));
dynamicQuery.add(disjunction);
@ -1156,115 +1157,76 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
throws ParseException, SystemException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
List<Avviso> lista = new ArrayList<Avviso>();
DynamicQuery query = DynamicQueryFactoryUtil.forClass(Avviso.class);
if (numeroProtocollo != null && !numeroProtocollo.equals("")) {
if (Validator.isNotNull(numeroProtocollo)) {
query.add(RestrictionsFactoryUtil.eq("protocollo", numeroProtocollo));
}
Calendar calendarDa = Calendar.getInstance();
calendarDa.set(Calendar.DAY_OF_MONTH, 1);
calendarDa.set(Calendar.MONTH, 1);
calendarDa.set(Calendar.YEAR, 2014);
if (dataDa != null && !dataDa.equals("") && dataA != null && !dataA.equals("")) {
if (Validator.isNotNull(dataDa) && Validator.isNotNull(dataA)) {
Date dateDa = sdf.parse(dataDa);
Date dateA = sdf.parse(dataA);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(dateDa, dateA));
}
if (dataDa != null && !dataDa.equals("") && (dataA == null || dataA.equals(""))) {
if (Validator.isNotNull(dataDa) && Validator.isNull(dataA)) {
Date dateDa = sdf.parse(dataDa);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(dateDa, new Date()));
}
if ((dataDa == null || dataDa.equals("")) && dataA != null && !dataA.equals("")) {
if (Validator.isNull(dataDa) && Validator.isNotNull(dataA)) {
Date dateA = sdf.parse(dataA);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(calendarDa.getTime(), dateA));
}
if ((numeroProtocollo != null && !numeroProtocollo.equals("")) || (dataDa != null && !dataDa.equals(""))
|| (dataA != null && !dataA.equals(""))) {
if (Validator.isNotNull(numeroProtocollo) || Validator.isNotNull(dataDa) || Validator.isNotNull(dataA)) {
Order defaultOrder = OrderFactoryUtil.asc("dtProtocollo");
query.addOrder(defaultOrder);
lista = AvvisoLocalServiceUtil.dynamicQuery(query, start, end);
}
return lista;
}
@Override
public int countProtocolliSearch(String dataDa, String dataA, String numeroProtocollo) throws SystemException,
ParseException {
int count = 0;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery query = DynamicQueryFactoryUtil.forClass(Avviso.class);
if (numeroProtocollo != null && !numeroProtocollo.equals("")) {
if (Validator.isNotNull(numeroProtocollo)) {
query.add(RestrictionsFactoryUtil.eq("protocollo", numeroProtocollo));
}
Calendar calendarDa = Calendar.getInstance();
calendarDa.set(Calendar.DAY_OF_MONTH, 1);
calendarDa.set(Calendar.MONTH, 1);
calendarDa.set(Calendar.YEAR, 2014);
if (dataDa != null && !dataDa.equals("") && dataA != null && !dataA.equals("")) {
if (Validator.isNotNull(dataDa) && Validator.isNotNull(dataA)) {
Date dateDa = sdf.parse(dataDa);
Date dateA = sdf.parse(dataA);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(dateDa, dateA));
}
if (dataDa != null && !dataDa.equals("") && (dataA == null || dataA.equals(""))) {
if (Validator.isNotNull(dataDa) && Validator.isNull(dataA)) {
Date dateDa = sdf.parse(dataDa);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(dateDa, new Date()));
}
if ((dataDa == null || dataDa.equals("")) && dataA != null && !dataA.equals("")) {
if (Validator.isNull(dataDa) && Validator.isNotNull(dataA)) {
Date dateA = sdf.parse(dataA);
Property createDateProperty = PropertyFactoryUtil.forName("dtProtocollo");
query.add(createDateProperty.between(calendarDa.getTime(), dateA));
}
if ((numeroProtocollo != null && !numeroProtocollo.equals("")) || (dataDa != null && !dataDa.equals(""))
|| (dataA != null && !dataA.equals(""))) {
if (Validator.isNotNull(numeroProtocollo) || Validator.isNotNull(dataDa) || Validator.isNotNull(dataA)) {
count = (int) avvisoPersistence.countWithDynamicQuery(query);
}
return count;
}
@Override
public List<Avviso> getAvvisiPerAggiuntaProtocollo(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAggiuntaProtocollo();
dynamicQuery.addOrder(OrderFactoryUtil.asc("dtAvviso"));
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
@ -1272,28 +1234,22 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
@Override
public DynamicQuery dynamicQueryAggiuntaProtocollo() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
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("oldAvvisoId").eq(0L));
dynamicQuery.add(PropertyFactoryUtil.forName("fileEntryIdProtocollo").eq(0L));
dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
return dynamicQuery;
}
@Override
public List<Avviso> findByClassPk(long classPk) throws SystemException {
return avvisoPersistence.findByClassPk(classPk);
}
// ///////////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////////
// NUOVI METODI ADT
/**
* ADT
@ -1310,11 +1266,9 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
*/
@Override
public List<Avviso> getAvvisiInvioTecnicoNew(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnicoNew(null);
dynamicQuery.addOrder(OrderFactoryUtil.asc("dtAvviso"));
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
/**
@ -1326,7 +1280,6 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
* @throws SystemException
*/
private DynamicQuery dynamicQueryAvvisiInvioTecnicoNew(Long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("inviatoTecnico").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
@ -1336,17 +1289,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
if (Validator.isNotNull(avvisoId)) {
dynamicQuery.add(PropertyFactoryUtil.forName("avvisoId").eq(avvisoId));
}
// evito di prendere i vecchi avvisi, in alternativa aggiornare il campo
// inviatotecnico sulla tabella
// degli avvisi
// evito di prendere i vecchi avvisi, in alternativa aggiornare il campo inviatotecnico sulla tabella degli
// avvisi
Calendar gc = GregorianCalendar.getInstance();
gc.set(Calendar.YEAR, 2018);
gc.set(Calendar.MONTH, 10);// NOVEMBRE
gc.set(Calendar.DAY_OF_MONTH, 24);
dynamicQuery.add(PropertyFactoryUtil.forName("createDate").ge(gc.getTime()));
// /////////////////////////////////////////
return dynamicQuery;
}
/**
@ -1359,7 +1309,6 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
*/
@Override
public Avviso getAvvisoVidimazione(long intPraticaId, long dettPraticaID) throws SystemException {
DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
new String[] { StatoPraticaConstants.VIDIMATA }));
@ -1368,16 +1317,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("classPk", dettPraticaID));
dynamicQuery.addOrder(OrderFactoryUtil.asc("avvisoId"));
List<Avviso> ritorno = dynamicQuery(dynamicQuery, 0, 1);
if (ritorno.isEmpty()) {
return null;
} else {
return ritorno.get(0);
}
}
/**
@ -1389,7 +1335,6 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
*/
@Override
public Avviso getLastAvvisoIntegrazione(long intPraticaId) throws SystemException {
DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
new String[] { StatoPraticaConstants.INTEGRAZIONE }));
@ -1397,15 +1342,12 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId));
dynamicQuery.addOrder(OrderFactoryUtil.desc("avvisoId"));
List<Avviso> ritorno = dynamicQuery(dynamicQuery, 0, 1);
if (ritorno.isEmpty()) {
return null;
} else {
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.
*
* This library is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.liferay.portos.bo.service.impl;
@ -83,15 +83,12 @@ import com.liferay.portlet.asset.model.AssetLinkConstants;
* The implementation of the controllo pratica local service.
*
* <p>
* All custom service methods should be put in this class. Whenever methods are
* added, rerun ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.bo.service.ControlloPraticaLocalService}
* interface.
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* their definitions into the {@link it.tref.liferay.portos.bo.service.ControlloPraticaLocalService} interface.
*
* <p>
* This is a local service. Methods of this service will not have security
* checks based on the propagated JAAS credentials because this service can only
* be accessed from within the same VM.
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* credentials because this service can only be accessed from within the same VM.
* </p>
*
* @author Davide Barbagallo, 3F Consulting
@ -100,18 +97,17 @@ import com.liferay.portlet.asset.model.AssetLinkConstants;
*/
public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use
* {@link
* it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil} to
* access the controllo pratica local service.
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil} to access the controllo pratica local
* service.
*/
private static final Log _log = LogFactoryUtil.getLog(ControlloPraticaLocalServiceImpl.class);
@Override
public ControlloPratica addControlloPratica(long groupId, long userId, long intPraticaId,
long dettPraticaId, boolean updateFlagControlloObbligatorio, ServiceContext serviceContext)
throws PortalException, SystemException {
public ControlloPratica addControlloPratica(long groupId, long userId, long intPraticaId, long dettPraticaId,
boolean updateFlagControlloObbligatorio, ServiceContext serviceContext) throws PortalException,
SystemException {
User user = userPersistence.findByPrimaryKey(userId);
// 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
IntPratica intPratica = intPraticaLocalService.updateStatoPratica(intPraticaId, dettPraticaId,
StatoPraticaConstants.SOTTOPOSTA_A_PARERE);
if (updateFlagControlloObbligatorio
&& Constants.TIPO_PRATICA_DEPOSITO.equals(intPratica.getTipoPratica())) {
if (updateFlagControlloObbligatorio && Constants.TIPO_PRATICA_DEPOSITO.equals(intPratica.getTipoPratica())) {
intPratica.setControlloObbligatorio(true);
intPratica = intPraticaLocalService.updateIntPratica(intPratica);
}
@ -166,9 +161,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
// ///////////
// Workflow
WorkflowHandlerRegistryUtil.startWorkflowInstance(entry.getCompanyId(), entry.getGroupId(),
entry.getUserId(), ControlloPratica.class.getName(), entry.getPrimaryKey(), entry,
serviceContext, wfContextMap);
WorkflowHandlerRegistryUtil.startWorkflowInstance(entry.getCompanyId(), entry.getGroupId(), entry.getUserId(),
ControlloPratica.class.getName(), entry.getPrimaryKey(), entry, serviceContext, wfContextMap);
Date dtInvio = null;
if (intPratica.getDtSorteggio() != null) {
@ -177,15 +171,14 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
dtInvio = entry.getCreateDate();
}
TempisticaLocalServiceUtil.addTempistica(intPraticaId, dettPraticaId,
TempisticaConstants.TIPO_PRATICA, dtInvio, serviceContext);
TempisticaLocalServiceUtil.addTempistica(intPraticaId, dettPraticaId, TempisticaConstants.TIPO_PRATICA,
dtInvio, serviceContext);
return entry;
}
@Override
public ControlloPratica deleteControlloPratica(long controlloPraticaId) throws PortalException,
SystemException {
public ControlloPratica deleteControlloPratica(long controlloPraticaId) throws PortalException, SystemException {
ControlloPratica entry = controlloPraticaPersistence.findByPrimaryKey(controlloPraticaId);
@ -193,8 +186,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
@Override
public ControlloPratica deleteControlloPratica(ControlloPratica entry) throws SystemException,
PortalException {
public ControlloPratica deleteControlloPratica(ControlloPratica entry) throws SystemException, PortalException {
// Resources
resourceLocalService.deleteResource(entry.getCompanyId(), ControlloPratica.class.getName(),
@ -206,8 +198,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
// Workflow
workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(entry.getCompanyId(),
entry.getGroupId(), ControlloPratica.class.getName(), entry.getControlloPraticaId());
workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(entry.getCompanyId(), entry.getGroupId(),
ControlloPratica.class.getName(), entry.getControlloPraticaId());
controlloPraticaPersistence.remove(entry);
@ -215,8 +207,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
@Override
public List<ControlloPratica> findByIntPraticaId_Status(long intPraticaId, int status)
throws SystemException {
public List<ControlloPratica> findByIntPraticaId_Status(long intPraticaId, int status) throws SystemException {
return controlloPraticaPersistence.findByIntPraticaId_Status(intPraticaId, status);
}
@ -228,9 +219,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
@Override
public void updateAsset(long userId, ControlloPratica entry, long[] assetCategoryIds,
String[] assetTagNames, long[] assetLinkEntryIds, Date now) throws PortalException,
SystemException {
public void updateAsset(long userId, ControlloPratica entry, long[] assetCategoryIds, String[] assetTagNames,
long[] assetLinkEntryIds, Date now) throws PortalException, SystemException {
boolean visible = false;
@ -248,10 +238,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, entry.getGroupId(), now, now,
ControlloPratica.class.getName(), entry.getControlloPraticaId(), entry.getUuid(), 0,
assetCategoryIds, assetTagNames, visible, null, null, null, null, ContentTypes.TEXT_PLAIN,
String.valueOf(entry.getPrimaryKey()), String.valueOf(entry.getPrimaryKey()), null, null, 0,
0, null, false);
ControlloPratica.class.getName(), entry.getControlloPraticaId(), entry.getUuid(), 0, assetCategoryIds,
assetTagNames, visible, null, null, null, null, ContentTypes.TEXT_PLAIN,
String.valueOf(entry.getPrimaryKey()), String.valueOf(entry.getPrimaryKey()), null, null, 0, 0, null,
false);
assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds,
AssetLinkConstants.TYPE_RELATED);
@ -264,9 +254,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
@Override
public ControlloPratica updateStatus(long userId, long resourcePrimKey, int status,
ServiceContext serviceContext, List<ControlloPratica> wfNewListVarianti) throws PortalException,
SystemException {
public ControlloPratica updateStatus(long userId, long resourcePrimKey, int status, ServiceContext serviceContext,
List<ControlloPratica> wfNewListVarianti) throws PortalException, SystemException {
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
@ -287,8 +276,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
List<DettPratica> successivePratiche = dettPraticaLocalService
.findCompletedByIntPraticaAndSuccessivoDettPratica(entry.getIntPraticaId(),
entry.getDettPraticaId());
boolean autorizzazione = Constants.TIPO_PRATICA_AUTORIZZAZIONE.equalsIgnoreCase(intPratica
.getTipoPratica());
boolean autorizzazione = Constants.TIPO_PRATICA_AUTORIZZAZIONE
.equalsIgnoreCase(intPratica.getTipoPratica());
boolean avvioWorkflow = false;
for (DettPratica dettPraticaSuc : successivePratiche) {
if (TipoIntegrazioneUtil.VARIANTE.equalsIgnoreCase(dettPraticaSuc.getTipoIntegrazione())
@ -324,13 +313,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
@Override
public boolean generazioneDocumento(long controlloPraticaId, String jsonParams, String tipoAvviso,
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException,
SystemException {
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, SystemException {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPraticaId);
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica
.getDettPraticaId());
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica.getDettPraticaId());
ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(controlloPratica.getCompanyId());
@ -354,8 +340,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
@Override
@Deprecated
public boolean updateStatoPraticaGeneraDocumentoFinale(long controlloPraticaId, String jsonParams,
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException,
SystemException {
long userIdFirma, Map<String, Serializable> workflowContext) throws PortalException, SystemException {
return generaDocumentoFinale(controlloPraticaId, jsonParams, userIdFirma, workflowContext);
}
@ -364,10 +349,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public boolean generaDocumentoFinale(long controlloPraticaId, String jsonParams, long userIdFirma,
Map<String, Serializable> workflowContext) throws PortalException, SystemException {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPraticaId);
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica
.getDettPraticaId());
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica.getDettPraticaId());
ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(controlloPratica.getCompanyId());
@ -401,11 +384,9 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public void updateIstruttore(long controlloPraticaId, Map<String, Serializable> workflowContext)
throws PortalException, SystemException {
ControlloPratica controlloPratica = controlloPraticaLocalService
.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
@SuppressWarnings("unchecked")
Map<String, String> parametri = (Map<String, String>) workflowContext
.get("CONTEXT_TASK_FORM_PARAMETERS");
Map<String, String> parametri = (Map<String, String>) workflowContext.get("CONTEXT_TASK_FORM_PARAMETERS");
IntPratica intPratica = intPraticaLocalService.getIntPratica(controlloPratica.getIntPraticaId());
long istruttore = GetterUtil.getLong(parametri.get("istruttore"));
intPratica.setStatusByUserId(istruttore);
@ -423,8 +404,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
/**
* I valori di ritorno possibili sono:
* approvato,non_approvato,annullato,richiesta_integrazione
* I valori di ritorno possibili sono: approvato,non_approvato,annullato,richiesta_integrazione
*
* @throws SystemException
* @throws PortalException
@ -435,11 +415,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
String esito = getEsitoFinale(controlloPraticaId, workflowContext);
String ramoWorkflow = StringPool.BLANK;
ControlloPratica controlloPratica = controlloPraticaLocalService
.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
Avviso avviso = avvisoLocalService.fetchLastAvvisoByIntPraticaPerStatoFinale(controlloPratica
.getIntPraticaId());
Avviso avviso = avvisoLocalService
.fetchLastAvvisoByIntPraticaPerStatoFinale(controlloPratica.getIntPraticaId());
if (avviso != null && avviso.getRifiutato()) {
ramoWorkflow = "rifiuto_firma";
} else {
@ -483,10 +462,9 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
// Map<String, String> parametri = (Map<String, String>)
// workflowContext.get("CONTEXT_TASK_FORM_PARAMETERS");
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
Map<String, Serializable> parametri = WorkflowUtil.getFormParameters(controlloPratica);
String esitoScelta = (String) parametri.get("esito");
String esitoScelta = (String) parametri.get(WorkflowConstants.WORKFLOW_TASKNAME_ESITO);
if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(esitoScelta)
&& AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) {
@ -500,11 +478,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
@Override
public void aggiornaStatoPerRichiestaIntegrazione(long controlloPraticaId,
Map<String, Serializable> workflowContext) throws PortalException, SystemException {
public void aggiornaStatoPerRichiestaIntegrazione(long controlloPraticaId, Map<String, Serializable> workflowContext)
throws PortalException, SystemException {
ControlloPratica controlloPratica = controlloPraticaLocalService
.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
IntPratica intPratica = intPraticaLocalService.getIntPratica(controlloPratica.getIntPraticaId());
intPratica.setStatoPratica(StatoPraticaConstants.INTEGRAZIONE);
intPraticaLocalService.updateIntPratica(intPratica);
@ -514,8 +491,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public String getJsonListaIstruttori(long controlloPraticaId, Map<String, Serializable> workflowContext)
throws PortalException, SystemException {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
@ -540,69 +516,60 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public String getJsonEsitoPratica(long controlloPraticaId, Map<String, Serializable> workflowContext)
throws PortalException, SystemException {
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.getControlloPratica(controlloPraticaId);
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
jsonObject.put("esito", jsonArray);
jsonObject.put(WorkflowConstants.WORKFLOW_TASKNAME_ESITO, jsonArray);
if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) {
JSONObject etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "CONFORME");
etichette.put("value", "CO");
etichette.put("value", StatoPraticaConstants.CONFORME);
etichette.put("default", false);
jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "NON CONFORME");
etichette.put("value", "NC");
etichette.put("value", StatoPraticaConstants.NON_CONFORME);
etichette.put("default", false);
jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "RICHIESTA INTEGRAZIONE");
etichette.put("value", "IN");
etichette.put("value", StatoPraticaConstants.INTEGRAZIONE);
etichette.put("default", false);
jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "ANNULLATA");
etichette.put("value", "AL");
etichette.put("value", StatoPraticaConstants.ANNULLATA);
etichette.put("default", false);
jsonArray.put(etichette);
} else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) {
JSONObject etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "AUTORIZZATA");
// etichette.put("value", "CO");
etichette.put("value", "AU");
etichette.put("value", StatoPraticaConstants.AUTORIZZATA);
etichette.put("default", false);
jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "NON AUTORIZZATA");
// etichette.put("value", "NC");
etichette.put("value", "AN");
etichette.put("value", StatoPraticaConstants.NON_AUTORIZZATA);
etichette.put("default", false);
jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "RICHIESTA INTEGRAZIONE");
etichette.put("value", "IN");
etichette.put("value", StatoPraticaConstants.INTEGRAZIONE);
etichette.put("default", false);
jsonArray.put(etichette);
etichette = JSONFactoryUtil.createJSONObject();
etichette.put("label", "ANNULLATA");
etichette.put("value", "AL");
etichette.put("value", StatoPraticaConstants.ANNULLATA);
etichette.put("default", false);
jsonArray.put(etichette);
}
return jsonObject.toString();
}
@Override
public ControlloPratica addPraticheAlControllo(long controlloPraticaId, long dettPraticaId)
throws PortalException, SystemException {
ControlloPratica controlloPratica = controlloPraticaLocalService
.getControlloPratica(controlloPraticaId);
public ControlloPratica addPraticheAlControllo(long controlloPraticaId, long dettPraticaId) throws PortalException,
SystemException {
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
controlloPratica.setDettPraticaId(dettPraticaId);
controlloPratica.setModifiedDate(new Date());
@ -622,8 +589,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public ControlloPratica addPraticheAlControlloVarianti(long controlloPraticaId, long dettPraticaId,
ServiceContext serviceContext) throws PortalException, SystemException {
_log.info("start addPraticheAlControlloVarianti per controlloPraticaId=" + controlloPraticaId);
ControlloPratica controlloPratica = controlloPraticaLocalService
.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
controlloPratica.setDettPraticaId(dettPraticaId);
controlloPratica.setModifiedDate(new Date());
ControlloPratica result = controlloPraticaPersistence.update(controlloPratica);
@ -648,8 +614,7 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
FormLogLocalServiceUtil.addFormLog(lastTask.getWorkflowInstanceId(), 0l, "cambio-istruttore",
jsonFormParameters, serviceContext);
} catch (Exception e) {
_log.error(
"Errore in addPraticheAlControlloVarianti - inserimento log non riuscito -controlloPraticaId = "
_log.error("Errore in addPraticheAlControlloVarianti - inserimento log non riuscito -controlloPraticaId = "
+ controlloPraticaId, e);
}
@ -657,21 +622,17 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
/*
* TODO Controllare bene il processo. Ci deve essere un modo per capire se
* sono pratiche da importare o nuove. A mio parere (scuti) dovrebbe essere:
* if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE
* .equalsIgnoreCase(dettPratica.getTipoIntegrazione())) { return
* "portos1_integrazioni"; } else { return "portos1_esito"; }
* TODO Controllare bene il processo. Ci deve essere un modo per capire se sono pratiche da importare o nuove. A mio
* parere (scuti) dovrebbe essere: if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE
* .equalsIgnoreCase(dettPratica.getTipoIntegrazione())) { return "portos1_integrazioni"; } else { return
* "portos1_esito"; }
*/
@Override
public String getReturnValueScriptIniziale(long controlloPraticaId) throws PortalException,
SystemException {
public String getReturnValueScriptIniziale(long controlloPraticaId) throws PortalException, SystemException {
ControlloPratica controlloPratica = controlloPraticaLocalService
.getControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId);
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica
.getDettPraticaId());
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(controlloPratica.getDettPraticaId());
if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equalsIgnoreCase(dettPratica.getTipoIntegrazione())) {
// return "portos1_esito";
@ -686,12 +647,10 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
String tipoEsito = "";
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.fetchControlloPratica(controlloPraticaId);
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.fetchControlloPratica(controlloPraticaId);
ClassLoader classLoaderKaleo = (ClassLoader) PortletBeanLocatorUtil.locate(
com.liferay.portal.workflow.kaleo.service.ClpSerializer.getServletContextName(),
"portletClassLoader");
com.liferay.portal.workflow.kaleo.service.ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery dqKaleo = DynamicQueryFactoryUtil.forClass(KaleoInstance.class, classLoaderKaleo);
dqKaleo.add(RestrictionsFactoryUtil.eq("classPK", controlloPraticaId));
@ -706,10 +665,8 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
it.tref.liferay.portos.kaleo.service.ClpSerializer.getServletContextName(),
"portletClassLoader");
DynamicQuery dqKaleoLog = DynamicQueryFactoryUtil
.forClass(FormLog.class, classLoaderKaleoLog);
dqKaleoLog.add(RestrictionsFactoryUtil.eq("workflowInstanceId",
kaleoInstance.getKaleoInstanceId()));
DynamicQuery dqKaleoLog = DynamicQueryFactoryUtil.forClass(FormLog.class, classLoaderKaleoLog);
dqKaleoLog.add(RestrictionsFactoryUtil.eq("workflowInstanceId", kaleoInstance.getKaleoInstanceId()));
dqKaleoLog.add(RestrictionsFactoryUtil.eq("transitionName", "registra-esito"));
Order defaultOrder = OrderFactoryUtil.desc("createDate");
@ -719,33 +676,27 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
if (listaKaleoLog != null && !listaKaleoLog.isEmpty()) {
FormLog formLog = listaKaleoLog.get(0);
JSONObject json = JSONFactoryUtil.createJSONObject(formLog.getFormParameters());
if (json.has("esito")) {
String appStirng = json.getString("esito");
switch (appStirng) {
case "IN":
if (json.has(WorkflowConstants.WORKFLOW_TASKNAME_ESITO)) {
String appString = json.getString(WorkflowConstants.WORKFLOW_TASKNAME_ESITO);
switch (appString) {
case StatoPraticaConstants.INTEGRAZIONE:
tipoEsito = "Richiesta Integrazione";
break;
case "CO":
case StatoPraticaConstants.CONFORME:
if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) {
tipoEsito = "Conforme";
} else if (AzioniPraticheUtil
.isAutorizzazione(controlloPratica.getIntPraticaId())) {
} else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) {
tipoEsito = "Autorizzata";
}
break;
case "NC":
case StatoPraticaConstants.NON_CONFORME:
if (AzioniPraticheUtil.isDeposito(controlloPratica.getIntPraticaId())) {
tipoEsito = "Non conforme";
} else if (AzioniPraticheUtil
.isAutorizzazione(controlloPratica.getIntPraticaId())) {
} else if (AzioniPraticheUtil.isAutorizzazione(controlloPratica.getIntPraticaId())) {
tipoEsito = "Non autorizzata";
}
break;
case "AL":
case StatoPraticaConstants.ANNULLATA:
tipoEsito = "Annullata";
break;
@ -753,13 +704,9 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
break;
}
}
}
}
}
return tipoEsito;
}
@ -769,11 +716,9 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
@Override
public Long calculateDateAvvioProcedimento(long controlloPraticaId) throws SystemException,
PortalException {
public Long calculateDateAvvioProcedimento(long controlloPraticaId) throws SystemException, PortalException {
ControlloPratica controllo = ControlloPraticaLocalServiceUtil
.fetchControlloPratica(controlloPraticaId);
ControlloPratica controllo = ControlloPraticaLocalServiceUtil.fetchControlloPratica(controlloPraticaId);
IntPratica pratica = IntPraticaLocalServiceUtil.fetchIntPratica(controllo.getIntPraticaId());
@ -785,9 +730,12 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
Date chiusura = null;
long stop = 0L;
List<Avviso> avvisi = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(),
QueryUtil.ALL_POS, QueryUtil.ALL_POS, OrderByComparatorFactoryUtil
.getOrderByComparatorFactory().create("portos_bo_Avviso", "createDate", true));
List<Avviso> avvisi = AvvisoLocalServiceUtil.findByIntPratica(
pratica.getIntPraticaId(),
QueryUtil.ALL_POS,
QueryUtil.ALL_POS,
OrderByComparatorFactoryUtil.getOrderByComparatorFactory().create("portos_bo_Avviso", "createDate",
true));
Date start = null;
Date end = null;
@ -856,35 +804,28 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
}
/*
* public long calculateDateAvvioProcedimentoOld(long controlloPraticaId)
* throws SystemException, PortalException {
* public long calculateDateAvvioProcedimentoOld(long controlloPraticaId) throws SystemException, PortalException {
*
* long giorni = 0;
*
* ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
* .fetchControlloPratica(controlloPraticaId);
* ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil .fetchControlloPratica(controlloPraticaId);
*
* Long intPraticaId = controlloPratica.getIntPraticaId();
*
* List<Tempistica> tempisticaList =
* TempisticaLocalServiceUtil.findByIntPratica_Tipo(intPraticaId,
* List<Tempistica> tempisticaList = TempisticaLocalServiceUtil.findByIntPratica_Tipo(intPraticaId,
* TempisticaConstants.TIPO_PRATICA);
*
* if (tempisticaList != null && tempisticaList.size() > 0) { Tempistica
* temp = null;
* if (tempisticaList != null && tempisticaList.size() > 0) { Tempistica temp = null;
*
* for (Iterator iterator = tempisticaList.iterator(); iterator.hasNext();)
* { Tempistica tempistica = (Tempistica) iterator.next(); if (temp == null
* || temp.getCreateDate().before(tempistica.getCreateDate())) temp =
* tempistica; }
* for (Iterator iterator = tempisticaList.iterator(); iterator.hasNext();) { Tempistica tempistica = (Tempistica)
* iterator.next(); if (temp == null || temp.getCreateDate().before(tempistica.getCreateDate())) temp = tempistica;
* }
*
* long giorniMillisecFormat = 0; if (temp.getStop() > 0)
* giorniMillisecFormat = temp.getStop() - (temp.getStart() +
* temp.getWait()); else if (temp.getStop() == 0) giorniMillisecFormat =
* System.currentTimeMillis() - (temp.getStart() + temp.getWait());
* long giorniMillisecFormat = 0; if (temp.getStop() > 0) giorniMillisecFormat = temp.getStop() - (temp.getStart() +
* temp.getWait()); else if (temp.getStop() == 0) giorniMillisecFormat = System.currentTimeMillis() -
* (temp.getStart() + temp.getWait());
*
* giorni = TimeUnit.DAYS.convert(giorniMillisecFormat,
* TimeUnit.MILLISECONDS); }
* giorni = TimeUnit.DAYS.convert(giorniMillisecFormat, TimeUnit.MILLISECONDS); }
*
* return giorni; }
*/
@ -899,78 +840,50 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
public void gestioneWFVarianti(ControlloPratica cp) {
try {
/*
* DettPratica
* dettPratica=DettPraticaLocalServiceUtil.getDettPratica
* (cp.getDettPraticaId());
* if(dettPratica.getTipoIntegrazione().equals
* (TipoIntegrazioneUtil.VARIANTE)){ _log.info(
* DettPratica dettPratica=DettPraticaLocalServiceUtil.getDettPratica (cp.getDettPraticaId());
* if(dettPratica.getTipoIntegrazione().equals (TipoIntegrazioneUtil.VARIANTE)){ _log.info(
* "gestioneWFVarianti - avviato workflow per variante dettPraticaId="
* +cp.getDettPraticaId()+" -ControlloPraticaId="+cp.
* getControlloPraticaId()); IntPratica intPratica=
* IntPraticaLocalServiceUtil.fetchIntPratica(cp.getIntPraticaId());
* long statusByuserId=intPratica.getStatusByUserId();
* _log.info("gestioneWFVarianti -statusByuserId="
* +statusByuserId+" per int pratica="
* +intPratica.getIntPraticaId()); //WorkflowInstanceLink
* workflowInstanceLink =
* WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink(
* // cp.getCompanyId(),cp.getGroupId(),
* ControlloPratica.class.getName(),cp.getPrimaryKey());
* //_log.info(
* "gestioneWFVarianti - workflowInstanceLink=="+workflowInstanceLink
* .getWorkflowInstanceId()); if (statusByuserId==0){
* _log.info("gestioneWFVarianti - KO - statusByuserId="
* +statusByuserId); return; }else{
* _log.info("gestioneWFVarianti - statusByuserId determinato ="
* +statusByuserId); } long workflowInstanceId =
* WorkflowUtil.getWorkflowInstanceId(cp);
* +cp.getDettPraticaId()+" -ControlloPraticaId="+cp. getControlloPraticaId()); IntPratica intPratica=
* IntPraticaLocalServiceUtil.fetchIntPratica(cp.getIntPraticaId()); long
* statusByuserId=intPratica.getStatusByUserId(); _log.info("gestioneWFVarianti -statusByuserId="
* +statusByuserId+" per int pratica=" +intPratica.getIntPraticaId()); //WorkflowInstanceLink
* workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink( //
* cp.getCompanyId(),cp.getGroupId(), ControlloPratica.class.getName(),cp.getPrimaryKey()); //_log.info(
* "gestioneWFVarianti - workflowInstanceLink=="+workflowInstanceLink .getWorkflowInstanceId()); if
* (statusByuserId==0){ _log.info("gestioneWFVarianti - KO - statusByuserId=" +statusByuserId); return;
* }else{ _log.info("gestioneWFVarianti - statusByuserId determinato =" +statusByuserId); } long
* workflowInstanceId = WorkflowUtil.getWorkflowInstanceId(cp);
*
* //creazione record KaleoTaskInstanceToken di tipo ESITO
* ServiceContext serviceContext = new ServiceContext();
* serviceContext.setCompanyId(cp.getCompanyId()); KaleoInstance
* kaleoInstance =
* KaleoInstanceLocalServiceUtil.getKaleoInstance(workflowInstanceId
* ); KaleoInstanceToken rootKaleoInstanceToken =
* kaleoInstance.getRootKaleoInstanceToken(serviceContext);
* //creazione record KaleoTaskInstanceToken di tipo ESITO ServiceContext serviceContext = new
* ServiceContext(); serviceContext.setCompanyId(cp.getCompanyId()); KaleoInstance kaleoInstance =
* KaleoInstanceLocalServiceUtil.getKaleoInstance(workflowInstanceId ); KaleoInstanceToken
* rootKaleoInstanceToken = kaleoInstance.getRootKaleoInstanceToken(serviceContext);
* _log.info("gestioneWFVarianti - rootKaleoInstanceToken="+
* rootKaleoInstanceToken.getCurrentKaleoNodeName()); long
* kaleoTaskInstanceTokenID=CounterLocalServiceUtil.increment(
* "com.liferay.counter.model.Counter");
* _log.info("kaleoTaskInstanceTokenID="+kaleoTaskInstanceTokenID);
* KaleoTaskInstanceToken x =
* KaleoTaskInstanceTokenLocalServiceUtil.
* createKaleoTaskInstanceToken(kaleoTaskInstanceTokenID);
* x.setKaleoTaskId(21642); x.setKaleoTaskName("Esito");
* x.setCompleted(false); x.setGroupId(cp.getGroupId());
* x.setClassName
* ("it.tref.liferay.portos.bo.model.ControlloPratica");
* x.setClassPK(kaleoInstance.getClassPK());
* x.setCompanyId(kaleoInstance.getCompanyId());
* x.setUserId(kaleoInstance.getUserId());
* x.setUserName(kaleoInstance.getUserName()); x.setCreateDate(new
* Date());
* x.setKaleoInstanceId(kaleoInstance.getKaleoInstanceId());
* x.setKaleoDefinitionId(kaleoInstance.getKaleoDefinitionId());
* x.setKaleoInstanceTokenId
* kaleoTaskInstanceTokenID=CounterLocalServiceUtil.increment( "com.liferay.counter.model.Counter");
* _log.info("kaleoTaskInstanceTokenID="+kaleoTaskInstanceTokenID); KaleoTaskInstanceToken x =
* KaleoTaskInstanceTokenLocalServiceUtil. createKaleoTaskInstanceToken(kaleoTaskInstanceTokenID);
* x.setKaleoTaskId(21642); x.setKaleoTaskName("Esito"); x.setCompleted(false);
* x.setGroupId(cp.getGroupId()); x.setClassName ("it.tref.liferay.portos.bo.model.ControlloPratica");
* x.setClassPK(kaleoInstance.getClassPK()); x.setCompanyId(kaleoInstance.getCompanyId());
* x.setUserId(kaleoInstance.getUserId()); x.setUserName(kaleoInstance.getUserName()); x.setCreateDate(new
* Date()); x.setKaleoInstanceId(kaleoInstance.getKaleoInstanceId());
* x.setKaleoDefinitionId(kaleoInstance.getKaleoDefinitionId()); x.setKaleoInstanceTokenId
* (rootKaleoInstanceToken.getKaleoInstanceTokenId());
* x.setWorkflowContext(kaleoInstance.getWorkflowContext());
* x=KaleoTaskInstanceTokenLocalServiceUtil
* x.setWorkflowContext(kaleoInstance.getWorkflowContext()); x=KaleoTaskInstanceTokenLocalServiceUtil
* .updateKaleoTaskInstanceToken(x); _log.info(
* "gestioneWFVarianti - KaleoTaskInstanceToken di tipo ESITO creato - KaleoTaskInstanceTokenId = "
* +x.getKaleoTaskInstanceTokenId()); _log.info(
* "gestioneWFVarianti - correttamente eseguito - ControlloPraticaId = "
* +cp.getControlloPraticaId());
* ////////////////////////////////////
* /////////////////////////////////
* "gestioneWFVarianti - correttamente eseguito - ControlloPraticaId = " +cp.getControlloPraticaId());
* //////////////////////////////////// /////////////////////////////////
*
*
*
* }
*/
} catch (Exception e) {
_log.error(
"gestioneWFVarianti - Errore in gestioneWFVarianti - dettaPratiacaId="
+ cp.getDettPraticaId(), e);
_log.error("gestioneWFVarianti - Errore in gestioneWFVarianti - dettaPratiacaId=" + cp.getDettPraticaId(),
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);
@Override
public Delega addDelega(long userId, long intPraticaId, long dettPraticaId, String tipologia,
String codiceFiscale, ServiceContext serviceContext) throws PortalException, SystemException {
@ -109,6 +110,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delega;
}
@Override
public Delega cambioStato(long delegaId, String esito) throws PortalException, SystemException {
Date now = new Date();
@ -122,6 +124,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delega;
}
@Override
public void concludiDeleghePagamento(long dettPraticaId) throws PortalException, SystemException {
List<Delega> deleghe = this.findByDettPratica_Tipologia_InEsito(dettPraticaId,
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 {
// TODO Write your own validation code
}
@Override
public List<Delega> findByIntPratica(long intPraticaId, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica(intPraticaId, start, end, orderByComparator);
}
@Override
public List<Delega> findByDettPratica(long dettPraticaId, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica(dettPraticaId, start, end, orderByComparator);
}
@Override
public int countByIntPratica(long intPraticaId) throws SystemException {
return delegaPersistence.countByIntPratica(intPraticaId);
}
@Override
public int countByDettPratica(long dettPraticaId) throws SystemException {
return delegaPersistence.countByIntPratica(dettPraticaId);
}
@Override
public List<Delega> findByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale, int start,
int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale, start, end,
orderByComparator);
}
@Override
public List<Delega> findByCodiceFiscale(String codiceFiscale) throws SystemException {
return delegaPersistence.findByCodiceFiscale(codiceFiscale);
}
@Override
public int countByIntPratica_CodiceFiscale(long intPraticaId, String codiceFiscale)
throws SystemException {
return delegaPersistence.countByIntPratica_CodiceFiscale(intPraticaId, codiceFiscale);
}
@Override
public List<Delega> findByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByCodiceFiscale_InEsito(codiceFiscale, esiti, start, end,
orderByComparator);
}
@Override
public int countByCodiceFiscale_InEsito(String codiceFiscale, String[] esiti) throws SystemException {
return delegaPersistence.countByCodiceFiscale_InEsito(codiceFiscale, esiti);
}
@Override
public List<Delega> findByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti,
start, end, orderByComparator);
}
@Override
public int countByIntPratica_CodiceFiscale_InEsito(long intPraticaId, String codiceFiscale, String[] esiti)
throws SystemException {
return delegaPersistence.countByIntPratica_CodiceFiscale_InEsito(intPraticaId, codiceFiscale, esiti);
}
@Override
public List<Delega> findByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti,
start, end, orderByComparator);
}
@Override
public int countByDettPratica_CodiceFiscale_InEsito(long dettPraticaId, String codiceFiscale,
String[] esiti) throws SystemException {
return delegaPersistence
.countByDettPratica_CodiceFiscale_InEsito(dettPraticaId, codiceFiscale, esiti);
}
@Override
public List<Delega> findByIntPratica_InEsito(long intPraticaId, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica_InEsito(intPraticaId, esiti, start, end, orderByComparator);
}
@Override
public int countByIntPratica_InEsito(long intPraticaId, String[] esiti) throws SystemException {
return delegaPersistence.countByIntPratica_InEsito(intPraticaId, esiti);
}
@Override
public List<Delega> findByDettPratica_InEsito(long dettPraticaId, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica_InEsito(dettPraticaId, esiti, start, end,
orderByComparator);
}
@Override
public List<String> findCfByDettPratica_InEsito(long dettPraticaId, String[] esiti)
throws SystemException {
@ -239,6 +258,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delegaPersistence.findWithDynamicQuery(dynamicQuery);
}
@Override
public List<Delega> findByDettPratica_InEsito(long dettPraticaId, String[] esiti) throws SystemException {
DynamicQuery dynamicQuery = createQueryByDettPratica_InEsito(dettPraticaId, esiti);
@ -246,6 +266,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delegaPersistence.findWithDynamicQuery(dynamicQuery);
}
@Override
public List<String> findCfByDettPratica_Tipologia_InEsito(long dettPraticaId, String[] tipologie,
String[] esiti) throws SystemException {
@ -257,6 +278,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return delegaPersistence.findWithDynamicQuery(dynamicQuery);
}
@Override
public List<Delega> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String[] tipologie,
String[] esiti) throws SystemException {
@ -274,21 +296,25 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public int countByDettPratica_InEsito(long dettPraticaId, String[] esiti) throws SystemException {
return delegaPersistence.countByDettPratica_InEsito(dettPraticaId, esiti);
}
@Override
public List<Delega> findByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti,
start, end, orderByComparator);
}
@Override
public int countByCodiceFiscale_Tipologia_InEsito(String codiceFiscale, String tipologia, String[] esiti)
throws SystemException {
return delegaPersistence.countByCodiceFiscale_Tipologia_InEsito(codiceFiscale, tipologia, esiti);
}
@Override
public List<Delega> findByIntPratica_CodiceFiscale_Tipologia_InEsito(long intPraticaId,
String codiceFiscale, String tipologia, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
@ -296,12 +322,14 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
codiceFiscale, tipologia, esiti, start, end, orderByComparator);
}
@Override
public int countByIntPratica_CodiceFiscale_Tipologia_InEsito(long intPraticaId, String codiceFiscale,
String tipologia, String[] esiti) throws SystemException {
return delegaPersistence.countByIntPratica_CodiceFiscale_Tipologia_InEsito(intPraticaId,
codiceFiscale, tipologia, esiti);
}
@Override
public List<Delega> findByDettPratica_CodiceFiscale_Tipologia_InEsito(long dettPraticaId,
String codiceFiscale, String[] tipologie, String[] esiti, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
@ -309,35 +337,41 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
codiceFiscale, tipologie, esiti, start, end, orderByComparator);
}
@Override
public int countByDettPratica_CodiceFiscale_Tipologia_InEsito(long dettPraticaId, String codiceFiscale,
String[] tipologie, String[] esiti) throws SystemException {
return delegaPersistence.countByDettPratica_CodiceFiscale_Tipologia_InEsito(dettPraticaId,
codiceFiscale, tipologie, esiti);
}
@Override
public List<Delega> findByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti, start,
end, orderByComparator);
}
@Override
public List<Delega> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String tipologia,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica_Tipologia_InEsito(dettPraticaId, tipologia, esiti, start,
end, orderByComparator);
}
@Override
public int countByIntPratica_Tipologia_InEsito(long intPraticaId, String tipologia, String[] esiti)
throws SystemException {
return delegaPersistence.countByIntPratica_Tipologia_InEsito(intPraticaId, tipologia, esiti);
}
@Override
public List<Delega> findByDettPratica_Tipologia_InEsito(long dettPraticaId, String[] tipologie,
String[] esiti, int start, int end, OrderByComparator orderByComparator) throws SystemException {
return delegaPersistence.findByDettPratica_Tipologie_InEsiti(dettPraticaId, tipologie, esiti, start,
end, orderByComparator);
}
@Override
public int countByDettPratica_Tipologia_InEsito(long intPraticaId, String[] tipologie, String[] esiti)
throws SystemException {
return delegaPersistence.countByDettPratica_Tipologie_InEsiti(intPraticaId, tipologie, esiti);
@ -347,6 +381,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
*
* ADT: nuovo metodo generazione documento conclusione delega
*/
@Override
public void generaDocumentoConcludiDelegaGeologo(long dettPraticaId, Delega delega,
ServiceContext serviceContext) throws PortalException, SystemException {
@ -373,9 +408,9 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
reportDto.setFileEntryIds(new long[] { fileEntryIdTemplate.getFileEntryId() });
reportDto.setFolderId(folderAllegati.getFolderId());
reportDto.setFileName(fileName);
reportDto.setHeader("");
reportDto.setHeader(StringPool.BLANK);
reportDto.setHeaderHeight(1);
reportDto.setFooter("");
reportDto.setFooter(StringPool.BLANK);
reportDto.setFooterHeight(40);
reportDto.setParameters(parameters);
@ -386,7 +421,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
.replace(getClass().getSimpleName(), "resource/asseverazioni");
reportDto.setPortalURL(getClass().getResource(resourcePath).getPath());
String relazioni = "";
String relazioni = StringPool.BLANK;
Map<String, Serializable> dichiarazioniMap = delega.getDichiarazioniMap();
if (dichiarazioniMap.containsKey("coniugio") && ((Boolean) dichiarazioniMap.get("coniugio"))
&& dichiarazioniMap.containsKey("relazioni")) {
@ -402,15 +437,7 @@ public class DelegaLocalServiceImpl extends DelegaLocalServiceBaseImpl {
null);
long fileEntryId = result.getFileEntryIds()[0];
// DLFileEntry fileEntry =
// 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 = "";
String sha256 = StringPool.BLANK;
try {
sha256 = DigestUtils.sha256Hex(dlAppLocalService.getFileEntry(fileEntryId)
.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,
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);
if (Validator.isNotNull(statoPagamento)) {
if (DettPratica.class.getName().equals(pagamento.getClassName())) {
@ -322,7 +181,6 @@ public abstract class PagamentiUtil {
long pagamentoId = 0l;
long intPraticaId = 0l;
// long dettPraticaId = 0l;
if (DettPratica.class.getName().equals(className)) {
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(classPk);
esenzioneBolli = dettPratica.isNormEsenteBollo();
@ -334,7 +192,6 @@ public abstract class PagamentiUtil {
pagamentoId = dettPratica.getPagamentoIdBolli();
}
intPraticaId = dettPratica.getIntPraticaId();
// dettPraticaId = classPk;
} else if (FineLavori.class.getName().equals(className)) {
FineLavori fineLavori = FineLavoriLocalServiceUtil.getFineLavori(classPk);
esenzioneBolli = fineLavori.isNormEsenteBollo();
@ -345,8 +202,6 @@ public abstract class PagamentiUtil {
} else if (PagamentoConstants.PAGAMENTO_BOLLI.equals(tipoPagamento)) {
pagamentoId = fineLavori.getPagamentoId();
}
// dettPraticaId =
// DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(fineLavori.getIntPraticaId()).getDettPraticaId();
intPraticaId = fineLavori.getIntPraticaId();
} else if (Collaudo.class.getName().equals(className)) {
Collaudo collaudo = CollaudoLocalServiceUtil.getCollaudo(classPk);
@ -358,8 +213,6 @@ public abstract class PagamentiUtil {
} else if (PagamentoConstants.PAGAMENTO_BOLLI.equals(tipoPagamento)) {
pagamentoId = collaudo.getPagamentoId();
}
// dettPraticaId =
// DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(collaudo.getIntPraticaId()).getDettPraticaId();
intPraticaId = collaudo.getIntPraticaId();
} else {
throw new SystemException("error.fields.pratica.pagamento.classPk.invalid");
@ -459,7 +312,7 @@ public abstract class PagamentiUtil {
serviceContext.getUserId(), codice, causale, codiceFiscaleCommittente, tipoPagamento,
importi, iuvs, currentURL, currentURL, provincia);
String urlPagamento = "";
String urlPagamento = StringPool.BLANK;
if (idpOTFType == null) {
urlPagamento = currentURL;
@ -474,11 +327,9 @@ public abstract class PagamentiUtil {
PagamentoConstants.MEZZO_IRIS, codiceFiscaleCommittente, tipoPagamento, importo,
PagamentoConstants.UTILIZZATA_IN_CORSO, classPk, className, 0l, urlPagamento, iuvs,
serviceContext);
// actionResponse.sendRedirect(idpOTFType.getUrlGW().toString());
} else {
return PagamentoLocalServiceUtil.getPagamento(pagamentoId);
}
// }
} else {
boolean add = true;
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 static String protocollaPartenza(Avviso avviso, Long fileEntryId) throws Exception {
String protocollo = null;
InputStream inputStream = null;
try {
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(avviso.getIntPraticaId());
long groupId = avviso.getGroupId();
File allegato = new File();
if (Validator.isNotNull(fileEntryId)) {
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId);
inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(),
fileEntry.getVersion());
String sha256 = DigestUtils.sha256Hex(inputStream);
allegato.setFileId(String.valueOf(fileEntryId));
allegato.setFileSha256(sha256);
} else {
String doc = String.valueOf(avviso.getAvvisoId());
String sha256 = DigestUtils.sha256Hex(doc);
allegato.setFileId("0");
allegato.setFileSha256(sha256);
}
// utilizzato anche come discriminate tra la 1a e la 2a chiamata 1a
// recupero numero protocollo -> 1 allegato finto 2a aggiorno dati
// del documento prodotto -> 2 allegati, il 1o giusto e il 2o per
// recupero num protocollo
// utilizzato anche come discriminate tra la 1a e la 2a chiamata 1a recupero numero protocollo -> 1 allegato
// finto 2a aggiorno dati del documento prodotto -> 2 allegati, il 1o giusto e il 2o per recupero num
// protocollo
Protocollo protocolloBean = new Protocollo();
protocolloBean.setOggetto(generaOggettoProtocollo(avviso.getClassName(), avviso.getAvvisoId()));
protocolloBean.setChiuso(false);
@ -102,15 +88,13 @@ public class ProtocollazioneUtil {
} finally {
StreamUtil.cleanUp(inputStream);
}
return protocollo;
}
public static String protocollaArrivo(Object praticaInstance, String title) throws Exception {
long groupId = 0l;
long praticaId = 0l;
long companyId = 0l;
long groupId = 0L;
long praticaId = 0L;
long companyId = 0L;
String utenteScreenName = StringPool.BLANK;
String className = StringPool.BLANK;
if (praticaInstance instanceof DettPratica) {
@ -122,20 +106,17 @@ public class ProtocollazioneUtil {
className = DettPratica.class.getName();
} else if (praticaInstance instanceof FineLavori) {
groupId = ((FineLavori) praticaInstance).getGroupId();
utenteScreenName = UserLocalServiceUtil.getUser(((FineLavori) praticaInstance).getUserId())
.getScreenName();
utenteScreenName = UserLocalServiceUtil.getUser(((FineLavori) praticaInstance).getUserId()).getScreenName();
praticaId = ((FineLavori) praticaInstance).getFineLavoriId();
companyId = ((FineLavori) praticaInstance).getCompanyId();
className = FineLavori.class.getName();
} else if (praticaInstance instanceof Collaudo) {
groupId = ((Collaudo) praticaInstance).getGroupId();
utenteScreenName = UserLocalServiceUtil.getUser(((Collaudo) praticaInstance).getUserId())
.getScreenName();
utenteScreenName = UserLocalServiceUtil.getUser(((Collaudo) praticaInstance).getUserId()).getScreenName();
praticaId = ((Collaudo) praticaInstance).getCollaudoId();
companyId = ((Collaudo) praticaInstance).getCompanyId();
className = Collaudo.class.getName();
}
List<File> allegati = new ArrayList<File>();
List<DocPratica> docPraticas = DocPraticaLocalServiceUtil.findByClassPk(praticaId);
for (DocPratica docPratica : docPraticas) {
@ -144,11 +125,9 @@ public class ProtocollazioneUtil {
if (Validator.isNull(sha256)) {
InputStream inputStream = null;
try {
if (docPratica.getDlFileEntryId() == 0L) {
FilesImporter.importaFile(docPratica.getDocPraticaId(), DocPratica.class.getName());
}
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(docPratica.getDlFileEntryId());
inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(),
fileEntry.getVersion());
@ -159,12 +138,10 @@ public class ProtocollazioneUtil {
StreamUtil.cleanUp(inputStream);
}
}
allegato.setFileId(String.valueOf(docPratica.getDlFileEntryId()));
allegato.setFileSha256(sha256);
allegati.add(allegato);
}
Protocollo protocolloBean = new Protocollo();
protocolloBean.setOggetto(generaOggettoProtocollo(className, praticaId));
protocolloBean.setChiuso(false);
@ -172,15 +149,13 @@ public class ProtocollazioneUtil {
protocolloBean.setUtenteId(utenteScreenName);
protocolloBean.setUfficioId(String.valueOf(groupId));
protocolloBean.setPraticaId(String.valueOf(praticaId));
protocolloBean.setFiles(allegati);
JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean);
return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero"));
}
public static String protocollaArrivoAccessoAtti(long groupId, long companyId, String userName,
long accessoAttiId, String className) throws Exception {
public static String protocollaArrivoAccessoAtti(long groupId, long companyId, String userName, long accessoAttiId,
String className) throws Exception {
List<File> allegati = new ArrayList<File>();
File allegato = new File();
String doc = String.valueOf(accessoAttiId);
@ -188,7 +163,6 @@ public class ProtocollazioneUtil {
allegato.setFileId("0");
allegato.setFileSha256(sha256);
allegati.add(allegato);
Protocollo protocolloBean = new Protocollo();
protocolloBean.setOggetto(generaOggettoProtocollo(className, accessoAttiId));
protocolloBean.setChiuso(false);
@ -196,14 +170,12 @@ public class ProtocollazioneUtil {
protocolloBean.setUtenteId(userName);
protocolloBean.setUfficioId(String.valueOf(groupId));
protocolloBean.setPraticaId(String.valueOf(accessoAttiId));
protocolloBean.setFiles(allegati);
JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean);
return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero"));
}
public static String generaOggettoProtocollo(String className, long classPk) {
try {
Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(classPk);
if (Validator.isNotNull(avviso)) {
@ -212,113 +184,76 @@ public class ProtocollazioneUtil {
} catch (SystemException | PortalException e) {
e.printStackTrace();
}
return "Oggetto: " + className + " " + classPk;
return "Oggetto: " + className + StringPool.SPACE + classPk;
}
public static List<OggettoProtocollo> csvToOggettoProtocollo(java.io.File file)
throws FileNotFoundException, IOException, ParseException {
public static List<OggettoProtocollo> csvToOggettoProtocollo(java.io.File file) throws FileNotFoundException,
IOException, ParseException {
String[] FILE_PROTOCOLLO_HEADER = { "id", "mittente/destinatario id", "ufficio id", "oggetto",
"numero fascicolo", "data inserimento", "tipo" };
CSVFormat format = CSVFormat.EXCEL.withTrailingDelimiter().withHeader(FILE_PROTOCOLLO_HEADER)
.withSkipHeaderRecord().withIgnoreEmptyLines().withIgnoreSurroundingSpaces();
Iterable<CSVRecord> records = format.parse(new FileReader(file));
List<OggettoProtocollo> listaOggettoProtocollo = new ArrayList<>();
for (CSVRecord csvRecord : records) {
listaOggettoProtocollo.add(new OggettoProtocollo(csvRecord.get("id"), csvRecord
.get("mittente/destinatario id"), csvRecord.get("ufficio id"), csvRecord.get("oggetto"),
csvRecord.get("numero fascicolo"), csvRecord.get("data inserimento"), csvRecord
.get("tipo")));
.get("mittente/destinatario id"), csvRecord.get("ufficio id"), csvRecord.get("oggetto"), csvRecord
.get("numero fascicolo"), csvRecord.get("data inserimento"), csvRecord.get("tipo")));
}
return listaOggettoProtocollo;
}
public static List<OggettoProtocollo> searchProtocolli(HttpServletRequest request, long companyId,
long userId) {
public static List<OggettoProtocollo> searchProtocolli(HttpServletRequest request, long companyId, long userId) {
List<OggettoProtocollo> result = Collections.emptyList();
String ufficioIds = "";
String ufficioIds = StringPool.BLANK;
String anno = ParamUtil.getString(request, "annoRiferimento");
String numeroProtocollo = ParamUtil.getString(request, "numeroProtocollo");
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;
}
try {
if (ufficioId == -1) {
List<Organization> organizationList = OrganizationLocalServiceUtil
.getUserOrganizations(userId);
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(userId);
if (organizationList != null && !organizationList.isEmpty()) {
List<Integer> lista = new ArrayList<Integer>();
for (Organization org : organizationList) {
lista.add(GetterUtil.getInteger(org.getGroupId()));
}
ufficioIds = lista.toString().substring(1, lista.toString().length() - 1);
}
} else {
ufficioIds = "" + ufficioId;
ufficioIds = String.valueOf(ufficioId);
}
ufficioIds = ufficioIds.replaceAll(" ", "");
// String urlCSVService = PortletProps.get("protocollo.cvs.url");
ufficioIds = ufficioIds.replaceAll(StringPool.SPACE, StringPool.BLANK);
String urlCSVService = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId,
ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_EXPORT_URL);
String numeroFascicoloEntity = StringPool.BLANK;
if (Validator.isNotNull(numeroProtocollo)) {
anno = numeroProtocollo.substring(0, 4);
numeroFascicoloEntity = numeroProtocollo.substring(4, numeroProtocollo.length())
.replaceFirst("^0+(?!$)", StringPool.BLANK);
numeroFascicoloEntity = numeroProtocollo.substring(4, numeroProtocollo.length()).replaceFirst(
"^0+(?!$)", StringPool.BLANK);
}
String data = String.format("?anno=%s&ufficioIds=%s&numeroFascicolo=%s", anno, ufficioIds,
numeroFascicoloEntity);
URL url = new URL(urlCSVService + data);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
}
byte[] bytes = IOUtils.toByteArray(conn.getInputStream());
java.io.File tempFile = java.io.File.createTempFile("prefix", "suffix", null);
FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(bytes);
fos.flush();
fos.close();
conn.disconnect();
return ProtocollazioneUtil.csvToOggettoProtocollo(tempFile);
} catch (Exception e) {
}
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.number=2555
build.date=1615540150045
build.number=2565
build.date=1615988331406
build.auto.upgrade=true
##

98
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 import="com.liferay.portal.kernel.search.IndexerRegistryUtil"%>
<%@page import="com.liferay.portal.kernel.search.Document"%>
<%@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.Document"%>
<%@page import="java.util.ArrayList"%>
<%@ include file="/html/gestioneattivita/init.jsp"%>
<%@include file="/html/gestioneattivita/init.jsp"%>
<%
boolean doSearch = true;
PortletURL iteratorURL = liferayPortletResponse.createRenderURL();
//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 committente = ParamUtil.getString(request, "committente", 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 ufficio = ParamUtil.getString(request, "ufficio", StringPool.BLANK);
String ordinaPer = ParamUtil.getString(request, "ordinaPer", StringPool.BLANK);
@ -34,7 +29,6 @@ iteratorURL.setParameter("tipoPratica", tipoPratica);
iteratorURL.setParameter("statoPratica", statoPratica);
iteratorURL.setParameter("committente", committente);
iteratorURL.setParameter("soggettiInterconnessi", soggettiInterconnessi);
//ADT ADT BUG BO ID = 8
iteratorURL.setParameter("istruttore", istruttore);
iteratorURL.setParameter("dataRichiestaInizio", dataRichiestaInizio);
iteratorURL.setParameter("dataRichiestaFine", dataRichiestaFine);
@ -45,8 +39,6 @@ iteratorURL.setParameter("tipoProcedura", tipoProcedura);
iteratorURL.setParameter("ordinaPer", ordinaPer);
iteratorURL.setParameter("ordinaTipo", ordinaTipo);
iteratorURL.setParameter("tabs1", tabs1);
String orderByType = ParamUtil.getString(request, "orderByType", "asc");
String orderByCol = ParamUtil.getString(request, "orderByCol", "nome");
@ -54,80 +46,60 @@ String keywords = StringPool.BLANK;
request.setAttribute("tabs1", "Tab_MieiTask");
%>
<!-- Funzione per esportare la ricerca -->
<%-- Funzione per esportare la ricerca --%>
<liferay-portlet:resourceURL id="exportRicercaMieAttivita" var="exportRicercaMieAttivitaURL">
<liferay-portlet:param name="dataRichiestaInizio" value="<%=dataRichiestaInizio %>"/>
<liferay-portlet:param name="dataRichiestaFine" value="<%=dataRichiestaFine %>"/>
<liferay-portlet:param name="numeroProgetto" value="<%=numeroProgetto %>"/>
<liferay-portlet:param name="protocollo" value="<%=protocollo %>"/>
<liferay-portlet:param name="tipoPratica" value="<%=tipoPratica %>"/>
<liferay-portlet:param name="statoPratica" value="<%=statoPratica %>"/>
<liferay-portlet:param name="committente" value="<%=committente %>"/>
<liferay-portlet:param name="soggettiInterconnessi" value="<%=soggettiInterconnessi %>"/>
<liferay-portlet:param name="istruttore" value="<%=istruttore %>"/>
<liferay-portlet:param name="ufficio" value="<%=ufficio %>"/>
<liferay-portlet:param name="comune" value="<%=comuneSearch %>"/>
<liferay-portlet:param name="tipoAttivita" value="<%=tipoAttivita %>"/>
<liferay-portlet:param name="tipoProcedura" value="<%=tipoProcedura %>"/>
<liferay-portlet:param name="ordinaPer" value="<%=ordinaPer %>"/>
<liferay-portlet:param name="ordinaTipo" value="<%=ordinaTipo %>"/>
<liferay-portlet:param name="searchForExport" value="true"/>
<liferay-portlet:param name="cmd" value="exportRicercaMieAttivita"/>
<liferay-portlet:param name="dataRichiestaInizio" value="<%= dataRichiestaInizio %>" />
<liferay-portlet:param name="dataRichiestaFine" value="<%= dataRichiestaFine %>" />
<liferay-portlet:param name="numeroProgetto" value="<%= numeroProgetto %>" />
<liferay-portlet:param name="protocollo" value="<%= protocollo %>" />
<liferay-portlet:param name="tipoPratica" value="<%= tipoPratica %>" />
<liferay-portlet:param name="statoPratica" value="<%= statoPratica %>" />
<liferay-portlet:param name="committente" value="<%= committente %>" />
<liferay-portlet:param name="soggettiInterconnessi" value="<%= soggettiInterconnessi %>" />
<liferay-portlet:param name="istruttore" value="<%= istruttore %>" />
<liferay-portlet:param name="ufficio" value="<%= ufficio %>" />
<liferay-portlet:param name="comune" value="<%= comuneSearch %>" />
<liferay-portlet:param name="tipoAttivita" value="<%= tipoAttivita %>" />
<liferay-portlet:param name="tipoProcedura" value="<%= tipoProcedura %>" />
<liferay-portlet:param name="ordinaPer" value="<%= ordinaPer %>" />
<liferay-portlet:param name="ordinaTipo" value="<%= ordinaTipo %>" />
<liferay-portlet:param name="searchForExport" value="true" />
<liferay-portlet:param name="cmd" value="exportRicercaMieAttivita" />
</liferay-portlet:resourceURL>
<div class="row-fluid" style="margin-top:10px;">
<div class="span10"></div>
<div class="span2">
<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>
</div>
</div>
<liferay-ui:search-container
emptyResultsMessage="no-entries-were-found"
iteratorURL="<%= iteratorURL %>"
orderByType="<%= orderByType %>" orderByCol="<%= orderByCol %>"
>
<liferay-ui:search-container emptyResultsMessage="no-entries-were-found" iteratorURL="<%= iteratorURL %>"
orderByType="<%= orderByType %>" orderByCol="<%= orderByCol %>">
<%
List<ControlloPratica> listaControlloPratica = new ArrayList<ControlloPratica>();
Hits hits = ControlloPraticaAdvancedSearch.searchMieiTask(request, user, searchContainer.getStart(), searchContainer.getEnd());
Hits hits = ControlloPraticaAdvancedSearch.searchMieiTask(request, user, searchContainer.getStart(),
searchContainer.getEnd());
for (Document doc : hits.toList()) {
String controlloPraticaId = doc.get("controlloPraticaId");
if (Validator.isNotNull(controlloPraticaId)) {
ControlloPratica controlloPratica =
ControlloPraticaLocalServiceUtil.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId));
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.fetchControlloPratica(
GetterUtil.getLong(controlloPraticaId));
if (Validator.isNotNull(controlloPratica)) {
listaControlloPratica.add(controlloPratica);
}else{
} else {
Indexer indexer = IndexerRegistryUtil.getIndexer(IntPratica.class);
indexer.delete(company.getCompanyId(), doc.getUID());
}
}
}
searchContainer.setTotal(hits.getLength());
%>
<liferay-ui:search-container-results
results="<%=listaControlloPratica%>"
/>
<liferay-ui:search-container-row
className="it.tref.liferay.portos.bo.model.ControlloPratica"
modelVar="controlloPratica"
>
<%@ include file="/html/gestioneattivita/view_columns.jspf" %>
<liferay-ui:search-container-results results="<%= listaControlloPratica %>" />
<liferay-ui:search-container-row className="it.tref.liferay.portos.bo.model.ControlloPratica"
modelVar="controlloPratica">
<%@include file="/html/gestioneattivita/view_columns.jspf"%>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator paginate="<%= true %>" />
<liferay-ui:search-iterator paginate="true" />
</liferay-ui:search-container>

102
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 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.Hits"%>
<%@page import="com.liferay.portal.kernel.search.Indexer"%>
<%@page import="com.liferay.portal.kernel.search.IndexerRegistryUtil"%>
<%@page import="java.util.ArrayList"%>
<%@ include file="/html/gestioneattivita/init.jsp" %>
<%@include file="/html/gestioneattivita/init.jsp"%>
<%
boolean doSearch = true;
PortletURL iteratorURL = liferayPortletResponse.createRenderURL();
//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 committente = ParamUtil.getString(request, "committente", 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 ufficio = ParamUtil.getString(request, "ufficio", StringPool.BLANK);
String ordinaPer = ParamUtil.getString(request, "ordinaPer", StringPool.BLANK);
@ -33,7 +29,6 @@ iteratorURL.setParameter("tipoPratica", tipoPratica);
iteratorURL.setParameter("statoPratica", statoPratica);
iteratorURL.setParameter("committente", committente);
iteratorURL.setParameter("soggettiInterconnessi", soggettiInterconnessi);
//ADT ADT BUG BO ID = 8
iteratorURL.setParameter("istruttore", istruttore);
iteratorURL.setParameter("dataRichiestaInizio", dataRichiestaInizio);
iteratorURL.setParameter("dataRichiestaFine", dataRichiestaFine);
@ -44,92 +39,67 @@ iteratorURL.setParameter("tipoProcedura", tipoProcedura);
iteratorURL.setParameter("ordinaPer", ordinaPer);
iteratorURL.setParameter("ordinaTipo", ordinaTipo);
iteratorURL.setParameter("tabs1", tabs1);
String orderByType = ParamUtil.getString(request, "orderByType", "asc");
String orderByCol = ParamUtil.getString(request, "orderByCol", "nome");
String keywords = StringPool.BLANK;
request.setAttribute("tabs1", "Tab_TaskMieiRuoli");
%>
<!-- Funzione per esportare la ricerca -->
<%-- Funzione per esportare la ricerca --%>
<liferay-portlet:resourceURL id="exportRicercaMieiRuoli" var="exportRicercaMieiRuoliURL">
<liferay-portlet:param name="dataRichiestaInizio" value="<%=dataRichiestaInizio %>"/>
<liferay-portlet:param name="dataRichiestaFine" value="<%=dataRichiestaFine %>"/>
<liferay-portlet:param name="numeroProgetto" value="<%=numeroProgetto %>"/>
<liferay-portlet:param name="protocollo" value="<%=protocollo %>"/>
<liferay-portlet:param name="tipoPratica" value="<%=tipoPratica %>"/>
<liferay-portlet:param name="statoPratica" value="<%=statoPratica %>"/>
<liferay-portlet:param name="committente" value="<%=committente %>"/>
<liferay-portlet:param name="soggettiInterconnessi" value="<%=soggettiInterconnessi %>"/>
<!-- ADT BUG BO ID = 8 -->
<liferay-portlet:param name="istruttore" value="<%=istruttore %>"/>
<liferay-portlet:param name="ufficio" value="<%=ufficio %>"/>
<liferay-portlet:param name="comune" value="<%=comuneSearch %>"/>
<liferay-portlet:param name="tipoAttivita" value="<%=tipoAttivita %>"/>
<liferay-portlet:param name="tipoProcedura" value="<%=tipoProcedura %>"/>
<liferay-portlet:param name="ordinaPer" value="<%=ordinaPer %>"/>
<liferay-portlet:param name="ordinaTipo" value="<%=ordinaTipo %>"/>
<liferay-portlet:param name="searchForExport" value="true"/>
<liferay-portlet:param name="cmd" value="exportRicercaMieiRuoli"/>
<liferay-portlet:param name="dataRichiestaInizio" value="<%= dataRichiestaInizio %>" />
<liferay-portlet:param name="dataRichiestaFine" value="<%= dataRichiestaFine %>" />
<liferay-portlet:param name="numeroProgetto" value="<%= numeroProgetto %>" />
<liferay-portlet:param name="protocollo" value="<%= protocollo %>" />
<liferay-portlet:param name="tipoPratica" value="<%= tipoPratica %>" />
<liferay-portlet:param name="statoPratica" value="<%= statoPratica %>" />
<liferay-portlet:param name="committente" value="<%= committente %>" />
<liferay-portlet:param name="soggettiInterconnessi" value="<%= soggettiInterconnessi %>" />
<liferay-portlet:param name="istruttore" value="<%= istruttore %>" />
<liferay-portlet:param name="ufficio" value="<%= ufficio %>" />
<liferay-portlet:param name="comune" value="<%= comuneSearch %>" />
<liferay-portlet:param name="tipoAttivita" value="<%= tipoAttivita %>" />
<liferay-portlet:param name="tipoProcedura" value="<%= tipoProcedura %>" />
<liferay-portlet:param name="ordinaPer" value="<%= ordinaPer %>" />
<liferay-portlet:param name="ordinaTipo" value="<%= ordinaTipo %>" />
<liferay-portlet:param name="searchForExport" value="true" />
<liferay-portlet:param name="cmd" value="exportRicercaMieiRuoli" />
</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="span2">
<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>
</div>
</div>
<liferay-ui:search-container
emptyResultsMessage="no-entries-were-found"
iteratorURL="<%= iteratorURL %>"
orderByType="<%= orderByType %>" orderByCol="<%= orderByCol %>"
>
<liferay-ui:search-container emptyResultsMessage="no-entries-were-found" iteratorURL="<%= iteratorURL %>"
orderByType="<%= orderByType %>" orderByCol="<%= orderByCol %>">
<%
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()) {
String controlloPraticaId = doc.get("controlloPraticaId");
if (Validator.isNotNull(controlloPraticaId)) {
ControlloPratica controlloPratica =
ControlloPraticaLocalServiceUtil.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId));
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.fetchControlloPratica(
GetterUtil.getLong(controlloPraticaId));
if (Validator.isNotNull(controlloPratica)) {
listaControlloPratica.add(controlloPratica);
}else{
} else {
Indexer indexer = IndexerRegistryUtil.getIndexer(IntPratica.class);
indexer.delete(company.getCompanyId(), doc.getUID());
}
}
}
searchContainer.setTotal(hits.getLength());
%>
<liferay-ui:search-container-results
results="<%=listaControlloPratica%>"
/>
<liferay-ui:search-container-row
className="it.tref.liferay.portos.bo.model.ControlloPratica"
modelVar="controlloPratica"
>
<%@ include file="/html/gestioneattivita/view_columns.jspf" %>
<liferay-ui:search-container-results results="<%= listaControlloPratica %>" />
<liferay-ui:search-container-row className="it.tref.liferay.portos.bo.model.ControlloPratica"
modelVar="controlloPratica">
<%@include file="/html/gestioneattivita/view_columns.jspf"%>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator paginate="<%= true %>" />
<liferay-ui:search-iterator paginate="true" />
</liferay-ui:search-container>

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

@ -1,174 +1,136 @@
<%@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.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.dao.orm.QueryUtil"%>
<%@page import="com.liferay.portal.kernel.language.LanguageUtil"%>
<%@page import="com.liferay.portal.kernel.util.StringPool"%>
<%@page import="it.tref.liferay.portos.bo.util.WorkflowUtil"%>
<%@page import="it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.service.impl.DettPraticaLocalServiceImpl"%>
<%@page import="it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil"%>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
<%@page import="com.liferay.portal.kernel.util.Validator"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowConstants"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowInstance"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil"%>
<%@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="java.util.concurrent.TimeUnit"%>
<%@page import="java.util.Date"%>
<%@page import="it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.model.Provincia"%>
<%@page import="it.tref.liferay.portos.bo.service.ComuneLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.WorkflowInstanceLink"%>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
<%@page import="com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil"%>
<%@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.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.model.IntPratica"%>
<%@page import="com.liferay.portal.kernel.dao.orm.QueryUtil"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTask"%>
<%@page import="it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil"%>
<%@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="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;
//ADT - BUG-12 Aggiunta colonna Data Esito
String currentTab = (String)request.getAttribute("tabs1");
%>
<%
String rowUrl = StringPool.BLANK;
String currentTab = (String)request.getAttribute("tabs1");
//Informazioni relative alla pratica
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(controlloPratica.getIntPraticaId());
DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica.getIntPraticaId());
%>
<c:if test="<%= Validator.isNotNull(intPratica) %>">
<%
ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(controlloPratica.getControlloPraticaId());
Territorio territorio = TerritorioLocalServiceUtil.fetchTerritorio(intPratica.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.fetchComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), territorio.getCodiceProvincia());
if(controlloPratica.getStatus() == 0 || controlloPratica.getStatus() == 4 || controlloPratica.getStatus() == 6){
}
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(),
territorio.getCodiceProvincia());
//Informazioni relative al workflow
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink(
controlloPratica.getCompanyId(), controlloPratica.getGroupId(), ControlloPratica.class.getName(),
controlloPratica.getPrimaryKey());
List<WorkflowTask> listaTask = null;
WorkflowInstance workflowInstance = null;
if (workflowInstanceLink != null) {
long workflowInstanceId = workflowInstanceLink.getWorkflowInstanceId();
workflowInstance =
WorkflowInstanceManagerUtil.getWorkflowInstance(controlloPratica.getCompanyId(), workflowInstanceId);
workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(controlloPratica.getCompanyId(),
workflowInstanceId);
listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(controlloPratica.getCompanyId(), null,
workflowInstance.getWorkflowInstanceId(), false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
WorkflowTask task = null;
if(listaTask != null && !listaTask.isEmpty()){
if (listaTask != null && !listaTask.isEmpty()) {
task = listaTask.get(0);
}
%>
<liferay-ui:search-container-column-text name="taskName">
<%
String taskName = StringPool.BLANK;
if(task!=null){
if (task!=null) {
User userTask = UserLocalServiceUtil.fetchUser(task.getAssigneeUserId());
taskName = LanguageUtil.get(pageContext,task.getName());
if(userTask!=null){
taskName += " ("+userTask.getFullName()+")";
if (userTask != null) {
taskName += " (" + userTask.getFullName() + ")";
}
}else if (workflowInstance != null){
} else if (workflowInstance != null) {
taskName = LanguageUtil.get(pageContext, workflowInstance.getState());
}
if(lastDettPratica != null){
if (lastDettPratica != null) {
if (lastDettPratica.getTipoIntegrazione() != null) {
//BUG BO ID=14: NOME TASK SEZIONE ATTIVITA'
if(lastDettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE)){
taskName = taskName + " - Integrazione #" + (lastDettPratica.getIntegrazione());
} else if(lastDettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIANTE)){
taskName = taskName + " - Variante #" + (lastDettPratica.getVarianteNumero());
if (lastDettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE)) {
taskName = taskName + " - Integrazione #" + lastDettPratica.getIntegrazione();
} else if (lastDettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIANTE)) {
taskName = taskName + " - Variante #" + lastDettPratica.getVarianteNumero();
}
}
}
out.print(taskName);
%>
</liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="Esito">
<%
String tipoEsito = ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica.getControlloPraticaId());
out.print(tipoEsito);
%>
<%= ControlloPraticaLocalServiceUtil.getTipoEsito(controlloPratica.getControlloPraticaId()) %>
</liferay-ui:search-container-column-text>
<%-- ADT - BUG-12 Aggiunta colonna Data Esito --%>
<%-- Bug 33264 --%>
<c:if test='<%= "Tab_TaskCompletati".equals(currentTab) %>'>
<liferay-ui:search-container-column-text name="Data Esito" value='<%=
controlloPratica.getStatusDate()!=null ? dateFormatDate.format(controlloPratica.getStatusDate()): "" %>' >
<liferay-ui:search-container-column-text name="Data Esito" value='<%= controlloPratica.getStatusDate() != null ?
dateFormatDate.format(controlloPratica.getStatusDate()) : StringPool.BLANK %>' >
</liferay-ui:search-container-column-text>
</c:if>
<liferay-ui:search-container-column-text name="Sorteggiata">
<%
boolean sorteggiata = SorteggioLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId())!=null;
String clazz = StringPool.BLANK;
if(sorteggiata){
boolean sorteggiata = SorteggioLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()) != null;
if (sorteggiata) {
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 name="Pratica">
<%
if(lastDettPratica != null){
if (lastDettPratica != null) {
long lastDettPraticaId = lastDettPratica.getDettPraticaId();
if(lastDettPraticaId != controlloPratica.getDettPraticaId()){
String messageLabel = LanguageUtil.get(pageContext, "sono-presenti-aggiornamenti-fuori-dal-controllo-obbligatorio");
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");
if (lastDettPraticaId != controlloPratica.getDettPraticaId()) {
String messageLabel = LanguageUtil.get(pageContext,
"sono-presenti-aggiornamenti-fuori-dal-controllo-obbligatorio");
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">
<i class="fa fa-exclamation-triangle txt-orange"></i>
<%=messageLabel %>
<%= messageLabel %>
</span>
<%
}
}
%>
<%= intPratica.getTitle(locale, true) %>
<%= Validator.isNull(intPratica.getTipoProcedura()) ?
"" :
<%= Validator.isNull(intPratica.getTipoProcedura()) ? StringPool.BLANK :
"<br><small>Procedura " + intPratica.getTipoProcedura() + "</small>" %>
</liferay-ui:search-container-column-text>
<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());
if (tecnico != null) {
@ -178,41 +140,38 @@ DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntP
}
%>
</c:if>
<c:if test="<%=intPratica.getStatusByUserId()==0l %>">
<c:if test="<%= intPratica.getStatusByUserId() == 0L %>">
-
</c:if>
</liferay-ui:search-container-column-text>
<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 %>">
<%
User approvatore = UserLocalServiceUtil.fetchUser(workflowTask.getAssigneeUserId());
if(approvatore!=null){
if (approvatore!=null) {
out.print(approvatore.getFullName());
}else{
if(workflowTask.getAssigneeUserId()==-1){
} else {
if (workflowTask.getAssigneeUserId() == -1) {
out.print( " [Portos 1]");
} else {
out.print( " ["+workflowTask.getAssigneeUserId()+"]");
out.print( " [" + workflowTask.getAssigneeUserId() + "]");
}
}
out.print(" ("+workflowTask.getName()+")");
out.print(" (" + workflowTask.getName() + ")");
%>
</c:if>
<c:if test="<%=workflowTask==null%>">
<c:if test="<%= workflowTask == null %>">
-
</c:if>
</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="provincia" >
<%= provincia.getProvincia() + " - " + comune.getDenominazione() %>
</liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="GG*" cssClass="text-center">
<%
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-jsp path="/html/gestioneattivita/action_button.jsp" align="right" cssClass="text-center"/>
</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;
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.DettPratica;
import it.tref.liferay.portos.bo.model.DocPratica;
@ -58,32 +31,52 @@ import javax.portlet.PortletException;
import javax.portlet.ResourceRequest;
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 {
private static Log _log = LogFactoryUtil.getLog(SoggettiPraticaPortlet.class);
public void deleteSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
SoggettoServiceUtil.deleteSoggetto(soggettoId);
} catch (PortalException | SystemException e) {
_log.error(e, e);
throw e;
}
}
public void invalidaSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
long dettPraticaIdRimozione = ParamUtil.getLong(actionRequest, "dettPraticaId");
SoggettoLocalServiceUtil.invalidaSoggetto(soggettoId, dettPraticaIdRimozione);
} catch (PortalException | SystemException e) {
_log.error(e, e);
throw e;
@ -91,13 +84,10 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
}
public void validaSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
SoggettoLocalServiceUtil.validaSoggetto(soggettoId, dettPraticaId);
} catch (PortalException | SystemException e) {
_log.error(e, e);
throw e;
@ -105,14 +95,12 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
}
public void makePrincipale(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
Soggetto soggetto = SoggettoServiceUtil.getSoggetto(soggettoId);
SoggettoServiceUtil.updatePrincipale(dettPraticaId, soggetto.getCodiceFiscale(),
soggetto.getTipologiaSoggetto());
} catch (PortalException | SystemException e) {
_log.error(e, e);
throw e;
@ -120,318 +108,20 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
}
public void removePrincipale(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
try {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
Soggetto soggetto = SoggettoServiceUtil.getSoggetto(soggettoId);
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
DettPraticaServiceUtil.updatePrincipale(dettPraticaId, StringPool.BLANK,
soggetto.getTipologiaSoggetto());
DettPraticaServiceUtil.updatePrincipale(dettPraticaId, StringPool.BLANK, soggetto.getTipologiaSoggetto());
} catch (PortalException | SystemException e) {
_log.error(e, 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 {
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");
@ -443,7 +133,6 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
} else {
codiceFiscale = ParamUtil.getString(actionRequest, "codiceFiscalePersone");
}
String codiceFiscaleDelegato = ParamUtil.getString(actionRequest, "codiceFiscaleDelegato");
Date dataNascita = ParamUtil.getDate(actionRequest, "dataNascita",
DateFormatFactoryUtil.getDate(actionRequest.getLocale()));
@ -474,22 +163,18 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
String capRap = ParamUtil.getString(actionRequest, "capRap");
String provinciaRap = ParamUtil.getString(actionRequest, "provinciaRap");
String comuneRap = ParamUtil.getString(actionRequest, "comuneRap");
String comuneRapEstero = ParamUtil.getString(actionRequest, "comuneRapEstero");
String albo = ParamUtil.getString(actionRequest, "albo");
String alboDescr = ParamUtil.getString(actionRequest, "alboDescr");
String regAlbo = ParamUtil.getString(actionRequest, "regAlbo");
String provinciaAlbo = ParamUtil.getString(actionRequest, "provinciaAlbo");
String numIscrAlbo = ParamUtil.getString(actionRequest, "numIscrAlbo");
String fax = ParamUtil.getString(actionRequest, "fax");
String telefonoResidenza = ParamUtil.getString(actionRequest, "telefonoResidenza");
String telefono = Validator.isNotNull(telefonoResidenza) ? telefonoResidenza : ParamUtil.getString(
actionRequest, "telefonoGiuridico");
String emailResidenza = ParamUtil.getString(actionRequest, "emailResidenza");
String email = Validator.isNotNull(emailResidenza) ? emailResidenza : ParamUtil.getString(
actionRequest, "emailGiuridica");
String email = Validator.isNotNull(emailResidenza) ? emailResidenza : ParamUtil.getString(actionRequest,
"emailGiuridica");
boolean aggiuntivo = ParamUtil.getBoolean(actionRequest, "aggiuntivo");
boolean rimosso = ParamUtil.getBoolean(actionRequest, "rimosso");
String ambitoAttivita = ParamUtil.getString(actionRequest, "ambitoAttivita");
@ -499,110 +184,82 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
: ambitoProfessioneAltro;
long intPraticaIdRimozione = ParamUtil.getLong(actionRequest, "intPraticaIdRimozione");
long dettPraticaIdRimozione = ParamUtil.getLong(actionRequest, "dettPraticaIdRimozione");
// Date dtDataRimozione =
// ParamUtil.getDate(actionRequest, "dtDataRimozione",
// DateFormatFactoryUtil.getDate(actionRequest.getLocale());
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);
try {
actionResponse.setRenderParameter("mvcPath", "html/soggettipratica/edit_soggetto.jsp");
boolean tmp = false;
if (requiredDoc) {
tmp = true;
}
Soggetto soggetto = null;
if (soggettoId == 0) {
soggetto = SoggettoServiceUtil.addSoggetto(userId, dettPraticaId, intPraticaId, nome,
cognome, codiceFiscale, codiceFiscaleDelegato, dataNascita, provinciaNascita,
comuneNascita, comuneDomicilio, comuneDomicilioEstero, provinciaDomicilio,
viaDomicilio, numeroCivicoDomicilio, capDomicilio, domicilioExtra, comune,
comuneEstero, provincia, via, numeroCivico, cap, denominazione, sedeLegale,
legaleRap, dataNascitaRap, provinciaNascitaRap, comuneNascitaRap, viaRap,
numeroCivicoRap, capRap, provinciaRap, comuneRap, comuneEstero, albo, alboDescr,
regAlbo, provinciaAlbo, numIscrAlbo, telefono, fax, email, tipologiaSoggetto,
soggetto = SoggettoServiceUtil.addSoggetto(userId, dettPraticaId, intPraticaId, nome, cognome,
codiceFiscale, codiceFiscaleDelegato, dataNascita, provinciaNascita, comuneNascita,
comuneDomicilio, comuneDomicilioEstero, provinciaDomicilio, viaDomicilio,
numeroCivicoDomicilio, capDomicilio, domicilioExtra, comune, comuneEstero, provincia, via,
numeroCivico, cap, denominazione, sedeLegale, legaleRap, dataNascitaRap, provinciaNascitaRap,
comuneNascitaRap, viaRap, numeroCivicoRap, capRap, provinciaRap, comuneRap, comuneEstero, albo,
alboDescr, regAlbo, provinciaAlbo, numIscrAlbo, telefono, fax, email, tipologiaSoggetto,
aggiuntivo, rimosso, ambitoAttivita, ambitoProfessione, intPraticaIdRimozione,
dettPraticaIdRimozione, null, soggettoSostituitoId, 0L, tmp, serviceContext);
} else {
soggetto = SoggettoServiceUtil.updateSoggetto(userId, soggettoId, dettPraticaId,
intPraticaId, nome, cognome, codiceFiscale, codiceFiscaleDelegato, dataNascita,
provinciaNascita, comuneNascita, comuneDomicilio, comuneDomicilioEstero,
provinciaDomicilio, viaDomicilio, numeroCivicoDomicilio, capDomicilio,
domicilioExtra, comune, comuneEstero, provincia, via, numeroCivico, cap,
denominazione, sedeLegale, legaleRap, dataNascitaRap, provinciaNascitaRap,
comuneNascitaRap, viaRap, numeroCivicoRap, capRap, provinciaRap, comuneRap,
comuneEstero, albo, alboDescr, regAlbo, provinciaAlbo, numIscrAlbo, telefono, fax,
email, tipologiaSoggetto, aggiuntivo, rimosso, ambitoAttivita, ambitoProfessione,
intPraticaIdRimozione, dettPraticaIdRimozione, null, soggettoSostituitoId, 0L, tmp,
serviceContext);
soggetto = SoggettoServiceUtil.updateSoggetto(userId, soggettoId, dettPraticaId, intPraticaId, nome,
cognome, codiceFiscale, codiceFiscaleDelegato, dataNascita, provinciaNascita, comuneNascita,
comuneDomicilio, comuneDomicilioEstero, provinciaDomicilio, viaDomicilio,
numeroCivicoDomicilio, capDomicilio, domicilioExtra, comune, comuneEstero, provincia, via,
numeroCivico, cap, denominazione, sedeLegale, legaleRap, dataNascitaRap, provinciaNascitaRap,
comuneNascitaRap, viaRap, numeroCivicoRap, capRap, provinciaRap, comuneRap, comuneEstero, albo,
alboDescr, regAlbo, provinciaAlbo, numIscrAlbo, telefono, fax, email, tipologiaSoggetto,
aggiuntivo, rimosso, ambitoAttivita, ambitoProfessione, intPraticaIdRimozione,
dettPraticaIdRimozione, null, soggettoSostituitoId, 0L, tmp, serviceContext);
}
PortalUtil.copyRequestParameters(actionRequest, actionResponse);
actionResponse.setRenderParameter("soggettoId", String.valueOf(soggetto.getSoggettoId()));
actionResponse.setRenderParameter("closePopup", String.valueOf(true));
} catch (PortalException e) {
_log.error(e, e);
throw e;
}
}
public void updateAllegatoSoggetto(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
public void updateAllegatoSoggetto(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long soggettoId = ParamUtil.getLong(actionRequest, "soggettoId");
Soggetto soggetto = SoggettoLocalServiceUtil.getSoggetto(soggettoId);
long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId");
DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(dettPraticaId);
long intPraticaId = dettPratica.getIntPraticaId();
ServiceContext serviceContext = ServiceContextFactory.getInstance(Soggetto.class.getName(),
actionRequest);
ServiceContext serviceContext = ServiceContextFactory.getInstance(Soggetto.class.getName(), actionRequest);
String sourceFileName = StringPool.BLANK;
byte[] content = null;
String jsonFirmatari = "";
String jsonFirmatari = StringPool.BLANK;
boolean isSigned = false;
boolean applicaFirma = ParamUtil.getBoolean(actionRequest, "applicaFirma");
try {
FirmeBean firmeBean = new FirmeBean();
if (Validator.isNotNull(soggetto.getFileVariazioneId())) {
DocPratica fileAllegato = DocPraticaLocalServiceUtil.getDocPratica(soggetto
.getFileVariazioneId());
DocPratica fileAllegato = DocPraticaLocalServiceUtil.getDocPratica(soggetto.getFileVariazioneId());
sourceFileName = fileAllegato.getFileName();
FileEntry attachment = DocPraticaLocalServiceUtil.getAttachment(soggetto
.getFileVariazioneId());
// content = IOUtils.toByteArray(attachment.getContentStream());
FileEntry attachment = DocPraticaLocalServiceUtil.getAttachment(soggetto.getFileVariazioneId());
content = FileUtil.getBytes(attachment.getContentStream());
firmeBean = FirmeUtil.deserialize(fileAllegato.getJsonFirmatari());
}
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
sourceFileName = uploadRequest.getFileName("docFile");
File file = uploadRequest.getFile("docFile");
User user = UserLocalServiceUtil.getUser(serviceContext.getUserId());
if (applicaFirma && !firmeBean.allSignatures().contains(user.getScreenName())) {
jsonFirmatari = FirmeUtil.addFirma(firmeBean, user.getScreenName());
} else {
jsonFirmatari = FirmeUtil.serialize(firmeBean);
}
if (file.exists()) {
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");
SessionErrors.add(actionRequest, "error.geniocivilefe.variazione-soggetto.allegato.ext.valid");
}
// lunghezza fissata a 200
if (sourceFileName.length() > 200) {
@ -610,28 +267,19 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
"error.geniocivilefe.variazione-soggetto.allegato.length.valid");
}
} else if (!TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(soggetto.getTipologiaSoggetto())) {
SessionErrors.add(actionRequest,
"error.geniocivilefe.variazione-soggetto.allegato.is.request");
SessionErrors.add(actionRequest, "error.geniocivilefe.variazione-soggetto.allegato.is.request");
}
if (!SessionErrors.isEmpty(actionRequest)) {
throw new SystemException("error.geniocivilefe.variazione-soggetto.allegato");
} else if (file != null) {
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.
// 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(soggetto.getTipologiaSoggetto())) {
String[] titolare = new String[] { dettPratica.getCodiceFiscaleDelegatoCommittente() };
isSigned = ValidazionePraticaUtil.isAllegatoSignedBySubjects(sourceFileName, content,
@ -645,11 +293,9 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
codiciFiscaliValidi.add(valido.getCodiceFiscale());
}
}
isSigned = ValidazionePraticaUtil.isAllegatoSignedBySubjectsAndPerson(sourceFileName,
content, serviceContext.getCompanyId(), codiciFiscaliValidi,
soggetto.getCodiceFiscale(), jsonFirmatari);
isSigned = ValidazionePraticaUtil.isAllegatoSignedBySubjectsAndPerson(sourceFileName, content,
serviceContext.getCompanyId(), codiciFiscaliValidi, soggetto.getCodiceFiscale(), jsonFirmatari);
}
if (!isSigned) {
if (TipoSoggettoUtil.COMMITTENTE.equals(soggetto.getTipologiaSoggetto())) {
SessionErrors.add(actionRequest,
@ -657,31 +303,24 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
throw new SystemException(
"error.geniocivilefe.variazione-soggetto.add.file.non.firmato.committente");
} else {
SessionErrors.add(actionRequest,
"error.geniocivilefe.variazione-soggetto.add.file.non.firmato");
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");
actionResponse.sendRedirect(redirectURL);
return;
}
long userId = PortalUtil.getUserId(actionRequest);
try {
SoggettoServiceUtil.allegaFileModifica(soggettoId, userId, intPraticaId, content, sourceFileName,
jsonFirmatari, serviceContext);
String successUrl = ParamUtil.getString(actionRequest, "successUrl");
successUrl = HttpUtil.addParameter(successUrl, actionResponse.getNamespace() + "closePopup",
String.valueOf(applicaFirma));
actionResponse.sendRedirect(successUrl);
} catch (PortalException e) {
_log.error(e, e);
throw e;
@ -689,24 +328,22 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
}
@Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
throws IOException, PortletException {
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
PortletException {
String id = resourceRequest.getResourceID();
try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(resourceRequest);
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 tipologiaSoggetto = ParamUtil.getString(resourceRequest, "tipologiaSoggetto");
JSONArray jsonSoggetti = JSONFactoryUtil.createJSONArray();
if (Validator.isNotNull(userId) && Validator.isNotNull(codiceFiscale)
&& Validator.isNotNull(tipologiaSoggetto)) {
OrderByComparator orderByComparator = OrderByComparatorFactoryUtil.create(
"portos_bo_soggetto", "createDate", false);
List<Soggetto> soggetti = SoggettoLocalServiceUtil
.findByUserId_CodiceFiscale_TipologiaSoggetto(userId, codiceFiscale,
tipologiaSoggetto, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
OrderByComparator orderByComparator = OrderByComparatorFactoryUtil.create("portos_bo_soggetto",
"createDate", false);
List<Soggetto> soggetti = SoggettoLocalServiceUtil.findByUserId_CodiceFiscale_TipologiaSoggetto(
userId, codiceFiscale, tipologiaSoggetto, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
orderByComparator);
if (soggetti.isEmpty()) {
soggetti = SoggettoLocalServiceUtil.findByUserId_CodiceFiscale(userId, codiceFiscale,
@ -720,36 +357,28 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
}
}
writeJSON(resourceRequest, resourceResponse, jsonSoggetti);
} else if ("province".equals(id)) {
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
List<Provincia> province = ProvinciaLocalServiceUtil.findAll(QueryUtil.ALL_POS,
QueryUtil.ALL_POS,
List<Provincia> province = ProvinciaLocalServiceUtil.findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS,
OrderByComparatorFactoryUtil.create("portos_bo_Provincia", "provincia", true));
for (Provincia provincia : province) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("provinciaId", provincia.getCodiceProvincia());
jsonObject.put("descLong", provincia.getSigla() + "- " + provincia.getProvincia());
jsonArray.put(jsonObject);
}
writeJSON(resourceRequest, resourceResponse, jsonArray);
} else if ("comuni".equals(id)) {
String codiceProvincia = ParamUtil.getString(resourceRequest, "provinciaId");
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
if (Validator.isNotNull(codiceProvincia) && Validator.isNotNull(codiceProvincia)) {
List<Comune> comuni = ComuneLocalServiceUtil.findByCompanyIdCodiceProvincia(
serviceContext.getCompanyId(), codiceProvincia, QueryUtil.ALL_POS,
QueryUtil.ALL_POS,
serviceContext.getCompanyId(), codiceProvincia, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
OrderByComparatorFactoryUtil.create("portos_bo_Comune", "denominazione", true));
for (Comune comune : comuni) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("comuneId", comune.getComuneId());
jsonObject.put("descLong", comune.getDenominazione());
jsonArray.put(jsonObject);
}
}
@ -762,5 +391,4 @@ public class SoggettiPraticaPortlet extends MVCPortlet {
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 inBO = ParamUtil.getBoolean(request, "inBO");
%>
<liferay-portlet:renderURL var="redirectErrorURL">
<liferay-portlet:param name="mvcPath" value="/html/soggettipratica/edit_soggetto.jsp" />
<liferay-portlet:param name="dettPraticaId" value="<%= String.valueOf(dettPraticaId) %>" />
@ -133,7 +132,7 @@ boolean inBO = ParamUtil.getBoolean(request, "inBO");
Soggetto sogg = soggetti.get(0);
tooltipTile.append("<li>")
.append(sogg.getNome())
.append(StringPool.BLANK)
.append(StringPool.SPACE)
.append(sogg.getCognome());
}
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;
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.InputStream;
import java.util.Date;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.DefaultHttpClient;
import com.fasterxml.jackson.databind.ObjectMapper;
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 {
private static final Log _log = LogFactoryUtil.getLog(FirmaUtil.class);
@ -33,8 +32,8 @@ public class FirmaUtil {
String preferencesXML;
javax.portlet.PortletPreferences jxPortletPreferences = null;
try {
pr = PortletPreferencesLocalServiceUtil.getPortletPreferences(
PortletKeys.PREFS_OWNER_TYPE_COMPANY, 0, "firma_WAR_portosfirmaportlet");
pr = PortletPreferencesLocalServiceUtil.getPortletPreferences(PortletKeys.PREFS_OWNER_TYPE_COMPANY, 0,
"firma_WAR_portosfirmaportlet");
preferencesXML = pr.get(0).getPreferences();
jxPortletPreferences = PortletPreferencesFactoryUtil.fromDefaultXML(preferencesXML);
} catch (SystemException e) {
@ -45,44 +44,30 @@ public class FirmaUtil {
}
public static List<String> getCodiceFiscale(byte[] fileArray, String urlPdfExtractor) {
List<String> listaCodiciFiscali = null;
HttpClient client = null;
try {
File file = File.createTempFile("codicefiscale", ".p7m");
FileUtils.writeByteArrayToFile(file, fileArray);
ObjectMapper mapper = new ObjectMapper();
// long companyId = CompanyThreadLocal.getCompanyId();
ContentBody body = new FileBody(file);
ContentBody body = new ByteArrayBody(fileArray, "codicefiscale" + (new Date()).getTime() + ".p7m");
MultipartEntity entity = new MultipartEntity();
entity.addPart("file", body);
HttpPost request = new HttpPost(urlPdfExtractor);
request.setEntity(entity);
HttpClient client = new DefaultHttpClient();
client = new DefaultHttpClient();
HttpResponse response = client.execute(request);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ response.getStatusLine().getStatusCode());
throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
}
InputStream inputStream = response.getEntity().getContent();
ExtractorResponse extractorResponse = mapper.readValue(inputStream, ExtractorResponse.class);
if (extractorResponse.isSuccess()) {
listaCodiciFiscali = extractorResponse.getCf();
}
} catch (IOException e) {
_log.error(e.getMessage());
} finally {
client.getConnectionManager().shutdown();
}
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;
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.net.SocketException;
import java.util.Arrays;
@ -55,6 +35,26 @@ import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
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 Myunghun Kim
@ -71,46 +71,35 @@ public class MailEngine {
public static Session getSession(Account account) {
Properties properties = _getProperties(account);
Session session = Session.getInstance(properties);
if (_log.isDebugEnabled()) {
session.setDebug(true);
session.getProperties().list(System.out);
}
return session;
}
public static Session getSession(boolean cache) {
Session session = null;
try {
session = MailServiceUtil.getSession();
} catch (SystemException se) {
if (_log.isWarnEnabled()) {
_log.warn(se, se);
}
session = InfrastructureUtil.getMailSession();
}
if (_log.isDebugEnabled()) {
session.setDebug(true);
session.getProperties().list(System.out);
}
return session;
}
public static void send(byte[] bytes) throws MailEngineException {
try {
Session session = getSession();
Message message = new MimeMessage(session, new UnsyncByteArrayInputStream(bytes));
_send(session, message, null, _BATCH_SIZE);
} catch (Exception e) {
throw new MailEngineException(e);
@ -119,40 +108,34 @@ public class MailEngine {
public static void send(InternetAddress from, InternetAddress to, String subject, String body)
throws MailEngineException {
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,
boolean htmlFormat) throws MailEngineException {
public static void send(InternetAddress from, InternetAddress to, String subject, String body, boolean htmlFormat)
throws MailEngineException {
send(from, new InternetAddress[] { to }, null, null, subject, body, htmlFormat, null, null, null);
}
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc,
InternetAddress[] bcc, InternetAddress[] bulkAddresses, String subject, String body,
boolean htmlFormat, InternetAddress[] replyTo, String messageId, String inReplyTo)
throws MailEngineException {
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
InternetAddress[] bulkAddresses, String subject, String body, boolean htmlFormat,
InternetAddress[] replyTo, String messageId, String inReplyTo) throws MailEngineException {
send(from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, replyTo, messageId, inReplyTo, null);
}
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc,
InternetAddress[] bcc, InternetAddress[] bulkAddresses, String subject, String body,
boolean htmlFormat, InternetAddress[] replyTo, String messageId, String inReplyTo,
List<FileAttachment> fileAttachments) throws MailEngineException {
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
InternetAddress[] bulkAddresses, String subject, String body, boolean htmlFormat,
InternetAddress[] replyTo, String messageId, String inReplyTo, List<FileAttachment> fileAttachments)
throws MailEngineException {
send(from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, replyTo, messageId, inReplyTo,
fileAttachments, null);
}
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc,
InternetAddress[] bcc, InternetAddress[] bulkAddresses, String subject, String body,
boolean htmlFormat, InternetAddress[] replyTo, String messageId, String inReplyTo,
List<FileAttachment> fileAttachments, SMTPAccount smtpAccount) throws MailEngineException {
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
InternetAddress[] bulkAddresses, String subject, String body, boolean htmlFormat,
InternetAddress[] replyTo, String messageId, String inReplyTo, List<FileAttachment> fileAttachments,
SMTPAccount smtpAccount) throws MailEngineException {
long startTime = System.currentTimeMillis();
if (_log.isDebugEnabled()) {
_log.debug("From: " + from);
_log.debug("To: " + Arrays.toString(to));
@ -165,132 +148,92 @@ public class MailEngine {
_log.debug("Reply to: " + Arrays.toString(replyTo));
_log.debug("Message ID: " + messageId);
_log.debug("In Reply To: " + inReplyTo);
if ((fileAttachments != null) && _log.isDebugEnabled()) {
for (int i = 0; i < fileAttachments.size(); i++) {
FileAttachment fileAttachment = fileAttachments.get(i);
if (fileAttachment instanceof it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) {
((it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) fileAttachment)
.generateFile();
}
File file = fileAttachment.getFile();
if (file == null) {
continue;
}
_log.debug("Attachment " + i + " file " + file.getAbsolutePath() + " and file name "
+ fileAttachment.getFileName());
}
}
}
try {
InternetAddressUtil.validateAddress(from);
if (ArrayUtil.isNotEmpty(to)) {
InternetAddressUtil.validateAddresses(to);
}
if (ArrayUtil.isNotEmpty(cc)) {
InternetAddressUtil.validateAddresses(cc);
}
if (ArrayUtil.isNotEmpty(bcc)) {
InternetAddressUtil.validateAddresses(bcc);
}
if (ArrayUtil.isNotEmpty(replyTo)) {
InternetAddressUtil.validateAddresses(replyTo);
}
if (ArrayUtil.isNotEmpty(bulkAddresses)) {
InternetAddressUtil.validateAddresses(bulkAddresses);
}
Session session = null;
if (smtpAccount == null) {
session = getSession();
} else {
session = getSession(smtpAccount);
}
Message message = new LiferayMimeMessage(session);
message.addHeader("X-Auto-Response-Suppress", "AutoReply, DR, NDR, NRN, OOF, RN");
message.setFrom(from);
if (ArrayUtil.isNotEmpty(to)) {
message.setRecipients(Message.RecipientType.TO, to);
}
if (ArrayUtil.isNotEmpty(cc)) {
message.setRecipients(Message.RecipientType.CC, cc);
}
if (ArrayUtil.isNotEmpty(bcc)) {
message.setRecipients(Message.RecipientType.BCC, bcc);
}
subject = GetterUtil.getString(subject);
message.setSubject(subject);
if ((fileAttachments != null) && (fileAttachments.size() > 0)) {
MimeMultipart rootMultipart = new MimeMultipart(_MULTIPART_TYPE_MIXED);
MimeMultipart messageMultipart = new MimeMultipart(_MULTIPART_TYPE_ALTERNATIVE);
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(messageMultipart);
rootMultipart.addBodyPart(messageBodyPart);
if (htmlFormat) {
MimeBodyPart bodyPart = new MimeBodyPart();
bodyPart.setContent(body, _TEXT_HTML);
messageMultipart.addBodyPart(bodyPart);
} else {
MimeBodyPart bodyPart = new MimeBodyPart();
bodyPart.setText(body);
messageMultipart.addBodyPart(bodyPart);
}
for (int i = 0; i < fileAttachments.size(); i++) {
FileAttachment fileAttachment = fileAttachments.get(i);
File file = fileAttachment.getFile();
if (file == null) {
continue;
}
MimeBodyPart mimeBodyPart = new MimeBodyPart();
DataSource dataSource = new FileDataSource(file);
mimeBodyPart.setDataHandler(new DataHandler(dataSource));
mimeBodyPart.setDisposition(Part.ATTACHMENT);
if (fileAttachment.getFileName() != null) {
mimeBodyPart.setFileName(fileAttachment.getFileName());
} else {
mimeBodyPart.setFileName(file.getName());
}
rootMultipart.addBodyPart(mimeBodyPart);
}
message.setContent(rootMultipart);
message.saveChanges();
} else {
if (htmlFormat) {
@ -299,80 +242,62 @@ public class MailEngine {
message.setContent(body, _TEXT_PLAIN);
}
}
message.setSentDate(new Date());
if (ArrayUtil.isNotEmpty(replyTo)) {
message.setReplyTo(replyTo);
}
if (messageId != null) {
message.setHeader("Message-ID", messageId);
}
if (inReplyTo != null) {
message.setHeader("In-Reply-To", inReplyTo);
message.setHeader("References", inReplyTo);
}
int batchSize = GetterUtil.getInteger(PropsUtil.get(PropsKeys.MAIL_BATCH_SIZE), _BATCH_SIZE);
_send(session, message, bulkAddresses, batchSize);
} catch (SendFailedException sfe) {
_log.error(sfe);
// if (_isThrowsExceptionOnFailure()) {
// throw new MailEngineException(sfe);
// }
throw new MailEngineException(sfe);
} catch (Exception e) {
throw new MailEngineException(e);
}
if (_log.isDebugEnabled()) {
_log.debug("Sending mail takes " + (System.currentTimeMillis() - startTime) + " ms");
}
}
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc,
InternetAddress[] bcc, String subject, String body) throws MailEngineException {
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
String subject, String body) throws MailEngineException {
send(from, to, cc, bcc, subject, body, false, null, null, null);
}
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc,
InternetAddress[] bcc, String subject, String body, boolean htmlFormat,
InternetAddress[] replyTo, String messageId, String inReplyTo) throws MailEngineException {
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
String subject, String body, boolean htmlFormat, InternetAddress[] replyTo, String messageId,
String inReplyTo) throws MailEngineException {
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,
String body) throws MailEngineException {
send(from, to, cc, null, subject, body, false, null, null, null);
}
public static void send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, String subject,
String body, boolean htmlFormat) throws MailEngineException {
send(from, to, cc, null, subject, body, htmlFormat, null, null, null);
}
public static void send(InternetAddress from, InternetAddress[] to, String subject, String body)
throws MailEngineException {
send(from, to, null, null, subject, body, false, null, null, null);
}
public static void send(InternetAddress from, InternetAddress[] to, String subject, String body,
boolean htmlFormat) throws MailEngineException {
public static void send(InternetAddress from, InternetAddress[] to, String subject, String body, boolean htmlFormat)
throws MailEngineException {
send(from, to, null, null, subject, body, htmlFormat, null, null, null);
}
public static void send(MailMessage mailMessage) throws MailEngineException {
send(mailMessage.getFrom(), mailMessage.getTo(), mailMessage.getCC(), mailMessage.getBCC(),
mailMessage.getBulkAddresses(), mailMessage.getSubject(), mailMessage.getBody(),
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 {
try {
send(new InternetAddress(from), new InternetAddress(to), subject, body);
} catch (AddressException ae) {
@ -389,57 +313,43 @@ public class MailEngine {
}
private static Address[] _getBatchAddresses(Address[] addresses, int index, int batchSize) {
if ((batchSize == _BATCH_SIZE) && (index == 0)) {
return addresses;
} else if (batchSize == _BATCH_SIZE) {
return null;
}
int start = index * batchSize;
if (start > addresses.length) {
return null;
}
int end = ((index + 1) * batchSize);
if (end > addresses.length) {
end = addresses.length;
}
return ArrayUtil.subset(addresses, start, end);
}
private static Properties _getProperties(Account account) {
Properties properties = new Properties();
String protocol = account.getProtocol();
properties.setProperty("mail.transport.protocol", protocol);
properties.setProperty("mail." + protocol + ".host", account.getHost());
properties.setProperty("mail." + protocol + ".port", String.valueOf(account.getPort()));
if (account.isRequiresAuthentication()) {
properties.setProperty("mail." + protocol + ".auth", "true");
properties.setProperty("mail." + protocol + ".user", account.getUser());
properties.setProperty("mail." + protocol + ".password", account.getPassword());
}
if (account.isSecure()) {
properties.setProperty("mail." + protocol + ".socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
properties.setProperty("mail." + protocol + ".socketFactory.class", "javax.net.ssl.SSLSocketFactory");
properties.setProperty("mail." + protocol + ".socketFactory.fallback", "false");
properties.setProperty("mail." + protocol + ".socketFactory.port",
String.valueOf(account.getPort()));
properties.setProperty("mail." + protocol + ".socketFactory.port", String.valueOf(account.getPort()));
}
return properties;
}
private static String _getSMTPProperty(Session session, String suffix) {
String protocol = GetterUtil.getString(session.getProperty("mail.transport.protocol"));
if (protocol.equals(Account.PROTOCOL_SMTPS)) {
return session.getProperty("mail.smtps." + suffix);
} 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)
throws MailEngineException {
try {
boolean smtpAuth = GetterUtil.getBoolean(_getSMTPProperty(session, "auth"), false);
String smtpHost = _getSMTPProperty(session, "host");
int smtpPort = GetterUtil.getInteger(_getSMTPProperty(session, "port"), Account.PORT_SMTP);
String user = _getSMTPProperty(session, "user");
String password = _getSMTPProperty(session, "password");
if (smtpAuth && Validator.isNotNull(user) && Validator.isNotNull(password)) {
String protocol = GetterUtil.getString(session.getProperty("mail.transport.protocol"),
Account.PROTOCOL_SMTP);
Transport transport = session.getTransport(protocol);
transport.connect(smtpHost, smtpPort, user, password);
Address[] addresses = null;
if (ArrayUtil.isNotEmpty(bulkAddresses)) {
addresses = bulkAddresses;
} else {
addresses = message.getAllRecipients();
}
for (int i = 0;; i++) {
Address[] batchAddresses = _getBatchAddresses(addresses, i, batchSize);
if (ArrayUtil.isEmpty(batchAddresses)) {
break;
}
transport.sendMessage(message, batchAddresses);
}
transport.close();
} else {
if (ArrayUtil.isNotEmpty(bulkAddresses)) {
int curBatch = 0;
Address[] portion = _getBatchAddresses(bulkAddresses, curBatch, batchSize);
while (ArrayUtil.isNotEmpty(portion)) {
Transport.send(message, portion);
curBatch++;
portion = _getBatchAddresses(bulkAddresses, curBatch, batchSize);
}
} else {
@ -516,25 +406,14 @@ public class MailEngine {
} else {
LogUtil.log(_log, me);
}
// if (_isThrowsExceptionOnFailure()) {
// throw new MailEngineException(me);
// }
throw new MailEngineException(me);
}
}
private static final int _BATCH_SIZE = 0;
private static final String _MULTIPART_TYPE_ALTERNATIVE = "alternative";
private static final String _MULTIPART_TYPE_MIXED = "mixed";
private static final String _TEXT_HTML = "text/html;charset=\"UTF-8\"";
private static final String _TEXT_PLAIN = "text/plain;charset=\"UTF-8\"";
private static Log _log = LogFactoryUtil.getLog(MailEngine.class);
private static final 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;
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.EmailAttachment;
@ -28,54 +14,55 @@ import javax.mail.internet.InternetAddress;
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 {
private static final Log _log = LogFactoryUtil.getLog(MailSenderUtil.class);
public static void sendMail(Email email) throws Exception {
_log.info("sendMail to: " + StringUtils.join(email.getToArray(), ", "));
InternetAddress from = toInternetAddress(email.getFrom());
InternetAddress[] to = toInternetAddresses(email.getToArray());
InternetAddress[] cc = toInternetAddresses(email.getCcArray());
InternetAddress[] bcc = toInternetAddresses(email.getBccArray());
InternetAddress[] bulAddresses = toInternetAddresses(email.getBulkAddressesArray());
String subject = email.getSubject();
String body = email.getBody();
boolean htmlFormat = email.isHtmlFormat();
InternetAddress[] replyTo = toInternetAddresses(email.getReplyToArray());
String messageId = email.getMessageId();
String inReplyTo = email.getInReplyTo();
List<EmailAttachment> emailAttachments = email.getEmailAttachments();
List<FileAttachment> fileAttachments = toFileAttachments(emailAttachments);
try {
SMTPAccount smtpAccount = null;
if (Validator.isNotNull(email.getSmtpHost())) {
String protocol = Account.PROTOCOL_SMTP;
if (email.getSmtpHost().startsWith(Account.PROTOCOL_SMTPS)) {
protocol = Account.PROTOCOL_SMTPS;
}
smtpAccount = (SMTPAccount) SMTPAccount.getInstance(protocol, email.getSmtpPort());
if (email.isSmtpSecure()) {
smtpAccount.setUser(email.getSmtpUsername());
smtpAccount.setPassword(email.getSmtpPassword());
}
}
MailEngine.send(from, to, cc, bcc, bulAddresses, subject, body, htmlFormat, replyTo, messageId,
inReplyTo, fileAttachments, smtpAccount);
} finally {
for (FileAttachment fileAttachment : fileAttachments) {
FileUtil.delete(fileAttachment.getFile());
}
@ -83,51 +70,43 @@ public class MailSenderUtil {
}
private static InternetAddress toInternetAddress(String address) throws AddressException {
if (Validator.isNotNull(address)) {
return new InternetAddress(address);
}
if (Validator.isNull(address)) {
return null;
}
return new InternetAddress(address);
}
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];
for (int i = 0; i < addresses.length; i++) {
internetAddresses[i] = new InternetAddress(addresses[i]);
}
return internetAddresses;
}
return null;
}
private static List<FileAttachment> toFileAttachments(List<EmailAttachment> emailAttachments)
throws PortalException, SystemException, IOException {
List<FileAttachment> fileAttachments = new ArrayList<FileAttachment>(emailAttachments.size());
List<FileAttachment> fileAttachments = new ArrayList<>(emailAttachments.size());
for (EmailAttachment emailAttachment : emailAttachments) {
InputStream inputStream = null;
try {
FileEntry fileEntry = emailAttachment.getFileEntry();
inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(),
fileEntry.getVersion(), false);
File file = FileUtil.createTempFile(inputStream);
String fileName = fileEntry.getTitle();
String extension = FileUtil.getExtension(fileName);
if (Validator.isNull(extension) && Validator.isNotNull(fileEntry.getExtension())) {
fileName += StringPool.PERIOD + fileEntry.getExtension();
}
fileAttachments.add(new FileAttachment(file, fileName));
} finally {
StreamUtil.cleanUp(inputStream);
}
}
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.ReportResultDto;
import java.io.File;
import java.io.FileOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
@ -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.MapUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.SystemProperties;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Company;
import com.liferay.portal.model.RoleConstants;
@ -56,6 +52,7 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
public class ProtocolloMessageListener extends BaseMessageListener {
private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
private static final Log _log = LogFactoryUtil.getLog(ProtocolloMessageListener.class);
@ -93,22 +90,13 @@ public class ProtocolloMessageListener extends BaseMessageListener {
long fileEntryId = reportDto.getFileEntryIds()[0];
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId);
if (Validator.isNotNull(fileEntry)) {
InputStream is = fileEntry.getContentStream();
byte[] targetArray = new byte[is.available()];
is.read(targetArray);
String tempFileNameCopy = System.getProperty(SystemProperties.TMP_DIR) + File.separator
+ "copied-files" + System.currentTimeMillis() + ".pdf";
File tempFileCopy = new File(tempFileNameCopy);
OutputStream outStreamCopiedFile = new FileOutputStream(tempFileCopy);
outStreamCopiedFile.write(targetArray);
is.close();
outStreamCopiedFile.close();
String tempFileNameModified = System.getProperty(SystemProperties.TMP_DIR) + File.separator
+ "modified-files" + System.currentTimeMillis() + ".pdf";
File tempFileModified = new File(tempFileNameModified);
FileOutputStream fileOutputStream = new FileOutputStream(tempFileModified);
PdfReader reader = new PdfReader(tempFileNameCopy);
PdfStamper stamper = new PdfStamper(reader, fileOutputStream);
InputStream inputStream = fileEntry.getContentStream();
byte[] inputBytes = new byte[inputStream.available()];
inputStream.read(inputBytes);
inputStream.close();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
PdfReader reader = new PdfReader(inputBytes);
PdfStamper stamper = new PdfStamper(reader, outputStream);
PdfWriter writer = stamper.getWriter();
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
PdfContentByte cb = stamper.getOverContent(i);
@ -139,30 +127,23 @@ public class ProtocolloMessageListener extends BaseMessageListener {
}
stamper.close();
reader.close();
byte[] outputBytes = outputStream.toByteArray();
outputStream.close();
ServiceContext serviceContext = new ServiceContext();
serviceContext.setUserId(userId);
serviceContext.setCompanyId(companyId);
byte[] newFilesBytes = Files.readAllBytes(tempFileModified.toPath());
fileOutputStream.close();
tempFileCopy.delete();
tempFileModified.delete();
FileEntry newFileEntry = null;
try {
newFileEntry = DLAppLocalServiceUtil.addFileEntry(userId, fileEntry.getRepositoryId(),
fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", "application/pdf",
reportDto.getFileName(), "", "", newFilesBytes, serviceContext);
reportDto.getFileName(), StringPool.BLANK, StringPool.BLANK, outputBytes, serviceContext);
} catch (DuplicateFileException e) {
FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), fileEntry.getFolderId(),
reportDto.getFileName());
// DLAppLocalServiceUtil.deleteFileEntry(fe.getFileEntryId());
_log.info("File duplicato : " + fe.getFileEntryId());
return;
}
tempFileCopy.delete();
tempFileModified.delete();
if (Validator.isNotNull(newFileEntry)) {
long[] fileEntryIds = new long[0];
fileEntryIds = ArrayUtil.append(fileEntryIds, newFileEntry.getFileEntryId());
@ -185,7 +166,6 @@ public class ProtocolloMessageListener extends BaseMessageListener {
private String finalizzaProtocollazione(long companyId, String protocollo, Date dtProtocollo)
throws SystemException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Company company = CompanyLocalServiceUtil.fetchCompany(companyId);
StringBuilder sb = new StringBuilder();
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;
import it.tref.liferay.portos.bo.modellistener.shared.model.ModelListenerWrapper;
import com.liferay.portal.kernel.messaging.BaseMessageListener;
import com.liferay.portal.kernel.messaging.DestinationNames;
import com.liferay.portal.kernel.messaging.Message;
import com.liferay.portal.kernel.messaging.MessageBusUtil;
import it.tref.liferay.portos.bo.modellistener.shared.model.ModelListenerWrapper;
public class ModelListenerHotDeployListener extends BaseMessageListener {
private String currentContextName;
@ -19,33 +19,19 @@ public class ModelListenerHotDeployListener extends BaseMessageListener {
@Override
protected void doReceive(Message message) throws Exception {
String command = message.getString("command");
String servletContextName = message.getString("servletContextName");
if (command.equals("deploy")) {
for (int i = 0; modelListenerWrappers != null && i < modelListenerWrappers.length; i++) {
if (servletContextName.equals(modelListenerWrappers[i].getServletContextName())) {
ModelListenerUtil.registerModelListener(modelListenerWrappers[i]);
// _log.info("[" + servletContextName + "/" + command + "]" + "Sto registrando il wrapper
// "
// + modelListenerWrappers[i].getModelClassName() + " - "
// + modelListenerWrappers[i].getServletContextName());
}
}
} else if (command.equals("undeploy")) {
if (servletContextName.equals(currentContextName)) {
ModelListenerUtil.unregisterModelListeners();
// _log.info("[" + servletContextName + "/" + command + "]" + "Sto effettuando undeploy ");
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
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
/**
* @see com.liferay.portal.kernel.bean.ClassLoaderBeanHandler
*/
if (method.getDeclaringClass() == Object.class) {
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())) {
try {
BaseModel<?> baseModel = (BaseModel<?>) args[0];
Serializable primaryKeyObj = baseModel.getPrimaryKeyObj();
Class<?> primaryKeyObjClass = primaryKeyObj.getClass();
ClassLoader classLoader = modelListener.getClass().getClassLoader();
String modelClassName = baseModel.getModelClassName();
String modelName = modelClassName.substring(modelClassName.lastIndexOf(".") + 1);
String localServiceUtilClassName =
StringUtil.replace(modelClassName, ".model.", ".service.") + "LocalServiceUtil";
String localServiceUtilClassName = StringUtil.replace(modelClassName, ".model.", ".service.")
+ "LocalServiceUtil";
String createMethodName = "create" + modelName;
// _log.info("localServiceUtilClassName " + localServiceUtilClassName);
Class<?> localServiceUtilClass = ClassResolverUtil.resolve(localServiceUtilClassName, classLoader);
boolean isSimpleColumnType = isSimpleColumnType(primaryKeyObjClass);
if (isSimpleColumnType) {
try {
args[0] = ReflectionUtil
.getDeclaredMethod(localServiceUtilClass, createMethodName, toPrimitive(primaryKeyObjClass))
.invoke(null, primaryKeyObj);
args[0] = ReflectionUtil.getDeclaredMethod(localServiceUtilClass, createMethodName,
toPrimitive(primaryKeyObjClass)).invoke(null, primaryKeyObj);
} catch (Exception e) {
args[0] = ReflectionUtil.getDeclaredMethod(localServiceUtilClass, createMethodName, primaryKeyObjClass)
.invoke(null, primaryKeyObj);
args[0] = ReflectionUtil.getDeclaredMethod(localServiceUtilClass, createMethodName,
primaryKeyObjClass).invoke(null, primaryKeyObj);
}
} else {
List<Class<?>> parameterTypes = new ArrayList<Class<?>>();
List<Object> arguments = new ArrayList<Object>();
Field[] fields = primaryKeyObjClass.getFields();
for (Field field : fields) {
// public fields -> [entity-name]PK
parameterTypes.add(field.getType());
arguments.add(field.get(primaryKeyObj));
}
try {
// custom method
args[0] = ReflectionUtil
.getDeclaredMethod(localServiceUtilClass, createMethodName,
parameterTypes.toArray(new Class<?>[parameterTypes.size()]))
.invoke(null, arguments.toArray(new Object[arguments.size()]));
args[0] = ReflectionUtil.getDeclaredMethod(localServiceUtilClass, createMethodName,
parameterTypes.toArray(new Class<?>[parameterTypes.size()])).invoke(null,
arguments.toArray(new Object[arguments.size()]));
} catch (NoSuchMethodException e) {
throw new ClassNotFoundException();
}
}
ReflectionUtil.getDeclaredMethod(args[0].getClass(), "setModelAttributes", Map.class).invoke(args[0],
baseModel.getModelAttributes());
} catch (ClassNotFoundException e) {
// plugin is not related to other plugin
}
}
Thread currentThread = Thread.currentThread();
ClassLoader contextClassLoader = currentThread.getContextClassLoader();
ClassLoader classLoader = modelListener.getClass().getClassLoader();
try {
if (classLoader != contextClassLoader) {
currentThread.setContextClassLoader(classLoader);
}
return ReflectionUtil.getDeclaredMethod(modelListener.getClass(), method.getName(), method.getParameterTypes())
.invoke(modelListener, args);
return ReflectionUtil.getDeclaredMethod(modelListener.getClass(), method.getName(),
method.getParameterTypes()).invoke(modelListener, args);
} finally {
if (classLoader != contextClassLoader) {
currentThread.setContextClassLoader(contextClassLoader);
@ -129,7 +100,6 @@ public class ModelListenerInvocationHandler implements InvocationHandler {
}
private Class<?> toPrimitive(Class<?> clazz) {
if (clazz.equals(Long.class)) {
return long.class;
} else if (clazz.equals(Integer.class)) {
@ -148,7 +118,6 @@ public class ModelListenerInvocationHandler implements InvocationHandler {
}
private boolean isSimpleColumnType(Class<?> clazz) {
if (clazz.equals(Long.class)) {
return true;
} else if (clazz.equals(Integer.class)) {
@ -166,13 +135,9 @@ public class ModelListenerInvocationHandler implements InvocationHandler {
} else if (clazz.equals(Blob.class)) {
return true;
}
return false;
}
private final static String[] MODEL_METHOD_NAMES =
{"onAfterCreate", "onAfterRemove", "onAfterUpdate", "onBeforeCreate", "onBeforeRemove", "onBeforeUpdate"};
// private final static Log _log = LogFactoryUtil.getLog(ModelListenerHotDeployListener.class);
private final static String[] MODEL_METHOD_NAMES = { "onAfterCreate", "onAfterRemove", "onAfterUpdate",
"onBeforeCreate", "onBeforeRemove", "onBeforeUpdate" };
}

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,
ModelListener<BaseModel<?>> modelListener) {
_servletContextNameMap.put(modelClassName, servletContextName);
if (!_modelListenersMap.containsKey(modelClassName)) {
_modelListenersMap.put(modelClassName, new ArrayList<ModelListener<BaseModel<?>>>());
}
@ -23,29 +21,23 @@ public class ModelListenerPool {
}
protected static void unregister(String modelClassName) {
_servletContextNameMap.remove(modelClassName);
_modelListenersMap.remove(modelClassName);
}
protected static Set<String> getModelClassNames() {
return _modelListenersMap.keySet();
}
protected static List<ModelListener<BaseModel<?>>> getModelListeners(String modelClassName) {
return _modelListenersMap.get(modelClassName);
}
protected static String getServletContextName(String modelClassName) {
return _servletContextNameMap.get(modelClassName);
}
private final static Map<String, List<ModelListener<BaseModel<?>>>> _modelListenersMap =
new ConcurrentHashMap<String, List<ModelListener<BaseModel<?>>>>();
private final static Map<String, List<ModelListener<BaseModel<?>>>> _modelListenersMap = new ConcurrentHashMap<String, List<ModelListener<BaseModel<?>>>>();
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
public void run(String[] ids) throws ActionException {
Thread thread = Thread.currentThread();
ClassLoader currentClassLoader = thread.getContextClassLoader();
String currentContextName = ClassLoaderPool.getContextName(currentClassLoader);
ModelListenerWrapper[] modelListenerWrappers = getModelListenerWrappers();
for (int i = 0; modelListenerWrappers != null && i < modelListenerWrappers.length; i++) {
if (ServletContextPool.containsKey(modelListenerWrappers[i].getServletContextName())) {
ModelListenerUtil.registerModelListener(modelListenerWrappers[i]);
}
}
MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY,
new ModelListenerHotDeployListener(currentContextName, modelListenerWrappers));
MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, new ModelListenerHotDeployListener(
currentContextName, modelListenerWrappers));
}
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;
}
public CronostoriaBean(Date dataEvento, String tipoEvento, String testoEvento, String tipoLink, String classPK, String className,
CronostoriaLink... links) {
public CronostoriaBean(Date dataEvento, String tipoEvento, String testoEvento, String tipoLink, String classPK,
String className, CronostoriaLink... links) {
super();
this.dataEvento = dataEvento;
this.tipoEvento = tipoEvento;
@ -40,7 +40,6 @@ public class CronostoriaBean implements Serializable {
this.className = className;
}
public Date getDataEvento() {
return dataEvento;
}
@ -81,25 +80,19 @@ public class CronostoriaBean implements Serializable {
this.tipoLink = tipoLink;
}
public String getClassPK() {
return classPK;
}
public void setClassPK(String classPK) {
this.classPK = classPK;
}
public String getClassName() {
return className;
}
public void setClassName(String 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) {
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() {
return name;
}
}

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

@ -1,32 +1,32 @@
package it.tref.liferay.portos.bo.shared.bean;
public class IstruttoreBean implements Comparable<IstruttoreBean>{
public class IstruttoreBean implements Comparable<IstruttoreBean> {
private long idIstruttore;
private String denominazione;
public long getIdIstruttore() {
return idIstruttore;
}
public void setIdIstruttore(long idIstruttore) {
this.idIstruttore = idIstruttore;
}
public String getDenominazione() {
return denominazione;
}
public void setDenominazione(String denominazione) {
this.denominazione = denominazione;
}
@Override
public int compareTo(IstruttoreBean o) {
int value = 0;
value = getDenominazione().compareTo(o.getDenominazione());
if (value != 0) {
return value;
}
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 String parere;
public long getIntPraticaId() {
return intPraticaId;
}
public void setIntPraticaId(long intPraticaId) {
this.intPraticaId = intPraticaId;
}
public Date getDataCreazione() {
return dataCreazione;
}
public void setDataCreazione(Date dataCreazione) {
this.dataCreazione = dataCreazione;
}
@ -34,53 +30,40 @@ public class ParereGeologoBean implements Comparable<ParereGeologoBean>{
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public long getParereGeologoId() {
return parereGeologoId;
}
public void setParereGeologoId(long parereGeologoId) {
this.parereGeologoId = parereGeologoId;
}
@Override
public int compareTo(ParereGeologoBean o) {
int value = 0;
value = getDataCreazione().compareTo(o.getDataCreazione());
if (value != 0) {
return value;
}
return 0;
}
public long getDettPraticaId() {
return dettPraticaId;
}
public void setDettPraticaId(long dettPraticaId) {
this.dettPraticaId = dettPraticaId;
}
public String getParere() {
return parere;
}
public void setParere(String 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;
public class File {
private String fileId;
private String fileSha256;
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getFileSha256() {
return fileSha256;
}
public void setFileSha256(String fileSha256) {
this.fileSha256 = fileSha256;
}
}

33
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_SANATORIA = "03";
//Bug 33461
// public static final String TIPO_PRATICA_OPERE_MINORE_IMPORTANZA = "05";
@SuppressWarnings("serial")
public static final HashMap<String, String> PRATICA_ZONE = new HashMap<String, String>() {
{
put(PROCEDURA_A, TIPO_PRATICA_AUTORIZZAZIONE);
@ -38,11 +36,9 @@ 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[] AMMINISTRAZIONE_CSV_HEADERS_COMUNI = {"Codice Regione", "Codice Città Metropolitana",
public static final String[] AMMINISTRAZIONE_CSV_HEADERS_COMUNI = { "Codice Regione", "Codice Città Metropolitana",
"Codice Provincia (1)", "Progressivo del Comune (2)", "Codice Comune formato alfanumerico",
"Denominazione in italiano", "Denominazione in tedesco", "Codice Ripartizione Geografica",
"Ripartizione geografica", "Denominazione regione", "Denominazione Città metropolitana",
@ -51,22 +47,10 @@ public class Constants implements com.liferay.portal.kernel.util.Constants {
"Codice Comune numerico con 107 province (dal 2006 al 2009)",
"Codice Comune numerico con 103 province (dal 1995 al 2005)", "Codice Catastale del comune",
"Popolazione legale 2011 (09/10/2011)", "Codice NUTS1 2010", "Codice NUTS2 2010 (3) ", "Codice NUTS3 2010",
"Codice NUTS1 2006", "Codice NUTS2 2006 (3)", "Codice NUTS3 2006"};
public static final String[] AMMINISTRAZIONE_CSV_HEADERS_PROVINCE = {"codice_provincia", "provincia", "regione",
"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";
"Codice NUTS1 2006", "Codice NUTS2 2006 (3)", "Codice NUTS3 2006" };
public static final String[] AMMINISTRAZIONE_CSV_HEADERS_PROVINCE = { "codice_provincia", "provincia", "regione",
"sigla" };
public static final String ROLE_NAME_GEOLOGO = "portos_geologo";
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_ISTRUTTORE = "portos_istruttore";
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_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_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
// da pannello di controllo. In origine era hardcoded a 20971520 byte.
// Manifattura Web Group, mofidica per rendere la dimensione massima degli allegati configurabile da pannello di
// 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_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.SystemException;
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.model.Company;
import com.liferay.portal.service.CompanyLocalServiceUtil;
@ -11,53 +12,36 @@ public class FascicoloURLUtil {
@Deprecated
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);
}
public static String getFascicoloFEViewURL(long companyId, long intPraticaId, String mvcPath, String queryString)
throws PortalException, SystemException {
Company company = CompanyLocalServiceUtil.getCompany(companyId);
String urlToBack = (String) company.getExpandoBridge().getAttribute(Constants.GESTIONE_PRATICA_URL_FE, false);
urlToBack = HttpUtil.addParameter(urlToBack, "_" + PortletKeys.FASCICOLOFE + "_intPraticaId", intPraticaId);
urlToBack = HttpUtil.addParameter(urlToBack, StringPool.UNDERLINE + PortletKeys.FASCICOLOFE + "_intPraticaId",
intPraticaId);
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 (queryString.startsWith("?")) {
if (queryString.startsWith(StringPool.QUESTION)) {
queryString = queryString.substring(1);
}
if (queryString.startsWith("&")) {
if (queryString.startsWith(StringPool.AMPERSAND)) {
queryString = queryString.substring(1);
}
urlToBack = urlToBack + "&" + queryString;
urlToBack = urlToBack + StringPool.AMPERSAND + queryString;
}
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);
String urlToBack = (String) company.getExpandoBridge().getAttribute(Constants.GESTIONE_PRATICA_URL_BO, false);
urlToBack = urlToBack + "&_" + PortletKeys.FASCICOLO + "_intPraticaId=" + intPraticaId;
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;
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.FirmeDetail;
@ -12,22 +7,25 @@ import java.util.Date;
import java.util.List;
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 static String addFirma(FirmeBean firmeBean, String codiceFiscale) {
Date now = new Date();
List<FirmeDetail> firme = new UniqueList<FirmeDetail>();
firme.addAll(firmeBean.getFirmeApplicativo());
firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), now));
firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), new Date()));
firmeBean.setFirmeApplicativo(firme);
return serialize(firmeBean);
}
public static String addFirmaDigitale(FirmeBean firmeBean, String codiceFiscale) {
Date now = null;
List<FirmeDetail> firme = new UniqueList<FirmeDetail>();
firme.addAll(firmeBean.getFirmeDigitali());
firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), now));
firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), null));
firmeBean.setFirmeDigitali(firme);
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;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.util.PortalUtil;
import java.util.Calendar;
import java.util.Date;
import javax.portlet.PortletRequest;
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 static Date getDate(PortletRequest request, String param) throws PortalException {
int day = ParamUtil.getInteger(request, param + "Day");
int month = ParamUtil.getInteger(request, param + "Month");
int year = ParamUtil.getInteger(request, param + "Year");
int hour = ParamUtil.getInteger(request, param + "Hour");
int minute = ParamUtil.getInteger(request, param + "Minute");
int amPm = ParamUtil.getInteger(request, param + "AmPM");
if (amPm == Calendar.PM) {
hour += 12;
}
return PortalUtil.getDate(month, day, year, hour, minute, null);
}
public static Date getDate(HttpServletRequest request, String param) throws PortalException {
int day = ParamUtil.getInteger(request, param + "Day");
int month = ParamUtil.getInteger(request, param + "Month");
int year = ParamUtil.getInteger(request, param + "Year");
int hour = ParamUtil.getInteger(request, param + "Hour");
int minute = ParamUtil.getInteger(request, param + "Minute");
int amPm = ParamUtil.getInteger(request, param + "AmPM");
if (amPm == Calendar.PM) {
hour += 12;
}
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;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
public class TipoIntegrazioneUtil {
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 VARIANTE = "13";
// private final static Map<String, String> integrazioneToStato = new HashMap<String, String>();
//
// private final static Map<String, String> labels = new HashMap<String, String>();
//
// static {
// 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});
@SuppressWarnings("serial")
private static final List<String> outOfWorkflow = new ArrayList<String>() {
{
add(VARIAZIONE_SOGGETTO);
add(ANNULLA);
}
};
public static boolean isOutOfWorkflow(String 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;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
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_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() {
return Arrays.asList(TipoSoggettoUtil.COMMITTENTE, TipoSoggettoUtil.DITTA, TipoSoggettoUtil.PROGETTISTA,
TipoSoggettoUtil.DIRETTORE_LAVORI, TipoSoggettoUtil.GEOLOGO, TipoSoggettoUtil.COLLAUDATORE);
return allSubjects;
}
public static boolean validaCodiceFiscale(String codiceFiscale, boolean ultimoCarattere) {
// conversione della stringa in caratteri maiuscoli
try {
String cf = codiceFiscale.toUpperCase().replaceAll(" ", "");
/*
* verifica della lunghezza del codice fiscale
*/
// verifica della lunghezza del codice fiscale
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))
return false;
/*
* 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', '9'};
/*
* creazione della matrice con i valori attribuiti ai caratteri dispari, 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
*/
// 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',
'9' };
// creazione della matrice con i valori attribuiti ai caratteri dispari, 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];
for (int i = 0; i < 26; i++) {
ValoriPari[i] = i;
@ -63,22 +62,17 @@ public class TipoSoggettoUtil {
char[] caratteriCF = cf.toCharArray();
int valore = 0;
for (int i = 0; i < caratteriCF.length - 1; i++) {
/*
* somma delle posizioni pari in base ai valori corrispondenti contenuti nell'array
* ValoriPari (tranne l'ultimo carattere che è quello di controllo)
*/
// somma delle posizioni pari in base ai valori corrispondenti contenuti nell'array ValoriPari
// (tranne l'ultimo carattere che è quello di controllo)
if ((i + 1) % 2 == 0) {
for (int j = 0; j < Carattere.length; j++) {
if (caratteriCF[i] == Carattere[j]) {
valore += ValoriPari[j];
}
}
/*
* somma delle posizioni dispari in base ai valori corrispondenti contenuti nell'array
* ValoriDispari
*/
} else {
// somma delle posizioni dispari in base ai valori corrispondenti contenuti nell'array
// ValoriDispari
for (int j = 0; j < Carattere.length; j++) {
if (caratteriCF[i] == Carattere[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 carattere)
*/
// ottenimento del resto della divisione per 26 e valutazione del carattere di controllo (ultimo
// carattere)
valore %= 26;
for (int i = 0; i < 26; i++) {
/*
* verifica che il valore dell'ultimo carattere corrisponda al valore ottenuto attraverso
* l'algoritmo di somma precedente
*/
// verifica che il valore dell'ultimo carattere corrisponda al valore ottenuto attraverso
// l'algoritmo di somma precedente
if (ultimoCarattere) {
if (caratteriCF[caratteriCF.length - 1] == Carattere[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;
public class ReportConstants {
/*
* Message
*/
public enum ReportProcessMode {
ASYNC,
SYNC
ASYNC, SYNC
}
public enum ReportResult {
FAILED,
SUCCESSFUL
FAILED, SUCCESSFUL
}
public enum ReportType {
HTML_TO_PDF,
JRXML_TO_PDF,
VELOCITY_TO_PDF,
ODT_TO_PDF
HTML_TO_PDF, JRXML_TO_PDF, VELOCITY_TO_PDF, ODT_TO_PDF
}
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_RESPONSE_DESTINATION_NAME = "responseDestinationName";
public final static String SERVICE_CONTEXT = "serviceContext";
public final static String FILE_ENTRY_ID_TEMPLATE = "fileEntryIdTemplate";
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 FOLDER_ID_REPORT = "folderIdReport";
/*
* Genio Civile
*/
public final static String LOGO_REGIONE = "LOGO_REGIONE";
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"?>
<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_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="com.liferay.ide.eclipse.server.plugin.container/web">
<attributes>
@ -18,5 +13,11 @@
</attributes>
</classpathentry>
<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"/>
</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>
<runtime name="Liferay v6.2 CE (Tomcat 7)"/>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="liferay.web" version="6.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
</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="import.shared" value="portos-kaleo-shared" />
<property name="import.shared" value="portos-bo-shared,portos-kaleo-shared" />
</project>

83
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 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.
@ -14,19 +26,15 @@
* details.
*/
--%>
<%@ include file="/html/portlet/workflow_instances/init.jsp" %>
<%
String randomId = StringUtil.randomId();
ResultRow row = (ResultRow)request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
WorkflowTask workflowTask = (WorkflowTask)row.getObject();
%>
<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:param name="struts_action" value="/workflow_instances/edit_workflow_instance_task" />
<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="assigneeUserId" value="<%= String.valueOf(user.getUserId()) %>" />
</portlet:actionURL>
<liferay-ui:icon
cssClass='<%= "workflow-task-" + randomId + " task-assign-to-me-link" %>'
image="assign"
message="assign-to-me"
method="get"
url="<%= assignToMeURL %>"
/>
<liferay-ui:icon cssClass='<%= "workflow-task-" + randomId + " task-assign-to-me-link" %>' image="assign"
message="assign-to-me" method="get" url="<%= assignToMeURL %>" />
</c:if>
<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) {
String message = "proceed";
if (Validator.isNotNull(transitionName)) {
message = transitionName;
}
%>
<portlet:actionURL var="editURL">
<portlet:param name="struts_action" value="/workflow_instances/edit_workflow_instance_task" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.SAVE %>" />
<portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" />
<portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" />
<c:if test="<%= transitionName != null %>">
<portlet:param name="transitionName" value="<%= transitionName %>" />
</c:if>
</portlet:actionURL>
<portlet:renderURL var="renderFormURL" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
<portlet:param name="struts_action" value="/workflow_tasks/render_form_task" />
<portlet:param name="formName" value='<%= "fm_"+ randomId %>' />
<portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" />
<portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" />
<c:if test="<%= transitionName != null %>">
<portlet:param name="transitionName" value="<%= transitionName %>" />
</c:if>
</portlet:renderURL>
<portlet:resourceURL var="validationURL">
<portlet:param name="struts_action" value="/workflow_tasks/render_form_task" />
<portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" />
<portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" />
<c:if test="<%= transitionName != null %>">
<portlet:param name="transitionName" value="<%= transitionName %>" />
</c:if>
</portlet:resourceURL>
<%
Map<String, Object> data = new HashMap<String, Object>();
data.put("href-validation", validationURL);
data.put("href-render-form", renderFormURL);
%>
<liferay-ui:icon
cssClass='<%= "workflow-task-" + randomId + " task-change-status-link" %>'
image="../aui/random"
message="<%= message %>"
method="get"
url="<%= editURL %>"
data="<%= data %>"
/>
<liferay-ui:icon cssClass='<%= "workflow-task-" + randomId + " task-change-status-link" %>'
image="../aui/random" message="<%= message %>" method="get" url="<%= editURL %>" data="<%= data %>" />
<%
}
%>
</c:if>
</liferay-ui:icon-menu>
<div class="hide" id="<%= randomId %>updateComments">
@ -118,19 +100,14 @@ WorkflowTask workflowTask = (WorkflowTask)row.getObject();
<div id="<%= randomId %>form"></div>
<aui:input cols="105" name="comment" rows="10" type="textarea" />
</div>
<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 />');
form.setAttribute('action', url);
form.setAttribute('method', 'POST');
var comments = A.one('#<%= randomId %>updateComments');
if (comments) {
form.append(comments);
comments.show();
}
@ -139,13 +116,13 @@ WorkflowTask workflowTask = (WorkflowTask)row.getObject();
if (formDiv) {
formDiv.empty();
}
var formErrorDiv = A.one('#<%= randomId %>formError');
if (formErrorDiv) {
formErrorDiv.empty();
}
var dialog = Liferay.Util.Window.getWindow(
{
var dialog = Liferay.Util.Window.getWindow({
dialog: {
bodyContent: form,
height: 620,
@ -209,11 +186,8 @@ WorkflowTask workflowTask = (WorkflowTask)row.getObject();
width: 550
},
title: title
}
);
});
A.one('#<%= randomId %>updateComments').plug(A.LoadingMask, {});
A.io.request(renderFormURL, {
dataType: 'html',
on: {
@ -241,20 +215,17 @@ WorkflowTask workflowTask = (WorkflowTask)row.getObject();
}
}
});
};
};
A.all('.workflow-task-<%= randomId %> a').on(
A.all('.workflow-task-<%= randomId %> a').on(
'click',
function(event) {
event.preventDefault();
var icon = event.currentTarget;
var title = icon.text();
var renderFormURL = icon.attr('data-href-render-form');
var validationURL = icon.attr('data-href-validation');
showPopup(icon.attr('href'), title, renderFormURL, validationURL);
}
);
);
</aui:script>

54
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.
*/
--%>
<%@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.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" %>
<%
String randomId = StringUtil.randomId();
String redirect = ParamUtil.getString(request, "redirect");
WorkflowTask workflowTask = (WorkflowTask)request.getAttribute(WebKeys.WORKFLOW_TASK);
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(company.getCompanyId(), workflowTask.getWorkflowInstanceId());
Map<String, Serializable> workflowContext = workflowInstance.getWorkflowContext();
long companyId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
long groupId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_GROUP_ID));
String className = (String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME);
long classPK = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
WorkflowHandler workflowHandler = WorkflowHandlerRegistryUtil.getWorkflowHandler(className);
AssetRenderer assetRenderer = workflowHandler.getAssetRenderer(classPK);
AssetRendererFactory assetRendererFactory = workflowHandler.getAssetRendererFactory();
AssetEntry assetEntry = null;
if (assetRenderer != null) {
assetEntry = assetRendererFactory.getAssetEntry(assetRendererFactory.getClassName(), assetRenderer.getClassPK());
}
String headerTitle = LanguageUtil.get(pageContext, workflowTask.getName());
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>
<div class="separator"></div>
</div>
<%
request.removeAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
%>
<liferay-util:include page="/html/portlet/workflow_tasks/workflow_task_action.jsp">
<liferay-portlet:param name="viewFullContentURLString" value="<%= viewFullContentURLString %>"/>
<!-- ADT BUG BO ID= 27 -->
<liferay-portlet:param name="classPkForCarichiLavoro" value="<%= String.valueOf(classPK) %>"/>
</liferay-util:include>
</div>
</div>
</div>
<style>
html {
padding: 0!important;
@ -333,11 +341,6 @@ color: #333!important;
color: black
}
</style>
<aui:script use="liferay-workflow-tasks">
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 %>taskDueDateLink', onTaskClickFn); --%>
</aui:script>
<%
PortalUtil.addPortletBreadcrumbEntry(request, headerTitle, currentURL);
%>

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

Caricamento…
Annulla
Salva