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

How to set the value of Filed Against in Plain Java API?

Hello,

given a string containing the desired value of Filed Against, I would like to set it to an IWorkItem.
I am using Plain Java API.

Thank you in advance.

0 votes



One answer

Permanent link
WorkItemWorkingCopyManager wcmgr = IWorkItemClient.getWorkItemWorkingCopyManager();
wcmgr.connect(workItemHandle...);
WorkItemWorkingCopy wc = wcmgr.getWorkingCopy(workitemHandle);
WorkItem wi = wc.getWorkItem();

wi.setCategory(ICategory value);

wc.save();
wcmgr.disconnect(workItemhandle);
(You can also use the IWorkItemOperation class, it will connect and disconnect under the covers, making it look like a more atomic operation.. it cannot detect conflicts between multiple clients changing the same workitem at the same time)

to FIND the category,
Its a TREE, so take care that u search the whole tree..
CategoriesManager catManager = CategoriesManager.createInstance(IAuditableClient, IProjectAreaHandle, monitor);
CategoryTreeNode rootnode= catManager.getRoot();

rootnode.getChildren().... will get u the list of root level categories, then u have to search thru them to find the one that matches the text u have, or team area or ...

      for (CategoryTreeNode node : rootnode.getChildren())
            {
                if(node.getName().equalsIgnoreCase(your_text))
                   {
                   // found category
                   ICategory xx = node.getCategory();
                   }

Ralph probably has a category search function in one of his blog entries.  ;->

0 votes

Comments

Thank you, but how can I get an auditable client?

I fixed my snippet above, should have used the classname, not my variable name

  private static IAuditableClient auditableClient = null;

             auditableClient = (IAuditableClient) repository
                    .getClientLibrary(IAuditableClient.class);

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
× 170

Question asked: Feb 17 '14, 4:31 a.m.

Question was seen: 6,220 times

Last updated: Feb 17 '14, 8:03 a.m.

Confirmation Cancel Confirm