|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" t3 c2 ~! w( wTeamcenter SOA 开发基础代码解析
1 a) H/ @) X# P/ U' [4 ]) {* An instance of the Connection object is created with implementations of the
4 d3 M% ?: ~) p1 L9 R) T/ Q* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners, E/ ]1 l0 L" ~6 _- A( p
* intefaces. This client application performs the following functions:$ V W% R" n* b; m/ X
* 1. Establishes a session with the Teamcenter server0 A( A3 y. c" D; Q
* 2. Display the contents of the Home Folder5 \5 N/ D" q0 L0 h3 b' V; b
* 3. Performs a simple query of the database
/ R9 Q! g6 \) H; i) @* 4. Create, revise, and delete an Item
" g. S+ J2 i1 v& w+ l3 d8 Y/ A( d/ ~7 @5 S, ?$ {9 F& R
1 G4 n' M! b( c& C. I
public class Hello9 a) _$ g. T+ y
{3 m2 F$ p3 q# Z! Z. \1 P
/**0 T @+ ?0 f0 \4 T
* @param args -help or -h will print out a Usage statement- v' g# X; I( x# `. E' `
*/8 E2 s! a* q r$ _7 }% B
public static void main(String[] args)) G. O$ ~, x( m: Y
{$ P5 c% A. P- A: b9 t
if (args.length > 0)
/ q' I( F9 m# l! m* V{
1 [4 Y+ s* Z ?3 I! aif (args[0].equals("-help") || args[0].equals("-h"))! Z, t* ]5 B* `2 s& W; Y, L
{
) W1 z1 N0 I" o8 h5 cSystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello"); l4 o6 }: w- B' A4 q) _& j* b
System.exit(0);
- d* f, V: {$ f}
* I4 D9 C, P2 A/ P5 h+ T" y}
) S7 q; W" d) N ^0 j// Get optional host information
* \; z$ ]' Q& j/ iString serverHost = "http://localhost:7001/tc";; d. R" c; w0 p- d
String host = System.getProperty("host"); p% k: R( U( Q" [% \' e' }
if (host != null && host.length() > 0)! m' R- T/ h; M: x E" E
{
( D" q3 Z# r8 I! L# ^6 ^serverHost = host;
% J3 N9 Y' h8 ~% ]}
' Q$ N8 e9 ~5 @% e+ kSession session = new Session(serverHost);9 x9 D, r# o) L: l5 L/ V
HomeFolder home = new HomeFolder();# @0 T1 {* s$ F0 y
Query query = new Query();- W) C- g( M- F+ d
DataManagement dm = new DataManagement();( Z" r t; `' B- z3 f: M5 ~
// Establish a session with the Teamcenter Server
' u- c# h/ {7 D( KUser user = session.login();
' u0 O' R( ~8 `// Using the User object returned from the login service request* Z# Q! T6 x9 v, ]7 }. |9 a
// display the contents of the Home Folder
. x2 c. C7 y) R, z3 jhome.listHomeFolder(user);
2 q7 D! r( K, c/ g3 v// Perform a simple query of the database) }5 X: [. L5 N* R' K" w1 Z: P
query.queryItems();8 P! `# h9 y/ N8 o
// Perform some basic data management functions2 j) N+ V: w: Y. t9 {0 j
dm.createReviseAndDelete();/ g$ A; ^, f9 N( n ~6 R. g% c9 G+ G
// Terminate the session with the Teamcenter server6 _" j4 Z3 w* p5 [* V3 p3 S
session.logout();
+ B0 W8 X+ b% X l0 R# ~ o}
J% P l- ]! u3 x5 b6 E) X}
$ P. R& R7 z/ q1 h
1 c. [ V) I! ?) y/ K: q |
|