Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
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
Solved! Go to Solution.
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.
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.