Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes

Comments

 Paulo, did you have an answer to your question?

I am trying to create an advisor to validate the workItem before deletion.

Thanks in advance,
Luana

Hi Luana,


At least on version 3.x, there is no  information on the data object, the code should work fine, the problem is in RTC delete operation. Are you using version 4, maybe they have fixed it 

 Paulo, yes, I'm using version 4. But the data object is still null, and I could not find a solution for that.

Have you found an alternative for your problem?



2 answers

Permanent link
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;

0 votes


Permanent link
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 delete ". If you add your advisor to listen to the delete behaviour, operation.getOperationData() returns null, therefore all the other code won't work

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: May 11 '12, 1:49 p.m.

Question was seen: 5,431 times

Last updated: Apr 22 '13, 6:25 p.m.

Confirmation Cancel Confirm