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

Operation Advisor - Custom Precondition for Work Items

I am just starting with extending our RTC server. I downloaded the SDK and started reviewing the following links:
https://jazz.net/wiki/bin/view/Main/CustomPreconditionFollowup
https://jazz.net/library/article/495/

What I would like to do is require that change sets have been delivered prior to transitioning a work item to a specific state. I thought this could be achieved via an extension to the com.ibm.team.workitem.operation.workItemSave operation ID.

There are aspects of this that I'd like to model off existing preconditions. Is there a way to pull the existing precondition code to review? I am not sure if they are in the source that comes with the SDK or where it would be located.

Also, is there any article that discusses custom preconditions which modify the UI? I'd like people to be able to select states similar to the "Prevent Editing" precondition.

Finally, on another note, it might be nice if RTC provided a plug-in template which could be used for different ways to extend it.

Anyway, I'll take any assistance from anybody that has coded up their own custom preconditions. Thanks in advance.

0 votes


Accepted answer


13 other answers

Permanent link

What do you mean when you say "I keep getting null returned for this call"? Do you mean you get NullPointerException exception? If so, can you please provide the exception stack? Or, did you see any error log in the console?

I know nothing about the Extensions Workshop. I am just trying to figure our the problem from the basic technical view.

I get a pop-up error box when trying to use the UI config for the precondition in the operation behavior editor that gives a NullPointerException. And when I debugged it looks like either the getWorkbench() or getActiveWorkbenchWindow() returned null. I googled and it looks like it's possible to for the latter call to return null. Every other precondition editor I looked at had it coded the same way.

Eventually, in my attempts to figure this out, it went away but I am not sure why. I never changed that code either. It was quite strange.


2. I am not sure I understand how I can determine exactly what services I require for what I want to do.

FWIW when writing future extensions, I've posted the following on my blog about one approach to figuring out which services you require: http://ryehle.wordpress.com/2011/11/21/finding-the-right-service-api-for-your-process-extension/

Thanks Robin! I'll check this out because I have a few more extensions to write after working my way through this one which is almost complete.

0 votes


Permanent link

2. I am not sure I understand how I can determine exactly what services I require for what I want to do.

FWIW when writing future extensions, I've posted the following on my blog about one approach to figuring out which services you require: http://ryehle.wordpress.com/2011/11/21/finding-the-right-service-api-for-your-process-extension/

0 votes


Permanent link
So one challenge I am having is in creating the Aspect Editor.

I keep getting null returned for this call:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, new RunnableWithProgress() {....

Is there any reason for why this happens or how to avoid? I am following the pattern in the getWorkItemsType call of the 3.0.1 Extensions Workshop labs which is consistent with what I see in the out of the box preconditions.

Thanks.


What do you mean when you say "I keep getting null returned for this call"? Do you mean you get NullPointerException exception? If so, can you please provide the exception stack? Or, did you see any error log in the console?

I know nothing about the Extensions Workshop. I am just trying to figure our the problem from the basic technical view.

0 votes


Permanent link
I don't use that, so sorry no help

Sam

0 votes


Permanent link
So one challenge I am having is in creating the Aspect Editor.

I keep getting null returned for this call:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, new RunnableWithProgress() {....

Is there any reason for why this happens or how to avoid? I am following the pattern in the getWorkItemsType call of the 3.0.1 Extensions Workshop labs which is consistent with what I see in the out of the box preconditions.

Thanks.

0 votes


Permanent link
Same here Sam. Most of my material is also from helping people.

I hope we can pull more material together to provide more workshop material. It is just a matter of how much time I can spend.

Thanks so much for contributing!


Thanks Sam and Ralph. I will follow up with any preconditions I am able to write as well to help others.

Thanks again for updating the extensions workshop. I really thought it was well done.

0 votes


Permanent link
Same here Sam. Most of my material is also from helping people.

I hope we can pull more material together to provide more workshop material. It is just a matter of how much time I can spend.

Thanks so much for contributing!

0 votes


Permanent link
no problem.. don't care about attribution.. just trying to help others as they have helped me

I also submitted this to enhancement 182769.. build it, ship it and let users select it.. vs having to write code.

https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/182769

Sam

0 votes


Permanent link
Hi Sam,

I ruthlessly stole your code and intent to incorporate it in my set of example trophies, if that is OK with you. I will put your name in as author.

Phillip,

there are several examples in the WiKi: https://jazz.net/wiki/bin/view/Main/RtcSdk20 they are hard to find.

I agree, it would be great to have all these examples. It comes down to be get clearance to publish code and resources to create, collect and worse maintain it.

The workshop has been updated recently.
The services, you need at least

com.ibm.team.repository.service.IRepositoryItemService
com.ibm.team.scm.common.IScmService


I think it does not matter if pre- or postcondition as long as the required interface is similar.

0 votes


Permanent link
Ralph,

Thanks so much for this information. I reviewed the extensions workshop and I found a lot of helpful information. I think it's the most comprehensive thing I've read so far.

Just some feedback:
1. I think this path is helpful at the conclusion of the workshop to include additional sample code that can be downloaded for review. Something like a series of example preconditions and followups for a few common classes you may be using with a paragraph description of each. No need to step through everything but at least it provides an additional template to start from.
2. I am not sure I understand how I can determine exactly what services I require for what I want to do.

My struggle is that currently I want to do something which I believe is probably fairly simple but I get stuck on a few questions.

To be more specific, we currently require an associated work item to deliver a change set. Now I want to create another condition that further verifies the type and state of that associated work item before you can deliver.
However, I am not sure of what applies from the workshop because:
1. I am not sure what services I require
2. I don't know #1 partly because the lab covered a different operationID and because it was a followup not a precondition

I think any examples for deliver (server) preconditions may be helpful to me here as a result.

0 votes

1–15 items
page 1of 1 pagesof 2 pages

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
× 11,109
× 369
× 89

Question asked: Sep 29 '11, 3:58 p.m.

Question was seen: 26,076 times

Last updated: Mar 23 '15, 8:07 a.m.

Confirmation Cancel Confirm