|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 N+ N2 e4 }: P2 mTeamcenter SOA 开发基础代码解析+ E; I: t w$ N( }' t0 B6 }
* An instance of the Connection object is created with implementations of the
2 ]# t# b5 m8 b2 d. }) ~* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners5 I9 H. {- |6 l' ~, B
* intefaces. This client application performs the following functions:1 v" L& t. @4 l7 U) y+ S
* 1. Establishes a session with the Teamcenter server
0 b. a/ q7 W$ C' D3 M* 2. Display the contents of the Home Folder
+ N& _- y; O4 `* 3. Performs a simple query of the database
1 L+ ~. C* {) q4 h6 K9 U* 4. Create, revise, and delete an Item
+ C# |& ]/ B+ w, x3 Y' a1 c; i7 D2 J9 p; |) y
5 q j, I4 W4 }( G- B
public class Hello$ Y. m' x- X9 a: E {6 F Z
{* g1 `; L6 `' `) C( w
/**
6 w9 }+ O" U$ L2 m; Z* @param args -help or -h will print out a Usage statement
9 K* e8 ]7 X) n' T! n* m*/' f7 v) {9 S4 g/ G" k) F2 R6 X
public static void main(String[] args)
( C$ y$ X7 v- f5 Z9 z4 C% ?{( C1 P" _ f: p! O
if (args.length > 0)
& {; x# w/ p# s/ L{
2 J. ~- v7 B2 j& B9 S8 eif (args[0].equals("-help") || args[0].equals("-h"))
2 K4 r& X1 b+ }% c! s1 B" p{
0 g- A0 O5 c- ?; j4 ESystem.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello"); _! b( X) t' _1 @
System.exit(0);3 O9 O' Q/ K K% E, C
}
3 b. r) c2 g% X* [3 a# ^* Q- m) V}$ G( `1 U% _' k$ J
// Get optional host information
: |+ U% L! j' d# N+ |# {4 BString serverHost = "http://localhost:7001/tc";8 M3 k+ M" ^4 ^; f4 |) q
String host = System.getProperty("host");
) w n' e) S- _. jif (host != null && host.length() > 0). q4 H! P- P9 p( D5 B0 V
{
% Z9 F, {1 g8 U" ~& k2 IserverHost = host;
4 I+ T/ q' W- h6 v7 X8 K e}$ g+ S" m# j! f) E
Session session = new Session(serverHost);
2 @; r% Y+ ]# Z3 oHomeFolder home = new HomeFolder();# C! t& v$ ~0 o+ d" ~: w0 a4 |* z
Query query = new Query();$ j8 B1 ~) Y3 }5 K; d. d- n
DataManagement dm = new DataManagement();
1 P$ L' V+ C5 _% W& G2 C! g' L0 R// Establish a session with the Teamcenter Server" P) N* a }4 b- M% K3 s6 k' U$ h
User user = session.login(); M7 T" r+ @5 S0 }( N+ _5 |% x9 d! b
// Using the User object returned from the login service request
* K2 [/ s2 d8 Y: E# g4 \/ t// display the contents of the Home Folder
% q# n2 J$ E8 U% [1 l% M: D$ khome.listHomeFolder(user);
/ e' {$ p: c" o8 C5 v// Perform a simple query of the database3 g) m2 Q& G# O, k z- X9 G
query.queryItems();6 c2 Z; {1 O0 L% \ {* K
// Perform some basic data management functions$ r9 @0 S4 _) C
dm.createReviseAndDelete();% P! Z6 ~2 ^/ ]8 _+ H2 P
// Terminate the session with the Teamcenter server
1 p L; j/ t6 u$ Q. l4 I! i/ Z& l3 u) dsession.logout();
! w% K$ b% Y7 d5 N2 D}: C0 S. T }% O
}- ^& p* U; j! _0 H$ t0 `
6 s& \2 b: U# K9 y d; e |
|