Problems With Update WorkItem Subscribers PlugIn
Hi, i have a problem with my plugin . A brief description how it works: " When the workitem "defect" changes its state in "Closed", the members with a role equal to "subscriber" ( custom role ) and belonging to the Project Area are added as subscribers. " The problem is : Subscribers are properly added to the workitem working copy but the original workItem is not updated. This is the plugin java code : ----------------------------------------------------------------------------------------------------------------------------------------------------------
public class SubscriberOnChange extends AbstractService implements IOperationParticipant {
// Services we need
//*********************************************************************************************************************************
ArrayList<IContributor> subscribersArray =
subscribersArrayByRoleName(operation.getProcessArea(), wi, roleName, monitor);
try{
Can you help me PLEASE??? Thanks.
Giuseppe Gravina.
|
4 answers
Ralph Schoon (63.7k●3●36●48)
| answered May 13 '14, 3:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
What does "This section does not work" mean? Have you looked into other examples e.g. https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ ?
Comments
Giuseppe Gravina
commented May 13 '14, 5:36 p.m.
Hi Ralph, This section does not work [ wiServer.saveWorkItem2(wiOnServerCopy, null, null);] means that I expect that with this line of code the subscribers added to the working copy, are added to the original wi too. So, the original wi is updated.
Giuseppe Gravina
commented May 13 '14, 5:52 p.m.
...when i change the wi state in Closed the Screen error is:
Guiseppe, I would suggest to
|
Ralph Schoon (63.7k●3●36●48)
| answered May 14 '14, 3:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Not sure what is going on. I have done similar stuff here: https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ and it works for me.
If you debug it with Jetty, what happens when the code runs? Is there a recursion? Comments Also look for the log files for stack traces. However, if you really want to do this kind of stuff familiarize yourself with using Jetty for debugging.
|
Hi Ralph, I read the article ( https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/) and I have some questions for you....Can you answer , please? - How can I get the WI Working Copy? 1) **************************************************************** WAY 1 ********************************************************
Object opData = operation.getOperationData();
IWorkItem wiOnServerCopy = (IWorkItem)wiOnServer.getWorkingCopy(); 2)**************************************************************** WAY 2********************************************************* Object opData = operation.getOperationData();
ISaveParameter data = (ISaveParameter)opData;
IWorkItemHandle currentWIHandle =
(IWorkItemHandle)data.getNewState().getItemHandle();
3)*************************************************************** OTHER WAY ? ************************************************ ??? - After working on WI Working Copy, how can i save changes?
IWorkItemServer wiServer = getService(IWorkItemServer.class); wiServer.saveWorkItem2(workitemCopy, null, null);
Is this correct?? *************************************************************************************************************************************
Thanks, Giuseppe. |
Hi Ralph, I read the article ( https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/) and I have some questions for you....Can you answer , please? - How can I get the WI Working Copy? 1) **************************************************************** WAY 1 ********************************************************
Object opData = operation.getOperationData();
IWorkItem wiOnServerCopy = (IWorkItem)wiOnServer.getWorkingCopy(); 2)**************************************************************** WAY 2********************************************************* Object opData = operation.getOperationData();
ISaveParameter data = (ISaveParameter)opData;
IWorkItemHandle currentWIHandle =
(IWorkItemHandle)data.getNewState().getItemHandle();
3)*************************************************************** OTHER WAY ? ************************************************ ??? - After working on WI Working Copy, how can i save changes?
IWorkItemServer wiServer = getService(IWorkItemServer.class); wiServer.saveWorkItem2(workitemCopy, null, null);
Is this correct?? *************************************************************************************************************************************
Thanks, Giuseppe. Comments Basically, how you get a working copy depends on what you have. If you have an ID, you can search for that. If you are in an advisor or follow up action you get parameters when being called. e.g. the old state of the work item and the new state. In other cases you get a work item handle and need to resolve that e.g. using a service, IAuditable or IItemManager.
Giuseppe Gravina
commented May 20 '14, 7:26 a.m.
Thank You so much for your support Ralph. I take one of your old question, that is : " what happens when the code runs? Is there a recursion? ". So, from log files, i see that when the code runs all works correctly....subscribers are added to wi working copy, but when the code reaches the code line "saveWorkItem2(wiCopy,null,null)", the plug in restart more times and everytimes executes the commands until to save code line....
This behavior ends when appear the Screen error below:
Is this recursion?? Thanks Giuseppe.
Giuseppe Gravina
commented May 20 '14, 10:31 a.m.
Hi Ralph, the plugin finally works :) . The problem was recursion. I solved it by inserting the following lines of code: " if (data.getAdditionalSaveParameters().contains("EXIT-NO-RECURSIVE- UPDATE")) { return; } " +
" Set additionalParams = new HashSet();
Thanks very much:) ByeBye Giuseppe.
if
|
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.