cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Can any one tell me how I can delete Latest Iteration of WTDocument

SOLVED
Newbie

Can any one tell me how I can delete Latest Iteration of WTDocument

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

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Can any one tell me how I can delete Latest Iteration of WTDocument

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

View solution in original post

2 REPLIES 2

Re: Can any one tell me how I can delete Latest Iteration of WTDocument

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

Re: Can any one tell me how I can delete Latest Iteration of WTDocument

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

View solution in original post