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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Translate the entire conversation x

replacing LWCNormalizedObject in code

Emacp
12-Amethyst

replacing LWCNormalizedObject in code

Good mornig,

I tried to use this code on WNC 12.1, replacing LWCNormalizedObject (deprecated) with PersistableAdapter:

 

private static void setIbaOnPartUsesOccurrence(PartUsesOccurrence puo, String ibaName, String ibaValue) throws WTException {
System.out.println("--------- Import.setIBAonPartUsesOccurrenc invoked on occurrence "+ puo.getName() +", with ibaName=" + ibaName + " and ibaValue=" + ibaValue);
wt.occurrence.UsesOccurrenceUserIBAs iba=wt.occurrence.UsesOccurrenceUserIBAs.newUsesOccurrenceUserIBAs(puo);
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(iba,null,java.util.Locale.US,new com.ptc.core.meta.common.UpdateOperationIdentifier());

obj.load(ibaName);
obj.set(ibaName,ibaValue);
obj.apply();

wt.fc.collections.WTKeyedMap usesOccurrencesAndData = new wt.fc.collections.WTKeyedHashMap();
wt.fc.collections.WTCollection relatedUsesOccurrenceData = new wt.fc.collections.WTArrayList(); relatedUsesOccurrenceData.add(iba);
usesOccurrencesAndData.put(puo, relatedUsesOccurrenceData);
System.out.println("--------- Import.setIBAonPartUsesOccurrenc done");

wt.occurrence.OccurrenceHelper.service.saveUsesOccurrenceAndData(usesOccurrencesAndData);
}

 

No error found in MethodServer but no value set on the IBA. Parent part is checked-out.

Does anyone have any suggestion? tnx

ACCEPTED SOLUTION

Accepted Solutions
Emacp
12-Amethyst
(To:Emacp)

I reply to my own post, clarifying that the code worked on the second attempt on another server. Evidently the IBA on my VM has some problem.

View solution in original post

1 REPLY 1
Emacp
12-Amethyst
(To:Emacp)

I reply to my own post, clarifying that the code worked on the second attempt on another server. Evidently the IBA on my VM has some problem.

Announcements
Top Tags