|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/ H: W7 K$ a9 t9 \/ I
Teamcenter SOA 开发基础代码解析
0 h# m3 t0 g- x* An instance of the Connection object is created with implementations of the' S6 t! F9 Z# _* Q% X
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners! J* k3 a* p0 F* U4 S+ b- |+ {
* intefaces. This client application performs the following functions:3 X6 l! ^( o5 V0 `' W M& ?# n% F+ ^
* 1. Establishes a session with the Teamcenter server0 Y- |, j# ?- L, o/ c
* 2. Display the contents of the Home Folder# |* p" J3 X& x* p" b& s8 H/ n
* 3. Performs a simple query of the database
( i/ [- n9 k( n% Y* D1 q* 4. Create, revise, and delete an Item
- N; l, Y. `8 T7 E* f3 I
P! h7 @' b. i7 _4 [4 [8 O+ ?2 S3 p5 t' c' V' A% ^
public class Hello
( \% Q1 h( Q8 _" {- c- p{
" _2 d. \0 W. m! P/**2 P& ], a) T4 E
* @param args -help or -h will print out a Usage statement
4 {% a: X9 D5 h; h*/
, G% K$ A6 B: y/ S% r% @) Cpublic static void main(String[] args)
, n: Z+ f N# Y2 N) N2 w{7 h: { F" J2 \, i
if (args.length > 0)
~ @7 z% R, F" @5 v% t5 a{6 k8 p3 w& S1 V# }0 ]6 B
if (args[0].equals("-help") || args[0].equals("-h"))
5 b* f) N$ q$ R{3 D' C: P) i$ H8 A8 m' y
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");; a3 w# ?- z3 L7 o3 R
System.exit(0);
! I# S8 Q2 l9 v2 p& [+ ?; n. Z5 b}( z% ?, q4 r2 e7 X7 M6 ?& Z
}
0 _7 {0 s Z6 y8 V6 e// Get optional host information% J+ S* s3 R- ]) h+ n, |, I
String serverHost = "http://localhost:7001/tc";1 ?$ S, f" L7 c8 @# U
String host = System.getProperty("host");
$ S4 C, I8 i- m# }4 @; pif (host != null && host.length() > 0)( P% H" t& P6 |, b3 x7 n$ ~! H
{
+ P, y: v9 {8 ]% c4 A7 F6 h/ E' C' JserverHost = host;
3 j5 k O6 b; B- K' k3 s. F}8 z( o4 z$ s' X* W; E4 s; o
Session session = new Session(serverHost);$ ]9 @0 Z1 U# [ ?# J2 Y6 V
HomeFolder home = new HomeFolder();
; Z9 a4 g5 S+ E; u7 c* uQuery query = new Query();- i( M" ^" Y% X+ @6 ]' q: X$ i
DataManagement dm = new DataManagement();" V$ c3 A1 Q( m+ b3 x6 l
// Establish a session with the Teamcenter Server: u( d P* U* f* a4 j; B- r: }
User user = session.login();! `. U6 @6 n3 p& s' g
// Using the User object returned from the login service request; R; r- S- h F6 {+ g' |0 i
// display the contents of the Home Folder
( z$ Z% q0 r, H% w8 [home.listHomeFolder(user);
/ ^) a( u3 X8 g6 x+ k% m, u// Perform a simple query of the database
1 }0 g r t5 Z# b5 oquery.queryItems();0 q* a! R2 S9 I
// Perform some basic data management functions
5 l9 K" S. _% Hdm.createReviseAndDelete();
. H0 X I; e9 _3 K) n7 ~% m// Terminate the session with the Teamcenter server0 H( e' \1 T+ r: \$ y. Q$ P' g
session.logout();) d, t9 K& }: P5 V- A, }2 P
}
0 F+ D/ i8 y. Y% Q( d3 w# ^7 G}
3 s; l- S6 P. J& k5 h
, a" ^. n- x5 w5 W: e |
|