|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息, Z8 E7 }8 B7 f3 f! w
+ c8 ?# a# G. }6 v- K I& [
' _6 B5 h5 x% w5 [5 X8 G public static void getAllItemRevisionsOfItem(ModelObject[] item_list)5 _4 _) E: m! C: `- E. P0 |
{
% s9 M& i0 _5 A+ V* y1 M: v if(item_list == null) return;
1 D( ?) v; ^) G5 Z
; c5 V; l" d8 k. P, D" V' F, a SimpleDateFormat format = ; C# \/ g/ I' T# a; v0 q
new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US"));
/ y7 l: ~; j: B; C/ n; e- n ~1 B! X! J2 M U( i. ^
for (int ii = 0; ii < item_list.length; ii++)1 I, C. e) i$ S) q5 P1 h
{ N& c6 s+ O# G. r
System.out.println("\nItem Revision List\tLast Modified"); B. R% i$ U% b% |
System.out.println("====================\t=============");
9 }6 E* \* V- G$ r5 ~9 l" C t k* b% C4 v$ o. v
DataManagementService dm =
) x7 V- c# z; K. L DataManagementService.getService(Session.geTConnection());) c1 t" Z7 R2 |6 M8 w7 F
! F5 _" D j& J) W! `1 r
String[] attributes = {"revision_list"};0 E! i/ f# \2 [
dm.getProperties(item_list, attributes);' d6 E( C F0 T# w7 f4 G! u1 g
6 ~# U; T) E8 y( e% S' X try+ e% ^. U$ H; {6 U
{- J4 R: j. w7 f" S4 E: \
ModelObject[] rev_list =
E0 \3 p/ H6 |5 K s0 N ((Item) item_list[ii]).get_displayable_revisions();3 t' x8 c4 I: v% K/ n
for (int kk = 0; kk < rev_list.length; kk++)
" b3 x9 N% }/ ~, S' d {
+ F& Y, l1 e9 m String objectString =% Y0 ]' {6 ~6 q+ M1 J" V# [4 ~
((WorkspaceObject) rev_list[kk]).get_object_string();% k6 ?/ Q, m% }# h3 ^
Calendar lastModified = , P# M0 y0 h5 |+ V. {
((POM_application_object) rev_list[kk]).get_last_mod_date();
% x2 f# V7 S6 x# M. _ System.out.println(objectString + "\t\t" +
- b. B' |8 n D8 i) v) ^, ? format.format(lastModified.getTime()));
/ y \) U6 r; M+ O0 x8 I3 D" i# Q }9 z0 y# i6 Q1 [& T% J6 Y' J
}0 u, _7 e; g! q6 S4 ?
catch (NotLoadedException e)
) M# y0 v1 p- Y6 n {' ^8 X% L4 ]2 I5 h( g
System.out.println(e.getMessage());
7 i# m1 }) D$ {* {* t+ ?& D }2 n+ O: q! @5 @. q
}
" ]/ q8 Q& l6 d% r/ B3 k }
0 V7 N2 ~/ g, | |
|