Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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");

info.setSeverity(IProcessReport.WARNING);
collector.addInfo(info);


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.

0 votes



3 answers

Permanent link
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");

info.setSeverity(IProcessReport.WARNING);
collector.addInfo(info);


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.


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

0 votes


Permanent link
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.

0 votes


Permanent link
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?


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

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Jun 06 '11, 1:10 p.m.

Question was seen: 5,341 times

Last updated: Jun 06 '11, 1:10 p.m.

Confirmation Cancel Confirm