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. 237
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiBOPortlet.java
  3. 192
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiFEPortlet.java
  4. 40
      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. 14
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java
  9. 37
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java
  10. 84
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/EmailSenderUtil.java
  11. 118
      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. 25
      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. 53
      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. 33
      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. 67
      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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.liferay.portos.accesso.atti;
@ -11,28 +17,24 @@ package it.tref.liferay.portos.accesso.atti;
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 NoSuchRichiestaAccessoAttiException() {
super();
}
public NoSuchRichiestaAccessoAttiException(String msg) {
super(msg);
}
public NoSuchRichiestaAccessoAttiException(String msg, Throwable cause) {
super(msg, cause);
}
public NoSuchRichiestaAccessoAttiException(Throwable cause) {
super(cause);
}
}

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

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

40
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 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);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String username = ParamUtil.getString(actionRequest, "codiceFiscale");
String password = ParamUtil.getString(actionRequest, "password");
String email = ParamUtil.getString(actionRequest, "indirizzoEmail");
String nome = ParamUtil.getString(actionRequest, "nome");
String cognome = ParamUtil.getString(actionRequest, "cognome");
String dataNascita = ParamUtil.getString(actionRequest, "dataNascita");
if(username != null){
User checkUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(),
username.toLowerCase());
User checkUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), username.toLowerCase());
if(checkUser == null){
Date dateOfBirthday = sdf.parse(dataNascita);
Calendar cal = Calendar.getInstance();
cal.setTime(dateOfBirthday);
int birthdayMonth = cal.get(Calendar.MONTH);
int birthdayDay = cal.get(Calendar.DAY_OF_MONTH);
;
int birthdayYear = cal.get(Calendar.YEAR);
;
int birthdayDay = cal.get(Calendar.DAY_OF_MONTH);;
int birthdayYear = cal.get(Calendar.YEAR);;
long creatorUserId = 0;
long facebookId = 0;
int prefixId = 0;
int suffixId = 0;
long groupIds[] = new long[0];
long organizationIds[] = new long[0];
long roleIds[] = new long[0];
long userGroupIds[] = new long[0];
boolean autoPassword = false;
boolean autoScreenName = false;
boolean male = true;
boolean sendEmail = true;
String password1 = password;
String password2 = password;
String screenName = username;
String openId = null;
String middleName = null;
String jobTitle = null;
Date now = new Date();
Locale locale = themeDisplay.getLocale();
ServiceContext serviceContext = new ServiceContext();
User user = UserLocalServiceUtil.addUser(creatorUserId, themeDisplay.getCompanyId(), autoPassword,
password1, password2, autoScreenName, screenName, email, facebookId, openId, locale, nome,
middleName, cognome, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear,
jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);
User user = UserLocalServiceUtil.addUser(creatorUserId, themeDisplay.getCompanyId(), autoPassword, password1, password2,
autoScreenName, screenName, email, facebookId, openId, locale, nome, middleName, cognome, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);
long userId = user.getUserId();
User userCreated = UserLocalServiceUtil.getUser(userId);
userCreated.setLoginDate(now);
userCreated.setLoginIP("127.0.0.1");
userCreated.setLastLoginDate(now);
userCreated.setModifiedDate(now);
Role roleUserNoCNS = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), "UTENTE_NO_CNS");
UserLocalServiceUtil.addRoleUser(roleUserNoCNS.getRoleId(), userId);
UserLocalServiceUtil.updateAgreedToTermsOfUse(userId, true);
UserLocalServiceUtil.updateEmailAddressVerified(userId, true);
UserLocalServiceUtil.updatePasswordReset(userId, false);
} else {
SessionErrors.add(actionRequest, "error-user-exist");
}
}
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;
/**
* @author 3F Consulting + Manifattura Web Group s.r.l.
* @author 3F Consulting
* @generated
*/
public class RichiestaAccessoAttiLocalServiceClpInvoker {
@ -132,13 +132,13 @@ public class RichiestaAccessoAttiLocalServiceClpInvoker {
"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,
@ -265,13 +265,13 @@ public class RichiestaAccessoAttiLocalServiceClpInvoker {
(java.lang.String)arguments[3]);
}
if (_methodName44.equals(name) &&
Arrays.deepEquals(_methodParameterTypes44, parameterTypes)) {
if (_methodName43.equals(name) &&
Arrays.deepEquals(_methodParameterTypes43, parameterTypes)) {
return RichiestaAccessoAttiLocalServiceUtil.findByAccessToken((java.lang.String)arguments[0]);
}
if (_methodName45.equals(name) &&
Arrays.deepEquals(_methodParameterTypes45, parameterTypes)) {
if (_methodName44.equals(name) &&
Arrays.deepEquals(_methodParameterTypes44, parameterTypes)) {
return RichiestaAccessoAttiLocalServiceUtil.findRichiesteByGroup(((Long)arguments[0]).longValue(),
((Integer)arguments[1]).intValue(),
((Integer)arguments[2]).intValue());
@ -322,8 +322,8 @@ public class RichiestaAccessoAttiLocalServiceClpInvoker {
private String[] _methodParameterTypes41;
private String _methodName42;
private String[] _methodParameterTypes42;
private String _methodName43;
private String[] _methodParameterTypes43;
private String _methodName44;
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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
@ -20,125 +26,222 @@ import java.util.List;
import com.liferay.portal.kernel.dao.orm.Disjunction;
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.RestrictionsFactoryUtil;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Organization;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
/**
* The implementation of the richiesta accesso atti local service.
*
* <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalService}
* interface.
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalService} interface.
*
* <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* credentials because this service can only be accessed from within the same VM.
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p>
*
* @author 3F Consulting + 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.RichiestaAccessoAttiLocalServiceUtil
*/
public class RichiestaAccessoAttiLocalServiceImpl extends RichiestaAccessoAttiLocalServiceBaseImpl {
public class RichiestaAccessoAttiLocalServiceImpl
extends RichiestaAccessoAttiLocalServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil} to access the richiesta accesso
* atti local service.
* NOTE FOR DEVELOPERS:
*
* 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");
@Override
public List<RichiestaAccessoAtti> findByGestita(boolean gestita, int start, int end) throws SystemException{
return richiestaAccessoAttiPersistence.findByGestita(gestita, start, end);
}
@SuppressWarnings("unchecked")
@Override
public List<RichiestaAccessoAtti> findCompletate(String numeroProgetto, String protocollo, String dataDal,
String dataAl, int start, int end) throws SystemException {
public List<RichiestaAccessoAtti> findCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl, int start, int end) throws SystemException, ParseException{
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));
}
if(!protocollo.equals("")){
Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
disjunction.add(PropertyFactoryUtil.forName("protocolloEntrata").eq(protocollo));
disjunction.add(PropertyFactoryUtil.forName("protocolloUscita").eq(protocollo));
dq.add(disjunction);
}
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));
}
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));
return dynamicQuery(dqCompletate(numeroProgetto, protocollo, dataDal, dataAl), start, end);
}
@Override
public int countCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl)
throws SystemException {
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();
return dynamicQuery(dqCompletate(numeroProgetto, protocollo, dataDal, dataAl)).size();
Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione");
dq.add(createDateProperty.between(now, dateAl));
}
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{
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery dq = dynamicQuery();
DynamicQuery dq = richiestaAccessoAttiLocalService.dynamicQuery();
dq.add(RestrictionsFactoryUtil.eq("gestita", true));
if (Validator.isNotNull(numeroProgetto)) {
if(!numeroProgetto.equals("")){
dq.add(RestrictionsFactoryUtil.eq("numeroProgetto", numeroProgetto));
}
if (Validator.isNotNull(protocollo)) {
if(!protocollo.equals("")){
Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
disjunction.add(PropertyFactoryUtil.forName("protocolloEntrata").eq(protocollo));
disjunction.add(PropertyFactoryUtil.forName("protocolloUscita").eq(protocollo));
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
public RichiestaAccessoAtti findByAccessToken(String accessToken) throws SystemException {
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));
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")
@Override
public List<RichiestaAccessoAtti> findRichiesteByGroup(long userId, int start, int end) throws SystemException {
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));
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));
if (!groupIds.isEmpty()) {
dq.add(RestrictionsFactoryUtil.in("groupId", groupIds));
public RichiestaAccessoAtti findByAccessToken(String accessToken) throws SystemException{
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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
@ -12,22 +18,23 @@ import it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiServ
/**
* The implementation of the richiesta accesso atti remote service.
*
* <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiService} interface.
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiService} interface.
*
* <p>
* 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.
* 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.
* </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.RichiestaAccessoAttiServiceUtil
*/
public class RichiestaAccessoAttiServiceImpl extends RichiestaAccessoAttiServiceBaseImpl {
public class RichiestaAccessoAttiServiceImpl
extends RichiestaAccessoAttiServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil} to access the richiesta accesso atti
* remote service.
* NOTE FOR DEVELOPERS:
*
* Never reference this interface directly. Always use {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil} to access the richiesta accesso atti remote service.
*/
}

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

@ -14,18 +14,28 @@ public class AccessoAttiAccessTokenUtil {
public static String generateAccessToken(long richiestaAccessoAttiId, String numeroProgetto, long richiedenteUserId){
StringBuffer sb = new StringBuffer();
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");
md.update(concatString.getBytes());
byte byteData[] = md.digest();
for (int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
} catch (NoSuchAlgorithmException e) {
_log.error(e,e);
}
return sb.toString();
}
}

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

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

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

@ -1,13 +1,16 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="init.jsp" %>
<div style="width: 30%">
<div style="width:30%;">
<liferay-ui:error key="atto-non-esistente" message="Nessun atto trovato per questo numero progetto" />
</div>
<liferay-portlet:actionURL name="aggiungiRichiestaBO" var="aggiungiRichiestaBOURL">
<liferay-portlet:param name="tabs1" value="Aggiungi Richiesta" />
</liferay-portlet:actionURL>
<aui:form name="fmDomande" action="<%=aggiungiRichiestaBOURL %>" method="POST" enctype="multipart/form-data" >
<div class="row-fluid" style="margin-top: 10px">
<div class="row-fluid" style="margin-top: 10px;">
<div class="span3">
<aui:input name="emailRicontatto" label="Email per il ricontatto">
<aui:validator name="required" />
@ -21,6 +24,7 @@
return fieldNode.get('disabled') || (val != null && val!='');
}
</aui:validator>
<aui:validator name="custom" errorMessage="campo-non-valido" >
function (val, fieldNode, ruleValue) {
if(fieldNode.get('disabled')){
@ -36,39 +40,41 @@
</aui:input>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px">
<div class="row-fluid" style="margin-top: 10px;">
<div class="span3">
<aui:input name="numeroProgetto" label="Numero Progetto" style="width: 50%">
<aui:input name="numeroProgetto" label="Numero Progetto" style="width:50%;">
<aui:validator name="required" />
<aui:validator name="digits" />
</aui:input>
</div>
<div class="span3">
<aui:input name="dataVidimazione" cssClass="calendarDatepicker" label="Data di vidimazione"
style="width: 50%">
<aui:input name="dataVidimazione" cssClass="calendarDatepicker" label="Data di vidimazione" style="width:50%;">
<aui:validator name="required" />
</aui:input>
</div>
<div class="span3">
<div style="margin-top: 7%">
<div style="margin-top: 7%;">
<aui:input name="sanatoria" type="checkbox" label="Trattasi di Sanatoria" />
</div>
</div>
<div class="span3">
<div style="margin-top: 7%">
<aui:input name="dataSanatoria" cssClass="calendarDatepicker" label="Data Sanatoria"
style="width: 50%" >
<div style="margin-top: 7%;">
<aui:input name="dataSanatoria" cssClass="calendarDatepicker" label="Data Sanatoria" style="width:50%;" >
<aui:validator name="custom" errorMessage="campo-richiesto" >
function (val, fieldNode, ruleValue) {
var A = AUI();
var checkValue = true;
var portletNamespace = '<portlet:namespace/>';
var sanatorie = A.one("#"+portletNamespace + "sanatoria").val();
if(sanatorie == "true"){
if(val == ""){
checkValue = false;
}
}
return checkValue;
}
</aui:validator>
@ -76,97 +82,100 @@
</div>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px">
<div class="row-fluid" style="margin-top: 10px;">
<div class="span12">
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold">Tipologia Soggetto</div>
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold;">Tipologia Soggetto</div>
<div>
<aui:input checked="true" inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="committente" label="Proprietario/committente" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="progettista" label="Progettista/collaudatore" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="impresa" label="Impresa" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="autorita" label="Autorità giudiziaria/CTU" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="confinanti" label="Confinante/vicini" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="ctp" label="CTP" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" type="radio"
value="altriSoggetti" label="Altro soggetto" />
<aui:input checked="true" inlineField="true" inlineLabel="right" name="qualitaPersona" value="committente" type="radio" label="Proprietario/committente" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="progettista" type="radio" label="Progettista/collaudatore" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="impresa" type="radio" label="Impresa" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="autorita" type="radio" label="Autorità giudiziaria/CTU" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="confinanti" type="radio" label="Confinante/vicini" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="ctp" type="radio" label="CTP" />
<aui:input inlineField="true" inlineLabel="right" name="qualitaPersona" value="altriSoggetti" type="radio" label="Altro soggetto" />
</div>
</div>
</div>
<div class="row-fluid">
<div class="span3">
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold">Tipologia Richiesta</div>
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold;">Tipologia Richiesta</div>
<div>
<aui:input cssClass="visione" checked="true" inlineField="true" inlineLabel="right" name="visione"
value="visione" type="radio" label="Prendere visione" onClick="hideDettaglio();" />
<aui:input cssClass="visione" inlineField="true" inlineLabel="right" name="visione" value="copia"
type="radio" label="Estrarre copia" onClick="showDettaglio();" />
<aui:input cssClass="visione" checked="true" inlineField="true" inlineLabel="right" name="visione" value="visione" type="radio" label="Prendere visione" onClick="hideDettaglio();" />
<aui:input cssClass="visione" inlineField="true" inlineLabel="right" name="visione" value="copia" type="radio" label="Estrarre copia" onClick="showDettaglio();" />
</div>
</div>
<div class="span4" id="optionContainerCopia" style="display: none">
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold">&nbsp;</div>
<div class="span4" id="optionContainerCopia" style="display:none;">
<div style="margin-top: 10px;margin-bottom: 10px;font-weight: bold;">&nbsp;</div>
<div>
<aui:input checked="true" inlineField="true" inlineLabel="right" name="copiaDett" value="semplice"
type="radio" label="Semplice"/>
<aui:input inlineField="true" inlineLabel="right" name="copiaDett" value="autentica" type="radio"
label="Autentica (da assoggettare ad imposta di bollo)" />
<aui:input checked="true" inlineField="true" inlineLabel="right" name="copiaDett" value="semplice" type="radio" label="Semplice"/>
<aui:input inlineField="true" inlineLabel="right" name="copiaDett" value="autentica" type="radio" label="Autentica (da assoggettare ad imposta di bollo)" />
</div>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px">
<div class="row-fluid" style="margin-top: 10px;">
<div class="span12">
<aui:input name="motivazione" type="textarea" label="Motivazione della richiesta" />
</div>
</div>
<div class="row-fluid" style="margin-top: 10px">
<div class="row-fluid" style="margin-top: 10px;">
<div class="span12">
<aui:input name="documentoIdentita" type="file" label="Documento d'identità" >
<aui:input name="documentoIdentita" type="file" label="Documento d'identità" >
<aui:validator name="required" />
</aui:input>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px">
<div class="row-fluid" style="margin-top: 10px;">
<div class="span12">
<aui:input name="allegatoPagamento" type="file" label="Allegato pagamento" >
<aui:validator name="custom" errorMessage="campo-richiesto" >
function (val, fieldNode, ruleValue) {
var A = AUI();
var checkValue = true;
var portletNamespace = '<portlet:namespace/>';
var dataVidimazione = A.one("#"+portletNamespace + "dataVidimazione").val();
var sanatorie = A.one("#"+portletNamespace + "sanatoria").val();
if(sanatorie == "true"){
checkValue = false;
}
if(dataVidimazione != ""){
var checkDateFixed = "01/01/2015";
var checkDateFixed = new Date(checkDateFixed);
var vidimazioneDate = new Date(dataVidimazione);
if(vidimazioneDate <= checkDateFixed){
checkValue = false;
}
}
if(!checkValue){
if(val != ""){
return true;
}
}
return checkValue;
}
</aui:validator>
</aui:input>
</div>
</div>
<div class="row-fluid" style="margin-top: 10px">
<div class="row-fluid" style="margin-top: 10px;">
<div class="span12">
<aui:button type="submit" value="Richiedi Atto" />
</div>
</div>
</aui:form>
<script type="text/javascript">
function hideDettaglio(){
AUI().one('#optionContainerCopia').hide();
@ -175,10 +184,18 @@ function hideDettaglio(){
function showDettaglio(){
AUI().one('#optionContainerCopia').show();
}
</script>
<aui:script use="aui-base">
YUI().use('aui-datepicker', function(Y) {
var datepicker = new Y.DatePicker({
YUI().use(
'aui-datepicker',
function(Y) {
var datepicker = new Y.DatePicker(
{
trigger: '.calendarDatepicker',
calendar: {
dateFormat: 'dd/MM/yyyy',
@ -186,7 +203,8 @@ YUI().use('aui-datepicker', function(Y) {
mask: '%d/%m/%Y',
popover: {
toolbars: {
header: [[{
header: [[
{
icon: 'icon-trash',
label: Liferay.Language.get("Cancella"),
on: {
@ -194,10 +212,14 @@ YUI().use('aui-datepicker', function(Y) {
datepicker.clearSelection();
}
}
}]]
}
]]
},
zIndex: 1
}
});
});
}
);
}
);
</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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
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 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
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 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
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 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
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 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
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 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
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 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
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 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package it.tref.portos.calendar.appointments;
@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments;
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 SlotNotAvailableException() {

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

@ -5,14 +5,10 @@
<portlet>
<portlet-name>1</portlet-name>
<icon>/icon.png</icon>
<control-panel-entry-category>
configuration
</control-panel-entry-category>
<control-panel-entry-category>configuration</control-panel-entry-category>
<control-panel-entry-weight>1.5</control-panel-entry-weight>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>
/js/main.js
</footer-portlet-javascript>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>1-portlet</css-class-wrapper>
</portlet>
<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;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
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.model.Company;
import com.liferay.portal.service.CompanyLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory;
import com.liferay.util.bridges.mvc.MVCPortlet;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
public class CompanyConfigurationPortlet extends MVCPortlet {
public void saveCustomFields(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException,
public void saveCustomFields(ActionRequest actionRequest,
ActionResponse actionResponse) throws PortalException,
SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(Company.class.getName(), actionRequest);
Company company = CompanyLocalServiceUtil.getCompany(serviceContext.getCompanyId());
ServiceContext serviceContext = ServiceContextFactory.getInstance(
Company.class.getName(), actionRequest);
Company company = CompanyLocalServiceUtil.getCompany(serviceContext
.getCompanyId());
company.setExpandoBridgeAttributes(serviceContext);
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" %>
<%@page import="com.liferay.portal.kernel.util.ParamUtil"%>

25
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.PortletRequest"%>
<%@page import="com.liferay.portal.util.PortletKeys"%>
<%@page import="com.liferay.portlet.PortletURLFactoryUtil"%>
<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>
<%@include file="/html/company_configuration/init.jsp" %>
<%
PortletURL companyCustomFieldsURL = PortletURLFactoryUtil.create(request, PortletKeys.EXPANDO, plid, PortletRequest.RENDER_PHASE);
companyCustomFieldsURL.setWindowState(LiferayWindowState.POP_UP);
companyCustomFieldsURL.setParameter("struts_action", "/expando/view_attributes");
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" />
<portlet:actionURL name="saveCustomFields" var="saveCustomFieldsURL" />
<liferay-ui:icon
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>
<aui:form name="fm" action="<%=saveCustomFieldsURL.toString() %>">
<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 %>"
editable="true" label="true" />
editable="<%= true %>"
label="<%= true %>"
/>
</aui:fieldset>
<aui:button type="submit" value="btn-save-custom-fields"></aui:button>
</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/portlet_2_0" prefix="portlet" %>

53
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;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.exception.PortalException;
@ -25,7 +26,7 @@ import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil;
public class StartUpAction extends SimpleAction {
private static final Log _log = LogFactoryUtil.getLog(StartUpAction.class);
private final static Log _log = LogFactoryUtil.getLog(StartUpAction.class);
@Override
public void run(String[] companyIds) throws ActionException {
@ -33,8 +34,10 @@ public class StartUpAction extends SimpleAction {
for (String id : companyIds) {
try {
long companyId = GetterUtil.getLong(id);
String[] defaultActions = {ActionKeys.VIEW, ActionKeys.UPDATE};
String[] guestActions = {ActionKeys.VIEW};
// Organization custom fields
addExpandoColumnIfNotExists(companyId, Group.class.getName(), "cookiesJournalarticleId",
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 {
long classNameId = PortalUtil.getClassNameId(className);
ExpandoTable expandoTable = null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getTable(companyId, classNameId,
ExpandoTableConstants.DEFAULT_TABLE_NAME);
expandoTable =
ExpandoTableLocalServiceUtil.getTable(companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME);
} catch (PortalException e) {
try {
expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId, classNameId,
ExpandoTableConstants.DEFAULT_TABLE_NAME);
} catch (PortalException e1) {}
expandoTable =
ExpandoTableLocalServiceUtil.addTable(companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME);
} catch (PortalException e1) {
}
}
ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), name);
if (expandoColumn == null) {
try {
expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), name, type);
} catch (PortalException e) {}
} catch (PortalException e) {
}
}
try {
if (indexed) {
UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties();
typeSettingsProperties.put(ExpandoColumnConstants.INDEX_TYPE,
String.valueOf(ExpandoColumnConstants.INDEX_TYPE_TEXT));
expandoColumn.setTypeSettingsProperties(typeSettingsProperties);
expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn);
}
if (hidden) {
UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties();
typeSettingsProperties.put(ExpandoColumnConstants.PROPERTY_HIDDEN, String.valueOf(1));
expandoColumn.setTypeSettingsProperties(typeSettingsProperties);
expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn);
}
Role roleGuest = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST);
Role rolePowerUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.POWER_USER);
Role roleUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER);
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()),
roleGuest.getRoleId(), guestActions);
ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), roleGuest.getRoleId(),
guestActions);
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()),
rolePowerUser.getRoleId(), defaultActions);
ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), rolePowerUser.getRoleId(),
defaultActions);
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()),
roleUser.getRoleId(), defaultActions);
} catch (PortalException e) {}
ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), roleUser.getRoleId(),
defaultActions);
} catch (PortalException e) {
}
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="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.kernel.util.Validator"%>
<%@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"?>
<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">
<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">
<portlet>
<portlet-name>1</portlet-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;
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.SimpleAction;
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.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 {
private static final Log _log = LogFactoryUtil.getLog(DeployAction.class);
private final static Log _log = LogFactoryUtil.getLog(DeployAction.class);
@Override
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() {
@ -39,6 +47,7 @@ public class DeployAction extends SimpleAction {
String evento = message.getString("command");
String nomePlugin = message.getString("servletContextName");
if (evento.equals("undeploy") && nomePlugin.equals("portos-deploy-alert-portlet")) {
try {
NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento);
@ -49,12 +58,16 @@ public class DeployAction extends SimpleAction {
} else if (evento.equals("deploy") || evento.equals("undeploy")) {
try {
List<NotificationMail> notifications;
NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento);
notifications =
NotificationMailLocalServiceUtil.findNotifications(PortalUtil.getDefaultCompanyId(),
nomePlugin);
NotificationMailLocalServiceUtil.findNotifications(PortalUtil.getDefaultCompanyId(), nomePlugin);
for (int i = 0; i < notifications.size(); i++) {
String templateName = notifications.get(i).getNomeTemplate();
if (templateName.equals(MailConstants.DEFAULT_TEMPLATE)) {
if (evento.equals("deploy")) {
templateName = MailConstants.DEFAULT_DEPLOY_TEMPLATE;
@ -62,11 +75,14 @@ public class DeployAction extends SimpleAction {
templateName = MailConstants.DEFAULT_UNDEPLOY_TEMPLATE;
}
}
JSONObject parametri = DeployAlertUtil.getParametri(nomePlugin, evento);
ServiceContext serviceContext = DeployAlertUtil.getServiceContext();
MailManagerUtil.sendMailByTemplateName(Company.class.toString(),
serviceContext.getCompanyId(), templateName, parametri, serviceContext);
MailManagerUtil.sendMailByTemplateName(Company.class.toString(), serviceContext.getCompanyId(),
templateName, parametri, serviceContext);
}
} catch (Exception 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 static final String DEFAULT_TEMPLATE = "default";
public static final String DEFAULT_DEPLOY_TEMPLATE = "default-deploy";
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 {
@Override
public boolean hasAccessPermission(PermissionChecker permissionChecker, Group group, Portlet portlet)
throws Exception {
long companyId = PortalUtil.getDefaultCompanyId();
if (companyId == permissionChecker.getCompanyId()) {
return true;
}
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;
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.SystemException;
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.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 void addNotification(ActionRequest request, ActionResponse response) throws PortalException, SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request);
String nomePlugin = ParamUtil.getString(request, "nomePlugin");
String nomeTemplate = ParamUtil.getString(request, "nomeTemplate");
try {
NotificationMailLocalServiceUtil.addNotification(nomePlugin, nomeTemplate, serviceContext);
} catch (PortalException e) {
SessionErrors.add(request, e.getClass());
response.setRenderParameter("mvcPath", "/html/notificator/edit_notification.jsp");
}
}
@ -33,8 +39,10 @@ public class NotificatorPortlet extends MVCPortlet {
SystemException {
long notificationId = ParamUtil.getLong(request, "notificationId");
try {
NotificationMailLocalServiceUtil.deleteNotificationMail(notificationId);
} catch (PortalException pe) {
SessionErrors.add(request, pe.getClass().getName());
}
@ -44,14 +52,16 @@ public class NotificatorPortlet extends MVCPortlet {
SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request);
String nomePlugin = ParamUtil.getString(request, "nomePlugin");
String nomeTemplate = ParamUtil.getString(request, "nomeTemplate");
long notificationId = ParamUtil.getLong(request, "notificationId");
try {
NotificationMailLocalServiceUtil.updateNotification(nomePlugin, nomeTemplate, serviceContext,
notificationId);
NotificationMailLocalServiceUtil.updateNotification(nomePlugin, nomeTemplate, serviceContext, notificationId);
} catch (PortalException pe) {
SessionErrors.add(request, pe.getClass());
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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
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.NotificationTipoException;
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 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.
* <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* their definitions into the {@link it.tref.liferay.portos.deployalert.service.NotificationLogLocalService} interface.
* All custom service methods should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.deployalert.service.NotificationLogLocalService} interface.
* <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* credentials because this service can only be accessed from within the same VM.
* This is a local service. Methods of this service will not have security checks based on the
* propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p>
*
* @author Matteo
@ -35,17 +42,21 @@ import com.liferay.portal.kernel.util.Validator;
*/
public class NotificationLogLocalServiceImpl extends NotificationLogLocalServiceBaseImpl {
@Override
public NotificationLog addNotification(String nomePlugin, String tipo) throws SystemException, PortalException {
Date now = new Date();
validate(nomePlugin, tipo);
long notificationId = counterLocalService.increment(NotificationLog.class.getName());
NotificationLog notification = notificationLogPersistence.create(notificationId);
notification.setTipo(tipo);
notification.setNomePlugin(nomePlugin);
notification.setData(now);
notificationLogPersistence.update(notification);
return notification;
}
@ -58,5 +69,6 @@ public class NotificationLogLocalServiceImpl extends NotificationLogLocalService
if (Validator.isNull(tipo)) {
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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
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.DynamicQuery;
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.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.
* <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* their definitions into the {@link it.tref.liferay.portos.deployalert.service.NotificationMailLocalService} interface.
* All custom service methods should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.deployalert.service.NotificationMailLocalService} interface.
* <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* credentials because this service can only be accessed from within the same VM.
* This is a local service. Methods of this service will not have security checks based on the
* propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p>
*
* @author Matteo
@ -44,15 +51,19 @@ import com.liferay.portal.service.ServiceContext;
*/
public class NotificationMailLocalServiceImpl extends NotificationMailLocalServiceBaseImpl {
@Override
public NotificationMail addNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext)
throws PortalException, SystemException {
User user = userPersistence.findByPrimaryKey(serviceContext.getUserId());
Date now = new Date();
validate(nomePlugin, nomeTemplate);
long notificationId = counterLocalService.increment(NotificationMail.class.getName());
NotificationMail notification = notificationMailPersistence.create(notificationId);
notification.setUserId(user.getUserId());
notification.setCompanyId(user.getCompanyId());
notification.setUserName(user.getFullName());
@ -61,7 +72,9 @@ public class NotificationMailLocalServiceImpl extends NotificationMailLocalServi
notification.setExpandoBridgeAttributes(serviceContext);
notification.setNomePlugin(nomePlugin);
notification.setNomeTemplate(nomeTemplate);
notificationMailPersistence.update(notification);
return notification;
}
@ -76,25 +89,29 @@ public class NotificationMailLocalServiceImpl extends NotificationMailLocalServi
}
}
@Override
public NotificationMail updateNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext,
long notificationId) throws SystemException, PortalException {
Date now = new Date();
NotificationMail notification = getNotificationMail(notificationId);
validate(nomePlugin, nomeTemplate);
notification.setModifiedDate(serviceContext.getModifiedDate(now));
notification.setNomePlugin(nomePlugin);
notification.setNomeTemplate(nomeTemplate);
notification.setExpandoBridgeAttributes(serviceContext);
notificationMailPersistence.update(notification);
return notification;
}
@Override
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"));
List<NotificationMail> notifications = null;
try {
@ -105,30 +122,30 @@ public class NotificationMailLocalServiceImpl extends NotificationMailLocalServi
return notifications;
}
@Override
public List<NotificationMail> findNotifications(long companyId) throws SystemException {
return notificationMailPersistence.findBycompanyId(companyId);
}
@Override
public int getNotificationCount(long companyId) throws SystemException {
return notificationMailPersistence.countBycompanyId(companyId);
}
@Override
public List<NotificationMail> findNotifications(long companyId, String servletContextName) throws SystemException {
DynamicQuery dynamicQuery = dynamicQuery();
DynamicQuery dynamicQuery = notificationMailLocalService.dynamicQuery();
if (Validator.isNull(servletContextName)) {
Disjunction or = RestrictionsFactoryUtil.disjunction();
or.add(RestrictionsFactoryUtil.isNull("nomePlugin"));
or.add(RestrictionsFactoryUtil.eq("nomePlugin", StringPool.BLANK));
dynamicQuery.add(or);
} else {
dynamicQuery.add(RestrictionsFactoryUtil.eq("nomePlugin", servletContextName));
}
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.impl.NotificationLogImpl;
import it.tref.liferay.portos.deployalert.model.impl.NotificationLogModelImpl;
import it.tref.liferay.portos.deployalert.service.persistence.NotificationLogPersistence;
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.impl.NotificationMailImpl;
import it.tref.liferay.portos.deployalert.model.impl.NotificationMailModelImpl;
import it.tref.liferay.portos.deployalert.service.persistence.NotificationMailPersistence;
import java.io.Serializable;

33
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;
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.json.JSONFactoryUtil;
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.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 {
private static final Log _log = LogFactoryUtil.getLog(DeployAlertUtil.class);
private final static Log _log = LogFactoryUtil.getLog(DeployAlertUtil.class);
public static final ServiceContext getServiceContext() {
long companyId = PortalUtil.getDefaultCompanyId();
ServiceContext serviceContext = new ServiceContext();
Company company;
serviceContext.setCompanyId(companyId);
try {
company = CompanyLocalServiceUtil.getCompany(companyId);
Role role = RoleLocalServiceUtil.getRole(company.getCompanyId(), RoleConstants.ADMINISTRATOR);
long userAdminId = UserLocalServiceUtil.getRoleUserIds(role.getRoleId())[0];
serviceContext.setUserId(userAdminId);
serviceContext.setScopeGroupId(company.getGroupId());
PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(UserLocalServiceUtil
.getUser(userAdminId)));
PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(userAdminId)));
} catch (Exception e) {
_log.error(e, e);
}
return serviceContext;
}
@ -52,9 +56,11 @@ public class DeployAlertUtil {
String subject = "Deploy Plugin";
String body = "E' stato effettuato il $evento del plugin $nomePlugin in data $data.";
String[] to = {"matteoguggia97@gmail.com"};
try {
add = MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_DEPLOY_TEMPLATE, "test@3fconsulting.it", to,
null, null, subject, body, false, serviceContext);
add =
MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_DEPLOY_TEMPLATE, "test@3fconsulting.it", to, null,
null, subject, body, false, serviceContext);
} catch (SystemException e) {
_log.error(e, e);
}
@ -71,8 +77,9 @@ public class DeployAlertUtil {
String[] to = {"matteoguggia97@gmail.com"};
try {
add = MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_UNDEPLOY_TEMPLATE, "test@3fconsulting.it", to,
null, null, subject, body, false, serviceContext);
add =
MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_UNDEPLOY_TEMPLATE, "test@3fconsulting.it", to, null,
null, subject, body, false, serviceContext);
} catch (SystemException 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" %>

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.StringUtil"%>
<%@ 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"%>
<%@ page
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"%>
<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">
<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">
<liferay-portlet-app>
<portlet>
<portlet-name>1</portlet-name>
<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>
<footer-portlet-javascript></footer-portlet-javascript>
<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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
/**
* 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.
* 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.
*
* <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance}
* interface.
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance} interface.
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
*/
@SuppressWarnings("serial")
public class KaleoInstanceImpl extends KaleoInstanceBaseImpl {
/*
* NOTE FOR DEVELOPERS: 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.
* NOTE FOR DEVELOPERS:
*
* 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
/**
* 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.
* 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.
*
* <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode}
* interface.
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode} interface.
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
*/
@SuppressWarnings("serial")
public class KaleoNodeImpl extends KaleoNodeBaseImpl {
/*
* NOTE FOR DEVELOPERS: 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.
* NOTE FOR DEVELOPERS:
*
* 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
/**
* The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the
* &quot;kaleotaskassignmentinstance&quot; database table, with each column mapped to a property of this class.
* The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the &quot;kaleotaskassignmentinstance&quot; database table, with each column mapped to a property of this class.
*
* <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface.
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface.
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
*/
@SuppressWarnings("serial")
public class KaleoTaskAssignmentInstanceImpl extends KaleoTaskAssignmentInstanceBaseImpl {
public class KaleoTaskAssignmentInstanceImpl
extends KaleoTaskAssignmentInstanceBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task assignment
* instance model instance should use the {@link
* it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface instead.
* NOTE FOR DEVELOPERS:
*
* Never reference this class directly. All methods that expect a kaleo task assignment instance model instance should use the {@link it.tref.liferay.portos.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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
/**
* 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.
* 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.
*
* <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask}
* interface.
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask} interface.
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
*/
@SuppressWarnings("serial")
public class KaleoTaskImpl extends KaleoTaskBaseImpl {
/*
* NOTE FOR DEVELOPERS: 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.
* NOTE FOR DEVELOPERS:
*
* 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
/**
* 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.
* 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.
*
* <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the
* {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} interface.
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} interface.
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
*/
@SuppressWarnings("serial")
public class KaleoTaskInstanceTokenImpl extends KaleoTaskInstanceTokenBaseImpl {
/*
* NOTE FOR DEVELOPERS: 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.
* NOTE FOR DEVELOPERS:
*
* 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.impl.KaleoInstanceImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoInstancePersistence;
import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
* @see KaleoInstancePersistence
* @see KaleoInstanceUtil
* @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.impl.KaleoInstanceTokenImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceTokenModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoInstanceTokenPersistence;
import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
* @see KaleoInstanceTokenPersistence
* @see KaleoInstanceTokenUtil
* @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.impl.KaleoLogImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoLogModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoLogPersistence;
import java.io.Serializable;
@ -58,7 +59,7 @@ import java.util.Set;
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
* @see KaleoLogPersistence
* @see KaleoLogUtil
* @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.impl.KaleoNodeImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoNodeModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoNodePersistence;
import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.Set;
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
* @see KaleoNodePersistence
* @see KaleoNodeUtil
* @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.impl.KaleoTaskAssignmentInstanceImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskAssignmentInstanceModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoTaskAssignmentInstancePersistence;
import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
* @see KaleoTaskAssignmentInstancePersistence
* @see KaleoTaskAssignmentInstanceUtil
* @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.impl.KaleoTaskInstanceTokenImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskInstanceTokenModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoTaskInstanceTokenPersistence;
import java.io.Serializable;
@ -56,7 +57,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
* @see KaleoTaskInstanceTokenPersistence
* @see KaleoTaskInstanceTokenUtil
* @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.impl.KaleoTaskImpl;
import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskModelImpl;
import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoTaskPersistence;
import java.io.Serializable;
@ -54,7 +55,7 @@ import java.util.List;
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author 3FC + Manifattura Web Group s.r.l.
* @author 3FC
* @see KaleoTaskPersistence
* @see KaleoTaskUtil
* @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">
<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">
<service-builder package-path="it.tref.liferay.portos.kaleo">
<author></author>
<namespace>portos_Kaleo</namespace>
<entity name="FormLog" local-service="true" remote-service="false">
<column name="formLogId" type="long" primary="true" />
<column name="formLogId" type="long" primary="true"></column>
<!-- Group instance -->
<column name="groupId" type="long" />
<column name="groupId" type="long"></column>
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<column name="workflowInstanceId" type="long" />
<column name="workflowTaskId" type="long" />
<column name="transitionName" type="String" />
<column name="formParameters" type="String" />
<column name="companyId" type="long"></column>
<column name="userId" type="long"></column>
<column name="userName" type="String"></column>
<column name="createDate" type="Date"></column>
<column name="modifiedDate" type="Date"></column>
<column name="workflowInstanceId" type="long"></column>
<column name="workflowTaskId" type="long"></column>
<column name="transitionName" type="String"></column>
<column name="formParameters" type="String"></column>
<!-- Order -->
<order>
<order-column name="createDate" order-by="asc" />
<order-column name="createDate" order-by="asc"></order-column>
</order>
<!-- Finder -->
<finder return-type="Collection" name="Company">
<finder-column name="companyId" />
<finder-column name="companyId"></finder-column>
</finder>
<finder return-type="Collection" name="C_Instance">
<finder-column name="companyId" />
<finder-column name="workflowInstanceId" />
<finder-column name="companyId"></finder-column>
<finder-column name="workflowInstanceId"></finder-column>
</finder>
<finder return-type="Collection" name="C_Task">
<finder-column name="companyId" />
<finder-column name="workflowTaskId" />
<finder-column name="companyId"></finder-column>
<finder-column name="workflowTaskId"></finder-column>
</finder>
<finder return-type="Collection" name="C_Task_TransitionName">
<finder-column name="companyId" />
<finder-column name="workflowTaskId" />
<finder-column name="transitionName" />
<finder-column name="companyId"></finder-column>
<finder-column name="workflowTaskId"></finder-column>
<finder-column name="transitionName"></finder-column>
</finder>
</entity>
<entity name="FormDefinitionLink" local-service="true" remote-service="false">
<column name="formDefinitionLinkId" type="long" primary="true" />
<column name="formDefinitionLinkId" type="long" primary="true"></column>
<!-- Group instance -->
<column name="groupId" type="long" />
<column name="groupId" type="long"></column>
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<column name="name" type="String" />
<column name="definitionName" type="String" />
<column name="definitionVersion" type="int" />
<column name="ddmStructureId" type="long" />
<column name="companyId" type="long"></column>
<column name="userId" type="long"></column>
<column name="userName" type="String"></column>
<column name="createDate" type="Date"></column>
<column name="modifiedDate" type="Date"></column>
<column name="name" type="String"></column>
<column name="definitionName" type="String"></column>
<column name="definitionVersion" type="int"></column>
<column name="ddmStructureId" type="long"></column>
<!-- Order -->
<order>
<order-column name="createDate" order-by="asc" />
<order-column name="createDate" order-by="asc"></order-column>
</order>
<!-- Finder -->
<finder return-type="Collection" name="Company">
<finder-column name="companyId" />
<finder-column name="companyId"></finder-column>
</finder>
<finder return-type="Collection" name="C_DefinitionName_DefinitionVersion">
<finder-column name="companyId" />
<finder-column name="definitionName" />
<finder-column name="definitionVersion" />
<finder-column name="companyId"></finder-column>
<finder-column name="definitionName"></finder-column>
<finder-column name="definitionVersion"></finder-column>
</finder>
<finder return-type="Collection" name="DDMStructureId">
<finder-column name="ddmStructureId" />
<finder-column name="ddmStructureId"></finder-column>
</finder>
</entity>
<entity name="FormTemplateLink" local-service="true" remote-service="false">
<column name="formTemplateLinkId" type="long" primary="true" />
<column name="formDefinitionLinkId" type="long" />
<column name="ddmTemplateId" type="long" />
<column name="kaleoNodeId" type="long" />
<column name="transitionName" type="String" />
<column name="formTemplateLinkId" type="long" primary="true"></column>
<column name="formDefinitionLinkId" type="long"></column>
<column name="ddmTemplateId" type="long"></column>
<column name="kaleoNodeId" type="long"></column>
<column name="transitionName" type="String"></column>
<finder return-type="Collection" name="FormDefinitionLinkId">
<finder-column name="formDefinitionLinkId" />
<finder-column name="formDefinitionLinkId"></finder-column>
</finder>
<finder return-type="Collection" name="DDMTemplateId">
<finder-column name="ddmTemplateId" />
<finder-column name="ddmTemplateId"></finder-column>
</finder>
<finder return-type="FormTemplateLink" name="FormDefinitionLinkId_KaleoNodeId_TransitionName" unique="true">
<finder-column name="formDefinitionLinkId" />
<finder-column name="kaleoNodeId" />
<finder-column name="transitionName" />
<finder-column name="formDefinitionLinkId"></finder-column>
<finder-column name="kaleoNodeId"></finder-column>
<finder-column name="transitionName"></finder-column>
</finder>
</entity>
<exceptions>
<exception>FormDefinitionLinkName</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
public String getPortletId() {
return PortletKeys.WORKFLOW_FORM_ADMIN;
}
@Override
public String getResourceName() {
// return DDLPermission.RESOURCE_NAME;
return RESOURCE_NAME;
}
@Override
public String getStorageType() {
// return PropsValues.DYNAMIC_DATA_LISTS_STORAGE_TYPE;
return PropsUtil.get(PropsKeys.DYNAMIC_DATA_LISTS_STORAGE_TYPE);
}
@Override
public String getStructureName(Locale locale) {
return LanguageUtil.get(locale, "data-definition");
}
@Override
public String getStructureType() {
return DDLRecordSet.class.getName();
}
@ -62,15 +59,17 @@ public class FormDDMDisplay extends BaseDDMDisplay {
throws Exception {
String redirect = ParamUtil.getString(liferayPortletRequest, "redirect");
if (Validator.isNull(redirect)) {
return getViewTemplatesURL(liferayPortletRequest, liferayPortletResponse, classNameId, classPK);
}
return redirect;
}
@Override
public boolean isShowAddStructureButton() {
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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
/**
* 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.
* 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.
*
* <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface.
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface.
* </p>
*
* @author
*/
@SuppressWarnings("serial")
public class FormLogImpl extends FormLogBaseImpl {
/*
* NOTE FOR DEVELOPERS: 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.
* NOTE FOR DEVELOPERS:
*
* 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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is 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;
/**
* 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.
* 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.
*
* <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink}
* interface.
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink} interface.
* </p>
*
* @author
*/
@SuppressWarnings("serial")
public class FormTemplateLinkImpl extends FormTemplateLinkBaseImpl {
/*
* NOTE FOR DEVELOPERS: 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.
* NOTE FOR DEVELOPERS:
*
* 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.portlet.BaseControlPanelEntry;
/**
* Control panel entry class WorkflowFormAdminPortletControlPanelEntry
*/
public class WorkflowFormAdminPortletControlPanelEntry extends BaseControlPanelEntry {
@Override
protected boolean hasAccessPermissionDenied(PermissionChecker permissionChecker, Group group, Portlet portlet)
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">
<hook>
<portal-properties>portal.properties</portal-properties>
<language-properties>
content/Language.properties
</language-properties>
<language-properties>content/Language.properties</language-properties>
</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 it.tref.portos.liferay.log.camel.core.CamelCoreInitializer;
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.utility.ClassUtils;
import it.tref.portos.liferay.log.utility.Constants;
import java.lang.reflect.Field;
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;
import it.tref.portos.liferay.log.utility.Constants;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.SimpleAction;
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.ExpandoTableLocalServiceUtil;
import it.tref.portos.liferay.log.shared.util.Constants;
public class LogStartupAction extends SimpleAction {
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 {
/*
* Message
*/
public enum LogProcessMode {
ASYNC, SYNC
}
public static final String COMPANY_ID = "companyId";
public static final String USER_ID = "userId";
public static final String CONTENT = "payload";
public final static String COMPANY_ID = "companyId";
public final static String USER_ID = "userId";
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 static final String SERIAL = "liferay/tref/portos/monitoring_serial";
public static final String SYNC = "liferay/tref/portos/monitoring_sync";
public final static String SERIAL = "liferay/tref/portos/monitoring_serial";
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 {
/*** Mandatory ***/
public static final String HOSTNAME = "host";
public static final String IP_ADDRESS = "ipAddress";
public static final String DATA_EVENTO = "requestDate";
public static final String COD_PROC = "processCode";
public static final String COD_APP = "serverId";
public static final String ID_ISTANZA = "instanceId";
public static final String PROG_EVENTO = "eventProgressive";
public static final String COD_ATT = "activityCode";
public static final String COD_ESITO_EVENTO = "status";
public static final String TIPO_EVENTO = "eventType";
public final static String HOSTNAME = "host";
public final static String IP_ADDRESS = "ipAddress";
public final static String DATA_EVENTO = "requestDate";
public final static String COD_PROC = "processCode";
public final static String COD_APP = "serverId";
public final static String ID_ISTANZA = "instanceId";
public final static String PROG_EVENTO = "eventProgressive";
public final static String COD_ATT = "activityCode";
public final static String COD_ESITO_EVENTO = "status";
public final static String TIPO_EVENTO = "eventType";
/*** Optional ***/
public static final String ID_OPERATORE = "userId";
public final static String ID_OPERATORE = "userId";
/*** Labels ***/
public static final String HOSTNAME_LABEL = "hostname";
public static final String IP_ADDRESS_LABEL = "ipAddress";
public static final String DATA_EVENTO_LABEL = "dataEvento";
public static final String COD_PROC_LABEL = "codProc";
public static final String COD_APP_LABEL = "codApp";
public static final String ID_ISTANZA_LABEL = "idIstanza";
public static final String PROG_EVENTO_LABEL = "progEvento";
public static final String COD_ATT_LABEL = "codAtt";
public static final String COD_ESITO_EVENTO_LABEL = "codEsitoEvento";
public static final String TIPO_EVENTO_LABEL = "tipoEvento";
public static final String ID_OPERATORE_LABEL = "idOperatore";
public static final String COMPLEX_DATA_LABEL = "ComplexData";
public final static String HOSTNAME_LABEL = "hostname";
public final static String IP_ADDRESS_LABEL = "ipAddress";
public final static String DATA_EVENTO_LABEL = "dataEvento";
public final static String COD_PROC_LABEL = "codProc";
public final static String COD_APP_LABEL = "codApp";
public final static String ID_ISTANZA_LABEL = "idIstanza";
public final static String PROG_EVENTO_LABEL = "progEvento";
public final static String COD_ATT_LABEL = "codAtt";
public final static String COD_ESITO_EVENTO_LABEL = "codEsitoEvento";
public final static String TIPO_EVENTO_LABEL = "tipoEvento";
public final static String ID_OPERATORE_LABEL = "idOperatore";
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/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.

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

@ -3,7 +3,7 @@
<display>
<category name="category.hidden">
<portlet id="1" />
<portlet id="1"></portlet>
</category>
<category name="category.portos">
<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">
<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">
<service-builder package-path="it.tref.liferay.portos.mailmanager">
<author></author>
<namespace>portos_Mail</namespace>
<entity name="Email" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="emailId" type="long" primary="true" />
<column name="emailId" type="long" primary="true"></column>
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="groupId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<column name="companyId" type="long"></column>
<column name="groupId" type="long"></column>
<column name="userId" type="long"></column>
<column name="userName" type="String"></column>
<column name="createDate" type="Date"></column>
<column name="modifiedDate" type="Date"></column>
<!-- Other fields -->
<column name="from" type="String" />
<column name="to" type="String" />
<column name="cc" type="String" />
<column name="bcc" type="String" />
<column name="bulkAddresses" type="String" />
<column name="subject" type="String" />
<column name="body" type="String" />
<column name="htmlFormat" type="boolean" />
<column name="replyTo" type="String" />
<column name="messageId" type="String" />
<column name="inReplyTo" type="String" />
<column name="smtpHost" type="String" />
<column name="smtpPort" type="int" />
<column name="smtpSecure" type="boolean" />
<column name="smtpUsername" type="String" />
<column name="smtpPassword" type="String" />
<column name="sentDate" type="Date" />
<column name="sent" type="boolean" />
<column name="cancel" type="boolean" />
<column name="statusMessage" type="String" />
<column name="classNameId" type="long" />
<column name="classPK" type="long" />
<column name="from" type="String"></column>
<column name="to" type="String"></column>
<column name="cc" type="String"></column>
<column name="bcc" type="String"></column>
<column name="bulkAddresses" type="String"></column>
<column name="subject" type="String"></column>
<column name="body" type="String"></column>
<column name="htmlFormat" type="boolean"></column>
<column name="replyTo" type="String"></column>
<column name="messageId" type="String"></column>
<column name="inReplyTo" type="String"></column>
<column name="smtpHost" type="String"></column>
<column name="smtpPort" type="int"></column>
<column name="smtpSecure" type="boolean"></column>
<column name="smtpUsername" type="String"></column>
<column name="smtpPassword" type="String"></column>
<column name="sentDate" type="Date"></column>
<column name="sent" type="boolean"></column>
<column name="cancel" type="boolean"></column>
<column name="statusMessage" type="String"></column>
<column name="classNameId" type="long"></column>
<column name="classPK" type="long"></column>
<column name="templateName" type="String"></column>
<!-- Order -->
<order>
<order-column name="sentDate" order-by="desc" />
<order-column name="createDate" order-by="desc" />
<order-column name="sentDate" order-by="desc"></order-column>
<order-column name="createDate" order-by="desc"></order-column>
</order>
<!-- Finder methods -->
<finder name="Company" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="companyId"></finder-column>
</finder>
<finder name="C_G" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="groupId" />
<finder-column name="companyId"></finder-column>
<finder-column name="groupId"></finder-column>
</finder>
<finder name="C_T" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="groupId" />
<finder-column name="templateName" />
<finder-column name="companyId"></finder-column>
<finder-column name="groupId"></finder-column>
<finder-column name="templateName"></finder-column>
</finder>
<finder name="C_G_T" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="groupId" />
<finder-column name="templateName" />
<finder-column name="companyId"></finder-column>
<finder-column name="groupId"></finder-column>
<finder-column name="templateName"></finder-column>
</finder>
<finder name="C_C_C" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="classNameId" />
<finder-column name="classPK" />
<finder-column name="companyId"></finder-column>
<finder-column name="classNameId"></finder-column>
<finder-column name="classPK"></finder-column>
</finder>
<finder name="C_G_C_C" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="groupId" />
<finder-column name="classNameId" />
<finder-column name="classPK" />
<finder-column name="companyId"></finder-column>
<finder-column name="groupId"></finder-column>
<finder-column name="classNameId"></finder-column>
<finder-column name="classPK"></finder-column>
</finder>
<!-- References -->
<reference package-path="com.liferay.portal" entity="Company" />
<reference package-path="com.liferay.portlet.documentlibrary"
entity="DLApp" />
<reference package-path="com.liferay.portal" entity="Company"></reference>
<reference package-path="com.liferay.portlet.documentlibrary" entity="DLApp"></reference>
</entity>
<entity name="EmailAttachment" local-service="true"
remote-service="false">
<entity name="EmailAttachment" local-service="true" remote-service="false">
<!-- PK fields -->
<column name="emailId" type="long" primary="true" />
<column name="fileEntryId" type="long" primary="true" />
<column name="emailId" type="long" primary="true"></column>
<column name="fileEntryId" type="long" primary="true"></column>
<!-- Finder methods -->
<finder name="EmailId" return-type="Collection">
<finder-column name="emailId" />
<finder-column name="emailId"></finder-column>
</finder>
<finder name="FileEntryId" return-type="EmailAttachment">
<finder-column name="fileEntryId" />
<finder-column name="fileEntryId"></finder-column>
</finder>
<!-- References -->
<reference package-path="com.liferay.portal" entity="Company" />
<reference package-path="com.liferay.portlet.documentlibrary"
entity="DLApp" />
<reference package-path="com.liferay.portal" entity="Company"></reference>
<reference package-path="com.liferay.portlet.documentlibrary" entity="DLApp"></reference>
</entity>
<entity name="EmailTemplate" local-service="true"
remote-service="true">
<entity name="EmailTemplate" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="emailTemplateId" type="long" primary="true" />
<column name="emailTemplateId" type="long" primary="true"></column>
<!-- Group instance -->
<column name="groupId" type="long" />
<column name="groupId" type="long"></column>
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<column name="companyId" type="long"></column>
<column name="userId" type="long"></column>
<column name="userName" type="String"></column>
<column name="createDate" type="Date"></column>
<column name="modifiedDate" type="Date"></column>
<!-- Other fields -->
<column name="templateName" type="String" />
<column name="from" type="String" />
<column name="to" type="String" />
<column name="cc" type="String" />
<column name="ccn" type="String" />
<column name="subject" type="String" />
<column name="body" type="String" />
<column name="attachmentPermitted" type="Boolean" />
<column name="additionalParameters" type="String" />
<column name="templateName" type="String"></column>
<column name="from" type="String"></column>
<column name="to" type="String"></column>
<column name="cc" type="String"></column>
<column name="ccn" type="String"></column>
<column name="subject" type="String"></column>
<column name="body" type="String"></column>
<column name="attachmentPermitted" type="Boolean"></column>
<column name="additionalParameters" type="String"></column>
<!-- Order -->
<order by="asc">
<order-column name="emailTemplateId" />
<order-column name="emailTemplateId"></order-column>
</order>
<!-- Finder methods -->
<finder name="Company" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="companyId"></finder-column>
</finder>
<finder name="C_GroupId" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="groupId" />
<finder-column name="companyId"></finder-column>
<finder-column name="groupId"></finder-column>
</finder>
<finder name="C_GroupId_Name" return-type="EmailTemplate" unique="true">
<finder-column name="companyId" />
<finder-column name="groupId" />
<finder-column name="templateName" />
<finder-column name="companyId"></finder-column>
<finder-column name="groupId"></finder-column>
<finder-column name="templateName"></finder-column>
</finder>
<finder name="C_Name" return-type="EmailTemplate" unique="true">
<finder-column name="companyId" />
<finder-column name="templateName" />
<finder-column name="companyId"></finder-column>
<finder-column name="templateName"></finder-column>
</finder>
</entity>
<exceptions>
<exception>RequiredEmailFrom</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_T
IX_73A01DF4=portos_Mail_Email.Company
IX_73A01DF4=portos_Mail_Email.G_C
IX_20966470=portos_Mail_EmailAttachment.EmailId
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_EE0B52F3=portos_Mail_EmailTemplate.C_Name
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 unique index IX_6935F329 on portos_Mail_EmailTemplate (companyId, groupId, 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,
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;
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.LogFactoryUtil;
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.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 {
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 {
Message responseMessage = MessageBusUtil.createResponseMessage(message);
try {
String mode = (String) message.get("mode");
MailMessage mailMessage = (MailMessage) message.getPayload();
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"));
long classPK = GetterUtil.getLong(message.get("classPK"));
boolean sendSync = false;
if (MailManagerConstants.MESSAGING_SEND_MODE_SYNC.equals(mode)) {
sendSync = true;
}
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil
.getUser(serviceContext.getUserId()));
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);
responseMessage.setPayload(Boolean.TRUE);
} catch (Exception e) {
_log.error(e, e);
responseMessage.setPayload(Boolean.FALSE);
responseMessage.put("exceptionMessage", e.getMessage());
} finally {

67
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
* 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
* permissions and limitations under the License, including but not limited to distribution rights of the Software.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the 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 permissions and limitations under the License, including but not limited to
* distribution rights of the Software.
*
*
*
*/
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.SystemException;
@ -30,14 +27,27 @@ import com.liferay.portal.model.User;
import com.liferay.portal.security.permission.ActionKeys;
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.
*
* <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* their definitions into the {@link it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalService} interface.
* All custom service methods should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the
* {@link it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalService} interface.
*
* <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* credentials because this service can only be accessed from within the same VM.
* This is a local service. Methods of this service will not have security checks based on the
* propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p>
*
* @author
@ -46,11 +56,12 @@ import com.liferay.portal.service.ServiceContext;
*/
public class EmailAttachmentLocalServiceImpl extends EmailAttachmentLocalServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalServiceUtil} to access the email attachment local
* service.
* NOTE FOR DEVELOPERS:
*
* 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)
throws PortalException, SystemException {
@ -79,16 +90,15 @@ public class EmailAttachmentLocalServiceImpl extends EmailAttachmentLocalService
sourceFileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, file, serviceContext);
EmailAttachment emailAttachment =
createEmailAttachment(new EmailAttachmentPK(emailId, fileEntry
.getFileEntryId()));
emailAttachmentLocalService.createEmailAttachment(new EmailAttachmentPK(emailId, fileEntry.getFileEntryId()));
return addEmailAttachment(emailAttachment);
return emailAttachmentLocalService.addEmailAttachment(emailAttachment);
}
@Override
public EmailAttachment deleteEmailAttachment(EmailAttachmentPK emailAttachmentPK) throws PortalException,
SystemException {
EmailAttachment emailAttachment = getEmailAttachment(emailAttachmentPK);
EmailAttachment emailAttachment = emailAttachmentLocalService.getEmailAttachment(emailAttachmentPK);
return deleteEmailAttachment(emailAttachment);
}
@ -101,27 +111,24 @@ public class EmailAttachmentLocalServiceImpl extends EmailAttachmentLocalService
try {
dlAppLocalService.deleteFileEntry(emailAttachment.getFileEntryId());
} catch (PortalException e) {}
} catch (PortalException e) {
}
return emailAttachment;
}
@Override
public List<EmailAttachment> findByEmailId(long emailId) throws SystemException {
return emailAttachmentPersistence.findByEmailId(emailId);
}
@Override
public List<EmailAttachment> findByEmailId(long emailId, int start, int end) throws SystemException {
return emailAttachmentPersistence.findByEmailId(emailId);
}
@Override
public int countByEmailId(long emailId) throws SystemException {
return emailAttachmentPersistence.countByEmailId(emailId);
}
@Override
public EmailAttachment fetchByFileEntryId(long fileEntryId) throws SystemException {
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
* 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
* permissions and limitations under the License, including but not limited to distribution rights of the Software.
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the 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 permissions and limitations under the License, including but not limited to
* distribution rights of the Software.
*
*
*
*/
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.EmailBulkAddressesException;
import it.tref.liferay.portos.mailmanager.EmailCcException;
@ -27,30 +51,18 @@ import java.util.Collections;
import java.util.Date;
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.
*
* <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* their definitions into the {@link it.noovle.azimut.icf.mailmanager.service.EmailLocalService} interface.
* All custom service methods should be put in this class. Whenever methods are
* added, rerun ServiceBuilder to copy their definitions into the
* {@link it.noovle.azimut.icf.mailmanager.service.EmailLocalService} interface.
*
* <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* credentials because this service can only be accessed from within the same VM.
* This is a local service. Methods of this service will not have security
* checks based on the propagated JAAS credentials because this service can only
* be accessed from within the same VM.
* </p>
*
* @author
@ -59,67 +71,70 @@ import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
*/
public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* it.noovle.azimut.icf.mailmanager.service.EmailLocalServiceUtil} to access the email local service.
* NOTE FOR DEVELOPERS:
*
* Never reference this interface directly. Always use {@link
* it.noovle.azimut.icf.mailmanager.service.EmailLocalServiceUtil} to access
* the email local service.
*/
@Override
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 {
private final static Log _log = LogFactoryUtil.getLog(EmailLocalServiceImpl.class);
return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, null, null,
0, false, null, null, Collections.<FileAttachment> emptyList(), serviceContext);
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, 0, false, null, null, Collections.<FileAttachment> emptyList(), serviceContext);
}
@Override
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[],
String subject, String body, boolean htmlFormat, List<FileAttachment> fileAttachments,
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);
public Email addEmail(String className, long classPK, String from, String to[], String cc[],
String bcc[], String subject, String body, boolean htmlFormat,
List<FileAttachment> fileAttachments, 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);
}
@Override
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[],
String[] bulkAddresses, String subject, String body, boolean htmlFormat, String[] replyTo,
String messageId, String inReplyTo, String smtpHost, int smtpPort, boolean smtpSecure, String smtpUsername,
String smtpPassword, List<FileAttachment> fileAttachments, ServiceContext serviceContext) throws Exception {
return addEmail(className, classPK, from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, replyTo,
messageId, inReplyTo, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword, fileAttachments,
false, null, serviceContext);
public Email addEmail(String className, long classPK, String from, String to[], String cc[],
String bcc[], String[] bulkAddresses, String subject, String body, boolean htmlFormat,
String[] replyTo, String messageId, String inReplyTo, String smtpHost, int smtpPort,
boolean smtpSecure, String smtpUsername, String smtpPassword,
List<FileAttachment> fileAttachments, ServiceContext serviceContext) throws Exception {
return addEmail(className, classPK, from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat,
replyTo, messageId, inReplyTo, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword,
fileAttachments, false, null, serviceContext);
}
@Override
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[],
String subject, String body, boolean htmlFormat, List<FileAttachment> fileAttachments, boolean sendSync,
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, sendSync, null, serviceContext);
public Email addEmail(String className, long classPK, String from, String to[], String cc[],
String bcc[], String subject, String body, boolean htmlFormat,
List<FileAttachment> fileAttachments, boolean sendSync, 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, sendSync, null, serviceContext);
}
@Override
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[],
String subject, String body, boolean htmlFormat, List<FileAttachment> fileAttachments, boolean sendSync,
String templateName, 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, sendSync, templateName, serviceContext);
public Email addEmail(String className, long classPK, String from, String to[], String cc[],
String bcc[], String subject, String body, boolean htmlFormat,
List<FileAttachment> fileAttachments, boolean sendSync, String templateName,
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, sendSync, templateName, serviceContext);
}
@Override
public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[],
String[] bulkAddresses, String subject, String body, boolean htmlFormat, String[] replyTo,
String messageId, String inReplyTo, String smtpHost, int smtpPort, boolean smtpSecure, String smtpUsername,
String smtpPassword, List<FileAttachment> fileAttachments, boolean sendSync, String templateName,
public Email addEmail(String className, long classPK, String from, String to[], String cc[],
String bcc[], String[] bulkAddresses, String subject, String body, boolean htmlFormat,
String[] replyTo, String messageId, String inReplyTo, String smtpHost, int smtpPort,
boolean smtpSecure, String smtpUsername, String smtpPassword,
List<FileAttachment> fileAttachments, boolean sendSync, String templateName,
ServiceContext serviceContext) throws Exception {
User user = userLocalService.getUser(serviceContext.getUserId());
Date now = new Date();
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.setCompanyId(serviceContext.getCompanyId());
email.setCreateDate(serviceContext.getCreateDate(now));
@ -128,6 +143,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email.setClassPK(classPK);
email.setUserId(user.getUserId());
email.setUserName(user.getFullName());
email.setFrom(from);
email.setTo(StringUtil.merge(to, 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.setSubject(subject);
email.setBody(body);
email.setHtmlFormat(htmlFormat);
email.setReplyTo(StringUtil.merge(replyTo, StringPool.COMMA));
email.setMessageId(messageId);
email.setInReplyTo(inReplyTo);
email.setSmtpHost(smtpHost);
email.setSmtpPort(smtpPort);
email.setSmtpSecure(smtpSecure);
@ -146,37 +164,46 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email.setSmtpPassword(smtpPassword);
email.setCancel(false);
email.setTemplateName(templateName);
email = addEmail(email);
// Email Attachments
if (fileAttachments != null && !fileAttachments.isEmpty()) {
Folder folder = addEmailAttachmentsFolder(serviceContext.getCompanyId(), email.getEmailId());
for (FileAttachment fileAttachment : fileAttachments) {
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(),
folder.getFolderId(), fileAttachment.getFileName(), fileAttachment.getFile());
emailAttachmentLocalService.addEmailAttachment(serviceContext.getCompanyId(),
email.getEmailId(), folder.getFolderId(), fileAttachment.getFileName(),
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
// perdono nell'abisso dell'oblio. Siccome questo è già un task asincrono, inviamo in maniera sincrona e
// festeggiamo.
// Il valore di ritorno viene ignorato da SchedulerInvioDocumenti, le
// mail impostate per l'invio asincrono si perdono nell'abisso
// dell'oblio. Siccome questo è già un task asincrono, inviamo in
// maniera sincrona e festeggiamo.
sendSync = true;
if (sendSync) {
MailSenderUtil.sendMail(email);
markAsSent(email.getEmailId(), new Date(), StringPool.BLANK);
}
return email;
}
@Override
public Email updateEmail(long emailId, String from, String to[], String cc[], String bcc[], String subject,
String body, ServiceContext serviceContext) throws Exception {
public Email updateEmail(long emailId, String from, String to[], String cc[], String bcc[],
String subject, String body, ServiceContext serviceContext) throws Exception {
Email email = emailLocalService.getEmail(emailId);
Email email = getEmail(emailId);
validate(from, to, cc, bcc, null, subject, body, null);
email.setModifiedDate(new Date());
email.setFrom(from);
email.setTo(StringUtil.merge(to, StringPool.COMMA));
@ -184,54 +211,60 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
email.setBcc(StringUtil.merge(bcc, StringPool.COMMA));
email.setSubject(subject);
email.setBody(body);
return updateEmail(email);
}
@Override
public Email markAsSent(long emailId, Date sentDate, String statusMessage) throws PortalException, SystemException {
public Email markAsSent(long emailId, Date sentDate, String statusMessage) throws PortalException,
SystemException {
Email email = getEmail(emailId);
Email email = emailLocalService.getEmail(emailId);
email.setModifiedDate(new Date());
email.setSent(true);
email.setSentDate(sentDate);
email.setStatusMessage(statusMessage);
return updateEmail(email);
}
@Override
public Email updateStatusMessage(long emailId, String statusMessage) throws PortalException, SystemException {
public Email updateStatusMessage(long emailId, String statusMessage) throws PortalException,
SystemException {
Email email = getEmail(emailId);
Email email = emailLocalService.getEmail(emailId);
email.setModifiedDate(new Date());
email.setStatusMessage(statusMessage);
return updateEmail(email);
}
@Override
public Email resendEmail(long emailId) throws PortalException, SystemException {
Email email = getEmail(emailId);
Email email = emailLocalService.getEmail(emailId);
email.setModifiedDate(new Date());
email.setStatusMessage("");
email.setSent(false);
email.setSentDate(null);
email.setCancel(false);
return updateEmail(email);
}
@Override
public Email cancelEmail(long emailId) throws PortalException, SystemException {
Email email = getEmail(emailId);
Email email = emailLocalService.getEmail(emailId);
email.setModifiedDate(new Date());
email.setCancel(true);
return updateEmail(email);
}
@Override
public Email deleteEmail(long emailId) throws PortalException, SystemException {
Email email = getEmail(emailId);
Email email = emailLocalService.getEmail(emailId);
return deleteEmail(email);
}
@ -239,126 +272,108 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
public Email deleteEmail(Email email) throws SystemException {
super.deleteEmail(email);
// Email Attachments
List<EmailAttachment> emailAttachments = emailAttachmentLocalService.findByEmailId(email.getEmailId());
List<EmailAttachment> emailAttachments = emailAttachmentLocalService
.findByEmailId(email.getEmailId());
for (EmailAttachment emailAttachment : emailAttachments) {
emailAttachmentLocalService.deleteEmailAttachment(emailAttachment);
}
return email;
}
@Override
public List<Email> findByCompany(long companyId) throws SystemException {
return emailPersistence.findByCompany(companyId);
}
@Override
public List<Email> findByCompany(long companyId, int start, int end) throws SystemException {
return emailPersistence.findByCompany(companyId, start, end);
}
@Override
public List<Email> findByCompany(long companyId, int start, int end, OrderByComparator orderByComparator)
throws SystemException {
return emailPersistence.findByCompany(companyId, start, end, orderByComparator);
}
@Override
public int countByCompany(long companyId) throws SystemException {
return emailPersistence.countByCompany(companyId);
}
@Override
public List<Email> findByC_G(long companyId, long groupId) throws SystemException {
return emailPersistence.findByC_G(companyId, groupId);
}
@Override
public List<Email> findByC_G(long companyId, long groupId, int start, int end) throws SystemException {
return emailPersistence.findByC_G(companyId, groupId, start, end);
}
@Override
public List<Email> findByC_G(long companyId, long groupId, int start, int end, OrderByComparator orderByComparator)
throws SystemException {
public List<Email> findByC_G(long companyId, long groupId, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return emailPersistence.findByC_G(companyId, groupId, start, end, orderByComparator);
}
@Override
public int countByC_G(long companyId, long groupId) throws SystemException {
return emailPersistence.countByC_G(companyId, groupId);
}
@Override
public List<Email> findByC_G_T(long companyId, long groupId, String templateName) throws SystemException {
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)
throws SystemException {
return emailPersistence.findByC_G_T(companyId, groupId, templateName, start, end);
}
@Override
public int countByC_G_T(long companyId, long groupId, String templateName) throws SystemException {
return emailPersistence.countByC_G_T(companyId, groupId, templateName);
}
@Override
public List<Email> findByC_G_C_C(long companyId, long groupId, long classNameId, long classPK)
throws SystemException {
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, int end)
throws SystemException {
public List<Email> findByC_G_C_C(long companyId, long groupId, long classNameId, long classPK, int start,
int end) throws SystemException {
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) throws SystemException {
public int countByC_G_C_C(long companyId, long groupId, long classNameId, long classPK)
throws SystemException {
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);
Group companyGroup = company.getGroup();
User defaultUser = company.getDefaultUser();
Folder folder =
dlAppLocalService.getFolder(companyGroup.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
EmailConstants.DEFAULT_ATTACHMENTS_FOLDER_NAME);
Folder folder = dlAppLocalService.getFolder(companyGroup.getGroupId(),
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, EmailConstants.DEFAULT_ATTACHMENTS_FOLDER_NAME);
ServiceContext serviceContext = new ServiceContext();
serviceContext.setGroupPermissions(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,
String body, String[] replyTo) throws PortalException {
private void validate(String from, String to[], String cc[], String bcc[], String[] bulkAddresses,
String subject, String body, String[] replyTo) throws PortalException {
if (Validator.isNull(from)) {
throw new RequiredEmailFromException();
} else if (!Validator.isEmailAddress(from)) {
throw new EmailFromException();
}
if (to == null || (to != null && to.length == 0)) {
throw new RequiredEmailToException();
} else {
@ -368,6 +383,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
}
}
}
if (cc != null && cc.length > 0) {
for (String emailAddress : cc) {
if (!Validator.isEmailAddress(emailAddress)) {
@ -375,6 +391,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
}
}
}
if (bcc != null && bcc.length > 0) {
for (String emailAddress : bcc) {
if (!Validator.isEmailAddress(emailAddress)) {
@ -382,6 +399,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
}
}
}
if (bulkAddresses != null && bulkAddresses.length > 0) {
for (String emailAddress : bulkAddresses) {
if (!Validator.isEmailAddress(emailAddress)) {
@ -389,12 +407,15 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl {
}
}
}
if (Validator.isNull(subject)) {
throw new RequiredEmailSubjectException();
}
if (Validator.isNull(body)) {
throw new RequiredEmailBodyException();
}
if (replyTo != null && replyTo.length == 0) {
for (String emailAddress : replyTo) {
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
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* This library is 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;
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.EmailTemplateCcnException;
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.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.
*
* <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* their definitions into the {@link it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalService} interface.
* All custom service methods should be put in this class. Whenever methods are added, rerun
* ServiceBuilder to copy their definitions into the
* {@link it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalService} interface.
*
* <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* credentials because this service can only be accessed from within the same VM.
* This is a local service. Methods of this service will not have security checks based on the
* propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p>
*
* @author
@ -49,65 +56,83 @@ import com.liferay.portal.service.ServiceContext;
*/
public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalServiceUtil} to access the email template local
* service.
* NOTE FOR DEVELOPERS:
*
* Never reference this interface directly. Always use {@link
* it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalServiceUtil} to access the email
* template local service.
*/
@Override
public EmailTemplate addEmailTemplate(String templateName, String from, String[] to, String[] cc, String[] ccn,
String subject, String body, boolean attachmentPermitted, ServiceContext serviceContext)
throws SystemException, PortalException {
String subject, String body, boolean attachmentPermitted, ServiceContext serviceContext) throws SystemException,
PortalException {
User user = userLocalService.getUser(serviceContext.getUserId());
Date now = new Date();
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.setUserId(user.getUserId());
emailTemplate.setUserName(user.getFullName());
emailTemplate.setCreateDate(serviceContext.getCreateDate(now));
emailTemplate.setModifiedDate(serviceContext.getModifiedDate(now));
emailTemplate.setGroupId(serviceContext.getScopeGroupId());
emailTemplate.setTemplateName(templateName);
emailTemplate.setFrom(from);
emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA));
emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA));
emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA));
emailTemplate.setSubject(subject);
emailTemplate.setBody(body);
emailTemplate.setAttachmentPermitted(attachmentPermitted);
emailTemplate = addEmailTemplate(emailTemplate);
emailTemplate = emailTemplateLocalService.addEmailTemplate(emailTemplate);
// Resource
resourceLocalService.addResources(emailTemplate.getCompanyId(), emailTemplate.getGroupId(),
emailTemplate.getUserId(), EmailTemplate.class.getName(), emailTemplate.getPrimaryKey(), false, true,
true);
emailTemplate.getUserId(), EmailTemplate.class.getName(), emailTemplate.getPrimaryKey(), false, true, true);
return emailTemplate;
}
@Override
public EmailTemplate updateEmailTemplate(long emailTemplateId, String templateName, String from, String[] to,
String[] cc, String[] ccn, String subject, String body, boolean attachmentPermitted,
ServiceContext serviceContext) throws SystemException, PortalException {
String[] cc, String[] ccn, String subject, String body, boolean attachmentPermitted, ServiceContext serviceContext)
throws SystemException, PortalException {
EmailTemplate emailTemplate = emailTemplateLocalService.getEmailTemplate(emailTemplateId);
EmailTemplate emailTemplate = getEmailTemplate(emailTemplateId);
validate(templateName, from, to, cc, ccn, subject, body);
emailTemplate.setModifiedDate(serviceContext.getModifiedDate(new Date()));
emailTemplate.setFrom(from);
emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA));
emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA));
emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA));
emailTemplate.setSubject(subject);
emailTemplate.setBody(body);
emailTemplate.setAttachmentPermitted(attachmentPermitted);
emailTemplate = updateEmailTemplate(emailTemplate);
emailTemplate = emailTemplateLocalService.updateEmailTemplate(emailTemplate);
return emailTemplate;
}
@Override
public EmailTemplate deleteEmailTemplate(long emailTemplateId) throws PortalException, SystemException {
EmailTemplate emailTemplate = getEmailTemplate(emailTemplateId);
EmailTemplate emailTemplate = emailTemplateLocalService.getEmailTemplate(emailTemplateId);
return deleteEmailTemplate(emailTemplate);
}
@ -115,64 +140,59 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
public EmailTemplate deleteEmailTemplate(EmailTemplate emailTemplate) throws SystemException {
super.deleteEmailTemplate(emailTemplate);
// Resource
try {
resourceLocalService.deleteResource(emailTemplate.getCompanyId(), EmailTemplate.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL, emailTemplate.getPrimaryKey());
} catch (PortalException e) {}
} catch (PortalException e) {
}
return emailTemplate;
}
@Override
public int countByC_GroupId(long companyId, long groupId) throws SystemException {
return emailTemplatePersistence.countByC_GroupId(companyId, groupId);
}
@Override
public List<EmailTemplate> findByC_GroupId(long companyId, long groupId, int start, int end,
OrderByComparator orderBy) throws SystemException {
public List<EmailTemplate> findByC_GroupId(long companyId, long groupId, int start, int end, OrderByComparator orderBy)
throws SystemException {
return emailTemplatePersistence.findByC_GroupId(companyId, groupId, start, end, orderBy);
}
@Override
public EmailTemplate findByC_GroupId_Name(long companyId, long groupId, String templateName)
throws NoSuchEmailTemplateException, SystemException {
return emailTemplatePersistence.findByC_GroupId_Name(companyId, groupId, templateName);
}
@Override
public EmailTemplate fetchByC_GroupId_Name(long companyId, long groupId, String templateName)
throws SystemException {
public EmailTemplate fetchByC_GroupId_Name(long companyId, long groupId, String templateName) throws SystemException {
return emailTemplatePersistence.fetchByC_GroupId_Name(companyId, groupId, templateName);
}
@Override
public int countByCompany(long companyId) throws SystemException {
return emailTemplatePersistence.countByCompany(companyId);
}
@Override
public List<EmailTemplate> findByCompany(long companyId, int start, int end, OrderByComparator orderBy)
throws SystemException {
return emailTemplatePersistence.findByCompany(companyId, start, end, orderBy);
}
@Override
public int countByC_Name(long companyId, String name) throws SystemException {
return emailTemplatePersistence.countByC_Name(companyId, name);
}
@Override
public EmailTemplate findByC_Name(long companyId, String templateName) throws SystemException,
NoSuchEmailTemplateException {
return emailTemplatePersistence.findByC_Name(companyId, templateName);
}
@ -182,11 +202,13 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
if (Validator.isNull(templateName)) {
throw new RequiredEmailTemplateNameException();
}
if (Validator.isNull(from)) {
throw new RequiredEmailTemplateFromException();
} else if (!Validator.isEmailAddress(from)) {
throw new EmailTemplateFromException();
}
if (to != null && to.length > 0) {
for (String emailAddress : to) {
if (!Validator.isEmailAddress(emailAddress)) {
@ -194,6 +216,7 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
}
}
}
if (cc != null && cc.length > 0) {
for (String emailAddress : cc) {
if (!Validator.isEmailAddress(emailAddress)) {
@ -201,6 +224,7 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
}
}
}
if (ccn != null && ccn.length > 0) {
for (String emailAddress : ccn) {
if (!Validator.isEmailAddress(emailAddress)) {
@ -208,11 +232,14 @@ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBase
}
}
}
if (Validator.isNull(subject)) {
throw new RequiredEmailTemplateSubjectException();
}
if (Validator.isNull(body)) {
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 {
private static boolean mwgDebug = false;
public static Session getSession() {
return getSession(false);
}
@ -74,7 +76,7 @@ public class MailEngine {
Session session = Session.getInstance(properties);
if (_log.isDebugEnabled()) {
if (mwgDebug || _log.isDebugEnabled()) {
session.setDebug(true);
session.getProperties().list(System.out);
@ -89,14 +91,14 @@ public class MailEngine {
try {
session = MailServiceUtil.getSession();
} catch (SystemException se) {
if (_log.isWarnEnabled()) {
if (mwgDebug || _log.isWarnEnabled()) {
_log.warn(se, se);
}
session = InfrastructureUtil.getMailSession();
}
if (_log.isDebugEnabled()) {
if (mwgDebug || _log.isDebugEnabled()) {
session.setDebug(true);
session.getProperties().list(System.out);
@ -151,7 +153,7 @@ public class MailEngine {
long startTime = System.currentTimeMillis();
if (_log.isDebugEnabled()) {
if (mwgDebug || _log.isDebugEnabled()) {
_log.debug("From: " + from);
_log.debug("To: " + Arrays.toString(to));
_log.debug("CC: " + Arrays.toString(cc));
@ -164,7 +166,7 @@ public class MailEngine {
_log.debug("Message ID: " + messageId);
_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++) {
FileAttachment fileAttachment = fileAttachments.get(i);
@ -326,7 +328,7 @@ public class MailEngine {
throw new MailEngineException(e);
}
if (_log.isDebugEnabled()) {
if (mwgDebug || _log.isDebugEnabled()) {
_log.debug("Sending mail takes " + (System.currentTimeMillis() - startTime) + " ms");
}
}
@ -503,7 +505,7 @@ public class MailEngine {
}
} catch (MessagingException me) {
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. "
+ 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 {
private final static Log _log = LogFactoryUtil.getLog(MailManagerUtil.class);
public static Email addEmailByTemplate(String className, long classPK, long emailTemplateId,
JSONObject templateParamJSON, List<FileAttachment> fileAttachments, ServiceContext serviceContext)
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" %>
<%

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" %>
<%

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" %>

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" %>
<%

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" %>
<%@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" %>
<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" %>
<%
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" %>
<%

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"%>
<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" %>
<%@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.portlet.PortletURLUtil"%>
@ -28,6 +27,8 @@
<%@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"%>
<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" %>
<%

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" %>
<%

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" %>
<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" %>
<%@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" %>
<%

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

@ -3,11 +3,11 @@
<display>
<category name="category.hidden">
<portlet id="1" />
<portlet id="1"></portlet>
</category>
<category name="category.portos">
<category name="category.tools">
<portlet id="2"/>
<portlet id="2"></portlet>
</category>
</category>
</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">
<service-builder package-path="it.tref.liferay.portos.maintenance">
<author></author>
<namespace>portos_maintenance</namespace>
<entity name="MaintenanceSchedule" local-service="true"
remote-service="true">
<entity name="MaintenanceSchedule" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="maintenanceScheduleId" type="long" primary="true" />
<column name="maintenanceScheduleId" type="long" primary="true"></column>
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<column name="companyId" type="long"></column>
<column name="userId" type="long"></column>
<column name="userName" type="String"></column>
<column name="createDate" type="Date"></column>
<column name="modifiedDate" type="Date"></column>
<!-- Other fields -->
<column name="type" type="String" />
<column name="reason" type="String" />
<column name="portalMessage" type="String" />
<column name="after" type="long" />
<column name="end" type="Date" />
<column name="onreboot" type="String" />
<column name="type" type="String"></column>
<column name="reason" type="String"></column>
<column name="portalMessage" type="String"></column>
<column name="after" type="long"></column>
<column name="end" type="Date"></column>
<column name="onreboot" type="String"></column>
<column name="status" type="String"></column>
<column name="statusMessage" type="String" />
<column name="completed" type="Boolean" />
<column name="statusMessage" type="String"></column>
<column name="completed" type="Boolean"></column>
<!-- Order -->
<order by="desc">
<order-column name="createDate" />
<order-column name="createDate"></order-column>
</order>
<!-- Finder methods -->
<finder name="Company" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="companyId"></finder-column>
</finder>
<finder name="C_Completed" return-type="Collection">
<finder-column name="companyId" />
<finder-column name="completed" />
<finder-column name="companyId"></finder-column>
<finder-column name="completed"></finder-column>
</finder>
<finder name="Completed_Onreboot" return-type="Collection">
<finder-column name="completed" />
<finder-column name="completed"></finder-column>
<finder-column name="onreboot"></finder-column>
</finder>
<finder name="Status" return-type="Collection">
<finder-column name="status" />
<finder-column name="status"></finder-column>
</finder>
</entity>
<exceptions>
<exception>RequiredMaintenanceType</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;
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.language.LanguageUtil;
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.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 {
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 {
PortletSession portletSession = actionRequest.getPortletSession();
String message = ParamUtil.getString(actionRequest, "message");
String className = LanguageUtil
String className =
LanguageUtil
.get(LocaleUtil.getDefault(),
"the-sign-in-process-is-temporarily-disabled-because-the-portal-is-undergoing-a-routine-maintenance-upgrade");
if (Validator.isNotNull(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,
portletSession.getId(), className);
_log.info("Maintenance session id: " + portletSession.getId());
}
public void deleteMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
_log.info("deleteMaintenanceSchedule - Inizio metodo");
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId");
MaintenanceScheduleServiceUtil.deleteMaintenanceSchedule(maintenanceScheduleId, serviceContext);
}
public void editMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
_log.info("editMaintenanceSchedule - Inizio metodo");
String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId");
String type = ParamUtil.getString(actionRequest, "type");
String reason = ParamUtil.getString(actionRequest, "reason");
@ -68,24 +83,31 @@ public class AdminMaintenancePortlet extends MVCPortlet {
String onreboot = ParamUtil.getString(actionRequest, "onreboot");
String status = ParamUtil.getString(actionRequest, "status");
String statusMessage = ParamUtil.getString(actionRequest, "statusMessage");
Calendar calendarEnd = Calendar.getInstance();
calendarEnd.set(ParamUtil.getInteger(actionRequest, "endYear"),
ParamUtil.getInteger(actionRequest, "endMonth") + 1, ParamUtil.getInteger(actionRequest, "endDay"),
ParamUtil.getInteger(actionRequest, "endHour"), ParamUtil.getInteger(actionRequest, "endMinute"));
MaintenanceSchedule maintenanceSchedule = null;
try {
if (cmd.equals(Constants.ADD)) {
maintenanceSchedule = MaintenanceScheduleServiceUtil.addMaintenanceSchedule(type, reason,
portalMessage, after, calendarEnd.getTime(), onreboot, serviceContext);
maintenanceSchedule =
MaintenanceScheduleServiceUtil.addMaintenanceSchedule(type, reason, portalMessage, after,
calendarEnd.getTime(), onreboot, serviceContext);
} else if (cmd.equals(Constants.UPDATE)) {
maintenanceSchedule = MaintenanceScheduleServiceUtil.updateMaintenanceSchedule(maintenanceScheduleId,
type, reason, portalMessage, after, calendarEnd.getTime(), onreboot, status, statusMessage,
serviceContext);
maintenanceSchedule =
MaintenanceScheduleServiceUtil.updateMaintenanceSchedule(maintenanceScheduleId, type, reason,
portalMessage, after, calendarEnd.getTime(), onreboot, status, statusMessage, serviceContext);
}
} catch (PortalException e) {
_log.error(e);
SessionErrors.add(actionRequest, e.getClass());
}
if (SessionErrors.isEmpty(actionRequest)) {
actionResponse.setRenderParameter("maintenanceScheduleId",
String.valueOf(maintenanceSchedule.getMaintenanceScheduleId()));
@ -94,5 +116,6 @@ public class AdminMaintenancePortlet extends MVCPortlet {
actionResponse.setRenderParameter("mvcPath", "/html/admin_maintenance/edit.jsp");
PortalUtil.copyRequestParameters(actionRequest, actionResponse);
}
}
}

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

Caricamento…
Annulla
Salva