Showing results for 
Search instead for 
Do you mean 
Reply

TC Classification Save Post Action Custom Hook


Hi All,
I am trying to find a way to get "user data" value of a Classification node Class in RAC Java Customization Plugin, which I am using as G4mSave Post Action Custom Hook.
If anyone of you have any idea on how to get "user data" attribute & LOV values of ICO objects from Java APIs, please shed some light.
Appreciate your time.
Thanks,
Anbu

4 REPLIES

Re: TC Classification Save Post Action Custom Hook

Hi Anbu,

 

you should be able to use the AbstractG4MContext object that you inherited. That gives you access to the form (in which the to be saved ICO values are). The current active view is also available here...

 

I assume you need "user data 1/2" from the class in which you want to classify. So the code snippet would be:

m_context.getICSApplicationObject().getView().getClassExtension1/2()

 

HTH

Danila

Re: TC Classification Save Post Action Custom Hook

[ Edited ]

HI Danila,

Thanks for your time.

I am using TC 9.1, it says, 

"The method getClassExtension() is undefined for the type ICSView"

 

Adding to my question, I found a class

  • com.teamcenter.services.strong.classification._2007_01.Classification.ClassDef

which has the field, "userData1 & userData2".

But I need to find which method returns this Object (ClassDef) so that I can get the details.

Also, there could be some ways from, still exploring.

m_context.getClassificationService()

 

FYI, I have ClassID & ClassName, with that I need to get that UserData values & LOV Keys & Values of ICOs.

 

 

Thanks,

Anbu

Re: TC Classification Save Post Action Custom Hook

Hi Anbu,

 

oh Tc9.1., this function is not available there.

 

The class you are refering to is used for SOA response objects, so they are not related. But this seems to be a good alternative, use the Classification SOA getClassDescriptions(). This takes the class id as input.

 

Regards

Danila

Re: TC Classification Save Post Action Custom Hook

Hi Danila, thanks again.

I am able to get write that method but while running, I am getting ClassDefNotFound error for ClassificationService class. I think am missing some obvious things in setup.

Here is the snippet from my code. please advise me on what am missing here. I am trying it now in TC 10.1.2

 

import com.teamcenter.services.rac.classification.ClassificationService;
import com.teamcenter.services.rac.classification._2007_01.Classification.GetClassDescriptionsResponse;
 
 
            // the icsApp contains the Data of the classification instance
ICSApplicationObject icsApp = m_context.getICSApplicationObject();
 
            // get the classified object
            TCComponent tcComp = m_context.getClassifiedComponent();
 
            String classId = tcComp.getClassificationClass();
            String[] classIdArray = {classId};
            
            // Getting userData values from Class using ClassID
            
            ClassificationService newClassService = ClassificationService.getService(this.m_context.getSession());
            GetClassDescriptionsResponse newClassDescResp = newClassService.getClassDescriptions(classIdArray);
            Map classObjMap = newClassDescResp.descriptions;
            
        if (classObjMap!= null) {
            Set<String> setOfKeys = classObjMap.keySet();
            Iterator<String> iterator = setOfKeys.iterator();
            while (iterator.hasNext()) {
            String key = (String) iterator.next();
            String value = (String)classObjMap.get(key);
            System.out.println("Key: "+ key+", Value: "+ value);
            }
        }