|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息
5 h- u7 f z. B* W* O3 ~6 G! f6 x
' E; {, n. G; ?7 G
; y" f, ^2 o1 x# x6 t public static void getAllItemRevisionsOfItem(ModelObject[] item_list)
5 z* D! C4 W3 N% l {
! ]5 e9 R& v. t8 h3 w& y% y if(item_list == null) return;& q; o9 X1 o0 \! h; x( u
9 q! p: h+ D. q SimpleDateFormat format = : f2 O) Y1 m& ?( z4 k
new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));2 k3 F; ?+ c) N* j+ \# a
/ f/ L s% U" F; M( N3 ? for (int ii = 0; ii < item_list.length; ii++)5 g& M- `% I7 ~" b' _+ E* X+ H; R% \1 x
{
* P8 w4 q& ^' ~0 T$ H/ \ System.out.println("\nItem Revision List\tLast Modified");
$ H7 A9 }! m1 {. H8 z) N( F% Q System.out.println("====================\t=============");1 v" J$ @ b! r3 D
7 K& a e8 a ?: @' r5 C' c3 ` DataManagementService dm =
$ Z2 e- l% `; p) g! E% q DataManagementService.getService(Session.geTConnection());' m7 b& e8 D: s! s4 M
# S. U) E& k4 B$ x1 B' s7 { String[] attributes = {"revision_list"};, c5 [1 e" G) m+ a, J$ L/ Y$ \2 y
dm.getProperties(item_list, attributes);
. G% z' z. o9 T; @: x/ M" s, s7 j% l. |: x; o: \$ u) Q7 j
try) h: Q6 q( D" ~, j; U9 J
{
2 T' g9 D) O- R- D" U ModelObject[] rev_list =
3 l8 o4 ?7 O r3 _5 d8 |% L8 \+ G ((Item) item_list[ii]).get_displayable_revisions();5 U) O; t, [) C/ o1 E+ |. `2 `
for (int kk = 0; kk < rev_list.length; kk++)) w S# ~6 C( h C0 e4 s
{
; d$ P Q* k8 z4 ]% }2 e: v8 A String objectString =
$ t' f. }) A4 H+ @. L# }0 [ ((WorkspaceObject) rev_list[kk]).get_object_string();: p* z, i6 S+ `, x
Calendar lastModified = & |: E! d) E: o
((POM_application_object) rev_list[kk]).get_last_mod_date();
2 i1 i( K+ T6 i' t# O" h: e System.out.println(objectString + "\t\t" +
4 y3 i7 c1 J$ I1 o. l) I format.format(lastModified.getTime()));, g J* \# R0 r4 Q; i! M" c& Q
}
0 f* [% \* [8 n! i1 _ }
* Y& L8 H; _5 E9 N( [2 W* i: q1 I catch (NotLoadedException e)& { ^5 w, B, y. m# S
{7 P" |5 b+ Q, |6 R+ | f9 S4 b
System.out.println(e.getMessage());
! A- w' c$ G7 m: k8 ^1 h }8 u8 i! Y$ X8 C
}
! _( C' Y+ [+ \# a) W- I }
, W+ g; X' z+ _+ ^ |
|