|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 ?' p) K' Y+ T4 e! H, H; Y R- t
Teamcenter SOA 开发基础代码解析9 C+ T, l! r! T4 K# F! @
* An instance of the Connection object is created with implementations of the
6 k7 u7 c1 U& z) p; b0 i* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners# E5 V b. K& d, I
* intefaces. This client application performs the following functions:1 ~, T4 E4 b1 m+ |2 @
* 1. Establishes a session with the Teamcenter server# o& x" Q. e _. ?
* 2. Display the contents of the Home Folder! n W0 a, |) ~* x) k5 V+ ?
* 3. Performs a simple query of the database
( _& A* r N8 E" @( F @( c* 4. Create, revise, and delete an Item& U& U, @: Y1 T; e
% N( x$ r2 f9 ]. C7 @6 q
# [ o& v5 w0 Opublic class Hello* A- x. S9 n+ G- y! n% e. P( z
{
! r* d V& D8 Y) h% y- |/**; E1 ^8 h% {0 h- E. s
* @param args -help or -h will print out a Usage statement: |) I% t9 H2 Y* R
*/& s* ]# q/ F2 O7 a. R! Y
public static void main(String[] args)* z# A- J2 H5 p: |+ g! Q
{ `8 K' M5 H2 ]! S4 f6 P3 H
if (args.length > 0)
: H+ n F$ t. D5 d. a: |" {: K{6 A d% m+ f9 d. x( W: n! u1 {4 f
if (args[0].equals("-help") || args[0].equals("-h"))
8 _( p7 I' Y1 S1 x6 ?{4 W& k5 t; z. n6 C5 f( Y. f; _
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");4 E( P+ ?% z' ~
System.exit(0);: x3 p3 _! o4 a# n6 c& P
}
3 o. R& n4 g$ F+ W# o}6 o- O0 [- Q: K& k8 W
// Get optional host information
0 J7 ^' o. a3 o' jString serverHost = "http://localhost:7001/tc";
0 O; R* d# T* r7 L% p1 JString host = System.getProperty("host"); w0 o2 n2 u+ l# B n) g
if (host != null && host.length() > 0)
- O' z7 i7 I6 c9 D V% K{: k' w% k. d7 }' B1 l" t1 C
serverHost = host;2 {/ m3 v! r: C B0 ~
}
/ N) r' _1 c/ N$ F; i) [( Q1 u: U' TSession session = new Session(serverHost);5 I4 v1 \, w; S' r6 B' O& I
HomeFolder home = new HomeFolder();
% I0 M' N! h: ^Query query = new Query();- {* [( Q9 X/ Q- ^2 O- W
DataManagement dm = new DataManagement();
' i6 z- `- g4 t0 S5 \, s! `9 |// Establish a session with the Teamcenter Server* j: C" y+ Y+ v+ t
User user = session.login(); U7 V: p* Q' O7 F2 Q; d1 t) R
// Using the User object returned from the login service request9 B% n6 r- m& {$ x8 Y4 T
// display the contents of the Home Folder
7 d/ [7 g& V! f9 S" W+ O( Bhome.listHomeFolder(user);
/ x6 K: n7 C: H7 A4 @) l2 a// Perform a simple query of the database5 n) L' R/ |6 _$ l( B9 `
query.queryItems();: L6 ]* u3 B/ M6 M# z2 ]& r
// Perform some basic data management functions
* g5 m/ T5 ~ I, fdm.createReviseAndDelete();
3 Q0 e3 u, }' f7 _4 w// Terminate the session with the Teamcenter server
+ u* j* w" Q. f/ K L4 w6 \: `session.logout();3 g0 ^4 w$ n" b2 i
}
+ { x8 I0 H4 e/ ^9 K! I}. S& x2 L" Z: `- a& {3 {
* \! w/ Z( x$ `! @; C
|
|