BaseEntity
. Used as
- * a base class for objects needing these properties.
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- */
@MappedSuperclass
public class NamedEntity extends BaseEntity {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
@Column(name = "name")
private String name;
diff --git a/src/main/java/org/springframework/cheapy/model/NuOffer.java b/src/main/java/org/springframework/cheapy/model/NuOffer.java
index 25ebce674..5a52a5756 100644
--- a/src/main/java/org/springframework/cheapy/model/NuOffer.java
+++ b/src/main/java/org/springframework/cheapy/model/NuOffer.java
@@ -1,44 +1,35 @@
-/*
- * Copyright 2012-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
package org.springframework.cheapy.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "nu_offers")
public class NuOffer extends Offer {
-//Oferta por numero de comensales
- @NotBlank
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ @NotNull
private Integer gold;
@Column(name = "discount_gold")
@NotBlank
private String discountGold;
- @NotBlank
+ @NotNull
private Integer silver;
@Column(name = "discount_silver")
@NotBlank
private String discountSilver;
- @NotBlank
+ @NotNull
private Integer bronze;
@Column(name = "discount_bronze")
diff --git a/src/main/java/org/springframework/cheapy/model/Offer.java b/src/main/java/org/springframework/cheapy/model/Offer.java
index 0e6d23f18..c41ca9040 100644
--- a/src/main/java/org/springframework/cheapy/model/Offer.java
+++ b/src/main/java/org/springframework/cheapy/model/Offer.java
@@ -17,37 +17,42 @@ package org.springframework.cheapy.model;
import java.time.LocalDateTime;
-import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
-import javax.persistence.Table;
import javax.validation.constraints.Future;
-import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat;
@MappedSuperclass
public class Offer extends BaseEntity {
-//Clase padre
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ //Clase padre
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
- @NotBlank
+ @NotNull
@Future
private LocalDateTime start;
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
- @NotBlank
+ @NotNull
@Future
private LocalDateTime end;
- @NotBlank
+
private String code;
@Enumerated(value = EnumType.STRING)
private StatusOffer type;
+
@ManyToOne
@JoinColumn(name="client_id")
private Client client;
@@ -83,5 +88,13 @@ public class Offer extends BaseEntity {
public void setType(StatusOffer type) {
this.type = type;
}
+
+ public Client getClient() {
+ return client;
+ }
+
+ public void setClient(Client client) {
+ this.client = client;
+ }
}
diff --git a/src/main/java/org/springframework/cheapy/model/Owner.java b/src/main/java/org/springframework/cheapy/model/Owner.java
index 792f42753..7a04f3434 100644
--- a/src/main/java/org/springframework/cheapy/model/Owner.java
+++ b/src/main/java/org/springframework/cheapy/model/Owner.java
@@ -1,50 +1,22 @@
-/*
- * Copyright 2012-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
package org.springframework.cheapy.model;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
-import org.springframework.beans.support.MutableSortDefinition;
-import org.springframework.beans.support.PropertyComparator;
import org.springframework.core.style.ToStringCreator;
-/**
- * Simple JavaBean domain object representing an owner.
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Michael Isvy
- */
@Entity
@Table(name = "owners")
public class Owner extends Person {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
@Column(name = "address")
@NotEmpty
private String address;
diff --git a/src/main/java/org/springframework/cheapy/model/Person.java b/src/main/java/org/springframework/cheapy/model/Person.java
index 7e8d87c0c..8758455db 100644
--- a/src/main/java/org/springframework/cheapy/model/Person.java
+++ b/src/main/java/org/springframework/cheapy/model/Person.java
@@ -1,32 +1,17 @@
-/*
- * Copyright 2012-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
package org.springframework.cheapy.model;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.NotEmpty;
-/**
- * Simple JavaBean domain object representing an person.
- *
- * @author Ken Krebs
- */
@MappedSuperclass
public class Person extends BaseEntity {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
@Column(name = "first_name")
@NotEmpty
private String firstName;
diff --git a/src/main/java/org/springframework/cheapy/model/SpeedOffer.java b/src/main/java/org/springframework/cheapy/model/SpeedOffer.java
index 71e32ae3e..0ef65d7a2 100644
--- a/src/main/java/org/springframework/cheapy/model/SpeedOffer.java
+++ b/src/main/java/org/springframework/cheapy/model/SpeedOffer.java
@@ -1,44 +1,35 @@
-/*
- * Copyright 2012-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
package org.springframework.cheapy.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "speed_offers")
public class SpeedOffer extends Offer {
-//Ofertar por rapidez comiendo
- @NotBlank
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ @NotNull
private Integer gold; // x minutos
@Column(name = "discount_gold")
@NotBlank
private String discountGold;
- @NotBlank
+ @NotNull
private Integer silver;
@Column(name = "discount_silver")
@NotBlank
private String discountSilver;
- @NotBlank
+ @NotNull
private Integer bronze;
@Column(name = "discount_bronze")
diff --git a/src/main/java/org/springframework/cheapy/model/TimeOffer.java b/src/main/java/org/springframework/cheapy/model/TimeOffer.java
index ceefc371e..d9833e0c8 100644
--- a/src/main/java/org/springframework/cheapy/model/TimeOffer.java
+++ b/src/main/java/org/springframework/cheapy/model/TimeOffer.java
@@ -1,46 +1,50 @@
-/*
- * Copyright 2012-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
package org.springframework.cheapy.model;
-import java.time.LocalDateTime;
import java.time.LocalTime;
import javax.persistence.Entity;
import javax.persistence.Table;
-import javax.validation.constraints.Future;
import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
@Table(name = "time_offers")
public class TimeOffer extends Offer {
-//Oferta por franja horaria
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ //Oferta por franja horaria
@DateTimeFormat(pattern = "HH:mm")
- @NotBlank
+ @NotNull
private LocalTime init;
@DateTimeFormat(pattern = "HH:mm")
- @NotBlank
+ @NotNull
private LocalTime finish;
@NotBlank
private String discount;
+ public LocalTime getInit() {
+ return init;
+ }
+ public void setInit(LocalTime init) {
+ this.init = init;
+ }
+
+ public LocalTime getFinish() {
+ return finish;
+ }
+
+ public void setFinish(LocalTime finish) {
+ this.finish = finish;
+ }
public String getDiscount() {
return discount;
diff --git a/src/main/java/org/springframework/cheapy/model/User.java b/src/main/java/org/springframework/cheapy/model/User.java
index 7cfc346d1..bd5b2dd30 100644
--- a/src/main/java/org/springframework/cheapy/model/User.java
+++ b/src/main/java/org/springframework/cheapy/model/User.java
@@ -1,8 +1,9 @@
package org.springframework.cheapy.model;
-import javax.persistence.JoinColumn;
-import javax.persistence.MappedSuperclass;
-import javax.persistence.OneToOne;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
@Entity
@Table(name = "users")
diff --git a/src/main/java/org/springframework/cheapy/model/Usuario.java b/src/main/java/org/springframework/cheapy/model/Usuario.java
index f6204abeb..9079bc72e 100644
--- a/src/main/java/org/springframework/cheapy/model/Usuario.java
+++ b/src/main/java/org/springframework/cheapy/model/Usuario.java
@@ -1,12 +1,8 @@
package org.springframework.cheapy.model;
-import java.util.Set;
-
import javax.persistence.CascadeType;
import javax.persistence.Entity;
-import javax.persistence.Id;
import javax.persistence.JoinColumn;
-import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.Email;
diff --git a/src/main/java/org/springframework/cheapy/model/package-info.java b/src/main/java/org/springframework/cheapy/model/package-info.java
index 620e13c68..1bc54373f 100644
--- a/src/main/java/org/springframework/cheapy/model/package-info.java
+++ b/src/main/java/org/springframework/cheapy/model/package-info.java
@@ -1,20 +1 @@
-/*
- * Copyright 2012-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * The classes in this package represent utilities used by the domain.
- */
package org.springframework.cheapy.model;
diff --git a/src/main/java/org/springframework/cheapy/repository/AuthoritiesRepository.java b/src/main/java/org/springframework/cheapy/repository/AuthoritiesRepository.java
index a8adee7f7..8d5f6317c 100644
--- a/src/main/java/org/springframework/cheapy/repository/AuthoritiesRepository.java
+++ b/src/main/java/org/springframework/cheapy/repository/AuthoritiesRepository.java
@@ -2,8 +2,6 @@ package org.springframework.cheapy.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.cheapy.model.Authorities;
-import org.springframework.cheapy.model.User;
-
public interface AuthoritiesRepository extends CrudRepositoryOwner
domain objects All method names are compliant
- * with Spring Data naming conventions so this interface can easily be extended for Spring
- * Data. See:
- * https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-creation
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Michael Isvy
- */
public interface FoodOfferRepository extends RepositoryOwner
domain objects All method names are compliant
- * with Spring Data naming conventions so this interface can easily be extended for Spring
- * Data. See:
- * https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-creation
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Michael Isvy
- */
public interface NuOfferRepository extends RepositoryOwner
domain objects All method names are compliant
- * with Spring Data naming conventions so this interface can easily be extended for Spring
- * Data. See:
- * https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-creation
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Michael Isvy
- */
public interface SpeedOfferRepository extends RepositoryOwner
domain objects All method names are compliant
- * with Spring Data naming conventions so this interface can easily be extended for Spring
- * Data. See:
- * https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-creation
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Michael Isvy
- */
public interface TimeOfferRepository extends Repository