You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "David Vittor (JIRA)" <ji...@apache.org> on 2014/08/29 14:22:53 UTC

[jira] [Resolved] (JSPWIKI-864) ValidationManager added to WikiEngine

     [ https://issues.apache.org/jira/browse/JSPWIKI-864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Vittor resolved JSPWIKI-864.
----------------------------------

    Resolution: Not a Problem

I've just realized what Glen was saying, when we include the core jspwiki-war classes into our projects, we automatically get access to commons-validator.

Hence this task is a non issue. Resolving.

> ValidationManager added to WikiEngine
> -------------------------------------
>
>                 Key: JSPWIKI-864
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-864
>             Project: JSPWiki
>          Issue Type: Wish
>          Components: Core & storage
>            Reporter: David Vittor
>            Priority: Minor
>
> Here is another idea. When I write plugins, I spend a lot of time writing code to make sure that the parameters passed into the plugins are valid. Things such as strings, booleans, numbers, urls, emails addresses, etc.
> I was thinking if we could create a ValidationManager class that could take a List of "Validators (interface)" and pass values for validation.
> The two main interface method of a Validator would be:
> * void validate(String value, String type) throws InvalidValueException;
> * void validate(String value, String type, boolean required) throws InvalidValueException;
> ** Note: by default "required" would be false.
> The type would be a static int TYPE_EMAIL, TYPE_STRING, etc. defined in the ValidationManager.
> The ValidationManager, would have property:
> * List<Validator> validators;
> and methods:
> * void addValidator(Validator v);
> * Validator removeValidator(Validator v);
> * List <Validator> getValidators();
> This would be very beneficial for all plugin developers, cause then they can call:
> * wikiContent.getValidationManager().validate(params.get('url'),ValidationManager.TYPE_URL);
> And they don't need a try catch, as the user will be told exactly what the error was. If all parameters are valid, the plugin can continue to do it's work.



--
This message was sent by Atlassian JIRA
(v6.2#6252)