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

How to update a custom attribute value of a workitem using server side API.

 

Hi, 

I wrote a java server side API to update a custom attribute value of a workitem using below code, value is showing in console but value is not updating in work item.

 

public class NcbreleseClass extends AbstractService implements

IOperationParticipant

{

 

      private IWorkItemCommon fWorkItemCommon;

      public void run(AdvisableOperation operation,

                  IProcessConfigurationElement participantConfig,

                  IParticipantInfoCollector collector, IProgressMonitor monitor)

                  throws TeamRepositoryException

                  {

                        Object data = operation.getOperationData();

                        ISaveParameter saveParameter = null;

                       

                        if (data instanceof ISaveParameter)

                        {

                             

                              fWorkItemCommon = getService(IWorkItemCommon.class);

                              saveParameter = (ISaveParameter) data;

                              IAuditable auditable = saveParameter.getNewState();

                              IWorkItem workItem = (IWorkItem)auditable;

                              String type = workItem.getWorkItemType();

                       

                              if (type.equals("projectchangerequest"))

                              {

                      IProjectAreaHandle fprojectArea = workItem.getProjectArea();

                      //info is custom attribute

                      IAttribute infovalue = fWorkItemCommon.findAttribute(fprojectArea,"info",monitor);

                      String value = new String("Update"); 

                      workItem.setValue(infovalue,value);

                      Object crValue = workItem.getValue(infovalue);

                        String crstring = crValue.toString();

                       

                              System.out.println("Info Value is updated...."+crstring);

                             

                              }

                        }

                             

                        }

                       

     

     

}

Thanks & Regards

Sachin Nairy

0 votes


Accepted answer

Permanent link
Sachin,

https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ shows how this can be done using the server API.
Sachin Nairy selected this answer as the correct answer

0 votes

Comments

Thanks Ralph, It is a good information which u shared. it helps a lot to understand rtc framework. if possible write some information about coding standard for rtc api which will help us to avoid server load while running plugin.

I have posted what I know in my blog.

To reduce load reduce the attributes you load by using profiles. Also detect as quickly as possible if you have to do something and quit if not. Avoid complex searches if possible. But finally, if you have to do something, you have to do it. No way around it. You could only try to reduce load by using intelligent algorithms and things Java Provides such as hash maps etc.

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,940

Question asked: Sep 27 '13, 5:36 a.m.

Question was seen: 4,564 times

Last updated: Oct 29 '13, 7:10 a.m.

Confirmation Cancel Confirm