|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 I; s! W0 |1 C8 cTeamcenter SOA 开发基础代码解析# Q% ~0 S5 d# G( E Y. M
* An instance of the Connection object is created with implementations of the; T# L+ W& H$ ^* q, [. u8 b
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
( c' n. {* D. M+ f0 @" }. P& x$ J5 R* intefaces. This client application performs the following functions:
) ] { n$ e3 L1 O( v* 1. Establishes a session with the Teamcenter server1 Y9 \; P0 B4 T1 ?
* 2. Display the contents of the Home Folder
w# S2 S: ?- o' ~5 @* 3. Performs a simple query of the database) ~8 X# K* z$ F; V% r; _; Y
* 4. Create, revise, and delete an Item
: p2 I b1 m' _$ Q7 u/ p3 @# l
# W! [9 U" s, O# ]. C
! Q+ o0 u+ x. L( D; Y, _public class Hello% w7 m4 f" o3 T) a* `0 t1 \
{. V% u- e) z1 o8 S7 w: h! ^1 l) E! U
/**! e$ @- E1 a3 j
* @param args -help or -h will print out a Usage statement
# A0 r+ B- c6 W3 T/ Z. Q0 E6 ^3 l*/4 k: I% Q! C) s- s2 O( @! W
public static void main(String[] args)
% V/ @+ K5 t: U. T; r- w- s: O{
1 n, F- q2 O* N9 B% {) cif (args.length > 0)
% R" R. ?; \" F L: p- G6 L{: a3 ^, Z# c- l2 t( I2 v: r8 f
if (args[0].equals("-help") || args[0].equals("-h"))
2 N7 r2 t- ~9 I{1 i0 ]' Y( ?7 ]
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
) _3 U, m: H$ Z3 [System.exit(0);5 D- h/ d% Y% D- i( G& Z
}
! t- i/ r0 Q# m4 s}3 R* V# x" S- n# W( w2 ^8 V$ h
// Get optional host information
& D5 E1 m0 S5 H! z7 v0 e: eString serverHost = "http://localhost:7001/tc";5 c! ?" ]) P8 f
String host = System.getProperty("host");) a9 M, c+ N R
if (host != null && host.length() > 0)
) }" O. ]# i j; Q6 m{
3 r+ R# z. R! C) f- rserverHost = host;
3 ]4 U O/ g+ n7 V, n}
/ |. d# F0 S4 vSession session = new Session(serverHost);
0 Q& j: }/ C; T: h, I2 g0 }, [HomeFolder home = new HomeFolder();. X3 g9 P3 J7 h
Query query = new Query();2 t$ Y. l( k8 ]% O3 O" H
DataManagement dm = new DataManagement();5 \0 e; `+ E' y# J" r, R/ |# N
// Establish a session with the Teamcenter Server
, ~0 V$ o% c7 P- b+ OUser user = session.login();
/ c- g- @. }" {" |* ]; W, C// Using the User object returned from the login service request+ t6 P. z8 k8 |6 P7 d' s) w
// display the contents of the Home Folder4 L3 g3 K- C, ]$ g) `
home.listHomeFolder(user);4 c2 C m$ E$ ?" I' u2 r
// Perform a simple query of the database
+ K, X F% C$ i' Y- L& `, ~( mquery.queryItems();; W+ \7 |% w% J* ? L. e
// Perform some basic data management functions) G5 z' ~7 n4 V5 Y9 d) l
dm.createReviseAndDelete();: [ p" g& S1 a% d8 Q3 r8 `
// Terminate the session with the Teamcenter server" L. }2 x ]; U, G
session.logout();" O$ }, Q4 ? U! X5 K6 H
}
& @& r* x+ l3 O1 @8 b}4 H; s& ? _% e) T% P. N: N9 }
; ~5 r6 `, A9 w/ k1 t& i4 F6 u/ V# @
|
|