From 5eb7a2cf6b3156942dd7ca1ff9e37db5eca7ea25 Mon Sep 17 00:00:00 2001 From: manuel-freire Date: Wed, 31 May 2017 15:00:38 +0200 Subject: [PATCH] solucionados problemas para compilar via mvn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No corrijo los warnings, pero todos son fácilmente solucionables --- ...omandoAn\314\203adirServiciosAEvento.java" | 22 -- .../Entidades/Evento.java.BACKUP.4517.java | 221 ------------------ .../Entidades/Evento.java.BASE.4517.java | 220 ----------------- .../Entidades/Evento.java.LOCAL.4517.java | 220 ----------------- .../Entidades/Evento.java.REMOTE.4517.java | 221 ------------------ .../Negocio/__tests/TestEmpleados.java | 1 - src/main/java/javafx/util/Pair.java | 128 ++++++++++ 7 files changed, 128 insertions(+), 905 deletions(-) delete mode 100644 "src/main/java/es/fdi/eventsoft/Negocio/Comandos/Imp/Comandos_Eventos/ComandoAn\314\203adirServiciosAEvento.java" delete mode 100644 src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.BACKUP.4517.java delete mode 100644 src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.BASE.4517.java delete mode 100644 src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.LOCAL.4517.java delete mode 100644 src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.REMOTE.4517.java create mode 100644 src/main/java/javafx/util/Pair.java diff --git "a/src/main/java/es/fdi/eventsoft/Negocio/Comandos/Imp/Comandos_Eventos/ComandoAn\314\203adirServiciosAEvento.java" "b/src/main/java/es/fdi/eventsoft/Negocio/Comandos/Imp/Comandos_Eventos/ComandoAn\314\203adirServiciosAEvento.java" deleted file mode 100644 index 2ac8e4c..0000000 --- "a/src/main/java/es/fdi/eventsoft/Negocio/Comandos/Imp/Comandos_Eventos/ComandoAn\314\203adirServiciosAEvento.java" +++ /dev/null @@ -1,22 +0,0 @@ -package es.fdi.eventsoft.Negocio.Comandos.Imp.Comandos_Eventos; -import es.fdi.eventsoft.Negocio.Comandos.Comando; -import es.fdi.eventsoft.Negocio.Comandos.Contexto; -import es.fdi.eventsoft.Negocio.Comandos.EventosNegocio; -import es.fdi.eventsoft.Negocio.Entidades.Evento; -import es.fdi.eventsoft.Negocio.ServiciosAplicacion.Factoria_ServiciosAplicacion.FactoriaSA; -import javafx.util.Pair; - -import java.util.List; - -/** - * Created by Rodrigo de Miguel on 09/05/2017. - */ -public class ComandoAñadirServiciosAEvento implements Comando { - - public Contexto execute(Object datos){ - Pair> par = (Pair>) datos; - EventosNegocio evento = FactoriaSA.getInstance().crearSAEventos().añadirServiciosAEvento(par.getKey(), par.getValue()); - return new Contexto(evento, null); - } - -} diff --git a/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.BACKUP.4517.java b/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.BACKUP.4517.java deleted file mode 100644 index 77fa724..0000000 --- a/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.BACKUP.4517.java +++ /dev/null @@ -1,221 +0,0 @@ -package es.fdi.eventsoft.Negocio.Entidades; - -import es.fdi.eventsoft.Negocio.Entidades.Usuario.Cliente; -import es.fdi.eventsoft.Negocio.Entidades.Usuario.Organizador; -import org.hibernate.annotations.*; -import org.hibernate.validator.constraints.NotBlank; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.persistence.*; -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; -import javax.validation.constraints.Future; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -@Entity -@Table(name = "Eventos") -@NamedQueries({ - @NamedQuery(name = "Evento.buscarEventosPorUsuario", query = "from Evento e join fetch e.cliente join fetch e.organizador where e.cliente = :cliente"), - @NamedQuery(name = "Evento.buscarEventosPorUsuario_2", query = "from Evento e join fetch e.organizador join fetch e.cliente where e.organizador = :organizador") -}) -public class Evento implements Serializable { - - /**************************** - ********* ATRIBUTOS ******** - ****************************/ - - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id private Long id; - - @NotBlank - @Column(nullable = false) - private String nombre; - - @NotBlank - @Column(nullable = false) - private String descripcion; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(nullable = false) - private Cliente cliente; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(nullable = false) - private Organizador organizador; - - @Column(nullable = false) - private CategoriasEvento categoria; - - @NotBlank - @Column(nullable = false) - private String lugar; - - @Column(name = "Fecha_Inicio", nullable = false) - @DateTimeFormat(pattern="dd/MM/yyyy") - @NotNull - private Date fechaInicio; - - - @Column(name = "Fecha_Fin", nullable = false) - @DateTimeFormat(pattern="dd/MM/yyyy") - @NotNull @Future - private Date fechaFin; - - - @OneToMany(mappedBy = "evento", fetch = FetchType.LAZY, cascade = CascadeType.ALL) - @Cascade(org.hibernate.annotations.CascadeType.ALL) - private List eventoServicios; - - @Version long version; - - /**************************** - ******* CONSTRUCTORES ****** - ****************************/ - - public enum CategoriasEvento { - BODAS, - DESPEDIDAS, - BABY_SHOWER, - COMIDA_EMPRESA - } - - public Evento() {} - - public Evento(String nombre, String descripcion, Cliente cliente, Organizador organizador, CategoriasEvento categoria, String lugar, Date fechaInicio, Date fechaFin) { - this.nombre = nombre; - this.descripcion = descripcion; - this.cliente = cliente; - this.organizador = organizador; - this.categoria = categoria; - this.lugar = lugar; - this.fechaInicio = fechaInicio; - this.fechaFin = fechaFin; - } - - public Evento(String nombre, String descripcion, Cliente cliente, Organizador organizador, CategoriasEvento categoria, String lugar, Date fechaInicio, Date fechaFin, List eventoServicios) { - this.nombre = nombre; - this.descripcion = descripcion; - this.cliente = cliente; - this.organizador = organizador; - this.categoria = categoria; - this.lugar = lugar; - this.fechaInicio = fechaInicio; - this.fechaFin = fechaFin; - this.eventoServicios = eventoServicios; - } - - /**************************** - **** GETTERS AND SETTERS *** - ****************************/ - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getNombre() { - return nombre; - } - - public void setNombre(String nombre) { - this.nombre = nombre; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public Cliente getCliente() { - return cliente; - } - - public void setCliente(Cliente cliente) { - this.cliente = cliente; - } - - public Organizador getOrganizador() { - return organizador; - } - - public void setOrganizador(Organizador organizador) { - this.organizador = organizador; - } - - public CategoriasEvento getCategoria() { - return categoria; - } - - public void setCategoria(CategoriasEvento categoria) { - this.categoria = categoria; - } - - public String getLugar() { - return lugar; - } - - public void setLugar(String lugar) { - this.lugar = lugar; - } - - public Date getFechaInicio() { - return fechaInicio; - } - - public void setFechaInicio(Date fechaInicio) { - this.fechaInicio = fechaInicio; - } - - public Date getFechaFin() { - return fechaFin; - } - - public void setFechaFin(Date fechaFin) { - this.fechaFin = fechaFin; - } - - public List getEventoServicios() { - return eventoServicios; - } - - public void setEventoServicios(List eventoServicios) { - this.eventoServicios = eventoServicios; - } - - public void addEventoServicios(List eventoServicios) { - for (EventoServicio ev :eventoServicios){ - if(!this.eventoServicios.contains(ev)) { - this.eventoServicios.add(ev); - }else{ - System.out.println("eventosServicios ya contiene el servicio"); - } - } - } - - @Override - public String toString() { - return "Evento{" + - "id=" + id + - ", nombre='" + nombre + '\'' + - ", descripcion='" + descripcion + '\'' + - ", cliente=" + cliente + - ", organizador=" + organizador + - ", categoria=" + categoria + - ", lugar='" + lugar + '\'' + - ", fechaInicio=" + fechaInicio + - ", fechaFin=" + fechaFin + - '}'; - } -} diff --git a/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.BASE.4517.java b/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.BASE.4517.java deleted file mode 100644 index ca10177..0000000 --- a/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.BASE.4517.java +++ /dev/null @@ -1,220 +0,0 @@ -package es.fdi.eventsoft.Negocio.Entidades; - -import es.fdi.eventsoft.Negocio.Entidades.Usuario.Cliente; -import es.fdi.eventsoft.Negocio.Entidades.Usuario.Organizador; -import org.hibernate.annotations.*; -import org.hibernate.validator.constraints.NotBlank; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.persistence.*; -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; -import javax.validation.constraints.Future; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -@Entity -@Table(name = "Eventos") -@NamedQueries({ - @NamedQuery(name = "Evento.buscarEventosPorUsuario", query = "from Evento e where e.cliente = :cliente") -}) -public class Evento implements Serializable { - - /**************************** - ********* ATRIBUTOS ******** - ****************************/ - - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id private Long id; - - @NotBlank - @Column(nullable = false) - private String nombre; - - @NotBlank - @Column(nullable = false) - private String descripcion; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(nullable = false) - private Cliente cliente; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(nullable = false) - private Organizador organizador; - - @Column(nullable = false) - private CategoriasEvento categoria; - - @NotBlank - @Column(nullable = false) - private String lugar; - - @Column(name = "Fecha_Inicio", nullable = false) - @DateTimeFormat(pattern="dd/MM/yyyy") - @NotNull - private Date fechaInicio; - - - @Column(name = "Fecha_Fin", nullable = false) - @DateTimeFormat(pattern="dd/MM/yyyy") - @NotNull @Future - private Date fechaFin; - - - @OneToMany(mappedBy = "evento", fetch = FetchType.LAZY, cascade = CascadeType.ALL) - @Cascade(org.hibernate.annotations.CascadeType.ALL) - private List eventoServicios; - - @Version long version; - - /**************************** - ******* CONSTRUCTORES ****** - ****************************/ - - public enum CategoriasEvento { - BODAS, - DESPEDIDAS, - BABY_SHOWER, - COMIDA_EMPRESA - } - - public Evento() {} - - public Evento(String nombre, String descripcion, Cliente cliente, Organizador organizador, CategoriasEvento categoria, String lugar, Date fechaInicio, Date fechaFin) { - this.nombre = nombre; - this.descripcion = descripcion; - this.cliente = cliente; - this.organizador = organizador; - this.categoria = categoria; - this.lugar = lugar; - this.fechaInicio = fechaInicio; - this.fechaFin = fechaFin; - } - - public Evento(String nombre, String descripcion, Cliente cliente, Organizador organizador, CategoriasEvento categoria, String lugar, Date fechaInicio, Date fechaFin, List eventoServicios) { - this.nombre = nombre; - this.descripcion = descripcion; - this.cliente = cliente; - this.organizador = organizador; - this.categoria = categoria; - this.lugar = lugar; - this.fechaInicio = fechaInicio; - this.fechaFin = fechaFin; - this.eventoServicios = eventoServicios; - } - - /**************************** - **** GETTERS AND SETTERS *** - ****************************/ - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getNombre() { - return nombre; - } - - public void setNombre(String nombre) { - this.nombre = nombre; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public Cliente getCliente() { - return cliente; - } - - public void setCliente(Cliente cliente) { - this.cliente = cliente; - } - - public Organizador getOrganizador() { - return organizador; - } - - public void setOrganizador(Organizador organizador) { - this.organizador = organizador; - } - - public CategoriasEvento getCategoria() { - return categoria; - } - - public void setCategoria(CategoriasEvento categoria) { - this.categoria = categoria; - } - - public String getLugar() { - return lugar; - } - - public void setLugar(String lugar) { - this.lugar = lugar; - } - - public Date getFechaInicio() { - return fechaInicio; - } - - public void setFechaInicio(Date fechaInicio) { - this.fechaInicio = fechaInicio; - } - - public Date getFechaFin() { - return fechaFin; - } - - public void setFechaFin(Date fechaFin) { - this.fechaFin = fechaFin; - } - - public List getEventoServicios() { - return eventoServicios; - } - - public void setEventoServicios(List eventoServicios) { - this.eventoServicios = eventoServicios; - } - - public void addEventoServicios(List eventoServicios) { - for (EventoServicio ev :eventoServicios){ - if(!this.eventoServicios.contains(ev)) { - this.eventoServicios.add(ev); - }else{ - System.out.println("eventosServicios ya contiene el servicio"); - } - } - } - - @Override - public String toString() { - return "Evento{" + - "id=" + id + - ", nombre='" + nombre + '\'' + - ", descripcion='" + descripcion + '\'' + - ", cliente=" + cliente + - ", organizador=" + organizador + - ", categoria=" + categoria + - ", lugar='" + lugar + '\'' + - ", fechaInicio=" + fechaInicio + - ", fechaFin=" + fechaFin + - '}'; - } -} diff --git a/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.LOCAL.4517.java b/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.LOCAL.4517.java deleted file mode 100644 index c602687..0000000 --- a/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.LOCAL.4517.java +++ /dev/null @@ -1,220 +0,0 @@ -package es.fdi.eventsoft.Negocio.Entidades; - -import es.fdi.eventsoft.Negocio.Entidades.Usuario.Cliente; -import es.fdi.eventsoft.Negocio.Entidades.Usuario.Organizador; -import org.hibernate.annotations.*; -import org.hibernate.validator.constraints.NotBlank; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.persistence.*; -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; -import javax.validation.constraints.Future; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -@Entity -@Table(name = "Eventos") -@NamedQueries({ - @NamedQuery(name = "Evento.buscarEventosPorUsuario", query = "from Evento e where e.cliente = :cliente") -}) -public class Evento implements Serializable { - - /**************************** - ********* ATRIBUTOS ******** - ****************************/ - - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id private Long id; - - @NotBlank - @Column(nullable = false) - private String nombre; - - @NotBlank - @Column(nullable = false) - private String descripcion; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(nullable = false) - private Cliente cliente; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(nullable = false) - private Organizador organizador; - - @Column(nullable = false) - private CategoriasEvento categoria; - - @NotBlank - @Column(nullable = false) - private String lugar; - - @Column(name = "Fecha_Inicio", nullable = false) - @DateTimeFormat(pattern="dd/MM/yyyy") - @NotNull - private Date fechaInicio; - - - @Column(name = "Fecha_Fin", nullable = false) - @DateTimeFormat(pattern="dd/MM/yyyy") - @NotNull @Future - private Date fechaFin; - - - @OneToMany(mappedBy = "evento", fetch = FetchType.LAZY, cascade = CascadeType.ALL) - @Cascade(org.hibernate.annotations.CascadeType.ALL) - private List eventoServicios; - - @Version long version; - - /**************************** - ******* CONSTRUCTORES ****** - ****************************/ - - public enum CategoriasEvento { - BODAS, - DESPEDIDAS, - BABY_SHOWER, - COMIDA_EMPRESA - } - - public Evento() {} - - public Evento(String nombre, String descripcion, Cliente cliente, Organizador organizador, CategoriasEvento categoria, String lugar, Date fechaInicio, Date fechaFin) { - this.nombre = nombre; - this.descripcion = descripcion; - this.cliente = cliente; - this.organizador = organizador; - this.categoria = categoria; - this.lugar = lugar; - this.fechaInicio = fechaInicio; - this.fechaFin = fechaFin; - } - - public Evento(String nombre, String descripcion, Cliente cliente, Organizador organizador, CategoriasEvento categoria, String lugar, Date fechaInicio, Date fechaFin, List eventoServicios) { - this.nombre = nombre; - this.descripcion = descripcion; - this.cliente = cliente; - this.organizador = organizador; - this.categoria = categoria; - this.lugar = lugar; - this.fechaInicio = fechaInicio; - this.fechaFin = fechaFin; - this.eventoServicios = eventoServicios; - } - - /**************************** - **** GETTERS AND SETTERS *** - ****************************/ - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getNombre() { - return nombre; - } - - public void setNombre(String nombre) { - this.nombre = nombre; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public Cliente getCliente() { - return cliente; - } - - public void setCliente(Cliente cliente) { - this.cliente = cliente; - } - - public Organizador getOrganizador() { - return organizador; - } - - public void setOrganizador(Organizador organizador) { - this.organizador = organizador; - } - - public CategoriasEvento getCategoria() { - return categoria; - } - - public void setCategoria(CategoriasEvento categoria) { - this.categoria = categoria; - } - - public String getLugar() { - return lugar; - } - - public void setLugar(String lugar) { - this.lugar = lugar; - } - - public Date getFechaInicio() { - return fechaInicio; - } - - public void setFechaInicio(Date fechaInicio) { - this.fechaInicio = fechaInicio; - } - - public Date getFechaFin() { - return fechaFin; - } - - public void setFechaFin(Date fechaFin) { - this.fechaFin = fechaFin; - } - - public List getEventoServicios() { - return eventoServicios; - } - - public void setEventoServicios(List eventoServicios) { - this.eventoServicios = eventoServicios; - } - - public void addEventoServicios(List eventoServicios) { - for (EventoServicio ev :eventoServicios){ - if(!this.eventoServicios.contains(ev)) { - this.eventoServicios.add(ev); - }else{ - System.out.println("eventosServicios ya contiene el servicio"); - } - } - } - - @Override - public String toString() { - return "Evento{" + - "id=" + id + - ", nombre='" + nombre + '\'' + - ", descripcion='" + descripcion + '\'' + - ", cliente=" + cliente + - ", organizador=" + organizador + - ", categoria=" + categoria + - ", lugar='" + lugar + '\'' + - ", fechaInicio=" + fechaInicio + - ", fechaFin=" + fechaFin + - '}'; - } -} diff --git a/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.REMOTE.4517.java b/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.REMOTE.4517.java deleted file mode 100644 index a75a21e..0000000 --- a/src/main/java/es/fdi/eventsoft/Negocio/Entidades/Evento.java.REMOTE.4517.java +++ /dev/null @@ -1,221 +0,0 @@ -package es.fdi.eventsoft.Negocio.Entidades; - -import es.fdi.eventsoft.Negocio.Entidades.Usuario.Cliente; -import es.fdi.eventsoft.Negocio.Entidades.Usuario.Organizador; -import org.hibernate.annotations.*; -import org.hibernate.validator.constraints.NotBlank; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.persistence.*; -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; -import javax.validation.constraints.Future; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -@Entity -@Table(name = "Eventos") -@NamedQueries({ - @NamedQuery(name = "Evento.buscarEventosPorUsuario", query = "from Evento e join fetch e.cliente join fetch e.organizador where e.cliente = :cliente"), - @NamedQuery(name = "Evento.buscarEventosPorUsuario_2", query = "from Evento e join fetch e.organizador join fetch e.cliente where e.organizador = :organizador") -}) -public class Evento implements Serializable { - - /**************************** - ********* ATRIBUTOS ******** - ****************************/ - - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id private Long id; - - @NotBlank - @Column(nullable = false) - private String nombre; - - @NotBlank - @Column(nullable = false) - private String descripcion; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(nullable = false) - private Cliente cliente; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(nullable = false) - private Organizador organizador; - - @Column(nullable = false) - private CategoriasEvento categoria; - - @NotBlank - @Column(nullable = false) - private String lugar; - - @Column(name = "Fecha_Inicio", nullable = false) - @DateTimeFormat(pattern="dd/MM/yyyy") - @NotNull - private Date fechaInicio; - - - @Column(name = "Fecha_Fin", nullable = false) - @DateTimeFormat(pattern="dd/MM/yyyy") - @NotNull @Future - private Date fechaFin; - - - @OneToMany(mappedBy = "evento", fetch = FetchType.LAZY, cascade = CascadeType.ALL) - @Cascade(org.hibernate.annotations.CascadeType.ALL) - private List eventoServicios; - - @Version long version; - - /**************************** - ******* CONSTRUCTORES ****** - ****************************/ - - public enum CategoriasEvento { - BODAS, - DESPEDIDAS, - BABY_SHOWER, - COMIDA_EMPRESA - } - - public Evento() {} - - public Evento(String nombre, String descripcion, Cliente cliente, Organizador organizador, CategoriasEvento categoria, String lugar, Date fechaInicio, Date fechaFin) { - this.nombre = nombre; - this.descripcion = descripcion; - this.cliente = cliente; - this.organizador = organizador; - this.categoria = categoria; - this.lugar = lugar; - this.fechaInicio = fechaInicio; - this.fechaFin = fechaFin; - } - - public Evento(String nombre, String descripcion, Cliente cliente, Organizador organizador, CategoriasEvento categoria, String lugar, Date fechaInicio, Date fechaFin, List eventoServicios) { - this.nombre = nombre; - this.descripcion = descripcion; - this.cliente = cliente; - this.organizador = organizador; - this.categoria = categoria; - this.lugar = lugar; - this.fechaInicio = fechaInicio; - this.fechaFin = fechaFin; - this.eventoServicios = eventoServicios; - } - - /**************************** - **** GETTERS AND SETTERS *** - ****************************/ - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getNombre() { - return nombre; - } - - public void setNombre(String nombre) { - this.nombre = nombre; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public Cliente getCliente() { - return cliente; - } - - public void setCliente(Cliente cliente) { - this.cliente = cliente; - } - - public Organizador getOrganizador() { - return organizador; - } - - public void setOrganizador(Organizador organizador) { - this.organizador = organizador; - } - - public CategoriasEvento getCategoria() { - return categoria; - } - - public void setCategoria(CategoriasEvento categoria) { - this.categoria = categoria; - } - - public String getLugar() { - return lugar; - } - - public void setLugar(String lugar) { - this.lugar = lugar; - } - - public Date getFechaInicio() { - return fechaInicio; - } - - public void setFechaInicio(Date fechaInicio) { - this.fechaInicio = fechaInicio; - } - - public Date getFechaFin() { - return fechaFin; - } - - public void setFechaFin(Date fechaFin) { - this.fechaFin = fechaFin; - } - - public List getEventoServicios() { - return eventoServicios; - } - - public void setEventoServicios(List eventoServicios) { - this.eventoServicios = eventoServicios; - } - - public void addEventoServicios(List eventoServicios) { - for (EventoServicio ev :eventoServicios){ - if(!this.eventoServicios.contains(ev)) { - this.eventoServicios.add(ev); - }else{ - System.out.println("eventosServicios ya contiene el servicio"); - } - } - } - - @Override - public String toString() { - return "Evento{" + - "id=" + id + - ", nombre='" + nombre + '\'' + - ", descripcion='" + descripcion + '\'' + - ", cliente=" + cliente + - ", organizador=" + organizador + - ", categoria=" + categoria + - ", lugar='" + lugar + '\'' + - ", fechaInicio=" + fechaInicio + - ", fechaFin=" + fechaFin + - '}'; - } -} diff --git a/src/main/java/es/fdi/eventsoft/Negocio/__tests/TestEmpleados.java b/src/main/java/es/fdi/eventsoft/Negocio/__tests/TestEmpleados.java index 53a7288..2a3d4a5 100644 --- a/src/main/java/es/fdi/eventsoft/Negocio/__tests/TestEmpleados.java +++ b/src/main/java/es/fdi/eventsoft/Negocio/__tests/TestEmpleados.java @@ -12,7 +12,6 @@ import es.fdi.eventsoft.Negocio.ServiciosAplicacion.Factoria_ServiciosAplicacion.FactoriaSA; import es.fdi.eventsoft.Negocio.ServiciosAplicacion.SA_Mensajes.SAMensajes; import es.fdi.eventsoft.Presentacion.Controllers.EventController; -import javafx.scene.input.Mnemonic; import javafx.util.Pair; import jdk.nashorn.internal.parser.JSONParser; import org.hibernate.cfg.annotations.PropertyBinder; diff --git a/src/main/java/javafx/util/Pair.java b/src/main/java/javafx/util/Pair.java new file mode 100644 index 0000000..221adfc --- /dev/null +++ b/src/main/java/javafx/util/Pair.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javafx.util; + +import java.io.Serializable; + +/** + *

A convenience class to represent name-value pairs.

+ * @since JavaFX 2.0 + */ +public class Pair implements Serializable{ + + /** + * Key of this Pair. + */ + private K key; + + /** + * Gets the key for this pair. + * @return key for this pair + */ + public K getKey() { return key; } + + /** + * Value of this this Pair. + */ + private V value; + + /** + * Gets the value for this pair. + * @return value for this pair + */ + public V getValue() { return value; } + + /** + * Creates a new pair + * @param key The key for this pair + * @param value The value to use for this pair + */ + public Pair(K key, V value) { + this.key = key; + this.value = value; + } + + /** + *

String representation of this + * Pair.

+ * + *

The default name/value delimiter '=' is always used.

+ * + * @return String representation of this Pair + */ + @Override + public String toString() { + return key + "=" + value; + } + + /** + *

Generate a hash code for this Pair.

+ * + *

The hash code is calculated using both the name and + * the value of the Pair.

+ * + * @return hash code for this Pair + */ + @Override + public int hashCode() { + // name's hashCode is multiplied by an arbitrary prime number (13) + // in order to make sure there is a difference in the hashCode between + // these two parameters: + // name: a value: aa + // name: aa value: a + return key.hashCode() * 13 + (value == null ? 0 : value.hashCode()); + } + + /** + *

Test this Pair for equality with another + * Object.

+ * + *

If the Object to be tested is not a + * Pair or is null, then this method + * returns false.

+ * + *

Two Pairs are considered equal if and only if + * both the names and values are equal.

+ * + * @param o the Object to test for + * equality with this Pair + * @return true if the given Object is + * equal to this Pair else false + */ + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof Pair) { + Pair pair = (Pair) o; + if (key != null ? !key.equals(pair.key) : pair.key != null) return false; + if (value != null ? !value.equals(pair.value) : pair.value != null) return false; + return true; + } + return false; + } +} + +