| Summary: | validate parameters | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Pico <mpicom> |
| Component: | BIRT | Assignee: | Ruo Yin <ruo.yin> |
| Status: | VERIFIED FIXED | QA Contact: | Xiaoying Gu <bluesoldier> |
| Severity: | normal | ||
| Priority: | P3 | CC: | bluesoldier, jouyang, mpicom |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | Obsolete | ||
|
Description
Pico
Actually, there is a log message telling the invalid parameter and its desired type.
Another way to locate invalid parameter is to check parameter values one by one.
For example:
task.setParameterValue( "p1", "v1");
task.validateParameterValues();
task.setParameterValue( "p2", "v2");
task.validateParameterValues();
Hi,
I know the log message but i`d need it at runtime to show to de user.
where is the method validateParametersValues() ?
I only know validateParameters() and if i use it to check parameters one to one, always give me false because it check all the parameters not only the parameter set.
In your example if p2 is required the first validateParameters return false although p1 is ok.
task.setParameterValue( "p1", "v1");
task.validateParameters(); ->> False because p2 is required and p1 is ok
task.setParameterValue( "p2", "v2");
task.validateParameters();
another way ?
Thanks a lot.
Oh, sorry, it's my typo, I mean validateParameters() by validateParameterValues(). There is no API to get detail result of validation at render time. We need to add a new method like: boolean validateParameters( boolean verbose ) throw EngineException; to throw exception with detail failure information. There are 2 workarounds for now: 1. In EngineTask, method doValidateParameters(), which does the actual validation, does throw out the exception. You can manage to create a dynamic proxy of the class and catch the exception. 2. If above solution is too tricky for you, you'd better use same logic in EngineTask to validate parameters by yourself. It's not difficult. After calling task.validateParameters, you can call task.getErrors() to retrieve the error Verified. |