|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter SOA开发源码分享:获取所有的item版本信息
+ d: e5 \9 Z- i' O d% [5 g F& {0 z: a) }9 R& t; Q$ C
: t b/ c7 x& F4 [. c" } public static void getAllItemRevisionsOfItem(ModelObject[] item_list)* t1 f( ~! ?1 O: }3 g! a
{$ |% O. ~& V: V& Z$ j1 K3 |+ b' P
if(item_list == null) return;
7 o6 {9 h0 ?& H' S1 K. y' i7 M: \: [/ n
SimpleDateFormat format =
& D* Z( o+ x `" L new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US")); p. p, E4 }3 S5 ]# s" J4 G
; Y# D9 v4 d1 Q; V0 j
for (int ii = 0; ii < item_list.length; ii++)
) r! p7 X, H8 T2 W" J$ B {
2 `8 j- R) [* q4 V5 I1 M6 A5 m5 H4 Q System.out.println("\nItem Revision List\tLast Modified");
9 j9 L# Q6 s) g0 Y1 s+ @' b System.out.println("====================\t=============");
4 l. |0 l' L- t* |5 P
5 \" j' X. p4 W7 |; O C; z DataManagementService dm = 3 w% I' d* Y+ V% |: a& W j" N
DataManagementService.getService(Session.geTConnection());
' }. M4 U( b( O, Y2 i% p5 H1 C1 ]' s! c# a% P
String[] attributes = {"revision_list"}; o" G7 x8 x/ _& X. m3 o
dm.getProperties(item_list, attributes);, U L2 O" \& |# l5 {
' ]4 D( `/ L! a" H, m try$ ]# ^/ w- Z( w9 N3 \
{
5 a. V8 R# P# x6 b. H1 { ModelObject[] rev_list = 0 v6 i' c& T5 Z+ q3 X
((Item) item_list[ii]).get_displayable_revisions();5 F. w; j9 ~1 h4 |; l2 l
for (int kk = 0; kk < rev_list.length; kk++)$ J" b: W3 t5 J
{9 t" o, F+ s" o, _# Y
String objectString =; R9 j. R1 k8 v X7 b9 P. c
((WorkspaceObject) rev_list[kk]).get_object_string();8 T, h) [" i1 ^5 H. ?( ]8 I5 ` R, Z8 c
Calendar lastModified = * v) ?+ z+ Z; b/ v1 l
((POM_application_object) rev_list[kk]).get_last_mod_date();2 a9 _+ T' D4 H2 D
System.out.println(objectString + "\t\t" + 8 {. n1 {6 X+ X, S3 J( |. _
format.format(lastModified.getTime()));
+ L6 L% u" `# h3 p! f i4 g) C }; U/ {7 y6 S8 l+ w
}, }; J" @0 I( D- f' l
catch (NotLoadedException e)
3 _+ K+ b0 L; h1 A* }4 Z9 p {
# j }% b$ I0 D- { System.out.println(e.getMessage());/ D. G. I2 c. `: Q
}
4 `* b m$ ?, e9 j1 P( [1 J* G }
! V" d2 S( t& o& L7 y }6 Q5 E- A. S7 N+ g
|
|