Sfoglia il codice sorgente

diff

feature/differenze-sorgenti
E-A B 2 anni fa
parent
commit
77d72d2ef2
  1. 8
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/accesso/atti/service/RichiestaAccessoAttiLocalServiceWrapper.java
  2. 35
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/model/impl/RichiestaAccessoAttiImpl.java
  3. 4
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/liferay-display.xml
  4. 2
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/liferay-hook.xml
  5. 109
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/service.xml
  6. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/details_column.jsp
  7. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/relations_column.jsp
  8. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/detail.jsp
  9. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view.jsp
  10. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view_list.jsp
  11. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/init.jsp
  12. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/edit.jsp
  13. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/view.jsp
  14. 28
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-display.xml
  15. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-hook.xml
  16. 2058
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service.xml
  17. 1
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/search/IntPraticaSearch.java
  18. 120
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service.xml
  19. 36
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/DisponibilitaImpl.java
  20. 48
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/FunzionarioImpl.java
  21. 57
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/PrenotazioneImpl.java
  22. 36
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/ProfessionistaImpl.java
  23. 510
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaLocalServiceImpl.java
  24. 136
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaServiceImpl.java
  25. 133
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioLocalServiceImpl.java
  26. 172
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioServiceImpl.java
  27. 314
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/PrenotazioneLocalServiceImpl.java
  28. 140
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/PrenotazioneServiceImpl.java
  29. 35
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/ProfessionistaLocalServiceImpl.java
  30. 32
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/ProfessionistaServiceImpl.java
  31. 96
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/util/CalendarUtil.java
  32. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/init.jsp
  33. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/amministrazione.jsp
  34. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/calendar.jsp
  35. 31
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/gestione_disponibilita.jsp
  36. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/gestione_disponibilita_action.jsp
  37. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/view.jsp
  38. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/init.jsp

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

@ -19,7 +19,7 @@ import com.liferay.portal.service.ServiceWrapper;
/** /**
* Provides a wrapper for {@link RichiestaAccessoAttiLocalService}. * Provides a wrapper for {@link RichiestaAccessoAttiLocalService}.
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see RichiestaAccessoAttiLocalService * @see RichiestaAccessoAttiLocalService
* @generated * @generated
*/ */
@ -302,7 +302,8 @@ public class RichiestaAccessoAttiLocalServiceWrapper
public java.util.List<it.tref.liferay.portos.accesso.atti.model.RichiestaAccessoAtti> findCompletate( public java.util.List<it.tref.liferay.portos.accesso.atti.model.RichiestaAccessoAtti> findCompletate(
java.lang.String numeroProgetto, java.lang.String protocollo, java.lang.String numeroProgetto, java.lang.String protocollo,
java.lang.String dataDal, java.lang.String dataAl, int start, int end) java.lang.String dataDal, java.lang.String dataAl, int start, int end)
throws com.liferay.portal.kernel.exception.SystemException { throws com.liferay.portal.kernel.exception.SystemException,
java.text.ParseException {
return _richiestaAccessoAttiLocalService.findCompletate(numeroProgetto, return _richiestaAccessoAttiLocalService.findCompletate(numeroProgetto,
protocollo, dataDal, dataAl, start, end); protocollo, dataDal, dataAl, start, end);
} }
@ -311,7 +312,8 @@ public class RichiestaAccessoAttiLocalServiceWrapper
public int countCompletate(java.lang.String numeroProgetto, public int countCompletate(java.lang.String numeroProgetto,
java.lang.String protocollo, java.lang.String dataDal, java.lang.String protocollo, java.lang.String dataDal,
java.lang.String dataAl) java.lang.String dataAl)
throws com.liferay.portal.kernel.exception.SystemException { throws com.liferay.portal.kernel.exception.SystemException,
java.text.ParseException {
return _richiestaAccessoAttiLocalService.countCompletate(numeroProgetto, return _richiestaAccessoAttiLocalService.countCompletate(numeroProgetto,
protocollo, dataDal, dataAl); protocollo, dataDal, dataAl);
} }

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

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

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

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

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

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

109
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/service.xml

@ -1,94 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd"> <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="it.tref.liferay.portos.audit"> <service-builder package-path="it.tref.liferay.portos.audit">
<author>Marco</author> <author>Marco</author>
<namespace>portos_AUDIT</namespace> <namespace>portos_AUDIT</namespace>
<entity name="AuditEvent" local-service="true" remote-service="false"> <entity name="AuditEvent" local-service="true" remote-service="false">
<column name="auditEventId" type="long" primary="true" /> <column name="auditEventId" type="long" primary="true"></column>
<column name="companyId" type="long"></column>
<column name="companyId" type="long" /> <column name="createDate" type="Date"></column>
<column name="createDate" type="Date" />
<!-- Dati dell'utente che ha effettuato l'operazione --> <!-- Dati dell'utente che ha effettuato l'operazione -->
<column name="userId" type="long" /> <column name="userId" type="long"></column>
<column name="userName" type="String" /> <column name="userName" type="String"></column>
<!-- Questo campo è utilizzato per definire la tipologia di audit STORICO, LOG --> <!-- Questo campo è utilizzato per definire la tipologia di audit STORICO, LOG -->
<column name="auditEventTable" type="String" /> <column name="auditEventTable" type="String"></column>
<!-- 3 Campi utilizzati per categorizzare gli eventi inseriti e migliorare la ricerca --> <!-- 3 Campi utilizzati per categorizzare gli eventi inseriti e migliorare la ricerca -->
<column name="eventType" type="String" /> <column name="eventType" type="String"></column>
<column name="eventCategory" type="String" /> <column name="eventCategory" type="String"></column>
<column name="eventAction" type="String" /> <column name="eventAction" type="String"></column>
<!--3 Campi per stabilire quale è l'oggetto di interesse in caso di urcgroupid= 0 si riferisce ad un evento globale--> <!--3 Campi per stabilire quale è l'oggetto di interesse in caso di urcgroupid= 0 si riferisce ad un evento globale-->
<column name="classNameId" type="long" /> <column name="classNameId" type="long"></column>
<column name="classPK" type="String" /> <column name="classPK" type="String"></column>
<column name="enteGroupId" type="long" /> <column name="enteGroupId" type="long"></column>
<column name="enteCodice" type="String" /> <column name="enteCodice" type="String"></column>
<!--2 Campi per stabilire quale è l'oggetto padre a cui è legato qeullo del log--> <!--2 Campi per stabilire quale è l'oggetto padre a cui è legato qeullo del log-->
<column name="parentClassNameId" type="long" /> <column name="parentClassNameId" type="long"></column>
<column name="parentClassPK" type="String" /> <column name="parentClassPK" type="String"></column>
<!--2 Campi per stabilire quale è l'aggetto a cui è relazionato il log (escluso il parent)--> <!--2 Campi per stabilire quale è l'aggetto a cui è relazionato il log (escluso il parent)-->
<column name="relatedClassNameId" type="long" /> <column name="relatedClassNameId" type="long"></column>
<column name="relatedClassPK" type="String" /> <column name="relatedClassPK" type="String"></column>
<!-- Messaggio testuale dell'evento --> <!-- Messaggio testuale dell'evento -->
<column name="message" type="String" /> <column name="message" type="String"></column>
<!-- Dati per lo storico --> <!-- Dati per lo storico -->
<column name="diff" type="String" /> <column name="diff" type="String"></column>
<!-- Dati generici dell'utente che ha effettuato l'operazione --> <!-- Dati generici dell'utente che ha effettuato l'operazione -->
<column name="clientHost" type="String" /> <column name="clientHost" type="String"></column>
<column name="clientIP" type="String" /> <column name="clientIP" type="String"></column>
<column name="serverName" type="String" /> <column name="serverName" type="String"></column>
<column name="serverPort" type="int" /> <column name="serverPort" type="int"></column>
<column name="sessionID" type="String" /> <column name="sessionID" type="String"></column>
<!-- Informazioni addizionale dell'evento --> <!-- Informazioni addizionale dell'evento -->
<column name="additionalInfo" type="String" /> <column name="additionalInfo" type="String"></column>
<order by="desc"> <order by="desc">
<order-column name="createDate" /> <order-column name="createDate"></order-column>
</order> </order>
<finder name="CompanyId" return-type="Collection"> <finder name="CompanyId" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
</finder> </finder>
<finder name="C_ClassNameId" return-type="Collection"> <finder name="C_ClassNameId" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="classNameId" /> <finder-column name="classNameId"></finder-column>
</finder> </finder>
<finder name="C_ClassNameId_ClassPK" return-type="Collection"> <finder name="C_ClassNameId_ClassPK" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="classNameId" /> <finder-column name="classNameId"></finder-column>
<finder-column name="classPK"/> <finder-column name="classPK"></finder-column>
</finder> </finder>
<finder name="C_ClassNameId_AuditEventTable" return-type="Collection"> <finder name="C_ClassNameId_AuditEventTable" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="classNameId" /> <finder-column name="classNameId"></finder-column>
<finder-column name="auditEventTable"/> <finder-column name="auditEventTable"></finder-column>
</finder> </finder>
<finder name="C_ClassNameId_ClassPK_AuditEventTable" return-type="Collection"> <finder name="C_ClassNameId_ClassPK_AuditEventTable" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="classNameId" /> <finder-column name="classNameId"></finder-column>
<finder-column name="classPK"/> <finder-column name="classPK"></finder-column>
<finder-column name="auditEventTable"/> <finder-column name="auditEventTable"></finder-column>
</finder> </finder>
<finder name="C_ParentClassNameId_ParentClassPK" return-type="Collection"> <finder name="C_ParentClassNameId_ParentClassPK" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="parentClassNameId" /> <finder-column name="parentClassNameId"></finder-column>
<finder-column name="parentClassPK"/> <finder-column name="parentClassPK"></finder-column>
</finder> </finder>
<finder name="C_ParentClassNameId_ParentClassPK_ClassNameId" return-type="Collection"> <finder name="C_ParentClassNameId_ParentClassPK_ClassNameId" return-type="Collection">
<finder-column name="companyId" /> <finder-column name="companyId"></finder-column>
<finder-column name="parentClassNameId" /> <finder-column name="parentClassNameId"></finder-column>
<finder-column name="parentClassPK"/> <finder-column name="parentClassPK"></finder-column>
<finder-column name="classNameId" /> <finder-column name="classNameId"></finder-column>
</finder> </finder>
</entity> </entity>
</service-builder> </service-builder>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/details_column.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.kernel.util.TextFormatter"%> <%@page import="com.liferay.portal.kernel.util.TextFormatter"%>
<%@page import="com.liferay.portal.kernel.json.JSONArray"%> <%@page import="com.liferay.portal.kernel.json.JSONArray"%>
<%@page import="it.tref.liferay.portos.audit.model.AuditEvent"%> <%@page import="it.tref.liferay.portos.audit.model.AuditEvent"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/relations_column.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.kernel.util.TextFormatter"%> <%@page import="com.liferay.portal.kernel.util.TextFormatter"%>
<%@page import="com.liferay.portal.kernel.json.JSONArray"%> <%@page import="com.liferay.portal.kernel.json.JSONArray"%>
<%@page import="it.tref.liferay.portos.audit.model.AuditEvent"%> <%@page import="it.tref.liferay.portos.audit.model.AuditEvent"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/detail.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%> <%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%>
<%@page import="com.liferay.portal.security.permission.ActionKeys"%> <%@page import="com.liferay.portal.security.permission.ActionKeys"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%> <%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%>
<%@page import="com.liferay.portal.security.permission.ActionKeys"%> <%@page import="com.liferay.portal.security.permission.ActionKeys"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view_list.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%> <%@page import="it.tref.liferay.portos.audit.shared.permission.HistoryPermission"%>
<%@page import="com.liferay.portal.security.permission.ActionKeys"%> <%@page import="com.liferay.portal.security.permission.ActionKeys"%>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-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/portlet_2_0" prefix="portlet" %> <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/edit.jsp

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

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/view.jsp

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

28
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-display.xml

@ -4,22 +4,22 @@
<display> <display>
<category name="category.portos"> <category name="category.portos">
<category name="category.bo"> <category name="category.bo">
<portlet id="1" /> <portlet id="1"></portlet>
<portlet id="2" /> <portlet id="2"></portlet>
<portlet id="4" /> <portlet id="4"></portlet>
<portlet id="6" /> <portlet id="6"></portlet>
<portlet id="8" /> <portlet id="8"></portlet>
<portlet id="13" /> <portlet id="13"></portlet>
<portlet id="22" /> <portlet id="22"></portlet>
<portlet id="ricerca-posizione" /> <portlet id="ricerca-posizione"></portlet>
</category> </category>
</category> </category>
<category name="category.hidden"> <category name="category.hidden">
<portlet id="5" /> <portlet id="5"></portlet>
<portlet id="7" /> <portlet id="7"></portlet>
<portlet id="9" /> <portlet id="9"></portlet>
<portlet id="11" /> <portlet id="11"></portlet>
<portlet id="12" /> <portlet id="12"></portlet>
<portlet id="portos-administration" /> <portlet id="portos-administration"></portlet>
</category> </category>
</display> </display>

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

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

2058
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service.xml

File diff soppresso perché troppo grande Load Diff

1
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/search/IntPraticaSearch.java

@ -220,6 +220,7 @@ public class IntPraticaSearch extends BaseSearch {
// Condizioni aggiuntive // Condizioni aggiuntive
fullQuery(request, user, query, searchContext); fullQuery(request, user, query, searchContext);
hits = SearchEngineUtil.search(searchContext, query); hits = SearchEngineUtil.search(searchContext, query);
_log.info(query);
logResults(query, hits); logResults(query, hits);
} catch (ParseException | SearchException | java.text.ParseException e) { } catch (ParseException | SearchException | java.text.ParseException e) {
_log.error(e, e); _log.error(e, e);

120
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service.xml

@ -1,107 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.1.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_1_0.dtd"> <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.1.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_1_0.dtd">
<service-builder package-path="it.tref.portos.calendar.appointments"> <service-builder package-path="it.tref.portos.calendar.appointments">
<author>3F Consulting + Manifattura Web Group s.r.l.</author> <author>3F Consulting</author>
<namespace>portos_calendar_appointments</namespace> <namespace>portos_calendar_appointments</namespace>
<entity name="Funzionario" local-service="true" remote-service="true" uuid="true"> <entity name="Funzionario" local-service="true" remote-service="true" uuid="true">
<!-- PK fields --> <!-- PK fields -->
<column name="funzionarioId" type="long" primary="true" /> <column name="funzionarioId" type="long" primary="true"></column>
<!-- Audit fields --> <!-- Audit fields -->
<column name="companyId" type="long" /> <column name="companyId" type="long"></column>
<column name="userId" type="long" /> <column name="userId" type="long"></column>
<column name="userName" type="String" /> <column name="userName" type="String"></column>
<column name="createDate" type="Date" /> <column name="createDate" type="Date"></column>
<column name="modifiedDate" type="Date" /> <column name="modifiedDate" type="Date"></column>
<column name="groupId" type="long" /> <column name="groupId" type="long"></column>
<!-- Other fields --> <!-- Other fields -->
<column name="nome" type="String" /> <column name="nome" type="String"></column>
<column name="cognome" type="String" /> <column name="cognome" type="String"></column>
<column name="presidio" type="String" /> <column name="presidio" type="String"></column>
<column name="tipologia" type="String" /> <column name="tipologia" type="String"></column>
<!-- Finder --> <!-- Finder -->
<finder return-type="Funzionario" name="Funzionario"> <finder return-type="Funzionario" name="Funzionario">
<finder-column name="funzionarioId" /> <finder-column name="funzionarioId"></finder-column>
</finder> </finder>
<finder return-type="Collection" name="Presidio"> <finder return-type="Collection" name="Presidio">
<finder-column name="presidio" /> <finder-column name="presidio"></finder-column>
</finder> </finder>
</entity> </entity>
<entity name="Professionista" local-service="true" remote-service="true" uuid="true"> <entity name="Professionista" local-service="true" remote-service="true" uuid="true">
<!-- PK fields --> <!-- PK fields -->
<column name="professionistaId" type="long" primary="true" /> <column name="professionistaId" type="long" primary="true"></column>
<!-- Audit fields --> <!-- Audit fields -->
<column name="companyId" type="long" /> <column name="companyId" type="long"></column>
<column name="userId" type="long" /> <column name="userId" type="long"></column>
<column name="userName" type="String" /> <column name="userName" type="String"></column>
<column name="createDate" type="Date" /> <column name="createDate" type="Date"></column>
<column name="modifiedDate" type="Date" /> <column name="modifiedDate" type="Date"></column>
<column name="groupId" type="long" /> <column name="groupId" type="long"></column>
<!-- Other fields --> <!-- Other fields -->
<column name="nome" type="String" /> <column name="nome" type="String"></column>
<column name="cognome" type="String" /> <column name="cognome" type="String"></column>
</entity> </entity>
<entity name="Disponibilita" local-service="true" remote-service="true" uuid="true"> <entity name="Disponibilita" local-service="true" remote-service="true" uuid="true">
<!-- PK fields --> <!-- PK fields -->
<column name="disponibilitaId" type="long" primary="true" /> <column name="disponibilitaId" type="long" primary="true"></column>
<!-- Audit fields --> <!-- Audit fields -->
<column name="companyId" type="long" /> <column name="companyId" type="long"></column>
<column name="userId" type="long" /> <column name="userId" type="long"></column>
<column name="userName" type="String" /> <column name="userName" type="String"></column>
<column name="createDate" type="Date" /> <column name="createDate" type="Date"></column>
<column name="modifiedDate" type="Date" /> <column name="modifiedDate" type="Date"></column>
<column name="groupId" type="long" /> <column name="groupId" type="long"></column>
<!-- Other fields --> <!-- Other fields -->
<column name="funzionarioId" type="long" /> <column name="funzionarioId" type="long"></column>
<column name="startDate" type="Date" /> <column name="startDate" type="Date"></column>
<column name="endDate" type="Date" /> <column name="endDate" type="Date"></column>
<column name="exactDate" type="String" /> <column name="exactDate" type="String"></column>
<column name="presidio" type="long" /> <column name="presidio" type="long"></column>
<column name="disponibile" type="boolean" /> <column name="disponibile" type="boolean"></column>
</entity> </entity>
<entity name="Prenotazione" local-service="true" remote-service="true" uuid="true"> <entity name="Prenotazione" local-service="true" remote-service="true" uuid="true">
<!-- PK fields --> <!-- PK fields -->
<column name="prenotazioneId" type="long" primary="true" /> <column name="prenotazioneId" type="long" primary="true"></column>
<!-- Audit fields --> <!-- Audit fields -->
<column name="companyId" type="long" /> <column name="companyId" type="long"></column>
<column name="userId" type="long" /> <column name="userId" type="long"></column>
<column name="userName" type="String" /> <column name="userName" type="String"></column>
<column name="createDate" type="Date" /> <column name="createDate" type="Date"></column>
<column name="modifiedDate" type="Date" /> <column name="modifiedDate" type="Date"></column>
<column name="groupId" type="long" /> <column name="groupId" type="long"></column>
<!-- Other fields --> <!-- Other fields -->
<column name="funzionarioId" type="long" /> <column name="funzionarioId" type="long"></column>
<column name="professionistaId" type="long" /> <column name="professionistaId" type="long"></column>
<column name="startDate" type="Date" /> <column name="startDate" type="Date"></column>
<column name="endDate" type="Date" /> <column name="endDate" type="Date"></column>
<column name="descLong" type="String" /> <column name="descLong" type="String"></column>
<!-- Product Backlog Item 32934 --> <!-- Product Backlog Item 32934 -->
<column name="telefono" type="String" /> <column name="telefono" type="String"></column>
<column name="email" type="String" /> <column name="email" type="String"></column>
<!-- Finder --> <!-- Finder -->
<finder return-type="Prenotazione" name="prenotazione"> <finder return-type="Prenotazione" name="prenotazione">
<finder-column name="prenotazioneId" /> <finder-column name="prenotazioneId"></finder-column>
</finder> </finder>
<finder return-type="Collection" name="Funzionario_StartDate"> <finder return-type="Collection" name="Funzionario_StartDate">
<finder-column name="funzionarioId" /> <finder-column name="funzionarioId"></finder-column>
<finder-column name="startDate" /> <finder-column name="startDate"></finder-column>
</finder> </finder>
<finder return-type="Collection" name="StartDate"> <finder return-type="Collection" name="StartDate">
<finder-column name="startDate" /> <finder-column name="startDate"></finder-column>
</finder> </finder>
</entity> </entity>
<exceptions> <exceptions>
<exception>DuplicateFunzionario</exception> <exception>DuplicateFunzionario</exception>
<exception>DuplicateProfessionista</exception> <exception>DuplicateProfessionista</exception>
<exception>DuplicatePrenotazione</exception> <exception>DuplicatePrenotazione</exception>
<exception>SlotNotAvailable</exception> <exception>SlotNotAvailable</exception>
</exceptions> </exceptions>
</service-builder> </service-builder>

36
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/DisponibilitaImpl.java

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

48
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/FunzionarioImpl.java

@ -1,9 +1,13 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software *
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in * This library is free software; you can redistribute it and/or modify it under the terms of the
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * GNU Lesser General Public License as published by the Free Software Foundation; either version
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/ */
package it.tref.portos.calendar.appointments.model.impl; package it.tref.portos.calendar.appointments.model.impl;
@ -12,26 +16,28 @@ import com.liferay.portal.kernel.util.StringPool;
/** /**
* The extended model implementation for the Funzionario service. Represents a row in the * The extended model implementation for the Funzionario service. Represents a row in the
* &quot;portos_calendar_appointments_Funzionario&quot; database table, with each column mapped to a property of this * &quot;portos_calendar_appointments_Funzionario&quot; database table, with each column mapped to a
* class. * property of this class.
*
* <p> * <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun * Helper methods and all application logic should be put in this class. Whenever methods are added,
* ServiceBuilder to copy their definitions into the {@link it.tref.portos.calendar.appointments.model.Funzionario} * rerun ServiceBuilder to copy their definitions into the
* interface. * {@link it.tref.portos.calendar.appointments.model.Funzionario} interface.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class FunzionarioImpl extends FunzionarioBaseImpl { public class FunzionarioImpl extends FunzionarioBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a funzionario model instance * NOTE FOR DEVELOPERS:
* should use the {@link it.tref.portos.calendar.appointments.model.Funzionario} interface instead. *
*/ * Never reference this class directly. All methods that expect a funzionario model instance
public FunzionarioImpl() {} * should use the {@link it.tref.portos.calendar.appointments.model.Funzionario} interface
* instead.
*/
public FunzionarioImpl() {}
@Override public String getFullDescription() {
public String getFullDescription() { return getNome() + StringPool.SPACE + getCognome();
return getNome() + StringPool.SPACE + getCognome(); }
}
} }

57
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/PrenotazioneImpl.java

@ -1,9 +1,13 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software *
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in * This library is free software; you can redistribute it and/or modify it under the terms of the
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * GNU Lesser General Public License as published by the Free Software Foundation; either version
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/ */
package it.tref.portos.calendar.appointments.model.impl; package it.tref.portos.calendar.appointments.model.impl;
@ -14,27 +18,38 @@ import org.apache.commons.lang.time.DateUtils;
/** /**
* The extended model implementation for the Prenotazione service. Represents a row in the * The extended model implementation for the Prenotazione service. Represents a row in the
* &quot;portos_calendar_appointments_Prenotazione&quot; database table, with each column mapped to a property of this * &quot;portos_calendar_appointments_Prenotazione&quot; database table, with each column mapped to
* class. * a property of this class.
*
* <p> * <p>
* Helper methods and all application logic should be put in this class. Whenever methods are added, rerun * Helper methods and all application logic should be put in this class. Whenever methods are added,
* ServiceBuilder to copy their definitions into the {@link it.tref.portos.calendar.appointments.model.Prenotazione} * rerun ServiceBuilder to copy their definitions into the
* interface. * {@link it.tref.portos.calendar.appointments.model.Prenotazione} interface.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
*/ */
@SuppressWarnings("serial")
public class PrenotazioneImpl extends PrenotazioneBaseImpl { public class PrenotazioneImpl extends PrenotazioneBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a prenotazione model instance * NOTE FOR DEVELOPERS:
* should use the {@link it.tref.portos.calendar.appointments.model.Prenotazione} interface instead. *
*/ * Never reference this class directly. All methods that expect a prenotazione model instance
public PrenotazioneImpl() {} * should use the {@link it.tref.portos.calendar.appointments.model.Prenotazione} interface
* instead.
*/
public PrenotazioneImpl() {}
public boolean isExpired(Date now) {
if (now.after(getStartDate())) {
return true;
}
if (DateUtils.isSameDay(now, getStartDate())) {
return true;
@Override }
public boolean isExpired(Date now) {
return now.after(getStartDate()) || DateUtils.isSameDay(now, getStartDate()); return false;
} }
} }

36
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/ProfessionistaImpl.java

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

510
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaLocalServiceImpl.java

@ -1,9 +1,13 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software *
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in * This library is free software; you can redistribute it and/or modify it under the terms of the
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * GNU Lesser General Public License as published by the Free Software Foundation; either version
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/ */
package it.tref.portos.calendar.appointments.service.impl; package it.tref.portos.calendar.appointments.service.impl;
@ -26,13 +30,11 @@ import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.Order; import com.liferay.portal.kernel.dao.orm.Order;
import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil;
import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil; import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.Organization; import com.liferay.portal.model.Organization;
import com.liferay.portal.model.Role; import com.liferay.portal.model.Role;
import com.liferay.portal.model.User; import com.liferay.portal.model.User;
@ -40,508 +42,650 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
/** /**
* The implementation of the disponibilita local service. * The implementation of the disponibilita local service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.tref.portos.calendar.appointments.service.DisponibilitaLocalService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.tref.portos.calendar.appointments.service.DisponibilitaLocalService} interface.
*
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * This is a local service. Methods of this service will not have security checks based on the
* credentials because this service can only be accessed from within the same VM. * propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see it.tref.portos.calendar.appointments.service.base.DisponibilitaLocalServiceBaseImpl * @see it.tref.portos.calendar.appointments.service.base.DisponibilitaLocalServiceBaseImpl
* @see it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil * @see it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil
*/ */
public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBaseImpl { public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil} to access the disponibilita local *
* service. * Never reference this interface directly. Always use {@link
* it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil} to access the
* disponibilita local service.
*/ */
private static Log _log = LogFactoryUtil.getLog(DisponibilitaLocalServiceImpl.class); private static Log _log = LogFactoryUtil.getLog(DisponibilitaLocalServiceImpl.class);
@Override //Bug 32935
public long checkDisponibilitaExist(long funzionarioId, Date startDate, Date endDate) throws SystemException { public long checkDisponibilitaExist(long funzionarioId, Date startDate, Date endDate) throws SystemException{
long exist = 0L; long exist = 0L;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDate))); dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDate)));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", startDate));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate", endDate)); //Bug 32935
@SuppressWarnings("unchecked") dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate",startDate));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate",endDate));
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery); List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
if (!results.isEmpty()) { if(!results.isEmpty()){
exist = results.get(0).getDisponibilitaId(); exist = results.get(0).getDisponibilitaId();
} }
return exist; return exist;
} }
@Override public long checkDisponibilitaExist(long funzionarioId, Date startDate, Date endDate, long presidio) throws SystemException{
public long checkDisponibilitaExist(long funzionarioId, Date startDate, Date endDate, long presidio)
throws SystemException {
long exist = 0L; long exist = 0L;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDate))); dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDate)));
dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio", presidio)); dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio",presidio));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", startDate));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate", endDate)); //Bug 32935
@SuppressWarnings("unchecked") dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate",startDate));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate",endDate));
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery); List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
if (!results.isEmpty()) { if(!results.isEmpty()){
exist = results.get(0).getDisponibilitaId(); exist = results.get(0).getDisponibilitaId();
} }
return exist; return exist;
} }
@Override
public Disponibilita addDisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio, public Disponibilita addDisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio,
ServiceContext serviceContext) throws SystemException, PortalException { ServiceContext serviceContext) throws SystemException, PortalException {
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(presidio); Organization organization = OrganizationLocalServiceUtil.fetchOrganization(presidio);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Disponibilita disponibilita = Disponibilita disponibilita =
disponibilitaPersistence.create(counterLocalService.increment(Disponibilita.class.getName())); disponibilitaPersistence.create(counterLocalService.increment(Disponibilita.class.getName()));
User user = userPersistence.findByPrimaryKey(userId); User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date(); Date now = new Date();
disponibilita.setCompanyId(serviceContext.getCompanyId()); disponibilita.setCompanyId(serviceContext.getCompanyId());
disponibilita.setUserId(user.getUserId()); disponibilita.setUserId(user.getUserId());
disponibilita.setUserName(user.getFullName()); disponibilita.setUserName(user.getFullName());
disponibilita.setCreateDate(serviceContext.getCreateDate(now)); disponibilita.setCreateDate(serviceContext.getCreateDate(now));
disponibilita.setModifiedDate(serviceContext.getModifiedDate(now)); disponibilita.setModifiedDate(serviceContext.getModifiedDate(now));
disponibilita.setGroupId(organization.getGroupId()); disponibilita.setGroupId(organization.getGroupId());
disponibilita.setFunzionarioId(funzionarioId); disponibilita.setFunzionarioId(funzionarioId);
disponibilita.setStartDate(startDate); disponibilita.setStartDate(startDate);
disponibilita.setEndDate(endDate); disponibilita.setEndDate(endDate);
disponibilita.setPresidio(presidio); disponibilita.setPresidio(presidio);
disponibilita.setExactDate(sdf.format(startDate)); disponibilita.setExactDate(sdf.format(startDate));
disponibilita.setDisponibile(true); disponibilita.setDisponibile(true);
disponibilita = updateDisponibilita(disponibilita);
disponibilita = disponibilitaLocalService.updateDisponibilita(disponibilita);
return disponibilita; return disponibilita;
} }
@Override public Disponibilita addIndisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio,
public Disponibilita addIndisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, ServiceContext serviceContext) throws SystemException, PortalException {
long presidio, ServiceContext serviceContext) throws SystemException, PortalException {
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(presidio); Organization organization = OrganizationLocalServiceUtil.fetchOrganization(presidio);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Disponibilita disponibilita = Disponibilita disponibilita =
disponibilitaPersistence.create(counterLocalService.increment(Disponibilita.class.getName())); disponibilitaPersistence.create(counterLocalService.increment(Disponibilita.class.getName()));
User user = userPersistence.findByPrimaryKey(userId); User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date(); Date now = new Date();
disponibilita.setCompanyId(serviceContext.getCompanyId()); disponibilita.setCompanyId(serviceContext.getCompanyId());
disponibilita.setUserId(user.getUserId()); disponibilita.setUserId(user.getUserId());
disponibilita.setUserName(user.getFullName()); disponibilita.setUserName(user.getFullName());
disponibilita.setCreateDate(serviceContext.getCreateDate(now)); disponibilita.setCreateDate(serviceContext.getCreateDate(now));
disponibilita.setModifiedDate(serviceContext.getModifiedDate(now)); disponibilita.setModifiedDate(serviceContext.getModifiedDate(now));
disponibilita.setGroupId(organization.getGroupId()); disponibilita.setGroupId(organization.getGroupId());
disponibilita.setFunzionarioId(funzionarioId); disponibilita.setFunzionarioId(funzionarioId);
disponibilita.setStartDate(startDate); disponibilita.setStartDate(startDate);
disponibilita.setEndDate(endDate); disponibilita.setEndDate(endDate);
disponibilita.setPresidio(presidio); disponibilita.setPresidio(presidio);
disponibilita.setExactDate(sdf.format(startDate)); disponibilita.setExactDate(sdf.format(startDate));
disponibilita.setDisponibile(false); disponibilita.setDisponibile(false);
disponibilita = updateDisponibilita(disponibilita);
disponibilita = disponibilitaLocalService.updateDisponibilita(disponibilita);
return disponibilita; return disponibilita;
} }
@Override public void addDisponibilitaGenerale(long userId, Date startDate, Date endDate, long presidioId,
public void addDisponibilitaGenerale(long userId, Date startDate, Date endDate, long presidioId, String oraInizio, String oraInizio, String oraFine, int giornoSettimana, ServiceContext serviceContext) throws SystemException, PortalException, ParseException{
String oraFine, int giornoSettimana, ServiceContext serviceContext) throws SystemException,
PortalException, ParseException {
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(presidioId); Organization organization = OrganizationLocalServiceUtil.fetchOrganization(presidioId);
List<User> userDefinitivo = new ArrayList<User>(); List<User> userDefinitivo = new ArrayList<User>();
try { try {
if (organization != null) {
List<User> users = userLocalService.getOrganizationUsers(presidioId); if(organization != null){
List<User> users = UserLocalServiceUtil.getOrganizationUsers(presidioId);
for (User user : users) { for (User user : users) {
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto"); Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
Role portosIstruttore =
RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario"); Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
boolean isIstruttore = if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){
UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
organization.getGroupId(), portosIstruttore.getRoleId()); boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
if (isIstruttore) { user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
if(isIstruttore){
userDefinitivo.add(user); userDefinitivo.add(user);
} }
} }
} }
} }
} catch (NumberFormatException | SystemException e) { } catch (NumberFormatException | SystemException e) {
_log.error(e, e); _log.error(e,e);
} catch (PortalException e) { } catch (PortalException e) {
_log.error(e, e); _log.error(e,e);
} }
Calendar calendarStartDate = Calendar.getInstance(); Calendar calendarStartDate = Calendar.getInstance();
calendarStartDate.setTime(startDate); calendarStartDate.setTime(startDate);
if (calendarStartDate.get(Calendar.DAY_OF_WEEK) == giornoSettimana) {
if(calendarStartDate.get(Calendar.DAY_OF_WEEK) == giornoSettimana){
Date startDateToInsert = formatDateTime(oraInizio, startDate); Date startDateToInsert = formatDateTime(oraInizio, startDate);
Date endDateToInsert = formatDateTime(oraFine, startDate); Date endDateToInsert = formatDateTime(oraFine, startDate);
for (User user : userDefinitivo) { for (User user : userDefinitivo) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId())); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDateToInsert))); dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDateToInsert)));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", organization.getGroupId())); dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", organization.getGroupId()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", startDateToInsert));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate", endDateToInsert)); //Bug 32935
@SuppressWarnings("unchecked") dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate",startDateToInsert));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate",endDateToInsert));
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery); List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
if (results.isEmpty()) { if(results.isEmpty()){
addDisponibilita(serviceContext.getUserId(), user.getUserId(), startDateToInsert, endDateToInsert, addDisponibilita(serviceContext.getUserId(), user.getUserId(), startDateToInsert, endDateToInsert,
organization.getOrganizationId(), serviceContext); organization.getOrganizationId(), serviceContext);
} else { }
for (Iterator<Disponibilita> iterator = results.iterator(); iterator.hasNext();) { //Bug 32935
Disponibilita disponibilita = iterator.next(); else{
for (Iterator iterator = results.iterator(); iterator.hasNext();) {
Disponibilita disponibilita = (Disponibilita) iterator.next();
disponibilita.setDisponibile(true); disponibilita.setDisponibile(true);
updateDisponibilita(disponibilita); disponibilitaLocalService.updateDisponibilita(disponibilita);
} }
} }
} }
} }
addDayForDisponibilita(startDate, endDate, oraInizio, oraFine, giornoSettimana, userDefinitivo,
organization.getOrganizationId(), serviceContext); addDayForDisponibilita(startDate, endDate, oraInizio, oraFine, giornoSettimana,
userDefinitivo, organization.getOrganizationId(), serviceContext);
} }
private void addDayForDisponibilita(Date date, Date endDate, String oraInizio, String oraFine, int giornoSettimana, private void addDayForDisponibilita(Date date, Date endDate, String oraInizio, String oraFine,int giornoSettimana,List<User> users,
List<User> users, long presidioId, ServiceContext serviceContext) throws ParseException, SystemException, long presidioId, ServiceContext serviceContext)
PortalException { throws ParseException, SystemException, PortalException{
Organization org = OrganizationLocalServiceUtil.fetchOrganization(presidioId); Organization org = OrganizationLocalServiceUtil.fetchOrganization(presidioId);
Date datePlus = datePlusOneDay(date); Date datePlus = datePlusOneDay(date);
if (date.before(datePlus) && (endDate.after(datePlus) || isSameDate(endDate, datePlus))) { if(date.before(datePlus) && (endDate.after(datePlus) || isSameDate(endDate, datePlus))){
Calendar calendarStartDate = Calendar.getInstance(); Calendar calendarStartDate = Calendar.getInstance();
calendarStartDate.setTime(datePlus); calendarStartDate.setTime(datePlus);
if (calendarStartDate.get(Calendar.DAY_OF_WEEK) == giornoSettimana) {
if(calendarStartDate.get(Calendar.DAY_OF_WEEK) == giornoSettimana){
Date startDateToInsert = formatDateTime(oraInizio, datePlus); Date startDateToInsert = formatDateTime(oraInizio, datePlus);
Date endDateToInsert = formatDateTime(oraFine, datePlus); Date endDateToInsert = formatDateTime(oraFine, datePlus);
for (User user : users) { for (User user : users) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId())); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDateToInsert))); dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDateToInsert)));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", org.getGroupId())); dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", org.getGroupId()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", startDateToInsert));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate", endDateToInsert)); //Bug 32935
@SuppressWarnings("unchecked") dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate",startDateToInsert));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate",endDateToInsert));
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery); List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
if (results.isEmpty()) { if(results.isEmpty()){
addDisponibilita(serviceContext.getUserId(), user.getUserId(), startDateToInsert, addDisponibilita(serviceContext.getUserId(), user.getUserId(), startDateToInsert, endDateToInsert,
endDateToInsert, presidioId, serviceContext); presidioId, serviceContext);
} else { }
for (Iterator<Disponibilita> iterator = results.iterator(); iterator.hasNext();) { //Bug 32935
Disponibilita disponibilita = iterator.next(); else{
for (Iterator iterator = results.iterator(); iterator.hasNext();) {
Disponibilita disponibilita = (Disponibilita) iterator.next();
disponibilita.setDisponibile(true); disponibilita.setDisponibile(true);
updateDisponibilita(disponibilita); disponibilitaLocalService.updateDisponibilita(disponibilita);
} }
} }
} }
addDayForDisponibilita(datePlus, endDate, oraInizio, oraFine, giornoSettimana, users, presidioId,
serviceContext); addDayForDisponibilita(datePlus, endDate, oraInizio, oraFine, giornoSettimana, users,
presidioId, serviceContext);
} else { } else {
addDayForDisponibilita(datePlus, endDate, oraInizio, oraFine, giornoSettimana, users, presidioId, addDayForDisponibilita(datePlus, endDate, oraInizio, oraFine, giornoSettimana, users,
serviceContext); presidioId, serviceContext);
} }
} }
} }
private Date datePlusOneDay(Date date) { private Date datePlusOneDay(Date date){
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(date); calendar.setTime(date);
calendar.add(Calendar.DATE, 1); calendar.add(Calendar.DATE, 1);
return calendar.getTime(); return calendar.getTime();
} }
private boolean isSameDate(Date date1, Date date2) { private boolean isSameDate(Date date1 , Date date2){
Calendar cal1 = Calendar.getInstance(); Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance();
cal1.setTime(date1); cal1.setTime(date1);
cal2.setTime(date2); cal2.setTime(date2);
boolean sameDay =
cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) boolean sameDay = cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) &&
&& cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR); cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR);
return sameDay; return sameDay;
} }
@SuppressWarnings("unchecked")
@Override
public List<Disponibilita> findByStartDate(Date date) throws SystemException { public List<Disponibilita> findByStartDate(Date date) throws SystemException {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
Date end = DateUtils.addDays(start, 1); Date end = DateUtils.addDays(start, 1);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", start, end)); dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", start, end));
dynamicQuery.addOrder(OrderFactoryUtil.desc("funzionarioId")); dynamicQuery.addOrder(OrderFactoryUtil.desc("funzionarioId"));
return disponibilitaPersistence.findWithDynamicQuery(dynamicQuery); return disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
}
@Override }
public List<Disponibilita> findByFunzionarioStartAndPresidio(long funzionarioId, Date date, long presidio)
throws SystemException {
public List<Disponibilita> findByFunzionarioStartAndPresidio(long funzionarioId, Date date, long presidio) throws SystemException {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
Date end = DateUtils.addHours(start, 22); Date end = DateUtils.addHours(start, 22);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start)); dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end)); dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", presidio)); dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", presidio));
@SuppressWarnings("unchecked")
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery); List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
return results; return results;
}
@SuppressWarnings("unchecked") }
@Override
public List<Disponibilita> findByFunzionario_StartDate(long funzionarioId, Date date, long presidio)
throws SystemException {
public List<Disponibilita> findByFunzionario_StartDate(long funzionarioId, Date date, long presidio) throws SystemException {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
Date end = DateUtils.addHours(start, 22); Date end = DateUtils.addHours(start, 22);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start)); dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end)); dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", presidio)); dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", presidio));
return disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
return results;
} }
@SuppressWarnings("unchecked") public List<Disponibilita> findByFunzionarioStartDate(long funzionarioId, Date date, int startRow, int endRow) throws SystemException {
@Override
public List<Disponibilita> findByFunzionarioStartDate(long funzionarioId, Date date, int startRow, int endRow)
throws SystemException {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
Date end = DateUtils.addHours(start, 22);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start)); dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate"); Order defaultOrder = OrderFactoryUtil.asc("startDate");
dynamicQuery.addOrder(defaultOrder); dynamicQuery.addOrder(defaultOrder);
return dynamicQuery(dynamicQuery, startRow, endRow);
List<Disponibilita> results = disponibilitaLocalService.dynamicQuery(dynamicQuery, startRow, endRow);
return results;
} }
@Override
public int countByFunzionarioStartDate(long funzionarioId, Date date) throws SystemException { public int countByFunzionarioStartDate(long funzionarioId, Date date) throws SystemException {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start)); dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate"); Order defaultOrder = OrderFactoryUtil.asc("startDate");
dynamicQuery.addOrder(defaultOrder); dynamicQuery.addOrder(defaultOrder);
return dynamicQuery(dynamicQuery, QueryUtil.ALL_POS, QueryUtil.ALL_POS).size();
List<Disponibilita> results = disponibilitaLocalService.dynamicQuery(dynamicQuery, -1, -1);
return results.size();
} }
@SuppressWarnings("unchecked") public List<Disponibilita> findByPOStartDateAndFilters(long funzionarioId, Date date, int startRow, int endRow, String provinciaFilter, String funzionarioIdFilter) throws SystemException {
@Override
public List<Disponibilita> findByPOStartDateAndFilters(long funzionarioId, Date date, int startRow, int endRow, User user = UserLocalServiceUtil.fetchUser(funzionarioId);
String provinciaFilter, String funzionarioIdFilter) throws SystemException {
User user = userLocalService.fetchUser(funzionarioId);
List<Long> orgIds = new ArrayList<Long>(); List<Long> orgIds = new ArrayList<Long>();
try { try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale"); Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
boolean isDirigenteGenerale = boolean isDirigenteGenerale = RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if (isDirigenteGenerale) { if(isDirigenteGenerale){
List<Organization> orgs =
OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); List<Organization> orgs = OrganizationLocalServiceUtil.getOrganizations(-1, -1);
for (Organization organization : orgs) { for (Organization organization : orgs) {
if (organization.getParentOrganization() != null) { if(organization.getParentOrganization() != null){
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());
} }
} }
} else { } else {
List<Organization> orgs = OrganizationLocalServiceUtil.getUserOrganizations(funzionarioId); List<Organization> orgs = OrganizationLocalServiceUtil.getUserOrganizations(funzionarioId);
for (Organization organization : orgs) { for (Organization organization : orgs) {
Role portosPO = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_po"); Role portosPO = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_po");
boolean isPO =
UserGroupRoleLocalServiceUtil.hasUserGroupRole(funzionarioId, organization.getGroupId(), boolean isPO = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
portosPO.getRoleId()); funzionarioId, organization.getGroupId(), portosPO.getRoleId());
if (isPO) {
if(isPO){
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());
} }
} }
} }
} catch (PortalException e) { } catch (PortalException e) {
_log.error(e, e); _log.error(e,e);
} }
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
if (provinciaFilter.equals("-1") || provinciaFilter.equals(StringPool.BLANK)) {
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray())); if(!provinciaFilter.equals("-1") && !provinciaFilter.equals("")){
} else {
dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio", Long.valueOf(provinciaFilter))); dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio", Long.valueOf(provinciaFilter)));
}
if (funzionarioIdFilter.equals("-1") || funzionarioIdFilter.equals(StringPool.BLANK)) {
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
} else { } else {
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray()));
}
if(!funzionarioIdFilter.equals("-1") && !funzionarioIdFilter.equals("")){
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", Long.valueOf(funzionarioIdFilter))); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", Long.valueOf(funzionarioIdFilter)));
} else {
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
} }
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start)); dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate"); Order defaultOrder = OrderFactoryUtil.asc("startDate");
dynamicQuery.addOrder(defaultOrder); dynamicQuery.addOrder(defaultOrder);
return dynamicQuery(dynamicQuery, startRow, endRow);
List<Disponibilita> results = disponibilitaLocalService.dynamicQuery(dynamicQuery, startRow, endRow);
return results;
} }
@Override public int countByPOStartDateAndFilters(long funzionarioId, Date date, String provinciaFilter, String funzionarioIdFilter) throws SystemException {
public int countByPOStartDateAndFilters(long funzionarioId, Date date, String provinciaFilter,
String funzionarioIdFilter) throws SystemException { User user = UserLocalServiceUtil.fetchUser(funzionarioId);
User user = userLocalService.fetchUser(funzionarioId);
List<Long> orgIds = new ArrayList<Long>(); List<Long> orgIds = new ArrayList<Long>();
try { try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale"); Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
boolean isDirigenteGenerale = boolean isDirigenteGenerale = RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if (isDirigenteGenerale) { if(isDirigenteGenerale){
List<Organization> orgs =
OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); List<Organization> orgs = OrganizationLocalServiceUtil.getOrganizations(-1, -1);
for (Organization organization : orgs) { for (Organization organization : orgs) {
if (organization.getParentOrganization() != null) { if(organization.getParentOrganization() != null){
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());
} }
} }
} else { } else {
List<Organization> orgs = OrganizationLocalServiceUtil.getUserOrganizations(funzionarioId); List<Organization> orgs = OrganizationLocalServiceUtil.getUserOrganizations(funzionarioId);
for (Organization organization : orgs) { for (Organization organization : orgs) {
Role portosPO = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_po"); Role portosPO = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_po");
boolean isPO =
UserGroupRoleLocalServiceUtil.hasUserGroupRole(funzionarioId, organization.getGroupId(), boolean isPO = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
portosPO.getRoleId()); funzionarioId, organization.getGroupId(), portosPO.getRoleId());
if (isPO) {
if(isPO){
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());
} }
} }
} }
} catch (PortalException e) { } catch (PortalException e) {
_log.error(e, e); _log.error(e,e);
} }
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
if (provinciaFilter.equals("-1") || provinciaFilter.equals(StringPool.BLANK)) {
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray())); if(!provinciaFilter.equals("-1") && !provinciaFilter.equals("")){
} else {
dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio", Long.valueOf(provinciaFilter))); dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio", Long.valueOf(provinciaFilter)));
}
if (funzionarioIdFilter.equals("-1") || funzionarioIdFilter.equals(StringPool.BLANK)) {
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
} else { } else {
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray()));
}
if(!funzionarioIdFilter.equals("-1") && !funzionarioIdFilter.equals("")){
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", Long.valueOf(funzionarioIdFilter))); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", Long.valueOf(funzionarioIdFilter)));
} else {
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
} }
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start)); dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate"); Order defaultOrder = OrderFactoryUtil.asc("startDate");
dynamicQuery.addOrder(defaultOrder); dynamicQuery.addOrder(defaultOrder);
return dynamicQuery(dynamicQuery, QueryUtil.ALL_POS, QueryUtil.ALL_POS).size();
List<Disponibilita> results = disponibilitaLocalService.dynamicQuery(dynamicQuery, -1, -1);
return results.size();
} }
@SuppressWarnings("unchecked") public List<Disponibilita> findByPOStartDate(long funzionarioId, Date date, int startRow, int endRow) throws SystemException {
@Override
public List<Disponibilita> findByPOStartDate(long funzionarioId, Date date, int startRow, int endRow) User user = UserLocalServiceUtil.fetchUser(funzionarioId);
throws SystemException {
User user = userLocalService.fetchUser(funzionarioId);
List<Long> orgIds = new ArrayList<Long>(); List<Long> orgIds = new ArrayList<Long>();
try { try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale"); Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
boolean isDirigenteGenerale = boolean isDirigenteGenerale = RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if (isDirigenteGenerale) { if(isDirigenteGenerale){
List<Organization> orgs =
OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); List<Organization> orgs = OrganizationLocalServiceUtil.getOrganizations(-1, -1);
for (Organization organization : orgs) { for (Organization organization : orgs) {
if (organization.getParentOrganization() != null) { if(organization.getParentOrganization() != null){
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());
} }
} }
} else { } else {
List<Organization> orgs = OrganizationLocalServiceUtil.getUserOrganizations(funzionarioId); List<Organization> orgs = OrganizationLocalServiceUtil.getUserOrganizations(funzionarioId);
for (Organization organization : orgs) { for (Organization organization : orgs) {
Role portosPO = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_po"); Role portosPO = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_po");
boolean isPO =
UserGroupRoleLocalServiceUtil.hasUserGroupRole(funzionarioId, organization.getGroupId(), boolean isPO = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
portosPO.getRoleId()); funzionarioId, organization.getGroupId(), portosPO.getRoleId());
if (isPO) {
if(isPO){
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());
} }
} }
} }
} catch (PortalException e) { } catch (PortalException e) {
_log.error(e, e); _log.error(e,e);
} }
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray())); dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray()));
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId)); dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start)); dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate"); Order defaultOrder = OrderFactoryUtil.asc("startDate");
dynamicQuery.addOrder(defaultOrder); dynamicQuery.addOrder(defaultOrder);
return dynamicQuery(dynamicQuery, startRow, endRow);
List<Disponibilita> results = disponibilitaLocalService.dynamicQuery(dynamicQuery, startRow, endRow);
return results;
} }
@Override
public int countByPOStartDate(long funzionarioId, Date date) throws SystemException { public int countByPOStartDate(long funzionarioId, Date date) throws SystemException {
User user = userLocalService.fetchUser(funzionarioId); User user = UserLocalServiceUtil.fetchUser(funzionarioId);
List<Long> orgIds = new ArrayList<Long>(); List<Long> orgIds = new ArrayList<Long>();
try { try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale"); Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
boolean isDirigenteGenerale = boolean isDirigenteGenerale = RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if (isDirigenteGenerale) { if(isDirigenteGenerale){
List<Organization> orgs =
OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); List<Organization> orgs = OrganizationLocalServiceUtil.getOrganizations(-1, -1);
for (Organization organization : orgs) { for (Organization organization : orgs) {
if (organization.getParentOrganization() != null) { if(organization.getParentOrganization() != null){
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());
} }
} }
} else { } else {
List<Organization> orgs = OrganizationLocalServiceUtil.getUserOrganizations(funzionarioId); List<Organization> orgs = OrganizationLocalServiceUtil.getUserOrganizations(funzionarioId);
for (Organization organization : orgs) { for (Organization organization : orgs) {
Role portosPO = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_po"); Role portosPO = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_po");
boolean isPO =
UserGroupRoleLocalServiceUtil.hasUserGroupRole(funzionarioId, organization.getGroupId(), boolean isPO = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
portosPO.getRoleId()); funzionarioId, organization.getGroupId(), portosPO.getRoleId());
if (isPO) {
if(isPO){
orgIds.add(organization.getOrganizationId()); orgIds.add(organization.getOrganizationId());
} }
} }
} }
} catch (PortalException e) { } catch (PortalException e) {
_log.error(e, e); _log.error(e,e);
} }
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH); Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray())); dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray()));
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId)); dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start)); dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate"); Order defaultOrder = OrderFactoryUtil.asc("startDate");
dynamicQuery.addOrder(defaultOrder); dynamicQuery.addOrder(defaultOrder);
return dynamicQuery(dynamicQuery, QueryUtil.ALL_POS, QueryUtil.ALL_POS).size();
List<Disponibilita> results = disponibilitaLocalService.dynamicQuery(dynamicQuery, -1, -1);
return results.size();
} }
private Date formatDateTime(String orario, Date day) throws ParseException { private Date formatDateTime(String orario, Date day) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
Date data = sdf.parse(orario); Date data = sdf.parse(orario);
Calendar calendar = GregorianCalendar.getInstance(); Calendar calendar = GregorianCalendar.getInstance();
calendar.setTime(data); calendar.setTime(data);
Date date = DateUtils.addHours(day, calendar.get(Calendar.HOUR_OF_DAY)); Date date = DateUtils.addHours(day, calendar.get(Calendar.HOUR_OF_DAY));
date = DateUtils.addMinutes(date, calendar.get(Calendar.MINUTE)); date = DateUtils.addMinutes(date, calendar.get(Calendar.MINUTE));
return date; return date;
} }
} }

136
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaServiceImpl.java

@ -1,9 +1,13 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software *
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in * This library is free software; you can redistribute it and/or modify it under the terms of the
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * GNU Lesser General Public License as published by the Free Software Foundation; either version
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/ */
package it.tref.portos.calendar.appointments.service.impl; package it.tref.portos.calendar.appointments.service.impl;
@ -11,6 +15,7 @@ package it.tref.portos.calendar.appointments.service.impl;
import it.tref.portos.calendar.appointments.model.Disponibilita; import it.tref.portos.calendar.appointments.model.Disponibilita;
import it.tref.portos.calendar.appointments.model.Funzionario; import it.tref.portos.calendar.appointments.model.Funzionario;
import it.tref.portos.calendar.appointments.model.Prenotazione; import it.tref.portos.calendar.appointments.model.Prenotazione;
import it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil;
import it.tref.portos.calendar.appointments.service.base.DisponibilitaServiceBaseImpl; import it.tref.portos.calendar.appointments.service.base.DisponibilitaServiceBaseImpl;
import java.text.ParseException; import java.text.ParseException;
@ -37,117 +42,157 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
/** /**
* The implementation of the disponibilita remote service. * The implementation of the disponibilita remote service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.tref.portos.calendar.appointments.service.DisponibilitaService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.tref.portos.calendar.appointments.service.DisponibilitaService} interface.
*
* <p> * <p>
* This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS * This is a remote service. Methods of this service are expected to have security checks based on
* credentials because this service can be accessed remotely. * the propagated JAAS credentials because this service can be accessed remotely.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see it.tref.portos.calendar.appointments.service.base.DisponibilitaServiceBaseImpl * @see it.tref.portos.calendar.appointments.service.base.DisponibilitaServiceBaseImpl
* @see it.tref.portos.calendar.appointments.service.DisponibilitaServiceUtil * @see it.tref.portos.calendar.appointments.service.DisponibilitaServiceUtil
*/ */
public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl { public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.tref.portos.calendar.appointments.service.DisponibilitaServiceUtil} to access the disponibilita remote *
* service. * Never reference this interface directly. Always use {@link
* it.tref.portos.calendar.appointments.service.DisponibilitaServiceUtil} to access the
* disponibilita remote service.
*/ */
private static Log _log = LogFactoryUtil.getLog(DisponibilitaServiceImpl.class); private static Log _log = LogFactoryUtil.getLog(DisponibilitaServiceImpl.class);
@Override
public Disponibilita addDisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio, public Disponibilita addDisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio,
ServiceContext serviceContext) throws SystemException, PortalException { ServiceContext serviceContext) throws SystemException, PortalException {
return disponibilitaLocalService.addDisponibilita(userId, funzionarioId, startDate, endDate, presidio, serviceContext);
return disponibilitaLocalService.addDisponibilita(userId, funzionarioId, startDate, endDate, presidio,
serviceContext);
} }
@Override
public List<Disponibilita> addDisponibilitaGenerale(long presidio, long userId, Date dataInizioDisponibilita, public List<Disponibilita> addDisponibilitaGenerale(long presidio, long userId, Date dataInizioDisponibilita,
Date dataFineDisponibilita, String giornoSettimana, String oraInizioDisponibilita, Date dataFineDisponibilita, String giornoSettimana, String oraInizioDisponibilita, String oraFineDisponibilita,
String oraFineDisponibilita, ServiceContext serviceContext) throws SystemException, PortalException { ServiceContext serviceContext) throws SystemException, PortalException {
// ciclo su tutti i funzionari e chiamo il service su ogniuno di essi // ciclo su tutti i funzionari e chiamo il service su ogniuno di essi
List<Funzionario> funzionari = new ArrayList<Funzionario>(); List<Funzionario> funzionari = new ArrayList<Funzionario>();
// List<Funzionario> funzionari = funzionarioLocalService.findByPresidio(presidio); // List<Funzionario> funzionari = funzionarioLocalService.findByPresidio(presidio);
List<Disponibilita> listDisponibilita = new ArrayList<>(funzionari.size()); List<Disponibilita> listDisponibilita = new ArrayList<>(funzionari.size());
long funzionarioId; long funzionarioId;
for (Funzionario funzionario : funzionari) { for (Funzionario funzionario : funzionari) {
funzionarioId = funzionario.getFunzionarioId(); funzionarioId = funzionario.getFunzionarioId();
listDisponibilita.add(disponibilitaLocalService.addDisponibilita(userId, funzionarioId, listDisponibilita.add(disponibilitaLocalService.addDisponibilita(userId, funzionarioId, dataInizioDisponibilita,
dataInizioDisponibilita, dataFineDisponibilita, presidio, serviceContext)); dataFineDisponibilita, presidio, serviceContext));
} }
return listDisponibilita; return listDisponibilita;
} }
@Override public String verifyDisponibilitaByDateHour(String presidio, String date,String[] oreInizio, String idFunzionario) throws SystemException, ParseException {
public String verifyDisponibilitaByDateHour(String presidio, String date, String[] oreInizio, String idFunzionario)
throws SystemException, ParseException {
JSONObject json = JSONFactoryUtil.createJSONObject(); JSONObject json = JSONFactoryUtil.createJSONObject();
JSONArray array = JSONFactoryUtil.createJSONArray(); JSONArray array = JSONFactoryUtil.createJSONArray();
Organization org = OrganizationLocalServiceUtil.fetchOrganization(Long.parseLong(presidio)); Organization org = OrganizationLocalServiceUtil.fetchOrganization(Long.parseLong(presidio));
SimpleDateFormat sfd = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sfd = new SimpleDateFormat("dd/MM/yyyy");
Date dateVerifyTemp = sfd.parse(date); Date dateVerifyTemp = sfd.parse(date);
for (int i = 0; i < oreInizio.length; i++) { for (int i = 0; i < oreInizio.length; i++) {
JSONObject jsonFiglio = JSONFactoryUtil.createJSONObject(); JSONObject jsonFiglio = JSONFactoryUtil.createJSONObject();
String oraInizio = oreInizio[i]; String oraInizio = oreInizio[i];
jsonFiglio.put("ora", oraInizio); jsonFiglio.put("ora", oraInizio);
Date dateVerify = formatDateTime(oraInizio, dateVerifyTemp); Date dateVerify = formatDateTime(oraInizio, dateVerifyTemp);
List<Prenotazione> lista = prenotazioneLocalService.findByDateHourFunzionario(dateVerify,
Long.parseLong(idFunzionario), org.getGroupId());
jsonFiglio.put("disponibile", lista.isEmpty()); List<Prenotazione> lista =
PrenotazioneLocalServiceUtil.findByDateHourFunzionario(
dateVerify, Long.parseLong(idFunzionario), org.getGroupId());
if(lista.isEmpty()){
jsonFiglio.put("disponibile", true);
} else {
jsonFiglio.put("disponibile", false);
}
array.put(jsonFiglio); array.put(jsonFiglio);
} }
json.put("slot", array);
json.put("slot",array);
return json.toString(); return json.toString();
} }
@Override
public String getDisponibilitaByDate(String presidio, String date) throws SystemException, ParseException { public String getDisponibilitaByDate(String presidio, String date) throws SystemException, ParseException {
// TODO permessi // TODO permessi
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio)); Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio));
List<User> userDefinitivo = new ArrayList<User>(); List<User> userDefinitivo = new ArrayList<User>();
try { try {
if (organization != null) {
List<User> users = userLocalService.getOrganizationUsers(Long.valueOf(presidio)); if(organization != null){
List<User> users = UserLocalServiceUtil.getOrganizationUsers(Long.valueOf(presidio));
for (User user : users) { for (User user : users) {
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto"); Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
"portos_calendario"); Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){
organization.getGroupId(), portosIstruttore.getRoleId());
if (isIstruttore) { boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
if(isIstruttore){
userDefinitivo.add(user); userDefinitivo.add(user);
} }
} }
} }
} }
} catch (NumberFormatException | PortalException | SystemException e) {
_log.error(e, e); } catch (NumberFormatException | SystemException e) {
_log.error(e,e);
} catch (PortalException e) {
_log.error(e,e);
} }
Date startDate = new SimpleDateFormat("dd/MM/yyyy").parse(date); Date startDate = new SimpleDateFormat("dd/MM/yyyy").parse(date);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
JSONArray json = JSONFactoryUtil.createJSONArray(); JSONArray json = JSONFactoryUtil.createJSONArray();
for (User funzionario : userDefinitivo) { for (User funzionario : userDefinitivo) {
List<Disponibilita> disponibilitaByFunzionario = disponibilitaLocalService
.findByFunzionarioStartAndPresidio(funzionario.getUserId(), startDate, organization.getGroupId()); List<Disponibilita> disponibilitaByFunzionario =
disponibilitaLocalService.findByFunzionarioStartAndPresidio(funzionario.getUserId(), startDate, organization.getGroupId());
if (disponibilitaByFunzionario.isEmpty()) { if (disponibilitaByFunzionario.isEmpty()) {
continue; continue;
} }
JSONObject jsonDisponibilita = JSONFactoryUtil.createJSONObject(); JSONObject jsonDisponibilita = JSONFactoryUtil.createJSONObject();
jsonDisponibilita.put("idFunzionario", funzionario.getUserId()); jsonDisponibilita.put("idFunzionario", funzionario.getUserId());
JSONArray jsonOre = JSONFactoryUtil.createJSONArray(); JSONArray jsonOre = JSONFactoryUtil.createJSONArray();
for (Disponibilita d : disponibilitaByFunzionario) { for (Disponibilita d : disponibilitaByFunzionario) {
JSONObject jsonSlot = JSONFactoryUtil.createJSONObject(); JSONObject jsonSlot = JSONFactoryUtil.createJSONObject();
jsonSlot.put("inizio", sdf.format(d.getStartDate())); jsonSlot.put("inizio", sdf.format(d.getStartDate()));
jsonSlot.put("fine", sdf.format(d.getEndDate())); jsonSlot.put("fine", sdf.format(d.getEndDate()));
@ -156,18 +201,21 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
} }
jsonDisponibilita.put("ore", jsonOre); jsonDisponibilita.put("ore", jsonOre);
json.put(jsonDisponibilita); json.put(jsonDisponibilita);
} }
return json.toString(); return json.toString();
} }
private Date formatDateTime(String orario, Date day) throws ParseException { private Date formatDateTime(String orario, Date day) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
Date data = sdf.parse(orario); Date data = sdf.parse(orario);
Calendar calendar = GregorianCalendar.getInstance(); Calendar calendar = GregorianCalendar.getInstance();
calendar.setTime(data); calendar.setTime(data);
Date date = DateUtils.addHours(day, calendar.get(Calendar.HOUR_OF_DAY)); Date date = DateUtils.addHours(day, calendar.get(Calendar.HOUR_OF_DAY));
date = DateUtils.addMinutes(date, calendar.get(Calendar.MINUTE)); date = DateUtils.addMinutes(date, calendar.get(Calendar.MINUTE));
return date; return date;
} }
} }

133
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioLocalServiceImpl.java

@ -1,83 +1,94 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software *
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in * This library is free software; you can redistribute it and/or modify it under the terms of the
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * GNU Lesser General Public License as published by the Free Software Foundation; either version
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/ */
package it.tref.portos.calendar.appointments.service.impl; package it.tref.portos.calendar.appointments.service.impl;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.User;
import com.liferay.portal.service.ServiceContext;
import it.tref.portos.calendar.appointments.model.Funzionario; import it.tref.portos.calendar.appointments.model.Funzionario;
import it.tref.portos.calendar.appointments.service.base.FunzionarioLocalServiceBaseImpl; import it.tref.portos.calendar.appointments.service.base.FunzionarioLocalServiceBaseImpl;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.User;
import com.liferay.portal.service.ServiceContext;
/** /**
* The implementation of the funzionario local service. * The implementation of the funzionario local service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.tref.portos.calendar.appointments.service.FunzionarioLocalService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.tref.portos.calendar.appointments.service.FunzionarioLocalService} interface.
*
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * This is a local service. Methods of this service will not have security checks based on the
* credentials because this service can only be accessed from within the same VM. * propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see it.tref.portos.calendar.appointments.service.base.FunzionarioLocalServiceBaseImpl * @see it.tref.portos.calendar.appointments.service.base.FunzionarioLocalServiceBaseImpl
* @see it.tref.portos.calendar.appointments.service.FunzionarioLocalServiceUtil * @see it.tref.portos.calendar.appointments.service.FunzionarioLocalServiceUtil
*/ */
public class FunzionarioLocalServiceImpl extends FunzionarioLocalServiceBaseImpl { public class FunzionarioLocalServiceImpl extends FunzionarioLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.tref.portos.calendar.appointments.service.FunzionarioLocalServiceUtil} to access the funzionario local *
* service. * Never reference this interface directly. Always use {@link
*/ * it.tref.portos.calendar.appointments.service.FunzionarioLocalServiceUtil} to access the
* funzionario local service.
@Override */
public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia,
ServiceContext serviceContext) throws PortalException, SystemException { public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia,
ServiceContext serviceContext) throws PortalException, SystemException {
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date(); User user = userPersistence.findByPrimaryKey(userId);
Funzionario funzionario = funzionarioPersistence.create(counterLocalService.increment(Funzionario.class
.getName())); Date now = new Date();
funzionario.setCompanyId(serviceContext.getCompanyId());
funzionario.setUserId(user.getUserId()); Funzionario funzionario = funzionarioPersistence.create(counterLocalService.increment(Funzionario.class.getName()));
funzionario.setUserName(user.getFullName());
funzionario.setCreateDate(serviceContext.getCreateDate(now)); funzionario.setCompanyId(serviceContext.getCompanyId());
funzionario.setModifiedDate(serviceContext.getModifiedDate(now)); funzionario.setUserId(user.getUserId());
funzionario.setGroupId(serviceContext.getScopeGroupId()); funzionario.setUserName(user.getFullName());
funzionario.setNome(nome); funzionario.setCreateDate(serviceContext.getCreateDate(now));
funzionario.setCognome(cognome); funzionario.setModifiedDate(serviceContext.getModifiedDate(now));
funzionario.setPresidio(presidio); funzionario.setGroupId(serviceContext.getScopeGroupId());
funzionario.setTipologia(tipologia);
funzionario = funzionarioPersistence.update(funzionario); funzionario.setNome(nome);
return funzionario; funzionario.setCognome(cognome);
} funzionario.setPresidio(presidio);
funzionario.setTipologia(tipologia);
@Override
public Funzionario deleteFunzionario(Funzionario funzionario) throws SystemException { funzionario = funzionarioPersistence.update(funzionario);
return super.deleteFunzionario(funzionario); return funzionario;
} }
@Override @Override
public Funzionario deleteFunzionario(long funzionarioId) throws PortalException, SystemException { public Funzionario deleteFunzionario(Funzionario funzionario) throws SystemException {
Funzionario funzionario = funzionarioPersistence.findByPrimaryKey(funzionarioId); return super.deleteFunzionario(funzionario);
return this.deleteFunzionario(funzionario); }
}
@Override
@Override public Funzionario deleteFunzionario(long funzionarioId) throws PortalException, SystemException {
public List<Funzionario> findByPresidio(String presidio) throws SystemException { Funzionario funzionario = funzionarioPersistence.findByPrimaryKey(funzionarioId);
return this.deleteFunzionario(funzionario);
return funzionarioPersistence.findByPresidio(presidio); }
}
public List<Funzionario> findByPresidio(String presidio) throws SystemException {
return funzionarioPersistence.findByPresidio(presidio);
}
} }

172
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioServiceImpl.java

@ -1,14 +1,17 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software *
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in * This library is free software; you can redistribute it and/or modify it under the terms of the
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * GNU Lesser General Public License as published by the Free Software Foundation; either version
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/ */
package it.tref.portos.calendar.appointments.service.impl; package it.tref.portos.calendar.appointments.service.impl;
import it.tref.liferay.portos.bo.shared.util.Constants;
import it.tref.portos.calendar.appointments.model.Funzionario; import it.tref.portos.calendar.appointments.model.Funzionario;
import it.tref.portos.calendar.appointments.service.base.FunzionarioServiceBaseImpl; import it.tref.portos.calendar.appointments.service.base.FunzionarioServiceBaseImpl;
@ -23,7 +26,6 @@ import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Organization; import com.liferay.portal.model.Organization;
import com.liferay.portal.model.Role; import com.liferay.portal.model.Role;
@ -32,94 +34,126 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
import it.tref.liferay.portos.bo.shared.util.Constants;
/** /**
* The implementation of the funzionario remote service. * The implementation of the funzionario remote service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.tref.portos.calendar.appointments.service.FunzionarioService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.tref.portos.calendar.appointments.service.FunzionarioService} interface.
*
* <p> * <p>
* This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS * This is a remote service. Methods of this service are expected to have security checks based on
* credentials because this service can be accessed remotely. * the propagated JAAS credentials because this service can be accessed remotely.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see it.tref.portos.calendar.appointments.service.base.FunzionarioServiceBaseImpl * @see it.tref.portos.calendar.appointments.service.base.FunzionarioServiceBaseImpl
* @see it.tref.portos.calendar.appointments.service.FunzionarioServiceUtil * @see it.tref.portos.calendar.appointments.service.FunzionarioServiceUtil
*/ */
public class FunzionarioServiceImpl extends FunzionarioServiceBaseImpl { public class FunzionarioServiceImpl extends FunzionarioServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.tref.portos.calendar.appointments.service.FunzionarioServiceUtil} to access the funzionario remote service. *
*/ * Never reference this interface directly. Always use {@link
* it.tref.portos.calendar.appointments.service.FunzionarioServiceUtil} to access the funzionario
* remote service.
*/
private static Log _log = LogFactoryUtil.getLog(FunzionarioServiceImpl.class); private static Log _log = LogFactoryUtil.getLog(FunzionarioServiceImpl.class);
@Override public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia,
public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia, ServiceContext serviceContext) throws PortalException, SystemException {
ServiceContext serviceContext) throws PortalException, SystemException {
return funzionarioLocalService.addFunzionario(userId, nome, cognome, presidio, tipologia, serviceContext); return funzionarioLocalService.addFunzionario(userId, nome, cognome, presidio, tipologia, serviceContext);
} }
public String getFunzionariByPresidio(String presidio) {
JSONArray json = JSONFactoryUtil.createJSONArray();
try {
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio));
if(organization != null){
List<User> users = UserLocalServiceUtil.getOrganizationUsers(Long.valueOf(presidio));
//Bug 32935
Collections.sort(users, new UserComparator());
for (User user : users) {
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
Role portosGeologo = RoleLocalServiceUtil.getRole(organization.getCompanyId(), Constants.ROLE_NAME_GEOLOGO);
Role portosCalendario = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
@Override Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), Constants.ROLE_NAME_ISTRUTTORE);
public String getFunzionariByPresidio(String presidio) {
if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){
JSONArray json = JSONFactoryUtil.createJSONArray();
try { boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio)); user.getUserId(), organization.getGroupId(), portosCalendario.getRoleId());
if (organization != null) {
List<User> users = userLocalService.getOrganizationUsers(Long.valueOf(presidio)); boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
Collections.sort(users, new UserComparator()); user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
for (User user : users) {
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto"); boolean isGeologo = UserLocalServiceUtil.hasRoleUser(portosGeologo.getRoleId(), user.getUserId());
Role portosGeologo = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
Constants.ROLE_NAME_GEOLOGO);
Role portosCalendario = RoleLocalServiceUtil.getRole(organization.getCompanyId(), if(isCalendario){
"portos_calendario"); JSONObject jsonFunzionario = JSONFactoryUtil.createJSONObject();
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), jsonFunzionario.put("id", user.getUserId());
Constants.ROLE_NAME_ISTRUTTORE); jsonFunzionario.put("nome", user.getFirstName());
if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) { jsonFunzionario.put("cognome", user.getLastName());
boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
organization.getGroupId(), portosCalendario.getRoleId()); if(isIstruttore){
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), jsonFunzionario.put("tipologia", "Istruttore");
organization.getGroupId(), portosIstruttore.getRoleId()); } else if(isGeologo){
boolean isGeologo = userLocalService.hasRoleUser(portosGeologo.getRoleId(), jsonFunzionario.put("tipologia", "Geologo");
user.getUserId()); } else {
if (isCalendario) { jsonFunzionario.put("tipologia", "");
JSONObject jsonFunzionario = JSONFactoryUtil.createJSONObject();
jsonFunzionario.put("id", user.getUserId());
jsonFunzionario.put("nome", user.getFirstName());
jsonFunzionario.put("cognome", user.getLastName());
if (isIstruttore) {
jsonFunzionario.put("tipologia", "Istruttore");
} else if (isGeologo) {
jsonFunzionario.put("tipologia", "Geologo");
} else {
jsonFunzionario.put("tipologia", StringPool.BLANK);
}
json.put(jsonFunzionario);
} }
json.put(jsonFunzionario);
} }
} }
} }
} catch (NumberFormatException | PortalException | SystemException e) {
_log.error(e, e);
} }
return json.toString();
} catch (NumberFormatException | SystemException e) {
_log.error(e,e);
} catch (PortalException e) {
_log.error(e,e);
} }
}
class UserComparator implements Comparator<User> { return json.toString();
}
@Override }
//Bug 32935
class UserComparator implements Comparator<User>{
@Override
public int compare(User o1, User o2) { public int compare(User o1, User o2) {
int compareLastName = 0;
if(Validator.isNotNull(o1.getLastName()) && Validator.isNotNull(o2.getLastName()))
compareLastName = o1.getLastName().compareToIgnoreCase(o2.getLastName());
if(compareLastName == 0 && Validator.isNotNull(o1.getFirstName()) && Validator.isNotNull(o2.getFirstName()))
compareLastName = o1.getFirstName().compareToIgnoreCase(o2.getFirstName());
int compareLastName = 0;
if (Validator.isNotNull(o1.getLastName()) && Validator.isNotNull(o2.getLastName()))
compareLastName = o1.getLastName().compareToIgnoreCase(o2.getLastName());
if (compareLastName == 0 && Validator.isNotNull(o1.getFirstName()) && Validator.isNotNull(o2.getFirstName()))
compareLastName = o1.getFirstName().compareToIgnoreCase(o2.getFirstName());
return compareLastName; return compareLastName;
} }
} }

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

@ -1,9 +1,13 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software *
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in * This library is free software; you can redistribute it and/or modify it under the terms of the
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * GNU Lesser General Public License as published by the Free Software Foundation; either version
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/ */
package it.tref.portos.calendar.appointments.service.impl; package it.tref.portos.calendar.appointments.service.impl;
@ -33,170 +37,196 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
/** /**
* The implementation of the prenotazione local service. * The implementation of the prenotazione local service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.tref.portos.calendar.appointments.service.PrenotazioneLocalService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.tref.portos.calendar.appointments.service.PrenotazioneLocalService} interface.
*
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * This is a local service. Methods of this service will not have security checks based on the
* credentials because this service can only be accessed from within the same VM. * propagated JAAS credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see it.tref.portos.calendar.appointments.service.base.PrenotazioneLocalServiceBaseImpl * @see it.tref.portos.calendar.appointments.service.base.PrenotazioneLocalServiceBaseImpl
* @see it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil * @see it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil
*/ */
public class PrenotazioneLocalServiceImpl extends PrenotazioneLocalServiceBaseImpl { public class PrenotazioneLocalServiceImpl extends PrenotazioneLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil} to access the prenotazione local *
* service. * Never reference this interface directly. Always use {@link
*/ * it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil} to access the
* prenotazione local service.
@Override */
public Prenotazione addPrenotazione(long userId, long funzionarioId, long professionistaId, Date startDate,
Date endDate, String descrizione, String telefono, String email, long presidio,
ServiceContext serviceContext) throws SystemException, PortalException {
Prenotazione prenotazione =
prenotazionePersistence.create(counterLocalService.increment(Prenotazione.class.getName()));
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
prenotazione.setCompanyId(serviceContext.getCompanyId());
prenotazione.setUserId(user.getUserId());
prenotazione.setUserName(user.getFullName());
prenotazione.setCreateDate(serviceContext.getCreateDate(now));
prenotazione.setModifiedDate(serviceContext.getModifiedDate(now));
prenotazione.setGroupId(presidio);
prenotazione.setFunzionarioId(funzionarioId);
prenotazione.setProfessionistaId(professionistaId);
prenotazione.setStartDate(startDate);
prenotazione.setEndDate(endDate);
prenotazione.setDescLong(descrizione);
prenotazione.setTelefono(telefono);
prenotazione.setEmail(email);
prenotazione = updatePrenotazione(prenotazione);
return prenotazione;
}
@Override //Product Backlog Item 32934
public Prenotazione updatePrenotazione(long prenotazioneId, Date startDate, Date endDate, String descrizione, public Prenotazione addPrenotazione(long userId, long funzionarioId, long professionistaId, Date startDate,
ServiceContext serviceContext) throws SystemException, PortalException { Date endDate, String descrizione, String telefono, String email, long presidio, ServiceContext serviceContext) throws SystemException, PortalException {
Prenotazione prenotazione = prenotazionePersistence.findByPrimaryKey(prenotazioneId);
Date now = new Date();
prenotazione.setModifiedDate(serviceContext.getModifiedDate(now));
prenotazione.setStartDate(startDate);
prenotazione.setEndDate(endDate);
prenotazione.setDescLong(descrizione);
prenotazione = updatePrenotazione(prenotazione);
return prenotazione;
}
@Override Prenotazione prenotazione =
public Prenotazione deletePrenotazione(Prenotazione prenotazione) throws SystemException { prenotazionePersistence.create(counterLocalService.increment(Prenotazione.class.getName()));
return super.deletePrenotazione(prenotazione); User user = userPersistence.findByPrimaryKey(userId);
}
@Override Date now = new Date();
public Prenotazione deletePrenotazione(long prenotazioneId) throws PortalException, SystemException {
Prenotazione prenotazione = prenotazionePersistence.findByPrimaryKey(prenotazioneId); prenotazione.setCompanyId(serviceContext.getCompanyId());
return this.deletePrenotazione(prenotazione); prenotazione.setUserId(user.getUserId());
} prenotazione.setUserName(user.getFullName());
prenotazione.setCreateDate(serviceContext.getCreateDate(now));
prenotazione.setModifiedDate(serviceContext.getModifiedDate(now));
prenotazione.setGroupId(presidio);
@SuppressWarnings("unchecked") prenotazione.setFunzionarioId(funzionarioId);
@Override prenotazione.setProfessionistaId(professionistaId);
public List<Prenotazione> findByStartDate(Date date) throws SystemException { prenotazione.setStartDate(startDate);
prenotazione.setEndDate(endDate);
prenotazione.setDescLong(descrizione);
Date start = DateUtils.truncate(date, java.util.Calendar.DAY_OF_MONTH); //Product Backlog Item 32934
Date end = DateUtils.addDays(start, 1); prenotazione.setTelefono(telefono);
DynamicQuery dynamicQuery = dynamicQuery(); prenotazione.setEmail(email);
dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", start, end));
dynamicQuery.addOrder(OrderFactoryUtil.desc("funzionarioId"));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
}
@SuppressWarnings("unchecked") prenotazione = prenotazioneLocalService.updatePrenotazione(prenotazione);
@Override
public List<Prenotazione> findByDateHourFunzionario(Date date, long funzionarioId, long groupId)
throws SystemException {
DynamicQuery dynamicQuery = dynamicQuery(); return prenotazione;
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId)); }
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", date));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", groupId));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
}
@Override public Prenotazione updatePrenotazione(long prenotazioneId, Date startDate, Date endDate, String descrizione,
public int getAvailableSlotByStartDate_EndDate(long funzionarioId, Date startDate, Date endDate) ServiceContext serviceContext) throws SystemException, PortalException {
throws SystemException {
Prenotazione prenotazione = prenotazionePersistence.findByPrimaryKey(prenotazioneId);
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId)); Date now = new Date();
Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
Conjunction conjunctionStart = RestrictionsFactoryUtil.conjunction(); prenotazione.setModifiedDate(serviceContext.getModifiedDate(now));
conjunctionStart.add(RestrictionsFactoryUtil.ge("startDate", startDate));
conjunctionStart.add(RestrictionsFactoryUtil.lt("startDate", endDate)); prenotazione.setStartDate(startDate);
disjunction.add(conjunctionStart); prenotazione.setEndDate(endDate);
Conjunction conjunctionEnd = RestrictionsFactoryUtil.conjunction(); prenotazione.setDescLong(descrizione);
conjunctionEnd.add(RestrictionsFactoryUtil.gt("endDate", startDate));
conjunctionEnd.add(RestrictionsFactoryUtil.le("endDate", endDate)); prenotazione = prenotazioneLocalService.updatePrenotazione(prenotazione);
disjunction.add(conjunctionEnd);
dynamicQuery.add(disjunction); return prenotazione;
return (int) prenotazionePersistence.countWithDynamicQuery(dynamicQuery); }
}
@Override
public Prenotazione deletePrenotazione(Prenotazione prenotazione) throws SystemException {
return super.deletePrenotazione(prenotazione);
}
@Override
public Prenotazione deletePrenotazione(long prenotazioneId) throws PortalException, SystemException {
Prenotazione prenotazione = prenotazionePersistence.findByPrimaryKey(prenotazioneId);
return this.deletePrenotazione(prenotazione);
}
public List<Prenotazione> findByStartDate(Date date) throws SystemException {
Date start = DateUtils.truncate(date, java.util.Calendar.DAY_OF_MONTH);
Date end = DateUtils.addDays(start, 1);
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", start, end));
dynamicQuery.addOrder(OrderFactoryUtil.desc("funzionarioId"));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
}
public List<Prenotazione> findByDateHourFunzionario(Date date, long funzionarioId, long groupId) throws SystemException {
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", date));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", groupId));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
@SuppressWarnings("unchecked")
@Override
public List<Prenotazione> findByFunzionario_StartDate(long funzionarioId, Date date, long groupId)
throws SystemException {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
Date end = DateUtils.addHours(start, 22);
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", groupId));
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
} }
@Override public int getAvailableSlotByStartDate_EndDate(long funzionarioId, Date startDate, Date endDate)
public int countPrenotazioniPresidioPeriodo(long presidioId, String fromString, String toString) throws SystemException {
throws SystemException, PortalException, ParseException {
DynamicQuery dynamicQuery = dynamicQuery();
int count = 0; dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
Date from = sdf.parse(fromString); Conjunction conjunctionStart = RestrictionsFactoryUtil.conjunction();
Date to = sdf.parse(toString); conjunctionStart.add(RestrictionsFactoryUtil.ge("startDate", startDate));
Calendar fromCal = Calendar.getInstance(); conjunctionStart.add(RestrictionsFactoryUtil.lt("startDate", endDate));
fromCal.setTime(from); disjunction.add(conjunctionStart);
fromCal.set(Calendar.HOUR_OF_DAY, 2); Conjunction conjunctionEnd = RestrictionsFactoryUtil.conjunction();
Calendar toCal = Calendar.getInstance(); conjunctionEnd.add(RestrictionsFactoryUtil.gt("endDate", startDate));
toCal.setTime(to); conjunctionEnd.add(RestrictionsFactoryUtil.le("endDate", endDate));
toCal.set(Calendar.HOUR_OF_DAY, 22); disjunction.add(conjunctionEnd);
Organization org = OrganizationLocalServiceUtil.fetchOrganization(presidioId); dynamicQuery.add(disjunction);
Role portosCalendario = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_calendario"); return (int) prenotazionePersistence.countWithDynamicQuery(dynamicQuery);
if (org != null) {
List<User> users = userLocalService.getOrganizationUsers(presidioId); }
for (User user : users) {
boolean isCalendario = public List<Prenotazione> findByFunzionario_StartDate(long funzionarioId, Date date, long groupId) throws SystemException {
UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), org.getGroupId(), Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
portosCalendario.getRoleId()); Date end = DateUtils.addHours(start, 22);
if (isCalendario) {
DynamicQuery dynamicQuery = dynamicQuery(); DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", groupId));
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end));
return prenotazionePersistence.findWithDynamicQuery(dynamicQuery);
}
public int countPrenotazioniPresidioPeriodo(long presidioId, String fromString, String toString) throws SystemException, PortalException, ParseException{
int count = 0;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date from = sdf.parse(fromString);
Date to = sdf.parse(toString);
Calendar fromCal = Calendar.getInstance();
fromCal.setTime(from);
fromCal.set(Calendar.HOUR_OF_DAY, 2);
Calendar toCal = Calendar.getInstance();
toCal.setTime(to);
toCal.set(Calendar.HOUR_OF_DAY, 22);
Organization org = OrganizationLocalServiceUtil.fetchOrganization(presidioId);
Role portosCalendario = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_calendario");
if (org != null) {
List<User> users = UserLocalServiceUtil.getOrganizationUsers(presidioId);
for (User user : users) {
boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
user.getUserId(), org.getGroupId(), portosCalendario.getRoleId());
if(isCalendario){
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId())); dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId()));
dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", fromCal.getTime(), toCal.getTime())); dynamicQuery.add(RestrictionsFactoryUtil.between("startDate", fromCal.getTime(), toCal.getTime()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", org.getGroupId())); dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", org.getGroupId()));
count = count + ((int) prenotazionePersistence.countWithDynamicQuery(dynamicQuery));
} count = count + ((int) prenotazionePersistence.countWithDynamicQuery(dynamicQuery));
}
} }
} }
return count;
} return count;
}
} }

140
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/PrenotazioneServiceImpl.java

@ -1,15 +1,20 @@
/** /**
* ù * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute ù * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* 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 * This library is free software; you can redistribute it and/or modify it under the terms of the
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * GNU Lesser General Public License as published by the Free Software Foundation; either version
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/ */
package it.tref.portos.calendar.appointments.service.impl; package it.tref.portos.calendar.appointments.service.impl;
import it.tref.portos.calendar.appointments.SlotNotAvailableException; import it.tref.portos.calendar.appointments.SlotNotAvailableException;
import it.tref.portos.calendar.appointments.model.Prenotazione; import it.tref.portos.calendar.appointments.model.Prenotazione;
import it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil;
import it.tref.portos.calendar.appointments.service.base.PrenotazioneServiceBaseImpl; import it.tref.portos.calendar.appointments.service.base.PrenotazioneServiceBaseImpl;
import java.text.ParseException; import java.text.ParseException;
@ -34,139 +39,190 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
/** /**
* The implementation of the prenotazione remote service. * The implementation of the prenotazione remote service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun
* their definitions into the {@link it.tref.portos.calendar.appointments.service.PrenotazioneService} interface. * ServiceBuilder to copy their definitions into the
* {@link it.tref.portos.calendar.appointments.service.PrenotazioneService} interface.
*
* <p> * <p>
* This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS * This is a remote service. Methods of this service are expected to have security checks based on
* credentials because this service can be accessed remotely. * the propagated JAAS credentials because this service can be accessed remotely.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see it.tref.portos.calendar.appointments.service.base.PrenotazioneServiceBaseImpl * @see it.tref.portos.calendar.appointments.service.base.PrenotazioneServiceBaseImpl
* @see it.tref.portos.calendar.appointments.service.PrenotazioneServiceUtil * @see it.tref.portos.calendar.appointments.service.PrenotazioneServiceUtil
*/ */
public class PrenotazioneServiceImpl extends PrenotazioneServiceBaseImpl { public class PrenotazioneServiceImpl extends PrenotazioneServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.tref.portos.calendar.appointments.service.PrenotazioneServiceUtil} to access the prenotazione remote service. *
* Never reference this interface directly. Always use {@link
* it.tref.portos.calendar.appointments.service.PrenotazioneServiceUtil} to access the
* prenotazione remote service.
*/ */
private static Log _log = LogFactoryUtil.getLog(PrenotazioneServiceImpl.class); private static Log _log = LogFactoryUtil.getLog(PrenotazioneServiceImpl.class);
@Override //Product Backlog Item 32934
public void addPrenotazione(long userId, long funzionarioId, long professionistaId, Date startDate, Date endDate, public void addPrenotazione(long userId, long funzionarioId, long professionistaId, Date startDate, Date endDate,
String descrizione, String telefono, String email, long presidio, ServiceContext serviceContext) String descrizione, String telefono, String email, long presidio, ServiceContext serviceContext) throws SystemException, PortalException {
throws SystemException, PortalException {
if (!isSlotAvailable(funzionarioId, startDate, endDate)) { if (!isSlotAvailable(funzionarioId, startDate, endDate)) {
throw new SlotNotAvailableException("slot not available"); throw new SlotNotAvailableException("slot not available");
} }
prenotazioneLocalService.addPrenotazione(userId, funzionarioId, professionistaId, startDate, endDate, //Product Backlog Item 32934
descrizione, telefono, email, presidio, serviceContext); prenotazioneLocalService.addPrenotazione(userId, funzionarioId, professionistaId, startDate, endDate, descrizione, telefono, email, presidio,
serviceContext);
} }
@Override
public void updatePrenotazione(long prenotazioneId, long userId, Date startDate, Date endDate, String descrizione, public void updatePrenotazione(long prenotazioneId, long userId, Date startDate, Date endDate, String descrizione,
ServiceContext serviceContext) throws SystemException, PortalException { ServiceContext serviceContext) throws SystemException, PortalException {
Prenotazione prenotazione = prenotazioneLocalService.fetchPrenotazione(prenotazioneId); Prenotazione prenotazione = PrenotazioneLocalServiceUtil.fetchPrenotazione(prenotazioneId);
if (prenotazione.getUserId() != userId) { if (prenotazione.getUserId() != userId) {
throw new SystemException("error.calendar.appointments.prenotazione.not.allowed.update " + prenotazioneId throw new SystemException("error.calendar.appointments.prenotazione.not.allowed.update " + prenotazioneId
+ " user " + userId); + " user " + userId);
} }
prenotazioneLocalService.updatePrenotazione(prenotazioneId, startDate, endDate, descrizione, serviceContext); prenotazioneLocalService.updatePrenotazione(prenotazioneId, startDate, endDate, descrizione, serviceContext);
} }
@Override
public void deletePrenotazione(long prenotazioneId, long userId) throws SystemException, PortalException { public void deletePrenotazione(long prenotazioneId, long userId) throws SystemException, PortalException {
Prenotazione prenotazione = PrenotazioneLocalServiceUtil.fetchPrenotazione(prenotazioneId);
//Product Backlog Item 32933
// if (prenotazione.getUserId() != userId) {
// throw new SystemException("error.calendar.appointments.prenotazione.not.allowed.update " + prenotazioneId
// + " user " + userId);
// }
prenotazioneLocalService.deletePrenotazione(prenotazioneId); prenotazioneLocalService.deletePrenotazione(prenotazioneId);
} }
@Override public String getPrenotazioniByDate(String presidio, String date, String userId) throws SystemException, ParseException {
public String getPrenotazioniByDate(String presidio, String date, String userId) throws SystemException,
ParseException {
long loggetUserId = Long.parseLong(userId); long loggetUserId = Long.parseLong(userId);
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio)); Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio));
List<User> userDefinitivo = new ArrayList<User>(); List<User> userDefinitivo = new ArrayList<User>();
try { try {
if (organization != null) {
List<User> users = userLocalService.getOrganizationUsers(Long.valueOf(presidio)); if(organization != null){
List<User> users = UserLocalServiceUtil.getOrganizationUsers(Long.valueOf(presidio));
for (User user : users) { for (User user : users) {
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto"); Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
"portos_calendario"); Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){
organization.getGroupId(), portosIstruttore.getRoleId());
if (isIstruttore) { boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
if(isIstruttore){
userDefinitivo.add(user); userDefinitivo.add(user);
} }
} }
} }
} }
} catch (NumberFormatException | PortalException | SystemException e) {
_log.error(e, e); } catch (NumberFormatException | SystemException e) {
_log.error(e,e);
} catch (PortalException e) {
_log.error(e,e);
} }
Date startDate = new SimpleDateFormat("dd/MM/yyyy").parse(date); Date startDate = new SimpleDateFormat("dd/MM/yyyy").parse(date);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
JSONArray json = JSONFactoryUtil.createJSONArray(); JSONArray json = JSONFactoryUtil.createJSONArray();
for (User funzionario : userDefinitivo) { for (User funzionario : userDefinitivo) {
List<Prenotazione> prenotazioniByFunzionario = prenotazioneLocalService.findByFunzionario_StartDate(
funzionario.getUserId(), startDate, organization.getGroupId()); List<Prenotazione> prenotazioniByFunzionario =
prenotazioneLocalService.findByFunzionario_StartDate(funzionario.getUserId(), startDate, organization.getGroupId());
if (prenotazioniByFunzionario.isEmpty()) { if (prenotazioniByFunzionario.isEmpty()) {
continue; continue;
} }
JSONObject jsonFunzionario = JSONFactoryUtil.createJSONObject(); JSONObject jsonFunzionario = JSONFactoryUtil.createJSONObject();
jsonFunzionario.put("idFunzionario", funzionario.getUserId()); jsonFunzionario.put("idFunzionario", funzionario.getUserId());
jsonFunzionario.put("nomeFunzionario", funzionario.getFullName()); jsonFunzionario.put("nomeFunzionario", funzionario.getFullName());
JSONArray jsonPrenotazioni = JSONFactoryUtil.createJSONArray(); JSONArray jsonPrenotazioni = JSONFactoryUtil.createJSONArray();
for (Prenotazione prenotazione : prenotazioniByFunzionario) { for (Prenotazione prenotazione : prenotazioniByFunzionario) {
JSONObject jsonPrenotazione = JSONFactoryUtil.createJSONObject(); JSONObject jsonPrenotazione = JSONFactoryUtil.createJSONObject();
jsonPrenotazione.put("idPrenotazione", prenotazione.getPrenotazioneId()); jsonPrenotazione.put("idPrenotazione", prenotazione.getPrenotazioneId());
jsonPrenotazione.put("inizio", sdf.format(prenotazione.getStartDate())); jsonPrenotazione.put("inizio", sdf.format(prenotazione.getStartDate()));
jsonPrenotazione.put("fine", sdf.format(prenotazione.getEndDate())); jsonPrenotazione.put("fine", sdf.format(prenotazione.getEndDate()));
User richiedente = userLocalService.fetchUser(prenotazione.getProfessionistaId());
if (loggetUserId == prenotazione.getProfessionistaId()) { User richiedente = UserLocalServiceUtil.fetchUser(prenotazione.getProfessionistaId());
if(loggetUserId == prenotazione.getProfessionistaId()){
jsonPrenotazione.put("visible", true); jsonPrenotazione.put("visible", true);
} else { } else {
jsonPrenotazione.put("visible", canSeeFullInformations(loggetUserId)); jsonPrenotazione.put("visible", canSeeFullInformations(loggetUserId));
} }
jsonPrenotazione.put("richiedente", richiedente.getFullName()); jsonPrenotazione.put("richiedente", richiedente.getFullName());
jsonPrenotazione.put("richiedenteId", prenotazione.getProfessionistaId()); jsonPrenotazione.put("richiedenteId", prenotazione.getProfessionistaId());
jsonPrenotazione.put("descrizione", prenotazione.getDescLong()); jsonPrenotazione.put("descrizione", prenotazione.getDescLong());
//Product Backlog Item 32934
jsonPrenotazione.put("telefono", prenotazione.getTelefono()); jsonPrenotazione.put("telefono", prenotazione.getTelefono());
jsonPrenotazione.put("email", prenotazione.getEmail()); jsonPrenotazione.put("email", prenotazione.getEmail());
jsonPrenotazioni.put(jsonPrenotazione); jsonPrenotazioni.put(jsonPrenotazione);
} }
jsonFunzionario.put("prenotazioni", jsonPrenotazioni); jsonFunzionario.put("prenotazioni", jsonPrenotazioni);
json.put(jsonFunzionario); json.put(jsonFunzionario);
} }
return json.toString(); return json.toString();
} }
private boolean canSeeFullInformations(long loggetUserId) throws SystemException { private boolean canSeeFullInformations(long loggetUserId) throws SystemException{
boolean canDo = false; boolean canDo = false;
User user = userLocalService.fetchUser(loggetUserId);
if (user != null) { User user = UserLocalServiceUtil.fetchUser(loggetUserId);
if(user != null){
Group siteBO = GroupLocalServiceUtil.fetchGroup(user.getCompanyId(), "Portos BackOffice"); Group siteBO = GroupLocalServiceUtil.fetchGroup(user.getCompanyId(), "Portos BackOffice");
boolean isBoUser = GroupLocalServiceUtil.hasUserGroup(user.getUserId(), siteBO.getGroupId()); boolean isBoUser = GroupLocalServiceUtil.hasUserGroup(user.getUserId(), siteBO.getGroupId());
if (isBoUser) {
if(isBoUser){
canDo = true; canDo = true;
} }
} }
return canDo; return canDo;
} }
@Override
public boolean isSlotAvailable(long funzionarioId, Date startDate, Date endDate) throws SystemException { public boolean isSlotAvailable(long funzionarioId, Date startDate, Date endDate) throws SystemException {
return prenotazioneLocalService.getAvailableSlotByStartDate_EndDate(funzionarioId, startDate, endDate) == 0; return prenotazioneLocalService.getAvailableSlotByStartDate_EndDate(funzionarioId, startDate, endDate) == 0;
} }
} }

35
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/ProfessionistaLocalServiceImpl.java

@ -1,9 +1,15 @@
/** /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software *
* Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in * This library is free software; you can redistribute it and/or modify it under
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * the terms of the GNU Lesser General Public License as published by the Free
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/ */
package it.tref.portos.calendar.appointments.service.impl; package it.tref.portos.calendar.appointments.service.impl;
@ -12,22 +18,23 @@ import it.tref.portos.calendar.appointments.service.base.ProfessionistaLocalServ
/** /**
* The implementation of the professionista local service. * The implementation of the professionista local service.
*
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.portos.calendar.appointments.service.ProfessionistaLocalService} interface.
* their definitions into the {@link it.tref.portos.calendar.appointments.service.ProfessionistaLocalService} interface. *
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the propagated JAAS * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
* credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author 3F Consulting + Manifattura Web Group s.r.l. * @author 3F Consulting
* @see it.tref.portos.calendar.appointments.service.base.ProfessionistaLocalServiceBaseImpl * @see it.tref.portos.calendar.appointments.service.base.ProfessionistaLocalServiceBaseImpl
* @see it.tref.portos.calendar.appointments.service.ProfessionistaLocalServiceUtil * @see it.tref.portos.calendar.appointments.service.ProfessionistaLocalServiceUtil
*/ */
public class ProfessionistaLocalServiceImpl extends ProfessionistaLocalServiceBaseImpl { public class ProfessionistaLocalServiceImpl
extends ProfessionistaLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link * NOTE FOR DEVELOPERS:
* it.tref.portos.calendar.appointments.service.ProfessionistaLocalServiceUtil} to access the professionista local *
* service. * Never reference this interface directly. Always use {@link it.tref.portos.calendar.appointments.service.ProfessionistaLocalServiceUtil} to access the professionista local service.
*/ */
} }

32
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/ProfessionistaServiceImpl.java

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

96
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/util/CalendarUtil.java

@ -5,6 +5,7 @@ import it.tref.portos.calendar.appointments.model.Prenotazione;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -13,6 +14,8 @@ import java.util.regex.Pattern;
import javax.mail.internet.AddressException; import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress; import javax.mail.internet.InternetAddress;
import org.apache.log4j.net.TelnetAppender;
import com.liferay.mail.service.MailServiceUtil; import com.liferay.mail.service.MailServiceUtil;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.mail.MailMessage; import com.liferay.portal.kernel.mail.MailMessage;
@ -24,42 +27,39 @@ import com.liferay.util.portlet.PortletProps;
public class CalendarUtil { public class CalendarUtil {
public static void inviaEmailRichiestaAppuntamento(long userIdProfessionista, long userIdFunzionario, public static void inviaEmailRichiestaAppuntamento(long userIdProfessionista, long userIdFunzionario, Date startDate, String telefono, String emailFeUser) throws SystemException, AddressException{
Date startDate, String telefono, String emailFeUser) throws SystemException, AddressException {
User professionista = UserLocalServiceUtil.fetchUser(userIdProfessionista); User professionista = UserLocalServiceUtil.fetchUser(userIdProfessionista);
User boUser = UserLocalServiceUtil.fetchUser(userIdFunzionario); User boUser = UserLocalServiceUtil.fetchUser(userIdFunzionario);
InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it"); InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it");
InternetAddress toAddress = isAllowedEmailAddress(professionista.getEmailAddress()) ? new InternetAddress( InternetAddress toAddress = isAllowedEmailAddress(professionista.getEmailAddress()) ? new InternetAddress(professionista.getEmailAddress()) : null;
professionista.getEmailAddress()) : null; InternetAddress bccAddress = isAllowedEmailAddress(boUser.getEmailAddress()) ? new InternetAddress(boUser.getEmailAddress()) : null;
InternetAddress bccAddress = isAllowedEmailAddress(boUser.getEmailAddress()) ? new InternetAddress( InternetAddress toAddressToFeUser = isAllowedEmailAddress(emailFeUser) ? new InternetAddress(emailFeUser) : null;
boUser.getEmailAddress()) : null;
InternetAddress toAddressToFeUser = isAllowedEmailAddress(emailFeUser) ? new InternetAddress(
emailFeUser) : null;
MailMessage mailMessage = new MailMessage(); MailMessage mailMessage = new MailMessage();
// Product Backlog Item 32934 //Product Backlog Item 32934
List<InternetAddress> toAddresses = new ArrayList<InternetAddress>(); List<InternetAddress> toAddresses = new ArrayList<InternetAddress>();
if (toAddress != null) if(toAddress != null)
toAddresses.add(toAddress); toAddresses.add(toAddress);
if (toAddressToFeUser != null) if(toAddressToFeUser != null)
toAddresses.add(toAddressToFeUser); toAddresses.add(toAddressToFeUser);
mailMessage.setTo(toAddresses.toArray(new InternetAddress[0])); mailMessage.setTo(toAddresses.toArray(new InternetAddress[0]));
mailMessage.setFrom(fromAddress); mailMessage.setFrom(fromAddress);
if (bccAddress != null) if(bccAddress != null)
mailMessage.setBCC(bccAddress); mailMessage.setBCC(bccAddress);
mailMessage.setSubject("Notifica Richiesta Appuntamento Portos"); mailMessage.setSubject("Notifica Richiesta Appuntamento Portos");
mailMessage.setBody(creaCorpoMailRichiestaAppuntamento(professionista, boUser, startDate, telefono, mailMessage.setBody(creaCorpoMailRichiestaAppuntamento(professionista, boUser, startDate, telefono, emailFeUser));
emailFeUser));
mailMessage.setHTMLFormat(true); mailMessage.setHTMLFormat(true);
/* /*
* Invio email * Invio email
*/ */
@ -67,35 +67,31 @@ public class CalendarUtil {
} }
public static void inviaEmailAnnullamentoAppuntamento(Prenotazione prenotazione) throws SystemException, public static void inviaEmailAnnullamentoAppuntamento(Prenotazione prenotazione) throws SystemException, AddressException{
AddressException {
User professionista = UserLocalServiceUtil.fetchUser(prenotazione.getProfessionistaId()); User professionista = UserLocalServiceUtil.fetchUser(prenotazione.getProfessionistaId());
User boUser = UserLocalServiceUtil.fetchUser(prenotazione.getFunzionarioId()); User boUser = UserLocalServiceUtil.fetchUser(prenotazione.getFunzionarioId());
InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it"); InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it");
InternetAddress toAddress = isAllowedEmailAddress(professionista.getEmailAddress()) ? new InternetAddress( InternetAddress toAddress = isAllowedEmailAddress(professionista.getEmailAddress()) ? new InternetAddress(professionista.getEmailAddress()) : null;
professionista.getEmailAddress()) : null; InternetAddress bccAddress = isAllowedEmailAddress(boUser.getEmailAddress()) ? new InternetAddress(boUser.getEmailAddress()) : null;
InternetAddress bccAddress = isAllowedEmailAddress(boUser.getEmailAddress()) ? new InternetAddress( InternetAddress toAddressToFeUser = isAllowedEmailAddress(prenotazione.getEmail()) ? new InternetAddress(prenotazione.getEmail()) : null;
boUser.getEmailAddress()) : null;
InternetAddress toAddressToFeUser = isAllowedEmailAddress(prenotazione.getEmail()) ? new InternetAddress(
prenotazione.getEmail()) : null;
MailMessage mailMessage = new MailMessage(); MailMessage mailMessage = new MailMessage();
// Product Backlog Item 32934 //Product Backlog Item 32934
List<InternetAddress> toAddresses = new ArrayList<InternetAddress>(); List<InternetAddress> toAddresses = new ArrayList<InternetAddress>();
if (toAddress != null) if(toAddress != null)
toAddresses.add(toAddress); toAddresses.add(toAddress);
if (toAddressToFeUser != null) if(toAddressToFeUser != null)
toAddresses.add(toAddressToFeUser); toAddresses.add(toAddressToFeUser);
mailMessage.setTo(toAddresses.toArray(new InternetAddress[0])); mailMessage.setTo(toAddresses.toArray(new InternetAddress[0]));
mailMessage.setFrom(fromAddress); mailMessage.setFrom(fromAddress);
if (bccAddress != null) if(bccAddress != null)
mailMessage.setBCC(bccAddress); mailMessage.setBCC(bccAddress);
mailMessage.setSubject("Notifica Annullamento Appuntamento Portos"); mailMessage.setSubject("Notifica Annullamento Appuntamento Portos");
@ -109,18 +105,17 @@ public class CalendarUtil {
} }
public static void inviaEmailReminderAppuntamenti(List<Prenotazione> lista, User userBo, Date tomorrow)
throws SystemException, AddressException {
InternetAddress toAddress = isAllowedEmailAddress(userBo.getEmailAddress()) ? new InternetAddress( public static void inviaEmailReminderAppuntamenti(List<Prenotazione> lista, User userBo, Date tomorrow) throws SystemException, AddressException{
userBo.getEmailAddress()) : null;
InternetAddress toAddress = isAllowedEmailAddress(userBo.getEmailAddress()) ? new InternetAddress(userBo.getEmailAddress()) : null;
InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it"); InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it");
MailMessage mailMessage = new MailMessage(); MailMessage mailMessage = new MailMessage();
mailMessage.setTo(toAddress); mailMessage.setTo(toAddress);
mailMessage.setFrom(fromAddress); mailMessage.setFrom(fromAddress);
mailMessage.setSubject("Reminder appuntamenti Portos di domani"); mailMessage.setSubject("Reminder appuntamenti Portos di domani");
mailMessage.setBody(creaCorpoMailReminder(lista, userBo, tomorrow)); mailMessage.setBody(creaCorpoMailReminder(lista,userBo, tomorrow));
mailMessage.setHTMLFormat(true); mailMessage.setHTMLFormat(true);
/* /*
@ -130,8 +125,8 @@ public class CalendarUtil {
} }
private static String creaCorpoMailReminder(List<Prenotazione> lista, User boUser, Date tomorrow)
throws SystemException { private static String creaCorpoMailReminder(List<Prenotazione> lista , User boUser, Date tomorrow) throws SystemException{
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
@ -142,7 +137,9 @@ public class CalendarUtil {
/* /*
* Gestione header * Gestione header
*/ */
sb.append("<html><head><title>Appuntamenti del " + sdf.format(tomorrow) + "</title></head><body>"); sb.append("<html><head><title>Appuntamenti del "
+ sdf.format(tomorrow)
+ "</title></head><body>");
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("Gentile " + boUser.getFullName() + " ,"); sb.append("Gentile " + boUser.getFullName() + " ,");
@ -162,7 +159,7 @@ public class CalendarUtil {
User professionistaUser = UserLocalServiceUtil.fetchUser(prenotazione.getProfessionistaId()); User professionistaUser = UserLocalServiceUtil.fetchUser(prenotazione.getProfessionistaId());
sb.append("<div style='width:100%;'>"); sb.append("<div style='width:100%;'>");
sb.append("Ore " + sdfOra.format(prenotazione.getStartDate())); sb.append("Ore " +sdfOra.format(prenotazione.getStartDate()));
sb.append(" : appuntamento con " + professionistaUser.getFullName() + ". Motivo: "); sb.append(" : appuntamento con " + professionistaUser.getFullName() + ". Motivo: ");
sb.append(HtmlUtil.escape(prenotazione.getDescLong())); sb.append(HtmlUtil.escape(prenotazione.getDescLong()));
sb.append("</div>"); sb.append("</div>");
@ -171,17 +168,19 @@ public class CalendarUtil {
} }
sb.append("</body></html>"); sb.append("</body></html>");
return sb.toString(); return sb.toString();
} }
private static String creaCorpoMailRichiestaAppuntamento(User professionista, User boUser,
Date dataAppuntamento, String telefono, String mail) { private static String creaCorpoMailRichiestaAppuntamento(User professionista, User boUser, Date dataAppuntamento, String telefono, String mail){
SimpleDateFormat sdfGiorno = new SimpleDateFormat("d MMMMM yyyy"); SimpleDateFormat sdfGiorno = new SimpleDateFormat("d MMMMM yyyy");
SimpleDateFormat sdfOra = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdfOra = new SimpleDateFormat("HH:mm");
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
/* /*
@ -204,7 +203,7 @@ public class CalendarUtil {
sb.append(" &egrave; stato stato prenotato con successo."); sb.append(" &egrave; stato stato prenotato con successo.");
sb.append("</div>"); sb.append("</div>");
// Product Backlog Item 32934 //Product Backlog Item 32934
sb.append("<br/><div>Di seguito i recapiti che ha specificato:</div>"); sb.append("<br/><div>Di seguito i recapiti che ha specificato:</div>");
sb.append("<div>Telefono:&#9;").append(telefono).append("</div>"); sb.append("<div>Telefono:&#9;").append(telefono).append("</div>");
sb.append("<div>Email:&#9;").append(mail).append("</div>"); sb.append("<div>Email:&#9;").append(mail).append("</div>");
@ -214,11 +213,12 @@ public class CalendarUtil {
return sb.toString(); return sb.toString();
} }
private static String creaCorpoMailAnnullamento(User professionista, User boUser, Date dataAppuntamento) { private static String creaCorpoMailAnnullamento(User professionista, User boUser, Date dataAppuntamento){
SimpleDateFormat sdfGiorno = new SimpleDateFormat("d MMMMM yyyy"); SimpleDateFormat sdfGiorno = new SimpleDateFormat("d MMMMM yyyy");
SimpleDateFormat sdfOra = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdfOra = new SimpleDateFormat("HH:mm");
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
/* /*
@ -245,30 +245,28 @@ public class CalendarUtil {
return sb.toString(); return sb.toString();
} }
// Bug 32935 //Bug 32935
public static int calculateTimeSlots(Date start, Date end, int slotInterval) { public static int calculateTimeSlots(Date start, Date end, int slotInterval){
Long count = null; Long count = null;
count = (((end.getTime() - start.getTime()) / 1000L) / 60L) / slotInterval + 1; count = (((end.getTime() - start.getTime()) / 1000L) / 60L) / slotInterval + 1;
return count.intValue(); return count.intValue();
} }
private static boolean isAllowedEmailAddress(String emailAddress) { private static boolean isAllowedEmailAddress(String emailAddress){
final String[] NOT_ALLOWED_EMAIL_DOMAINS = PortletProps final String[] NOT_ALLOWED_EMAIL_DOMAINS = PortletProps.getArray(PortletPropsKeys.EMAIL_DOMAINS_NOT_ALLOWED);
.getArray(PortletPropsKeys.EMAIL_DOMAINS_NOT_ALLOWED); final Pattern VALID_EMAIL_ADDRESS_REGEX = Pattern.compile(PortletProps.get(PortletPropsKeys.EMAIL_VALIDATOR_REGEXP), Pattern.CASE_INSENSITIVE);
final Pattern VALID_EMAIL_ADDRESS_REGEX = Pattern.compile(
PortletProps.get(PortletPropsKeys.EMAIL_VALIDATOR_REGEXP), Pattern.CASE_INSENSITIVE);
boolean isAllowed = true; boolean isAllowed = true;
if (Validator.isNotNull(emailAddress)) { if(Validator.isNotNull(emailAddress)){
Matcher matcher = VALID_EMAIL_ADDRESS_REGEX.matcher(emailAddress); Matcher matcher = VALID_EMAIL_ADDRESS_REGEX.matcher(emailAddress);
isAllowed = matcher.find(); isAllowed = matcher.find();
String emailDomain = emailAddress.substring(emailAddress.indexOf("@") + 1); String emailDomain = emailAddress.substring(emailAddress.indexOf("@") + 1);
if (isAllowed && Arrays.asList(NOT_ALLOWED_EMAIL_DOMAINS).contains(emailDomain)) { if(isAllowed && Arrays.asList(NOT_ALLOWED_EMAIL_DOMAINS).contains(emailDomain)){
isAllowed = false; isAllowed = false;
} }
} else { }else{
isAllowed = false; isAllowed = false;
} }

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/init.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%> <%@page import="java.util.ArrayList"%>
<%@page import="com.liferay.portal.model.Role"%> <%@page import="com.liferay.portal.model.Role"%>
<%@page import="com.liferay.portal.service.UserGroupRoleLocalServiceUtil"%> <%@page import="com.liferay.portal.service.UserGroupRoleLocalServiceUtil"%>

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/amministrazione.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil"%> <%@page import="it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil"%>
<%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%> <%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.Organization"%> <%@page import="com.liferay.portal.model.Organization"%>

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/calendar.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%> <%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.Organization"%> <%@page import="com.liferay.portal.model.Organization"%>
<%@page import="it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil"%> <%@page import="it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil"%>

31
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/gestione_disponibilita.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%> <%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
<%@page import="it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil"%> <%@page import="it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil"%>
<%@page import="it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil"%> <%@page import="it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil"%>
@ -6,33 +5,45 @@
<%@page import="javax.portlet.PortletURL"%> <%@page import="javax.portlet.PortletURL"%>
<%@page import="java.util.Calendar"%> <%@page import="java.util.Calendar"%>
<%@ include file="/html/calendar_appointments/init.jsp" %> <%@ include file="/html/calendar_appointments/init.jsp" %>
<% <%
Calendar cal = Calendar.getInstance(); // locale-specific Calendar cal = Calendar.getInstance(); // locale-specific
cal.set(Calendar.HOUR_OF_DAY, 8); cal.set(Calendar.HOUR_OF_DAY, 8);
cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0); cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.MILLISECOND, 0);
SimpleDateFormat sdfGiorno = new SimpleDateFormat("d MMMMM yyyy"); SimpleDateFormat sdfGiorno = new SimpleDateFormat("d MMMMM yyyy");
SimpleDateFormat sdfOra = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdfOra = new SimpleDateFormat("HH:mm");
PortletURL iteratorURLMie = liferayPortletResponse.createRenderURL(); PortletURL iteratorURLMie = liferayPortletResponse.createRenderURL();
iteratorURLMie.setParameter("tabs1", tabs1); iteratorURLMie.setParameter("tabs1", tabs1);
String provinciaRicerca = ParamUtil.getString(request, "presidio_user_select", "-1"); String provinciaRicerca = ParamUtil.getString(request, "presidio_user_select", "-1");
String funzionarioIdRicerca = ParamUtil.getString(request, "funzionarioId", "-1"); String funzionarioIdRicerca = ParamUtil.getString(request, "funzionarioId", "-1");
PortletURL iteratorURLAltri = liferayPortletResponse.createRenderURL(); PortletURL iteratorURLAltri = liferayPortletResponse.createRenderURL();
iteratorURLAltri.setParameter("tabs1", tabs1); iteratorURLAltri.setParameter("tabs1", tabs1);
iteratorURLAltri.setParameter("presidio_user_select", provinciaRicerca); iteratorURLAltri.setParameter("presidio_user_select", provinciaRicerca);
iteratorURLAltri.setParameter("funzionarioId", funzionarioIdRicerca); iteratorURLAltri.setParameter("funzionarioId", funzionarioIdRicerca);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
%> %>
<liferay-portlet:actionURL name="addDisponibilita" var="addDisponibilitaURL"> <liferay-portlet:actionURL name="addDisponibilita" var="addDisponibilitaURL">
<liferay-portlet:param name="tabs1" value="Amministrazione"/> <liferay-portlet:param name="tabs1" value="Amministrazione"/>
<liferay-portlet:param name="funzionarioId" value='<%=""+user.getUserId() %>'/> <liferay-portlet:param name="funzionarioId" value='<%=""+user.getUserId() %>'/>
<liferay-portlet:param name="mvcPath" value="/html/calendar_appointments/view.jsp"/> <liferay-portlet:param name="mvcPath" value="/html/calendar_appointments/view.jsp"/>
</liferay-portlet:actionURL> </liferay-portlet:actionURL>
<c:if test="<%= !isDirigenteGenerale %>">
<c:if test="<%=!isDirigenteGenerale %>">
<div class="module-group fm_user_disponibilita_container" style="margin-top:2%;"> <div class="module-group fm_user_disponibilita_container" style="margin-top:2%;">
<aui:form name="fm_disponibilita_user" method="post" action="<%= addDisponibilitaURL %>"> <aui:form name="fm_disponibilita_user" method="post" action="<%= addDisponibilitaURL %>">
<liferay-ui:panel extended="false" defaultState="open" collapsible="false" title="Aggiungi Disponibilità"> <liferay-ui:panel extended="false" defaultState="open" collapsible="false" title="Aggiungi Disponibilitŕ">
<div class="container-fluid container-presidio-select"> <div class="container-fluid container-presidio-select">
<div class="row"> <div class="row">
@ -145,7 +156,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
<div class="module-group fm_user_indisponibilita_container" style="margin-top:2%;"> <div class="module-group fm_user_indisponibilita_container" style="margin-top:2%;">
<aui:form name="fm_indisponibilita_user" method="post" action="<%= addIndisponibilitaURL %>"> <aui:form name="fm_indisponibilita_user" method="post" action="<%= addIndisponibilitaURL %>">
<liferay-ui:panel extended="false" defaultState="open" collapsible="false" title="Aggiungi Indisponibilità"> <liferay-ui:panel extended="false" defaultState="open" collapsible="false" title="Aggiungi Indisponibilitŕ">
<div class="container-fluid container-presidio-select"> <div class="container-fluid container-presidio-select">
<div class="row"> <div class="row">
@ -251,7 +262,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
</c:if> </c:if>
<div class="module-group fm_generale_disponibilita_container" style="margin-top:2%;"> <div class="module-group fm_generale_disponibilita_container" style="margin-top:2%;">
<liferay-ui:panel extended="false" defaultState="open" collapsible="false" title="Le mie disponibilità"> <liferay-ui:panel extended="false" defaultState="open" collapsible="false" title="Le mie disponibilitŕ">
<div class="container-fluid container-presidio-select"> <div class="container-fluid container-presidio-select">
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
@ -272,7 +283,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
className="it.tref.portos.calendar.appointments.model.Disponibilita" className="it.tref.portos.calendar.appointments.model.Disponibilita"
modelVar="disponibilita" modelVar="disponibilita"
> >
<liferay-ui:search-container-column-text name="Disponibilità Appuntamento"> <liferay-ui:search-container-column-text name="Disponibilitŕ Appuntamento">
<% <%
out.print(sdfGiorno.format(disponibilita.getStartDate()) + " dalle " + sdfOra.format(disponibilita.getStartDate()) + " alle " + sdfOra.format(disponibilita.getEndDate())); out.print(sdfGiorno.format(disponibilita.getStartDate()) + " dalle " + sdfOra.format(disponibilita.getStartDate()) + " alle " + sdfOra.format(disponibilita.getEndDate()));
%> %>
@ -292,7 +303,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
<liferay-ui:search-container-column-text name="Disponibile"> <liferay-ui:search-container-column-text name="Disponibile">
<% <%
if(disponibilita.isDisponibile()){ if(disponibilita.isDisponibile()){
out.print("Sì"); out.print("Si");
} else { } else {
out.print("No"); out.print("No");
} }
@ -316,7 +327,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
<c:if test="<%=isPO %>"> <c:if test="<%=isPO %>">
<div class="module-group fm_generale_disponibilita_container" style="margin-top:2%;"> <div class="module-group fm_generale_disponibilita_container" style="margin-top:2%;">
<liferay-ui:panel extended="false" defaultState="open" collapsible="false" title="Disponibilità Sotto Controllo"> <liferay-ui:panel extended="false" defaultState="open" collapsible="false" title="Disponibilitŕ Sotto Controllo">
<!-- FILTRO PER PROVINCIA O FUNZIONARIO --> <!-- FILTRO PER PROVINCIA O FUNZIONARIO -->
@ -383,7 +394,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
out.print(funzionario.getFullName()); out.print(funzionario.getFullName());
%> %>
</liferay-ui:search-container-column-text> </liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="Disponibilità Appuntamento"> <liferay-ui:search-container-column-text name="Disponibilitŕ Appuntamento">
<% <%
out.print(sdfGiorno.format(disponibilita.getStartDate()) + " dalle " + sdfOra.format(disponibilita.getStartDate()) + " alle " + sdfOra.format(disponibilita.getEndDate())); out.print(sdfGiorno.format(disponibilita.getStartDate()) + " dalle " + sdfOra.format(disponibilita.getStartDate()) + " alle " + sdfOra.format(disponibilita.getEndDate()));
%> %>
@ -403,7 +414,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
<liferay-ui:search-container-column-text name="Disponibile"> <liferay-ui:search-container-column-text name="Disponibile">
<% <%
if(disponibilita.isDisponibile()){ if(disponibilita.isDisponibile()){
out.print("Sì"); out.print("Si");
} else { } else {
out.print("No"); out.print("No");
} }

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/gestione_disponibilita_action.jsp

@ -1,4 +1,3 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="it.tref.portos.calendar.appointments.model.Disponibilita"%> <%@page import="it.tref.portos.calendar.appointments.model.Disponibilita"%>
<%@ include file="/html/calendar_appointments/init.jsp" %> <%@ include file="/html/calendar_appointments/init.jsp" %>

1
liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/view.jsp

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

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

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

Caricamento…
Annulla
Salva