|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息1 O5 `6 f6 {/ ]* q6 F- V
+ n; \) C) M2 I+ U8 ]9 f ?
/ e- t8 j/ K3 N! t( b: q
public static void getAllItemRevisionsOfItem(ModelObject[] item_list)# ~8 t1 }6 `8 Z) i6 r
{
/ R! t8 X9 ]: l* _" O if(item_list == null) return;
1 K+ b1 ~" m8 \/ K" y, N3 {" u% f; i- ]
SimpleDateFormat format = . H; q5 L0 T. m0 C
new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));1 J: g/ s+ l4 F1 n# i
0 c' n3 s5 ~4 X; h9 M6 N for (int ii = 0; ii < item_list.length; ii++)
1 o9 Y( e3 g* \# O e {
9 M4 x/ @$ x+ g! ~4 F8 W System.out.println("\nItem Revision List\tLast Modified");
* q) l' l9 x, p* J; J% ` System.out.println("====================\t=============");" S9 f* c; D2 R# X3 A7 {# z+ R
( e6 R5 d0 @8 P8 @7 l& g
DataManagementService dm =
/ o+ W4 t1 v S' u DataManagementService.getService(Session.geTConnection());
" X6 }: T- v3 K- ~
! E! m, `9 ]. i* q, ~ String[] attributes = {"revision_list"}; z( N' B( {) e6 R- `
dm.getProperties(item_list, attributes);
7 ~/ |6 i. x9 K) B" K
3 c/ g( l0 V: ~2 {/ S try
- M( h& R$ N- C' _8 L' B5 T1 ]8 A" b {
, c# D7 l% }# V$ r0 K: H ModelObject[] rev_list =
* t4 R9 i7 P5 F J$ i) z5 v* c ((Item) item_list[ii]).get_displayable_revisions();, W* v" R2 L' I% w8 ~& Z
for (int kk = 0; kk < rev_list.length; kk++)
4 |9 H; |3 G+ ]2 f {
. E( J/ K- C ]0 v: ~! t4 k5 A/ y String objectString =
# }" j+ f# a: I4 i, { ((WorkspaceObject) rev_list[kk]).get_object_string();% p1 J* X8 _( C9 o5 t, `
Calendar lastModified = 2 z& `1 o2 O ^" G7 ?
((POM_application_object) rev_list[kk]).get_last_mod_date();
) l$ j, \9 [2 s7 U+ K/ E v System.out.println(objectString + "\t\t" + * q# z3 q# t- P% Y* R7 n0 F' N6 d+ T
format.format(lastModified.getTime()));
9 b% {0 F w8 H8 M8 N% U& E }- _8 t( F/ I2 a" U9 \7 Z
}
8 W6 C2 T. ~( k catch (NotLoadedException e)
% b4 N' H( f3 z( V {
: e; g9 n0 k0 ~4 W9 ` System.out.println(e.getMessage());- o* l( X- Q! \, ?4 f
}4 F5 G! _' @* d6 L& c7 b) \
}
- C+ F! _8 H3 t9 N9 H }
2 B4 f6 Z; P) | |
|