|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/ X4 ?: S ~. ]( m- B: J' i/ L0 @
Teamcenter SOA开发源码: 打印对象信息
* i( k+ r+ A' a4 R
0 T4 [3 O+ k7 J8 t+ M9 c6 U. a! c
[mw_shl_code=java,true]import com.teamcenter.clientx.AppXSession;5 Z1 y4 k$ \: ^( `& K! I' y
import com.teamcenter.services.strong.core.DataManagementService;
6 T. r8 V. y& J2 Ximport com.teamcenter.soa.client.model.ServiceData;
% c5 g& L. p3 K' L0 timport com.teamcenter.soa.client.model.ModelObject;
0 Z0 G- Q6 I6 F, q- q: O" `( Oimport com.teamcenter.soa.exceptions.NotLoadedException;' R W* F$ r0 O; x
3 `$ w" S* P8 Y
' A7 O) { ? I public void printObject_strings(ModelObject[] objects)
K! E# \( j7 ?; O. Y0 l. }: ?$ z+ \7 S {
6 ^5 Z2 f8 ] J* R( S DataManagementService dmService = DataManagementService.getService(AppXSession.geTConnection());5 g; g: c/ J, r0 H
if (objects.length == 0) return;' \8 S! ?) ?0 v0 o7 V
String[] attributes = {"object_string"};' r, E9 h+ x0 f! Z
dmService.getProperties(objects, attributes);
' f7 @' [$ Y$ i4 `1 t$ ] for (int i = 0; i < objects.length; i++)
! G+ W8 i0 N4 O) S0 ]0 i u% T- [8 } {$ J2 I3 g6 f& B6 I' j' W
String type = objects.getTypeObject().getName();+ G- G+ g5 E% x9 x$ e
String objectString = "";1 R" O, w; @% f' _4 m _, z! Y9 h/ c
if (objects.getTypeObject().isInstanceOf("POM_object"))3 G7 o$ {8 ^# l, {- v
{0 n; Z! r: O# K2 A: N
try
! j1 H4 z0 |4 t; z {
: j3 x" ?! Z2 A0 U objectString = wo.getPropertyObject("object_string").getStringValue();6 }9 Y3 a* e/ x' I1 x8 u
}- V$ b) C1 K6 H1 t
catch (NotLoadedException e) {} // just ignore
# ?& x; O3 i s) t5 V5 T% _4 g }
7 K/ h. j; Z, ]: Y, c6 G x System.out.println(" " + objectString + "(" + type + ")" );2 e, M8 K9 y& d5 r/ {0 p
}! s( P$ p% z; O& C! @, z
}[/mw_shl_code]
$ o) F0 m0 n: @+ D% L# l |
|