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 05d66a688..6f250737d 100644
--- a/src/main/java/org/springframework/cheapy/model/NuOffer.java
+++ b/src/main/java/org/springframework/cheapy/model/NuOffer.java
@@ -1,49 +1,44 @@
-/*
- * 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.Min;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "nu_offers")
public class NuOffer extends Offer {
- @NotBlank
- private Integer gold;
+ //Oferta por numero de comensales
+ private static final long serialVersionUID = 1L;
+
+ @NotNull
+ @Min(1)
+ private Integer gold;
@Column(name = "discount_gold")
- @NotBlank
- private String discountGold;
+ @NotNull
+ @Min(0)
+ private Integer discountGold;
- @NotBlank
- private Integer silver;
+ @NotNull
+ @Min(1)
+ private Integer silver;
@Column(name = "discount_silver")
- @NotBlank
- private String discountSilver;
+ @NotNull
+ @Min(0)
+ private Integer discountSilver;
- @NotBlank
- private Integer bronze;
+ @NotNull
+ @Min(1)
+ private Integer bronze;
@Column(name = "discount_bronze")
- @NotBlank
- private String discountBronze;
+ @NotNull
+ @Min(0)
+ private Integer discountBronze;
public Integer getGold() {
return gold;
@@ -53,11 +48,11 @@ public class NuOffer extends Offer {
this.gold = gold;
}
- public String getDiscountGold() {
+ public Integer getDiscountGold() {
return discountGold;
}
- public void setDiscountGold(String discountGold) {
+ public void setDiscountGold(Integer discountGold) {
this.discountGold = discountGold;
}
@@ -69,11 +64,11 @@ public class NuOffer extends Offer {
this.silver = silver;
}
- public String getDiscountSilver() {
+ public Integer getDiscountSilver() {
return discountSilver;
}
- public void setDiscountSilver(String discountSilver) {
+ public void setDiscountSilver(Integer discountSilver) {
this.discountSilver = discountSilver;
}
@@ -85,12 +80,12 @@ public class NuOffer extends Offer {
this.bronze = bronze;
}
- public String getDiscountBronze() {
+ public Integer getDiscountBronze() {
return discountBronze;
}
- public void setDiscountBronze(String discountBronze) {
+ public void setDiscountBronze(Integer discountBronze) {
this.discountBronze = discountBronze;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/springframework/cheapy/model/Offer.java b/src/main/java/org/springframework/cheapy/model/Offer.java
index 4c3921b1b..5ae64feba 100644
--- a/src/main/java/org/springframework/cheapy/model/Offer.java
+++ b/src/main/java/org/springframework/cheapy/model/Offer.java
@@ -17,39 +17,40 @@ 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 {
+ 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;
-
+ private StatusOffer status;
+
@ManyToOne
- @JoinColumn(name="client_id")
+ @JoinColumn(name = "client_id")
private Client client;
public LocalDateTime getStart() {
@@ -76,12 +77,20 @@ public class Offer extends BaseEntity {
this.code = code;
}
- public StatusOffer getType() {
- return type;
+ public StatusOffer getStatus() {
+ return status;
}
- public void setType(StatusOffer type) {
- this.type = type;
+ public void setStatus(StatusOffer type) {
+ this.status = 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 0399d4baf..84b551829 100644
--- a/src/main/java/org/springframework/cheapy/model/SpeedOffer.java
+++ b/src/main/java/org/springframework/cheapy/model/SpeedOffer.java
@@ -1,49 +1,44 @@
-/*
- * 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.Min;
+import javax.validation.constraints.NotNull;
@Entity
@Table(name = "speed_offers")
public class SpeedOffer extends Offer {
- @NotBlank
- private Integer gold; // x minutos
+ // Ofertar por rapidez comiendo
+ private static final long serialVersionUID = 1L;
+
+ @NotNull
+ @Min(0)
+ private Integer gold;
@Column(name = "discount_gold")
- @NotBlank
- private String discountGold;
+ @NotNull
+ @Min(0)
+ private Integer discountGold;
- @NotBlank
+ @NotNull
+ @Min(0)
private Integer silver;
@Column(name = "discount_silver")
- @NotBlank
- private String discountSilver;
+ @NotNull
+ @Min(0)
+ private Integer discountSilver;
- @NotBlank
+ @NotNull
+ @Min(0)
private Integer bronze;
@Column(name = "discount_bronze")
- @NotBlank
- private String discountBronze;
+ @NotNull
+ @Min(0)
+ private Integer discountBronze;
public Integer getGold() {
return gold;
@@ -53,11 +48,11 @@ public class SpeedOffer extends Offer {
this.gold = gold;
}
- public String getDiscountGold() {
+ public Integer getDiscountGold() {
return discountGold;
}
- public void setDiscountGold(String discountGold) {
+ public void setDiscountGold(Integer discountGold) {
this.discountGold = discountGold;
}
@@ -69,11 +64,11 @@ public class SpeedOffer extends Offer {
this.silver = silver;
}
- public String getDiscountSilver() {
+ public Integer getDiscountSilver() {
return discountSilver;
}
- public void setDiscountSilver(String discountSilver) {
+ public void setDiscountSilver(Integer discountSilver) {
this.discountSilver = discountSilver;
}
@@ -85,12 +80,12 @@ public class SpeedOffer extends Offer {
this.bronze = bronze;
}
- public String getDiscountBronze() {
+ public Integer getDiscountBronze() {
return discountBronze;
}
- public void setDiscountBronze(String discountBronze) {
+ public void setDiscountBronze(Integer discountBronze) {
this.discountBronze = discountBronze;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/springframework/cheapy/model/TimeOffer.java b/src/main/java/org/springframework/cheapy/model/TimeOffer.java
index 7f1d3cc6d..44ae5e3d6 100644
--- a/src/main/java/org/springframework/cheapy/model/TimeOffer.java
+++ b/src/main/java/org/springframework/cheapy/model/TimeOffer.java
@@ -1,27 +1,10 @@
-/*
- * 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;
@@ -29,24 +12,42 @@ import org.springframework.format.annotation.DateTimeFormat;
@Table(name = "time_offers")
public class TimeOffer extends Offer {
+ 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;
+ @NotNull
+ private Integer discount;
+ public LocalTime getInit() {
+ return init;
+ }
+ public void setInit(LocalTime init) {
+ this.init = init;
+ }
- public String getDiscount() {
+ public LocalTime getFinish() {
+ return finish;
+ }
+
+ public void setFinish(LocalTime finish) {
+ this.finish = finish;
+ }
+
+ public Integer getDiscount() {
return discount;
}
- public void setDiscount(String discount) {
+ public void setDiscount(Integer discount) {
this.discount = discount;
}
diff --git a/src/main/java/org/springframework/cheapy/model/User.java b/src/main/java/org/springframework/cheapy/model/User.java
index 36d495444..e9c232562 100644
--- a/src/main/java/org/springframework/cheapy/model/User.java
+++ b/src/main/java/org/springframework/cheapy/model/User.java
@@ -1,23 +1,12 @@
package org.springframework.cheapy.model;
-import java.util.List;
-import java.util.Set;
-
-import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
-import javax.persistence.MappedSuperclass;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
import javax.persistence.Table;
-import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
-//@Entity
-//@Table(name = "users")
-@MappedSuperclass
+@Entity
+@Table(name = "users")
public class User{
@Id
@@ -27,7 +16,8 @@ public class User{
private String password;
boolean enabled;
-
+
+ private static final long serialVersionUID = 1L;
public String getUsername() {
@@ -46,11 +36,4 @@ public class User{
this.password = password;
}
-// public Set${exception.message}
+ +${exception.message}
- -Invalid username or password
+Meta bronce | +|
---|---|
+ | |||
---|---|---|---|
+ |
+
+ |
+
+ |
+
+
+
+
+ |
+
+
+ + | ||
---|---|---|
+ |
+
+ |
+
+
+
+
+ |
+
+ + | ||
---|---|---|
+ |
+
+ |
+
+
+
+
+ |
+
+
+ | ||
---|---|---|
+ |
+
+ |
+
+
+
+
+ |
+