How to retrieve the Summary field that is set when workitem is saved?
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
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
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!
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!
8 other answers
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.
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
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
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
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
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
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.
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
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
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