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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Update EPMDocument IBA through JAVA

AK_10639313
8-Gravel

Update EPMDocument IBA through JAVA

Good evening,
I'm having trouble understanding the process of updating an IBA of an EPMDocument.
I'm trying as it follows:

attributes.put(attributeName, attributeValue);
PersistableAdapter epmObj = new PersistableAdapter(epmDoc, null, null, new UpdateOperationIdentifier());
epmObj.load(attributeName);
epmObj.set(attributeName, attributeValue);
EPMDocument obj = (EPMDocument) epmObj.apply();
PersistenceHelper.manager.modify(obj);

 

However I didn't get any changes on the attribute itself. I'm guessing that in this case I need to checkout the EPM and do the changes on a working copy of it to persist the changes.
However reading the documentation and other topics I haven't found a clear flow to check-out--> set the attribute and then check-in the object. Can someone give me a hand on this if possible? Thank you kindly for your support

ACCEPTED SOLUTION

Accepted Solutions

You are correct, you need to check out the object first, make the modifications, then check in. I think you need something like the below...

doc = (EPMDocument) WorkInProgressHelper.service.checkout(doc, WorkInProgressHelper.service.getCheckoutFolder(), null).getWorkingCopy();
PersistableAdapter pa = new PersistableAdapter(doc, null, Locale.getDefault(), null);
pa.load(attributeName);
pa.set(attributeName, attributeValue);
doc = (EPMDocument) pa.apply();
doc = (EPMDocument) PersistenceHelper.manager.modify(doc);
doc = (EPMDocument) WorkInProgressHelper.service.checkin(doc, "IBA Updated");

 

Graham

View solution in original post

3 REPLIES 3

Hi @AK_10639313,

Thank you for your question. 

Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.
 

Regards,

Vivek N
Community Moderation Team.

You are correct, you need to check out the object first, make the modifications, then check in. I think you need something like the below...

doc = (EPMDocument) WorkInProgressHelper.service.checkout(doc, WorkInProgressHelper.service.getCheckoutFolder(), null).getWorkingCopy();
PersistableAdapter pa = new PersistableAdapter(doc, null, Locale.getDefault(), null);
pa.load(attributeName);
pa.set(attributeName, attributeValue);
doc = (EPMDocument) pa.apply();
doc = (EPMDocument) PersistenceHelper.manager.modify(doc);
doc = (EPMDocument) WorkInProgressHelper.service.checkin(doc, "IBA Updated");

 

Graham

Hello @AK_10639313

 

It looks like you have a response from a community member. If it helped to answer your question please mark the reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.

Announcements

Top Tags