根据部件对象的oid查询部件

package jwis.retest;

import wt.fc.ReferenceFactory;
import wt.fc.WTReference;
import wt.method.RemoteMethodServer;
import wt.part.WTPart;
import wt.query.QueryException;
import wt.query.QuerySpec;
import wt.query.SearchCondition;
import wt.query.WhereExpression;
import wt.util.WTException;

/**
*
* @author Administrator
* 根据部件的oid查询部件信息
*/
public class PartOidSelect {

static WTPart part = null;

//根据部件对象的oid查询部件
public static WTPart getOidPart(String oid) throws QueryException{

//QuerySpec sqc = new QuerySpec();

//WhereExpression we = new SearchCondition(WTPart.class, WTPart, arg2)

try {
/*
WTReference rf = new ReferenceFactory().getReference(oid);

part = (WTPart)rf.getObject();

*/

ReferenceFactory rf = new ReferenceFactory();

part = (WTPart) rf.getReference(oid).getObject();


} catch (WTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return part;

}

public static void main(String[] args) {

String oid = "VR:wt.part.WTPart:16077";

try {

RemoteMethodServer server = RemoteMethodServer.getDefault();

server.setUserName("wcadmin");

server.setPassword("password");

System.out.println(getOidPart(oid));
} catch (QueryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//System.out.println(part);
}

}

猜你喜欢

转载自katch-chou.iteye.com/blog/1035558