|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) V, a+ T0 }/ B3 ^
Teamcenter SOA开发源码: 打印对象信息
7 Q4 l! O0 j1 s2 d$ b- ~
" J; y$ ?( N$ ?( D+ X. u% m! X# g" I
[mw_shl_code=java,true]import com.teamcenter.clientx.AppXSession;
7 J" L( g1 z; ~ \) Wimport com.teamcenter.services.strong.core.DataManagementService;: H; Z L* r( L) N+ y+ t
import com.teamcenter.soa.client.model.ServiceData;
/ j9 j$ l% z4 c$ b1 U. fimport com.teamcenter.soa.client.model.ModelObject;
W1 k# I8 Y$ N2 E, L. [ m# Wimport com.teamcenter.soa.exceptions.NotLoadedException;
# }( k. i9 E5 D0 N0 F6 h
' w4 J' }" h5 h) W3 g* L g
1 l5 d1 [: S- f' P3 S! s) r0 n public void printObject_strings(ModelObject[] objects)
! l5 D i- D' v& D9 j& {6 Y {
5 K, n! L5 \2 E% f2 h4 N1 c DataManagementService dmService = DataManagementService.getService(AppXSession.geTConnection());
0 f$ J- o: P! `) a3 O, d }) ?% t if (objects.length == 0) return;- C& Z+ }, X9 H2 a) [; A
String[] attributes = {"object_string"};! q- g) y7 x3 m, b
dmService.getProperties(objects, attributes);( \6 G! [/ M: x9 F* [/ {9 f
for (int i = 0; i < objects.length; i++)
. K1 c2 U% L& e1 b {) ?! C: k& ^7 q, s P9 s' c
String type = objects.getTypeObject().getName();
- D7 Y! ]0 U% T$ z String objectString = "";$ j" [3 K6 n( |1 N2 @2 f
if (objects.getTypeObject().isInstanceOf("POM_object"))
! x/ c0 H# H. b) W. Y {" V7 k: ~& V2 T1 ]3 j7 R
try
# ~$ W% q2 U! W% f {
$ q$ P7 b3 S$ ~ objectString = wo.getPropertyObject("object_string").getStringValue();% m8 R) g9 ]! b* D x0 }
}, D7 i2 `3 Q* g
catch (NotLoadedException e) {} // just ignore: y* m: @2 @2 Q Y
}
% D, u1 R, _7 h; w1 F System.out.println(" " + objectString + "(" + type + ")" );( j; e* c" ^$ O
}, x4 o% g; C2 q9 r3 g& P
}[/mw_shl_code]
3 I3 l: Q+ [+ K( a: n: u" z |
|