|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息! x4 h6 B# t0 }0 E! O) h
: J9 a, Z& r& D! l) p* H" d
' L* c# N- }$ G' F" s public static void getAllItemRevisionsOfItem(ModelObject[] item_list)
1 t* C% |! h ~& Q {2 M- X" G' L7 ?$ O8 _; ~
if(item_list == null) return;
5 [) P9 k) O$ V' O3 u
- I1 w2 Z1 S7 D1 o SimpleDateFormat format =
S8 z9 V5 e& B5 O9 S* j" e x new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));) u. r. I! z+ I/ u
" J: K) s; T6 @( D
for (int ii = 0; ii < item_list.length; ii++)8 `" s" }$ e2 g8 N. o7 L
{
" O+ b F) e! Y0 d1 [/ b, [ System.out.println("\nItem Revision List\tLast Modified");* N ?6 b3 K* ?% \+ K' n7 f$ S
System.out.println("====================\t=============");6 W# s7 y8 Z3 `9 K, E3 b% y
* p$ R4 D' S6 I' I; n2 K
DataManagementService dm =
- h3 L' y: m$ d; Q DataManagementService.getService(Session.geTConnection());
$ w4 n0 p) ^- a4 R2 u% D* P: W6 o8 X% F$ S" ~6 g( q
String[] attributes = {"revision_list"};
: g8 M7 r; w6 o4 U dm.getProperties(item_list, attributes);: q' W. M/ ^4 z, c
6 c; i5 t, E0 K' }& B- t try
, p( f- |, f: o' g4 u {. e- \ ]; M# r
ModelObject[] rev_list =
0 C- ^ K& |& b, k+ M% k* y ((Item) item_list[ii]).get_displayable_revisions();' v9 P/ W* u! A* f% Y) z
for (int kk = 0; kk < rev_list.length; kk++)
# _) M# x1 A" ^" c {" \) c# x' G4 ^
String objectString =' g+ S |- d! } O4 [! b7 o
((WorkspaceObject) rev_list[kk]).get_object_string();
5 E1 F' l+ ?4 L3 u Calendar lastModified = ) ], c8 ?6 F3 H) L' S9 j' s
((POM_application_object) rev_list[kk]).get_last_mod_date();0 @1 E) _9 W: J
System.out.println(objectString + "\t\t" +
2 P( D; J6 Q" M% J$ z( M6 @/ A format.format(lastModified.getTime()));
- G# E2 B7 p0 }4 Q8 u8 z$ J }( \7 P6 ^9 y& Z7 d1 a0 N$ J
}' ~+ X4 _- q7 V9 B
catch (NotLoadedException e)) l2 O! O4 k u: B, F
{
- w. n7 C; R9 X3 B System.out.println(e.getMessage());
9 q9 A3 X4 u; c% I/ r2 y }
* G% {4 _% R& l" s* @- j; _/ d. B% } }
+ B, C! ?4 x- y% x/ U( ^ W$ C( m2 s }8 B8 \9 u1 m) F, s
|
|