Hi.
How can i get WCTypeInstanceIdentifier for the object (e.g. WTChangeOrder2 instance) by java code?
Thanks.
I am trying to use TypeIdentifierUtility.getTypeInstanceIdentifier(object) method.
The result looks like WCTYPE|wt.change2.WTChangeOrder2~~WCI|453083|20|453082
And I have an
NullPointerException
at com.ptc.core.meta.container.common.impl.BasicAttributeContainer._getEquivalent(BasicAttributeContainer.java:4957)
at com.ptc.core.meta.container.common.impl.BasicAttributeContainer._put(BasicAttributeContainer.java:2738)
at com.ptc.core.meta.container.common.impl.BasicAttributeContainer._put(BasicAttributeContainer.java:2627)
at com.ptc.core.meta.container.common.impl.BasicAttributeContainer.put(BasicAttributeContainer.java:947)
at com.ptc.core.meta.type.common.impl.DefaultTypeInstance.put(DefaultTypeInstance.java:1023)
at com.ptc.core.lwc.server.LWCNormalizedObject.set(LWCNormalizedObject.java:567)
when i try to set this WCTypeInstanceIdentifier to the attribute.
Attribute is created based on global attribute, which defined as Reference type.
What am i doing wrong?
NullPointerException is caused by
com.ptc.core.meta.common.IllegalFormatException
at com.ptc.core.meta.common.impl.AbstractAssociationTypeIdentifier.newAssociationIdentifier(AbstractAssociationTypeIdentifier.java:566)
at com.ptc.core.meta.type.common.TypeInstanceHelper.acquireSingleAttributeIdentifier(TypeInstanceHelper.java:220)
at com.ptc.core.meta.type.common.TypeInstanceHelper.acquireNewAssociationIdentifier(TypeInstanceHelper.java:88)
at com.ptc.core.lwc.server.LWCNormalizedObject.set(LWCNormalizedObject.java:567)
Hi,
Maybe this will work:
TypeInstanceIdentifier obj = TypeIdentifierUtility.getTypeInstanceIdentifier(yourObj);
if(obj instanceof WCTypeInstanceIdentifier){
WCTypeInstanceIdentifier obj2 = (WCTypeInstanceIdentifier) obj;
}
Regards,
Vytautas