Reloading the component from EWM client using API
Hello,
We are working on automating - Replacing the component baseline in a stream and repository workspace in EWM , when I use replaceComponent EWM API to replace the baseline of the component, the component goes out of sync.
The code:
workspaceConnection.applyComponentOperations(Collections.singletonList(workspaceConnection.componentOpFactory().replaceComponent(componentHandle, baselineConnection, workspaceHandle, false)), monitor);
To resolve this error , we are trying to reload this “out of sync component” in our local sandbox, I am using “ILoadOperation.requestreload “ API from EWM
code:
ISharingManager sharingManager = FileSystemCore.getSharingManager();
LoadDilemmaHandler loadDilemmaHandler = LoadDilemmaHandler.getDefault();
ILoadOperation loadOperation= IOperationFactory.instance.getLoadOperation(loadDilemmaHandler);
String sandboxPathName = sandboxPath;
IPath sandboxPath = new Path(sandboxPathName);
ILocation sandboxLocation = new PathLocation(sandboxPath);
ISandbox sandbox = sharingManager.getSandbox(sandboxLocation, false);
IShare[] iShare = sandbox.allShares(monitor);
Collection<IShare> ishareCol = new ArrayList();
for (int j = 0; j < iShare.length; j++) {
ishareCol.add(iShare[j]);
System.out.println(iShare[j]);
}
IRepositoryResolver resolver = new IRepositoryResolver() {
@Override
public ITeamRepository getRepoFor(String uri, UUID id) throws TeamRepositoryException {
return teamRepository;}
}; loadOperation.setEclipseSpecificLoadOptions(com.ibm.team.filesystem.client.operations.ILoadOperation.IMPORT_PROJECTS);
loadOperation.setPreserveLocalChanges(true);
loadOperation.getSharesOutOfSync();
loadOperation.requestReLoad(ishareCol, resolver,true, monitor);
loadOperation.run(monitor);
sharingManager.deregister(sandbox, monitor);
workspaceConnection.refresh(monitor);
But this is throwing me this error:
com.ibm.team.filesystem.client.FileSystemStatusException: Status ERROR: com.ibm.team.filesystem.client code=2 Loading the directories in the file system would overwrite/remove existing directories.
When we reload components from the EWM client ,we have an option for overwriting the local changes. But from the code side , we are unable to figure out how we resolve the issue.
and also when we reload the "out of sync" component from EWM client, it only reloads that specific component, but from the code side it is trying to reload all the components in that particular workspace.
Can anyone suggest any solution here?
Regards,
Yukti R Bhat
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Mar 20 '24, 3:32 a.m.