It's all about the answers!

Ask a question

Followup action


Dacian Hantig (4844) | asked Dec 07 '10, 5:06 a.m.
Hi,

I'm trying to extend the Save action of a workitem and include a custom action after the work item was saved (so, in the followup event).
So the plugin will be deployed on the server side.

What I need is the human readable values (you can see in the viewer, like in web, or in RTC directly). Some values are easily retrievable, but some are objects and I could not find out how to get the human readable value out of them. Those are marked with "// object" at the end of the line

Here after is the code


package postSaveParticipant.example;

import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.repository.service.AbstractService;
import com.ibm.team.workitem.common.ISaveParameter;
import com.ibm.team.workitem.common.model.IWorkItem;
import com.ibm.team.workitem.service.IWorkItemPostSaveParticipant;

public class PostSaveParticipant extends AbstractService implements
IWorkItemPostSaveParticipant {

/*
* (non-Javadoc)
*
* @see
* com.ibm.team.workitem.service.IWorkItemPostSaveParticipant#run(com.ibm
* .team.workitem.common.ISaveParameter)
*/
public void run(ISaveParameter saveParameter)
throws TeamRepositoryException {
IWorkItem workItem = (IWorkItem) saveParameter.getNewState();
if (workItem != null) {
StringBuffer res = new StringBuffer();
res.append("Got a workItem with data [");
res.append("Duration=" + workItem.getDuration() + "\n");
res.append("Id=" + workItem.getId() + "\n"); // object
res.append("WorkItemType=" + workItem.getWorkItemType() + "\n");
res.append("Approvals=" + workItem.getApprovals().getContents()
+ "\n");
res.append("Category=" + workItem.getCategory() + "\n"); // object

res.append("Class=" + workItem.getClass() + "\n");
res.append("Comments=" + workItem.getComments().getContents()
+ "\n"); // object
res.append("ContextId=" + workItem.getContextId() + "\n");
res.append("CreationDate=" + workItem.getCreationDate() + "\n");

res.append("Creator=" + workItem.getCreator() + "\n"); // object

res.append("CustomAttributes=" + workItem.getCustomAttributes()
+ "\n");
res.append("DueDate=" + workItem.getDueDate() + "\n");
res.append("HTMLDescription=" + workItem.getHTMLDescription()
+ "\n");
res.append("HTMLSummary=" + workItem.getHTMLSummary() + "\n");

res.append("ItemHandle=" + workItem.getItemHandle() + "\n");// object
res.append("ItemId=" + workItem.getItemId() + "\n");// object
res.append("ItemType=" + workItem.getItemType() + "\n");// object
res.append("ModifiedBy=" + workItem.getModifiedBy() + "\n");// object

res.append("Origin=" + workItem.getOrigin() + "\n");

res.append("Owner=" + workItem.getOwner() + "\n");// object

res.append("Priority=" + workItem.getPriority() + "\n");// object
res.append("ProjectArea=" + workItem.getProjectArea() + "\n");// object
res.append("Resolution2=" + workItem.getResolution2() + "\n");// object

res.append("ResolutionDate=" + workItem.getResolutionDate() + "\n");

res.append("Resolver=" + workItem.getResolver() + "\n");// object
res.append("Severity=" + workItem.getSeverity() + "\n");// object
res.append("State=" + workItem.getState2() + "\n");// object
res.append("StateHandle=" + workItem.getStateHandle() + "\n");// object
res.append("StateId=" + workItem.getStateId() + "\n");// object
res.append("Subscriptions=" + workItem.getSubscriptions() + "\n");// object

res.append("Tags2=" + workItem.getTags2() + "\n");
res.append("Target=" + workItem.getTarget() + "\n");
res.append("]!");
System.out.println(res);
}
}
}


Can you please help me?

Kind regards,
Dacian

7 answers



permanent link
Dacian Hantig (4844) | answered Jan 03 '11, 11:29 a.m.
1) As soon as I added as required plugin
com.ibm.team.repository.client (needed for the code you gave me) my
plugin does not go into Active state any more, no matter how much I
wait. It stays in Installed state. Do you know why? Or what can I do
to overcome this?

Follow-up actions run on the server, and you cannot use client-side
plug-ins there. Can you elaborate on the functionality you need to use?
I can then point you to the appropriate service.


--
Regards,
Patrick
RTC Work Item Component Lead

Thanks for answering.
What we have to do is to make a synchronization between RTC and another application we use (HP Service Manager). To do this we need to get information from the RTC and transmit it through a web service. This is the action I'm focusing now.
The synchronization between the two (let's call it bridge), will go both ways and is related to the fact that both applications are in use but not by the same people, but we need to make the connection between them so that we have all the information changed in one place and not in two places.
Hope this was clear enough.

permanent link
Patrick Streule (4.9k21) | answered Dec 14 '10, 8:08 a.m.
JAZZ DEVELOPER
1) As soon as I added as required plugin
com.ibm.team.repository.client (needed for the code you gave me) my
plugin does not go into Active state any more, no matter how much I
wait. It stays in Installed state. Do you know why? Or what can I do
to overcome this?

Follow-up actions run on the server, and you cannot use client-side
plug-ins there. Can you elaborate on the functionality you need to use?
I can then point you to the appropriate service.


--
Regards,
Patrick
RTC Work Item Component Lead

permanent link
Dacian Hantig (4844) | answered Dec 14 '10, 5:52 a.m.
Thank you for the answer.

1) As soon as I added as required plugin com.ibm.team.repository.client (needed for the code you gave me) my plugin does not go into Active state any more, no matter how much I wait. It stays in Installed state. Do you know why? Or what can I do to overcome this?

2) getItemId() is giving the object, while getId() gives the actual ID (the number)

permanent link
Michael Pav (1611) | answered Dec 13 '10, 5:19 p.m.
For your question about the UserID, check this post:
http://jazz.net/forums/viewtopic.php?t=2272&highlight=getowner

For your question about the workItem ID, use the getId() method, not the getItemId() method.

permanent link
Dacian Hantig (4844) | answered Dec 13 '10, 9:05 a.m.
I don't know any details about your setup. I'm quite a beginner in this.
I have set up my project just by using an analogy and following one of the videos I could find here:
https://jazz.net/wiki/bin/view/Main/RTCSDK20_ProcessPreConditionExample#Videos

So, I have never modified the plugin.xml or site.xml

HTH

permanent link
Michael Pav (1611) | answered Dec 10 '10, 3:44 p.m.
Upon plugin load, I'm bumping into is a null pointer exception. I'm pretty sure that there is a problem with my plugin.xml or site.xml:




2010-12-11 11:28:15,710 ERROR eam.repository.common.util.ExtensionRegistryReader - CRJAZ0201I The extension reader with plugin id "WorkItemPostSaveParticipantRegistry@da00da0, pluginId="com.ibm.team.workitem.service", extensionPointId="workItemPostSaveParticipants", started=<true>" failed to add an extension to the extension point "com.ibm.team.workitem.service.workItemPostSaveParticipants" with the plugin id "com.ibm.team.workitem.service.workItemPostSaveParticipants".
com.ibm.team.repository.common.transport.TeamServiceRegistryException: CRJAZ1103I Failed to start extension service: "ExtensionServiceElementDescriptor@1a581a58, bundle="workitem", componentId="workitem.perforce.extensionService", implementationClass="workitem.perforce.jobSync"".

...
...

java.lang.NullPointerException
at com.ibm.team.repository.common.transport.AbstractElementDescriptor.getBundleContext(AbstractElementDescriptor.java:389)





<extension
id="workitem.perforcejob"
name="Perforce Job Sync"
point="com.ibm.team.workitem.service.workItemPostSaveParticipants">
<workItemPostSaveParticipant
id="perforcejob.workItemPostSaveParticipant">
<extensionService
componentId="workitem.perforce.extensionService"
implementationClass="workitem.perforce.jobSync">
</extensionService>
</workItemPostSaveParticipant>
</extension>



permanent link
Michael Pav (1611) | answered Dec 10 '10, 11:45 a.m.
Hello Dacian,

Let me hijack your post a bit. I also am working on an IWorkItemPostSaveParticipant extension. My trouble is that it never seems to get invoked... I can attach to tomcat and debug other actions and extensions within RTC. I can also see that my extension plugin has be loaded by OSGi.

What mojo did you use to enable IWorkItemPostSaveParticipant extensions?

Thanks,

Your answer


Register or to post your answer.