|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 u0 R+ ^; @; N" x6 f; aTeamcenter SOA开发源码: 打印对象信息
3 v& A7 I9 ~/ n( O# D9 j8 Q: N9 I. A& U8 Q" [- K5 G& @
) j0 z0 T/ c- U# h8 |& M[mw_shl_code=java,true]import com.teamcenter.clientx.AppXSession;
9 C0 w6 l; F: q8 Q& H3 d1 Eimport com.teamcenter.services.strong.core.DataManagementService;7 z6 X+ O* x$ G
import com.teamcenter.soa.client.model.ServiceData;! Y& H* A1 x1 }: _1 ]* z! s# m
import com.teamcenter.soa.client.model.ModelObject;* H7 T1 Z9 u3 k7 |
import com.teamcenter.soa.exceptions.NotLoadedException;
0 R- p6 I& s, o% p) Z! D% D/ e8 f
4 E3 y4 Q6 M/ l3 V
7 J. Y7 C9 m; y- V" C% Y public void printObject_strings(ModelObject[] objects)7 o' X# B% j0 H( p0 ~
{
& p& L/ O+ |0 i1 `2 h& p8 i1 W DataManagementService dmService = DataManagementService.getService(AppXSession.geTConnection());
2 u& k0 W& A: ?8 J; A if (objects.length == 0) return;
* J% e0 c% {- L. @: ` String[] attributes = {"object_string"};) ^ M4 ?. b$ {. s- P y6 T
dmService.getProperties(objects, attributes);* J5 }, g% p8 Y9 G. d6 ~
for (int i = 0; i < objects.length; i++)1 M6 M5 K- u, i- J2 A3 d; l
{
' ?9 g _' T$ w% U, k% f' y- N String type = objects.getTypeObject().getName();
% j0 j$ a h, _6 z0 t I: Y: V' A String objectString = "";
3 W2 k1 _+ [* Y1 @ if (objects.getTypeObject().isInstanceOf("POM_object"))" h5 R9 q' j/ U& w2 a0 H
{
% ]. j! n4 r( y try+ o. M7 _! O- E6 K! U5 {/ e
{
1 S/ w& [/ c# k) `) J objectString = wo.getPropertyObject("object_string").getStringValue();
! u$ z! S8 K) ]) B$ P }
* D8 y6 \2 `8 k& ^* d8 O! Y# C/ y" w catch (NotLoadedException e) {} // just ignore
5 i% K, R$ d2 u4 a+ W }0 j/ B& P7 Y" @5 c& q6 Z& t0 O" l
System.out.println(" " + objectString + "(" + type + ")" );
7 C1 a3 D' A4 t# y. ?! W* S" Z }
' @- ^% t: I/ U7 s& Q }[/mw_shl_code]- l# z: d5 M0 O5 ^0 d5 S! m
|
|