Sfoglia il codice sorgente

align

feature/allineamento-sorgenti
E-A B 2 anni fa
parent
commit
74d61c6113
  1. 10
      liferay-plugins-sdk-6.2/.idea/.gitignore
  2. 6
      liferay-plugins-sdk-6.2/.idea/ant.xml
  3. 6
      liferay-plugins-sdk-6.2/.idea/jpa-buddy.xml
  4. 9
      liferay-plugins-sdk-6.2/.idea/misc.xml
  5. 6
      liferay-plugins-sdk-6.2/.idea/vcs.xml
  6. 2
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/liferay-hook.xml
  7. 2
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/service.xml
  8. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/audit/service/persistence/AuditEventPersistenceImpl.java
  9. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/details_column.jsp
  10. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/common/relations_column.jsp
  11. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/detail.jsp
  12. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view.jsp
  13. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/detail/view_list.jsp
  14. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/init.jsp
  15. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/edit.jsp
  16. 1
      liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/html/storicizzazione/view.jsp
  17. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-hook.xml
  18. 6
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service.xml
  19. 2
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service.xml
  20. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateFunzionarioException.java
  21. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicatePrenotazioneException.java
  22. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateProfessionistaException.java
  23. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchDisponibilitaException.java
  24. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchFunzionarioException.java
  25. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchPrenotazioneException.java
  26. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchProfessionistaException.java
  27. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/SlotNotAvailableException.java
  28. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/DisponibilitaImpl.java
  29. 2
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/FunzionarioImpl.java
  30. 13
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/PrenotazioneImpl.java
  31. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/model/impl/ProfessionistaImpl.java
  32. 250
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaLocalServiceImpl.java
  33. 53
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/DisponibilitaServiceImpl.java
  34. 14
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioLocalServiceImpl.java
  35. 72
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/it/tref/portos/calendar/appointments/service/impl/FunzionarioServiceImpl.java
  36. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/init.jsp
  37. 11
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/amministrazione.jsp
  38. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/calendar.jsp
  39. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/gestione_disponibilita.jsp
  40. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/gestione_disponibilita_action.jsp
  41. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/view.jsp
  42. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/init.jsp
  43. 1
      liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/view.jsp

10
liferay-plugins-sdk-6.2/.idea/.gitignore vendored

@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Zeppelin ignored files
/ZeppelinRemoteNotebooks/

6
liferay-plugins-sdk-6.2/.idea/ant.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/build.xml" />
</component>
</project>

6
liferay-plugins-sdk-6.2/.idea/jpa-buddy.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="renamerInitialized" value="true" />
</component>
</project>

9
liferay-plugins-sdk-6.2/.idea/misc.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" default="true">
<output url="file://$PROJECT_DIR$/classes" />
</component>
<component name="ProjectType">
<option name="id" value="jpab" />
</component>
</project>

6
liferay-plugins-sdk-6.2/.idea/vcs.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

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

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

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="it.tref.liferay.portos.audit">
<author>Marco</author>

1
liferay-plugins-sdk-6.2/portlets/portos-audit-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/audit/service/persistence/AuditEventPersistenceImpl.java

@ -43,7 +43,6 @@ import it.tref.liferay.portos.audit.NoSuchAuditEventException;
import it.tref.liferay.portos.audit.model.AuditEvent;
import it.tref.liferay.portos.audit.model.impl.AuditEventImpl;
import it.tref.liferay.portos.audit.model.impl.AuditEventModelImpl;
import it.tref.liferay.portos.audit.service.persistence.AuditEventPersistence;
import java.io.Serializable;

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.json.JSONArray"%>
<%@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.json.JSONArray"%>
<%@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="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="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="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/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" %>

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

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

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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.1.0//EN"
"http://www.liferay.com/dtd/liferay-service-builder_6_1_0.dtd">
<?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">
<service-builder package-path="it.tref.liferay.portos.bo">
<author>Davide Barbagallo, 3F Consulting + Manifattura Web Group s.r.l.</author>
<namespace>portos_bo</namespace>

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

@ -1,4 +1,4 @@
<?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">
<service-builder package-path="it.tref.portos.calendar.appointments">
<author>3F Consulting + Manifattura Web Group s.r.l.</author>

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

@ -13,7 +13,6 @@ import com.liferay.portal.kernel.exception.PortalException;
/**
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class DuplicateFunzionarioException extends PortalException {
public DuplicateFunzionarioException() {

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

@ -13,7 +13,6 @@ import com.liferay.portal.kernel.exception.PortalException;
/**
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class DuplicatePrenotazioneException extends PortalException {
public DuplicatePrenotazioneException() {

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

@ -13,7 +13,6 @@ import com.liferay.portal.kernel.exception.PortalException;
/**
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class DuplicateProfessionistaException extends PortalException {
public DuplicateProfessionistaException() {

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

@ -13,7 +13,6 @@ import com.liferay.portal.NoSuchModelException;
/**
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class NoSuchDisponibilitaException extends NoSuchModelException {
public NoSuchDisponibilitaException() {

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

@ -13,7 +13,6 @@ import com.liferay.portal.NoSuchModelException;
/**
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class NoSuchFunzionarioException extends NoSuchModelException {
public NoSuchFunzionarioException() {

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

@ -13,7 +13,6 @@ import com.liferay.portal.NoSuchModelException;
/**
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class NoSuchPrenotazioneException extends NoSuchModelException {
public NoSuchPrenotazioneException() {

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

@ -13,7 +13,6 @@ import com.liferay.portal.NoSuchModelException;
/**
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class NoSuchProfessionistaException extends NoSuchModelException {
public NoSuchProfessionistaException() {

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

@ -13,7 +13,6 @@ import com.liferay.portal.kernel.exception.PortalException;
/**
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class SlotNotAvailableException extends PortalException {
public SlotNotAvailableException() {

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

@ -20,7 +20,6 @@ package it.tref.portos.calendar.appointments.model.impl;
*
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class DisponibilitaImpl extends DisponibilitaBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a disponibilita model instance

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

@ -22,7 +22,6 @@ import com.liferay.portal.kernel.util.StringPool;
*
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class FunzionarioImpl extends FunzionarioBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a funzionario model instance
@ -30,7 +29,6 @@ public class FunzionarioImpl extends FunzionarioBaseImpl {
*/
public FunzionarioImpl() {}
@Override
public String getFullDescription() {
return getNome() + StringPool.SPACE + getCognome();
}

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

@ -24,7 +24,6 @@ import org.apache.commons.lang.time.DateUtils;
*
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class PrenotazioneImpl extends PrenotazioneBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a prenotazione model instance
@ -32,9 +31,17 @@ public class PrenotazioneImpl extends PrenotazioneBaseImpl {
*/
public PrenotazioneImpl() {}
@Override
public boolean isExpired(Date now) {
return now.after(getStartDate()) || DateUtils.isSameDay(now, getStartDate());
if (now.after(getStartDate())) {
return true;
}
if (DateUtils.isSameDay(now, getStartDate())) {
return true;
}
return false;
}
}

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

@ -20,7 +20,6 @@ package it.tref.portos.calendar.appointments.model.impl;
*
* @author 3F Consulting + Manifattura Web Group s.r.l.
*/
@SuppressWarnings("serial")
public class ProfessionistaImpl extends ProfessionistaBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a professionista model instance

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

@ -26,13 +26,11 @@ import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.Order;
import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil;
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.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.Organization;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.User;
@ -40,6 +38,7 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
/**
* The implementation of the disponibilita local service.
@ -64,17 +63,19 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
private static Log _log = LogFactoryUtil.getLog(DisponibilitaLocalServiceImpl.class);
@Override
public long checkDisponibilitaExist(long funzionarioId, Date startDate, Date endDate) throws SystemException {
//Bug 32935
public long checkDisponibilitaExist(long funzionarioId, Date startDate, Date endDate) throws SystemException{
long exist = 0L;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDate)));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", startDate));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate", endDate));
@SuppressWarnings("unchecked")
//Bug 32935
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate",startDate));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate",endDate));
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
if (!results.isEmpty()) {
exist = results.get(0).getDisponibilitaId();
@ -82,19 +83,19 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
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;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
DynamicQuery dynamicQuery = dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", funzionarioId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDate)));
dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio", presidio));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", startDate));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate", endDate));
@SuppressWarnings("unchecked")
dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio",presidio));
//Bug 32935
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate",startDate));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate",endDate));
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
if (!results.isEmpty()) {
exist = results.get(0).getDisponibilitaId();
@ -102,7 +103,6 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
return exist;
}
@Override
public Disponibilita addDisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio,
ServiceContext serviceContext) throws SystemException, PortalException {
@ -124,13 +124,15 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
disponibilita.setPresidio(presidio);
disponibilita.setExactDate(sdf.format(startDate));
disponibilita.setDisponibile(true);
disponibilita = updateDisponibilita(disponibilita);
disponibilita = disponibilitaLocalService.updateDisponibilita(disponibilita);
return disponibilita;
}
@Override
public Disponibilita addIndisponibilita(long userId, long funzionarioId, Date startDate, Date endDate,
long presidio, ServiceContext serviceContext) throws SystemException, PortalException {
public Disponibilita addIndisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio,
ServiceContext serviceContext) throws SystemException, PortalException {
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(presidio);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
@ -150,29 +152,35 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
disponibilita.setPresidio(presidio);
disponibilita.setExactDate(sdf.format(startDate));
disponibilita.setDisponibile(false);
disponibilita = updateDisponibilita(disponibilita);
disponibilita = disponibilitaLocalService.updateDisponibilita(disponibilita);
return disponibilita;
}
@Override
public void addDisponibilitaGenerale(long userId, Date startDate, Date endDate, long presidioId, String oraInizio,
String oraFine, int giornoSettimana, ServiceContext serviceContext) throws SystemException,
PortalException, ParseException {
public void addDisponibilitaGenerale(long userId, Date startDate, Date endDate, long presidioId,
String oraInizio, String oraFine, int giornoSettimana, ServiceContext serviceContext) throws SystemException, PortalException, ParseException{
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(presidioId);
List<User> userDefinitivo = new ArrayList<User>();
try {
if (organization != null) {
List<User> users = userLocalService.getOrganizationUsers(presidioId);
if(organization != null){
List<User> users = UserLocalServiceUtil.getOrganizationUsers(presidioId);
for (User user : users) {
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
Role portosIstruttore =
RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
boolean isIstruttore =
UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
organization.getGroupId(), portosIstruttore.getRoleId());
if (isIstruttore) {
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
if(isIstruttore){
userDefinitivo.add(user);
}
}
@ -194,18 +202,22 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDateToInsert)));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", organization.getGroupId()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", startDateToInsert));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate", endDateToInsert));
@SuppressWarnings("unchecked")
//Bug 32935
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate",startDateToInsert));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate",endDateToInsert));
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
if (results.isEmpty()) {
addDisponibilita(serviceContext.getUserId(), user.getUserId(), startDateToInsert, endDateToInsert,
organization.getOrganizationId(), serviceContext);
} else {
for (Iterator<Disponibilita> iterator = results.iterator(); iterator.hasNext();) {
Disponibilita disponibilita = iterator.next();
}
//Bug 32935
else{
for (Iterator iterator = results.iterator(); iterator.hasNext();) {
Disponibilita disponibilita = (Disponibilita) iterator.next();
disponibilita.setDisponibile(true);
updateDisponibilita(disponibilita);
disponibilitaLocalService.updateDisponibilita(disponibilita);
}
}
}
@ -232,18 +244,22 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", user.getUserId()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("exactDate", sdf.format(startDateToInsert)));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", org.getGroupId()));
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate", startDateToInsert));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate", endDateToInsert));
@SuppressWarnings("unchecked")
//Bug 32935
dynamicQuery.add(RestrictionsFactoryUtil.eq("startDate",startDateToInsert));
dynamicQuery.add(RestrictionsFactoryUtil.eq("endDate",endDateToInsert));
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
if (results.isEmpty()) {
addDisponibilita(serviceContext.getUserId(), user.getUserId(), startDateToInsert,
endDateToInsert, presidioId, serviceContext);
} else {
for (Iterator<Disponibilita> iterator = results.iterator(); iterator.hasNext();) {
Disponibilita disponibilita = iterator.next();
if(results.isEmpty()){
addDisponibilita(serviceContext.getUserId(), user.getUserId(), startDateToInsert, endDateToInsert,
presidioId, serviceContext);
}
//Bug 32935
else{
for (Iterator iterator = results.iterator(); iterator.hasNext();) {
Disponibilita disponibilita = (Disponibilita) iterator.next();
disponibilita.setDisponibile(true);
updateDisponibilita(disponibilita);
disponibilitaLocalService.updateDisponibilita(disponibilita);
}
}
}
@ -276,8 +292,6 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
return sameDay;
}
@SuppressWarnings("unchecked")
@Override
public List<Disponibilita> findByStartDate(Date date) throws SystemException {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
@ -288,10 +302,9 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
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 end = DateUtils.addHours(start, 22);
DynamicQuery dynamicQuery = dynamicQuery();
@ -299,15 +312,12 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", presidio));
@SuppressWarnings("unchecked")
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
return results;
}
@SuppressWarnings("unchecked")
@Override
public List<Disponibilita> findByFunzionario_StartDate(long funzionarioId, Date date, long presidio)
throws SystemException {
}
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
Date end = DateUtils.addHours(start, 22);
@ -316,24 +326,28 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
dynamicQuery.add(RestrictionsFactoryUtil.lt("endDate", end));
dynamicQuery.add(RestrictionsFactoryUtil.eq("groupId", presidio));
return disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
List<Disponibilita> results = disponibilitaPersistence.findWithDynamicQuery(dynamicQuery);
return results;
}
@SuppressWarnings("unchecked")
@Override
public List<Disponibilita> findByFunzionarioStartDate(long funzionarioId, Date date, int startRow, int endRow)
throws SystemException {
public List<Disponibilita> findByFunzionarioStartDate(long funzionarioId, Date date, int startRow, int endRow) 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.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate");
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 {
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
@ -342,15 +356,16 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate");
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")
@Override
public List<Disponibilita> findByPOStartDateAndFilters(long funzionarioId, Date date, int startRow, int endRow,
String provinciaFilter, String funzionarioIdFilter) throws SystemException {
public List<Disponibilita> findByPOStartDateAndFilters(long funzionarioId, Date date, int startRow, int endRow, String provinciaFilter, String funzionarioIdFilter) throws SystemException {
User user = UserLocalServiceUtil.fetchUser(funzionarioId);
User user = userLocalService.fetchUser(funzionarioId);
List<Long> orgIds = new ArrayList<Long>();
try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
@ -381,27 +396,31 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
}
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
DynamicQuery dynamicQuery = dynamicQuery();
if (provinciaFilter.equals("-1") || provinciaFilter.equals(StringPool.BLANK)) {
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray()));
} else {
if(!provinciaFilter.equals("-1") && !provinciaFilter.equals("")){
dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio", Long.valueOf(provinciaFilter)));
}
if (funzionarioIdFilter.equals("-1") || funzionarioIdFilter.equals(StringPool.BLANK)) {
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
} else {
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray()));
}
if(!funzionarioIdFilter.equals("-1") && !funzionarioIdFilter.equals("")){
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", Long.valueOf(funzionarioIdFilter)));
} else {
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
}
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate");
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>();
try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
@ -432,36 +451,39 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
}
Date start = DateUtils.truncate(date, Calendar.DAY_OF_MONTH);
DynamicQuery dynamicQuery = dynamicQuery();
if (provinciaFilter.equals("-1") || provinciaFilter.equals(StringPool.BLANK)) {
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray()));
} else {
if(!provinciaFilter.equals("-1") && !provinciaFilter.equals("")){
dynamicQuery.add(RestrictionsFactoryUtil.eq("presidio", Long.valueOf(provinciaFilter)));
}
if (funzionarioIdFilter.equals("-1") || funzionarioIdFilter.equals(StringPool.BLANK)) {
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
} else {
dynamicQuery.add(PropertyFactoryUtil.forName("presidio").in(orgIds.toArray()));
}
if(!funzionarioIdFilter.equals("-1") && !funzionarioIdFilter.equals("")){
dynamicQuery.add(RestrictionsFactoryUtil.eq("funzionarioId", Long.valueOf(funzionarioIdFilter)));
} else {
dynamicQuery.add(RestrictionsFactoryUtil.ne("funzionarioId", funzionarioId));
}
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate");
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")
@Override
public List<Disponibilita> findByPOStartDate(long funzionarioId, Date date, int startRow, int endRow)
throws SystemException {
public List<Disponibilita> findByPOStartDate(long funzionarioId, Date date, int startRow, int endRow) throws SystemException {
User user = UserLocalServiceUtil.fetchUser(funzionarioId);
User user = userLocalService.fetchUser(funzionarioId);
List<Long> orgIds = new ArrayList<Long>();
try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
boolean isDirigenteGenerale =
RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if (isDirigenteGenerale) {
List<Organization> orgs =
OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
boolean isDirigenteGenerale = RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if(isDirigenteGenerale){
List<Organization> orgs = OrganizationLocalServiceUtil.getOrganizations(-1, -1);
for (Organization organization : orgs) {
if (organization.getParentOrganization() != null) {
orgIds.add(organization.getOrganizationId());
@ -489,23 +511,26 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate");
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 {
User user = userLocalService.fetchUser(funzionarioId);
User user = UserLocalServiceUtil.fetchUser(funzionarioId);
List<Long> orgIds = new ArrayList<Long>();
try {
Role dirigenteGenerale = RoleLocalServiceUtil.getRole(user.getCompanyId(), "dirigente_generale");
boolean isDirigenteGenerale =
RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if (isDirigenteGenerale) {
List<Organization> orgs =
OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
boolean isDirigenteGenerale = RoleLocalServiceUtil.hasUserRole(user.getUserId(), dirigenteGenerale.getRoleId());
if(isDirigenteGenerale){
List<Organization> orgs = OrganizationLocalServiceUtil.getOrganizations(-1, -1);
for (Organization organization : orgs) {
if (organization.getParentOrganization() != null) {
if(organization.getParentOrganization() != null){
orgIds.add(organization.getOrganizationId());
}
}
@ -531,7 +556,10 @@ public class DisponibilitaLocalServiceImpl extends DisponibilitaLocalServiceBase
dynamicQuery.add(RestrictionsFactoryUtil.ge("startDate", start));
Order defaultOrder = OrderFactoryUtil.asc("startDate");
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 {

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

@ -11,6 +11,7 @@ package it.tref.portos.calendar.appointments.service.impl;
import it.tref.portos.calendar.appointments.model.Disponibilita;
import it.tref.portos.calendar.appointments.model.Funzionario;
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 java.text.ParseException;
@ -37,6 +38,7 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
/**
* The implementation of the disponibilita remote service.
@ -61,7 +63,6 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
private static Log _log = LogFactoryUtil.getLog(DisponibilitaServiceImpl.class);
@Override
public Disponibilita addDisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio,
ServiceContext serviceContext) throws SystemException, PortalException {
@ -69,7 +70,6 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
serviceContext);
}
@Override
public List<Disponibilita> addDisponibilitaGenerale(long presidio, long userId, Date dataInizioDisponibilita,
Date dataFineDisponibilita, String giornoSettimana, String oraInizioDisponibilita,
String oraFineDisponibilita, ServiceContext serviceContext) throws SystemException, PortalException {
@ -87,9 +87,7 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
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();
JSONArray array = JSONFactoryUtil.createJSONArray();
@ -101,9 +99,18 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
String oraInizio = oreInizio[i];
jsonFiglio.put("ora", oraInizio);
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);
}
json.put("slot", array);
@ -117,24 +124,34 @@ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl {
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio));
List<User> userDefinitivo = new ArrayList<User>();
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) {
Role portosSupporto = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_supporto");
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
"portos_calendario");
if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
organization.getGroupId(), portosIstruttore.getRoleId());
if (isIstruttore) {
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
if(isIstruttore){
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);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
JSONArray json = JSONFactoryUtil.createJSONArray();

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

@ -8,17 +8,17 @@
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.service.base.FunzionarioLocalServiceBaseImpl;
import java.util.Date;
import java.util.List;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.User;
import com.liferay.portal.service.ServiceContext;
/**
* The implementation of the funzionario local service.
* <p>
@ -40,7 +40,6 @@ public class FunzionarioLocalServiceImpl extends FunzionarioLocalServiceBaseImpl
* service.
*/
@Override
public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia,
ServiceContext serviceContext) throws PortalException, SystemException {
@ -75,9 +74,8 @@ public class FunzionarioLocalServiceImpl extends FunzionarioLocalServiceBaseImpl
return this.deleteFunzionario(funzionario);
}
@Override
public List<Funzionario> findByPresidio(String presidio) throws SystemException {
return funzionarioPersistence.findByPresidio(presidio);
}
}

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

@ -8,7 +8,6 @@
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.service.base.FunzionarioServiceBaseImpl;
@ -23,7 +22,6 @@ import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.log.Log;
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.model.Organization;
import com.liferay.portal.model.Role;
@ -32,6 +30,8 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
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.
@ -55,59 +55,81 @@ public class FunzionarioServiceImpl extends FunzionarioServiceBaseImpl {
private static Log _log = LogFactoryUtil.getLog(FunzionarioServiceImpl.class);
@Override
public Funzionario addFunzionario(long userId, String nome, String cognome, String presidio, String tipologia,
ServiceContext serviceContext) throws PortalException, SystemException {
return funzionarioLocalService.addFunzionario(userId, nome, cognome, presidio, tipologia, serviceContext);
}
@Override
public String getFunzionariByPresidio(String presidio) {
JSONArray json = JSONFactoryUtil.createJSONArray();
try {
Organization organization = OrganizationLocalServiceUtil.fetchOrganization(Long.valueOf(presidio));
if (organization != null) {
List<User> users = userLocalService.getOrganizationUsers(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");
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(),
Constants.ROLE_NAME_ISTRUTTORE);
if (!userLocalService.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())) {
boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
organization.getGroupId(), portosCalendario.getRoleId());
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(),
organization.getGroupId(), portosIstruttore.getRoleId());
boolean isGeologo = userLocalService.hasRoleUser(portosGeologo.getRoleId(),
user.getUserId());
if (isCalendario) {
Role portosGeologo = RoleLocalServiceUtil.getRole(organization.getCompanyId(), Constants.ROLE_NAME_GEOLOGO);
Role portosCalendario = RoleLocalServiceUtil.getRole(organization.getCompanyId(), "portos_calendario");
Role portosIstruttore = RoleLocalServiceUtil.getRole(organization.getCompanyId(), Constants.ROLE_NAME_ISTRUTTORE);
if(!UserLocalServiceUtil.hasRoleUser(portosSupporto.getRoleId(), user.getUserId())){
boolean isCalendario = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
user.getUserId(), organization.getGroupId(), portosCalendario.getRoleId());
boolean isIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(
user.getUserId(), organization.getGroupId(), portosIstruttore.getRoleId());
boolean isGeologo = UserLocalServiceUtil.hasRoleUser(portosGeologo.getRoleId(), user.getUserId());
if(isCalendario){
JSONObject jsonFunzionario = JSONFactoryUtil.createJSONObject();
jsonFunzionario.put("id", user.getUserId());
jsonFunzionario.put("nome", user.getFirstName());
jsonFunzionario.put("cognome", user.getLastName());
if (isIstruttore) {
if(isIstruttore){
jsonFunzionario.put("tipologia", "Istruttore");
} else if (isGeologo) {
} else if(isGeologo){
jsonFunzionario.put("tipologia", "Geologo");
} else {
jsonFunzionario.put("tipologia", StringPool.BLANK);
jsonFunzionario.put("tipologia", "");
}
json.put(jsonFunzionario);
}
}
}
}
} catch (NumberFormatException | PortalException | SystemException e) {
_log.error(e, e);
} catch (NumberFormatException | SystemException e) {
_log.error(e,e);
} catch (PortalException e) {
_log.error(e,e);
}
return json.toString();
}
}
class UserComparator implements Comparator<User> {

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="com.liferay.portal.model.Role"%>
<%@page import="com.liferay.portal.service.UserGroupRoleLocalServiceUtil"%>

11
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="com.liferay.portal.service.OrganizationLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.Organization"%>
@ -245,11 +244,11 @@ String dataFine = ParamUtil.getString(request, "dataFineRicerca","");
<div class="lfr-form-row lfr-form-row-inline">
<div class="row-fields" style="display: flex;">
<aui:select id="giornoSettimana1" name="giornoSettimana1" label="Giorno della Settimana">
<aui:option value="2" label="Lunedì"></aui:option>
<aui:option value="3" label="Martedì"></aui:option>
<aui:option value="4" label="Mercoledì"></aui:option>
<aui:option value="5" label="Giovedì"></aui:option>
<aui:option value="6" label="Venerdì"></aui:option>
<aui:option value="2" label="Luned<EFBFBD>"></aui:option>
<aui:option value="3" label="Marted<EFBFBD>"></aui:option>
<aui:option value="4" label="Mercoled<EFBFBD>"></aui:option>
<aui:option value="5" label="Gioved<EFBFBD>"></aui:option>
<aui:option value="6" label="Venerd<EFBFBD>"></aui:option>
</aui:select>
<aui:select id="oraIn1" name="oraIn1" label="Ora Inizio">
<aui:option value="08:00" label="08:00"></aui:option>

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.model.Organization"%>
<%@page import="it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil"%>

1
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="it.tref.portos.calendar.appointments.service.PrenotazioneLocalServiceUtil"%>
<%@page import="it.tref.portos.calendar.appointments.service.DisponibilitaLocalServiceUtil"%>

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"%>
<%@ 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"%>
<%@ 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="com.liferay.portal.kernel.util.FastDateFormatFactoryUtil"%>
<%@page import="com.liferay.portal.kernel.util.StringUtil"%>

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

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

Caricamento…
Annulla
Salva