String oid1="OR:wt.part.WTPart:261597138";
WTPart part=(WTPart)GenericUtil.REF_FACTORY.getReference(oid1).getObject();
out.print(part.getIdentity()+"<br/>");
QueryResult qr=WTPartHelper.service.getUsesWTParts(part, GenericUtil.LATEST_CONFIG_SPEC);
out.print(qr.size()+"<br/>");
while(qr.hasMoreElements()){
Persistable[] p=(Persistable[])qr.nextElement();
out.print(p[1].getIdentity()+"<br/>");
WTPart part=(WTPart)GenericUtil.REF_FACTORY.getReference(oid1).getObject();
out.print(part.getIdentity()+"<br/>");
QueryResult qr=WTPartHelper.service.getUsesWTParts(part, GenericUtil.LATEST_CONFIG_SPEC);
out.print(qr.size()+"<br/>");
while(qr.hasMoreElements()){
Persistable[] p=(Persistable[])qr.nextElement();
out.print(p[1].getIdentity()+"<br/>");
}
红色字体需注意:
通常我们会用Persistable p=(Persistable)qr.nextElement();去接受参数,此时系统会报错,显示如下:
用Persistable[] p=(Persistable[])qr.nextElement();数组接收显示成功,进一步打印数组内容:
数组第二个为我们要获取的WTPart对象。