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

Creation of precondition plugin on delete of workitem

 Hello Team,

We are trying to create a precondition plugin which will trigger on deletion of a work item.

Please help us how to get the trigger point on work item deletion. Also, how the plugin can be made available to apply on Delete work item in Operation Behavior.

In Plugin, we have provided the operation id com.ibm.team.workitem.operation.workItemDelete in Entensions but it did not work for us.

Please help us with this.

1

0 votes


Accepted answer

Permanent link
Follow this link, read the material and follow the extensions workshop: https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/

According to https://jazz.net/wiki/bin/view/Main/CustomPreconditionsTable#operations the operation ID is com.ibm.team.workitem.operation.workItemDelete
https://rsjazz.wordpress.com has several examples for advisors. You need to use the Extension point for advisors is com.ibm.team.process.service.operationAdvisors

Debug your extension on Jetty. If you have questions you can ask them here and hope for an answer provided the question actually carries information that people can work on. "but it did not work for us" is not really useful.
Ralph Schoon selected this answer as the correct answer

0 votes

Comments

Note, you have to look at the operation data you get in the advisor and figure how to access the information you want. I would assume you can get the old state of the work item e.g. to access data.


One other answer

Permanent link
Hello Ralph,

We are also trying a precondition where a work item cannot be deleted if it has a relationship (eg parent->child)

on debugging the plugin in Jetty we see that the operationData is null. so ideally we cannot extract the data through:

Object data = operation.getOperationData();


However in the variable view of Debug for the operation class we see that the workItemHandle information is present:
name:val$workItem   value: WorkItemImpl(id=1229)

I am not able to find any method in the operation class to retrieve the handle. Any suggestions how to retrieve this handle?

Thanks,
Abhishek Kumar

0 votes

Comments

Create your own question. Posting answers with new questions is just an annoying, frustrating habit. I don't want to spend my day converting these answers into questions for forum users.

If you want to do this, you have to have some basic skills. Follow https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ to get them.   The extensions workshop provides all you need to know for this question.

Various examples on https://rsjazz.wordpress.com/ show also how to get the data.
WorkItemImpl also tells you that the work item handle is already resolved.

Most of this information was already in the answer above. You should consider to follow such hints.

for extracting the data from pre-conditon from save workitem we use the following
Object data = operation.getOperationData();
        if (!(data instanceof ISaveParameter)) {   return;  }
        ISaveParameter saveParameter = (ISaveParameter) data;
        if (saveParameter.isCreation()) {
          return;
        }
        IAuditable auditable = saveParameter.getNewState();
        if (!(auditable instanceof IWorkItem)) {   return; }
but in the case of precondition of delete work item i am not able to extract the data this way.
Object data = operation.getOperationData(); returns null.(when we debug in jetty)
I searched for examples in your blog as well as in the workshop, but i wasn't able to find it.
WorkItemImpl class exists as a variable in the operation class but maybe it is not visible  from the current execution context.

I can see the same in an experiment I was doing. This means, I am not able to access the work item in the delete and I can't actually test anything. The work item is somehow in the information, but I have no idea how to access it.


I don't have any more information unfortunately.

The method  com.ibm.team.workitem.service.internal.WorkItemRepositoryService.deleteWorkItem(IWorkItemHandle, IRepositoryItemService)
performs the delete operation and that does not provide operation data. It is even documented. I don't know why, but this seems to be as designed. so if you want that to change, you would have to create an enhancement request. If you create one, for example here: https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWelcome , please provide a link below.

Hello Ralph,

I have raised an enhancement, follow this link.

Thanks.

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,952
× 70

Question asked: May 24 '16, 10:27 a.m.

Question was seen: 3,769 times

Last updated: Jun 24 '16, 7:27 a.m.

Confirmation Cancel Confirm