|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
, P+ P6 z1 M' H( B3 j8 M0 n: P+ aTeamcenter SOA 开发基础代码解析
6 x/ A) u3 `$ x* An instance of the Connection object is created with implementations of the
% L7 M$ R4 x+ }8 _3 K, y* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners! F' p0 S0 o2 o2 o4 J# ?! A
* intefaces. This client application performs the following functions:6 b. A- \( }5 i
* 1. Establishes a session with the Teamcenter server) w, O8 R& U1 p& x8 ^! D
* 2. Display the contents of the Home Folder
: ]0 c8 n3 @* X: a. x. _* 3. Performs a simple query of the database
3 ~6 R8 m! I) `" E( r8 d& x6 K+ e+ J# C* 4. Create, revise, and delete an Item$ |# u) ]/ u3 R# m. z3 \, o+ C
/ {5 u5 U( n( d0 a `; S. Z& J% _' k! n( G) h
public class Hello" @& s9 U- L* o1 y/ c' q
{
+ K i* h) |) N4 V, D" B8 j/**
. E% o3 U1 U3 B1 U& X1 d2 c5 h" G* @param args -help or -h will print out a Usage statement2 Q5 l( @0 h7 r/ b1 ]
*/
$ } I7 p, I9 ?public static void main(String[] args)
; @4 [8 V1 q O' m, x{, C- N' t" q, q1 S9 }$ \) D
if (args.length > 0)9 }, i5 l- I2 W& `5 e1 v7 s
{1 b+ W, m: w1 e! V! M
if (args[0].equals("-help") || args[0].equals("-h"))
( f2 Q: d2 p+ j9 @0 _% r8 S& Z {{: O/ a, D% c7 z H2 p
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
: {+ [% o8 y0 x) Z! U$ o0 C7 t, HSystem.exit(0);
& f$ Z3 j0 D3 H& _+ X4 F; |- U}: i+ Y1 F* ~% L# A3 N. q
}+ N; f1 C8 f+ `1 X2 W; C; H: B
// Get optional host information
5 w8 A+ C$ r8 P. E" nString serverHost = "http://localhost:7001/tc";8 C+ f( p- v) X: J4 I$ }/ D
String host = System.getProperty("host");
1 R8 v7 C$ k Qif (host != null && host.length() > 0)
0 ~$ l! M1 y+ q* I/ C8 d" N{
) G' w6 Q" c" y A5 l- OserverHost = host;
: U2 k; e6 t- U( I}
; |; T z. X& R1 U7 J% r; [8 J" HSession session = new Session(serverHost);
# ]8 t# [7 h- [& `HomeFolder home = new HomeFolder();3 N5 y0 _, C" S, G
Query query = new Query();
$ t" }# R/ q9 N. \; aDataManagement dm = new DataManagement();
8 A r) m. Z4 z// Establish a session with the Teamcenter Server5 @. f+ O$ k( Q9 m
User user = session.login();1 G& P' B, V/ a. i# ~
// Using the User object returned from the login service request
+ S1 x3 M! m; f& y$ V1 V// display the contents of the Home Folder# D9 D# b% T7 N0 [
home.listHomeFolder(user);. Y2 ^ N8 Y5 K: B2 ]5 q
// Perform a simple query of the database3 j. E* ]8 y2 V5 s9 D+ T# ] Y
query.queryItems();! J) j2 t' w' e5 I7 P
// Perform some basic data management functions; D! G" N! G: }, ^, E6 {: r
dm.createReviseAndDelete();2 _% Z2 t) [; |
// Terminate the session with the Teamcenter server0 D- E9 m% X9 |2 z8 ~( n6 U( A
session.logout();
$ ]& u7 {$ Q% z3 _1 I1 U* E}% M( _0 j" d- p5 N: a
}
1 ^* u& V6 Z; L1 a8 t6 P2 q/ r5 s# q% {& G
|
|