Quantcast
Channel: PTC Community : Unanswered Discussions - Windchill
Viewing all articles
Browse latest Browse all 3592

API to get List of Attributes from WTPart

$
0
0

Hi All,

 

I am using below code to fetch IBA values for WTpart,

but in this program i have to give input as IBA name.

i want all IBA for that part which having any value or null,

as shown here fig.

 

 

 

 

11-5-2015 2-16-06 PM.jpg

Please check my code and let me know where i am did wrong.

 

Regards,

Vivek

 

package test;

import java.util.Locale;

import wt.util.WTContext;

import wt.util.WTException;

import com.ptc.core.lwc.server.LWCNormalizedObject;

import wt.method.RemoteMethodServer;

import wt.part.WTPart;

import wt.fc.ObjectIdentifier;

import com.ptc.core.meta.common.UpdateOperationIdentifier;

import com.ptc.windchill.uwgm.common.folder.FolderHelper;

import wt.vc.wip.WorkInProgressHelper;

import wt.fc.PersistenceHelper;

import wt.fc.ReferenceFactory;

import wt.fc.WTReference;

import wt.fc.Persistable;

import wt.httpgw.WTContextBeanHandler;

import wt.method.MethodContext;

import wt.session.SessionContext;

import java.io.Serializable;

import wt.method.RemoteAccess;

public classIBAHandler3implementsRemoteAccess{

@SuppressWarnings("deprecation")

public static void main(String[] args) {

   try {

  RemoteMethodServer myServer = RemoteMethodServer.getDefault();

  myServer.setUserName("wcadmin");

  myServer.setPassword("ts");

  Class aClass[] = {};

   Object aObj[] = {};

  myServer.invoke("change", IBAHandler3.class.getName(), null, aClass,aObj);

  }catch (Exception e) {

   //Handle exceptione.printStackTrace();

  }

}

public static void change(){

   try {

  ObjectIdentifier oid = ObjectIdentifier.newObjectIdentifier("wt.part.WTPart:215486");

  WTPart part = (WTPart) PersistenceHelper.manager.refresh(oid);

  System.out.println(part.getName());

  LWCNormalizedObject obj = new LWCNormalizedObject(part,null, null, null);

  System.out.println(obj);

  obj.load("FURNACE TYPE");//Logical Identifier

   Object str = obj.get("FURNACE TYPE");//Logical Identifier

  System.out.println("-------PTC TEST-------------"+str);

  }catch (Exception e) {

   //Handle exception

  e.printStackTrace();

  }

  }

}


Viewing all articles
Browse latest Browse all 3592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>