It's all about the answers!

Ask a question

How to extend the precondtion that validate the owner doesn't belong to team area before save workitem on RTC


chen fengmiao (7032832) | asked Mar 21 '14, 9:11 a.m.
edited Mar 21 '14, 10:51 a.m. by Ralph Schoon (61.4k33643)
I hope to extend the save workitem procondition that validate the owner doesn't belong to team area. if  the owner does not belong to the team area,the workitem don't save success.
We use RTC4.0.6 version.
Where can I find this API?
Has any example  like it?
please help me ! Thank you very much!

Accepted answer


permanent link
Ralph Schoon (61.4k33643) | answered Mar 21 '14, 9:57 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Chen, you will have to write that yourself.

There are various examples for this kind of API on https://rsjazz.wordpress.com/ most of the posts there are based on examples on Jazz.net https://rsjazz.wordpress.com/interesting-links/ for more. For development you should look into https://jazz.net/library/article/1000. Currently that works only for RTC 4.0. It is in the progress of being updated to make it usable for other RTC versions. I am not sure however, when we will get it on the web site.

https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ contains common API you would be interested in.

Most examples on the blog are follow up actions. The difference between an advisor and a follow up action is the extension point as described in https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/

Good luck.



 
chen fengmiao selected this answer as the correct answer

Comments
chen fengmiao commented Mar 21 '14, 10:04 a.m.

Thank you Ralph,I will try to read the examples on rsjazz.wordpress.com .


chen fengmiao commented Mar 21 '14, 10:16 a.m.

Hi,Ralph. I don' t find the API: which team area does the owner  belong to on workitem?


Ralph Schoon commented Mar 21 '14, 10:35 a.m. | edited Mar 21 '14, 10:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Chen, the team area the work item belongs to can be found using the category.
To understand what team area and what role a user has, have a look at https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ the method SampleCurrentUserHasRoleCondition can give you some hints. Also interesting API (but client API) is described in https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/ . To understand what you are up to if you want to do this, start reading here: https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/


Ralph Schoon commented Mar 21 '14, 10:50 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Not sure right now, if using permissions would be easier. If the user is not member of the team area, what role does he have? Prevent "Everyone" from saving the work item?
I would try that first. I am currently not completely sure if users that are member of the project or parent project areas have. See https://jazz.net/library/article/291


chen fengmiao commented Mar 21 '14, 11:20 a.m.

Hi Ralph,on fact  I want to make these warning message to the error message ,prevent the user save the work item if appear this error message , I have to extend the procondition?




Ralph Schoon commented Mar 21 '14, 11:42 a.m. | edited Mar 21 '14, 11:43 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This has nothing to do with a precondition. I am not sure how this is implemented. It might be a validator. I think it is built in and not configurable. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization to understand validators. JavaScript however would not allow you to do this either, due to its API limitations. An option would possibly be a java based validator as described in https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ . This would work for the Web UI and the Eclipse UI. An advisor/precondition would only prevent the save and not show an error.

Permissions would also just prevent the save.   


chen fengmiao commented Mar 21 '14, 12:06 p.m.

Thank you for Ralph's answer . you mention the suggest "Permissions would also just prevent the save."   it see https://jazz.net/library/article/291  ?


Ralph Schoon commented Mar 21 '14, 12:11 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Have you opened the link? It describes how permissions work.


chen fengmiao commented Mar 21 '14, 12:21 p.m.

Hi Ralph, I can open the link. I readed this article ,but I don't what can I ?


Ralph Schoon commented Mar 24 '14, 4:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am not aware of any way to achieve the change you desire - making the warning an error in the display. There are only the following ways I am aware:

  • Use permissions - only users with certain roles in the team area (which requires to be member of the team, except for the Everyone role)
  • Extend RTC with a Java based validator that checks the condition and returns the error AND using the operational behavior Attribute Validation (should give you exactly what you ask for) - I checked and the mechanism above showing the icon
  • Extend RTC and create an advisor/precondition that prevents saving

What you see above is configured this way:

and shows in the presentation editor like this:

And I am not aware you can change this to error.


showing 5 of 10 show 5 more comments

Your answer


Register or to post your answer.