Wednesday 14 December 2016

SOA Service Client : Get Wherereference

How to Get Where Reference for object in Teamcenter

 private static void whereReferenced(ModelObject modObj)
    {
        WorkspaceObject[] arrWorkspaceObject = new WorkspaceObject[1];
        arrWorkspaceObject[0] = (WorkspaceObject) modObj;

        //com.teamcenter.services.strong.core.DataManagementService

        DataManagementService dataManagementService = DataManagementService.getService(connection);

        WhereReferencedResponse whereReferencedResponse = dataManagementService.whereReferenced(

                arrWorkspaceObject, 3);//3 represent number of levels

        if (whereReferencedResponse != null)
        {
            WhereReferencedOutput[] whereReferencedOutputs = whereReferencedResponse.output;

            if (whereReferencedOutputs != null)
            {

               for (WhereReferencedOutput whereReferencedOutput : whereReferencedOutputs)
                {
                    if (whereReferencedOutput != null)
                    {
                        WhereReferencedInfo[] whereReferencedinfos = whereReferencedOutput.info;
                        if (whereReferencedinfos != null)
                        {
                            for (WhereReferencedInfo whereReferencedInfo : whereReferencedinfos)
                            {
                                System.out.println(whereReferencedInfo.referencer);
                                System.out.println(whereReferencedInfo.relation);
                            }
                        }
                    }
                }
            }
        }  
    }

No comments:

Post a Comment