Hi,
I have realized I follow-up action that run without problem on RTC. In this server side plug-in I create a new work item and add it as a child of my auditable workitem when I try to save it.
public class CreaTask extends AbstractService implements IOperationParticipant {
public void run(AdvisableOperation operation, IProcessConfigurationElement participantConfig,IParticipantInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException
{ Object data= operation.getOperationData();
if (data instanceof ISaveParameter) {
IAuditable auditable = ((ISaveParameter) data).getNewState();
if (auditable instanceof IWorkItem) {
IWorkItem workItem = (IWorkItem) auditable;
String tipo = workItem.getWorkItemType().toString(); //Trovo il tipo di WorkItem Release
IWorkItemServer workiteamServicess = getWorkItemServerService();
if(tipo.contains("release")) {
IProjectAreaHandle progetto = workItem.getProjectArea();
String NOME_BOX_TASK[] = ....
String ID_TASK[] = .....
String NOME_TASK[] = .....
int num_task = NOME_BOX_TASK.length; int j = 0; int i = 0; IAttribute taskbox_status;
IWorkItemType task_type; Boolean task_result; IWorkItemReferences references; IWorkItem workItemCopy; IWorkItem workItemTASK;
references = workiteamServicess.resolveWorkItemReferences(workItem, null); IWorkItem workItemCopy2;
workItemCopy = (IWorkItem) workItem.getWorkingCopy();
for (i=1; i<num_task; i++){
taskbox_status = workiteamServicess.findAttribute(progetto, NOME_BOX_TASK[j].toString(), monitor);
task_type = workiteamServicess.findWorkItemType(progetto, ID_TASK[j].toString(), null);
task_result = (Boolean) workItem.getValue(taskbox_status);
if (task_result) {
workItemTASK = workiteamServicess.createWorkItem2(task_type);
workItemCopy2 = (IWorkItem) workItemTASK.getWorkingCopy();
workItemCopy.setHTMLSummary(XMLString.createFromPlainText("T_"));
workiteamServicess.saveWorkItem2(workItemCopy2, null, null);
references.add(WorkItemEndPoints.CHILD_WORK_ITEMS, WorkItemLinkTypes.createWorkItemReference(workItemTASK));
}
j++; }
workiteamServicess.saveWorkItem2(workItemCopy, references, null);
}
}
}
}
private static IWorkItemServer workiteamServer;
private IWorkItemServer getWorkItemServerService() {
synchronized (this) {
if (workiteamServer == null) {
workiteamServer = getService(IWorkItemServer.class);
}
return workiteamServer;
}
}
}
But, when I add a precondition on the same auditable workitem save operation like the follow
public class ControlloTaskSV_or_WKFL extends AbstractService implements IOperationAdvisor {
private static IWorkItemServer workiteamServer = null;
public void run(AdvisableOperation operation, IProcessConfigurationElement advisorConfiguration, IAdvisorInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException {
Object data= operation.getOperationData();
if (data instanceof ISaveParameter) {
IAuditable auditable = ((ISaveParameter) data).getNewState();
if (auditable instanceof IWorkItem) {
IWorkItem workItem = (IWorkItem) auditable;
IProjectAreaHandle progetto = workItem.getProjectArea();
IAttribute taskbox_status;
taskbox_status = getWorkItemServerService().findAttribute(progetto, "Rel_task_svwfnav", monitor);
Boolean taskSV_result = (Boolean) workItem.getValue(taskbox_status);
taskbox_status = getWorkItemServerService().findAttribute(progetto, "Rel_task_wkfl", monitor);
Boolean taskWKFL_result = (Boolean) workItem.getValue(taskbox_status);
if(taskSV_result && taskWKFL_result) {
IAdvisorInfo info = collector.createProblemInfo("Warning", "worning ", "error");
collector.addInfo(info);} else { return;
}
}
}
}
private IWorkItemServer getWorkItemServerService() {
synchronized (this) {
if (workiteamServer == null) {
workiteamServer = getService(IWorkItemServer.class);
}
return workiteamServer;
}
}
}
I have an error on the workiteamServicess.saveWorkItem2(workItemCopy2, null, null) of the follow-up action.
// Compiled from ExportProxyServiceRecord.java (version 1.2 : 46.0, super bit)
public final class org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord extends org.eclipse.soda.sat.core.internal.record.ServiceRecordDelegate implements org.eclipse.soda.sat.core.record.interfaces.IExportProxyServiceRecord {
// Field descriptor #8 Ljava/lang/String;
private static final java.lang.String FAILED_TO_CREATE_PROXY_KEY = "ExportProxyServiceRecord.FailedToCreateProxy";
// Field descriptor #8 Ljava/lang/String;
private static final java.lang.String INTERFACE_CLASSES_KEY = "ExportProxyServiceRecord.InterfaceClasses";
// Field descriptor #8 Ljava/lang/String;
private static final java.lang.String UNRECOGNIZED_INVOCATION_HANDLER_KEY = "ExportProxyServiceRecord.UnrecognizedInvocationHandler";
// Field descriptor #8 Ljava/lang/String;
private static final java.lang.String EQUALS_METHOD = "equals";
// Field descriptor #22 Lorg/osgi/framework/BundleContext;
private org.osgi.framework.BundleContext bundleContext;
// Field descriptor #24 Lorg/eclipse/soda/sat/core/framework/interfaces/IProxyServiceHandler;
private org.eclipse.soda.sat.core.framework.interfaces.IProxyServiceHandler handler;
// Field descriptor #26 Ljava/lang/Object;
private java.lang.Object realService;
.............
..............
............
Somebody can help me to fix this error?
thanks