Using Warning on precondition
Hi,
I was looking on how to set Warning on my precondition extension. I'm able to set a warning using the following snippet: IAdvisorInfo info = collector.createProblemInfo("WARNING", "FINTO", "finto"); It works well but I've a question: it is possible to switch eclipse view to Team Advisor as for the problems? In this case the warning it's ok, but if I don't go to team advisor I could not view it. Is it possible? Thanks, Michele. |
3 answers
Jared Burns (4.5k●2●9)
| answered Jun 07 '11, 2:58 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Hi, Hi, Michele. As the JavaDoc on IReportInfo#setSeverity(...) indicates, you shouldn't set the severity of your info objects. Although it is regrettably exposed in the API, conceptually it never makes sense to report warnings from preconditions. The model for preconditions is that you create a "problem info" to report a problem. If the end-user wants this problem to only be a warning, they can configure the precondition to be overruleable. In this way, when your problem is reported, the operation will be stopped, the user will receive feedback in the Team Advisor, and they will have a chance to correct the problem. I don't recall why the setSeverity(...) method was even exposed on IReportInfo. Given the confusion it can cause, we should probably deprecate it. - Jared |
Hi Jared,
thank you for the answer. I understand this point of view, so if I want an alert I have to put it into a follow-up extension. Because a warning does not stop the execution. But if I have all my logic put into pre-condition and for a specific case of this logic I don't want to get an error but only a warning how do I have to do? Do I have to duplicate all the logic both in pre-condition and follow-up? Thanks, Michele. |
Jared Burns (4.5k●2●9)
| answered Jun 17 '11, 2:24 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER I understand this point of view, so if I want an alert I have to put it into a follow-up extension. Because a warning does not stop the execution. Without knowing more details of your use-case, my answer would be that if you want to show an alert, you should put your logic in a precondition. Your users can then choose whether this alert is a real blocker or just a warning by configuring your precondition as overrulable or not. Maybe it would help if you could elaborate on the type of check you want to perform? - Jared |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.