|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息. Y8 D' z: K1 w" p2 c
0 P+ E, _4 p$ X" }+ j* G7 j
( a# k: v- p& ?2 t& z2 s* c
public static void getAllItemRevisionsOfItem(ModelObject[] item_list); @ T) i2 `% n2 h
{2 b2 c: _& {3 J% g; \# S
if(item_list == null) return;
* m6 @% ]8 k$ I( y6 ?# T ?" c2 e3 }, B7 o1 a3 i
SimpleDateFormat format =
8 m+ v* d: i5 y new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));
- |9 U% X$ O) H/ B& Q
! l0 s) N2 a. M' g1 J* Y for (int ii = 0; ii < item_list.length; ii++)
8 `' u$ p/ F* } t! x0 s: m4 Q3 U {+ d2 Y* }0 j# H! c4 v
System.out.println("\nItem Revision List\tLast Modified");' {3 c& r( w# f$ }
System.out.println("====================\t=============");
+ e# h3 T5 v) F' ~/ a7 I- f% w5 @7 }4 d, ]2 n* s& }6 u' c
DataManagementService dm = 0 {1 E0 x+ @( X0 U+ k! j6 f X8 B
DataManagementService.getService(Session.geTConnection());3 G* C. n& `- } m0 n' q/ o' P
% H' R- r) [6 S# V' n* o' M8 ^6 ^ String[] attributes = {"revision_list"};
* B! j! S: I. S+ R; C' W S dm.getProperties(item_list, attributes);
8 s3 o6 T' A5 J; L+ \* Y5 ~/ G$ c) m/ Y# j8 Y J
try
; o4 [" E4 D0 I* O6 B) R" [ {/ g3 M. l. | {! m( P) N- C w
ModelObject[] rev_list = 2 q; g" c! w1 P( n* w/ H
((Item) item_list[ii]).get_displayable_revisions();
& i- v7 K7 V9 Y. l9 e for (int kk = 0; kk < rev_list.length; kk++)! _$ [3 l0 Y8 i4 |- T
{( F1 x- d5 C% t4 f' {* E
String objectString =
, g) f5 H' F @2 w1 O9 K" O, S ((WorkspaceObject) rev_list[kk]).get_object_string();. o# U$ k0 c: Y6 K+ k: C$ P
Calendar lastModified =
) D! E8 G* x; o; w v. v ((POM_application_object) rev_list[kk]).get_last_mod_date();
4 a5 b1 y g1 Z0 A System.out.println(objectString + "\t\t" + ) l& i# I8 l, D9 J
format.format(lastModified.getTime()));+ a) l5 o( W) `" k& p
}
7 d' d3 H; K1 z3 Y3 i! T2 ? }4 i, D( ^4 f1 D6 M! F5 X4 b
catch (NotLoadedException e)6 j$ F7 F) X3 W; e+ i' I5 V
{' b3 O N- p" M3 G$ o8 d
System.out.println(e.getMessage());+ m- b3 |7 l4 ^2 [* n0 |
}1 I5 f0 g2 ?" W3 r# s. u& m Q- d
}
+ c: L" u! ]# q4 v }2 _& x$ N- y4 n' X
|
|