Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Creating ChangeNotices with Java SOA Libraries

Siemens Phenom Siemens Phenom
Siemens Phenom

The full name for ChangeNoticeRevision is com.teamcenter.client.model.strong.ChangeNoticeRevision.

You need to make sure you include the TcSoaStrongModelCm_<version>.jar in your project.

 

What I normally do when developing is include all the jars, then when I'm done I run with -verbose:class and parse the output to determine exactly which jars were loaded, then I trim the classpath down and retest.

 

 

You can also test the type of a ModelObject using obj.getTypeObject().isInstanceOf(classname).

Re: Creating ChangeNotices with Java SOA Libraries

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Thanks Jonathan. It worked best for me.

Re: Creating ChangeNotices with Java SOA Libraries

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hi Jonathan,

 

I have got the ChangeNoticeRevision class from jar. Everytime I do dmService.loadObject(new String[] { itemRevUID }) it returns me ItemRevision, But I am not able to cast it to ChangeNoticeRevision.

 

Though if(modelObj.getTypeObject().isInstanceOf("ChangeNoticeRevision")) returns True , I am not able to cast modelObj to ChangeNoticeRevision. However, I am able to cast it to ItemRevision.

 

Can you please guide what I am missing here ?

Re: Creating ChangeNotices with Java SOA Libraries

Siemens Phenom Siemens Phenom
Siemens Phenom

Apologies for missing this out earlier.

You need to add a call to initialise the object factory in your code.

 

import com.teamcenter.soa.client.model.StrongObjectFactoryCm;


StrongObjectFactoryCm.init();

The object factory is in the same jar as before.

 

The call adds a mapping of names of types to their class constructors, so that the SOA infrastructure can return the proper concrete object types to your client code.  Without the mapping being initialised you just get nearest base class that is already defined.  In your case this is ItemRevision.

Re: Creating ChangeNotices with Java SOA Libraries

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hi jonathan morris

 

I need some help here, I used same code it is working for me too, but I have little bit different requirement here.
While creating the initial revision there is Date property, it’s mandatory property on revision, how do I pass the date while creating initial revision of the Change Item.

 

Thanks!

Re: Creating ChangeNotices with Java SOA Libraries

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi @UmeshProlim 

    You should be able to do something like the following;

 

Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
createInput.dateProps.put("YourDataProp", cal);

 

You can use Property.parseDate(String) to turn a Teamcenter formatted string into a Calendar.