|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息2 W+ _! U3 u7 i1 z- ?4 ~' s& X# }
/ v( Q1 ^) R2 T$ a
, H* O0 V+ w7 u# w public static void getAllItemRevisionsOfItem(ModelObject[] item_list)
) s2 E% d0 A/ J$ v0 ]6 f {
O/ N% f# ?$ m4 n2 { if(item_list == null) return;% ~) [- j# o, B7 w: K$ Z! }6 ~. m9 b
. ]2 K) H2 o7 W. s- v! ? SimpleDateFormat format = + k( o8 x+ t9 ]5 Q
new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));( Z$ R. l' j. h" Q- F
% ]- h. s0 _1 m* R- V
for (int ii = 0; ii < item_list.length; ii++)7 i4 u( E/ _1 W' ^' L
{: I4 o0 n1 W1 d- c% p3 S* f
System.out.println("\nItem Revision List\tLast Modified");! L' k8 S. r4 T' V" I
System.out.println("====================\t=============");: v* I& f# T6 S) R
( a: R0 x/ x7 j6 j DataManagementService dm = : t4 _! o, S+ z3 b' \$ J
DataManagementService.getService(Session.geTConnection());0 z7 I: r8 D/ L) d& \, u
' H2 u4 I! h, Q String[] attributes = {"revision_list"};
2 ~% X9 d. ~% L9 R, m dm.getProperties(item_list, attributes);
8 X& h% Q! [$ ^- q5 M$ ?$ E$ }" Y7 {+ i
try
3 k; \. M2 N( \3 P! }" D6 b0 H/ j6 W {
: |; N+ T& o1 W* h4 v: T6 Y ModelObject[] rev_list = . {. B2 s4 u& A0 I0 f; T6 V$ p* p) O F
((Item) item_list[ii]).get_displayable_revisions();) B4 O) a5 w8 n4 V$ {
for (int kk = 0; kk < rev_list.length; kk++)
4 A$ l! c8 a( m' \6 p9 N {" Y O' S# A: N$ A5 B
String objectString =% ?: p5 T# S1 {9 c8 v
((WorkspaceObject) rev_list[kk]).get_object_string();6 q+ C& l% a4 m5 C0 \! d& B
Calendar lastModified = 7 i6 X- m7 f: q$ R: f8 Y5 V3 T
((POM_application_object) rev_list[kk]).get_last_mod_date(); D- _6 _ ]8 W
System.out.println(objectString + "\t\t" +
0 `8 n) K6 f: z format.format(lastModified.getTime()));
5 c" X2 X( B0 a% v" b5 p9 E w. Z ^ }
1 i- u* F) W. C2 D( T; K3 @6 `" P }* H. ]' k7 m0 N1 R: U7 E
catch (NotLoadedException e)
' k) Z2 Y$ d6 a& X1 {" f' V. w6 [ {, S1 e# } u7 a" {1 ~
System.out.println(e.getMessage());6 M4 d2 p3 ^4 }! W0 t" ?9 C V
}
8 p+ h* a- I% n# B) G5 A) V& t }' r, ]& P0 n; s
}
, {% _ b+ X# Q. p |
|