It's all about the answers!

Ask a question

[closed] How to edit work items from a participant


Paul B (219) | asked Sep 08 '15, 2:22 a.m.
closed Sep 10 '15, 4:06 a.m. by Ralph Schoon (54.7k23641)
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

The question has been closed for the following reason: "Duplicate Question" by rschoon Sep 10 '15, 4:06 a.m.