Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi
Need API for revising WTPart subtype.
Need to revise and set the revision to a later revision.
Tried using below.
But this does not works for revising WTPart Subtype with custom revision scheme.
Anyone if tried ,please share the code.
Thanks.
Hello @arajendren ,
In my case I used method with WTCollection because mentioned method do not work for me. (I don't remember why :D)
In my example the revision is set to the next one that is set by OIR. I don't care what next value is :D.
WTDocument orderWTPObject = null;// find document what you need to revise it could be any type which is revisable. EPMDocument, WTPart what ever.
try
{
WTCollection revisionables = new WTArrayList();
revisionables.add(orderWTPObject);
WTPrincipalReference principalRef = SessionHelper.manager.getPrincipalReference();
WTValuedMap newVersions = VersionControlHelper.service.newVersions(revisionables);
WTCollection newWtRevision = newVersions.wtValues();
if (principalRef != null)
{
Iterator persistableIterator = newWtRevision.persistableIterator();
while (persistableIterator.hasNext())
{
Promotable promotable = (Promotable) persistableIterator.next();
VersionControlHelper.assignIterationCreator(promotable, principalRef);
VersionControlHelper.setIterationModifier(promotable, principalRef);
}
} else if (logger.isDebugEnabled())
{
logger.debug("The given principal reference is null");
}
WTCollection newVersionColect = PersistenceHelper.manager.store(newWtRevision);
if (newVersionColect.size() > 0)
{
WTArrayList wtArrayList = new WTArrayList(newVersionColect);
ObjectReference wtPreference = (ObjectReference) wtArrayList.get(0);
orderWTPObject = (WTDocument) wtPreference.getObject(); // new revision of object. change type as you need
}
} catch (WTPropertyVetoException var9)
{
throw new WTException(var9);
}