|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& o$ U3 f' J+ Y1 e F
Teamcenter SOA 开发基础代码解析- G5 l- p0 Y: A! w& E: c
* An instance of the Connection object is created with implementations of the
0 W' o$ X9 {6 \5 a; v* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
! e! e, n$ E( R9 m, x; {* intefaces. This client application performs the following functions:7 ~; J7 o' _# i
* 1. Establishes a session with the Teamcenter server0 N0 w5 @* g4 {: J
* 2. Display the contents of the Home Folder
/ o4 m: L$ }6 S- C$ D. W* 3. Performs a simple query of the database7 G. S8 O6 y8 [7 s! e, D
* 4. Create, revise, and delete an Item$ I7 B$ H/ L8 L/ C1 N
% H D0 z( e6 K# t' W0 r3 J
9 Z5 h, t: @# ?+ X1 f: F5 g8 ^public class Hello
3 x; D0 S' V. m$ S{" H- \, q+ Q1 o. t$ U% D
/**
; F1 @+ Y& K" z1 l* @param args -help or -h will print out a Usage statement
/ V+ x+ Z+ }0 ]3 [$ U3 p. u*/1 Y3 M9 k I" c9 O8 d
public static void main(String[] args)
" N+ l7 w, C* ^( b a. j6 P{
" ~# o- e6 s8 V8 u9 J" sif (args.length > 0)
6 |- r4 Q; N- a9 T4 C5 u) x3 J{+ G: i9 \ n4 `2 ~8 J( z1 f
if (args[0].equals("-help") || args[0].equals("-h"))
; H% f! L, X" y W+ u% l0 E0 @; s{
! Y5 b: T) S; R% c1 USystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
' N; x# \* a$ |$ \. s$ KSystem.exit(0);0 Q% G- e$ l- h$ b/ E3 X/ }
}1 v! l; Y/ j, k4 X/ J
}: r B* o. z8 w6 }
// Get optional host information" i5 v" t9 ~5 Q X' B7 _1 z
String serverHost = "http://localhost:7001/tc";
1 |. B! k- C; W$ M* e. M5 S) g& _String host = System.getProperty("host");% p6 o1 S/ q3 I- Z) I, O) u% L( C
if (host != null && host.length() > 0)
: S2 k" S9 ~6 z4 ~{) W# ?+ e7 N; V" z5 x- }8 ]' E
serverHost = host;$ B4 m/ L$ U C8 ^, r' Y/ j
}- _3 x9 l. R9 o! p! @
Session session = new Session(serverHost);
( Y8 l% n2 G# N, S9 y# vHomeFolder home = new HomeFolder();
: j1 K9 Q) @- @; u; @Query query = new Query();& w! o, |( m) w, ]5 O, N
DataManagement dm = new DataManagement();# Y" Y+ g& H1 _. X2 O% K: N
// Establish a session with the Teamcenter Server
# h, p r" l0 f& QUser user = session.login();+ \; z* x4 v S1 L
// Using the User object returned from the login service request
6 f9 p( ]' W1 y5 t5 g// display the contents of the Home Folder8 L# b2 J7 h' h* x- k
home.listHomeFolder(user);
1 K- H7 I9 E: \ q$ g8 z; W; t// Perform a simple query of the database
, J+ w- ?" P* M1 {query.queryItems();5 _/ I" y4 x' O& ~& y4 e
// Perform some basic data management functions
7 L0 ^7 p6 v R, }dm.createReviseAndDelete();
; ]. q3 I# F: x1 J// Terminate the session with the Teamcenter server$ b; u9 e# m* j" y
session.logout();( R& f8 \2 d4 c0 j6 O: P1 V, f
}
o( }, D2 D* [ R# \& R}) w/ l5 {. _8 }' q, h
6 O1 j7 U: d, z; C
|
|