|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& p$ }& h1 J* c! a/ NTeamcenter SOA 开发基础代码解析: {- O7 a* g# K1 y3 h
* An instance of the Connection object is created with implementations of the
3 h' H9 Z' Z8 I' y8 _* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners0 H/ G+ K4 o# q$ z H) A8 y
* intefaces. This client application performs the following functions:: k: z9 w6 A% u: f& g
* 1. Establishes a session with the Teamcenter server" F; S5 T+ \. ^0 h4 g' S! {
* 2. Display the contents of the Home Folder
% X; S5 i* w+ s% e* 3. Performs a simple query of the database
) T6 _! h$ M* v% C2 X. ]* 4. Create, revise, and delete an Item: w' `& c; a! y# j
$ J, k/ W1 u6 n& r! d8 c$ b& R# b( a) A
public class Hello" U; `( y& r J: |; [4 L
{! w, g) b j# M
/** ?# I$ i U( W3 x
* @param args -help or -h will print out a Usage statement5 C3 x& d) i% @0 z
*/
O3 O5 s; X dpublic static void main(String[] args)
1 p9 y9 ~* v8 P) i; { y) r% g1 x{
! R2 b9 {; e) Hif (args.length > 0)' U- H5 H7 ]* `' k6 W" D3 c
{
# _7 | K7 H2 M- `6 I% }: Xif (args[0].equals("-help") || args[0].equals("-h"))2 w2 }: R+ B5 A5 ~- n
{; q) Y! N' v$ S& r& d; _5 X: Y% n
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
: C8 {& o; Z& _1 mSystem.exit(0);
& d8 x- ^ H6 ?2 ]# u" y}
H) v! k+ S" Y( O}
. g" I4 s- l6 ]( K$ Y: }// Get optional host information
0 ]4 y! u/ [& `* q/ V: ^String serverHost = "http://localhost:7001/tc";
6 V. B& _; j: ~2 W0 r5 p' n. @String host = System.getProperty("host");
$ p: V& s7 K1 i) z( \2 G5 g% mif (host != null && host.length() > 0)$ c0 ~) S/ D6 M- d: T7 p
{
3 Y v' j4 H, }! l% LserverHost = host;- N8 j' o2 k6 [" F4 q
}# I7 n! ~1 P" U$ }& ^! ~
Session session = new Session(serverHost);0 ^/ `6 \' b) Z/ b0 r% c
HomeFolder home = new HomeFolder();
" w% J: T8 ]' K0 `/ P3 a I- K5 sQuery query = new Query();, X) N% n, q6 z3 \- K
DataManagement dm = new DataManagement();
0 d7 Q: Y1 k. s9 M9 A// Establish a session with the Teamcenter Server
6 H9 d* \* k; iUser user = session.login();
$ ]5 M5 x! b% ` e// Using the User object returned from the login service request6 c& i6 b' ], z: b" c1 Y; y( U0 t
// display the contents of the Home Folder0 S$ y7 u" H. e8 W
home.listHomeFolder(user);
6 q7 D7 ?% M ]' P; |7 ^// Perform a simple query of the database
7 V0 j: m, V+ E. @" C3 x- g" @' }0 wquery.queryItems();
7 z6 x1 \) w. v! @6 q// Perform some basic data management functions
' }7 I. k" F; W7 p* Gdm.createReviseAndDelete();! |* D! g. T- R
// Terminate the session with the Teamcenter server
5 e4 F$ m- M, ksession.logout();. z4 u; M* v9 o3 @
}
8 B# t" x8 G% X1 M}
; y N: L$ U# A) G% d& L9 H# R9 o( _* r$ {/ D- ?# |$ M; i1 k; ~
|
|