workItem.hasAttribute( attribute)= false after I add the attribute into the configuration xml and i execute Synchronize Attributes.
my system:
- RTC 4.0.1 - Jazz Server and RTC Eclipse Client 4.0.1 precondition: - client plugin on RTC Eclipse Client. - The plugin performs an update of the xml configuration and then a synchronize Attributes Here is the scenario from the Client Plugin code: - update of the xml configuration is successful. The update does some adding of attributes in the work items. - run synchronize attributes with com.ibm.team.workitem.client.WorkItemOperation execute workItemClient.updateWorkItemType( workItem, type, type, monitor ); ...with success - other code will look for the new attributes and the com.ibm.team.workitem.common.model.IWorkItem.hasAttribute(IAttribute) will return false for the new added attribute....this is my FAILURE because the attribute should be there. Consideration: 1. it does not happen all the times. 2. It can happen for some work item and not all. 3. usually a double execution of the synchronize attribute via my plugin code will fix the issue and the attribute will be found the second time around. 4. i run a query on my work item to execute the Synchronize Attributes and to do the other com.ibm.team.workitem.common.model.IWorkItem.hasAttribute(IAttribute) on specific work item Question: is it possible that Synchronize Attributes did not work? is there a way to make sure that i get the right work item working copy's connection? some call to make sure that the work item is updated? is there another way to make sure that the attribute changes are picked up? My only guess is that something did not get trough. thank you Stefania |
9 answers
we do need to modify the Process Configuration and add the new attributes.
It is a total replacement of the process configuration xml. The attributes are added fine in the Process Configuration with success. //////////////////////////////////////////////////////////// IProjectAreaWorkingCopy projectAreaWorkingCopy = (IProjectAreaWorkingCopy)itemWorkingCopy; IDocument spec = projectAreaWorkingCopy.getProcessSpecification(); ..... spec.set( newSpecSource ); itemWorkingCopy.save( monitor ); //////////////////////////////////////////////////////////// The problem is that the Synchronize Attributes after does not seem to pick up the change soon enough. If i rerun the Synchronize Attributes it works. You said 'Maybe you have to force reload your process changes before running a synchronize attributes' How can i force a reload of the process changes? I guess that is the same thing that happen when i do: - work item perspective - Team Artifact tab - select of my connected project area - right click - select of Open. thanks again. Stefania Comments
Ralph Schoon
commented Feb 21 '13, 12:41 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Stefania,
Get The Latest Data
Stefania Axo
commented Feb 22 '13, 8:44 p.m.
thanks so much
Stefania Axo
commented Mar 04 '13, 8:16 p.m.
hi Ralph
Stefania Axo
commented Mar 04 '13, 8:32 p.m.
I just want to let you know that my code overall works.
|
Hi,
From your comments it seems like the sync only fails when there are a lot of changes - could it be that the sync call is a non-blocking method, e.g. that when you run it it returns immediately; however the sync could still be running in the background / a separate thread? Simon Comments
Stefania Axo
commented Mar 05 '13, 12:01 p.m.
hi
|
it is a client plugin that has this extensions:
************************************************** <extension point="org.eclipse.ui.popupMenus"> <objectContribution objectClass="com.ibm.team.repository.client.ITeamRepository" id="com.ibm.sport.rtc.process.deployment.ui.contribution1"> <menu label="Process Specification" path="additions" id="com.ibm.sport.rtc.process.deployment.ui.menu1"> <separator name="group1"> </separator> </menu> <action label="Deploy Process Change..." class="com.ibm.sport.rtc.process.deployment.ui.popup.actions.DeployProcessChangeAction" menubarPath="com.ibm.sport.rtc.process.deployment.ui.menu1/group1" enablesFor="1" id="com.ibm.sport.rtc.process.deployment.ui.deployProcessChange"> </action> </objectContribution> </extension> ******************************************************************** here is a piece of code that get the project areas related to the selected repository. ********************************************************************* private Object[] projectSelection(ITeamRepository repository) throws TeamRepositoryException { IAuditableClient auditableClient = (IAuditableClient) repository .getClientLibrary(IAuditableClient.class); ItemProfile<IProjectArea> profile = ItemProfile .createFullProfile(IProjectArea.ITEM_TYPE); List<IProjectArea> projectAreas = auditableClient.findAuditables( profile, monitor); filteredProjects = new ArrayList<IProjectArea>(projectAreas.size()); for (IProjectArea project : projectAreas) { if (!project.isArchived()) filteredProjects.add(project); } projectNames = null; Display.getDefault().syncExec(new Runnable() { public void run() { setShell(Display.getDefault().getActiveShell()); ListSelectionDialog dialog = new ListSelectionDialog(shell, filteredProjects, new ListContentProvider(), new ProjectAreaLabelProvider(), "Select Target Projects"); dialog.setTitle("Select Projects"); if (dialog.open() == ListSelectionDialog.OK) { projectNames = dialog.getResult(); } } }); return (projectNames); ************************************************************************************** After the selection of the project area is done i will run the deployment on it in a sequential way. is it something i can do in the way i load those project areas? Also this is what i added to the code: *************************************** // START // Make sure we have the project area/ repository refreshed from the server IItemManager itemManager = repository.itemManager(); projectArea = (IProjectArea)itemManager.fetchCompleteItem( projectArea.getItemHandle(), IItemManager.REFRESH, monitor ); repository = (ITeamRepository) projectArea.getOrigin(); // END workingCopyManager.connect( projectArea ); IProcessItemWorkingCopy itemWorkingCopy = workingCopyManager .getWorkingCopy( projectArea ); ......... IProjectAreaWorkingCopy projectAreaWorkingCopy = (IProjectAreaWorkingCopy)itemWorkingCopy; IDocument spec = projectAreaWorkingCopy.getProcessSpecification(); spec.set( newSpecSource ); ........ // save project area // START // Make sure we have the project area/ repository refreshed from the server itemWorkingCopy.asyncInitialize( null ); itemWorkingCopy.requestUpdateContext(); // END itemWorkingCopy.save( monitor ); ******************************************* |
After trying different tries with com.ibm.team.repository.client.IItemManager and com.ibm.team.process.client.workingcopies.IProjectAreaWorkingCopy methods like :
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& (IProjectArea)itemManager.fetchCompleteItem( projectArea.getItemHandle(), IItemManager.REFRESH, monitor ); .......... projectAreaWorkingCopy.asyncInitialize( null ); projectAreaWorkingCopy.requestUpdateContext(); projectAreaWorkingCopy.asyncRefresh(); if (projectAreaWorkingCopy.isDirty()) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& the code that seems to workaround the problem does the following steps: - Save the new specification with the new attributes and stuff - get the specification back and append a space (+" ") then Save - get the specification back and remove the space then Save The re-editing of the the process specification seems to do the trick!! That is true even if i do from the Eclipse client with the project area editor. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& spec = projectAreaWorkingCopy.getProcessSpecification(); s = spec.get(); spec.set( s + " " ); projectAreaWorkingCopy.save( monitor ); s = spec.get(); s = s.substring( 0, s.length() - 1 ); spec.set( s ); projectAreaWorkingCopy.save( monitor ); &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& |
We've got the same behaviour: if we programmamtically update the Process Configuration Source the new attributes then are not showed in work-items.
Stefania's trick seems does not work for us... :( At the moment our code is:
IProcessItemService processClient = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);
Any advice?
Thanks in advance.
|
We found that the org.eclipse.ui.part.EditorPart#doSave is overrided by com.ibm.team.process.internal.ide.ui.editors.AbstractProcessItemEditor#doSave.
We found that in our IWorkingCopyManager the IUpdateContext was null when instead with a ProjectAreaEditorInput the IUpdateContext is never null:
if (manager.getUpdateContext() == null) { Comments
Stefania Axo
commented Oct 25 '13, 12:35 p.m.
did it work?
The code above comes from com.ibm.team.process.internal.ide.ui.editors.ProcessItemEditorInput#getWorkingCopy.
If we would try to set a IUpdateContext in our manager, we have to implement method "execute(Runnable runnable)" from that interface. (We had not try it yet.)
|
Further investigation... Inside com.ibm.team.process.internal.client.tests.AbstractTeamProcessTest class we found the method syncInitializeWorkingCopy which performs the working copy asyncInitialize inside a separate thread because:
// We make this call inside a separate thread so that the initialization
Could our initialization be missing because of this? Any advice from Jazz devs would be great .:D
Cheers.
|
i am not a jazz developer.
i may not be the best to answer this. the workaround i put for RTC 4.0 seems to hold so far. between the connection and the empty space &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& (IProjectArea)itemManager.fetchCompleteItem( projectArea.getItemHandle(), IItemManager.REFRESH, monitor ); .......... projectAreaWorkingCopy.asyncInitialize( null ); projectAreaWorkingCopy.requestUpdateContext(); projectAreaWorkingCopy.asyncRefresh(); if (projectAreaWorkingCopy.isDirty()) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& |
Hey guys, I am also trying to post the process config source xml file back to the project and following your examples and some others, I have been getting this error: "com.ibm.team.process.common.service.ProcessDataValidationException: content is not allowed in prolog".
I have edited the file on my local machine and now want to post it back to the project and save it. Any ideas, why I could be getting this error?
Comments
Stefania Axo
commented May 01 '14, 3:26 p.m.
i will suggest this:
KB 20
commented May 01 '14, 4:21 p.m.
are you able to post content back to your projects? I just checked the scrum template and everything seems to be the same at the beginning. Could it be an encoding issue? Do you keep "<?xml version="1.0" encoding="UTF-8"?>" at the top of your xml file? If it is working for you then, my next question is if you are using a windows machine to post the content back?
Stefania Axo
commented May 15 '14, 5:05 p.m.
this is what is on my process configuration source
|
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.
Comments
Hi Stefania,
as far as I know modifying the process XML is not a suggested scenario. In fact in all discussions I attended with the process team it was strongly discouraged.
Since the Eclipse client does add new attributes, I have to assume there is an API that allows to do it. I had looked into it because of a forum question, but was not able to find the API, unfortunately. Well, I found an entry point, but couldn't drill deep enough.
Another though: There is some caching going on behind the scenes. Maybe you have to force reload your process changes before running a synchronize attributes. I would assume the process components refreshes when it adds attributes.