|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 \; }0 {7 N6 j" N' M
Teamcenter SOA 开发基础代码解析- T+ b- A4 b2 m& V) N
* An instance of the Connection object is created with implementations of the
- |' f& W3 P2 }5 \6 X2 m* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
7 K5 g; {( R2 r0 Z: G- m: m* intefaces. This client application performs the following functions:
# P0 G& ]7 D5 G O1 h* 1. Establishes a session with the Teamcenter server
6 w# [7 {* v7 m; ~% D* 2. Display the contents of the Home Folder
% l. r4 q6 z# [# {, z3 ]' ~: ]* 3. Performs a simple query of the database! x3 z( [! e3 M* C# c% A
* 4. Create, revise, and delete an Item
7 N2 p( M; E0 y# Z
+ O/ P7 h2 p# |5 G$ A' d, Y( b _4 z, A+ {. A9 c y0 Q1 R5 R/ a: ~
public class Hello) x2 Z; k# k8 c% U6 l2 V
{/ {( o$ `1 D5 m" c
/**
3 F% j0 R: P1 {* @param args -help or -h will print out a Usage statement
' W# B- O7 R$ z2 I ^7 {$ }- k \*/; W. j$ C" X1 b' c; B
public static void main(String[] args)+ m1 q" j9 U4 g$ u( @& f8 b/ Q6 ]5 o
{0 \- s4 f2 R2 ^. `+ E. k
if (args.length > 0)
' }2 r* u" F0 l& b! J{
7 k; k) m$ Y# |' l) Dif (args[0].equals("-help") || args[0].equals("-h"))0 R' `. _2 T4 I+ Q: U z! A
{0 ]- `8 s8 a% D+ i' O* J! z4 u5 n
System.out.println("usage: java [-Dhost=http://server:port/TC] com.teamcenter.hello.Hello");
2 ^" {* }: J: W" U! A' v. iSystem.exit(0);
! c' c1 x ~' k, d( \& k W}$ R% {* v5 ^6 S0 L9 v4 A& U
}
. k6 f/ e; U o// Get optional host information
/ F% Q; ~# x, Y- E) j5 s1 ?& uString serverHost = "http://localhost:7001/tc";
! W; L" U" E3 [String host = System.getProperty("host");6 Z5 y3 ^8 o) a1 M: V+ @4 f; a
if (host != null && host.length() > 0)
5 \* O" S0 m0 \- I8 V{
; z7 |* r: O! r4 I4 iserverHost = host;! b+ J) Z9 p9 X& k; K3 b) i- W
}1 Y0 T) M0 w0 m; B
Session session = new Session(serverHost);! v/ l2 K- ^9 S5 r" f, B- I
HomeFolder home = new HomeFolder();3 I% u0 l7 y1 @5 q+ @
Query query = new Query();
$ c' V% w1 V! [4 h: j7 O- c) XDataManagement dm = new DataManagement();9 M( \) C3 x$ j) t+ k2 C' s* k
// Establish a session with the Teamcenter Server& ^2 { B9 H* l
User user = session.login();
8 Z/ ^" u& w5 N( q5 ?! J// Using the User object returned from the login service request6 ]# Z# X4 I4 M6 i! ]7 h+ v" T
// display the contents of the Home Folder1 n) x# M8 _. |2 T" X
home.listHomeFolder(user);, e9 `$ ~0 g" R0 g4 z$ t
// Perform a simple query of the database
- G: s9 ^9 a0 P# A7 h* ^, s" }query.queryItems();2 `9 A8 y$ r+ S* c6 B
// Perform some basic data management functions
6 p5 r8 n; v* {3 j4 G3 ?( g7 Ldm.createReviseAndDelete();
, i5 P2 @4 M5 S7 c" L* D// Terminate the session with the Teamcenter server
3 I( s: i8 D5 N5 _session.logout();
4 \* A1 ` y n* ?. `& y}7 K2 v) }6 [6 j! V" p* l) h& v" @
}+ S/ q' a6 P3 P" x- y
( W5 z7 V# S. t |
|