Hello,
I am stuck in one place I guess any one of you can help me, basically I am trying to delete the latest Iteration of the WTDocument using
PersistenceHelper.manager.delete(persistable);
where persistable object is latest iteration of WTDocument but when I execute the method it delete the entire version of the object
Can any one help me how I can delete only latest iteration of object
Solved! Go to Solution.
Hi Ankit,
You can use the following Code to delete the latest iteration,
wt.vc.wip.Workable iterationObj = null; |
boolean isLatestIteration = false;
wt.fc.QueryResult result = wt.vc.VersionControlHelper.service.allIterationsFrom((wt.vc.Iterated)WTObject);
while (result.hasMoreElements() ){
WTObject tmpObj = (WTObject)result.nextElement();
if(WTObject instanceof WTPart){
WTPart part = (WTPart)tmpObj; | ||
isLatestIteration = part.isLatestIteration(); | ||
if(isLatestIteration){ | ||
iterationObj(part); | ||
break; | ||
} |
}
}
if( isLatestIteration ){
wt.vc.VersionControlHelper.service.deleteIterations((wt.vc.Iterated)iterationObj,(wt.vc.Iterated)iterationObj); | ||||||
strLogger.append(" :: Object Deleted :: Yes" ); |
}
BR
MKR
Take a look at VersionControlHelper.service.deleteIterations. Not sure if theres a deleteLatest, so getting the iteration you want to delete may be up to you.
Message was edited by: Matthew Knight. Fixed typo
Hi Ankit,
You can use the following Code to delete the latest iteration,
wt.vc.wip.Workable iterationObj = null; |
boolean isLatestIteration = false;
wt.fc.QueryResult result = wt.vc.VersionControlHelper.service.allIterationsFrom((wt.vc.Iterated)WTObject);
while (result.hasMoreElements() ){
WTObject tmpObj = (WTObject)result.nextElement();
if(WTObject instanceof WTPart){
WTPart part = (WTPart)tmpObj; | ||
isLatestIteration = part.isLatestIteration(); | ||
if(isLatestIteration){ | ||
iterationObj(part); | ||
break; | ||
} |
}
}
if( isLatestIteration ){
wt.vc.VersionControlHelper.service.deleteIterations((wt.vc.Iterated)iterationObj,(wt.vc.Iterated)iterationObj); | ||||||
strLogger.append(" :: Object Deleted :: Yes" ); |
}
BR
MKR