|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息
0 e4 `& {4 p4 z& ]/ L; p# ]
/ S) ?, D( G S$ M- ~* J4 Z7 ?
/ N1 ~- r/ s$ s) g5 K$ Y public static void getAllItemRevisionsOfItem(ModelObject[] item_list); R7 ~+ p7 G+ f% A O
{
( i. X! T' Q+ j* v& l# @ if(item_list == null) return;) K/ ^9 z+ Y" U M+ S2 w3 Z( x$ m
$ d1 T ]& m7 G: ~! w
SimpleDateFormat format =
( [* ?! s0 j% K$ g# [/ @ new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));6 @: G q7 H q# j
7 v" \* e- c, a% V( `$ j
for (int ii = 0; ii < item_list.length; ii++)* V$ ~3 F8 F4 H+ u8 u/ r8 y5 ]* l
{* t8 r) @* y4 s' o. U
System.out.println("\nItem Revision List\tLast Modified");
0 _+ I/ j8 r" a5 ~: H7 r System.out.println("====================\t=============");
) C7 H) ^# a# ^# k9 y) A( Q& X5 q, L! N! s3 k
DataManagementService dm = 7 v0 N9 P5 m' E _
DataManagementService.getService(Session.geTConnection());
+ ?% k |7 I2 ~8 w1 x: R, u5 E' s. H$ _, ?, Q+ e4 X, Y
String[] attributes = {"revision_list"};- G* u! {) y- r* E: K- G8 l; f: M
dm.getProperties(item_list, attributes);8 f0 {: b4 i- u. e$ L
" P7 j/ I6 l# M0 h/ v
try
0 }. }$ b& e+ s# O, M {
8 O5 p+ V5 O! k ModelObject[] rev_list =
( U i5 h" A% h# b! v ((Item) item_list[ii]).get_displayable_revisions();
3 U1 R! T' v: v) W9 D8 I for (int kk = 0; kk < rev_list.length; kk++)' a6 b- [9 P' Q; {6 [
{4 [1 A4 o2 n- A
String objectString =' M$ y9 a# i. v
((WorkspaceObject) rev_list[kk]).get_object_string();
I3 i$ j1 P* w' G Calendar lastModified = / T8 {( @' l8 q
((POM_application_object) rev_list[kk]).get_last_mod_date();% n. a5 q5 C9 Z x
System.out.println(objectString + "\t\t" + 4 l3 m6 V' L9 k& s( W- L$ z+ C
format.format(lastModified.getTime()));
) a, a! k9 K5 D. Q- D; f- X. u }+ O' Z2 z" ^% C5 J# B6 Q* U! f- a
}6 f8 |; z% r2 h% c' Z
catch (NotLoadedException e)! V" S6 @3 S* u! }! U( \
{
4 l) B1 J2 t! M7 G( c System.out.println(e.getMessage()); V; m: |8 p7 \4 {! d- E* Q
}' ^2 U2 f" R+ |9 K8 n4 K' D9 w+ T
}
% B% \: _. V; x) E i; t }
7 O7 u% B. F+ z9 x2 d t |
|