It's all about the answers!

Ask a question

how to get currentUser and set attribute value by Java Plain API


guoping chen (191014) | asked Nov 19 '13, 8:46 p.m.
I use RTC
firstly,I using scripts for attribute customization in work item to validate something. but i don't get current user in script.
secondly,Then I refer the helloworldadvisor example and create it in local machine.
example URL:
https://jazz.net/library/article/495
Rational Team Concert - Creating Custom Operation Advisors

add the following code into HelloWorldProhibitSave.java.
IContributor iContributor = iTeamRepository.loggedInContributor() ;
IContributorHandle iContributorHandle = auditableCommon.getUser();

but compile error,the following class did not find.
iTeamRepository,auditableCommon

how to resovle it?

thirdly,if compile is ok, how to set a attribute value by java API.
Thanks

One answer



permanent link
Ralph Schoon (61.4k33643) | answered Nov 20 '13, 2:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
As this is not a trivial topic, plan some time to educate yourself on this. Start here and follow the linked articles to get started on setting this up: https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/

Understand the differences in the APIs. E.g. the article above refers to an advisor, which basically is a client or a server side extension. These extensions usually don't use the ITeamRepository object, but you can get the loggedInUser from the AbstractService they extend.

For setting attributes look into https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ and search the blog for attributes.

If you are in China, where Wordpress is blocked, drop me an e-mail at ralph.schoon@de.ibm.com and I can send you some downloads of the articles. I know there are users in china who know how to get around the block as well.



Comments
guoping chen commented Nov 21 '13, 9:12 p.m.

Dear Ralph Schoon,

Thanks for your answer.
As you know, some articles URL is blocked in China. Could you kindly send me some materials about RTC Development articles in Java Plain API .(I had send mail to you)

By the way, Could I use the following development environment in local machine.
server: RTC ver4.0.4
client: RTC ver4.0.1
Plain java: ver4.0.1
sdk:ver4.0.1

I am a quesion about sdk version. Could I use the sdk 4.0.4 in RTC Client 4.0.1?
server,client,PlainJava,SDK---->all version must be same?


guoping chen commented Nov 21 '13, 10:26 p.m.

Dear Ralph Schoon,
I want to realize the following functions:
1.Create a workitem type
2.Create two custom attributes to the new workitem type
 .timestamp
 .contibutor
3.when the workitem is saved,
if workflow state's value is from s1 to s2,automatically set the value to the two custome attributes.
    .timestamp(value is now date)
    .contibutor(value is the CurrentUser)
Now I have the following problems(in step3).
first,I used javascript to complete the function(set value).
set date value is ok,but set contibutor is NG(because can not get the currentUser)

I research the jazznet articles.
 I found that
Process Configuration-->>Team Configuration-->>Operation Behavior-->>Save Work Item (server)-->> Preconditions-->>Implied Properties,when workitem is saved, the currentUser value is set to the owner.

so I want to use java.
I try to create a new Precondition,but I lack of these knowledge.
Can you help me with this or tell me if any of mentioned functionalities are supported?


Ralph Schoon commented Nov 25 '13, 2:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Most of the code is on https://rsjazz.wordpress.com/

Your answer


Register or to post your answer.