Sfoglia il codice sorgente

diff portlets,themes,webs

feature/differenze-sorgenti
E-A B 2 anni fa
parent
commit
7231c41224
  1. 24
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/accesso/atti/NoSuchRichiestaAccessoAttiException.java
  2. 285
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiBOPortlet.java
  3. 234
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiFEPortlet.java
  4. 46
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/CreazioneAccountPortosPortlet.java
  5. 22
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/base/RichiestaAccessoAttiLocalServiceClpInvoker.java
  6. 245
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java
  7. 35
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiServiceImpl.java
  8. 18
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java
  9. 47
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java
  10. 98
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/EmailSenderUtil.java
  11. 148
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp
  12. 19
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateFunzionarioException.java
  13. 19
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicatePrenotazioneException.java
  14. 19
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateProfessionistaException.java
  15. 19
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchDisponibilitaException.java
  16. 19
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchFunzionarioException.java
  17. 19
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchPrenotazioneException.java
  18. 19
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchProfessionistaException.java
  19. 19
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/SlotNotAvailableException.java
  20. 8
      liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/liferay-portlet.xml
  21. 18
      liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/companyconfig/portlet/CompanyConfigurationPortlet.java
  22. 1
      liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/init.jsp
  23. 27
      liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/view.jsp
  24. 1
      liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/init.jsp
  25. 57
      liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/cookies/action/StartUpAction.java
  26. 1
      liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/init.jsp
  27. 1
      liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/view.jsp
  28. 5
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/portlet.xml
  29. 44
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/action/DeployAction.java
  30. 3
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/constants/MailConstants.java
  31. 5
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/control/DeployAlertControl.java
  32. 26
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/portlet/NotificatorPortlet.java
  33. 40
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationLogLocalServiceImpl.java
  34. 69
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationMailLocalServiceImpl.java
  35. 1
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationLogPersistenceImpl.java
  36. 1
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationMailPersistenceImpl.java
  37. 37
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/util/DeployAlertUtil.java
  38. 1
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/init.jsp
  39. 1
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/edit_notification.jsp
  40. 1
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/init.jsp
  41. 1
      liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/view.jsp
  42. 2
      liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/liferay-hook.xml
  43. 10
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/liferay-portlet.xml
  44. 36
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoInstanceImpl.java
  45. 36
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoNodeImpl.java
  46. 40
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskAssignmentInstanceImpl.java
  47. 36
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskImpl.java
  48. 37
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskInstanceTokenImpl.java
  49. 3
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstancePersistenceImpl.java
  50. 3
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstanceTokenPersistenceImpl.java
  51. 3
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoLogPersistenceImpl.java
  52. 3
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoNodePersistenceImpl.java
  53. 3
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskAssignmentInstancePersistenceImpl.java
  54. 3
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskInstanceTokenPersistenceImpl.java
  55. 3
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskPersistenceImpl.java
  56. 2
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/liferay-hook.xml
  57. 136
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/service.xml
  58. 11
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/ddm/FormDDMDisplay.java
  59. 32
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormLogImpl.java
  60. 33
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormTemplateLinkImpl.java
  61. 11
      liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/portlet/WorkflowFormAdminPortletControlPanelEntry.java
  62. 6
      liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/liferay-hook.xml
  63. 2
      liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogRequestPostAction.java
  64. 5
      liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogStartupAction.java
  65. 12
      liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogConstants.java
  66. 9
      liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogDestinationNames.java
  67. 47
      liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogFormat.java
  68. 1
      liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/html/init.jsp
  69. 1
      liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/view.jsp
  70. 2
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-display.xml
  71. 2
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-hook.xml
  72. 225
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/service.xml
  73. 4
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.properties
  74. 3
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.sql
  75. 6
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/tables.sql
  76. 22
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/messaging/MailManagerMessageListener.java
  77. 71
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailAttachmentLocalServiceImpl.java
  78. 285
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailLocalServiceImpl.java
  79. 121
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailTemplateLocalServiceImpl.java
  80. 16
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java
  81. 2
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailManagerUtil.java
  82. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/common/email_dialog_attachment.jsp
  83. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/edit.jsp
  84. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_send_popup_button.jsp
  85. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_template_action.jsp
  86. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/init.jsp
  87. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/close_popup.jsp
  88. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/init.jsp
  89. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/view.jsp
  90. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/toolbar.jsp
  91. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/view.jsp
  92. 3
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/init.jsp
  93. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/edit.jsp
  94. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_action.jsp
  95. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_history_popup_button.jsp
  96. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/init.jsp
  97. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/view.jsp
  98. 4
      liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/liferay-display.xml
  99. 62
      liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/service.xml
  100. 63
      liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/portlet/AdminMaintenancePortlet.java
  101. Some files were not shown because too many files have changed in this diff Show More

24
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/accesso/atti/NoSuchRichiestaAccessoAttiException.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.accesso.atti; package it.tref.liferay.portos.accesso.atti;
@ -11,28 +17,24 @@ package it.tref.liferay.portos.accesso.atti;
import com.liferay.portal.NoSuchModelException; import com.liferay.portal.NoSuchModelException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class NoSuchRichiestaAccessoAttiException extends NoSuchModelException { public class NoSuchRichiestaAccessoAttiException extends NoSuchModelException {
public NoSuchRichiestaAccessoAttiException() { public NoSuchRichiestaAccessoAttiException() {
super(); super();
} }
public NoSuchRichiestaAccessoAttiException(String msg) { public NoSuchRichiestaAccessoAttiException(String msg) {
super(msg); super(msg);
} }
public NoSuchRichiestaAccessoAttiException(String msg, Throwable cause) { public NoSuchRichiestaAccessoAttiException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
} }
public NoSuchRichiestaAccessoAttiException(Throwable cause) { public NoSuchRichiestaAccessoAttiException(Throwable cause) {
super(cause); super(cause);
} }
} }

285
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiBOPortlet.java

@ -52,66 +52,89 @@ import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortalUtil;
import com.liferay.util.bridges.mvc.MVCPortlet; import com.liferay.util.bridges.mvc.MVCPortlet;
/**
* Portlet implementation class AccessoAttiBOPortlet
*/
public class AccessoAttiBOPortlet extends MVCPortlet { public class AccessoAttiBOPortlet extends MVCPortlet {
public static final Log _log = LogFactoryUtil.getLog(AccessoAttiBOPortlet.class); public static final Log _log = LogFactoryUtil.getLog(AccessoAttiBOPortlet.class);
public void accettaRichiesta(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, public void accettaRichiesta(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, AddressException{
AddressException {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long richiestaAccessoAttiId = ParamUtil.getLong(actionRequest, "richiestaAccessoAttiId"); long richiestaAccessoAttiId = ParamUtil.getLong(actionRequest, "richiestaAccessoAttiId");
String testoEmail = ParamUtil.getString(actionRequest, "testoEmail"); String testoEmail = ParamUtil.getString(actionRequest, "testoEmail");
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); RichiestaAccessoAtti richiestaAccessoAtti =
if (richiestaAccessoAtti != null) { RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if(richiestaAccessoAtti != null){
String accessToken = AccessoAttiAccessTokenUtil.generateAccessToken(richiestaAccessoAttiId, String accessToken = AccessoAttiAccessTokenUtil.generateAccessToken(richiestaAccessoAttiId,
richiestaAccessoAtti.getNumeroProgetto(), richiestaAccessoAtti.getUserId()); richiestaAccessoAtti.getNumeroProgetto(), richiestaAccessoAtti.getUserId());
richiestaAccessoAtti.setFunzionarioId(themeDisplay.getUserId()); richiestaAccessoAtti.setFunzionarioId(themeDisplay.getUserId());
richiestaAccessoAtti.setGestita(true); richiestaAccessoAtti.setGestita(true);
richiestaAccessoAtti.setAccettata(true); richiestaAccessoAtti.setAccettata(true);
richiestaAccessoAtti.setDtAccettazione(new Date()); richiestaAccessoAtti.setDtAccettazione(new Date());
richiestaAccessoAtti.setAccessToken(accessToken); richiestaAccessoAtti.setAccessToken(accessToken);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti);
try { try {
String protocollo = ProtocolloUtil.protocollaArrivoAccessoAtti(richiestaAccessoAtti.getGroupId(), String protocollo = ProtocolloUtil.protocollaArrivoAccessoAtti(richiestaAccessoAtti.getGroupId(),
richiestaAccessoAtti.getCompanyId(), richiestaAccessoAtti.getUserName(), richiestaAccessoAtti.getCompanyId(), richiestaAccessoAtti.getUserName(),
richiestaAccessoAtti.getRichiestaAccessoAttiId(), RichiestaAccessoAtti.class.getName()); richiestaAccessoAtti.getRichiestaAccessoAttiId(), RichiestaAccessoAtti.class.getName());
richiestaAccessoAtti.setProtocolloUscita(protocollo); richiestaAccessoAtti.setProtocolloUscita(protocollo);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti);
} catch (Exception e) { } catch (Exception e) {
_log.error(e); _log.error(e);
} }
EmailSenderUtil.sendAcceptedEmail(richiestaAccessoAttiId, testoEmail); EmailSenderUtil.sendAcceptedEmail(richiestaAccessoAttiId, testoEmail);
} }
} }
public void rifiutaRichiesta(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, public void rifiutaRichiesta(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, AddressException{
AddressException {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long richiestaAccessoAttiId = ParamUtil.getLong(actionRequest, "richiestaAccessoAttiId"); long richiestaAccessoAttiId = ParamUtil.getLong(actionRequest, "richiestaAccessoAttiId");
String motivoRifiuto = ParamUtil.getString(actionRequest, "motivoRifiuto"); String motivoRifiuto = ParamUtil.getString(actionRequest, "motivoRifiuto");
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if (richiestaAccessoAtti != null) { RichiestaAccessoAtti richiestaAccessoAtti =
RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if(richiestaAccessoAtti != null){
richiestaAccessoAtti.setFunzionarioId(themeDisplay.getUserId()); richiestaAccessoAtti.setFunzionarioId(themeDisplay.getUserId());
richiestaAccessoAtti.setGestita(true); richiestaAccessoAtti.setGestita(true);
richiestaAccessoAtti.setAccettata(false); richiestaAccessoAtti.setAccettata(false);
richiestaAccessoAtti.setDtAccettazione(new Date()); richiestaAccessoAtti.setDtAccettazione(new Date());
richiestaAccessoAtti.setAccessToken("-1"); richiestaAccessoAtti.setAccessToken("-1");
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti);
try { try {
String protocollo = ProtocolloUtil.protocollaArrivoAccessoAtti(richiestaAccessoAtti.getGroupId(), String protocollo = ProtocolloUtil.protocollaArrivoAccessoAtti(richiestaAccessoAtti.getGroupId(),
richiestaAccessoAtti.getCompanyId(), richiestaAccessoAtti.getUserName(), richiestaAccessoAtti.getCompanyId(), richiestaAccessoAtti.getUserName(),
richiestaAccessoAtti.getRichiestaAccessoAttiId(), RichiestaAccessoAtti.class.getName()); richiestaAccessoAtti.getRichiestaAccessoAttiId(), RichiestaAccessoAtti.class.getName());
richiestaAccessoAtti.setProtocolloUscita(protocollo); richiestaAccessoAtti.setProtocolloUscita(protocollo);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti);
} catch (Exception e) { } catch (Exception e) {
_log.error(e); _log.error(e);
} }
EmailSenderUtil.sendDeniedEmail(richiestaAccessoAttiId, motivoRifiuto); EmailSenderUtil.sendDeniedEmail(richiestaAccessoAttiId, motivoRifiuto);
} }
} }
public void ricercaGestite(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException { public void ricercaGestite(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException {
@ -120,48 +143,65 @@ public class AccessoAttiBOPortlet extends MVCPortlet {
String protocollo = actionRequest.getParameter("protocollo"); String protocollo = actionRequest.getParameter("protocollo");
String dataDal = actionRequest.getParameter("dataDal"); String dataDal = actionRequest.getParameter("dataDal");
String dataAl = actionRequest.getParameter("dataAl"); String dataAl = actionRequest.getParameter("dataAl");
actionResponse.setRenderParameter("numeroProgetto", numeroProgetto); actionResponse.setRenderParameter("numeroProgetto", numeroProgetto);
actionResponse.setRenderParameter("protocollo", protocollo); actionResponse.setRenderParameter("protocollo", protocollo);
actionResponse.setRenderParameter("dataDal", dataDal); actionResponse.setRenderParameter("dataDal", dataDal);
actionResponse.setRenderParameter("dataAl", dataAl); actionResponse.setRenderParameter("dataAl", dataAl);
actionResponse.setRenderParameter("tabs1", "Richieste Concluse"); actionResponse.setRenderParameter("tabs1", "Richieste Concluse");
} }
@Override @Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, public void serveResource(ResourceRequest resourceRequest,
ResourceResponse resourceResponse) throws IOException,
PortletException { PortletException {
String id = resourceRequest.getResourceID(); String id = resourceRequest.getResourceID();
if ("exportRicerca".equals(id)) {
if("exportRicerca".equals(id)){
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
Locale locale = themeDisplay.getLocale(); Locale locale = themeDisplay.getLocale();
User user = themeDisplay.getUser(); User user = themeDisplay.getUser();
String csv = StringPool.BLANK; String csv = StringPool.BLANK;
HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest);
HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse); HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse);
try { try {
csv = exportSearch(locale, resourceRequest, user); csv = exportSearch(locale, resourceRequest, user);
} catch (SystemException | ParseException | PortalException e) { } catch (SystemException | ParseException | PortalException e) {
_log.error(e, e); _log.error(e,e);
} }
ServletResponseUtil.sendFile(request, response, "export_ricerca_accesso_atti_" + new Date().getTime()
+ ".csv", csv.getBytes(StringPool.UTF8), ContentTypes.TEXT_CSV_UTF8); ServletResponseUtil.sendFile(request, response, "export_ricerca_accesso_atti_"+ new Date().getTime() + ".csv", csv.getBytes(StringPool.UTF8),
ContentTypes.TEXT_CSV_UTF8);
} }
super.serveResource(resourceRequest, resourceResponse); super.serveResource(resourceRequest, resourceResponse);
} }
private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user) throws SystemException, private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user) throws SystemException, ParseException, PortalException {
ParseException, PortalException {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
String numeroProgetto = ParamUtil.getString(httpRequest, "numeroProgetto", StringPool.BLANK); String numeroProgetto = ParamUtil.getString(httpRequest, "numeroProgetto", StringPool.BLANK);
String protocollo = ParamUtil.getString(httpRequest, "protocollo", StringPool.BLANK); String protocollo = ParamUtil.getString(httpRequest, "protocollo", StringPool.BLANK);
String dataDal = ParamUtil.getString(httpRequest, "dataDal", StringPool.BLANK); String dataDal = ParamUtil.getString(httpRequest, "dataDal", StringPool.BLANK);
String dataAl = ParamUtil.getString(httpRequest, "dataAl", StringPool.BLANK); String dataAl = ParamUtil.getString(httpRequest, "dataAl", StringPool.BLANK);
List<RichiestaAccessoAtti> lista = RichiestaAccessoAttiLocalServiceUtil.findCompletate(numeroProgetto,
protocollo, dataDal, dataAl, -1, -1); List<RichiestaAccessoAtti> lista =
RichiestaAccessoAttiLocalServiceUtil.findCompletate(numeroProgetto, protocollo, dataDal, dataAl, -1, -1);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "Utente Richiedente"))); sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "Utente Richiedente")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "Data Gestione"))); sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "Data Gestione")));
@ -182,68 +222,98 @@ public class AccessoAttiBOPortlet extends MVCPortlet {
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "Gestita Da"))); sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "Gestita Da")));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
for (RichiestaAccessoAtti atto : lista) { for (RichiestaAccessoAtti atto : lista) {
sb.append(CSVUtil.encode(UserLocalServiceUtil.getUser(atto.getUserId()).getFullName())); sb.append(CSVUtil.encode(UserLocalServiceUtil.getUser(atto.getUserId()).getFullName()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(sdf.format(atto.getDtAccettazione()))); sb.append(CSVUtil.encode(sdf.format(atto.getDtAccettazione())));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(atto.getProtocolloEntrata())); sb.append(CSVUtil.encode(atto.getProtocolloEntrata()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(atto.getProtocolloUscita())); sb.append(CSVUtil.encode(atto.getProtocolloUscita()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(atto.getNumeroProgetto())); sb.append(CSVUtil.encode(atto.getNumeroProgetto()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(sdf.format(atto.getDtVidimazione()))); sb.append(CSVUtil.encode(sdf.format(atto.getDtVidimazione())));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(atto.getSanatoria() ? "SI" : "NO")); sb.append(CSVUtil.encode(atto.getSanatoria() ? "SI" : "NO"));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
if (atto.getIntPraticaId() != 0L) {
if(atto.getIntPraticaId() != 0L){
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(atto.getTerritorioId()); Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(atto.getTerritorioId());
Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId()); Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId());
Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(themeDisplay.getCompanyId(), Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(themeDisplay.getCompanyId(), comune.getCodiceProvincia());
comune.getCodiceProvincia());
sb.append(CSVUtil.encode(provincia.getProvincia())); sb.append(CSVUtil.encode(provincia.getProvincia()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
} else { } else {
sb.append(CSVUtil.encode("")); sb.append(CSVUtil.encode(""));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
} }
sb.append(CSVUtil.encode(atto.getAccettata() ? "SI" : "NO")); sb.append(CSVUtil.encode(atto.getAccettata() ? "SI" : "NO"));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(CSVUtil.encode(UserLocalServiceUtil.getUser(atto.getFunzionarioId()).getFullName())); sb.append(CSVUtil.encode(UserLocalServiceUtil.getUser(atto.getFunzionarioId()).getFullName()));
sb.append(StringPool.SEMICOLON); sb.append(StringPool.SEMICOLON);
sb.append(StringPool.NEW_LINE); sb.append(StringPool.NEW_LINE);
} }
return sb.toString(); return sb.toString();
} }
public void aggiungiRichiestaBO(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, public void aggiungiRichiestaBO(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, AddressException, ParseException{
AddressException, ParseException {
long accessoAttiId = 0L; long accessoAttiId = 0L;
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date dataCheck = sdf.parse("01/01/2015"); Date dataCheck = sdf.parse("01/01/2015");
boolean isNoCNSUser = ParamUtil.getBoolean(actionRequest, "isNoCNSUser"); boolean isNoCNSUser = ParamUtil.getBoolean(actionRequest, "isNoCNSUser");
String codiceFiscale = ParamUtil.getString(actionRequest, "codiceFiscale"); String codiceFiscale = ParamUtil.getString(actionRequest, "codiceFiscale");
String emailRicontatto = ParamUtil.getString(actionRequest, "emailRicontatto"); String emailRicontatto = ParamUtil.getString(actionRequest, "emailRicontatto");
String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto"); String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto");
Date dataVidimazione = ParamUtil.getDate(actionRequest, "dataVidimazione", sdf); Date dataVidimazione = ParamUtil.getDate(actionRequest, "dataVidimazione", sdf);
String qualitaPersona = ParamUtil.getString(actionRequest, "qualitaPersona"); String qualitaPersona = ParamUtil.getString(actionRequest, "qualitaPersona");
String visione = ParamUtil.getString(actionRequest, "visione"); String visione = ParamUtil.getString(actionRequest, "visione");
String copiaDettaglio = ParamUtil.getString(actionRequest, "copiaDett"); String copiaDettaglio = ParamUtil.getString(actionRequest, "copiaDett");
String motivazione = ParamUtil.getString(actionRequest, "motivazione"); String motivazione = ParamUtil.getString(actionRequest, "motivazione");
boolean sanatoria = ParamUtil.getBoolean(actionRequest, "sanatoria"); boolean sanatoria = ParamUtil.getBoolean(actionRequest, "sanatoria");
if (numeroProgetto != null && !numeroProgetto.equalsIgnoreCase("")) {
if (!dataVidimazione.before(dataCheck) && !sanatoria) { if(numeroProgetto != null && !numeroProgetto.equalsIgnoreCase("")){
if(!dataVidimazione.before(dataCheck) && !sanatoria){
IntPratica intPratica = IntPraticaLocalServiceUtil.findByNumeroProgetto(numeroProgetto); IntPratica intPratica = IntPraticaLocalServiceUtil.findByNumeroProgetto(numeroProgetto);
if (intPratica != null) { if(intPratica != null){
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.createRichiestaAccessoAtti(CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.createRichiestaAccessoAtti(
.getName())); CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class.getName()));
accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId();
richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId());
richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId()); richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId());
richiestaAccessoAtti.setGroupId(intPratica.getGroupId()); richiestaAccessoAtti.setGroupId(intPratica.getGroupId());
@ -254,139 +324,194 @@ public class AccessoAttiBOPortlet extends MVCPortlet {
richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); richiestaAccessoAtti.setMotivazioneRichiesta(motivazione);
richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); richiestaAccessoAtti.setNumeroProgetto(numeroProgetto);
richiestaAccessoAtti.setSanatoria(sanatoria); richiestaAccessoAtti.setSanatoria(sanatoria);
if (sanatoria) {
if(sanatoria){
Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf);
richiestaAccessoAtti.setDtSanatoria(dataSanatoria); richiestaAccessoAtti.setDtSanatoria(dataSanatoria);
} }
richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); richiestaAccessoAtti.setTipologiaPersona(qualitaPersona);
if (visione.equalsIgnoreCase("copia")) {
if(visione.equalsIgnoreCase("copia")){
richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio);
} }
richiestaAccessoAtti.setTipologiaRichiesta(visione); richiestaAccessoAtti.setTipologiaRichiesta(visione);
User loggedUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(),
codiceFiscale.toLowerCase()); User loggedUser =
if (loggedUser != null) { UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), codiceFiscale.toLowerCase());
if(loggedUser != null){
richiestaAccessoAtti.setUserId(loggedUser.getUserId()); richiestaAccessoAtti.setUserId(loggedUser.getUserId());
richiestaAccessoAtti.setUserName(loggedUser.getScreenName()); richiestaAccessoAtti.setUserName(loggedUser.getScreenName());
} else { } else {
richiestaAccessoAtti.setUserName(codiceFiscale.toLowerCase()); richiestaAccessoAtti.setUserName(codiceFiscale.toLowerCase());
} }
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti);
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
if (dataVidimazione.before(dataCheck) || sanatoria) {
if (uploadRequest.getSize("allegatoPagamento") != 0) { if(dataVidimazione.before(dataCheck) || sanatoria){
if(uploadRequest.getSize("allegatoPagamento") != 0){
String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); String sourceFileName = uploadRequest.getFileName("allegatoPagamento");
File fileApp = uploadRequest.getFile("allegatoPagamento"); File fileApp = uploadRequest.getFile("allegatoPagamento");
long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti(
themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, true);
sourceFileName, fileApp, true);
RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate);
} }
} }
if (isNoCNSUser) {
if (uploadRequest.getSize("documentoIdentita") != 0) { if(isNoCNSUser){
if(uploadRequest.getSize("documentoIdentita") != 0){
String sourceFileName = uploadRequest.getFileName("documentoIdentita"); String sourceFileName = uploadRequest.getFileName("documentoIdentita");
File fileApp = uploadRequest.getFile("documentoIdentita"); File fileApp = uploadRequest.getFile("documentoIdentita");
long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti(
themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, false);
sourceFileName, fileApp, false);
RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate);
} }
} }
RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(accessoAttiId); RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(accessoAttiId);
try { try {
String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(
richiesta.getRichiestaAccessoAttiId(), richiesta.getIntPraticaId(), String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(richiesta.getRichiestaAccessoAttiId(),
richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(), richiesta.getCompanyId(), richiesta.getIntPraticaId(), richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(),
richiesta.getUserName()); richiesta.getCompanyId(), richiesta.getUserName());
richiesta.setProtocolloEntrata(protocollo); richiesta.setProtocolloEntrata(protocollo);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta);
} catch (Exception e) { } catch (Exception e) {
_log.error(e); _log.error(e);
} }
EmailSenderUtil.sendAcceptedRequest(accessoAttiId); EmailSenderUtil.sendAcceptedRequest(accessoAttiId);
actionResponse.setRenderParameter("jspPage", "/html/accesso_atti_fe/richiesta-inviata-success.jsp"); actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp");
} else { } else {
SessionErrors.add(actionRequest, "atto-non-esistente"); SessionErrors.add(actionRequest, "atto-non-esistente");
} }
} else { } else {
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.createRichiestaAccessoAtti(CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.createRichiestaAccessoAtti(
.getName())); CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class.getName()));
accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId();
richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId());
// richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId());
// richiestaAccessoAtti.setGroupId(intPratica.getGroupId());
// richiestaAccessoAtti.setTerritorioId(intPratica.getTerritorioId());
richiestaAccessoAtti.setCreateDate(new Date()); richiestaAccessoAtti.setCreateDate(new Date());
richiestaAccessoAtti.setEmailRicontatto(emailRicontatto); richiestaAccessoAtti.setEmailRicontatto(emailRicontatto);
richiestaAccessoAtti.setDtVidimazione(dataVidimazione); richiestaAccessoAtti.setDtVidimazione(dataVidimazione);
richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); richiestaAccessoAtti.setMotivazioneRichiesta(motivazione);
richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); richiestaAccessoAtti.setNumeroProgetto(numeroProgetto);
richiestaAccessoAtti.setSanatoria(sanatoria); richiestaAccessoAtti.setSanatoria(sanatoria);
if (sanatoria) { if(sanatoria){
Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf);
richiestaAccessoAtti.setDtSanatoria(dataSanatoria); richiestaAccessoAtti.setDtSanatoria(dataSanatoria);
} }
richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); richiestaAccessoAtti.setTipologiaPersona(qualitaPersona);
if (visione.equalsIgnoreCase("copia")) {
if(visione.equalsIgnoreCase("copia")){
richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio);
} }
richiestaAccessoAtti.setTipologiaRichiesta(visione); richiestaAccessoAtti.setTipologiaRichiesta(visione);
User loggedUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(),
codiceFiscale.toLowerCase()); User loggedUser =
if (loggedUser != null) { UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), codiceFiscale.toLowerCase());
if(loggedUser != null){
richiestaAccessoAtti.setUserId(loggedUser.getUserId()); richiestaAccessoAtti.setUserId(loggedUser.getUserId());
richiestaAccessoAtti.setUserName(loggedUser.getScreenName()); richiestaAccessoAtti.setUserName(loggedUser.getScreenName());
} else { } else {
richiestaAccessoAtti.setUserName(codiceFiscale.toLowerCase()); richiestaAccessoAtti.setUserName(codiceFiscale.toLowerCase());
} }
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti);
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
if (dataVidimazione.before(dataCheck) || sanatoria) {
if (uploadRequest.getSize("allegatoPagamento") != 0) { if(dataVidimazione.before(dataCheck) || sanatoria){
if(uploadRequest.getSize("allegatoPagamento") != 0){
String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); String sourceFileName = uploadRequest.getFileName("allegatoPagamento");
File fileApp = uploadRequest.getFile("allegatoPagamento"); File fileApp = uploadRequest.getFile("allegatoPagamento");
long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti(
themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, true);
sourceFileName, fileApp, true);
RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate);
} }
} }
if (isNoCNSUser) {
if (uploadRequest.getSize("documentoIdentita") != 0) { if(isNoCNSUser){
if(uploadRequest.getSize("documentoIdentita") != 0){
String sourceFileName = uploadRequest.getFileName("documentoIdentita"); String sourceFileName = uploadRequest.getFileName("documentoIdentita");
File fileApp = uploadRequest.getFile("documentoIdentita"); File fileApp = uploadRequest.getFile("documentoIdentita");
long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti(
themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, false);
sourceFileName, fileApp, false);
RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate);
} }
} }
RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(accessoAttiId); RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(accessoAttiId);
try { try {
String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(
richiesta.getRichiestaAccessoAttiId(), richiesta.getIntPraticaId(), richiesta.getGroupId(), String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(richiesta.getRichiestaAccessoAttiId(),
RichiestaAccessoAtti.class.getName(), richiesta.getCompanyId(), richiesta.getUserName()); richiesta.getIntPraticaId(), richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(),
richiesta.getCompanyId(), richiesta.getUserName());
richiesta.setProtocolloEntrata(protocollo); richiesta.setProtocolloEntrata(protocollo);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta);
} catch (Exception e) { } catch (Exception e) {
_log.error(e); _log.error(e);
} }
EmailSenderUtil.sendAcceptedRequest(accessoAttiId); EmailSenderUtil.sendAcceptedRequest(accessoAttiId);
actionResponse.setRenderParameter("jspPage", "/html/accesso_atti_fe/richiesta-inviata-success.jsp"); actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp");
} }
} }
} }
} }

234
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiFEPortlet.java

@ -30,34 +30,47 @@ import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortalUtil;
import com.liferay.util.bridges.mvc.MVCPortlet; import com.liferay.util.bridges.mvc.MVCPortlet;
/**
* Portlet implementation class AccessoAttiFEPortlet
*/
public class AccessoAttiFEPortlet extends MVCPortlet { public class AccessoAttiFEPortlet extends MVCPortlet {
public static final Log _log = LogFactoryUtil.getLog(AccessoAttiFEPortlet.class); public static final Log _log = LogFactoryUtil.getLog(AccessoAttiFEPortlet.class);
public void inviaRichiestaAccessoAtti(ActionRequest actionRequest, ActionResponse actionResponse) public void inviaRichiestaAccessoAtti(ActionRequest actionRequest, ActionResponse actionResponse) throws ParseException, SystemException, AddressException{
throws ParseException, SystemException, AddressException {
long accessoAttiId = 0L; long accessoAttiId = 0L;
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date dataCheck = sdf.parse("01/01/2015"); Date dataCheck = sdf.parse("01/01/2015");
boolean isNoCNSUser = ParamUtil.getBoolean(actionRequest, "isNoCNSUser"); boolean isNoCNSUser = ParamUtil.getBoolean(actionRequest, "isNoCNSUser");
String emailRicontatto = ParamUtil.getString(actionRequest, "emailRicontatto"); String emailRicontatto = ParamUtil.getString(actionRequest, "emailRicontatto");
String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto"); String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto");
Date dataVidimazione = ParamUtil.getDate(actionRequest, "dataVidimazione", sdf); Date dataVidimazione = ParamUtil.getDate(actionRequest, "dataVidimazione", sdf);
String qualitaPersona = ParamUtil.getString(actionRequest, "qualitaPersona"); String qualitaPersona = ParamUtil.getString(actionRequest, "qualitaPersona");
String visione = ParamUtil.getString(actionRequest, "visione"); String visione = ParamUtil.getString(actionRequest, "visione");
String copiaDettaglio = ParamUtil.getString(actionRequest, "copiaDett"); String copiaDettaglio = ParamUtil.getString(actionRequest, "copiaDett");
String motivazione = ParamUtil.getString(actionRequest, "motivazione"); String motivazione = ParamUtil.getString(actionRequest, "motivazione");
boolean sanatoria = ParamUtil.getBoolean(actionRequest, "sanatoria"); boolean sanatoria = ParamUtil.getBoolean(actionRequest, "sanatoria");
if (numeroProgetto != null && !numeroProgetto.equalsIgnoreCase("")) {
if (!dataVidimazione.before(dataCheck) && !sanatoria) { if(numeroProgetto != null && !numeroProgetto.equalsIgnoreCase("")){
if(!dataVidimazione.before(dataCheck) && !sanatoria){
IntPratica intPratica = IntPraticaLocalServiceUtil.findByNumeroProgetto(numeroProgetto); IntPratica intPratica = IntPraticaLocalServiceUtil.findByNumeroProgetto(numeroProgetto);
if (intPratica != null) { if(intPratica != null){
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.createRichiestaAccessoAtti(CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.createRichiestaAccessoAtti(
.getName())); CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class.getName()));
accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId();
richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId());
richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId()); richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId());
richiestaAccessoAtti.setGroupId(intPratica.getGroupId()); richiestaAccessoAtti.setGroupId(intPratica.getGroupId());
@ -68,144 +81,202 @@ public class AccessoAttiFEPortlet extends MVCPortlet {
richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); richiestaAccessoAtti.setMotivazioneRichiesta(motivazione);
richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); richiestaAccessoAtti.setNumeroProgetto(numeroProgetto);
richiestaAccessoAtti.setSanatoria(sanatoria); richiestaAccessoAtti.setSanatoria(sanatoria);
if (sanatoria) {
if(sanatoria){
Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf);
richiestaAccessoAtti.setDtSanatoria(dataSanatoria); richiestaAccessoAtti.setDtSanatoria(dataSanatoria);
} }
richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); richiestaAccessoAtti.setTipologiaPersona(qualitaPersona);
if (visione.equalsIgnoreCase("copia")) {
if(visione.equalsIgnoreCase("copia")){
richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio);
} }
richiestaAccessoAtti.setTipologiaRichiesta(visione); richiestaAccessoAtti.setTipologiaRichiesta(visione);
richiestaAccessoAtti.setUserId(themeDisplay.getUserId()); richiestaAccessoAtti.setUserId(themeDisplay.getUserId());
richiestaAccessoAtti.setUserName(themeDisplay.getUser().getScreenName()); richiestaAccessoAtti.setUserName(themeDisplay.getUser().getScreenName());
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti);
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
if (dataVidimazione.before(dataCheck) || sanatoria) {
if (uploadRequest.getSize("allegatoPagamento") != 0) { if(dataVidimazione.before(dataCheck) || sanatoria){
if(uploadRequest.getSize("allegatoPagamento") != 0){
String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); String sourceFileName = uploadRequest.getFileName("allegatoPagamento");
File fileApp = uploadRequest.getFile("allegatoPagamento"); File fileApp = uploadRequest.getFile("allegatoPagamento");
long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti(
themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, true);
sourceFileName, fileApp, true);
RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate);
} }
} }
if (isNoCNSUser) {
if (uploadRequest.getSize("documentoIdentita") != 0) { if(isNoCNSUser){
if(uploadRequest.getSize("documentoIdentita") != 0){
String sourceFileName = uploadRequest.getFileName("documentoIdentita"); String sourceFileName = uploadRequest.getFileName("documentoIdentita");
File fileApp = uploadRequest.getFile("documentoIdentita"); File fileApp = uploadRequest.getFile("documentoIdentita");
long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti(
themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, false);
sourceFileName, fileApp, false);
RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate);
} }
} }
RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(accessoAttiId); RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(accessoAttiId);
try { try {
String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(
richiesta.getRichiestaAccessoAttiId(), richiesta.getIntPraticaId(), String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(richiesta.getRichiestaAccessoAttiId(),
richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(), richiesta.getCompanyId(), richiesta.getIntPraticaId(), richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(),
richiesta.getUserName()); richiesta.getCompanyId(), richiesta.getUserName());
richiesta.setProtocolloEntrata(protocollo); richiesta.setProtocolloEntrata(protocollo);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta);
} catch (Exception e) { } catch (Exception e) {
_log.error(e); _log.error(e);
} }
EmailSenderUtil.sendAcceptedRequest(accessoAttiId); EmailSenderUtil.sendAcceptedRequest(accessoAttiId);
actionResponse.setRenderParameter("jspPage", "/html/accesso_atti_fe/richiesta-inviata-success.jsp"); actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp");
} else { } else {
SessionErrors.add(actionRequest, "atto-non-esistente"); SessionErrors.add(actionRequest, "atto-non-esistente");
} }
} else { } else {
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.createRichiestaAccessoAtti(CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.createRichiestaAccessoAtti(
.getName())); CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class.getName()));
accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId();
richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId());
// richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId());
// richiestaAccessoAtti.setGroupId(intPratica.getGroupId());
// richiestaAccessoAtti.setTerritorioId(intPratica.getTerritorioId());
richiestaAccessoAtti.setCreateDate(new Date()); richiestaAccessoAtti.setCreateDate(new Date());
richiestaAccessoAtti.setEmailRicontatto(emailRicontatto); richiestaAccessoAtti.setEmailRicontatto(emailRicontatto);
richiestaAccessoAtti.setDtVidimazione(dataVidimazione); richiestaAccessoAtti.setDtVidimazione(dataVidimazione);
richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); richiestaAccessoAtti.setMotivazioneRichiesta(motivazione);
richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); richiestaAccessoAtti.setNumeroProgetto(numeroProgetto);
richiestaAccessoAtti.setSanatoria(sanatoria); richiestaAccessoAtti.setSanatoria(sanatoria);
if (sanatoria) { if(sanatoria){
Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf);
richiestaAccessoAtti.setDtSanatoria(dataSanatoria); richiestaAccessoAtti.setDtSanatoria(dataSanatoria);
} }
richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); richiestaAccessoAtti.setTipologiaPersona(qualitaPersona);
if (visione.equalsIgnoreCase("copia")) {
if(visione.equalsIgnoreCase("copia")){
richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio);
} }
richiestaAccessoAtti.setTipologiaRichiesta(visione); richiestaAccessoAtti.setTipologiaRichiesta(visione);
richiestaAccessoAtti.setUserId(themeDisplay.getUserId()); richiestaAccessoAtti.setUserId(themeDisplay.getUserId());
richiestaAccessoAtti.setUserName(themeDisplay.getUser().getScreenName()); richiestaAccessoAtti.setUserName(themeDisplay.getUser().getScreenName());
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti);
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
if (dataVidimazione.before(dataCheck) || sanatoria) {
if (uploadRequest.getSize("allegatoPagamento") != 0) { if(dataVidimazione.before(dataCheck) || sanatoria){
if(uploadRequest.getSize("allegatoPagamento") != 0){
String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); String sourceFileName = uploadRequest.getFileName("allegatoPagamento");
File fileApp = uploadRequest.getFile("allegatoPagamento"); File fileApp = uploadRequest.getFile("allegatoPagamento");
long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti(
themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, true);
sourceFileName, fileApp, true);
RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate);
} }
} }
if (isNoCNSUser) {
if (uploadRequest.getSize("documentoIdentita") != 0) { if(isNoCNSUser){
if(uploadRequest.getSize("documentoIdentita") != 0){
String sourceFileName = uploadRequest.getFileName("documentoIdentita"); String sourceFileName = uploadRequest.getFileName("documentoIdentita");
File fileApp = uploadRequest.getFile("documentoIdentita"); File fileApp = uploadRequest.getFile("documentoIdentita");
long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti(
themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, false);
sourceFileName, fileApp, false);
RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId());
richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate);
} }
} }
RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(accessoAttiId); RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(accessoAttiId);
try { try {
String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(
richiesta.getRichiestaAccessoAttiId(), richiesta.getIntPraticaId(), richiesta.getGroupId(), String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(richiesta.getRichiestaAccessoAttiId(),
RichiestaAccessoAtti.class.getName(), richiesta.getCompanyId(), richiesta.getUserName()); richiesta.getIntPraticaId(), richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(),
richiesta.getCompanyId(), richiesta.getUserName());
richiesta.setProtocolloEntrata(protocollo); richiesta.setProtocolloEntrata(protocollo);
RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta);
} catch (Exception e) { } catch (Exception e) {
_log.error(e); _log.error(e);
} }
EmailSenderUtil.sendAcceptedRequest(accessoAttiId); EmailSenderUtil.sendAcceptedRequest(accessoAttiId);
actionResponse.setRenderParameter("jspPage", "/html/accesso_atti_fe/richiesta-inviata-success.jsp"); actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp");
} }
} }
} }
public void visualizzaAtto(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException { public void visualizzaAtto(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException {
actionResponse.setRenderParameter("tabs1", "Visualizza Atto"); actionResponse.setRenderParameter("tabs1", "Visualizza Atto");
actionRequest.setAttribute("tabs1", "Visualizza Atto"); actionRequest.setAttribute("tabs1", "Visualizza Atto");
String accessToken = ParamUtil.getString(actionRequest, "accessToken"); String accessToken = ParamUtil.getString(actionRequest, "accessToken");
RichiestaAccessoAtti atto = RichiestaAccessoAttiLocalServiceUtil.findByAccessToken(accessToken); RichiestaAccessoAtti atto = RichiestaAccessoAttiLocalServiceUtil.findByAccessToken(accessToken);
if (atto != null) { if(atto != null){
if (atto.isAccettata()) {
if(atto.isAccettata()){
Calendar calApp = Calendar.getInstance(); Calendar calApp = Calendar.getInstance();
calApp.setTime(atto.getDtAccettazione()); calApp.setTime(atto.getDtAccettazione());
calApp.add(Calendar.DATE, 7); calApp.add(Calendar.DATE, 7);
Date checkDate = calApp.getTime(); Date checkDate = calApp.getTime();
if (new Date().before(checkDate)) { if(new Date().before(checkDate) ){
actionResponse.setRenderParameter("accessoAttiId", "" + atto.getRichiestaAccessoAttiId());
actionResponse.setRenderParameter("accessoAttiId", ""+atto.getRichiestaAccessoAttiId());
} else { } else {
SessionErrors.add(actionRequest, "accesso-token-scaduto"); SessionErrors.add(actionRequest, "accesso-token-scaduto");
} }
@ -215,5 +286,56 @@ public class AccessoAttiFEPortlet extends MVCPortlet {
} else { } else {
SessionErrors.add(actionRequest, "no-atto-trovato"); SessionErrors.add(actionRequest, "no-atto-trovato");
} }
} }
} }

46
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/CreazioneAccountPortosPortlet.java

@ -27,69 +27,85 @@ import com.liferay.util.bridges.mvc.MVCPortlet;
*/ */
public class CreazioneAccountPortosPortlet extends MVCPortlet { public class CreazioneAccountPortosPortlet extends MVCPortlet {
public void creaAccount(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException,
ParseException, PortalException { public void creaAccount(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, ParseException, PortalException{
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String username = ParamUtil.getString(actionRequest, "codiceFiscale"); String username = ParamUtil.getString(actionRequest, "codiceFiscale");
String password = ParamUtil.getString(actionRequest, "password"); String password = ParamUtil.getString(actionRequest, "password");
String email = ParamUtil.getString(actionRequest, "indirizzoEmail"); String email = ParamUtil.getString(actionRequest, "indirizzoEmail");
String nome = ParamUtil.getString(actionRequest, "nome"); String nome = ParamUtil.getString(actionRequest, "nome");
String cognome = ParamUtil.getString(actionRequest, "cognome"); String cognome = ParamUtil.getString(actionRequest, "cognome");
String dataNascita = ParamUtil.getString(actionRequest, "dataNascita"); String dataNascita = ParamUtil.getString(actionRequest, "dataNascita");
if (username != null) {
User checkUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), if(username != null){
username.toLowerCase()); User checkUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), username.toLowerCase());
if (checkUser == null) { if(checkUser == null){
Date dateOfBirthday = sdf.parse(dataNascita); Date dateOfBirthday = sdf.parse(dataNascita);
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(dateOfBirthday); cal.setTime(dateOfBirthday);
int birthdayMonth = cal.get(Calendar.MONTH); int birthdayMonth = cal.get(Calendar.MONTH);
int birthdayDay = cal.get(Calendar.DAY_OF_MONTH); int birthdayDay = cal.get(Calendar.DAY_OF_MONTH);;
; int birthdayYear = cal.get(Calendar.YEAR);;
int birthdayYear = cal.get(Calendar.YEAR);
;
long creatorUserId = 0; long creatorUserId = 0;
long facebookId = 0; long facebookId = 0;
int prefixId = 0; int prefixId = 0;
int suffixId = 0; int suffixId = 0;
long groupIds[] = new long[0]; long groupIds[] = new long[0];
long organizationIds[] = new long[0]; long organizationIds[] = new long[0];
long roleIds[] = new long[0]; long roleIds[] = new long[0];
long userGroupIds[] = new long[0]; long userGroupIds[] = new long[0];
boolean autoPassword = false; boolean autoPassword = false;
boolean autoScreenName = false; boolean autoScreenName = false;
boolean male = true; boolean male = true;
boolean sendEmail = true; boolean sendEmail = true;
String password1 = password; String password1 = password;
String password2 = password; String password2 = password;
String screenName = username; String screenName = username;
String openId = null; String openId = null;
String middleName = null; String middleName = null;
String jobTitle = null; String jobTitle = null;
Date now = new Date(); Date now = new Date();
Locale locale = themeDisplay.getLocale(); Locale locale = themeDisplay.getLocale();
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
User user = UserLocalServiceUtil.addUser(creatorUserId, themeDisplay.getCompanyId(), autoPassword,
password1, password2, autoScreenName, screenName, email, facebookId, openId, locale, nome, User user = UserLocalServiceUtil.addUser(creatorUserId, themeDisplay.getCompanyId(), autoPassword, password1, password2,
middleName, cognome, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, autoScreenName, screenName, email, facebookId, openId, locale, nome, middleName, cognome, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);
jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);
long userId = user.getUserId(); long userId = user.getUserId();
User userCreated = UserLocalServiceUtil.getUser(userId); User userCreated = UserLocalServiceUtil.getUser(userId);
userCreated.setLoginDate(now); userCreated.setLoginDate(now);
userCreated.setLoginIP("127.0.0.1"); userCreated.setLoginIP("127.0.0.1");
userCreated.setLastLoginDate(now); userCreated.setLastLoginDate(now);
userCreated.setModifiedDate(now); userCreated.setModifiedDate(now);
Role roleUserNoCNS = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), "UTENTE_NO_CNS"); Role roleUserNoCNS = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), "UTENTE_NO_CNS");
UserLocalServiceUtil.addRoleUser(roleUserNoCNS.getRoleId(), userId); UserLocalServiceUtil.addRoleUser(roleUserNoCNS.getRoleId(), userId);
UserLocalServiceUtil.updateAgreedToTermsOfUse(userId, true); UserLocalServiceUtil.updateAgreedToTermsOfUse(userId, true);
UserLocalServiceUtil.updateEmailAddressVerified(userId, true); UserLocalServiceUtil.updateEmailAddressVerified(userId, true);
UserLocalServiceUtil.updatePasswordReset(userId, false); UserLocalServiceUtil.updatePasswordReset(userId, false);
} else { } else {
SessionErrors.add(actionRequest, "error-user-exist"); SessionErrors.add(actionRequest, "error-user-exist");
} }
} }
actionResponse.setRenderParameter("jspPage", "/html/creazione_account/success.jsp");
actionResponse.setRenderParameter("jspPage","/html/creazione_account/success.jsp");
} }
} }

22
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/base/RichiestaAccessoAttiLocalServiceClpInvoker.java

@ -19,7 +19,7 @@ import it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServ
import java.util.Arrays; import java.util.Arrays;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @generated * @generated
*/ */
public class RichiestaAccessoAttiLocalServiceClpInvoker { public class RichiestaAccessoAttiLocalServiceClpInvoker {
@ -132,13 +132,13 @@ public class RichiestaAccessoAttiLocalServiceClpInvoker {
"java.lang.String" "java.lang.String"
}; };
_methodName44 = "findByAccessToken"; _methodName43 = "findByAccessToken";
_methodParameterTypes44 = new String[] { "java.lang.String" }; _methodParameterTypes43 = new String[] { "java.lang.String" };
_methodName45 = "findRichiesteByGroup"; _methodName44 = "findRichiesteByGroup";
_methodParameterTypes45 = new String[] { "long", "int", "int" }; _methodParameterTypes44 = new String[] { "long", "int", "int" };
} }
public Object invokeMethod(String name, String[] parameterTypes, public Object invokeMethod(String name, String[] parameterTypes,
@ -265,13 +265,13 @@ public class RichiestaAccessoAttiLocalServiceClpInvoker {
(java.lang.String)arguments[3]); (java.lang.String)arguments[3]);
} }
if (_methodName44.equals(name) && if (_methodName43.equals(name) &&
Arrays.deepEquals(_methodParameterTypes44, parameterTypes)) { Arrays.deepEquals(_methodParameterTypes43, parameterTypes)) {
return RichiestaAccessoAttiLocalServiceUtil.findByAccessToken((java.lang.String)arguments[0]); return RichiestaAccessoAttiLocalServiceUtil.findByAccessToken((java.lang.String)arguments[0]);
} }
if (_methodName45.equals(name) && if (_methodName44.equals(name) &&
Arrays.deepEquals(_methodParameterTypes45, parameterTypes)) { Arrays.deepEquals(_methodParameterTypes44, parameterTypes)) {
return RichiestaAccessoAttiLocalServiceUtil.findRichiesteByGroup(((Long)arguments[0]).longValue(), return RichiestaAccessoAttiLocalServiceUtil.findRichiesteByGroup(((Long)arguments[0]).longValue(),
((Integer)arguments[1]).intValue(), ((Integer)arguments[1]).intValue(),
((Integer)arguments[2]).intValue()); ((Integer)arguments[2]).intValue());
@ -322,8 +322,8 @@ public class RichiestaAccessoAttiLocalServiceClpInvoker {
private String[] _methodParameterTypes41; private String[] _methodParameterTypes41;
private String _methodName42; private String _methodName42;
private String[] _methodParameterTypes42; private String[] _methodParameterTypes42;
private String _methodName43;
private String[] _methodParameterTypes43;
private String _methodName44; private String _methodName44;
private String[] _methodParameterTypes44; private String[] _methodParameterTypes44;
private String _methodName45;
private String[] _methodParameterTypes45;
} }

245
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.accesso.atti.service.impl; package it.tref.liferay.portos.accesso.atti.service.impl;
@ -20,125 +26,222 @@ import java.util.List;
import com.liferay.portal.kernel.dao.orm.Disjunction; import com.liferay.portal.kernel.dao.orm.Disjunction;
import com.liferay.portal.kernel.dao.orm.DynamicQuery; import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.Property;
import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil; import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Organization; import com.liferay.portal.model.Organization;
import com.liferay.portal.service.OrganizationLocalServiceUtil; import com.liferay.portal.service.OrganizationLocalServiceUtil;
/** /**
* The implementation of the richiesta accesso atti local service. * The implementation of the richiesta accesso atti local service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * 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.accesso.atti.service.RichiestaAccessoAttiLocalService} interface.
* their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalService} *
* interface.
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * 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.
* credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiLocalServiceBaseImpl * @see it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiLocalServiceBaseImpl
* @see it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil * @see it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil
*/ */
public class RichiestaAccessoAttiLocalServiceImpl extends RichiestaAccessoAttiLocalServiceBaseImpl { public class RichiestaAccessoAttiLocalServiceImpl
extends RichiestaAccessoAttiLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil} to access the richiesta accesso *
* atti local service. * Never reference this interface directly. Always use {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil} to access the richiesta accesso atti local service.
*/ */
private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); public List<RichiestaAccessoAtti> findByGestita(boolean gestita, int start, int end) throws SystemException{
return richiestaAccessoAttiPersistence.findByGestita(gestita, start, end);
}
@Override public List<RichiestaAccessoAtti> findCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl, int start, int end) throws SystemException, ParseException{
public List<RichiestaAccessoAtti> findByGestita(boolean gestita, int start, int end) throws SystemException {
return richiestaAccessoAttiPersistence.findByGestita(gestita, start, end); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery dq = richiestaAccessoAttiLocalService.dynamicQuery();
dq.add(RestrictionsFactoryUtil.eq("gestita", true));
if(!numeroProgetto.equals("")){
dq.add(RestrictionsFactoryUtil.eq("numeroProgetto", numeroProgetto));
} }
@SuppressWarnings("unchecked") if(!protocollo.equals("")){
@Override
public List<RichiestaAccessoAtti> findCompletate(String numeroProgetto, String protocollo, String dataDal,
String dataAl, int start, int end) throws SystemException {
return dynamicQuery(dqCompletate(numeroProgetto, protocollo, dataDal, dataAl), start, end); Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
disjunction.add(PropertyFactoryUtil.forName("protocolloEntrata").eq(protocollo));
disjunction.add(PropertyFactoryUtil.forName("protocolloUscita").eq(protocollo));
dq.add(disjunction);
} }
@Override if(!dataDal.equals("") && !dataAl.equals("")){
public int countCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl)
throws SystemException { Date dateDal = sdf.parse(dataDal);
Calendar calDal = Calendar.getInstance();
calDal.setTime(dateDal);
calDal.set(Calendar.HOUR_OF_DAY, 00);
calDal.set(Calendar.MINUTE, 00);
dateDal = calDal.getTime();
Date dateAl = sdf.parse(dataAl);
Calendar calAl = Calendar.getInstance();
calAl.setTime(dateAl);
calAl.set(Calendar.HOUR_OF_DAY, 23);
calAl.set(Calendar.MINUTE, 59);
dateAl = calAl.getTime();
Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione");
dq.add(createDateProperty.between(dateDal, dateAl));
}
if(!dataDal.equals("") && dataAl.equals("")){
Date dateDal = sdf.parse(dataDal);
Calendar calDal = Calendar.getInstance();
calDal.setTime(dateDal);
calDal.set(Calendar.HOUR_OF_DAY, 00);
calDal.set(Calendar.MINUTE, 00);
dateDal = calDal.getTime();
Date now = new Date();
Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione");
dq.add(createDateProperty.between(dateDal, now));
}
if(dataDal.equals("") && !dataAl.equals("")){
Date now = new Date("01/01/2018");
Date dateAl = sdf.parse(dataAl);
Calendar calAl = Calendar.getInstance();
calAl.setTime(dateAl);
calAl.set(Calendar.HOUR_OF_DAY, 23);
calAl.set(Calendar.MINUTE, 59);
dateAl = calAl.getTime();
Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione");
dq.add(createDateProperty.between(now, dateAl));
}
return dynamicQuery(dqCompletate(numeroProgetto, protocollo, dataDal, dataAl)).size(); return richiestaAccessoAttiLocalService.dynamicQuery(dq, start, end);
} }
private DynamicQuery dqCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl) { public int countCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl) throws SystemException, ParseException{
DynamicQuery dq = dynamicQuery(); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery dq = richiestaAccessoAttiLocalService.dynamicQuery();
dq.add(RestrictionsFactoryUtil.eq("gestita", true)); dq.add(RestrictionsFactoryUtil.eq("gestita", true));
if (Validator.isNotNull(numeroProgetto)) {
if(!numeroProgetto.equals("")){
dq.add(RestrictionsFactoryUtil.eq("numeroProgetto", numeroProgetto)); dq.add(RestrictionsFactoryUtil.eq("numeroProgetto", numeroProgetto));
} }
if (Validator.isNotNull(protocollo)) {
if(!protocollo.equals("")){
Disjunction disjunction = RestrictionsFactoryUtil.disjunction(); Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
disjunction.add(PropertyFactoryUtil.forName("protocolloEntrata").eq(protocollo)); disjunction.add(PropertyFactoryUtil.forName("protocolloEntrata").eq(protocollo));
disjunction.add(PropertyFactoryUtil.forName("protocolloUscita").eq(protocollo)); disjunction.add(PropertyFactoryUtil.forName("protocolloUscita").eq(protocollo));
dq.add(disjunction); dq.add(disjunction);
} }
dq.add(PropertyFactoryUtil.forName("dtAccettazione").between(parseStartDate(dataDal), parseEndDate(dataAl)));
return dq; if(!dataDal.equals("") && !dataAl.equals("")){
Date dateDal = sdf.parse(dataDal);
Calendar calDal = Calendar.getInstance();
calDal.setTime(dateDal);
calDal.set(Calendar.HOUR_OF_DAY, 00);
calDal.set(Calendar.MINUTE, 00);
dateDal = calDal.getTime();
Date dateAl = sdf.parse(dataAl);
Calendar calAl = Calendar.getInstance();
calAl.setTime(dateAl);
calAl.set(Calendar.HOUR_OF_DAY, 23);
calAl.set(Calendar.MINUTE, 59);
dateAl = calAl.getTime();
Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione");
dq.add(createDateProperty.between(dateDal, dateAl));
} }
@Override if(!dataDal.equals("") && dataAl.equals("")){
public RichiestaAccessoAtti findByAccessToken(String accessToken) throws SystemException {
Date dateDal = sdf.parse(dataDal);
Calendar calDal = Calendar.getInstance();
calDal.setTime(dateDal);
calDal.set(Calendar.HOUR_OF_DAY, 00);
calDal.set(Calendar.MINUTE, 00);
dateDal = calDal.getTime();
Date now = new Date();
Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione");
dq.add(createDateProperty.between(dateDal, now));
DynamicQuery dq = dynamicQuery();
dq.add(RestrictionsFactoryUtil.eq("accessToken", accessToken));
@SuppressWarnings("unchecked")
List<RichiestaAccessoAtti> lista = dynamicQuery(dq);
return lista == null || lista.isEmpty() ? null : lista.get(0);
} }
@SuppressWarnings("unchecked") if(dataDal.equals("") && !dataAl.equals("")){
@Override
public List<RichiestaAccessoAtti> findRichiesteByGroup(long userId, int start, int end) throws SystemException { Date now = new Date("01/01/2018");
Date dateAl = sdf.parse(dataAl);
Calendar calAl = Calendar.getInstance();
calAl.setTime(dateAl);
calAl.set(Calendar.HOUR_OF_DAY, 23);
calAl.set(Calendar.MINUTE, 59);
dateAl = calAl.getTime();
Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione");
dq.add(createDateProperty.between(now, dateAl));
List<Long> groupIds = new ArrayList<>();
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(userId);
if (Validator.isNull(organizationList)) {
for (Organization organization : organizationList) {
groupIds.add(organization.getGroupId());
} }
List<RichiestaAccessoAtti> lista = richiestaAccessoAttiLocalService.dynamicQuery(dq);
return lista.size();
} }
DynamicQuery dq = dynamicQuery();
dq.add(RestrictionsFactoryUtil.eq("gestita", false)); public RichiestaAccessoAtti findByAccessToken(String accessToken) throws SystemException{
if (!groupIds.isEmpty()) {
dq.add(RestrictionsFactoryUtil.in("groupId", groupIds)); DynamicQuery dq = richiestaAccessoAttiLocalService.dynamicQuery();
dq.add(RestrictionsFactoryUtil.eq("accessToken", accessToken));
List<RichiestaAccessoAtti> lista = richiestaAccessoAttiLocalService.dynamicQuery(dq);
if(lista != null && !lista.isEmpty()){
return lista.get(0);
} }
return dynamicQuery(dq, start, end);
return null;
} }
private static Date parseEndDate(String input) { public List<RichiestaAccessoAtti> findRichiesteByGroup(long userId, int start, int end) throws SystemException{
List<Long> listaLong = new ArrayList<Long>();
return parseDate(input, false); List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(userId);
if(organizationList != null && !organizationList.isEmpty()){
for (Organization organization : organizationList) {
listaLong.add(organization.getGroupId());
}
} }
private static Date parseStartDate(String input) { listaLong.add(0L);
return parseDate(input, true); DynamicQuery dq = richiestaAccessoAttiLocalService.dynamicQuery();
} dq.add(RestrictionsFactoryUtil.eq("gestita", false));
dq.add(RestrictionsFactoryUtil.in("groupId", listaLong));
private static Date parseDate(String input, boolean isStart) { return richiestaAccessoAttiLocalService.dynamicQuery(dq, start, end);
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(sdf.parse(input));
} catch (ParseException e) {
calendar.setTime(isStart ? new Date(0) : new Date());
}
calendar.set(Calendar.HOUR_OF_DAY, isStart ? 0 : 23);
calendar.set(Calendar.MINUTE, isStart ? 0 : 59);
calendar.set(Calendar.SECOND, isStart ? 0 : 59);
return calendar.getTime();
} }
} }

35
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiServiceImpl.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.accesso.atti.service.impl; package it.tref.liferay.portos.accesso.atti.service.impl;
@ -12,22 +18,23 @@ import it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiServ
/** /**
* The implementation of the richiesta accesso atti remote service. * The implementation of the richiesta accesso atti remote service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * 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.accesso.atti.service.RichiestaAccessoAttiService} interface.
* their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiService} interface. *
* <p> * <p>
* This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
* credentials because this service can be accessed remotely.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiServiceBaseImpl * @see it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiServiceBaseImpl
* @see it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil * @see it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil
*/ */
public class RichiestaAccessoAttiServiceImpl extends RichiestaAccessoAttiServiceBaseImpl { public class RichiestaAccessoAttiServiceImpl
extends RichiestaAccessoAttiServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil} to access the richiesta accesso atti *
* remote service. * Never reference this interface directly. Always use {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil} to access the richiesta accesso atti remote service.
*/ */
} }

18
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java

@ -11,21 +11,31 @@ public class AccessoAttiAccessTokenUtil {
private static final Log _log = LogFactoryUtil.getLog(AccessoAttiAccessTokenUtil.class); private static final Log _log = LogFactoryUtil.getLog(AccessoAttiAccessTokenUtil.class);
public static String generateAccessToken(long richiestaAccessoAttiId, String numeroProgetto, long richiedenteUserId) { public static String generateAccessToken(long richiestaAccessoAttiId, String numeroProgetto, long richiedenteUserId){
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
try { try {
String concatString = String.valueOf(richiestaAccessoAttiId) + StringPool.UNDERLINE + numeroProgetto
+ StringPool.UNDERLINE + richiedenteUserId; String concatString = String.valueOf(richiestaAccessoAttiId) + StringPool.UNDERLINE +
numeroProgetto + StringPool.UNDERLINE + richiedenteUserId;
MessageDigest md = MessageDigest.getInstance("MD5"); MessageDigest md = MessageDigest.getInstance("MD5");
md.update(concatString.getBytes()); md.update(concatString.getBytes());
byte byteData[] = md.digest(); byte byteData[] = md.digest();
for (int i = 0; i < byteData.length; i++) { for (int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)); sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
} }
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
_log.error(e, e); _log.error(e,e);
} }
return sb.toString(); return sb.toString();
} }
} }

47
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java

@ -11,7 +11,6 @@ import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.repository.model.FileEntry; import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.util.FileUtil; import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portlet.documentlibrary.model.DLFolder; import com.liferay.portlet.documentlibrary.model.DLFolder;
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
@ -25,43 +24,55 @@ public class DocumentLibraryUtil {
public static final String PAGAMENTO_CODEC_FILENAME = "PAGAMENTO_"; public static final String PAGAMENTO_CODEC_FILENAME = "PAGAMENTO_";
public static final String DOCUMENTO_CODEC_FILENAME = "DOCUMENTO_"; public static final String DOCUMENTO_CODEC_FILENAME = "DOCUMENTO_";
public static long saveFileEntryAccessoAtti(long companyGroupId, long richiestaAccessoAttiId, public static long saveFileEntryAccessoAtti(long companyGroupId, long richiestaAccessoAttiId, String originFileName,
String originFileName, File file, boolean pagamento) { File file, boolean pagamento) {
long fileEntryId = 0L; long fileEntryId = 0L;
try { try {
DLFolder folder = getRichiestaAttiFolder(companyGroupId); DLFolder folder = getRichiestaAttiFolder(companyGroupId);
if (folder != null) { if(folder != null){
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); RichiestaAccessoAtti richiestaAccessoAtti =
if (richiestaAccessoAtti != null) { RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if(richiestaAccessoAtti != null){
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(richiestaAccessoAtti.getCompanyId()); serviceContext.setCompanyId(richiestaAccessoAtti.getCompanyId());
serviceContext.setUserId(richiestaAccessoAtti.getUserId()); serviceContext.setUserId(richiestaAccessoAtti.getUserId());
String mineType = FileUtil.getExtension(originFileName); String mineType = FileUtil.getExtension(originFileName);
String prefixedFileName = StringPool.BLANK;
if (pagamento) { String prefixedFileName = "";
prefixedFileName = PAGAMENTO_CODEC_FILENAME + richiestaAccessoAttiId + StringPool.PERIOD if(pagamento){
+ mineType; prefixedFileName = PAGAMENTO_CODEC_FILENAME + richiestaAccessoAttiId + "." + mineType;
} else { } else {
prefixedFileName = DOCUMENTO_CODEC_FILENAME + richiestaAccessoAttiId + StringPool.PERIOD prefixedFileName = DOCUMENTO_CODEC_FILENAME + richiestaAccessoAttiId + "." + mineType;
+ mineType;
} }
FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(richiestaAccessoAtti.getUserId(),
folder.getRepositoryId(), folder.getFolderId(), prefixedFileName, mineType, FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(
prefixedFileName, StringPool.BLANK, StringPool.BLANK, file, serviceContext); richiestaAccessoAtti.getUserId(), folder.getRepositoryId(), folder.getFolderId(),
prefixedFileName, mineType, prefixedFileName, "", "", file, serviceContext);
fileEntryId = fileEntry.getFileEntryId(); fileEntryId = fileEntry.getFileEntryId();
} }
} }
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
_log.error(e, e); _log.error(e,e);
} }
return fileEntryId; return fileEntryId;
} }
private static DLFolder getRichiestaAttiFolder(long companyGroupId) throws PortalException, SystemException { private static DLFolder getRichiestaAttiFolder(long companyGroupId) throws PortalException, SystemException{
DLFolder folder = DLFolderLocalServiceUtil.getFolder(companyGroupId, 0L, RICHIESTA_ATTI_FOLDER_NAME); DLFolder folder = DLFolderLocalServiceUtil.getFolder(companyGroupId, 0L, RICHIESTA_ATTI_FOLDER_NAME);
return folder; return folder;
} }
} }

98
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/EmailSenderUtil.java

@ -12,119 +12,175 @@ import com.liferay.portal.kernel.mail.MailMessage;
public class EmailSenderUtil { public class EmailSenderUtil {
public static void sendAcceptedEmail(long richiestaAccessoAttiId, String testoAggiuntivo) throws SystemException, // private static final Log _log = LogFactoryUtil.getLog(EmailSenderUtil.class);
AddressException {
public static void sendAcceptedEmail(long richiestaAccessoAttiId, String testoAggiuntivo) throws SystemException, AddressException{
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if(richiestaAccessoAtti != null){
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if (richiestaAccessoAtti != null) {
InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto()); InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto());
InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it"); InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it");
MailMessage mailMessage = new MailMessage(); MailMessage mailMessage = new MailMessage();
mailMessage.setTo(toAddress); mailMessage.setTo(toAddress);
mailMessage.setFrom(fromAddress); mailMessage.setFrom(fromAddress);
mailMessage.setSubject("Notifica Accettazione Richiesta Accesso Atti"); mailMessage.setSubject("Notifica Accettazione Richiesta Accesso Atti");
mailMessage.setBody(creaCorpoMailRichiestaAccettata(richiestaAccessoAtti, testoAggiuntivo)); mailMessage.setBody(creaCorpoMailRichiestaAccettata(richiestaAccessoAtti,testoAggiuntivo));
mailMessage.setHTMLFormat(true); mailMessage.setHTMLFormat(true);
/*
* Invio email
*/
MailServiceUtil.sendEmail(mailMessage); MailServiceUtil.sendEmail(mailMessage);
} }
} }
public static void sendDeniedEmail(long richiestaAccessoAttiId, String motivoRifiuto) throws SystemException, public static void sendDeniedEmail(long richiestaAccessoAttiId, String motivoRifiuto) throws SystemException, AddressException{
AddressException {
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if(richiestaAccessoAtti != null){
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if (richiestaAccessoAtti != null) {
InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto()); InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto());
InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it"); InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it");
MailMessage mailMessage = new MailMessage(); MailMessage mailMessage = new MailMessage();
mailMessage.setTo(toAddress); mailMessage.setTo(toAddress);
mailMessage.setFrom(fromAddress); mailMessage.setFrom(fromAddress);
mailMessage.setSubject("Notifica Rifiuto Richiesta Accesso Atti"); mailMessage.setSubject("Notifica Rifiuto Richiesta Accesso Atti");
mailMessage.setBody(creaCorpoMailRichiestaRifiutata(richiestaAccessoAtti, motivoRifiuto)); mailMessage.setBody(creaCorpoMailRichiestaRifiutata(richiestaAccessoAtti, motivoRifiuto));
mailMessage.setHTMLFormat(true); mailMessage.setHTMLFormat(true);
/*
* Invio email
*/
MailServiceUtil.sendEmail(mailMessage); MailServiceUtil.sendEmail(mailMessage);
} }
} }
public static void sendAcceptedRequest(long richiestaAccessoAttiId) throws SystemException, AddressException { public static void sendAcceptedRequest(long richiestaAccessoAttiId) throws SystemException, AddressException{
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if(richiestaAccessoAtti != null){
RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil
.fetchRichiestaAccessoAtti(richiestaAccessoAttiId);
if (richiestaAccessoAtti != null) {
InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto()); InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto());
InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it"); InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it");
MailMessage mailMessage = new MailMessage(); MailMessage mailMessage = new MailMessage();
mailMessage.setTo(toAddress); mailMessage.setTo(toAddress);
mailMessage.setFrom(fromAddress); mailMessage.setFrom(fromAddress);
mailMessage.setSubject("Notifica Presa In Carico Richiesta"); mailMessage.setSubject("Notifica Presa In Carico Richiesta");
mailMessage.setBody(creaCorpoMailRichiestaInCarico(richiestaAccessoAtti)); mailMessage.setBody(creaCorpoMailRichiestaInCarico(richiestaAccessoAtti));
mailMessage.setHTMLFormat(true); mailMessage.setHTMLFormat(true);
/*
* Invio email
*/
MailServiceUtil.sendEmail(mailMessage); MailServiceUtil.sendEmail(mailMessage);
} }
} }
private static String creaCorpoMailRichiestaInCarico(RichiestaAccessoAtti richiestaAccessoAtti) { private static String creaCorpoMailRichiestaInCarico(RichiestaAccessoAtti richiestaAccessoAtti){
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
/*
* Gestione header
*/
sb.append("<html><head><title>Notifica Presa In Carico Richiesta</title></head><body>"); sb.append("<html><head><title>Notifica Presa In Carico Richiesta</title></head><body>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("Salve ,"); sb.append("Salve ,");
sb.append("</div>"); sb.append("</div>");
sb.append("<br/>"); sb.append("<br/>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("con la seguente email le comunichiamo che la sua richiesta n. "); sb.append("con la seguente email le comunichiamo che la sua richiesta n. ");
sb.append(richiestaAccessoAtti.getProtocolloEntrata()); sb.append(richiestaAccessoAtti.getProtocolloEntrata());
sb.append(" di accedere all'atto numero "); sb.append(" di accedere all'atto numero ");
sb.append(richiestaAccessoAtti.getNumeroProgetto()); sb.append(richiestaAccessoAtti.getNumeroProgetto());
sb.append(" è stata presa in carico dai nostri funzionari. Riceverà successivamente una mail nella quale le verrà indicato l'esito della sua richiesta."); sb.append(" è stata presa in carico dai nostri funzionari. Riceverà successivamente una mail nella quale le verrà indicato l'esito della sua richiesta.");
sb.append("<br/>"); sb.append("<br/>");
sb.append("<br/>"); sb.append("<br/>");
return sb.toString(); return sb.toString();
} }
private static String creaCorpoMailRichiestaAccettata(RichiestaAccessoAtti richiestaAccessoAtti, String testoExtra) { private static String creaCorpoMailRichiestaAccettata(RichiestaAccessoAtti richiestaAccessoAtti, String testoExtra){
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
/*
* Gestione header
*/
sb.append("<html><head><title>Notifica Accettazione Richiesta Accesso Atti</title></head><body>"); sb.append("<html><head><title>Notifica Accettazione Richiesta Accesso Atti</title></head><body>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("Salve ,"); sb.append("Salve ,");
sb.append("</div>"); sb.append("</div>");
sb.append("<br/>"); sb.append("<br/>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("con la seguente email le comunichiamo che la sua richiesta n. "); sb.append("con la seguente email le comunichiamo che la sua richiesta n. ");
sb.append(richiestaAccessoAtti.getProtocolloUscita()); sb.append(richiestaAccessoAtti.getProtocolloUscita());
sb.append(" di accedere all'atto numero "); sb.append(" di accedere all'atto numero ");
sb.append(richiestaAccessoAtti.getNumeroProgetto()); sb.append(richiestaAccessoAtti.getNumeroProgetto());
sb.append(" è stata accettata."); sb.append(" è stata accettata.");
sb.append("<br/>"); sb.append("<br/>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("Il suo codice di accesso al fascicolo è il seguente: <strong>"); sb.append("Il suo codice di accesso al fascicolo è il seguente: <strong>");
sb.append(richiestaAccessoAtti.getAccessToken()); sb.append(richiestaAccessoAtti.getAccessToken());
sb.append("</strong>"); sb.append("</strong>");
sb.append("</div>"); sb.append("</div>");
sb.append("<br/>"); sb.append("<br/>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append(testoExtra); sb.append(testoExtra);
sb.append("</div>"); sb.append("</div>");
sb.append("<br/>"); sb.append("<br/>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("Le ricordiamo che l'accesso avrà una validità di 7 giorni."); sb.append("Le ricordiamo che l'accesso avrà una validità di 7 giorni.");
sb.append("</div>"); sb.append("</div>");
sb.append("<br/>"); sb.append("<br/>");
return sb.toString(); return sb.toString();
} }
private static String creaCorpoMailRichiestaRifiutata(RichiestaAccessoAtti richiestaAccessoAtti, public static void sendDeniedEmail(){
String motivoRifiuto) {
}
private static String creaCorpoMailRichiestaRifiutata(RichiestaAccessoAtti richiestaAccessoAtti, String motivoRifiuto){
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
/*
* Gestione header
*/
sb.append("<html><head><title>Notifica Rifiuto Richiesta Accesso Atti</title></head><body>"); sb.append("<html><head><title>Notifica Rifiuto Richiesta Accesso Atti</title></head><body>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("Salve ,"); sb.append("Salve ,");
sb.append("</div>"); sb.append("</div>");
sb.append("<br/>"); sb.append("<br/>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("con la seguente email le comunichiamo che la sua richiesta n. "); sb.append("con la seguente email le comunichiamo che la sua richiesta n. ");
sb.append(richiestaAccessoAtti.getProtocolloUscita()); sb.append(richiestaAccessoAtti.getProtocolloUscita());
@ -133,6 +189,10 @@ public class EmailSenderUtil {
sb.append(" è stata rifiutata per la seguente motivazione: "); sb.append(" è stata rifiutata per la seguente motivazione: ");
sb.append(motivoRifiuto); sb.append(motivoRifiuto);
sb.append("<br/>"); sb.append("<br/>");
return sb.toString(); return sb.toString();
} }
} }

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

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

19
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateFunzionarioException.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.portos.calendar.appointments; package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class DuplicateFunzionarioException extends PortalException { public class DuplicateFunzionarioException extends PortalException {
public DuplicateFunzionarioException() { public DuplicateFunzionarioException() {

19
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicatePrenotazioneException.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.portos.calendar.appointments; package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class DuplicatePrenotazioneException extends PortalException { public class DuplicatePrenotazioneException extends PortalException {
public DuplicatePrenotazioneException() { public DuplicatePrenotazioneException() {

19
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateProfessionistaException.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.portos.calendar.appointments; package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class DuplicateProfessionistaException extends PortalException { public class DuplicateProfessionistaException extends PortalException {
public DuplicateProfessionistaException() { public DuplicateProfessionistaException() {

19
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchDisponibilitaException.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.portos.calendar.appointments; package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
import com.liferay.portal.NoSuchModelException; import com.liferay.portal.NoSuchModelException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class NoSuchDisponibilitaException extends NoSuchModelException { public class NoSuchDisponibilitaException extends NoSuchModelException {
public NoSuchDisponibilitaException() { public NoSuchDisponibilitaException() {

19
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchFunzionarioException.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.portos.calendar.appointments; package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
import com.liferay.portal.NoSuchModelException; import com.liferay.portal.NoSuchModelException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class NoSuchFunzionarioException extends NoSuchModelException { public class NoSuchFunzionarioException extends NoSuchModelException {
public NoSuchFunzionarioException() { public NoSuchFunzionarioException() {

19
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchPrenotazioneException.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.portos.calendar.appointments; package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
import com.liferay.portal.NoSuchModelException; import com.liferay.portal.NoSuchModelException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class NoSuchPrenotazioneException extends NoSuchModelException { public class NoSuchPrenotazioneException extends NoSuchModelException {
public NoSuchPrenotazioneException() { public NoSuchPrenotazioneException() {

19
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchProfessionistaException.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.portos.calendar.appointments; package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
import com.liferay.portal.NoSuchModelException; import com.liferay.portal.NoSuchModelException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class NoSuchProfessionistaException extends NoSuchModelException { public class NoSuchProfessionistaException extends NoSuchModelException {
public NoSuchProfessionistaException() { public NoSuchProfessionistaException() {

19
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/SlotNotAvailableException.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.portos.calendar.appointments; package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
/** /**
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class SlotNotAvailableException extends PortalException { public class SlotNotAvailableException extends PortalException {
public SlotNotAvailableException() { public SlotNotAvailableException() {

8
liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/liferay-portlet.xml

@ -5,14 +5,10 @@
<portlet> <portlet>
<portlet-name>1</portlet-name> <portlet-name>1</portlet-name>
<icon>/icon.png</icon> <icon>/icon.png</icon>
<control-panel-entry-category> <control-panel-entry-category>configuration</control-panel-entry-category>
configuration
</control-panel-entry-category>
<control-panel-entry-weight>1.5</control-panel-entry-weight> <control-panel-entry-weight>1.5</control-panel-entry-weight>
<header-portlet-css>/css/main.css</header-portlet-css> <header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript> <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
/js/main.js
</footer-portlet-javascript>
<css-class-wrapper>1-portlet</css-class-wrapper> <css-class-wrapper>1-portlet</css-class-wrapper>
</portlet> </portlet>
<role-mapper> <role-mapper>

18
liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/companyconfig/portlet/CompanyConfigurationPortlet.java

@ -1,24 +1,30 @@
package it.tref.liferay.portos.companyconfig.portlet; package it.tref.liferay.portos.companyconfig.portlet;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.model.Company; import com.liferay.portal.model.Company;
import com.liferay.portal.service.CompanyLocalServiceUtil; import com.liferay.portal.service.CompanyLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory; import com.liferay.portal.service.ServiceContextFactory;
import com.liferay.util.bridges.mvc.MVCPortlet; import com.liferay.util.bridges.mvc.MVCPortlet;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
public class CompanyConfigurationPortlet extends MVCPortlet { public class CompanyConfigurationPortlet extends MVCPortlet {
public void saveCustomFields(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, public void saveCustomFields(ActionRequest actionRequest,
ActionResponse actionResponse) throws PortalException,
SystemException { SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(Company.class.getName(), actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(
Company company = CompanyLocalServiceUtil.getCompany(serviceContext.getCompanyId()); Company.class.getName(), actionRequest);
Company company = CompanyLocalServiceUtil.getCompany(serviceContext
.getCompanyId());
company.setExpandoBridgeAttributes(serviceContext); company.setExpandoBridgeAttributes(serviceContext);
CompanyLocalServiceUtil.updateCompany(company); CompanyLocalServiceUtil.updateCompany(company);
} }
} }

1
liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/init.jsp" %> <%@include file="/html/init.jsp" %>
<%@page import="com.liferay.portal.kernel.util.ParamUtil"%> <%@page import="com.liferay.portal.kernel.util.ParamUtil"%>

27
liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/view.jsp

@ -1,25 +1,38 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="javax.portlet.PortletURL"%> <%@page import="javax.portlet.PortletURL"%>
<%@page import="javax.portlet.PortletRequest"%> <%@page import="javax.portlet.PortletRequest"%>
<%@page import="com.liferay.portal.util.PortletKeys"%> <%@page import="com.liferay.portal.util.PortletKeys"%>
<%@page import="com.liferay.portlet.PortletURLFactoryUtil"%> <%@page import="com.liferay.portlet.PortletURLFactoryUtil"%>
<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> <%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>
<%@include file="/html/company_configuration/init.jsp"%> <%@include file="/html/company_configuration/init.jsp" %>
<% <%
PortletURL companyCustomFieldsURL = PortletURLFactoryUtil.create(request, PortletKeys.EXPANDO, plid, PortletRequest.RENDER_PHASE); PortletURL companyCustomFieldsURL = PortletURLFactoryUtil.create(request, PortletKeys.EXPANDO, plid, PortletRequest.RENDER_PHASE);
companyCustomFieldsURL.setWindowState(LiferayWindowState.POP_UP); companyCustomFieldsURL.setWindowState(LiferayWindowState.POP_UP);
companyCustomFieldsURL.setParameter("struts_action", "/expando/view_attributes"); companyCustomFieldsURL.setParameter("struts_action", "/expando/view_attributes");
companyCustomFieldsURL.setParameter("modelResource", Company.class.getName()); companyCustomFieldsURL.setParameter("modelResource", Company.class.getName());
%> %>
<liferay-ui:icon message="manage-company-custom-fields" url="<%= companyCustomFieldsURL.toString() %>" label="true"
iconCssClass="icon-edit" linkCssClass="btn" useDialog="true" /> <liferay-ui:icon
<portlet:actionURL name="saveCustomFields" var="saveCustomFieldsURL" /> message="manage-company-custom-fields"
url="<%=companyCustomFieldsURL.toString() %>"
label="true"
iconCssClass="icon-edit"
linkCssClass="btn"
useDialog="true"
/>
<portlet:actionURL name="saveCustomFields" var="saveCustomFieldsURL"></portlet:actionURL>
<div class="separator"></div> <div class="separator"></div>
<aui:form name="fm" action="<%=saveCustomFieldsURL.toString() %>"> <aui:form name="fm" action="<%=saveCustomFieldsURL.toString() %>">
<aui:fieldset> <aui:fieldset>
<liferay-ui:custom-attribute-list className="<%= Company.class.getName() %>" <liferay-ui:custom-attribute-list
className="<%= Company.class.getName() %>"
classPK="<%= (company != null) ? company.getCompanyId() : 0 %>" classPK="<%= (company != null) ? company.getCompanyId() : 0 %>"
editable="true" label="true" /> editable="<%= true %>"
label="<%= true %>"
/>
</aui:fieldset> </aui:fieldset>
<aui:button type="submit" value="btn-save-custom-fields"></aui:button> <aui:button type="submit" value="btn-save-custom-fields"></aui:button>
</aui:form> </aui:form>

1
liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

57
liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/cookies/action/StartUpAction.java

@ -1,5 +1,6 @@
package it.tref.liferay.portos.cookies.action; package it.tref.liferay.portos.cookies.action;
import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.SimpleAction; import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
@ -25,7 +26,7 @@ import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil;
public class StartUpAction extends SimpleAction { public class StartUpAction extends SimpleAction {
private static final Log _log = LogFactoryUtil.getLog(StartUpAction.class); private final static Log _log = LogFactoryUtil.getLog(StartUpAction.class);
@Override @Override
public void run(String[] companyIds) throws ActionException { public void run(String[] companyIds) throws ActionException {
@ -33,8 +34,10 @@ public class StartUpAction extends SimpleAction {
for (String id : companyIds) { for (String id : companyIds) {
try { try {
long companyId = GetterUtil.getLong(id); long companyId = GetterUtil.getLong(id);
String[] defaultActions = { ActionKeys.VIEW, ActionKeys.UPDATE };
String[] guestActions = { ActionKeys.VIEW }; String[] defaultActions = {ActionKeys.VIEW, ActionKeys.UPDATE};
String[] guestActions = {ActionKeys.VIEW};
// Organization custom fields // Organization custom fields
addExpandoColumnIfNotExists(companyId, Group.class.getName(), "cookiesJournalarticleId", addExpandoColumnIfNotExists(companyId, Group.class.getName(), "cookiesJournalarticleId",
ExpandoColumnConstants.STRING, true, false, defaultActions, guestActions); ExpandoColumnConstants.STRING, true, false, defaultActions, guestActions);
@ -48,50 +51,72 @@ public class StartUpAction extends SimpleAction {
boolean indexed, boolean hidden, String[] defaultActions, String[] guestActions) throws SystemException { boolean indexed, boolean hidden, String[] defaultActions, String[] guestActions) throws SystemException {
long classNameId = PortalUtil.getClassNameId(className); long classNameId = PortalUtil.getClassNameId(className);
ExpandoTable expandoTable = null; ExpandoTable expandoTable = null;
try { try {
expandoTable = ExpandoTableLocalServiceUtil.getTable(companyId, classNameId, expandoTable =
ExpandoTableConstants.DEFAULT_TABLE_NAME); ExpandoTableLocalServiceUtil.getTable(companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME);
} catch (PortalException e) { } catch (PortalException e) {
try { try {
expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId, classNameId, expandoTable =
ExpandoTableConstants.DEFAULT_TABLE_NAME); ExpandoTableLocalServiceUtil.addTable(companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME);
} catch (PortalException e1) {} } catch (PortalException e1) {
} }
}
ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), name); ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), name);
if (expandoColumn == null) { if (expandoColumn == null) {
try { try {
expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), name, type); expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), name, type);
} catch (PortalException e) {} } catch (PortalException e) {
} }
}
try { try {
if (indexed) { if (indexed) {
UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties();
typeSettingsProperties.put(ExpandoColumnConstants.INDEX_TYPE, typeSettingsProperties.put(ExpandoColumnConstants.INDEX_TYPE,
String.valueOf(ExpandoColumnConstants.INDEX_TYPE_TEXT)); String.valueOf(ExpandoColumnConstants.INDEX_TYPE_TEXT));
expandoColumn.setTypeSettingsProperties(typeSettingsProperties); expandoColumn.setTypeSettingsProperties(typeSettingsProperties);
expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn);
} }
if (hidden) { if (hidden) {
UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties();
typeSettingsProperties.put(ExpandoColumnConstants.PROPERTY_HIDDEN, String.valueOf(1)); typeSettingsProperties.put(ExpandoColumnConstants.PROPERTY_HIDDEN, String.valueOf(1));
expandoColumn.setTypeSettingsProperties(typeSettingsProperties); expandoColumn.setTypeSettingsProperties(typeSettingsProperties);
expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn);
} }
Role roleGuest = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST); Role roleGuest = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST);
Role rolePowerUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.POWER_USER); Role rolePowerUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.POWER_USER);
Role roleUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER); Role roleUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER);
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), roleGuest.getRoleId(),
roleGuest.getRoleId(), guestActions); guestActions);
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), rolePowerUser.getRoleId(),
rolePowerUser.getRoleId(), defaultActions); defaultActions);
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), roleUser.getRoleId(),
roleUser.getRoleId(), defaultActions); defaultActions);
} catch (PortalException e) {} } catch (PortalException e) {
}
return expandoColumn; return expandoColumn;
} }
} }

1
liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.text.SimpleDateFormat"%> <%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.liferay.portlet.PortletURLUtil"%> <%@page import="com.liferay.portlet.PortletURLUtil"%>

1
liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/view.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.util.PortalUtil"%> <%@page import="com.liferay.portal.util.PortalUtil"%>
<%@page import="com.liferay.portal.kernel.util.Validator"%> <%@page import="com.liferay.portal.kernel.util.Validator"%>
<%@page import="com.liferay.portal.kernel.util.StringPool"%> <%@page import="com.liferay.portal.kernel.util.StringPool"%>

5
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/portlet.xml

@ -1,9 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
<portlet> <portlet>
<portlet-name>1</portlet-name> <portlet-name>1</portlet-name>
<display-name>Deploy Alert</display-name> <display-name>Deploy Alert</display-name>

44
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/action/DeployAction.java

@ -1,14 +1,5 @@
package it.tref.liferay.portos.deployalert.action; package it.tref.liferay.portos.deployalert.action;
import it.tref.liferay.portos.deployalert.constants.MailConstants;
import it.tref.liferay.portos.deployalert.model.NotificationMail;
import it.tref.liferay.portos.deployalert.service.NotificationLogLocalServiceUtil;
import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil;
import it.tref.liferay.portos.deployalert.util.DeployAlertUtil;
import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil;
import java.util.List;
import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.SimpleAction; import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
@ -25,12 +16,29 @@ import com.liferay.portal.model.Company;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortalUtil;
import it.tref.liferay.portos.deployalert.constants.MailConstants;
import it.tref.liferay.portos.deployalert.model.NotificationMail;
import it.tref.liferay.portos.deployalert.service.NotificationLogLocalServiceUtil;
import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil;
import it.tref.liferay.portos.deployalert.util.DeployAlertUtil;
import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil;
import java.util.List;
public class DeployAction extends SimpleAction { public class DeployAction extends SimpleAction {
private static final Log _log = LogFactoryUtil.getLog(DeployAction.class); private final static Log _log = LogFactoryUtil.getLog(DeployAction.class);
@Override @Override
public void run(final String[] ids) throws ActionException { public void run(final String[] ids) throws ActionException {
/*
* ServiceContext serviceContext = DeployAlertUtil.getServiceContext(); try {
* PermissionThreadLocal
* .setPermissionChecker(PermissionCheckerFactoryUtil.create(UserLocalServiceUtil
* .getUser(serviceContext.getUserId()))); } catch (Exception e) { _log.error(e, e); }
* DeployAlertUtil.addDefaultDeployMailTemplate(serviceContext);
* DeployAlertUtil.addDefaultUndeployMailTemplate(serviceContext);
*/
MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, new MessageListener() { MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, new MessageListener() {
@ -39,6 +47,7 @@ public class DeployAction extends SimpleAction {
String evento = message.getString("command"); String evento = message.getString("command");
String nomePlugin = message.getString("servletContextName"); String nomePlugin = message.getString("servletContextName");
if (evento.equals("undeploy") && nomePlugin.equals("portos-deploy-alert-portlet")) { if (evento.equals("undeploy") && nomePlugin.equals("portos-deploy-alert-portlet")) {
try { try {
NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento); NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento);
@ -49,12 +58,16 @@ public class DeployAction extends SimpleAction {
} else if (evento.equals("deploy") || evento.equals("undeploy")) { } else if (evento.equals("deploy") || evento.equals("undeploy")) {
try { try {
List<NotificationMail> notifications; List<NotificationMail> notifications;
NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento); NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento);
notifications = notifications =
NotificationMailLocalServiceUtil.findNotifications(PortalUtil.getDefaultCompanyId(), NotificationMailLocalServiceUtil.findNotifications(PortalUtil.getDefaultCompanyId(), nomePlugin);
nomePlugin);
for (int i = 0; i < notifications.size(); i++) { for (int i = 0; i < notifications.size(); i++) {
String templateName = notifications.get(i).getNomeTemplate(); String templateName = notifications.get(i).getNomeTemplate();
if (templateName.equals(MailConstants.DEFAULT_TEMPLATE)) { if (templateName.equals(MailConstants.DEFAULT_TEMPLATE)) {
if (evento.equals("deploy")) { if (evento.equals("deploy")) {
templateName = MailConstants.DEFAULT_DEPLOY_TEMPLATE; templateName = MailConstants.DEFAULT_DEPLOY_TEMPLATE;
@ -62,11 +75,14 @@ public class DeployAction extends SimpleAction {
templateName = MailConstants.DEFAULT_UNDEPLOY_TEMPLATE; templateName = MailConstants.DEFAULT_UNDEPLOY_TEMPLATE;
} }
} }
JSONObject parametri = DeployAlertUtil.getParametri(nomePlugin, evento); JSONObject parametri = DeployAlertUtil.getParametri(nomePlugin, evento);
ServiceContext serviceContext = DeployAlertUtil.getServiceContext(); ServiceContext serviceContext = DeployAlertUtil.getServiceContext();
MailManagerUtil.sendMailByTemplateName(Company.class.toString(), MailManagerUtil.sendMailByTemplateName(Company.class.toString(), serviceContext.getCompanyId(),
serviceContext.getCompanyId(), templateName, parametri, serviceContext); templateName, parametri, serviceContext);
} }
} catch (Exception e) { } catch (Exception e) {
_log.error(e, e); _log.error(e, e);
} }

3
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/constants/MailConstants.java

@ -3,6 +3,9 @@ package it.tref.liferay.portos.deployalert.constants;
public class MailConstants { public class MailConstants {
public static final String DEFAULT_TEMPLATE = "default"; public static final String DEFAULT_TEMPLATE = "default";
public static final String DEFAULT_DEPLOY_TEMPLATE = "default-deploy"; public static final String DEFAULT_DEPLOY_TEMPLATE = "default-deploy";
public static final String DEFAULT_UNDEPLOY_TEMPLATE = "default-undeploy"; public static final String DEFAULT_UNDEPLOY_TEMPLATE = "default-undeploy";
} }

5
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/control/DeployAlertControl.java

@ -8,14 +8,17 @@ import com.liferay.portlet.BaseControlPanelEntry;
public class DeployAlertControl extends BaseControlPanelEntry { public class DeployAlertControl extends BaseControlPanelEntry {
@Override
public boolean hasAccessPermission(PermissionChecker permissionChecker, Group group, Portlet portlet) public boolean hasAccessPermission(PermissionChecker permissionChecker, Group group, Portlet portlet)
throws Exception { throws Exception {
long companyId = PortalUtil.getDefaultCompanyId(); long companyId = PortalUtil.getDefaultCompanyId();
if (companyId == permissionChecker.getCompanyId()) { if (companyId == permissionChecker.getCompanyId()) {
return true; return true;
} }
return false; return false;
} }
} }

26
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/portlet/NotificatorPortlet.java

@ -1,11 +1,5 @@
package it.tref.liferay.portos.deployalert.portlet; package it.tref.liferay.portos.deployalert.portlet;
import it.tref.liferay.portos.deployalert.model.NotificationMail;
import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.servlet.SessionErrors; import com.liferay.portal.kernel.servlet.SessionErrors;
@ -14,17 +8,29 @@ import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory; import com.liferay.portal.service.ServiceContextFactory;
import com.liferay.util.bridges.mvc.MVCPortlet; import com.liferay.util.bridges.mvc.MVCPortlet;
import it.tref.liferay.portos.deployalert.model.NotificationMail;
import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
/**
* Portlet implementation class AdminDeployNotificatorPortlet
*/
public class NotificatorPortlet extends MVCPortlet { public class NotificatorPortlet extends MVCPortlet {
public void addNotification(ActionRequest request, ActionResponse response) throws PortalException, SystemException { public void addNotification(ActionRequest request, ActionResponse response) throws PortalException, SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request); ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request);
String nomePlugin = ParamUtil.getString(request, "nomePlugin"); String nomePlugin = ParamUtil.getString(request, "nomePlugin");
String nomeTemplate = ParamUtil.getString(request, "nomeTemplate"); String nomeTemplate = ParamUtil.getString(request, "nomeTemplate");
try { try {
NotificationMailLocalServiceUtil.addNotification(nomePlugin, nomeTemplate, serviceContext); NotificationMailLocalServiceUtil.addNotification(nomePlugin, nomeTemplate, serviceContext);
} catch (PortalException e) { } catch (PortalException e) {
SessionErrors.add(request, e.getClass()); SessionErrors.add(request, e.getClass());
response.setRenderParameter("mvcPath", "/html/notificator/edit_notification.jsp"); response.setRenderParameter("mvcPath", "/html/notificator/edit_notification.jsp");
} }
} }
@ -33,8 +39,10 @@ public class NotificatorPortlet extends MVCPortlet {
SystemException { SystemException {
long notificationId = ParamUtil.getLong(request, "notificationId"); long notificationId = ParamUtil.getLong(request, "notificationId");
try { try {
NotificationMailLocalServiceUtil.deleteNotificationMail(notificationId); NotificationMailLocalServiceUtil.deleteNotificationMail(notificationId);
} catch (PortalException pe) { } catch (PortalException pe) {
SessionErrors.add(request, pe.getClass().getName()); SessionErrors.add(request, pe.getClass().getName());
} }
@ -44,14 +52,16 @@ public class NotificatorPortlet extends MVCPortlet {
SystemException { SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request); ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request);
String nomePlugin = ParamUtil.getString(request, "nomePlugin"); String nomePlugin = ParamUtil.getString(request, "nomePlugin");
String nomeTemplate = ParamUtil.getString(request, "nomeTemplate"); String nomeTemplate = ParamUtil.getString(request, "nomeTemplate");
long notificationId = ParamUtil.getLong(request, "notificationId"); long notificationId = ParamUtil.getLong(request, "notificationId");
try { try {
NotificationMailLocalServiceUtil.updateNotification(nomePlugin, nomeTemplate, serviceContext, NotificationMailLocalServiceUtil.updateNotification(nomePlugin, nomeTemplate, serviceContext, notificationId);
notificationId);
} catch (PortalException pe) { } catch (PortalException pe) {
SessionErrors.add(request, pe.getClass()); SessionErrors.add(request, pe.getClass());
response.setRenderParameter("mvcPath", "/html/notificator/edit_notification.jsp"); response.setRenderParameter("mvcPath", "/html/notificator/edit_notification.jsp");
} }
} }

40
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationLogLocalServiceImpl.java

@ -1,13 +1,23 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.deployalert.service.impl; package it.tref.liferay.portos.deployalert.service.impl;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.Validator;
import it.tref.liferay.portos.deployalert.NotificationNomePluginException; import it.tref.liferay.portos.deployalert.NotificationNomePluginException;
import it.tref.liferay.portos.deployalert.NotificationTipoException; import it.tref.liferay.portos.deployalert.NotificationTipoException;
import it.tref.liferay.portos.deployalert.model.NotificationLog; import it.tref.liferay.portos.deployalert.model.NotificationLog;
@ -15,18 +25,15 @@ import it.tref.liferay.portos.deployalert.service.base.NotificationLogLocalServi
import java.util.Date; import java.util.Date;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.Validator;
/** /**
* The implementation of the notification log local service. * The implementation of the notification log local service.
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.tref.liferay.portos.deployalert.service.NotificationLogLocalService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.deployalert.service.NotificationLogLocalService} interface.
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * This is a local service. Methods of this service will not have security checks based on the
* credentials because this service can only be accessed from within the same VM. * propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author Matteo * @author Matteo
@ -35,17 +42,21 @@ import com.liferay.portal.kernel.util.Validator;
*/ */
public class NotificationLogLocalServiceImpl extends NotificationLogLocalServiceBaseImpl { public class NotificationLogLocalServiceImpl extends NotificationLogLocalServiceBaseImpl {
@Override
public NotificationLog addNotification(String nomePlugin, String tipo) throws SystemException, PortalException { public NotificationLog addNotification(String nomePlugin, String tipo) throws SystemException, PortalException {
Date now = new Date(); Date now = new Date();
validate(nomePlugin, tipo); validate(nomePlugin, tipo);
long notificationId = counterLocalService.increment(NotificationLog.class.getName()); long notificationId = counterLocalService.increment(NotificationLog.class.getName());
NotificationLog notification = notificationLogPersistence.create(notificationId); NotificationLog notification = notificationLogPersistence.create(notificationId);
notification.setTipo(tipo); notification.setTipo(tipo);
notification.setNomePlugin(nomePlugin); notification.setNomePlugin(nomePlugin);
notification.setData(now); notification.setData(now);
notificationLogPersistence.update(notification); notificationLogPersistence.update(notification);
return notification; return notification;
} }
@ -58,5 +69,6 @@ public class NotificationLogLocalServiceImpl extends NotificationLogLocalService
if (Validator.isNull(tipo)) { if (Validator.isNull(tipo)) {
throw new NotificationTipoException(); throw new NotificationTipoException();
} }
} }
} }

69
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationMailLocalServiceImpl.java

@ -1,22 +1,19 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.deployalert.service.impl; package it.tref.liferay.portos.deployalert.service.impl;
import it.tref.liferay.portos.deployalert.NotificationNomePluginException;
import it.tref.liferay.portos.deployalert.NotificationNomeTemplateException;
import it.tref.liferay.portos.deployalert.model.NotificationMail;
import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil;
import it.tref.liferay.portos.deployalert.service.base.NotificationMailLocalServiceBaseImpl;
import java.util.Date;
import java.util.List;
import com.liferay.portal.kernel.dao.orm.Disjunction; import com.liferay.portal.kernel.dao.orm.Disjunction;
import com.liferay.portal.kernel.dao.orm.DynamicQuery; import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil;
@ -28,14 +25,24 @@ import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.User; import com.liferay.portal.model.User;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import it.tref.liferay.portos.deployalert.NotificationNomePluginException;
import it.tref.liferay.portos.deployalert.NotificationNomeTemplateException;
import it.tref.liferay.portos.deployalert.model.NotificationMail;
import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil;
import it.tref.liferay.portos.deployalert.service.base.NotificationMailLocalServiceBaseImpl;
import java.util.Date;
import java.util.List;
/** /**
* The implementation of the notification mail local service. * The implementation of the notification mail local service.
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.tref.liferay.portos.deployalert.service.NotificationMailLocalService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.deployalert.service.NotificationMailLocalService} interface.
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * This is a local service. Methods of this service will not have security checks based on the
* credentials because this service can only be accessed from within the same VM. * propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author Matteo * @author Matteo
@ -44,15 +51,19 @@ import com.liferay.portal.service.ServiceContext;
*/ */
public class NotificationMailLocalServiceImpl extends NotificationMailLocalServiceBaseImpl { public class NotificationMailLocalServiceImpl extends NotificationMailLocalServiceBaseImpl {
@Override
public NotificationMail addNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext) public NotificationMail addNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext)
throws PortalException, SystemException { throws PortalException, SystemException {
User user = userPersistence.findByPrimaryKey(serviceContext.getUserId()); User user = userPersistence.findByPrimaryKey(serviceContext.getUserId());
Date now = new Date(); Date now = new Date();
validate(nomePlugin, nomeTemplate); validate(nomePlugin, nomeTemplate);
long notificationId = counterLocalService.increment(NotificationMail.class.getName()); long notificationId = counterLocalService.increment(NotificationMail.class.getName());
NotificationMail notification = notificationMailPersistence.create(notificationId); NotificationMail notification = notificationMailPersistence.create(notificationId);
notification.setUserId(user.getUserId()); notification.setUserId(user.getUserId());
notification.setCompanyId(user.getCompanyId()); notification.setCompanyId(user.getCompanyId());
notification.setUserName(user.getFullName()); notification.setUserName(user.getFullName());
@ -61,7 +72,9 @@ public class NotificationMailLocalServiceImpl extends NotificationMailLocalServi
notification.setExpandoBridgeAttributes(serviceContext); notification.setExpandoBridgeAttributes(serviceContext);
notification.setNomePlugin(nomePlugin); notification.setNomePlugin(nomePlugin);
notification.setNomeTemplate(nomeTemplate); notification.setNomeTemplate(nomeTemplate);
notificationMailPersistence.update(notification); notificationMailPersistence.update(notification);
return notification; return notification;
} }
@ -76,25 +89,29 @@ public class NotificationMailLocalServiceImpl extends NotificationMailLocalServi
} }
} }
@Override
public NotificationMail updateNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext, public NotificationMail updateNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext,
long notificationId) throws SystemException, PortalException { long notificationId) throws SystemException, PortalException {
Date now = new Date(); Date now = new Date();
NotificationMail notification = getNotificationMail(notificationId); NotificationMail notification = getNotificationMail(notificationId);
validate(nomePlugin, nomeTemplate); validate(nomePlugin, nomeTemplate);
notification.setModifiedDate(serviceContext.getModifiedDate(now)); notification.setModifiedDate(serviceContext.getModifiedDate(now));
notification.setNomePlugin(nomePlugin); notification.setNomePlugin(nomePlugin);
notification.setNomeTemplate(nomeTemplate); notification.setNomeTemplate(nomeTemplate);
notification.setExpandoBridgeAttributes(serviceContext); notification.setExpandoBridgeAttributes(serviceContext);
notificationMailPersistence.update(notification); notificationMailPersistence.update(notification);
return notification; return notification;
} }
@Override
public List<NotificationMail> findNotifications(long companyId, int start, int end) throws SystemException { public List<NotificationMail> findNotifications(long companyId, int start, int end) throws SystemException {
DynamicQuery query = dynamicQuery(); // return notificationMailPersistence.findBycompanyId(companyId, start, end);
DynamicQuery query = notificationMailLocalService.dynamicQuery();
query.addOrder(OrderFactoryUtil.asc("nomePlugin")); query.addOrder(OrderFactoryUtil.asc("nomePlugin"));
List<NotificationMail> notifications = null; List<NotificationMail> notifications = null;
try { try {
@ -105,30 +122,30 @@ public class NotificationMailLocalServiceImpl extends NotificationMailLocalServi
return notifications; return notifications;
} }
@Override
public List<NotificationMail> findNotifications(long companyId) throws SystemException { public List<NotificationMail> findNotifications(long companyId) throws SystemException {
return notificationMailPersistence.findBycompanyId(companyId); return notificationMailPersistence.findBycompanyId(companyId);
} }
@Override
public int getNotificationCount(long companyId) throws SystemException { public int getNotificationCount(long companyId) throws SystemException {
return notificationMailPersistence.countBycompanyId(companyId); return notificationMailPersistence.countBycompanyId(companyId);
} }
@Override
public List<NotificationMail> findNotifications(long companyId, String servletContextName) throws SystemException { public List<NotificationMail> findNotifications(long companyId, String servletContextName) throws SystemException {
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = notificationMailLocalService.dynamicQuery();
if (Validator.isNull(servletContextName)) { if (Validator.isNull(servletContextName)) {
Disjunction or = RestrictionsFactoryUtil.disjunction(); Disjunction or = RestrictionsFactoryUtil.disjunction();
or.add(RestrictionsFactoryUtil.isNull("nomePlugin")); or.add(RestrictionsFactoryUtil.isNull("nomePlugin"));
or.add(RestrictionsFactoryUtil.eq("nomePlugin", StringPool.BLANK)); or.add(RestrictionsFactoryUtil.eq("nomePlugin", StringPool.BLANK));
dynamicQuery.add(or); dynamicQuery.add(or);
} else { } else {
dynamicQuery.add(RestrictionsFactoryUtil.eq("nomePlugin", servletContextName)); dynamicQuery.add(RestrictionsFactoryUtil.eq("nomePlugin", servletContextName));
} }
return notificationMailPersistence.findWithDynamicQuery(dynamicQuery); return notificationMailPersistence.findWithDynamicQuery(dynamicQuery);
} }
} }

1
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationLogPersistenceImpl.java

@ -45,7 +45,6 @@ import it.tref.liferay.portos.deployalert.NoSuchNotificationLogException;
import it.tref.liferay.portos.deployalert.model.NotificationLog; import it.tref.liferay.portos.deployalert.model.NotificationLog;
import it.tref.liferay.portos.deployalert.model.impl.NotificationLogImpl; import it.tref.liferay.portos.deployalert.model.impl.NotificationLogImpl;
import it.tref.liferay.portos.deployalert.model.impl.NotificationLogModelImpl; import it.tref.liferay.portos.deployalert.model.impl.NotificationLogModelImpl;
import it.tref.liferay.portos.deployalert.service.persistence.NotificationLogPersistence;
import java.io.Serializable; import java.io.Serializable;

1
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationMailPersistenceImpl.java

@ -45,7 +45,6 @@ import it.tref.liferay.portos.deployalert.NoSuchNotificationMailException;
import it.tref.liferay.portos.deployalert.model.NotificationMail; import it.tref.liferay.portos.deployalert.model.NotificationMail;
import it.tref.liferay.portos.deployalert.model.impl.NotificationMailImpl; import it.tref.liferay.portos.deployalert.model.impl.NotificationMailImpl;
import it.tref.liferay.portos.deployalert.model.impl.NotificationMailModelImpl; import it.tref.liferay.portos.deployalert.model.impl.NotificationMailModelImpl;
import it.tref.liferay.portos.deployalert.service.persistence.NotificationMailPersistence;
import java.io.Serializable; import java.io.Serializable;

37
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/util/DeployAlertUtil.java

@ -1,11 +1,5 @@
package it.tref.liferay.portos.deployalert.util; package it.tref.liferay.portos.deployalert.util;
import it.tref.liferay.portos.deployalert.constants.MailConstants;
import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.json.JSONObject;
@ -22,27 +16,37 @@ import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortalUtil;
import it.tref.liferay.portos.deployalert.constants.MailConstants;
import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DeployAlertUtil { public class DeployAlertUtil {
private static final Log _log = LogFactoryUtil.getLog(DeployAlertUtil.class); private final static Log _log = LogFactoryUtil.getLog(DeployAlertUtil.class);
public static final ServiceContext getServiceContext() { public static final ServiceContext getServiceContext() {
long companyId = PortalUtil.getDefaultCompanyId(); long companyId = PortalUtil.getDefaultCompanyId();
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
Company company; Company company;
serviceContext.setCompanyId(companyId); serviceContext.setCompanyId(companyId);
try { try {
company = CompanyLocalServiceUtil.getCompany(companyId); company = CompanyLocalServiceUtil.getCompany(companyId);
Role role = RoleLocalServiceUtil.getRole(company.getCompanyId(), RoleConstants.ADMINISTRATOR); Role role = RoleLocalServiceUtil.getRole(company.getCompanyId(), RoleConstants.ADMINISTRATOR);
long userAdminId = UserLocalServiceUtil.getRoleUserIds(role.getRoleId())[0]; long userAdminId = UserLocalServiceUtil.getRoleUserIds(role.getRoleId())[0];
serviceContext.setUserId(userAdminId); serviceContext.setUserId(userAdminId);
serviceContext.setScopeGroupId(company.getGroupId()); serviceContext.setScopeGroupId(company.getGroupId());
PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(UserLocalServiceUtil
.getUser(userAdminId))); PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(userAdminId)));
} catch (Exception e) { } catch (Exception e) {
_log.error(e, e); _log.error(e, e);
} }
return serviceContext; return serviceContext;
} }
@ -51,10 +55,12 @@ public class DeployAlertUtil {
boolean add = false; boolean add = false;
String subject = "Deploy Plugin"; String subject = "Deploy Plugin";
String body = "E' stato effettuato il $evento del plugin $nomePlugin in data $data."; String body = "E' stato effettuato il $evento del plugin $nomePlugin in data $data.";
String[] to = { "matteoguggia97@gmail.com" }; String[] to = {"matteoguggia97@gmail.com"};
try { try {
add = MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_DEPLOY_TEMPLATE, "test@3fconsulting.it", to, add =
null, null, subject, body, false, serviceContext); MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_DEPLOY_TEMPLATE, "test@3fconsulting.it", to, null,
null, subject, body, false, serviceContext);
} catch (SystemException e) { } catch (SystemException e) {
_log.error(e, e); _log.error(e, e);
} }
@ -68,11 +74,12 @@ public class DeployAlertUtil {
boolean add = false; boolean add = false;
String subject = "Undeploy Plugin"; String subject = "Undeploy Plugin";
String body = "E' stato effettuato l'$evento del plugin $nomePlugin in data $data."; String body = "E' stato effettuato l'$evento del plugin $nomePlugin in data $data.";
String[] to = { "matteoguggia97@gmail.com" }; String[] to = {"matteoguggia97@gmail.com"};
try { try {
add = MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_UNDEPLOY_TEMPLATE, "test@3fconsulting.it", to, add =
null, null, subject, body, false, serviceContext); MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_UNDEPLOY_TEMPLATE, "test@3fconsulting.it", to, null,
null, subject, body, false, serviceContext);
} catch (SystemException e) { } catch (SystemException e) {
_log.error(e, e); _log.error(e, e);
} }

1
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

1
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/edit_notification.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.kernel.util.Validator"%> <%@page import="com.liferay.portal.kernel.util.Validator"%>
<%@page import="com.liferay.portal.kernel.util.StringUtil"%> <%@page import="com.liferay.portal.kernel.util.StringUtil"%>
<%@ include file="/html/notificator/init.jsp"%> <%@ include file="/html/notificator/init.jsp"%>

1
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/html/init.jsp"%> <%@ include file="/html/init.jsp"%>
<%@ page <%@ page
import="it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil"%> import="it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil"%>

1
liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/view.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/html/notificator/init.jsp"%> <%@ include file="/html/notificator/init.jsp"%>
<aui:button-row> <aui:button-row>

2
liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/liferay-hook.xml

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook> <hook>

10
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/liferay-portlet.xml

@ -2,10 +2,18 @@
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd"> <!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
<liferay-portlet-app> <liferay-portlet-app>
<portlet> <portlet>
<portlet-name>1</portlet-name> <portlet-name>1</portlet-name>
<icon></icon> <icon></icon>
<scheduler-entry>
<scheduler-event-listener-class>it.tref.liferay.portos.kaleo.controller.scheduler.SchedulerKaleoController</scheduler-event-listener-class>
<trigger>
<simple>
<simple-trigger-value>240</simple-trigger-value>
<time-unit>second</time-unit>
</simple>
</trigger>
</scheduler-entry>
<header-portlet-css></header-portlet-css> <header-portlet-css></header-portlet-css>
<footer-portlet-javascript></footer-portlet-javascript> <footer-portlet-javascript></footer-portlet-javascript>
<css-class-wrapper></css-class-wrapper> <css-class-wrapper></css-class-wrapper>

36
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoInstanceImpl.java

@ -1,30 +1,34 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.kaleo.controller.model.impl; package it.tref.liferay.portos.kaleo.controller.model.impl;
/** /**
* The extended model implementation for the KaleoInstance service. Represents a row in the &quot;kaleoinstance&quot; * The extended model implementation for the KaleoInstance service. Represents a row in the &quot;kaleoinstance&quot; database table, with each column mapped to a property of this class.
* database table, with each column mapped to a property of this class. *
* <p> * <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance} interface.
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance}
* interface.
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
*/ */
@SuppressWarnings("serial")
public class KaleoInstanceImpl extends KaleoInstanceBaseImpl { public class KaleoInstanceImpl extends KaleoInstanceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo instance model instance * NOTE FOR DEVELOPERS:
* should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance} interface instead. *
* Never reference this class directly. All methods that expect a kaleo instance model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance} interface instead.
*/ */
public KaleoInstanceImpl() {
public KaleoInstanceImpl() {} }
} }

36
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoNodeImpl.java

@ -1,30 +1,34 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.kaleo.controller.model.impl; package it.tref.liferay.portos.kaleo.controller.model.impl;
/** /**
* The extended model implementation for the KaleoNode service. Represents a row in the &quot;kaleonode&quot; database * The extended model implementation for the KaleoNode service. Represents a row in the &quot;kaleonode&quot; database table, with each column mapped to a property of this class.
* table, with each column mapped to a property of this class. *
* <p> * <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode} interface.
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode}
* interface.
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
*/ */
@SuppressWarnings("serial")
public class KaleoNodeImpl extends KaleoNodeBaseImpl { public class KaleoNodeImpl extends KaleoNodeBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo node model instance * NOTE FOR DEVELOPERS:
* should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode} interface instead. *
* Never reference this class directly. All methods that expect a kaleo node model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode} interface instead.
*/ */
public KaleoNodeImpl() {
public KaleoNodeImpl() {} }
} }

40
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskAssignmentInstanceImpl.java

@ -1,31 +1,35 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.kaleo.controller.model.impl; package it.tref.liferay.portos.kaleo.controller.model.impl;
/** /**
* The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the * The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the &quot;kaleotaskassignmentinstance&quot; database table, with each column mapped to a property of this class.
* &quot;kaleotaskassignmentinstance&quot; database table, with each column mapped to a property of this class. *
* <p> * <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface.
* ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface.
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
*/ */
@SuppressWarnings("serial") public class KaleoTaskAssignmentInstanceImpl
public class KaleoTaskAssignmentInstanceImpl extends KaleoTaskAssignmentInstanceBaseImpl { extends KaleoTaskAssignmentInstanceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task assignment * NOTE FOR DEVELOPERS:
* instance model instance should use the {@link *
* it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface instead. * Never reference this class directly. All methods that expect a kaleo task assignment instance model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface instead.
*/ */
public KaleoTaskAssignmentInstanceImpl() {
public KaleoTaskAssignmentInstanceImpl() {} }
} }

36
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskImpl.java

@ -1,30 +1,34 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.kaleo.controller.model.impl; package it.tref.liferay.portos.kaleo.controller.model.impl;
/** /**
* The extended model implementation for the KaleoTask service. Represents a row in the &quot;kaleotask&quot; database * The extended model implementation for the KaleoTask service. Represents a row in the &quot;kaleotask&quot; database table, with each column mapped to a property of this class.
* table, with each column mapped to a property of this class. *
* <p> * <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask} interface.
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask}
* interface.
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
*/ */
@SuppressWarnings("serial")
public class KaleoTaskImpl extends KaleoTaskBaseImpl { public class KaleoTaskImpl extends KaleoTaskBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task model instance * NOTE FOR DEVELOPERS:
* should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask} interface instead. *
* Never reference this class directly. All methods that expect a kaleo task model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask} interface instead.
*/ */
public KaleoTaskImpl() {
public KaleoTaskImpl() {} }
} }

37
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskInstanceTokenImpl.java

@ -1,31 +1,34 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.kaleo.controller.model.impl; package it.tref.liferay.portos.kaleo.controller.model.impl;
/** /**
* The extended model implementation for the KaleoTaskInstanceToken service. Represents a row in the * The extended model implementation for the KaleoTaskInstanceToken service. Represents a row in the &quot;kaleotaskinstancetoken&quot; database table, with each column mapped to a property of this class.
* &quot;kaleotaskinstancetoken&quot; database table, with each column mapped to a property of this class. *
* <p> * <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} interface.
* ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} interface.
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
*/ */
@SuppressWarnings("serial")
public class KaleoTaskInstanceTokenImpl extends KaleoTaskInstanceTokenBaseImpl { public class KaleoTaskInstanceTokenImpl extends KaleoTaskInstanceTokenBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task instance token * NOTE FOR DEVELOPERS:
* model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} *
* interface instead. * Never reference this class directly. All methods that expect a kaleo task instance token model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} interface instead.
*/ */
public KaleoTaskInstanceTokenImpl() {
public KaleoTaskInstanceTokenImpl() {} }
} }

3
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstancePersistenceImpl.java

@ -42,6 +42,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoInstanceException;
import it.tref.liferay.portos.kaleo.controller.model.KaleoInstance; import it.tref.liferay.portos.kaleo.controller.model.KaleoInstance;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceModelImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoInstancePersistence;
import java.io.Serializable; import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code> * Caching information and settings can be found in <code>portal.properties</code>
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
* @see KaleoInstancePersistence * @see KaleoInstancePersistence
* @see KaleoInstanceUtil * @see KaleoInstanceUtil
* @generated * @generated

3
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstanceTokenPersistenceImpl.java

@ -42,6 +42,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoInstanceTokenException
import it.tref.liferay.portos.kaleo.controller.model.KaleoInstanceToken; import it.tref.liferay.portos.kaleo.controller.model.KaleoInstanceToken;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceTokenImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceTokenImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceTokenModelImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceTokenModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoInstanceTokenPersistence;
import java.io.Serializable; import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code> * Caching information and settings can be found in <code>portal.properties</code>
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
* @see KaleoInstanceTokenPersistence * @see KaleoInstanceTokenPersistence
* @see KaleoInstanceTokenUtil * @see KaleoInstanceTokenUtil
* @generated * @generated

3
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoLogPersistenceImpl.java

@ -43,6 +43,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoLogException;
import it.tref.liferay.portos.kaleo.controller.model.KaleoLog; import it.tref.liferay.portos.kaleo.controller.model.KaleoLog;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoLogImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoLogImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoLogModelImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoLogModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoLogPersistence;
import java.io.Serializable; import java.io.Serializable;
@ -58,7 +59,7 @@ import java.util.Set;
* Caching information and settings can be found in <code>portal.properties</code> * Caching information and settings can be found in <code>portal.properties</code>
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
* @see KaleoLogPersistence * @see KaleoLogPersistence
* @see KaleoLogUtil * @see KaleoLogUtil
* @generated * @generated

3
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoNodePersistenceImpl.java

@ -41,6 +41,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoNodeException;
import it.tref.liferay.portos.kaleo.controller.model.KaleoNode; import it.tref.liferay.portos.kaleo.controller.model.KaleoNode;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoNodeImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoNodeImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoNodeModelImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoNodeModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoNodePersistence;
import java.io.Serializable; import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.Set;
* Caching information and settings can be found in <code>portal.properties</code> * Caching information and settings can be found in <code>portal.properties</code>
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
* @see KaleoNodePersistence * @see KaleoNodePersistence
* @see KaleoNodeUtil * @see KaleoNodeUtil
* @generated * @generated

3
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskAssignmentInstancePersistenceImpl.java

@ -42,6 +42,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoTaskAssignmentInstance
import it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance; import it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskAssignmentInstanceImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskAssignmentInstanceImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskAssignmentInstanceModelImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskAssignmentInstanceModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoTaskAssignmentInstancePersistence;
import java.io.Serializable; import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code> * Caching information and settings can be found in <code>portal.properties</code>
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
* @see KaleoTaskAssignmentInstancePersistence * @see KaleoTaskAssignmentInstancePersistence
* @see KaleoTaskAssignmentInstanceUtil * @see KaleoTaskAssignmentInstanceUtil
* @generated * @generated

3
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskInstanceTokenPersistenceImpl.java

@ -42,6 +42,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoTaskInstanceTokenExcep
import it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken; import it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskInstanceTokenImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskInstanceTokenImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskInstanceTokenModelImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskInstanceTokenModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoTaskInstanceTokenPersistence;
import java.io.Serializable; import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code> * Caching information and settings can be found in <code>portal.properties</code>
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
* @see KaleoTaskInstanceTokenPersistence * @see KaleoTaskInstanceTokenPersistence
* @see KaleoTaskInstanceTokenUtil * @see KaleoTaskInstanceTokenUtil
* @generated * @generated

3
liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskPersistenceImpl.java

@ -40,6 +40,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoTaskException;
import it.tref.liferay.portos.kaleo.controller.model.KaleoTask; import it.tref.liferay.portos.kaleo.controller.model.KaleoTask;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskModelImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoTaskPersistence;
import java.io.Serializable; import java.io.Serializable;
@ -54,7 +55,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code> * Caching information and settings can be found in <code>portal.properties</code>
* </p> * </p>
* *
* @author 3FC + Manifattura Web Group s.r.l. * @author 3FC
* @see KaleoTaskPersistence * @see KaleoTaskPersistence
* @see KaleoTaskUtil * @see KaleoTaskUtil
* @generated * @generated

2
liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/liferay-hook.xml

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook> <hook>

136
liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/service.xml

@ -1,132 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd"> <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="it.tref.liferay.portos.kaleo"> <service-builder package-path="it.tref.liferay.portos.kaleo">
<author></author> <author></author>
<namespace>portos_Kaleo</namespace> <namespace>portos_Kaleo</namespace>
<entity name="FormLog" local-service="true" remote-service="false"> <entity name="FormLog" local-service="true" remote-service="false">
<column name="formLogId" type="long" primary="true"></column>
<column name="formLogId" type="long" primary="true" />
<!-- Group instance --> <!-- Group instance -->
<column name="groupId" type="long"></column>
<column name="groupId" type="long" />
<!-- Audit fields --> <!-- Audit fields -->
<column name="companyId" type="long"></column>
<column name="companyId" type="long" /> <column name="userId" type="long"></column>
<column name="userId" type="long" /> <column name="userName" type="String"></column>
<column name="userName" type="String" /> <column name="createDate" type="Date"></column>
<column name="createDate" type="Date" /> <column name="modifiedDate" type="Date"></column>
<column name="modifiedDate" type="Date" /> <column name="workflowInstanceId" type="long"></column>
<column name="workflowTaskId" type="long"></column>
<column name="workflowInstanceId" type="long" /> <column name="transitionName" type="String"></column>
<column name="workflowTaskId" type="long" /> <column name="formParameters" type="String"></column>
<column name="transitionName" type="String" />
<column name="formParameters" type="String" />
<!-- Order --> <!-- Order -->
<order> <order>
<order-column name="createDate" order-by="asc" /> <order-column name="createDate" order-by="asc"></order-column>
</order> </order>
<!-- Finder --> <!-- Finder -->
<finder return-type="Collection" name="Company"> <finder return-type="Collection" name="Company">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
</finder> </finder>
<finder return-type="Collection" name="C_Instance"> <finder return-type="Collection" name="C_Instance">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="workflowInstanceId" /> <finder-column name="workflowInstanceId"></finder-column>
</finder> </finder>
<finder return-type="Collection" name="C_Task"> <finder return-type="Collection" name="C_Task">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="workflowTaskId" /> <finder-column name="workflowTaskId"></finder-column>
</finder> </finder>
<finder return-type="Collection" name="C_Task_TransitionName"> <finder return-type="Collection" name="C_Task_TransitionName">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="workflowTaskId" /> <finder-column name="workflowTaskId"></finder-column>
<finder-column name="transitionName" /> <finder-column name="transitionName"></finder-column>
</finder> </finder>
</entity> </entity>
<entity name="FormDefinitionLink" local-service="true" remote-service="false"> <entity name="FormDefinitionLink" local-service="true" remote-service="false">
<column name="formDefinitionLinkId" type="long" primary="true"></column>
<column name="formDefinitionLinkId" type="long" primary="true" />
<!-- Group instance --> <!-- Group instance -->
<column name="groupId" type="long"></column>
<column name="groupId" type="long" />
<!-- Audit fields --> <!-- Audit fields -->
<column name="companyId" type="long"></column>
<column name="companyId" type="long" /> <column name="userId" type="long"></column>
<column name="userId" type="long" /> <column name="userName" type="String"></column>
<column name="userName" type="String" /> <column name="createDate" type="Date"></column>
<column name="createDate" type="Date" /> <column name="modifiedDate" type="Date"></column>
<column name="modifiedDate" type="Date" /> <column name="name" type="String"></column>
<column name="definitionName" type="String"></column>
<column name="name" type="String" /> <column name="definitionVersion" type="int"></column>
<column name="definitionName" type="String" /> <column name="ddmStructureId" type="long"></column>
<column name="definitionVersion" type="int" />
<column name="ddmStructureId" type="long" />
<!-- Order --> <!-- Order -->
<order> <order>
<order-column name="createDate" order-by="asc" /> <order-column name="createDate" order-by="asc"></order-column>
</order> </order>
<!-- Finder --> <!-- Finder -->
<finder return-type="Collection" name="Company"> <finder return-type="Collection" name="Company">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
</finder> </finder>
<finder return-type="Collection" name="C_DefinitionName_DefinitionVersion"> <finder return-type="Collection" name="C_DefinitionName_DefinitionVersion">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="definitionName" /> <finder-column name="definitionName"></finder-column>
<finder-column name="definitionVersion" /> <finder-column name="definitionVersion"></finder-column>
</finder> </finder>
<finder return-type="Collection" name="DDMStructureId"> <finder return-type="Collection" name="DDMStructureId">
<finder-column name="ddmStructureId" /> <finder-column name="ddmStructureId"></finder-column>
</finder> </finder>
</entity> </entity>
<entity name="FormTemplateLink" local-service="true" remote-service="false"> <entity name="FormTemplateLink" local-service="true" remote-service="false">
<column name="formTemplateLinkId" type="long" primary="true"></column>
<column name="formTemplateLinkId" type="long" primary="true" /> <column name="formDefinitionLinkId" type="long"></column>
<column name="ddmTemplateId" type="long"></column>
<column name="formDefinitionLinkId" type="long" /> <column name="kaleoNodeId" type="long"></column>
<column name="ddmTemplateId" type="long" /> <column name="transitionName" type="String"></column>
<column name="kaleoNodeId" type="long" />
<column name="transitionName" type="String" />
<finder return-type="Collection" name="FormDefinitionLinkId"> <finder return-type="Collection" name="FormDefinitionLinkId">
<finder-column name="formDefinitionLinkId" /> <finder-column name="formDefinitionLinkId"></finder-column>
</finder> </finder>
<finder return-type="Collection" name="DDMTemplateId"> <finder return-type="Collection" name="DDMTemplateId">
<finder-column name="ddmTemplateId" /> <finder-column name="ddmTemplateId"></finder-column>
</finder> </finder>
<finder return-type="FormTemplateLink" name="FormDefinitionLinkId_KaleoNodeId_TransitionName" unique="true"> <finder return-type="FormTemplateLink" name="FormDefinitionLinkId_KaleoNodeId_TransitionName" unique="true">
<finder-column name="formDefinitionLinkId" /> <finder-column name="formDefinitionLinkId"></finder-column>
<finder-column name="kaleoNodeId" /> <finder-column name="kaleoNodeId"></finder-column>
<finder-column name="transitionName" /> <finder-column name="transitionName"></finder-column>
</finder> </finder>
</entity> </entity>
<exceptions> <exceptions>
<exception>FormDefinitionLinkName</exception> <exception>FormDefinitionLinkName</exception>
<exception>FormDefinitionLinkDefinitionName</exception> <exception>FormDefinitionLinkDefinitionName</exception>

11
liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/ddm/FormDDMDisplay.java

@ -22,31 +22,28 @@ public class FormDDMDisplay extends BaseDDMDisplay {
@Override @Override
public String getPortletId() { public String getPortletId() {
return PortletKeys.WORKFLOW_FORM_ADMIN; return PortletKeys.WORKFLOW_FORM_ADMIN;
} }
@Override @Override
public String getResourceName() { public String getResourceName() {
// return DDLPermission.RESOURCE_NAME;
return RESOURCE_NAME; return RESOURCE_NAME;
} }
@Override @Override
public String getStorageType() { public String getStorageType() {
// return PropsValues.DYNAMIC_DATA_LISTS_STORAGE_TYPE;
return PropsUtil.get(PropsKeys.DYNAMIC_DATA_LISTS_STORAGE_TYPE); return PropsUtil.get(PropsKeys.DYNAMIC_DATA_LISTS_STORAGE_TYPE);
} }
@Override @Override
public String getStructureName(Locale locale) { public String getStructureName(Locale locale) {
return LanguageUtil.get(locale, "data-definition"); return LanguageUtil.get(locale, "data-definition");
} }
@Override @Override
public String getStructureType() { public String getStructureType() {
return DDLRecordSet.class.getName(); return DDLRecordSet.class.getName();
} }
@ -62,15 +59,17 @@ public class FormDDMDisplay extends BaseDDMDisplay {
throws Exception { throws Exception {
String redirect = ParamUtil.getString(liferayPortletRequest, "redirect"); String redirect = ParamUtil.getString(liferayPortletRequest, "redirect");
if (Validator.isNull(redirect)) { if (Validator.isNull(redirect)) {
return getViewTemplatesURL(liferayPortletRequest, liferayPortletResponse, classNameId, classPK); return getViewTemplatesURL(liferayPortletRequest, liferayPortletResponse, classNameId, classPK);
} }
return redirect; return redirect;
} }
@Override @Override
public boolean isShowAddStructureButton() { public boolean isShowAddStructureButton() {
return true; return true;
} }
} }

32
liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormLogImpl.java

@ -1,28 +1,34 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.kaleo.model.impl; package it.tref.liferay.portos.kaleo.model.impl;
/** /**
* The extended model implementation for the FormLog service. Represents a row in the &quot;portos_Kaleo_FormLog&quot; * The extended model implementation for the FormLog service. Represents a row in the &quot;portos_Kaleo_FormLog&quot; database table, with each column mapped to a property of this class.
* database table, with each column mapped to a property of this class. *
* <p> * <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface.
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface.
* </p> * </p>
* *
* @author * @author
*/ */
@SuppressWarnings("serial")
public class FormLogImpl extends FormLogBaseImpl { public class FormLogImpl extends FormLogBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a form log model instance * NOTE FOR DEVELOPERS:
* should use the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface instead. *
* Never reference this class directly. All methods that expect a form log model instance should use the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface instead.
*/ */
public FormLogImpl() {} public FormLogImpl() {
}
} }

33
liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormTemplateLinkImpl.java

@ -1,29 +1,34 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.kaleo.model.impl; package it.tref.liferay.portos.kaleo.model.impl;
/** /**
* The extended model implementation for the FormTemplateLink service. Represents a row in the * The extended model implementation for the FormTemplateLink service. Represents a row in the &quot;portos_Kaleo_FormTemplateLink&quot; database table, with each column mapped to a property of this class.
* &quot;portos_Kaleo_FormTemplateLink&quot; database table, with each column mapped to a property of this class. *
* <p> * <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink} interface.
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink}
* interface.
* </p> * </p>
* *
* @author * @author
*/ */
@SuppressWarnings("serial")
public class FormTemplateLinkImpl extends FormTemplateLinkBaseImpl { public class FormTemplateLinkImpl extends FormTemplateLinkBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a form template link model * NOTE FOR DEVELOPERS:
* instance should use the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink} interface instead. *
* Never reference this class directly. All methods that expect a form template link model instance should use the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink} interface instead.
*/ */
public FormTemplateLinkImpl() {} public FormTemplateLinkImpl() {
}
} }

11
liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/portlet/WorkflowFormAdminPortletControlPanelEntry.java

@ -6,12 +6,21 @@ import com.liferay.portal.model.Portlet;
import com.liferay.portal.security.permission.PermissionChecker; import com.liferay.portal.security.permission.PermissionChecker;
import com.liferay.portlet.BaseControlPanelEntry; import com.liferay.portlet.BaseControlPanelEntry;
/**
* Control panel entry class WorkflowFormAdminPortletControlPanelEntry
*/
public class WorkflowFormAdminPortletControlPanelEntry extends BaseControlPanelEntry { public class WorkflowFormAdminPortletControlPanelEntry extends BaseControlPanelEntry {
@Override @Override
protected boolean hasAccessPermissionDenied(PermissionChecker permissionChecker, Group group, Portlet portlet) protected boolean hasAccessPermissionDenied(PermissionChecker permissionChecker, Group group, Portlet portlet)
throws Exception { throws Exception {
return group.isLayoutSetPrototype() || !WorkflowEngineManagerUtil.isDeployed(); if (group.isLayoutSetPrototype() || !WorkflowEngineManagerUtil.isDeployed()) {
return true;
}
return false;
} }
} }

6
liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/liferay-hook.xml

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook> <hook>
<portal-properties>portal.properties</portal-properties> <portal-properties>portal.properties</portal-properties>
<language-properties> <language-properties>content/Language.properties</language-properties>
content/Language.properties
</language-properties>
</hook> </hook>

2
liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogRequestPostAction.java

@ -28,9 +28,9 @@ import com.liferay.portal.util.PortalUtil;
import eu.bitwalker.useragentutils.UserAgent; import eu.bitwalker.useragentutils.UserAgent;
import it.tref.portos.liferay.log.camel.core.CamelCoreInitializer; import it.tref.portos.liferay.log.camel.core.CamelCoreInitializer;
import it.tref.portos.liferay.log.model.LogActionDetails; import it.tref.portos.liferay.log.model.LogActionDetails;
import it.tref.portos.liferay.log.shared.util.Constants;
import it.tref.portos.liferay.log.spring.SpringContextBeanScanner; import it.tref.portos.liferay.log.spring.SpringContextBeanScanner;
import it.tref.portos.liferay.log.utility.ClassUtils; import it.tref.portos.liferay.log.utility.ClassUtils;
import it.tref.portos.liferay.log.utility.Constants;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;

5
liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogStartupAction.java

@ -1,7 +1,5 @@
package it.tref.portos.liferay.log.action; package it.tref.portos.liferay.log.action;
import it.tref.portos.liferay.log.utility.Constants;
import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.SimpleAction; import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
@ -26,6 +24,9 @@ import com.liferay.portlet.expando.model.ExpandoTableConstants;
import com.liferay.portlet.expando.service.ExpandoColumnLocalServiceUtil; import com.liferay.portlet.expando.service.ExpandoColumnLocalServiceUtil;
import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil; import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil;
import it.tref.portos.liferay.log.shared.util.Constants;
public class LogStartupAction extends SimpleAction { public class LogStartupAction extends SimpleAction {
private static Log _log = LogFactoryUtil.getLog(LogStartupAction.class); private static Log _log = LogFactoryUtil.getLog(LogStartupAction.class);

12
liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogConstants.java

@ -2,13 +2,17 @@ package it.tref.portos.liferay.log.constants;
public class LogConstants { public class LogConstants {
/*
* Message
*/
public enum LogProcessMode { public enum LogProcessMode {
ASYNC, SYNC ASYNC, SYNC
} }
public static final String COMPANY_ID = "companyId"; public final static String COMPANY_ID = "companyId";
public static final String USER_ID = "userId"; public final static String USER_ID = "userId";
public static final String CONTENT = "payload"; public final static String CONTENT = "payload";
public final static String PARAM_PROCESS_MODE = "processMode";
public static final String PARAM_PROCESS_MODE = "processMode";
} }

9
liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogDestinationNames.java

@ -2,9 +2,10 @@ package it.tref.portos.liferay.log.constants;
public class LogDestinationNames { public class LogDestinationNames {
public static final String SERIAL = "liferay/tref/portos/monitoring_serial"; public final static String SERIAL = "liferay/tref/portos/monitoring_serial";
public static final String SYNC = "liferay/tref/portos/monitoring_sync"; public final static String SYNC = "liferay/tref/portos/monitoring_sync";
public final static String REST_SERVICE_URL = "http://rt-saas-tc01-s2.rt.tix.it:9888/logcollector";
public final static String REST_SERVICE_PORT = "9090";
public static final String REST_SERVICE_URL = "http://rt-saas-tc01-s2.rt.tix.it:9888/logcollector";
public static final String REST_SERVICE_PORT = "9090";
} }

47
liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogFormat.java

@ -3,31 +3,32 @@ package it.tref.portos.liferay.log.constants;
public class LogFormat { public class LogFormat {
/*** Mandatory ***/ /*** Mandatory ***/
public static final String HOSTNAME = "host"; public final static String HOSTNAME = "host";
public static final String IP_ADDRESS = "ipAddress"; public final static String IP_ADDRESS = "ipAddress";
public static final String DATA_EVENTO = "requestDate"; public final static String DATA_EVENTO = "requestDate";
public static final String COD_PROC = "processCode"; public final static String COD_PROC = "processCode";
public static final String COD_APP = "serverId"; public final static String COD_APP = "serverId";
public static final String ID_ISTANZA = "instanceId"; public final static String ID_ISTANZA = "instanceId";
public static final String PROG_EVENTO = "eventProgressive"; public final static String PROG_EVENTO = "eventProgressive";
public static final String COD_ATT = "activityCode"; public final static String COD_ATT = "activityCode";
public static final String COD_ESITO_EVENTO = "status"; public final static String COD_ESITO_EVENTO = "status";
public static final String TIPO_EVENTO = "eventType"; public final static String TIPO_EVENTO = "eventType";
/*** Optional ***/ /*** Optional ***/
public static final String ID_OPERATORE = "userId"; public final static String ID_OPERATORE = "userId";
/*** Labels ***/ /*** Labels ***/
public static final String HOSTNAME_LABEL = "hostname"; public final static String HOSTNAME_LABEL = "hostname";
public static final String IP_ADDRESS_LABEL = "ipAddress"; public final static String IP_ADDRESS_LABEL = "ipAddress";
public static final String DATA_EVENTO_LABEL = "dataEvento"; public final static String DATA_EVENTO_LABEL = "dataEvento";
public static final String COD_PROC_LABEL = "codProc"; public final static String COD_PROC_LABEL = "codProc";
public static final String COD_APP_LABEL = "codApp"; public final static String COD_APP_LABEL = "codApp";
public static final String ID_ISTANZA_LABEL = "idIstanza"; public final static String ID_ISTANZA_LABEL = "idIstanza";
public static final String PROG_EVENTO_LABEL = "progEvento"; public final static String PROG_EVENTO_LABEL = "progEvento";
public static final String COD_ATT_LABEL = "codAtt"; public final static String COD_ATT_LABEL = "codAtt";
public static final String COD_ESITO_EVENTO_LABEL = "codEsitoEvento"; public final static String COD_ESITO_EVENTO_LABEL = "codEsitoEvento";
public static final String TIPO_EVENTO_LABEL = "tipoEvento"; public final static String TIPO_EVENTO_LABEL = "tipoEvento";
public static final String ID_OPERATORE_LABEL = "idOperatore"; public final static String ID_OPERATORE_LABEL = "idOperatore";
public static final String COMPLEX_DATA_LABEL = "ComplexData"; public final static String COMPLEX_DATA_LABEL = "ComplexData";
} }

1
liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/html/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

1
liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/view.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% <%
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.

2
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-display.xml

@ -3,7 +3,7 @@
<display> <display>
<category name="category.hidden"> <category name="category.hidden">
<portlet id="1" /> <portlet id="1"></portlet>
</category> </category>
<category name="category.portos"> <category name="category.portos">
<category name="category.tools"> <category name="category.tools">

2
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-hook.xml

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook> <hook>

225
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/service.xml

@ -1,196 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd"> <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="it.tref.liferay.portos.mailmanager"> <service-builder package-path="it.tref.liferay.portos.mailmanager">
<author></author> <author></author>
<namespace>portos_Mail</namespace> <namespace>portos_Mail</namespace>
<entity name="Email" local-service="true" remote-service="true"> <entity name="Email" local-service="true" remote-service="true">
<!-- PK fields --> <!-- PK fields -->
<column name="emailId" type="long" primary="true"></column>
<column name="emailId" type="long" primary="true" />
<!-- Audit fields --> <!-- Audit fields -->
<column name="companyId" type="long"></column>
<column name="companyId" type="long" /> <column name="groupId" type="long"></column>
<column name="groupId" type="long" /> <column name="userId" type="long"></column>
<column name="userId" type="long" /> <column name="userName" type="String"></column>
<column name="userName" type="String" /> <column name="createDate" type="Date"></column>
<column name="createDate" type="Date" /> <column name="modifiedDate" type="Date"></column>
<column name="modifiedDate" type="Date" />
<!-- Other fields --> <!-- Other fields -->
<column name="from" type="String"></column>
<column name="from" type="String" /> <column name="to" type="String"></column>
<column name="to" type="String" /> <column name="cc" type="String"></column>
<column name="cc" type="String" /> <column name="bcc" type="String"></column>
<column name="bcc" type="String" /> <column name="bulkAddresses" type="String"></column>
<column name="bulkAddresses" type="String" /> <column name="subject" type="String"></column>
<column name="subject" type="String" /> <column name="body" type="String"></column>
<column name="body" type="String" /> <column name="htmlFormat" type="boolean"></column>
<column name="replyTo" type="String"></column>
<column name="htmlFormat" type="boolean" /> <column name="messageId" type="String"></column>
<column name="replyTo" type="String" /> <column name="inReplyTo" type="String"></column>
<column name="messageId" type="String" /> <column name="smtpHost" type="String"></column>
<column name="inReplyTo" type="String" /> <column name="smtpPort" type="int"></column>
<column name="smtpSecure" type="boolean"></column>
<column name="smtpHost" type="String" /> <column name="smtpUsername" type="String"></column>
<column name="smtpPort" type="int" /> <column name="smtpPassword" type="String"></column>
<column name="smtpSecure" type="boolean" /> <column name="sentDate" type="Date"></column>
<column name="smtpUsername" type="String" /> <column name="sent" type="boolean"></column>
<column name="smtpPassword" type="String" /> <column name="cancel" type="boolean"></column>
<column name="statusMessage" type="String"></column>
<column name="sentDate" type="Date" /> <column name="classNameId" type="long"></column>
<column name="sent" type="boolean" /> <column name="classPK" type="long"></column>
<column name="cancel" type="boolean" />
<column name="statusMessage" type="String" />
<column name="classNameId" type="long" />
<column name="classPK" type="long" />
<column name="templateName" type="String"></column> <column name="templateName" type="String"></column>
<!-- Order --> <!-- Order -->
<order> <order>
<order-column name="sentDate" order-by="desc" /> <order-column name="sentDate" order-by="desc"></order-column>
<order-column name="createDate" order-by="desc" /> <order-column name="createDate" order-by="desc"></order-column>
</order> </order>
<!-- Finder methods --> <!-- Finder methods -->
<finder name="Company" return-type="Collection"> <finder name="Company" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
</finder> </finder>
<finder name="C_G" return-type="Collection"> <finder name="C_G" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="groupId" /> <finder-column name="groupId"></finder-column>
</finder> </finder>
<finder name="C_T" return-type="Collection"> <finder name="C_T" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="groupId" /> <finder-column name="groupId"></finder-column>
<finder-column name="templateName" /> <finder-column name="templateName"></finder-column>
</finder> </finder>
<finder name="C_G_T" return-type="Collection"> <finder name="C_G_T" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="groupId" /> <finder-column name="groupId"></finder-column>
<finder-column name="templateName" /> <finder-column name="templateName"></finder-column>
</finder> </finder>
<finder name="C_C_C" return-type="Collection"> <finder name="C_C_C" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="classNameId" /> <finder-column name="classNameId"></finder-column>
<finder-column name="classPK" /> <finder-column name="classPK"></finder-column>
</finder> </finder>
<finder name="C_G_C_C" return-type="Collection"> <finder name="C_G_C_C" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="groupId" /> <finder-column name="groupId"></finder-column>
<finder-column name="classNameId" /> <finder-column name="classNameId"></finder-column>
<finder-column name="classPK" /> <finder-column name="classPK"></finder-column>
</finder> </finder>
<!-- References --> <!-- References -->
<reference package-path="com.liferay.portal" entity="Company"></reference>
<reference package-path="com.liferay.portal" entity="Company" /> <reference package-path="com.liferay.portlet.documentlibrary" entity="DLApp"></reference>
<reference package-path="com.liferay.portlet.documentlibrary"
entity="DLApp" />
</entity> </entity>
<entity name="EmailAttachment" local-service="true" remote-service="false">
<entity name="EmailAttachment" local-service="true"
remote-service="false">
<!-- PK fields --> <!-- PK fields -->
<column name="emailId" type="long" primary="true"></column>
<column name="emailId" type="long" primary="true" /> <column name="fileEntryId" type="long" primary="true"></column>
<column name="fileEntryId" type="long" primary="true" />
<!-- Finder methods --> <!-- Finder methods -->
<finder name="EmailId" return-type="Collection"> <finder name="EmailId" return-type="Collection">
<finder-column name="emailId" /> <finder-column name="emailId"></finder-column>
</finder> </finder>
<finder name="FileEntryId" return-type="EmailAttachment"> <finder name="FileEntryId" return-type="EmailAttachment">
<finder-column name="fileEntryId" /> <finder-column name="fileEntryId"></finder-column>
</finder> </finder>
<!-- References --> <!-- References -->
<reference package-path="com.liferay.portal" entity="Company"></reference>
<reference package-path="com.liferay.portal" entity="Company" /> <reference package-path="com.liferay.portlet.documentlibrary" entity="DLApp"></reference>
<reference package-path="com.liferay.portlet.documentlibrary"
entity="DLApp" />
</entity> </entity>
<entity name="EmailTemplate" local-service="true" remote-service="true">
<entity name="EmailTemplate" local-service="true"
remote-service="true">
<!-- PK fields --> <!-- PK fields -->
<column name="emailTemplateId" type="long" primary="true"></column>
<column name="emailTemplateId" type="long" primary="true" />
<!-- Group instance --> <!-- Group instance -->
<column name="groupId" type="long"></column>
<column name="groupId" type="long" />
<!-- Audit fields --> <!-- Audit fields -->
<column name="companyId" type="long"></column>
<column name="companyId" type="long" /> <column name="userId" type="long"></column>
<column name="userId" type="long" /> <column name="userName" type="String"></column>
<column name="userName" type="String" /> <column name="createDate" type="Date"></column>
<column name="createDate" type="Date" /> <column name="modifiedDate" type="Date"></column>
<column name="modifiedDate" type="Date" />
<!-- Other fields --> <!-- Other fields -->
<column name="templateName" type="String"></column>
<column name="templateName" type="String" /> <column name="from" type="String"></column>
<column name="to" type="String"></column>
<column name="from" type="String" /> <column name="cc" type="String"></column>
<column name="to" type="String" /> <column name="ccn" type="String"></column>
<column name="cc" type="String" /> <column name="subject" type="String"></column>
<column name="ccn" type="String" /> <column name="body" type="String"></column>
<column name="subject" type="String" /> <column name="attachmentPermitted" type="Boolean"></column>
<column name="body" type="String" /> <column name="additionalParameters" type="String"></column>
<column name="attachmentPermitted" type="Boolean" />
<column name="additionalParameters" type="String" />
<!-- Order --> <!-- Order -->
<order by="asc"> <order by="asc">
<order-column name="emailTemplateId" /> <order-column name="emailTemplateId"></order-column>
</order> </order>
<!-- Finder methods --> <!-- Finder methods -->
<finder name="Company" return-type="Collection"> <finder name="Company" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
</finder> </finder>
<finder name="C_GroupId" return-type="Collection"> <finder name="C_GroupId" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="groupId" /> <finder-column name="groupId"></finder-column>
</finder> </finder>
<finder name="C_GroupId_Name" return-type="EmailTemplate" unique="true"> <finder name="C_GroupId_Name" return-type="EmailTemplate" unique="true">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="groupId" /> <finder-column name="groupId"></finder-column>
<finder-column name="templateName" /> <finder-column name="templateName"></finder-column>
</finder> </finder>
<finder name="C_Name" return-type="EmailTemplate" unique="true"> <finder name="C_Name" return-type="EmailTemplate" unique="true">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="templateName" /> <finder-column name="templateName"></finder-column>
</finder> </finder>
</entity> </entity>
<exceptions> <exceptions>
<exception>RequiredEmailFrom</exception> <exception>RequiredEmailFrom</exception>
<exception>RequiredEmailTo</exception> <exception>RequiredEmailTo</exception>

4
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.properties

@ -4,6 +4,7 @@ IX_58C7CF0B=portos_Mail_Email.C_G_C_C
IX_489D58F=portos_Mail_Email.C_G_T IX_489D58F=portos_Mail_Email.C_G_T
IX_489D58F=portos_Mail_Email.C_T IX_489D58F=portos_Mail_Email.C_T
IX_73A01DF4=portos_Mail_Email.Company IX_73A01DF4=portos_Mail_Email.Company
IX_73A01DF4=portos_Mail_Email.G_C
IX_20966470=portos_Mail_EmailAttachment.EmailId IX_20966470=portos_Mail_EmailAttachment.EmailId
IX_CF970AA=portos_Mail_EmailAttachment.FileEntryId IX_CF970AA=portos_Mail_EmailAttachment.FileEntryId
@ -12,3 +13,6 @@ IX_59165C50=portos_Mail_EmailTemplate.C_GroupId
IX_6935F329=portos_Mail_EmailTemplate.C_GroupId_Name IX_6935F329=portos_Mail_EmailTemplate.C_GroupId_Name
IX_EE0B52F3=portos_Mail_EmailTemplate.C_Name IX_EE0B52F3=portos_Mail_EmailTemplate.C_Name
IX_28EAC59A=portos_Mail_EmailTemplate.Company IX_28EAC59A=portos_Mail_EmailTemplate.Company
IX_EC38E0B0=portos_Mail_EmailTemplateAttachment.EmailTemplateId
IX_4577CF50=portos_Mail_EmailTemplateAttachment.FileEntryId

3
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.sql

@ -11,3 +11,6 @@ create index IX_28EAC59A on portos_Mail_EmailTemplate (companyId);
create index IX_59165C50 on portos_Mail_EmailTemplate (companyId, groupId); create index IX_59165C50 on portos_Mail_EmailTemplate (companyId, groupId);
create unique index IX_6935F329 on portos_Mail_EmailTemplate (companyId, groupId, templateName); create unique index IX_6935F329 on portos_Mail_EmailTemplate (companyId, groupId, templateName);
create unique index IX_EE0B52F3 on portos_Mail_EmailTemplate (companyId, templateName); create unique index IX_EE0B52F3 on portos_Mail_EmailTemplate (companyId, templateName);
create index IX_EC38E0B0 on portos_Mail_EmailTemplateAttachment (emailTemplateId);
create index IX_4577CF50 on portos_Mail_EmailTemplateAttachment (fileEntryId);

6
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/tables.sql

@ -55,3 +55,9 @@ create table portos_Mail_EmailTemplate (
attachmentPermitted BOOLEAN, attachmentPermitted BOOLEAN,
additionalParameters VARCHAR(75) null additionalParameters VARCHAR(75) null
); );
create table portos_Mail_EmailTemplateAttachment (
emailTemplateId LONG not null,
fileEntryId LONG not null,
primary key (emailTemplateId, fileEntryId)
);

22
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/messaging/MailManagerMessageListener.java

@ -1,10 +1,5 @@
package it.tref.liferay.portos.mailmanager.messaging; package it.tref.liferay.portos.mailmanager.messaging;
import it.tref.liferay.portos.mailmanager.permission.ActionKeys;
import it.tref.liferay.portos.mailmanager.permission.EmailPermission;
import it.tref.liferay.portos.mailmanager.shared.util.MailManagerConstants;
import it.tref.liferay.portos.mailmanager.util.MailManagerUtil;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.mail.MailMessage; import com.liferay.portal.kernel.mail.MailMessage;
@ -18,6 +13,11 @@ import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil;
import it.tref.liferay.portos.mailmanager.permission.ActionKeys;
import it.tref.liferay.portos.mailmanager.permission.EmailPermission;
import it.tref.liferay.portos.mailmanager.shared.util.MailManagerConstants;
import it.tref.liferay.portos.mailmanager.util.MailManagerUtil;
public class MailManagerMessageListener implements MessageListener { public class MailManagerMessageListener implements MessageListener {
private static final Log _log = LogFactoryUtil.getLog(MailManagerMessageListener.class); private static final Log _log = LogFactoryUtil.getLog(MailManagerMessageListener.class);
@ -26,26 +26,34 @@ public class MailManagerMessageListener implements MessageListener {
public void receive(Message message) throws MessageListenerException { public void receive(Message message) throws MessageListenerException {
Message responseMessage = MessageBusUtil.createResponseMessage(message); Message responseMessage = MessageBusUtil.createResponseMessage(message);
try { try {
String mode = (String) message.get("mode"); String mode = (String) message.get("mode");
MailMessage mailMessage = (MailMessage) message.getPayload(); MailMessage mailMessage = (MailMessage) message.getPayload();
ServiceContext serviceContext = (ServiceContext) message.get("serviceContext"); ServiceContext serviceContext = (ServiceContext) message.get("serviceContext");
boolean checkPermission = GetterUtil.getBoolean(message.get("checkPermission"), true); boolean checkPermission = GetterUtil.getBoolean(message.get("checkPermission"), Boolean.TRUE);
String className = GetterUtil.getString(message.get("className")); String className = GetterUtil.getString(message.get("className"));
long classPK = GetterUtil.getLong(message.get("classPK")); long classPK = GetterUtil.getLong(message.get("classPK"));
boolean sendSync = false; boolean sendSync = false;
if (MailManagerConstants.MESSAGING_SEND_MODE_SYNC.equals(mode)) { if (MailManagerConstants.MESSAGING_SEND_MODE_SYNC.equals(mode)) {
sendSync = true; sendSync = true;
} }
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil
.getUser(serviceContext.getUserId())); .getUser(serviceContext.getUserId()));
if (checkPermission) { if (checkPermission) {
EmailPermission.check(permissionChecker, serviceContext.getScopeGroupId(), ActionKeys.SEND_EMAIL); EmailPermission.check(permissionChecker, serviceContext.getScopeGroupId(),
ActionKeys.SEND_EMAIL);
} }
MailManagerUtil.addEmail(className, classPK, mailMessage, sendSync, serviceContext); MailManagerUtil.addEmail(className, classPK, mailMessage, sendSync, serviceContext);
responseMessage.setPayload(Boolean.TRUE); responseMessage.setPayload(Boolean.TRUE);
} catch (Exception e) { } catch (Exception e) {
_log.error(e, e); _log.error(e, e);
responseMessage.setPayload(Boolean.FALSE); responseMessage.setPayload(Boolean.FALSE);
responseMessage.put("exceptionMessage", e.getMessage()); responseMessage.put("exceptionMessage", e.getMessage());
} finally { } finally {

71
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailAttachmentLocalServiceImpl.java

@ -1,21 +1,18 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. The contents of this file are subject to the terms of the * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* Liferay Enterprise Subscription License ("License"). You may not use this file except in compliance with the License. *
* You can obtain a copy of the License by contacting Liferay, Inc. See the License for the specific language governing * The contents of this file are subject to the terms of the Liferay Enterprise Subscription License
* permissions and limitations under the License, including but not limited to distribution rights of the Software. * ("License"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License by contacting Liferay, Inc. See the License for the specific language
* governing permissions and limitations under the License, including but not limited to
* distribution rights of the Software.
*
*
*
*/ */
package it.tref.liferay.portos.mailmanager.service.impl; package it.tref.liferay.portos.mailmanager.service.impl;
import it.tref.liferay.portos.mailmanager.EmailAttachmentFileException;
import it.tref.liferay.portos.mailmanager.EmailAttachmentTitleException;
import it.tref.liferay.portos.mailmanager.NoSuchEmailException;
import it.tref.liferay.portos.mailmanager.model.EmailAttachment;
import it.tref.liferay.portos.mailmanager.service.base.EmailAttachmentLocalServiceBaseImpl;
import it.tref.liferay.portos.mailmanager.service.persistence.EmailAttachmentPK;
import java.io.File;
import java.util.List;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
@ -30,14 +27,27 @@ import com.liferay.portal.model.User;
import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.security.permission.ActionKeys;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import it.tref.liferay.portos.mailmanager.EmailAttachmentFileException;
import it.tref.liferay.portos.mailmanager.EmailAttachmentTitleException;
import it.tref.liferay.portos.mailmanager.NoSuchEmailException;
import it.tref.liferay.portos.mailmanager.model.EmailAttachment;
import it.tref.liferay.portos.mailmanager.service.base.EmailAttachmentLocalServiceBaseImpl;
import it.tref.liferay.portos.mailmanager.service.persistence.EmailAttachmentPK;
import java.io.File;
import java.util.List;
/** /**
* The implementation of the email attachment local service. * The implementation of the email attachment local service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalService} interface.
*
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * This is a local service. Methods of this service will not have security checks based on the
* credentials because this service can only be accessed from within the same VM. * propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author * @author
@ -46,11 +56,12 @@ import com.liferay.portal.service.ServiceContext;
*/ */
public class EmailAttachmentLocalServiceImpl extends EmailAttachmentLocalServiceBaseImpl { public class EmailAttachmentLocalServiceImpl extends EmailAttachmentLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalServiceUtil} to access the email attachment local *
* service. * Never reference this interface directly. Always use {@link
* it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalServiceUtil} to access the
* email attachment local service.
*/ */
@Override
public EmailAttachment addEmailAttachment(long companyId, long emailId, long folderId, String fileName, File file) public EmailAttachment addEmailAttachment(long companyId, long emailId, long folderId, String fileName, File file)
throws PortalException, SystemException { throws PortalException, SystemException {
@ -71,24 +82,23 @@ public class EmailAttachmentLocalServiceImpl extends EmailAttachmentLocalService
} }
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); serviceContext.setGroupPermissions(new String[] {ActionKeys.VIEW});
serviceContext.setGuestPermissions(new String[] { ActionKeys.VIEW }); serviceContext.setGuestPermissions(new String[] {ActionKeys.VIEW});
FileEntry fileEntry = FileEntry fileEntry =
dlAppLocalService.addFileEntry(defaultUser.getUserId(), folder.getRepositoryId(), folder.getFolderId(), dlAppLocalService.addFileEntry(defaultUser.getUserId(), folder.getRepositoryId(), folder.getFolderId(),
sourceFileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, file, serviceContext); sourceFileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, file, serviceContext);
EmailAttachment emailAttachment = EmailAttachment emailAttachment =
createEmailAttachment(new EmailAttachmentPK(emailId, fileEntry emailAttachmentLocalService.createEmailAttachment(new EmailAttachmentPK(emailId, fileEntry.getFileEntryId()));
.getFileEntryId()));
return addEmailAttachment(emailAttachment); return emailAttachmentLocalService.addEmailAttachment(emailAttachment);
} }
@Override @Override
public EmailAttachment deleteEmailAttachment(EmailAttachmentPK emailAttachmentPK) throws PortalException, public EmailAttachment deleteEmailAttachment(EmailAttachmentPK emailAttachmentPK) throws PortalException,
SystemException { SystemException {
EmailAttachment emailAttachment = getEmailAttachment(emailAttachmentPK); EmailAttachment emailAttachment = emailAttachmentLocalService.getEmailAttachment(emailAttachmentPK);
return deleteEmailAttachment(emailAttachment); return deleteEmailAttachment(emailAttachment);
} }
@ -101,27 +111,24 @@ public class EmailAttachmentLocalServiceImpl extends EmailAttachmentLocalService
try { try {
dlAppLocalService.deleteFileEntry(emailAttachment.getFileEntryId()); dlAppLocalService.deleteFileEntry(emailAttachment.getFileEntryId());
} catch (PortalException e) {} } catch (PortalException e) {
}
return emailAttachment; return emailAttachment;
} }
@Override
public List<EmailAttachment> findByEmailId(long emailId) throws SystemException { public List<EmailAttachment> findByEmailId(long emailId) throws SystemException {
return emailAttachmentPersistence.findByEmailId(emailId); return emailAttachmentPersistence.findByEmailId(emailId);
} }
@Override
public List<EmailAttachment> findByEmailId(long emailId, int start, int end) throws SystemException { public List<EmailAttachment> findByEmailId(long emailId, int start, int end) throws SystemException {
return emailAttachmentPersistence.findByEmailId(emailId); return emailAttachmentPersistence.findByEmailId(emailId);
} }
@Override
public int countByEmailId(long emailId) throws SystemException { public int countByEmailId(long emailId) throws SystemException {
return emailAttachmentPersistence.countByEmailId(emailId); return emailAttachmentPersistence.countByEmailId(emailId);
} }
@Override
public EmailAttachment fetchByFileEntryId(long fileEntryId) throws SystemException { public EmailAttachment fetchByFileEntryId(long fileEntryId) throws SystemException {
return emailAttachmentPersistence.fetchByFileEntryId(fileEntryId); return emailAttachmentPersistence.fetchByFileEntryId(fileEntryId);
} }

285
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailLocalServiceImpl.java

@ -1,12 +1,36 @@
/** /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. The contents of this file are subject to the terms of the * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
* Liferay Enterprise Subscription License ("License"). You may not use this file except in compliance with the License. *
* You can obtain a copy of the License by contacting Liferay, Inc. See the License for the specific language governing * The contents of this file are subject to the terms of the Liferay Enterprise Subscription License
* permissions and limitations under the License, including but not limited to distribution rights of the Software. * ("License"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License by contacting Liferay, Inc. See the License for the specific language
* governing permissions and limitations under the License, including but not limited to
* distribution rights of the Software.
*
*
*
*/ */
package it.tref.liferay.portos.mailmanager.service.impl; package it.tref.liferay.portos.mailmanager.service.impl;
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.repository.model.Folder;
import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Company;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.User;
import com.liferay.portal.security.permission.ActionKeys;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
import it.tref.liferay.portos.mailmanager.EmailBccException; import it.tref.liferay.portos.mailmanager.EmailBccException;
import it.tref.liferay.portos.mailmanager.EmailBulkAddressesException; import it.tref.liferay.portos.mailmanager.EmailBulkAddressesException;
import it.tref.liferay.portos.mailmanager.EmailCcException; import it.tref.liferay.portos.mailmanager.EmailCcException;
@ -27,30 +51,18 @@ import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
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.repository.model.Folder;
import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Company;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.User;
import com.liferay.portal.security.permission.ActionKeys;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
/** /**
* The implementation of the email local service. * The implementation of the email local service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are
* their definitions into the {@link it.noovle.azimut.icf.mailmanager.service.EmailLocalService} interface. * added, rerun ServiceBuilder to copy their definitions into the
* {@link it.noovle.azimut.icf.mailmanager.service.EmailLocalService} interface.
*
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * This is a local service. Methods of this service will not have security
* credentials because this service can only be accessed from within the same VM. * checks based on the propagated JAAS credentials because this service can only
* be accessed from within the same VM.
* </p> * </p>
* *
* @author * @author
@ -59,67 +71,70 @@ import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
*/ */
public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.noovle.azimut.icf.mailmanager.service.EmailLocalServiceUtil} to access the email local service. *
* Never reference this interface directly. Always use {@link
* it.noovle.azimut.icf.mailmanager.service.EmailLocalServiceUtil} to access
* the email local service.
*/ */
@Override private final static Log _log = LogFactoryUtil.getLog(EmailLocalServiceImpl.class);
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[],
String subject, String body, boolean htmlFormat, ServiceContext serviceContext) throws Exception {
return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, null, null, public Email addEmail(String className, long classPK, String from, String to[], String cc[],
0, false, null, null, Collections.<FileAttachment> emptyList(), serviceContext); String bcc[], String subject, String body, boolean htmlFormat, ServiceContext serviceContext)
throws Exception {
return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null,
null, null, 0, false, null, null, Collections.<FileAttachment> emptyList(), serviceContext);
} }
@Override public Email addEmail(String className, long classPK, String from, String to[], String cc[],
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], String bcc[], String subject, String body, boolean htmlFormat,
String subject, String body, boolean htmlFormat, List<FileAttachment> fileAttachments, List<FileAttachment> fileAttachments, ServiceContext serviceContext) throws Exception {
ServiceContext serviceContext) throws Exception { return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null,
null, null, 0, false, null, null, fileAttachments, false, null, serviceContext);
return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, null, null,
0, false, null, null, fileAttachments, false, null, serviceContext);
} }
@Override public Email addEmail(String className, long classPK, String from, String to[], String cc[],
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], String bcc[], String[] bulkAddresses, String subject, String body, boolean htmlFormat,
String[] bulkAddresses, String subject, String body, boolean htmlFormat, String[] replyTo, String[] replyTo, String messageId, String inReplyTo, String smtpHost, int smtpPort,
String messageId, String inReplyTo, String smtpHost, int smtpPort, boolean smtpSecure, String smtpUsername, boolean smtpSecure, String smtpUsername, String smtpPassword,
String smtpPassword, List<FileAttachment> fileAttachments, ServiceContext serviceContext) throws Exception { List<FileAttachment> fileAttachments, ServiceContext serviceContext) throws Exception {
return addEmail(className, classPK, from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat,
return addEmail(className, classPK, from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, replyTo, replyTo, messageId, inReplyTo, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword,
messageId, inReplyTo, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword, fileAttachments, fileAttachments, false, null, serviceContext);
false, null, serviceContext);
} }
@Override public Email addEmail(String className, long classPK, String from, String to[], String cc[],
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], String bcc[], String subject, String body, boolean htmlFormat,
String subject, String body, boolean htmlFormat, List<FileAttachment> fileAttachments, boolean sendSync, List<FileAttachment> fileAttachments, boolean sendSync, ServiceContext serviceContext)
ServiceContext serviceContext) throws Exception { throws Exception {
return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null,
return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, null, null, null, null, 0, false, null, null, fileAttachments, sendSync, null, serviceContext);
0, false, null, null, fileAttachments, sendSync, null, serviceContext);
} }
@Override public Email addEmail(String className, long classPK, String from, String to[], String cc[],
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], String bcc[], String subject, String body, boolean htmlFormat,
String subject, String body, boolean htmlFormat, List<FileAttachment> fileAttachments, boolean sendSync, List<FileAttachment> fileAttachments, boolean sendSync, String templateName,
String templateName, ServiceContext serviceContext) throws Exception { ServiceContext serviceContext) throws Exception {
return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null,
return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, null, null, null, null, 0, false, null, null, fileAttachments, sendSync, templateName, serviceContext);
0, false, null, null, fileAttachments, sendSync, templateName, serviceContext);
} }
@Override public Email addEmail(String className, long classPK, String from, String to[], String cc[],
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], String bcc[], String[] bulkAddresses, String subject, String body, boolean htmlFormat,
String[] bulkAddresses, String subject, String body, boolean htmlFormat, String[] replyTo, String[] replyTo, String messageId, String inReplyTo, String smtpHost, int smtpPort,
String messageId, String inReplyTo, String smtpHost, int smtpPort, boolean smtpSecure, String smtpUsername, boolean smtpSecure, String smtpUsername, String smtpPassword,
String smtpPassword, List<FileAttachment> fileAttachments, boolean sendSync, String templateName, List<FileAttachment> fileAttachments, boolean sendSync, String templateName,
ServiceContext serviceContext) throws Exception { ServiceContext serviceContext) throws Exception {
User user = userLocalService.getUser(serviceContext.getUserId()); User user = userLocalService.getUser(serviceContext.getUserId());
Date now = new Date(); Date now = new Date();
validate(from, to, cc, bcc, bulkAddresses, subject, body, replyTo); validate(from, to, cc, bcc, bulkAddresses, subject, body, replyTo);
Email email = createEmail(counterLocalService.increment(Email.class.getName()));
Email email = emailLocalService.createEmail(counterLocalService.increment(Email.class.getName()));
email.setGroupId(serviceContext.getScopeGroupId()); email.setGroupId(serviceContext.getScopeGroupId());
email.setCompanyId(serviceContext.getCompanyId()); email.setCompanyId(serviceContext.getCompanyId());
email.setCreateDate(serviceContext.getCreateDate(now)); email.setCreateDate(serviceContext.getCreateDate(now));
@ -128,6 +143,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email.setClassPK(classPK); email.setClassPK(classPK);
email.setUserId(user.getUserId()); email.setUserId(user.getUserId());
email.setUserName(user.getFullName()); email.setUserName(user.getFullName());
email.setFrom(from); email.setFrom(from);
email.setTo(StringUtil.merge(to, StringPool.COMMA)); email.setTo(StringUtil.merge(to, StringPool.COMMA));
email.setCc(StringUtil.merge(cc, StringPool.COMMA)); email.setCc(StringUtil.merge(cc, StringPool.COMMA));
@ -135,10 +151,12 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email.setBulkAddresses(StringUtil.merge(bulkAddresses, StringPool.COMMA)); email.setBulkAddresses(StringUtil.merge(bulkAddresses, StringPool.COMMA));
email.setSubject(subject); email.setSubject(subject);
email.setBody(body); email.setBody(body);
email.setHtmlFormat(htmlFormat); email.setHtmlFormat(htmlFormat);
email.setReplyTo(StringUtil.merge(replyTo, StringPool.COMMA)); email.setReplyTo(StringUtil.merge(replyTo, StringPool.COMMA));
email.setMessageId(messageId); email.setMessageId(messageId);
email.setInReplyTo(inReplyTo); email.setInReplyTo(inReplyTo);
email.setSmtpHost(smtpHost); email.setSmtpHost(smtpHost);
email.setSmtpPort(smtpPort); email.setSmtpPort(smtpPort);
email.setSmtpSecure(smtpSecure); email.setSmtpSecure(smtpSecure);
@ -146,37 +164,46 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email.setSmtpPassword(smtpPassword); email.setSmtpPassword(smtpPassword);
email.setCancel(false); email.setCancel(false);
email.setTemplateName(templateName); email.setTemplateName(templateName);
email = addEmail(email); email = addEmail(email);
// Email Attachments // Email Attachments
if (fileAttachments != null && !fileAttachments.isEmpty()) { if (fileAttachments != null && !fileAttachments.isEmpty()) {
Folder folder = addEmailAttachmentsFolder(serviceContext.getCompanyId(), email.getEmailId()); Folder folder = addEmailAttachmentsFolder(serviceContext.getCompanyId(), email.getEmailId());
for (FileAttachment fileAttachment : fileAttachments) { for (FileAttachment fileAttachment : fileAttachments) {
if (fileAttachment instanceof FileAttachment) { if (fileAttachment instanceof FileAttachment) {
((it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) fileAttachment).generateFile(); ((it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) fileAttachment)
.generateFile();
} }
emailAttachmentLocalService.addEmailAttachment(serviceContext.getCompanyId(), email.getEmailId(), emailAttachmentLocalService.addEmailAttachment(serviceContext.getCompanyId(),
folder.getFolderId(), fileAttachment.getFileName(), fileAttachment.getFile()); email.getEmailId(), folder.getFolderId(), fileAttachment.getFileName(),
fileAttachment.getFile());
FileUtil.delete(fileAttachment.getFile()); FileUtil.delete(fileAttachment.getFile());
} }
} }
// Manifattura Web Group per Regione Siciliana
// Il valore di ritorno viene ignorato da SchedulerInvioDocumenti, le mail impostate per l'invio asincrono si // Il valore di ritorno viene ignorato da SchedulerInvioDocumenti, le
// perdono nell'abisso dell'oblio. Siccome questo è già un task asincrono, inviamo in maniera sincrona e // mail impostate per l'invio asincrono si perdono nell'abisso
// festeggiamo. // dell'oblio. Siccome questo è già un task asincrono, inviamo in
// maniera sincrona e festeggiamo.
sendSync = true; sendSync = true;
if (sendSync) { if (sendSync) {
MailSenderUtil.sendMail(email); MailSenderUtil.sendMail(email);
markAsSent(email.getEmailId(), new Date(), StringPool.BLANK); markAsSent(email.getEmailId(), new Date(), StringPool.BLANK);
} }
return email; return email;
} }
@Override public Email updateEmail(long emailId, String from, String to[], String cc[], String bcc[],
public Email updateEmail(long emailId, String from, String to[], String cc[], String bcc[], String subject, String subject, String body, ServiceContext serviceContext) throws Exception {
String body, ServiceContext serviceContext) throws Exception {
Email email = emailLocalService.getEmail(emailId);
Email email = getEmail(emailId);
validate(from, to, cc, bcc, null, subject, body, null); validate(from, to, cc, bcc, null, subject, body, null);
email.setModifiedDate(new Date()); email.setModifiedDate(new Date());
email.setFrom(from); email.setFrom(from);
email.setTo(StringUtil.merge(to, StringPool.COMMA)); email.setTo(StringUtil.merge(to, StringPool.COMMA));
@ -184,54 +211,60 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email.setBcc(StringUtil.merge(bcc, StringPool.COMMA)); email.setBcc(StringUtil.merge(bcc, StringPool.COMMA));
email.setSubject(subject); email.setSubject(subject);
email.setBody(body); email.setBody(body);
return updateEmail(email); return updateEmail(email);
} }
@Override public Email markAsSent(long emailId, Date sentDate, String statusMessage) throws PortalException,
public Email markAsSent(long emailId, Date sentDate, String statusMessage) throws PortalException, SystemException { SystemException {
Email email = getEmail(emailId); Email email = emailLocalService.getEmail(emailId);
email.setModifiedDate(new Date()); email.setModifiedDate(new Date());
email.setSent(true); email.setSent(true);
email.setSentDate(sentDate); email.setSentDate(sentDate);
email.setStatusMessage(statusMessage); email.setStatusMessage(statusMessage);
return updateEmail(email); return updateEmail(email);
} }
@Override public Email updateStatusMessage(long emailId, String statusMessage) throws PortalException,
public Email updateStatusMessage(long emailId, String statusMessage) throws PortalException, SystemException { SystemException {
Email email = getEmail(emailId); Email email = emailLocalService.getEmail(emailId);
email.setModifiedDate(new Date()); email.setModifiedDate(new Date());
email.setStatusMessage(statusMessage); email.setStatusMessage(statusMessage);
return updateEmail(email); return updateEmail(email);
} }
@Override
public Email resendEmail(long emailId) throws PortalException, SystemException { public Email resendEmail(long emailId) throws PortalException, SystemException {
Email email = getEmail(emailId); Email email = emailLocalService.getEmail(emailId);
email.setModifiedDate(new Date()); email.setModifiedDate(new Date());
email.setStatusMessage(""); email.setStatusMessage("");
email.setSent(false); email.setSent(false);
email.setSentDate(null); email.setSentDate(null);
email.setCancel(false); email.setCancel(false);
return updateEmail(email); return updateEmail(email);
} }
@Override
public Email cancelEmail(long emailId) throws PortalException, SystemException { public Email cancelEmail(long emailId) throws PortalException, SystemException {
Email email = getEmail(emailId); Email email = emailLocalService.getEmail(emailId);
email.setModifiedDate(new Date()); email.setModifiedDate(new Date());
email.setCancel(true); email.setCancel(true);
return updateEmail(email); return updateEmail(email);
} }
@Override @Override
public Email deleteEmail(long emailId) throws PortalException, SystemException { public Email deleteEmail(long emailId) throws PortalException, SystemException {
Email email = emailLocalService.getEmail(emailId);
Email email = getEmail(emailId);
return deleteEmail(email); return deleteEmail(email);
} }
@ -239,126 +272,108 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
public Email deleteEmail(Email email) throws SystemException { public Email deleteEmail(Email email) throws SystemException {
super.deleteEmail(email); super.deleteEmail(email);
// Email Attachments // Email Attachments
List<EmailAttachment> emailAttachments = emailAttachmentLocalService.findByEmailId(email.getEmailId());
List<EmailAttachment> emailAttachments = emailAttachmentLocalService
.findByEmailId(email.getEmailId());
for (EmailAttachment emailAttachment : emailAttachments) { for (EmailAttachment emailAttachment : emailAttachments) {
emailAttachmentLocalService.deleteEmailAttachment(emailAttachment); emailAttachmentLocalService.deleteEmailAttachment(emailAttachment);
} }
return email; return email;
} }
@Override
public List<Email> findByCompany(long companyId) throws SystemException { public List<Email> findByCompany(long companyId) throws SystemException {
return emailPersistence.findByCompany(companyId); return emailPersistence.findByCompany(companyId);
} }
@Override
public List<Email> findByCompany(long companyId, int start, int end) throws SystemException { public List<Email> findByCompany(long companyId, int start, int end) throws SystemException {
return emailPersistence.findByCompany(companyId, start, end); return emailPersistence.findByCompany(companyId, start, end);
} }
@Override
public List<Email> findByCompany(long companyId, int start, int end, OrderByComparator orderByComparator) public List<Email> findByCompany(long companyId, int start, int end, OrderByComparator orderByComparator)
throws SystemException { throws SystemException {
return emailPersistence.findByCompany(companyId, start, end, orderByComparator); return emailPersistence.findByCompany(companyId, start, end, orderByComparator);
} }
@Override
public int countByCompany(long companyId) throws SystemException { public int countByCompany(long companyId) throws SystemException {
return emailPersistence.countByCompany(companyId); return emailPersistence.countByCompany(companyId);
} }
@Override
public List<Email> findByC_G(long companyId, long groupId) throws SystemException { public List<Email> findByC_G(long companyId, long groupId) throws SystemException {
return emailPersistence.findByC_G(companyId, groupId); return emailPersistence.findByC_G(companyId, groupId);
} }
@Override
public List<Email> findByC_G(long companyId, long groupId, int start, int end) throws SystemException { public List<Email> findByC_G(long companyId, long groupId, int start, int end) throws SystemException {
return emailPersistence.findByC_G(companyId, groupId, start, end); return emailPersistence.findByC_G(companyId, groupId, start, end);
} }
@Override public List<Email> findByC_G(long companyId, long groupId, int start, int end,
public List<Email> findByC_G(long companyId, long groupId, int start, int end, OrderByComparator orderByComparator) OrderByComparator orderByComparator) throws SystemException {
throws SystemException {
return emailPersistence.findByC_G(companyId, groupId, start, end, orderByComparator); return emailPersistence.findByC_G(companyId, groupId, start, end, orderByComparator);
} }
@Override
public int countByC_G(long companyId, long groupId) throws SystemException { public int countByC_G(long companyId, long groupId) throws SystemException {
return emailPersistence.countByC_G(companyId, groupId); return emailPersistence.countByC_G(companyId, groupId);
} }
@Override
public List<Email> findByC_G_T(long companyId, long groupId, String templateName) throws SystemException { public List<Email> findByC_G_T(long companyId, long groupId, String templateName) throws SystemException {
return emailPersistence.findByC_G_T(companyId, groupId, templateName); return emailPersistence.findByC_G_T(companyId, groupId, templateName);
} }
@Override
public List<Email> findByC_G_T(long companyId, long groupId, String templateName, int start, int end) public List<Email> findByC_G_T(long companyId, long groupId, String templateName, int start, int end)
throws SystemException { throws SystemException {
return emailPersistence.findByC_G_T(companyId, groupId, templateName, start, end); return emailPersistence.findByC_G_T(companyId, groupId, templateName, start, end);
} }
@Override
public int countByC_G_T(long companyId, long groupId, String templateName) throws SystemException { public int countByC_G_T(long companyId, long groupId, String templateName) throws SystemException {
return emailPersistence.countByC_G_T(companyId, groupId, templateName); return emailPersistence.countByC_G_T(companyId, groupId, templateName);
} }
@Override
public List<Email> findByC_G_C_C(long companyId, long groupId, long classNameId, long classPK) public List<Email> findByC_G_C_C(long companyId, long groupId, long classNameId, long classPK)
throws SystemException { throws SystemException {
return emailPersistence.findByC_G_C_C(companyId, groupId, classNameId, classPK); return emailPersistence.findByC_G_C_C(companyId, groupId, classNameId, classPK);
} }
@Override public List<Email> findByC_G_C_C(long companyId, long groupId, long classNameId, long classPK, int start,
public List<Email> findByC_G_C_C(long companyId, long groupId, long classNameId, long classPK, int start, int end) int end) throws SystemException {
throws SystemException {
return emailPersistence.findByC_G_C_C(companyId, groupId, classNameId, classPK, start, end); return emailPersistence.findByC_G_C_C(companyId, groupId, classNameId, classPK, start, end);
} }
@Override public int countByC_G_C_C(long companyId, long groupId, long classNameId, long classPK)
public int countByC_G_C_C(long companyId, long groupId, long classNameId, long classPK) throws SystemException { throws SystemException {
return emailPersistence.countByC_G_C_C(companyId, groupId, classNameId, classPK); return emailPersistence.countByC_G_C_C(companyId, groupId, classNameId, classPK);
} }
private Folder addEmailAttachmentsFolder(long companyId, long emailId) throws PortalException, SystemException { private Folder addEmailAttachmentsFolder(long companyId, long emailId) throws PortalException,
SystemException {
Company company = companyLocalService.getCompany(companyId); Company company = companyLocalService.getCompany(companyId);
Group companyGroup = company.getGroup(); Group companyGroup = company.getGroup();
User defaultUser = company.getDefaultUser(); User defaultUser = company.getDefaultUser();
Folder folder =
dlAppLocalService.getFolder(companyGroup.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, Folder folder = dlAppLocalService.getFolder(companyGroup.getGroupId(),
EmailConstants.DEFAULT_ATTACHMENTS_FOLDER_NAME); DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, EmailConstants.DEFAULT_ATTACHMENTS_FOLDER_NAME);
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
serviceContext.setGuestPermissions(new String[] { ActionKeys.VIEW }); serviceContext.setGuestPermissions(new String[] { ActionKeys.VIEW });
return dlAppLocalService.addFolder(defaultUser.getUserId(), folder.getRepositoryId(), folder.getFolderId(),
String.valueOf(emailId), StringPool.BLANK, serviceContext); return dlAppLocalService.addFolder(defaultUser.getUserId(), folder.getRepositoryId(),
folder.getFolderId(), String.valueOf(emailId), StringPool.BLANK, serviceContext);
} }
private void validate(String from, String to[], String cc[], String bcc[], String[] bulkAddresses, String subject, private void validate(String from, String to[], String cc[], String bcc[], String[] bulkAddresses,
String body, String[] replyTo) throws PortalException { String subject, String body, String[] replyTo) throws PortalException {
if (Validator.isNull(from)) { if (Validator.isNull(from)) {
throw new RequiredEmailFromException(); throw new RequiredEmailFromException();
} else if (!Validator.isEmailAddress(from)) { } else if (!Validator.isEmailAddress(from)) {
throw new EmailFromException(); throw new EmailFromException();
} }
if (to == null || (to != null && to.length == 0)) { if (to == null || (to != null && to.length == 0)) {
throw new RequiredEmailToException(); throw new RequiredEmailToException();
} else { } else {
@ -368,6 +383,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
} }
} }
} }
if (cc != null && cc.length > 0) { if (cc != null && cc.length > 0) {
for (String emailAddress : cc) { for (String emailAddress : cc) {
if (!Validator.isEmailAddress(emailAddress)) { if (!Validator.isEmailAddress(emailAddress)) {
@ -375,6 +391,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
} }
} }
} }
if (bcc != null && bcc.length > 0) { if (bcc != null && bcc.length > 0) {
for (String emailAddress : bcc) { for (String emailAddress : bcc) {
if (!Validator.isEmailAddress(emailAddress)) { if (!Validator.isEmailAddress(emailAddress)) {
@ -382,6 +399,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
} }
} }
} }
if (bulkAddresses != null && bulkAddresses.length > 0) { if (bulkAddresses != null && bulkAddresses.length > 0) {
for (String emailAddress : bulkAddresses) { for (String emailAddress : bulkAddresses) {
if (!Validator.isEmailAddress(emailAddress)) { if (!Validator.isEmailAddress(emailAddress)) {
@ -389,12 +407,15 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
} }
} }
} }
if (Validator.isNull(subject)) { if (Validator.isNull(subject)) {
throw new RequiredEmailSubjectException(); throw new RequiredEmailSubjectException();
} }
if (Validator.isNull(body)) { if (Validator.isNull(body)) {
throw new RequiredEmailBodyException(); throw new RequiredEmailBodyException();
} }
if (replyTo != null && replyTo.length == 0) { if (replyTo != null && replyTo.length == 0) {
for (String emailAddress : replyTo) { for (String emailAddress : replyTo) {
if (!Validator.isEmailAddress(emailAddress)) { if (!Validator.isEmailAddress(emailAddress)) {

121
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailTemplateLocalServiceImpl.java

@ -1,13 +1,27 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under the terms of the
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * GNU Lesser General Public License as published by the Free Software Foundation; either version
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 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.
*/ */
package it.tref.liferay.portos.mailmanager.service.impl; package it.tref.liferay.portos.mailmanager.service.impl;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.ResourceConstants;
import com.liferay.portal.model.User;
import com.liferay.portal.service.ServiceContext;
import it.tref.liferay.portos.mailmanager.EmailTemplateCcException; import it.tref.liferay.portos.mailmanager.EmailTemplateCcException;
import it.tref.liferay.portos.mailmanager.EmailTemplateCcnException; import it.tref.liferay.portos.mailmanager.EmailTemplateCcnException;
import it.tref.liferay.portos.mailmanager.EmailTemplateFromException; import it.tref.liferay.portos.mailmanager.EmailTemplateFromException;
@ -23,24 +37,17 @@ import it.tref.liferay.portos.mailmanager.service.base.EmailTemplateLocalService
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.ResourceConstants;
import com.liferay.portal.model.User;
import com.liferay.portal.service.ServiceContext;
/** /**
* The implementation of the email template local service. * The implementation of the email template local service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalService} interface.
*
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * This is a local service. Methods of this service will not have security checks based on the
* credentials because this service can only be accessed from within the same VM. * propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author * @author
@ -49,65 +56,83 @@ import com.liferay.portal.service.ServiceContext;
*/ */
public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBaseImpl { public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalServiceUtil} to access the email template local *
* service. * Never reference this interface directly. Always use {@link
* it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalServiceUtil} to access the email
* template local service.
*/ */
@Override @Override
public EmailTemplate addEmailTemplate(String templateName, String from, String[] to, String[] cc, String[] ccn, public EmailTemplate addEmailTemplate(String templateName, String from, String[] to, String[] cc, String[] ccn,
String subject, String body, boolean attachmentPermitted, ServiceContext serviceContext) String subject, String body, boolean attachmentPermitted, ServiceContext serviceContext) throws SystemException,
throws SystemException, PortalException { PortalException {
User user = userLocalService.getUser(serviceContext.getUserId()); User user = userLocalService.getUser(serviceContext.getUserId());
Date now = new Date(); Date now = new Date();
validate(templateName, from, to, cc, ccn, subject, body); validate(templateName, from, to, cc, ccn, subject, body);
EmailTemplate emailTemplate = createEmailTemplate(counterLocalService.increment(EmailTemplate.class.getName()));
EmailTemplate emailTemplate =
emailTemplateLocalService.createEmailTemplate(counterLocalService.increment(EmailTemplate.class.getName()));
emailTemplate.setCompanyId(serviceContext.getCompanyId()); emailTemplate.setCompanyId(serviceContext.getCompanyId());
emailTemplate.setUserId(user.getUserId()); emailTemplate.setUserId(user.getUserId());
emailTemplate.setUserName(user.getFullName()); emailTemplate.setUserName(user.getFullName());
emailTemplate.setCreateDate(serviceContext.getCreateDate(now)); emailTemplate.setCreateDate(serviceContext.getCreateDate(now));
emailTemplate.setModifiedDate(serviceContext.getModifiedDate(now)); emailTemplate.setModifiedDate(serviceContext.getModifiedDate(now));
emailTemplate.setGroupId(serviceContext.getScopeGroupId()); emailTemplate.setGroupId(serviceContext.getScopeGroupId());
emailTemplate.setTemplateName(templateName); emailTemplate.setTemplateName(templateName);
emailTemplate.setFrom(from); emailTemplate.setFrom(from);
emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA)); emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA));
emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA)); emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA));
emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA)); emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA));
emailTemplate.setSubject(subject); emailTemplate.setSubject(subject);
emailTemplate.setBody(body); emailTemplate.setBody(body);
emailTemplate.setAttachmentPermitted(attachmentPermitted); emailTemplate.setAttachmentPermitted(attachmentPermitted);
emailTemplate = addEmailTemplate(emailTemplate);
emailTemplate = emailTemplateLocalService.addEmailTemplate(emailTemplate);
// Resource // Resource
resourceLocalService.addResources(emailTemplate.getCompanyId(), emailTemplate.getGroupId(), resourceLocalService.addResources(emailTemplate.getCompanyId(), emailTemplate.getGroupId(),
emailTemplate.getUserId(), EmailTemplate.class.getName(), emailTemplate.getPrimaryKey(), false, true, emailTemplate.getUserId(), EmailTemplate.class.getName(), emailTemplate.getPrimaryKey(), false, true, true);
true);
return emailTemplate; return emailTemplate;
} }
@Override @Override
public EmailTemplate updateEmailTemplate(long emailTemplateId, String templateName, String from, String[] to, public EmailTemplate updateEmailTemplate(long emailTemplateId, String templateName, String from, String[] to,
String[] cc, String[] ccn, String subject, String body, boolean attachmentPermitted, String[] cc, String[] ccn, String subject, String body, boolean attachmentPermitted, ServiceContext serviceContext)
ServiceContext serviceContext) throws SystemException, PortalException { throws SystemException, PortalException {
EmailTemplate emailTemplate = emailTemplateLocalService.getEmailTemplate(emailTemplateId);
EmailTemplate emailTemplate = getEmailTemplate(emailTemplateId);
validate(templateName, from, to, cc, ccn, subject, body); validate(templateName, from, to, cc, ccn, subject, body);
emailTemplate.setModifiedDate(serviceContext.getModifiedDate(new Date())); emailTemplate.setModifiedDate(serviceContext.getModifiedDate(new Date()));
emailTemplate.setFrom(from); emailTemplate.setFrom(from);
emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA)); emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA));
emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA)); emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA));
emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA)); emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA));
emailTemplate.setSubject(subject); emailTemplate.setSubject(subject);
emailTemplate.setBody(body); emailTemplate.setBody(body);
emailTemplate.setAttachmentPermitted(attachmentPermitted); emailTemplate.setAttachmentPermitted(attachmentPermitted);
emailTemplate = updateEmailTemplate(emailTemplate);
emailTemplate = emailTemplateLocalService.updateEmailTemplate(emailTemplate);
return emailTemplate; return emailTemplate;
} }
@Override @Override
public EmailTemplate deleteEmailTemplate(long emailTemplateId) throws PortalException, SystemException { public EmailTemplate deleteEmailTemplate(long emailTemplateId) throws PortalException, SystemException {
EmailTemplate emailTemplate = emailTemplateLocalService.getEmailTemplate(emailTemplateId);
EmailTemplate emailTemplate = getEmailTemplate(emailTemplateId);
return deleteEmailTemplate(emailTemplate); return deleteEmailTemplate(emailTemplate);
} }
@ -115,64 +140,59 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
public EmailTemplate deleteEmailTemplate(EmailTemplate emailTemplate) throws SystemException { public EmailTemplate deleteEmailTemplate(EmailTemplate emailTemplate) throws SystemException {
super.deleteEmailTemplate(emailTemplate); super.deleteEmailTemplate(emailTemplate);
// Resource // Resource
try { try {
resourceLocalService.deleteResource(emailTemplate.getCompanyId(), EmailTemplate.class.getName(), resourceLocalService.deleteResource(emailTemplate.getCompanyId(), EmailTemplate.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL, emailTemplate.getPrimaryKey()); ResourceConstants.SCOPE_INDIVIDUAL, emailTemplate.getPrimaryKey());
} catch (PortalException e) {} } catch (PortalException e) {
}
return emailTemplate; return emailTemplate;
} }
@Override @Override
public int countByC_GroupId(long companyId, long groupId) throws SystemException { public int countByC_GroupId(long companyId, long groupId) throws SystemException {
return emailTemplatePersistence.countByC_GroupId(companyId, groupId); return emailTemplatePersistence.countByC_GroupId(companyId, groupId);
} }
@Override @Override
public List<EmailTemplate> findByC_GroupId(long companyId, long groupId, int start, int end, public List<EmailTemplate> findByC_GroupId(long companyId, long groupId, int start, int end, OrderByComparator orderBy)
OrderByComparator orderBy) throws SystemException { throws SystemException {
return emailTemplatePersistence.findByC_GroupId(companyId, groupId, start, end, orderBy); return emailTemplatePersistence.findByC_GroupId(companyId, groupId, start, end, orderBy);
} }
@Override @Override
public EmailTemplate findByC_GroupId_Name(long companyId, long groupId, String templateName) public EmailTemplate findByC_GroupId_Name(long companyId, long groupId, String templateName)
throws NoSuchEmailTemplateException, SystemException { throws NoSuchEmailTemplateException, SystemException {
return emailTemplatePersistence.findByC_GroupId_Name(companyId, groupId, templateName); return emailTemplatePersistence.findByC_GroupId_Name(companyId, groupId, templateName);
} }
@Override @Override
public EmailTemplate fetchByC_GroupId_Name(long companyId, long groupId, String templateName) public EmailTemplate fetchByC_GroupId_Name(long companyId, long groupId, String templateName) throws SystemException {
throws SystemException {
return emailTemplatePersistence.fetchByC_GroupId_Name(companyId, groupId, templateName); return emailTemplatePersistence.fetchByC_GroupId_Name(companyId, groupId, templateName);
} }
@Override @Override
public int countByCompany(long companyId) throws SystemException { public int countByCompany(long companyId) throws SystemException {
return emailTemplatePersistence.countByCompany(companyId); return emailTemplatePersistence.countByCompany(companyId);
} }
@Override @Override
public List<EmailTemplate> findByCompany(long companyId, int start, int end, OrderByComparator orderBy) public List<EmailTemplate> findByCompany(long companyId, int start, int end, OrderByComparator orderBy)
throws SystemException { throws SystemException {
return emailTemplatePersistence.findByCompany(companyId, start, end, orderBy); return emailTemplatePersistence.findByCompany(companyId, start, end, orderBy);
} }
@Override @Override
public int countByC_Name(long companyId, String name) throws SystemException { public int countByC_Name(long companyId, String name) throws SystemException {
return emailTemplatePersistence.countByC_Name(companyId, name); return emailTemplatePersistence.countByC_Name(companyId, name);
} }
@Override @Override
public EmailTemplate findByC_Name(long companyId, String templateName) throws SystemException, public EmailTemplate findByC_Name(long companyId, String templateName) throws SystemException,
NoSuchEmailTemplateException { NoSuchEmailTemplateException {
return emailTemplatePersistence.findByC_Name(companyId, templateName); return emailTemplatePersistence.findByC_Name(companyId, templateName);
} }
@ -182,11 +202,13 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
if (Validator.isNull(templateName)) { if (Validator.isNull(templateName)) {
throw new RequiredEmailTemplateNameException(); throw new RequiredEmailTemplateNameException();
} }
if (Validator.isNull(from)) { if (Validator.isNull(from)) {
throw new RequiredEmailTemplateFromException(); throw new RequiredEmailTemplateFromException();
} else if (!Validator.isEmailAddress(from)) { } else if (!Validator.isEmailAddress(from)) {
throw new EmailTemplateFromException(); throw new EmailTemplateFromException();
} }
if (to != null && to.length > 0) { if (to != null && to.length > 0) {
for (String emailAddress : to) { for (String emailAddress : to) {
if (!Validator.isEmailAddress(emailAddress)) { if (!Validator.isEmailAddress(emailAddress)) {
@ -194,6 +216,7 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
} }
} }
} }
if (cc != null && cc.length > 0) { if (cc != null && cc.length > 0) {
for (String emailAddress : cc) { for (String emailAddress : cc) {
if (!Validator.isEmailAddress(emailAddress)) { if (!Validator.isEmailAddress(emailAddress)) {
@ -201,6 +224,7 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
} }
} }
} }
if (ccn != null && ccn.length > 0) { if (ccn != null && ccn.length > 0) {
for (String emailAddress : ccn) { for (String emailAddress : ccn) {
if (!Validator.isEmailAddress(emailAddress)) { if (!Validator.isEmailAddress(emailAddress)) {
@ -208,11 +232,14 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
} }
} }
} }
if (Validator.isNull(subject)) { if (Validator.isNull(subject)) {
throw new RequiredEmailTemplateSubjectException(); throw new RequiredEmailTemplateSubjectException();
} }
if (Validator.isNull(body)) { if (Validator.isNull(body)) {
throw new RequiredEmailTemplateBodyException(); throw new RequiredEmailTemplateBodyException();
} }
} }
} }

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

@ -65,6 +65,8 @@ import javax.mail.internet.MimeMultipart;
*/ */
public class MailEngine { public class MailEngine {
private static boolean mwgDebug = false;
public static Session getSession() { public static Session getSession() {
return getSession(false); return getSession(false);
} }
@ -74,7 +76,7 @@ public class MailEngine {
Session session = Session.getInstance(properties); Session session = Session.getInstance(properties);
if (_log.isDebugEnabled()) { if (mwgDebug || _log.isDebugEnabled()) {
session.setDebug(true); session.setDebug(true);
session.getProperties().list(System.out); session.getProperties().list(System.out);
@ -89,14 +91,14 @@ public class MailEngine {
try { try {
session = MailServiceUtil.getSession(); session = MailServiceUtil.getSession();
} catch (SystemException se) { } catch (SystemException se) {
if (_log.isWarnEnabled()) { if (mwgDebug || _log.isWarnEnabled()) {
_log.warn(se, se); _log.warn(se, se);
} }
session = InfrastructureUtil.getMailSession(); session = InfrastructureUtil.getMailSession();
} }
if (_log.isDebugEnabled()) { if (mwgDebug || _log.isDebugEnabled()) {
session.setDebug(true); session.setDebug(true);
session.getProperties().list(System.out); session.getProperties().list(System.out);
@ -151,7 +153,7 @@ public class MailEngine {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
if (_log.isDebugEnabled()) { if (mwgDebug || _log.isDebugEnabled()) {
_log.debug("From: " + from); _log.debug("From: " + from);
_log.debug("To: " + Arrays.toString(to)); _log.debug("To: " + Arrays.toString(to));
_log.debug("CC: " + Arrays.toString(cc)); _log.debug("CC: " + Arrays.toString(cc));
@ -164,7 +166,7 @@ public class MailEngine {
_log.debug("Message ID: " + messageId); _log.debug("Message ID: " + messageId);
_log.debug("In Reply To: " + inReplyTo); _log.debug("In Reply To: " + inReplyTo);
if ((fileAttachments != null) && _log.isDebugEnabled()) { if ((fileAttachments != null) && (mwgDebug || _log.isDebugEnabled())) {
for (int i = 0; i < fileAttachments.size(); i++) { for (int i = 0; i < fileAttachments.size(); i++) {
FileAttachment fileAttachment = fileAttachments.get(i); FileAttachment fileAttachment = fileAttachments.get(i);
@ -326,7 +328,7 @@ public class MailEngine {
throw new MailEngineException(e); throw new MailEngineException(e);
} }
if (_log.isDebugEnabled()) { if (mwgDebug || _log.isDebugEnabled()) {
_log.debug("Sending mail takes " + (System.currentTimeMillis() - startTime) + " ms"); _log.debug("Sending mail takes " + (System.currentTimeMillis() - startTime) + " ms");
} }
} }
@ -503,7 +505,7 @@ public class MailEngine {
} }
} catch (MessagingException me) { } catch (MessagingException me) {
if (me.getNextException() instanceof SocketException) { if (me.getNextException() instanceof SocketException) {
if (_log.isWarnEnabled()) { if (mwgDebug || _log.isWarnEnabled()) {
_log.warn("Failed to connect to a valid mail server. Please " + "make sure one is properly configured. " _log.warn("Failed to connect to a valid mail server. Please " + "make sure one is properly configured. "
+ me.getMessage()); + me.getMessage());
} }

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

@ -24,6 +24,8 @@ import java.util.List;
public class MailManagerUtil { public class MailManagerUtil {
private final static Log _log = LogFactoryUtil.getLog(MailManagerUtil.class);
public static Email addEmailByTemplate(String className, long classPK, long emailTemplateId, public static Email addEmailByTemplate(String className, long classPK, long emailTemplateId,
JSONObject templateParamJSON, List<FileAttachment> fileAttachments, ServiceContext serviceContext) JSONObject templateParamJSON, List<FileAttachment> fileAttachments, ServiceContext serviceContext)
throws Exception { throws Exception {

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/common/email_dialog_attachment.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/init.jsp" %> <%@include file="/html/init.jsp" %>
<% <%

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/edit.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/email_templates/init.jsp" %> <%@include file="/html/email_templates/init.jsp" %>
<% <%

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_send_popup_button.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/email_templates/init.jsp" %> <%@include file="/html/email_templates/init.jsp" %>

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_template_action.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/email_templates/init.jsp" %> <%@include file="/html/email_templates/init.jsp" %>
<% <%

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/init.jsp" %> <%@include file="/html/init.jsp" %>
<%@page import="org.apache.log4j.Logger"%> <%@page import="org.apache.log4j.Logger"%>

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/close_popup.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/email_templates/send_popup/init.jsp" %> <%@include file="/html/email_templates/send_popup/init.jsp" %>
<aui:script use="aui-base"> <aui:script use="aui-base">

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/email_templates/init.jsp" %> <%@include file="/html/email_templates/init.jsp" %>
<% <%
String className = ParamUtil.getString(request, "className"); String className = ParamUtil.getString(request, "className");

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/view.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/email_templates/send_popup/init.jsp" %> <%@include file="/html/email_templates/send_popup/init.jsp" %>
<% <%

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/toolbar.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/email_templates/init.jsp"%> <%@include file="/html/email_templates/init.jsp"%>
<aui:nav-bar> <aui:nav-bar>

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/view.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/email_templates/init.jsp" %> <%@include file="/html/email_templates/init.jsp" %>
<%@page import="it.tref.liferay.portos.mailmanager.service.EmailTemplateLocalServiceUtil"%> <%@page import="it.tref.liferay.portos.mailmanager.service.EmailTemplateLocalServiceUtil"%>

3
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.util.PortalUtil"%> <%@page import="com.liferay.portal.util.PortalUtil"%>
<%@page import="com.liferay.portlet.PortletURLUtil"%> <%@page import="com.liferay.portlet.PortletURLUtil"%>
@ -28,6 +27,8 @@
<%@page import="it.tref.liferay.portos.mailmanager.shared.util.MailManagerConstants"%> <%@page import="it.tref.liferay.portos.mailmanager.shared.util.MailManagerConstants"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@page import="com.liferay.portal.kernel.util.GetterUtil"%> <%@page import="com.liferay.portal.kernel.util.GetterUtil"%>
<liferay-theme:defineObjects /> <liferay-theme:defineObjects />

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/edit.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/mail_manager/init.jsp" %> <%@include file="/html/mail_manager/init.jsp" %>
<% <%

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_action.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/mail_manager/init.jsp" %> <%@include file="/html/mail_manager/init.jsp" %>
<% <%

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_history_popup_button.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/mail_manager/init.jsp" %> <%@include file="/html/mail_manager/init.jsp" %>
<c:if test="<%=EmailPermission.contains(permissionChecker, scopeGroupId, ActionKeys.VIEW_EMAIL_HISTORY) %>"> <c:if test="<%=EmailPermission.contains(permissionChecker, scopeGroupId, ActionKeys.VIEW_EMAIL_HISTORY) %>">

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/init.jsp" %> <%@include file="/html/init.jsp" %>
<%@page import="com.liferay.portal.kernel.util.TextFormatter"%> <%@page import="com.liferay.portal.kernel.util.TextFormatter"%>

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/view.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/html/mail_manager/init.jsp" %> <%@include file="/html/mail_manager/init.jsp" %>
<% <%

4
liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/liferay-display.xml

@ -3,11 +3,11 @@
<display> <display>
<category name="category.hidden"> <category name="category.hidden">
<portlet id="1" /> <portlet id="1"></portlet>
</category> </category>
<category name="category.portos"> <category name="category.portos">
<category name="category.tools"> <category name="category.tools">
<portlet id="2"/> <portlet id="2"></portlet>
</category> </category>
</category> </category>
</display> </display>

62
liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/service.xml

@ -1,64 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd"> <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="it.tref.liferay.portos.maintenance"> <service-builder package-path="it.tref.liferay.portos.maintenance">
<author></author> <author></author>
<namespace>portos_maintenance</namespace> <namespace>portos_maintenance</namespace>
<entity name="MaintenanceSchedule" local-service="true" remote-service="true">
<entity name="MaintenanceSchedule" local-service="true"
remote-service="true">
<!-- PK fields --> <!-- PK fields -->
<column name="maintenanceScheduleId" type="long" primary="true"></column>
<column name="maintenanceScheduleId" type="long" primary="true" />
<!-- Audit fields --> <!-- Audit fields -->
<column name="companyId" type="long"></column>
<column name="companyId" type="long" /> <column name="userId" type="long"></column>
<column name="userId" type="long" /> <column name="userName" type="String"></column>
<column name="userName" type="String" /> <column name="createDate" type="Date"></column>
<column name="createDate" type="Date" /> <column name="modifiedDate" type="Date"></column>
<column name="modifiedDate" type="Date" />
<!-- Other fields --> <!-- Other fields -->
<column name="type" type="String"></column>
<column name="type" type="String" /> <column name="reason" type="String"></column>
<column name="reason" type="String" /> <column name="portalMessage" type="String"></column>
<column name="portalMessage" type="String" /> <column name="after" type="long"></column>
<column name="after" type="long" /> <column name="end" type="Date"></column>
<column name="end" type="Date" /> <column name="onreboot" type="String"></column>
<column name="onreboot" type="String" />
<column name="status" type="String"></column> <column name="status" type="String"></column>
<column name="statusMessage" type="String" /> <column name="statusMessage" type="String"></column>
<column name="completed" type="Boolean" /> <column name="completed" type="Boolean"></column>
<!-- Order --> <!-- Order -->
<order by="desc"> <order by="desc">
<order-column name="createDate" /> <order-column name="createDate"></order-column>
</order> </order>
<!-- Finder methods --> <!-- Finder methods -->
<finder name="Company" return-type="Collection"> <finder name="Company" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
</finder> </finder>
<finder name="C_Completed" return-type="Collection"> <finder name="C_Completed" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="completed" /> <finder-column name="completed"></finder-column>
</finder> </finder>
<finder name="Completed_Onreboot" return-type="Collection"> <finder name="Completed_Onreboot" return-type="Collection">
<finder-column name="completed" /> <finder-column name="completed"></finder-column>
<finder-column name="onreboot"></finder-column> <finder-column name="onreboot"></finder-column>
</finder> </finder>
<finder name="Status" return-type="Collection"> <finder name="Status" return-type="Collection">
<finder-column name="status" /> <finder-column name="status"></finder-column>
</finder> </finder>
</entity> </entity>
<exceptions> <exceptions>
<exception>RequiredMaintenanceType</exception> <exception>RequiredMaintenanceType</exception>
<exception>RequiredMaintenanceReason</exception> <exception>RequiredMaintenanceReason</exception>

63
liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/portlet/AdminMaintenancePortlet.java

@ -1,14 +1,5 @@
package it.tref.liferay.portos.maintenance.portlet; package it.tref.liferay.portos.maintenance.portlet;
import it.tref.liferay.portos.maintenance.model.MaintenanceSchedule;
import it.tref.liferay.portos.maintenance.service.MaintenanceScheduleServiceUtil;
import java.util.Calendar;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletSession;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.language.LanguageUtil;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
@ -26,40 +17,64 @@ import com.liferay.portal.service.ServiceContextFactory;
import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortalUtil;
import com.liferay.util.bridges.mvc.MVCPortlet; import com.liferay.util.bridges.mvc.MVCPortlet;
import it.tref.liferay.portos.maintenance.model.MaintenanceSchedule;
import it.tref.liferay.portos.maintenance.service.MaintenanceScheduleServiceUtil;
import java.util.Calendar;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletSession;
/**
* Portlet implementation class AdminMaintenancePortlet
*/
public class AdminMaintenancePortlet extends MVCPortlet { public class AdminMaintenancePortlet extends MVCPortlet {
private static final Log _log = LogFactoryUtil.getLog(AdminMaintenancePortlet.class); private final static Log _log = LogFactoryUtil.getLog(AdminMaintenancePortlet.class);
public void maintain(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void maintain(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
PortletSession portletSession = actionRequest.getPortletSession(); PortletSession portletSession = actionRequest.getPortletSession();
String message = ParamUtil.getString(actionRequest, "message"); String message = ParamUtil.getString(actionRequest, "message");
String className = LanguageUtil
String className =
LanguageUtil
.get(LocaleUtil.getDefault(), .get(LocaleUtil.getDefault(),
"the-sign-in-process-is-temporarily-disabled-because-the-portal-is-undergoing-a-routine-maintenance-upgrade"); "the-sign-in-process-is-temporarily-disabled-because-the-portal-is-undergoing-a-routine-maintenance-upgrade");
if (Validator.isNotNull(message)) { if (Validator.isNotNull(message)) {
className = message; className = message;
} }
Class<?> clazz = ClassResolverUtil.resolve("com.liferay.portal.util.MaintenanceUtil",
PortalClassLoaderUtil.getClassLoader()); Class<?> clazz =
ClassResolverUtil.resolve("com.liferay.portal.util.MaintenanceUtil", PortalClassLoaderUtil.getClassLoader());
ReflectionUtil.getDeclaredMethod(clazz, "maintain", String.class, String.class).invoke(null, ReflectionUtil.getDeclaredMethod(clazz, "maintain", String.class, String.class).invoke(null,
portletSession.getId(), className); portletSession.getId(), className);
_log.info("Maintenance session id: " + portletSession.getId()); _log.info("Maintenance session id: " + portletSession.getId());
} }
public void deleteMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void deleteMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
_log.info("deleteMaintenanceSchedule - Inizio metodo"); _log.info("deleteMaintenanceSchedule - Inizio metodo");
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId"); long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId");
MaintenanceScheduleServiceUtil.deleteMaintenanceSchedule(maintenanceScheduleId, serviceContext); MaintenanceScheduleServiceUtil.deleteMaintenanceSchedule(maintenanceScheduleId, serviceContext);
} }
public void editMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { public void editMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
_log.info("editMaintenanceSchedule - Inizio metodo"); _log.info("editMaintenanceSchedule - Inizio metodo");
String cmd = ParamUtil.getString(actionRequest, Constants.CMD); String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId"); long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId");
String type = ParamUtil.getString(actionRequest, "type"); String type = ParamUtil.getString(actionRequest, "type");
String reason = ParamUtil.getString(actionRequest, "reason"); String reason = ParamUtil.getString(actionRequest, "reason");
@ -68,24 +83,31 @@ public class AdminMaintenancePortlet extends MVCPortlet {
String onreboot = ParamUtil.getString(actionRequest, "onreboot"); String onreboot = ParamUtil.getString(actionRequest, "onreboot");
String status = ParamUtil.getString(actionRequest, "status"); String status = ParamUtil.getString(actionRequest, "status");
String statusMessage = ParamUtil.getString(actionRequest, "statusMessage"); String statusMessage = ParamUtil.getString(actionRequest, "statusMessage");
Calendar calendarEnd = Calendar.getInstance(); Calendar calendarEnd = Calendar.getInstance();
calendarEnd.set(ParamUtil.getInteger(actionRequest, "endYear"), calendarEnd.set(ParamUtil.getInteger(actionRequest, "endYear"),
ParamUtil.getInteger(actionRequest, "endMonth") + 1, ParamUtil.getInteger(actionRequest, "endDay"), ParamUtil.getInteger(actionRequest, "endMonth") + 1, ParamUtil.getInteger(actionRequest, "endDay"),
ParamUtil.getInteger(actionRequest, "endHour"), ParamUtil.getInteger(actionRequest, "endMinute")); ParamUtil.getInteger(actionRequest, "endHour"), ParamUtil.getInteger(actionRequest, "endMinute"));
MaintenanceSchedule maintenanceSchedule = null; MaintenanceSchedule maintenanceSchedule = null;
try { try {
if (cmd.equals(Constants.ADD)) { if (cmd.equals(Constants.ADD)) {
maintenanceSchedule = MaintenanceScheduleServiceUtil.addMaintenanceSchedule(type, reason, maintenanceSchedule =
portalMessage, after, calendarEnd.getTime(), onreboot, serviceContext); MaintenanceScheduleServiceUtil.addMaintenanceSchedule(type, reason, portalMessage, after,
calendarEnd.getTime(), onreboot, serviceContext);
} else if (cmd.equals(Constants.UPDATE)) { } else if (cmd.equals(Constants.UPDATE)) {
maintenanceSchedule = MaintenanceScheduleServiceUtil.updateMaintenanceSchedule(maintenanceScheduleId, maintenanceSchedule =
type, reason, portalMessage, after, calendarEnd.getTime(), onreboot, status, statusMessage, MaintenanceScheduleServiceUtil.updateMaintenanceSchedule(maintenanceScheduleId, type, reason,
serviceContext); portalMessage, after, calendarEnd.getTime(), onreboot, status, statusMessage, serviceContext);
} }
} catch (PortalException e) { } catch (PortalException e) {
_log.error(e); _log.error(e);
SessionErrors.add(actionRequest, e.getClass()); SessionErrors.add(actionRequest, e.getClass());
} }
if (SessionErrors.isEmpty(actionRequest)) { if (SessionErrors.isEmpty(actionRequest)) {
actionResponse.setRenderParameter("maintenanceScheduleId", actionResponse.setRenderParameter("maintenanceScheduleId",
String.valueOf(maintenanceSchedule.getMaintenanceScheduleId())); String.valueOf(maintenanceSchedule.getMaintenanceScheduleId()));
@ -94,5 +116,6 @@ public class AdminMaintenancePortlet extends MVCPortlet {
actionResponse.setRenderParameter("mvcPath", "/html/admin_maintenance/edit.jsp"); actionResponse.setRenderParameter("mvcPath", "/html/admin_maintenance/edit.jsp");
PortalUtil.copyRequestParameters(actionRequest, actionResponse); PortalUtil.copyRequestParameters(actionRequest, actionResponse);
} }
} }
} }

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

Caricamento…
Annulla
Salva