|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ ^' Z& E/ L- a$ XTeamcenter SOA开发源码: 打印对象信息
4 \- e9 F! `$ s* Z5 B/ j! L
- H4 D3 \% h3 n p- @+ A/ {# Q* _8 o8 E2 n
[mw_shl_code=java,true]import com.teamcenter.clientx.AppXSession;
+ ^9 R( N' x1 y% J. P4 O& X) a% h. ^import com.teamcenter.services.strong.core.DataManagementService;5 V; Q3 ?' k" H5 \! S
import com.teamcenter.soa.client.model.ServiceData;0 t$ _, g5 F% G1 O
import com.teamcenter.soa.client.model.ModelObject;, D: O9 M4 n6 _/ y L9 z
import com.teamcenter.soa.exceptions.NotLoadedException;
. N8 V3 k" f8 Z0 Q. G" Q; `' w3 V& ~* ]( F6 J
1 M% ?( v; p& k
public void printObject_strings(ModelObject[] objects)
5 }9 o6 `- s- t9 P" z) t {
1 I8 Y3 Z6 K; I5 }" i& r; z5 h# [: O DataManagementService dmService = DataManagementService.getService(AppXSession.geTConnection());* W7 I' Z9 I+ h+ m% Y
if (objects.length == 0) return;$ `" E/ j% R/ e3 D+ c% H" ?" z- q* c
String[] attributes = {"object_string"};
2 _* j5 B3 R) X: {2 ]/ k( u, H dmService.getProperties(objects, attributes);
! P# H2 m9 U8 |8 o& O. C5 t6 T for (int i = 0; i < objects.length; i++)
5 @0 R$ y6 y5 z' F# r1 j2 Q {: m% N6 @! f6 K5 B* f
String type = objects.getTypeObject().getName();
/ F$ L% g) N) q. F9 B5 x String objectString = "";& @0 e- {; s9 E8 }' A
if (objects.getTypeObject().isInstanceOf("POM_object"))
$ V/ [9 k, f4 d- n {5 n& R4 M* o: c- \' h, d
try
9 ]- P: x; g/ ]9 @) ?. c' j: c- O, n {/ ^. Q0 g5 C2 W3 k
objectString = wo.getPropertyObject("object_string").getStringValue();* I! `" n4 T! g
}
8 G' s8 E- [# b2 S3 Q" {/ V6 \5 N3 e$ A catch (NotLoadedException e) {} // just ignore
/ r8 F# [+ K) ]2 k% b }
0 c9 n$ h7 Q# T+ D6 f5 @2 W" o0 P System.out.println(" " + objectString + "(" + type + ")" );7 ?% a1 Y( \5 L# |6 p2 E3 w7 c w' N$ _, H
}
9 R& w { V" |/ E/ f }[/mw_shl_code]
7 n h$ B% t& M. }6 \ |
|