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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Revise WTPart

arajendren
9-Granite

Revise WTPart

Hi

 

Need API for revising WTPart subtype.

Need to revise and set the revision to a later revision.

Tried using below.

 

arajendren_0-1635481705594.png

 

But this does not works for revising WTPart Subtype with custom revision scheme.

Anyone if tried ,please share the code.

 

Thanks.

2 REPLIES 2

@glv Could you please help with this?

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);
}

 

Announcements

Top Tags