How to retrieve the Summary field that is set when workitem is saved?
Ananya Joisa (45●6●21●24)
| asked Aug 17 '12, 3:25 p.m.
edited Aug 27 '12, 5:30 a.m. by Ralph Schoon (63.5k●3●36●46)
Hi everyone,
I am following the document, RTC Extension Workshop (https://jazz.net/library/article/634) using which I am running a build on save action of the workitem. I am customizing the code as per my team's need for which I am trying to retrieve the Summary of the workitem. Could anyone please guide me on where I would find it? I am trying to find the workitem variable/function which holds/returns the Summary name on saving the Workitem. Also could anyone point me to the source code of this Workshop. Many classes are not defined in the RTC-SDK package that I downloaded. Thanks for your help! Ananya |
Accepted answer
Ralph Schoon (63.5k●3●36●46)
| answered Aug 23 '12, 2:50 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Ananya,
interesting approach. I assume you can do that. See Robin's blog about how to find stuff in the API http://ryehle.wordpress.com/2011/11/21/finding-the-right-service-api-for-your-process-extension/ it is really useful. I would probably rather try to put this in the build.xml, if possible, maybe controlled by a property. But I have not tried that yet and you can always try other ways. While you are boldly go where no one (I know of) has ever gone before, please keep us updated on your progress in this thread! Ananya Joisa selected this answer as the correct answer
Comments
Ananya Joisa
commented Aug 23 '12, 3:34 a.m.
Thanks Ralph. Looks like this link will be helpful. Sure, Will keep you posted. Thanks, Ananya |
8 other answers
Ralph Schoon (63.5k●3●36●46)
| answered Aug 17 '12, 4:04 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Ananyja,
please see https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation for the code on how to access the summary. You use workItem.setHTMLSummary(XMLString.createFromPlainText(fSummary)); https://jazz.net/library/article/1000 is the latest version of the workshop and it is self contained.All classes you need comes with the SDK, If you are missing any you failed to follow the workshop, or you are trying to use the Plain Java Client Libraries. In the latter case please see https://jazz.net/library/article/807 on how to set it up. |
Thanks Ralph!
I am trying to set a Build target of a build definition from BuildOnStateChangeParticiapant.java I am trying to retrieve the function to set the build target that I have pointed out above from the build definition object. I have tried to get the function from the buildDef object in BuildOnStateChangeParticipant. But couldn't find any function that would set the build target. Could anyone please guide me on where to find it? Thanks, Ananya |
Ralph Schoon (63.5k●3●36●46)
| answered Aug 22 '12, 10:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Ananya,
I don't understand what you are trying to do. And why. What do you mean with build target? Are you following the workshop or are you going beyond? |
Hi Ralph,
By "Build targets", I mean the field in the Ant tab of the build definition "our.integration.build" which is the build definition ID as per the document. Yes, I am going beyond the document and customizing the code as per the team's requirement. The build definition (our.integration.build) is associated to a build.xml which has multiple targets. On a certain condition , I want a certain <target> in the build.xml to run. Hence I am programmatically trying to set the Build target field. Thanks, Ananya |
Hi Ralph,
While debugging, I found that the build targets field was one of the children of buildDef object and it is defined in the class ConfigurationPropertyImpl. I did a search for this class and it was not under rtc-sdk. Could you please tell me how to get these class files? -BuildConfigurationElementImpl -ConfigurationPropertyImpl Thanks, Ananya |
Ralph Schoon (63.5k●3●36●46)
| answered Aug 27 '12, 5:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Ananya,
I have no examples and can't create one right now. However I did a simple Java Search in my Eclipse configured with the RTC SDK. Searching BuildConfiguration showed several interesting hits, including JUnit test cases. Looking a bit down, I found com.ibm.team.build.internal.common.model.BuildConfigurationElement . Likewise a Java search for ConfigurationProperty revealed com.ibm.team.build.internal.common.model.ConfigurationProperty . Once you have that you can look for references to understand how the SDK uses these elements. |
Thanks Ralph,
I was trying to run the following while(i.hasNext()){ buildConfigElement= (IBuildConfigurationElement) i.next(); if(buildConfigElement.getName().equalsIgnoreCase("ant")){ ConfigurationPropertyImpl configProperty = (ConfigurationPropertyImpl) buildConfigElement.getConfigurationProperty("com.ibm.team.build.ant.antArgs"); configProperty.setValue("TestStory"); and I am getting an com.ibm.team.repository.common.internal.ImmutablePropertyException com.ibm.team.repository.common.internal.ImmutablePropertyException at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2060) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280) at com.ibm.team.build.internal.common.model.impl.ConfigurationPropertyImpl.setValue(ConfigurationPropertyImpl.java:204) at net.jazz.rtcext.workitem.extensions.service.BuildOnStateChangeParticipant.build(BuildOnStateChangeParticipant.java:245) at net.jazz.rtcext.workitem.extensions.service.BuildOnStateChangeParticipant.run(BuildOnStateChangeParticipant.java:186) This is exactly what I am trying to set to call a target "TestStory". How can I be able to modify it or use the setValue() function. Please help! Thanks, Ananya |
Hi Ralph,
We have basically achieved what was required as per our problem statement. Since you had suggested not to make changes to the build definition from the code, we went with a different approach than what I have explained above. It works as wanted :) Thank you very much for your time and patience. Thanks, Ananya |
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.