|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息
. S% X9 o2 D* C: {
! i7 r! m$ R- ^4 \5 v6 V
3 Y6 V' y$ Q( p) _3 _1 p8 H public static void getAllItemRevisionsOfItem(ModelObject[] item_list)
0 ]+ q7 d3 e6 H8 b0 c* X {
4 F: l/ }8 J. c: _ if(item_list == null) return;6 k1 V2 q2 Y; u% H6 y" D8 m( Z
& Z4 [3 P s' x& A: X SimpleDateFormat format = 0 \+ q3 s* o# g1 i, M+ t
new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));
8 U1 ]3 w/ i `; g) d: @
/ b6 y2 ^( c0 L/ C# |+ S6 b for (int ii = 0; ii < item_list.length; ii++)# P2 |. D t2 ?. ]0 n! i. i/ Y
{
2 Q# B3 R9 a" p8 @" [3 N System.out.println("\nItem Revision List\tLast Modified");5 m* S" s5 z4 i
System.out.println("====================\t=============");
8 j/ r* T" \: r7 N# s9 k
. G/ G* G9 E) i( @% Y DataManagementService dm =
: g* R1 ~. N$ [ DataManagementService.getService(Session.geTConnection());
9 k' k" l' L# G# z+ d
, N, ~# X# o. S$ c String[] attributes = {"revision_list"};; l: v2 X5 ?' \( [) ?
dm.getProperties(item_list, attributes);
/ @6 m6 _: j$ y! X* t2 t8 [/ n- f; j) U# { V
try' H5 K& P/ O' i; f7 Z
{) R* v3 A; B; @
ModelObject[] rev_list = % z/ l! v" |! `) N i* W
((Item) item_list[ii]).get_displayable_revisions();5 ^9 J6 M4 U/ c$ t( q5 {4 `
for (int kk = 0; kk < rev_list.length; kk++)0 o* T' E b" S( `1 C
{+ X a9 F6 \ @3 s/ O
String objectString =
: r$ k9 t- a- {! t' y3 K$ i7 r ((WorkspaceObject) rev_list[kk]).get_object_string();
5 ?% g& L& v8 a3 M Calendar lastModified =
- _, T+ W; J/ `8 I ((POM_application_object) rev_list[kk]).get_last_mod_date();- d5 Z- a5 I7 }4 E! V7 i2 I
System.out.println(objectString + "\t\t" +
6 y; M) C! R! I format.format(lastModified.getTime()));
" J0 g& n( h% L# i. } }
8 d* q/ T1 R2 G0 Z7 a2 ^ }5 w2 y) V J6 `) d8 u
catch (NotLoadedException e)
4 G# O; [( c' v$ o& A4 S8 ?4 F$ A {9 X, R& \) D1 @+ b4 r( K% J
System.out.println(e.getMessage());3 m0 e! ~' U* k! j6 g* g! c
}/ n% P/ _1 S. V: [" ]$ k
}, X/ M1 m8 l7 ?3 t! _
}3 Y5 f) N3 W# F) h
|
|