Cambiado tipo de datos Date a LocalDate para componente visit.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package ejb.visit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
@@ -17,9 +17,8 @@ import jpa.PatientJPA;
|
||||
import jpa.VisitJPA;
|
||||
|
||||
/**
|
||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los
|
||||
* métodos de la capa de negocio que implementan la logica de negocio y la
|
||||
* interacción con la capa de persistencia.
|
||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los métodos de la capa de negocio que implementan la logica de negocio y la interacción con la capa de
|
||||
* persistencia.
|
||||
*
|
||||
* @author mark
|
||||
*
|
||||
@@ -33,19 +32,16 @@ public class VisitFacadeBean implements VisitFacadeRemote {
|
||||
@EJB
|
||||
CommonFacadeLocal commonServices;
|
||||
|
||||
public Long getScheduledVisitsCount(int familyDoctorId, Date date) {
|
||||
TypedQuery<Long> query = entman.createQuery(
|
||||
"SELECT count(1) from VisitJPA v where v.date=:date and v.familyDoctor.id=:docId", Long.class);
|
||||
public Long getScheduledVisitsCount(int familyDoctorId, LocalDate date) {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from VisitJPA v where v.date=:date and v.familyDoctor.id=:docId", Long.class);
|
||||
query.setParameter("date", date);
|
||||
query.setParameter("docId", familyDoctorId);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
public List<VisitTO> listAllScheduledVisitsPaged(int familyDoctorId, Date date, int pageNumber, int pageSize) {
|
||||
TypedQuery<VisitJPA> query = entman.createQuery(
|
||||
"SELECT v from VisitJPA v where v.date=:date and v.familyDoctor.id=:docId order by v.date, v.time",
|
||||
VisitJPA.class);
|
||||
public List<VisitTO> listAllScheduledVisitsPaged(int familyDoctorId, LocalDate date, int pageNumber, int pageSize) {
|
||||
TypedQuery<VisitJPA> query = entman.createQuery("SELECT v from VisitJPA v where v.date=:date and v.familyDoctor.id=:docId order by v.date, v.time", VisitJPA.class);
|
||||
query.setParameter("date", date);
|
||||
query.setParameter("docId", familyDoctorId);
|
||||
|
||||
@@ -64,7 +60,7 @@ public class VisitFacadeBean implements VisitFacadeRemote {
|
||||
return listTO;
|
||||
}
|
||||
|
||||
public Long getVisitsCount(Integer patientId, Date date) {
|
||||
public Long getVisitsCount(Integer patientId, LocalDate date) {
|
||||
String strQuery = "SELECT count(1) from VisitJPA v %s";
|
||||
String strFilter = "";
|
||||
if (patientId != null)
|
||||
@@ -87,7 +83,7 @@ public class VisitFacadeBean implements VisitFacadeRemote {
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
public List<VisitTO> listVisitsPaged(Integer patientId, Date date, int pageNumber, int pageSize) {
|
||||
public List<VisitTO> listVisitsPaged(Integer patientId, LocalDate date, int pageNumber, int pageSize) {
|
||||
String strQuery = "SELECT v from VisitJPA v %s order by v.patient, v.date";
|
||||
String strFilter = "";
|
||||
if (patientId != null)
|
||||
@@ -143,14 +139,14 @@ public class VisitFacadeBean implements VisitFacadeRemote {
|
||||
entman.remove(vi);
|
||||
}
|
||||
|
||||
public void updateVisit(int id, Date date, LocalTime time) {
|
||||
public void updateVisit(int id, LocalDate date, LocalTime time) {
|
||||
VisitJPA vi = entman.find(VisitJPA.class, id);
|
||||
vi.setDate(date);
|
||||
vi.setTime(time);
|
||||
entman.persist(vi);
|
||||
}
|
||||
|
||||
public VisitTO addVisit(int patientId, Date date, LocalTime time, String observations) {
|
||||
public VisitTO addVisit(int patientId, LocalDate date, LocalTime time, String observations) {
|
||||
|
||||
PatientJPA pat = entman.find(PatientJPA.class, patientId);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ejb.visit;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
@@ -9,8 +9,7 @@ import javax.ejb.Remote;
|
||||
import TO.VisitTO;
|
||||
|
||||
/**
|
||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para
|
||||
* los clientes del EJB
|
||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para los clientes del EJB
|
||||
*
|
||||
* @author alina
|
||||
*
|
||||
@@ -21,13 +20,13 @@ public interface VisitFacadeRemote {
|
||||
* Definimos la interfaz remota
|
||||
*/
|
||||
|
||||
public Long getScheduledVisitsCount(int familyDoctorId, Date date);
|
||||
public Long getScheduledVisitsCount(int familyDoctorId, LocalDate date);
|
||||
|
||||
public List<VisitTO> listAllScheduledVisitsPaged(int familyDoctorId, Date date, int pageNumber, int pageSize);
|
||||
public List<VisitTO> listAllScheduledVisitsPaged(int familyDoctorId, LocalDate date, int pageNumber, int pageSize);
|
||||
|
||||
public Long getVisitsCount(Integer patientId, Date date);
|
||||
public Long getVisitsCount(Integer patientId, LocalDate date);
|
||||
|
||||
public List<VisitTO> listVisitsPaged(Integer patientId, Date date, int pageNumber, int pageSize);
|
||||
public List<VisitTO> listVisitsPaged(Integer patientId, LocalDate date, int pageNumber, int pageSize);
|
||||
|
||||
public VisitTO getVisit(int id) throws Exception;
|
||||
|
||||
@@ -35,8 +34,8 @@ public interface VisitFacadeRemote {
|
||||
|
||||
public void removeVisit(int id);
|
||||
|
||||
public void updateVisit(int id, Date date, LocalTime time);
|
||||
public void updateVisit(int id, LocalDate date, LocalTime time);
|
||||
|
||||
public VisitTO addVisit(int patientId, Date date, LocalTime time, String observations);
|
||||
public VisitTO addVisit(int patientId, LocalDate date, LocalTime time, String observations);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user