|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息
9 R8 V- w6 L, z+ B
`$ s; k' z8 ?/ @ i; A, Y6 W0 e
. a, {3 w/ y" w4 c public static void getAllItemRevisionsOfItem(ModelObject[] item_list)
+ V1 `* U$ S6 m: P9 J& P {$ ^/ W; P3 P( c! ]- D1 q0 B: r
if(item_list == null) return;. m2 D+ M) v Y. j
0 E M. v3 V% V6 x0 K. j2 b
SimpleDateFormat format =
# W5 ?; F: @4 b! h; N7 J new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));
8 |- k, f/ c: B, a5 |. \% b6 E9 B
for (int ii = 0; ii < item_list.length; ii++)- e; u- w) f% |5 V* F) B% g/ f$ t
{, ~5 g9 |5 S; v( b
System.out.println("\nItem Revision List\tLast Modified");
" \* H' {) ]# T- j! F System.out.println("====================\t=============");
- k2 T/ e- T. |% P; e, I& X9 V3 w5 a. {! V, M
DataManagementService dm =
/ ^# {7 |1 w8 o DataManagementService.getService(Session.geTConnection());' g! C1 o d, I
" _- F8 P" S! q8 R* H; V String[] attributes = {"revision_list"};( W: U- ?7 P1 V
dm.getProperties(item_list, attributes);
$ M6 K, p- W4 W6 A& j; Q
6 [: m* i8 d$ T2 o try( j- z1 t* g* [& |1 B! W! C9 y( y
{
; K; D& b% Y. d, D& J ModelObject[] rev_list = & V& {, k- q2 d4 l8 ~
((Item) item_list[ii]).get_displayable_revisions();9 k! |( w) k# n& e3 T
for (int kk = 0; kk < rev_list.length; kk++)
" y9 ?4 T3 a/ ?& {4 w7 H& \ {
+ `/ D$ f0 ~: M: J, a String objectString =
7 y5 p" O& l1 h6 y( ? ((WorkspaceObject) rev_list[kk]).get_object_string();, h% p$ y9 ?; G( A3 j
Calendar lastModified = 3 h; f4 X$ ]' \6 b) C/ \6 P
((POM_application_object) rev_list[kk]).get_last_mod_date();; W. O3 o8 Y+ y- ?3 F1 F8 Q
System.out.println(objectString + "\t\t" + # c. M$ D( C" n* {
format.format(lastModified.getTime()));
, C: ^: ^5 w- W4 u- w/ C; z }
& Y: Q L f1 y! p: e* O }
2 Y0 I+ O- h! W& ` h catch (NotLoadedException e)2 o0 Y o' Y7 c7 t' o+ \* v
{
# z8 f% `% t5 Z" p2 b$ v3 v System.out.println(e.getMessage());
' `# Q; W8 d! f6 C* T }6 T% \# h5 }& m
}* t& W7 j3 U4 {# e5 Q7 U
}( e5 [( P" r e7 x1 k
|
|