It's all about the answers!

Ask a question

Creation of precondition plugin on delete of workitem


0
1
Pankaj Sharma (401169) | asked May 24 '16, 10:27 a.m.
edited Jun 24 '16, 3:43 a.m. by Ralph Schoon (63.1k33645)
 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.

Accepted answer


permanent link
Ralph Schoon (63.1k33645) | answered May 25 '16, 2:26 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited May 25 '16, 2:27 a.m.
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

Comments
Ralph Schoon commented May 25 '16, 2:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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
Abhishek Kumar (49622) | answered Jun 24 '16, 3:15 a.m.
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


Comments
Ralph Schoon commented Jun 24 '16, 3:28 a.m. | edited Jun 24 '16, 3:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Abhishek Kumar commented Jun 24 '16, 5:11 a.m.

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.


Ralph Schoon commented Jun 24 '16, 6:01 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Ralph Schoon commented Jun 24 '16, 6:56 a.m. | edited Jun 24 '16, 6:57 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Abhishek Kumar commented Jun 24 '16, 7:27 a.m.

Hello Ralph,

I have raised an enhancement, follow this link.

Thanks.

Your answer


Register or 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.