Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/states/DefaultState.java @ 8636:7d1a32a543cb
(issue1755) Extend validation to allow localized error messages.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 27 Mar 2015 16:54:56 +0100 |
parents | 054d1b57ae4a |
children | 2323d005f9a5 0a5239a1e46e |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DefaultState.java Fri Mar 27 14:39:01 2015 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DefaultState.java Fri Mar 27 16:54:56 2015 +0100 @@ -419,13 +419,20 @@ } + /** Override this to do validation. + * + * Throw an IllegalArgumentException with a localized + * error message that should be presented to the user in case + * the date provided is invalid. */ + public void validate(Artifact artifact, CallContext context) + throws IllegalArgumentException { + validate(artifact); /* For compatibility so that classes that + override this method still work. */ + } /** - * This method validates the inserted data and returns true, if everything - * was correct, otherwise an exception is thrown. - * - * @param artifact A reference to the owner artifact. - * - * @return true, if everything was fine. + * This method is deprecated. + * Override the function with the callcontext instead to do + * localization of error.s */ public boolean validate(Artifact artifact) throws IllegalArgumentException