It's all about the answers!

Ask a question

How to edit work items from a participant


Paul B (219) | asked Sep 08 '15, 2:22 a.m.
Hi everyone,

I've recently got a working participant up and running and have been experimenting with different interfaces to see what's available. What I'm trying to do is when the save button is hit, I want to add some text to the comment field and add a couple of tags to the tags field.

Below is a snippet (cause i can't upload pictures yet) of the code I have thus far. I've been trying different things so this isn't the only code I've tried. If someone could correct what I'm doing wrong that would be great.

public void run(AdvisableOperation operation,
IProcessConfigurationElement participantConfig,
IParticipantInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException {
System.out.println("FYI - Plugin reached");
Object data= operation.getOperationData();
if (!(data instanceof ISaveParameter))
return;

ISaveParameter saveParameter= (ISaveParameter) data;
if (!(saveParameter.getNewState() instanceof IWorkItem))
return;
IAuditable auditable = saveParameter.getNewState();

if (auditable instanceof IWorkItem) {
IWorkItem workItem = (IWorkItem) auditable;
IWorkItem workItem2 = (IWorkItem) workItem.getWorkingCopy();

System.out.println("FYI - Section 2 reached");
workItem2.setHTMLDescription(XMLString.createFromPlainText("This is a test to see if it works"));
List<String> tags = new LinkedList<String>();
tags.add("Paul");
tags.add("House");
workItem2.setTags2(tags);
}

Thanks

One answer



permanent link
Ralph Schoon (55.5k23642) | answered Sep 10 '15, 4:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Sep 10 '15, 4:04 a.m.
See https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ and be aware that the save is a new save and WILL trigger the participant again, which will result in a recursive descent death of the save and or the server if you don't prevent that from happening as described in the blog post above.

Your answer


Register or to post your answer.