perform client activation date validation with office activation date
before creation.
This commit is contained in:
+4
@@ -217,4 +217,8 @@ public class Office extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBefore(final Date baseDate) {
|
||||||
|
return this.openingDate.before(baseDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+11
-1
@@ -356,7 +356,17 @@ public final class Client extends AbstractPersistable<Long> {
|
|||||||
baseDataValidator.reset().parameter("middlename").value(this.middlename).ignoreIfNull().notExceedingLengthOf(50);
|
baseDataValidator.reset().parameter("middlename").value(this.middlename).ignoreIfNull().notExceedingLengthOf(50);
|
||||||
baseDataValidator.reset().parameter("lastname").value(this.lastname).notBlank().notExceedingLengthOf(50);
|
baseDataValidator.reset().parameter("lastname").value(this.lastname).notBlank().notExceedingLengthOf(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.activationDate!=null)
|
||||||
|
{
|
||||||
|
if(!office.isBefore(this.activationDate)){
|
||||||
|
final String defaultUserMessage = "Client activation date cannot be a date before the Office activation date";
|
||||||
|
final ApiParameterError error = ApiParameterError.parameterError("error.msg.clients.activationDate.cannot.be.before.Office.activatoin.date",
|
||||||
|
defaultUserMessage, "activationDate", this.activationDate);
|
||||||
|
dataValidationErrors.add(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
|
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
|
||||||
"Validation errors exist.", dataValidationErrors); }
|
"Validation errors exist.", dataValidationErrors); }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user