|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息
@4 C" H' _0 I' C: O$ A, c; t, h# t& W n9 j' _2 C
! O) M! {1 k3 g! s/ H% Q public static void getAllItemRevisionsOfItem(ModelObject[] item_list)+ i& c- V, I' {: Y4 `! q6 H9 d
{
6 X: g7 d. H! ~0 {! l if(item_list == null) return;7 a! l3 a( |7 P: ]- K% O) M' R
6 M0 b# O9 J- [" y% } SimpleDateFormat format = / V' f! c5 l8 I% Y$ _" x
new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));3 U, ]' `* Z- O; p; X" r
& e. [+ l8 p. h; a, R( t for (int ii = 0; ii < item_list.length; ii++)7 r- t; D6 E* f. Q! u' I6 G
{
, v0 N: @- t0 ~( R0 e System.out.println("\nItem Revision List\tLast Modified");
7 \5 X' C$ e# \/ R# W System.out.println("====================\t=============");
/ i( H) H6 Z( B+ s0 B6 p9 q! y$ W3 k0 v. m' n
DataManagementService dm =
( D( P6 Z' X0 {2 I+ C- o; Y DataManagementService.getService(Session.geTConnection());6 Z0 d+ K# B0 @! V& s
4 X3 n! R7 B% F% n6 g- i D
String[] attributes = {"revision_list"};
4 a% G# F9 ^4 I6 z4 i; K dm.getProperties(item_list, attributes);5 ]. `4 h" q4 q. j
. K; k' c" u2 ~ b& Z! G try' U# n' |9 H& O
{
( O0 I c6 }" u* ~+ w/ S4 ] ModelObject[] rev_list =
- c# V8 f% D9 V7 B! n* A ((Item) item_list[ii]).get_displayable_revisions();/ E# N0 v1 N/ G; V5 H
for (int kk = 0; kk < rev_list.length; kk++)
+ K3 {5 } o, z2 T( W {
: Q6 U% w! n2 ]( n% X" G+ Z String objectString =( S" k* a4 c" ]/ ~" Z: n' {
((WorkspaceObject) rev_list[kk]).get_object_string();2 I2 L2 X+ X$ R! H' s, U
Calendar lastModified =
6 `# X. F6 R, A" r8 \3 b5 L2 E ((POM_application_object) rev_list[kk]).get_last_mod_date();* U7 n V' S% ~9 p2 _0 R) A
System.out.println(objectString + "\t\t" +
! v) I3 j, ? T, E: B4 C$ l format.format(lastModified.getTime()));. t, B; A, V0 A8 k$ v
}; t4 C+ B9 V6 r
}
0 v' A' d. Y) K/ `* e catch (NotLoadedException e)
6 j3 ]; a) D) z' k( c. J {6 y! s+ V) X- k) i
System.out.println(e.getMessage());$ P4 q! d$ O: p L" u* F- _2 l
}
/ Z* x, D: g e9 [; M1 C }- a! U; Y/ t3 I% P' P3 e
}
, H+ U6 X- f- ^# I* f |
|