polish
This commit is contained in:
@@ -17,6 +17,7 @@ import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.springframework.binding.message.MessageBuilder;
|
||||
import org.springframework.binding.message.MessageContext;
|
||||
import org.springframework.binding.validation.ValidationContext;
|
||||
|
||||
/**
|
||||
@@ -190,14 +191,13 @@ public class Booking implements Serializable {
|
||||
}
|
||||
|
||||
public void validateEnterBookingDetails(ValidationContext context) {
|
||||
context.getUserEvent();
|
||||
MessageContext messages = context.getMessageContext();
|
||||
if (checkinDate.before(today())) {
|
||||
context.getMessageContext().addMessage(
|
||||
new MessageBuilder().error().source("checkinDate").code("booking.checkinDate.beforeToday").build());
|
||||
messages.addMessage(new MessageBuilder().error().source("checkinDate").code(
|
||||
"booking.checkinDate.beforeToday").build());
|
||||
} else if (checkoutDate.before(checkinDate)) {
|
||||
context.getMessageContext().addMessage(
|
||||
new MessageBuilder().error().source("checkoutDate").code("booking.checkoutDate.beforeCheckinDate")
|
||||
.build());
|
||||
messages.addMessage(new MessageBuilder().error().source("checkoutDate").code(
|
||||
"booking.checkoutDate.beforeCheckinDate").build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.springframework.binding.message.MessageBuilder;
|
||||
import org.springframework.binding.message.MessageContext;
|
||||
import org.springframework.binding.validation.ValidationContext;
|
||||
|
||||
/**
|
||||
@@ -189,13 +190,13 @@ public class Booking implements Serializable {
|
||||
}
|
||||
|
||||
public void validateEnterBookingDetails(ValidationContext context) {
|
||||
MessageContext messages = context.getMessageContext();
|
||||
if (checkinDate.before(today())) {
|
||||
context.getMessageContext().addMessage(
|
||||
new MessageBuilder().error().source("checkinDate").code("booking.checkinDate.beforeToday").build());
|
||||
messages.addMessage(new MessageBuilder().error().source("checkinDate").code(
|
||||
"booking.checkinDate.beforeToday").build());
|
||||
} else if (checkoutDate.before(checkinDate)) {
|
||||
context.getMessageContext().addMessage(
|
||||
new MessageBuilder().error().source("checkoutDate").code("booking.checkoutDate.beforeCheckinDate")
|
||||
.build());
|
||||
messages.addMessage(new MessageBuilder().error().source("checkoutDate").code(
|
||||
"booking.checkoutDate.beforeCheckinDate").build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public abstract class AbstractMvcView implements View {
|
||||
|
||||
/**
|
||||
* Sets the configuration describing how this view should bind to its model to access data for rendering.
|
||||
* @param binderModel the model binder configuratio
|
||||
* @param binderConfiguration the model binder configuration
|
||||
*/
|
||||
public void setBinderConfiguration(BinderConfiguration binderConfiguration) {
|
||||
this.binderConfiguration = binderConfiguration;
|
||||
|
||||
Reference in New Issue
Block a user