|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ e- g, w+ q7 Q" F3 p* I" ~$ F; WTeamcenter SOA 开发基础代码解析- d- @0 k! R( R0 T' d
* An instance of the Connection object is created with implementations of the
( l) y& ?# H# B0 u8 `# c: \* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners8 u8 h8 [8 _$ f2 A
* intefaces. This client application performs the following functions:( E% j! p' c& o
* 1. Establishes a session with the Teamcenter server
, f; r0 R2 c' I2 K" r% ^' ^* 2. Display the contents of the Home Folder
9 f1 O( b# E" _, X) e* 3. Performs a simple query of the database2 m6 k# E) h) r
* 4. Create, revise, and delete an Item+ H* Q. Z, ^9 D3 R9 F C
# `. E+ ?% T5 d9 A, V2 d1 @
$ G% \1 \3 c% x1 z' C: bpublic class Hello
$ }' i5 z* [" V9 L4 D) V7 G+ Z{
& g1 a' y( M e3 p* Y- w$ }- H/**
- v! F5 E( ^5 c/ Q' p* @param args -help or -h will print out a Usage statement
, C; ~0 @$ H! b: ^*/) S7 s5 G3 W7 O$ Y( s& J
public static void main(String[] args)
7 N4 p* y5 u9 E+ C# d$ Y4 _{
0 }2 O2 e( z) Q2 Oif (args.length > 0)% }3 V3 L6 n2 E2 W% o7 [. d
{8 ^" O# o: d. a
if (args[0].equals("-help") || args[0].equals("-h"))
5 [+ ]! M- X. b6 l$ l{
, f! U$ Z& m$ o5 x2 a0 N, ^( ^System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");2 V1 ~. ?' Q7 K& |7 X P
System.exit(0);' @2 a* F* U$ S1 `7 ~8 t
}
9 n; E6 y$ T& w- P$ c3 m+ \/ t}
A' R O# j" S4 X// Get optional host information
4 M! H2 {; s. y- XString serverHost = "http://localhost:7001/tc";% o9 n; Y# v9 ]: `
String host = System.getProperty("host");
; N4 v7 }9 ?% xif (host != null && host.length() > 0)
; Y; {# p6 N, O{
& z+ z4 a% j8 E7 c; n& U" Q% cserverHost = host;
0 A# e* F" _1 ~4 Z* A}+ v8 T, c s3 Q4 ]$ F6 }7 v
Session session = new Session(serverHost);
3 C) N# C( K! o) y7 i ^" cHomeFolder home = new HomeFolder();- q6 I8 Q5 C3 d- I
Query query = new Query();
4 a$ H! c! \. u' J3 oDataManagement dm = new DataManagement();& t$ S! G1 g( `' `
// Establish a session with the Teamcenter Server' {! c5 @' D+ c! S
User user = session.login();! c9 }9 n+ }: P! D3 P5 W
// Using the User object returned from the login service request
" ?/ D: _8 M) J( M$ C// display the contents of the Home Folder
% F* i, ?8 W& L" q5 \$ m( Y3 Yhome.listHomeFolder(user);/ k( K8 W% m1 X* j0 K$ z. r+ w
// Perform a simple query of the database7 z8 D2 y& A: p) @5 W/ j! `6 `
query.queryItems();
' `! K$ M' C3 | \, j% C; [, d( X5 `// Perform some basic data management functions
; B: S4 D7 o, I0 G- |5 O8 ]6 _dm.createReviseAndDelete();1 U2 Y4 e6 ~' u! L" i# }6 D0 b
// Terminate the session with the Teamcenter server
& @& b* k# T$ N7 q3 S8 V% fsession.logout();( L: \% ^- w1 Z9 R& n& H; v( I
}2 C6 ~9 b5 p9 F" ~ r
}
" k/ p% ~( f4 Q& ]0 d$ c4 x+ d5 h# z) H D$ s
|
|