Skip to main content
8-Gravel
August 2, 2024
Solved

Update EPMDocument IBA through JAVA

  • August 2, 2024
  • 3 replies
  • 1218 views

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

Best answer by GrahamV

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

3 replies

Community Moderator
August 6, 2024

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.

GrahamV12-AmethystAnswer
12-Amethyst
August 8, 2024

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

Community Moderator
August 12, 2024

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.