Precondition on workitemDelete
Hi,
I am coding a precondition to prevent the user to delete workitems that are on a specific state or have some specific attributes filled.
I managed to create the precondition and debug it, the problem is I couldn't get the workitem being deleted, the AdvisableOperation that use to have this information inside the operationData, now returns null, using that property I was able to get the SaveParameter and the Workitem been saved, when running on the SaveWorkItem
How can get the workItem being deleted ?
thanks,
Paulo Cavoto
I am coding a precondition to prevent the user to delete workitems that are on a specific state or have some specific attributes filled.
I managed to create the precondition and debug it, the problem is I couldn't get the workitem being deleted, the AdvisableOperation that use to have this information inside the operationData, now returns null, using that property I was able to get the SaveParameter and the Workitem been saved, when running on the SaveWorkItem
How can get the workItem being deleted ?
thanks,
Paulo Cavoto
2 answers
here is my advisor code
public void run(AdvisableOperation operation, IProcessConfigurationElement advisorConfiguration, IAdvisorInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException {
if(Debug) System.out.println("in operation advisor");
// get the operation data
Object data= operation.getOperationData();
// is this a 'save' operation?
if (data instanceof ISaveParameter)
{
// get the affected object
IAuditable auditable = ((ISaveParameter) data).getNewState();
// if this is a workitem
if (auditable instanceof IWorkItem)
{
// reference the right object type (cast)
IWorkItem workItem = (IWorkItem) auditable;
here is my advisor code
Object data= operation.getOperationData();
// is this a 'save' operation?
if (data instanceof ISaveParameter)
Hi Sam,
The code you wrote works perfectly on the "workitem save" behaviour, the problem is that when you are running this a precondition on a "workitem
Comments
Luana Santos
Apr 17 '13, 1:52 p.m.Paulo, did you have an answer to your question?
Paulo Cavoto
Apr 17 '13, 9:33 p.m.Hi Luana,
Luana Santos
Apr 22 '13, 6:25 p.m.Paulo, yes, I'm using version 4. But the data object is still null, and I could not find a solution for that.