|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 a& R: _! M' ?
Teamcenter SOA 开发基础代码解析8 H- v W3 y+ E' K8 \3 i1 v% c1 C6 X
* An instance of the Connection object is created with implementations of the
0 s6 |) e, h A% ?; D' X* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
1 z P8 ^: E) z3 q5 I* intefaces. This client application performs the following functions:
6 @8 w4 A! V. w" a7 ]- B* 1. Establishes a session with the Teamcenter server( y4 a* g+ \# j9 Y2 ^
* 2. Display the contents of the Home Folder
& A0 s1 [5 d+ U6 h0 h" E4 |* 3. Performs a simple query of the database
* w2 `( m1 \' Z/ A3 ?% F* 4. Create, revise, and delete an Item
# W/ ]& H, f( c: t/ c
6 H( R8 S7 k. Y5 e1 n+ T r' W' N8 l1 E. z3 Q
public class Hello4 V9 W/ P( p* Q, q1 ?' ^6 }9 k
{( u* M- Z( T" J2 j- O% h4 D1 I
/**
: C" h; {9 `2 b- g$ [/ U* @param args -help or -h will print out a Usage statement# p# B* `4 x: R7 K
*/
' |: p- {, ^) @# w: a: m8 ^public static void main(String[] args)
. s8 E/ I$ a9 C! k{
8 M$ t) [: N0 w$ q9 D4 Y1 Zif (args.length > 0)
* n* K% Y3 s7 W W/ Q( ?{
8 N$ h; o% O! j# R6 \if (args[0].equals("-help") || args[0].equals("-h"))
2 |9 t- \* m3 G O; g3 C{
; u, n: `- ^/ x" }/ hSystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
& u* N f' t0 iSystem.exit(0);# J6 r% m1 m* F; V+ j! a7 x8 m
}, ~3 J" \8 n; t; U
}6 ? O: L# L2 M; U
// Get optional host information
0 W- h' v1 R% E( @7 PString serverHost = "http://localhost:7001/tc";3 {8 B9 r2 L, r
String host = System.getProperty("host");
$ D' e+ `/ U7 o( C7 q N8 L X" ~ \" Uif (host != null && host.length() > 0)$ `7 E+ k. b) e P1 ^: D
{
/ {0 \6 n: d6 L) e- B1 {serverHost = host;: t. _7 u. q4 v* k3 l: A' I
}5 Z0 k3 _( F; P8 c3 l6 H$ R
Session session = new Session(serverHost);
6 k+ v5 z' G- U, u& r0 ^8 J# UHomeFolder home = new HomeFolder();
0 a" Q5 G# G# I( ?( t9 D, T @Query query = new Query();4 a* ~* K- }6 q$ V4 o- h/ H
DataManagement dm = new DataManagement();
+ k! |0 K% V/ @, D- z* z' b( [// Establish a session with the Teamcenter Server9 o8 c8 e' u/ e0 k2 |
User user = session.login();* r( Q* Q& \( k' C6 T0 |
// Using the User object returned from the login service request
/ }, L, N: {; t/ e4 F// display the contents of the Home Folder: p5 Q; i5 t' ~" R7 G7 r* N4 }9 `/ m
home.listHomeFolder(user);7 a6 |% M' v6 S* K* b5 N
// Perform a simple query of the database5 C' g+ E1 p' L- F/ q. M
query.queryItems();
J' ~0 \8 `4 I' `// Perform some basic data management functions9 L3 e8 G" M& _5 \
dm.createReviseAndDelete();
4 h) s9 B: y/ P `" g// Terminate the session with the Teamcenter server# D4 J1 Z) [8 S9 H/ }, Y
session.logout();
- z7 t6 P2 d1 h( d# ]}8 u6 S; P/ c s0 \3 H$ |
}
- O$ b1 N) ~# r% b8 S& @# X) z+ S$ z2 f4 m, q
|
|