|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- Y6 k! r, X) ?3 ^4 \1 y. ?Teamcenter SOA 开发基础代码解析0 ]+ f5 _1 z/ }8 t: K0 W3 {/ o5 ?
* An instance of the Connection object is created with implementations of the$ I+ `0 T) f% ]+ G
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
/ N; L- j' C( a$ x0 x' a2 t* intefaces. This client application performs the following functions:* ^" P0 D( `3 I, Z
* 1. Establishes a session with the Teamcenter server
/ |7 N+ l: j/ E) Y3 D v7 A* 2. Display the contents of the Home Folder
' a2 F& w9 O- Z9 S* 3. Performs a simple query of the database
/ T0 I5 | P! u* 4. Create, revise, and delete an Item, K- p0 g z% ^2 U) v( D
1 S8 c$ U. i5 @* h
1 o% w/ l9 V6 ]. p
public class Hello
& q) F8 X$ O; p% }; B* j8 l{; L4 h7 @0 l4 M
/**5 Y! l& T' l! V- s/ ?! Y
* @param args -help or -h will print out a Usage statement/ g! T3 i4 N0 [& o) }
*/
9 K/ z5 i/ Q$ g# ]public static void main(String[] args)+ S7 C5 F. m8 E' L1 n
{, F7 H- K* k' T8 n6 W
if (args.length > 0)) U; s, ?" o6 ^( e9 Q) X% k& C% a
{! M* W$ U: s" x6 x
if (args[0].equals("-help") || args[0].equals("-h")). Y, T0 l Y# m/ }
{) `1 [5 Z3 v' O& o% p7 C* `+ { q
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");' y# j& S/ d7 |! F0 u
System.exit(0);' J) a1 M) ?; s- W
}8 E3 N. ?- P( h6 c; N
}) o1 H/ o/ U# {- U0 T! X
// Get optional host information
b+ R* v' M, e9 NString serverHost = "http://localhost:7001/tc";+ r2 O9 N. D, A! W
String host = System.getProperty("host");" T5 P+ f4 o; |
if (host != null && host.length() > 0)/ p# _9 y# Y" |' r6 O
{& h; n" n; W$ `& N, f
serverHost = host;/ Y# D, `7 Q- b5 K+ x8 ?' ?
}
! I+ T4 Y( m' d8 i) ?+ y6 n" |Session session = new Session(serverHost);' t( S- }- ~9 u* p, H* C; c
HomeFolder home = new HomeFolder();
( @2 Y; v. P2 @+ ZQuery query = new Query();/ K! I& d( J6 E( X
DataManagement dm = new DataManagement();
. j. Y0 r8 N+ I// Establish a session with the Teamcenter Server
" A: S8 x3 L( uUser user = session.login();2 c7 w) H" H! Q! P: ]" [# F
// Using the User object returned from the login service request
8 r5 @$ i- C5 B! N3 E1 W// display the contents of the Home Folder
( c3 B) `: x& `3 p* G j2 p' `home.listHomeFolder(user);
3 B& b+ \4 `" ^7 ^' Y$ r/ ]// Perform a simple query of the database& m& L' ~0 _& N2 c4 Y! L
query.queryItems();' s& ?( \) m4 ^+ y* F+ O& r
// Perform some basic data management functions
0 ] A7 b e4 F5 b) O' [4 }9 hdm.createReviseAndDelete();: \# i/ Z) l3 H' @
// Terminate the session with the Teamcenter server
) d: d4 Q$ t1 P- H% Xsession.logout();/ V3 L' E, w, p
}! ?9 x$ s9 P- G ?2 C% R% \ S( o
}
" @2 l0 O, I1 |: H4 _1 ~6 @. L- E( I. I
|
|