|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- K* j {7 l* X5 LTeamcenter SOA 开发基础代码解析
$ C" H4 t! a* x$ e; f( K* An instance of the Connection object is created with implementations of the2 V% r" P* t) E/ q6 P! h
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
: O3 Y* r+ U0 i% I8 q# p1 }- C* intefaces. This client application performs the following functions:' |2 B# ]" ^9 p, m9 X2 S' H
* 1. Establishes a session with the Teamcenter server+ D9 o0 i3 q* \9 ~1 \
* 2. Display the contents of the Home Folder1 Y, _4 y; V/ T* R
* 3. Performs a simple query of the database
2 q) q# Q9 c8 c! h M8 G* 4. Create, revise, and delete an Item
) b7 x V( d N5 Z5 {# k! G! H) K0 u5 O1 R$ i
+ \. p3 e3 ]+ {8 K- Npublic class Hello* r# t/ f0 O3 P7 z5 K7 K
{+ i3 i. Q* q4 Q6 X/ m
/**
% w, b0 _6 E8 D( G' `* @param args -help or -h will print out a Usage statement1 Z4 c! Z: @% z. k
*/# |% x+ U+ U: O. b; m5 o
public static void main(String[] args)
' M+ Y; Q, F" Q T+ G{
: U. ^: J/ [4 j/ Iif (args.length > 0)
1 t) V% C3 @: [3 {. @{
2 B' {6 W; }! r! r$ @/ oif (args[0].equals("-help") || args[0].equals("-h"))
9 Z, V. ]% j1 T7 X4 U& A* ~{: l( c3 A0 H; K; Z% o
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
0 M1 c9 h! P8 R2 ]3 tSystem.exit(0);9 i# n/ J& b2 H' r2 H& A2 C: @; r
}1 ~; ~: i1 k' O, b
}$ i2 c1 m: r9 s- U7 }5 K8 l
// Get optional host information4 P1 i# i$ y; G
String serverHost = "http://localhost:7001/tc";4 X* G1 ]& L+ A: A
String host = System.getProperty("host");
6 A5 b2 o7 e0 Z' t, y7 V$ Eif (host != null && host.length() > 0) m8 C/ h$ s. a* m6 P4 X1 A( s+ P; T
{7 g9 j: @, A/ J( K
serverHost = host;
5 n: V) P. s& a5 f}. w( d5 C* X2 w( J: T; y" F
Session session = new Session(serverHost);& P9 P" f5 K+ e$ \& F. M
HomeFolder home = new HomeFolder();6 x/ v9 [ @% i5 _2 i
Query query = new Query();
! C3 T4 G* p! Z. v6 ~' IDataManagement dm = new DataManagement();0 L# O6 ]' @$ Z: s0 { V0 O) k# w
// Establish a session with the Teamcenter Server8 V' {( E9 q+ V" D% Q! U/ O
User user = session.login();) R! n5 K7 R1 D# g( w! e+ ]+ Q
// Using the User object returned from the login service request# c1 x9 z: Z& _
// display the contents of the Home Folder
: G- s/ o9 Q- ^home.listHomeFolder(user);
9 \) G0 d1 i- b K// Perform a simple query of the database( P' P! T8 B, F6 o; p; n
query.queryItems();# v" ^' x. g% H
// Perform some basic data management functions
) m3 n' z* c7 V/ O8 kdm.createReviseAndDelete();( ^ w" D B5 }" x8 p) ~# V
// Terminate the session with the Teamcenter server j2 H3 c$ {5 F' I
session.logout();5 r0 \" M, e; F- V
}
# [- m1 D% E/ i( v}0 ~! X2 z7 |0 _8 U( b' S
@' m |9 s, R+ m: @
|
|