|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 m) U- x3 S7 T. R
Teamcenter SOA 开发基础代码解析0 c" w7 @+ }& y8 v, H7 I9 l
* An instance of the Connection object is created with implementations of the
4 M5 p- t1 F0 Q& I6 N. L/ T* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
( ? `( M5 s }( p7 p* intefaces. This client application performs the following functions: M+ U9 t$ ?: L- r; ]+ l
* 1. Establishes a session with the Teamcenter server
4 T# H: f) m& I5 s ^& v* 2. Display the contents of the Home Folder. B* y5 e- I% n. K& ? p
* 3. Performs a simple query of the database4 Q6 o5 g+ \) e" F/ j' C
* 4. Create, revise, and delete an Item
, J5 ?! E& E- s2 H+ V+ {" |" w4 u
% k2 C) ^% R. g& n, ^2 F, n3 Y* p" u
public class Hello4 a* ~+ F, c- A& O3 U6 x1 y, ]
{
! O! M' } K3 }/**# U. S- Y6 _4 a! T) Q0 p" Y0 f
* @param args -help or -h will print out a Usage statement* x2 v; n G3 {: V* o
*/- J: I$ A( T+ i7 v. {
public static void main(String[] args)
8 x6 u2 X% y9 U: l{9 K4 e8 |4 ?7 ?/ R& S- [
if (args.length > 0)
- m% E- ^& t g6 g' |{# A& l- k- y! W6 e# I$ A
if (args[0].equals("-help") || args[0].equals("-h"))
! j* d7 b, n; c7 H{
) f' c) q2 {6 X! m/ J2 USystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
& W% O; z+ E* |8 ~$ V4 KSystem.exit(0);' q3 o3 [, N7 t3 [/ V) C5 e
}6 C% s, R* p$ N
}* g& V1 Y8 f0 t& P6 Z; _: N
// Get optional host information
# q1 m/ g# R: K9 o( H% zString serverHost = "http://localhost:7001/tc";
0 t# C6 F( t! p0 l0 {+ N$ RString host = System.getProperty("host");4 V. O. E" }+ b3 @5 M% O
if (host != null && host.length() > 0)( M5 h0 M3 ^) F% |+ o, O* |
{3 D a9 g5 h p! J
serverHost = host;8 u8 ]' Z$ H! ?" w: Z
}, C$ G5 E! ?" O1 h+ f3 _, u( r7 s
Session session = new Session(serverHost);4 C9 B, h* V$ J9 l2 B8 [# q
HomeFolder home = new HomeFolder();
* H$ w! x/ b7 {! T" c8 P. @8 l) jQuery query = new Query();$ t' T# Y7 M& H Z
DataManagement dm = new DataManagement();- h7 k: ^' o ]' P7 J; b
// Establish a session with the Teamcenter Server
5 h" `3 A& h7 c. [1 _ a7 I/ T0 cUser user = session.login();
6 { }" n/ N! v+ R% c# C, H// Using the User object returned from the login service request
, o. ^* P3 H1 r2 r% x// display the contents of the Home Folder- g) m* N$ ^- }+ y7 _
home.listHomeFolder(user);" S& V: X# f9 @0 o
// Perform a simple query of the database( S% w9 p& ~2 }1 z, D# O
query.queryItems();# R- t2 q" J! ?- p4 B: r
// Perform some basic data management functions+ g# b% t' r) _9 f9 h% ^/ \
dm.createReviseAndDelete();7 S* F6 }; c4 o' c- O
// Terminate the session with the Teamcenter server
) W& Q" { J k) R3 Wsession.logout();
& J; U* L+ O2 I+ c+ u- g}1 y! s- _: S. v
}
% E' {' [) j1 r* ~6 X
, g/ h4 C3 u; B' m% S6 A% F o |
|