[closed] After undo unresolved changes in local sandbox EWM client require to be repaired!!!
Hi Guys,
After Undoing changes using java API in sandbox EWM need to be repaired to work further with after opening EWM. How can I correctly undo unresolved changes. I did dig all related forum question related to undo changes until I reach to this solution. but it need rapair interaction process afterward in EWM. Thank you in advance :). how can I do clean undo changeset in plain java just like scm command : scm.exe repair "BRM Stream Workspace"
p.s. Also resolver0 as in before last line did not work for me so I use resolver to get repository.
List<IWorkspaceHandle> workspaceHandles = ...
IWorkspaceHandle wh = workspaceHandles.get(0);
ArrayList<String> target = getAvailableComponentPath(); //like JKEJAVAUI, JKEBUSSINESLOGIC
FileSystemCore.startUp();
ISharingManager sm = FileSystemCore.getSharingManager();
ILocalChangeManager lcm = sm.getLocalChangeManager();
PathLocation pathlocation = new PathLocation(sandBoxLocation);
ILocation sandBoxLocation = pathlocation.getCanonicalForm();
String[] targetPaths = new String[target.size()];
targetPaths = target.toArray(targetPaths);
for (int i = 0; i < targetPaths.length; i++) {
ISandbox sbox = sm.getSandbox(sandBoxLocation, false);
IRelativeLocation relativeLocation = new RelativeLocation(
Arrays.asList(targetPaths[i]));
IShareable shareable = sbox.findShareable(relativeLocation,
ResourceType.FOLDER);
lcm.refreshChanges(new ISandbox[] { sbox },
RefreshType.TRAVERSE_ALL_WITH_RECOMPUTE_OF_KNOWN, null);
ILocalChange[] localChanges = lcm.getPendingChanges(
new IShareable[] { shareable }, null);
IRepositoryResolver resolver = new IRepositoryResolver() {
public ITeamRepository getRepoFor(String uri, UUID id) {
// Return the repository to be used
return repo;
}
};
if (localChanges.length > 0) {
IRepositoryResolver resolver0 = IRepositoryResolver.EXISTING_SHARED; //This one did not work
lcm.undoChanges(localChanges, resolver, true, null, monitor);
}
The question has been closed for the following reason: "Duplicate Question" by rschoon Jul 26 '22, 8:43 a.m.