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

Programmatic Creation of Work Items guide for RTC 4.0.x

 Hi community,

I just started using the RTC Java client API. I successfully searched for a work item and did some modification. But I stuck created a new work item.
I have used the following guide to try to create a new work item, but I think some code in there is outdated.

Is there a newer version of this guide or something similar?

Thanks in advance for your help :-)

0 votes


Accepted answer

Permanent link
Please have a look at http://rsjazz.wordpress.com/ there should be several examples there. Follow http://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ . However  https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation has always worked for me.
Lukas Steiger selected this answer as the correct answer

0 votes

Comments

 Hi  Ralph


Thanks for your answer :-) 
I already came across you blog and have used your guide for setup and to find out how to search work items and modify them through the API. 

The code line from the ProgrammaticWorkItemCreation article which I have troubles with is the following:
WorkItemInitialization operation = new WorkItemInitialization(summary, category);
I get the following error: WorkItemInitialization cannot be resolved to a type

Unfortunately, I couldn't find out if the type WorkItemInitialization is still available in the 4.0.4 API. Do you know something about that?

If you search, with the browser on ProgrammaticWorkItemCreation for WorkitemInitialization, you will find that this is an inner class you have to create so that it does what you want.

    private static class WorkItemInitialization extends WorkItemOperation {

    private String fSummary;

    public WorkItemInitialization(String summary) {
        super("Initializing Work Item", IWorkItem.FULL_PROFILE);
        fSummary= summary;
    }

    @Override
    protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException {
        IWorkItem workItem= workingCopy.getWorkItem();
        workItem.setHTMLSummary(XMLString.createFromPlainText(fSummary));
    }

    @Override
    protected void commit(WorkItemWorkingCopy[] workingCopies, IProgressMonitor monitor) throws TeamRepositoryException {
    }
}


You would code the class that needs to extend WorkItemOperation in a way you want it to behave. Update or create a work item.

If you grab an example from my blog or the Wiki, make sure to fully understand the example and make it work before you try our own enhancements.

EDIT: You were faster, thank you :-)

Nevermind, I just found out that this was a handmade class, Should have searched for that earlier.


Thanks for your help

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,943
× 411

Question asked: Oct 17 '13, 9:20 a.m.

Question was seen: 5,727 times

Last updated: Oct 18 '13, 2:48 a.m.

Confirmation Cancel Confirm