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 :-)
Accepted answer
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.
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