|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- [2 W; `6 ?* n3 D4 B! F
Teamcenter SOA 开发基础代码解析; [$ X2 A2 ~$ L1 K
* An instance of the Connection object is created with implementations of the* B9 r, | T( r2 f
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners+ q& i2 S- D- `% }0 F" `: l
* intefaces. This client application performs the following functions:7 L. l5 U) n/ N
* 1. Establishes a session with the Teamcenter server# W& x- C1 _' w n- K
* 2. Display the contents of the Home Folder
* t) v( j z6 i* 3. Performs a simple query of the database& ?3 ]6 |+ Q4 V) W/ o: s
* 4. Create, revise, and delete an Item
3 d4 H$ D. g+ K6 ?+ L, W( y$ t" R" P& `9 W2 p' M
- U9 y1 I, f, i, t; r5 upublic class Hello
& o0 x6 @2 S1 a3 L( `6 Z{
& f0 j5 D% s, e3 O' }7 U6 o* a/**
( ^) _$ }: n3 u% K* @param args -help or -h will print out a Usage statement
- \2 w' I% x+ l*/
* g7 P0 Q* |! x. n& E! Z0 Spublic static void main(String[] args)" a# f' ?/ _% @1 t8 J
{* Q* n& k, ]/ h4 a& Y) K
if (args.length > 0)
3 k' {* m/ w7 A. Q u2 y* S{
7 L7 l( ~& W7 R% V8 c5 E# ~( M% oif (args[0].equals("-help") || args[0].equals("-h"))
+ b f5 e1 F+ r) [8 W{" J: d& I% \! }6 O* T! [% l
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");. S C$ K( T5 p
System.exit(0);
- f G/ C( T9 {& p9 A}
9 R0 t3 B* x+ j- _}( F- @% C, R5 L5 _/ M- p
// Get optional host information
1 H- g4 C; Y7 x* Q& r- u: IString serverHost = "http://localhost:7001/tc";
! R2 G0 j- q [- L3 V. F- }* aString host = System.getProperty("host");+ u$ T9 k% k9 F0 ]% J* y+ m! ^
if (host != null && host.length() > 0)' E- F0 j8 R, u, Q
{
r! N1 }2 H! J1 j; T7 I# cserverHost = host;
- x: b! D) F# e* b) N) S$ a% h}
3 C- x5 |, a; u9 a, K# N) c& A# N' }/ sSession session = new Session(serverHost);
, h( D9 A9 j; Z1 k" A" }HomeFolder home = new HomeFolder(); m( j, m* u/ F. n, y; R
Query query = new Query();, N$ ^. y4 {0 y1 C2 C# v1 @
DataManagement dm = new DataManagement();. v# R4 R/ B. u( |
// Establish a session with the Teamcenter Server
$ e1 h! f* |/ [2 \User user = session.login();1 D j, j' P* o
// Using the User object returned from the login service request
# z' w# t0 `, E, a6 f// display the contents of the Home Folder
: E# k9 U7 l+ N w3 v$ bhome.listHomeFolder(user);
, `$ U7 h! \1 C" t' L' G, f// Perform a simple query of the database
1 \% s6 Q5 e' r& r- `8 ~" Z4 [query.queryItems();
) D/ R' c% n; H; l5 x7 e; s// Perform some basic data management functions$ q3 ?* I6 T. @! U# F
dm.createReviseAndDelete();
4 h3 z0 S0 k- A6 a// Terminate the session with the Teamcenter server
2 b- K. Y0 t+ ~, xsession.logout();, \7 t$ A, i+ @" ?3 q
}
+ Y0 F7 h2 T9 z @, z}
+ w, p$ |/ K& R' N# [' x0 r! C4 P3 J+ s) ~+ C; H4 p" P4 k; n
|
|