Source Code Cross Referenced for SampleService.java in  » UML » MetaBoss » com » hatbuyer » services » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » UML » MetaBoss » com.hatbuyer.services 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2004 © Softaris Pty.Ltd. All Rights Reserved.
015:        package com.hatbuyer.services;
016:
017:        import com.hatbuyer.suppliers.hatmaker.coredomainsupport.UserDetails;
018:        import com.hatbuyer.suppliers.hatmaker.coredomainsupport.datamanagement.GetAllUsersInput;
019:        import com.hatbuyer.suppliers.hatmaker.coredomainsupport.datamanagement.GetAllUsersResult;
020:        import com.hatbuyer.suppliers.hatmaker.maindomainsupport.ClientDetails;
021:        import com.hatbuyer.suppliers.hatmaker.maindomainsupport.ProductDetails;
022:        import com.hatbuyer.suppliers.hatmaker.maindomainsupport.ProductKey;
023:        import com.hatbuyer.suppliers.hatmaker.maindomainsupport.datamanagement.GetAllClientsInput;
024:        import com.hatbuyer.suppliers.hatmaker.maindomainsupport.datamanagement.GetAllClientsResult;
025:        import com.hatbuyer.suppliers.hatmaker.maindomainsupport.datamanagement.GetAllProductsInput;
026:        import com.hatbuyer.suppliers.hatmaker.maindomainsupport.datamanagement.GetAllProductsResult;
027:        import com.hatbuyer.suppliers.hatmaker.miscellaneousservices.marketingqueries.GetClientsWhoOrderedProductsOrServicesInput;
028:        import com.hatbuyer.suppliers.hatmaker.miscellaneousservices.marketingqueries.GetClientsWhoOrderedProductsOrServicesResult;
029:
030:        /** Simple Web Services client */
031:        public class SampleService {
032:
033:            com.hatbuyer.suppliers.hatmaker.coredomainsupport.datamanagement.WSPType_Stub mCoreDomainSupportStub = null;
034:            com.hatbuyer.suppliers.hatmaker.maindomainsupport.datamanagement.WSPType_Stub mMainDomainSupportStub = null;
035:            com.hatbuyer.suppliers.hatmaker.miscellaneousservices.marketingqueries.WSPType_Stub mMarketingQueriesStub = null;
036:            UserDetails[] mLastUserDetails = null;
037:            ClientDetails[] mLastClientDetails = null;
038:            ProductDetails[] mLastProductDetails = null;
039:
040:            public static void main(String[] args) {
041:                System.out.println();
042:                System.out
043:                        .println("Sample Java Client for the HatMaker Web Services");
044:                System.out.println();
045:                System.out.println();
046:                try {
047:                    SampleService client = new SampleService();
048:                    client.testGetAllUsers();
049:                    client.testGetAllClients();
050:                    client.testGetAllProducts();
051:                    client.testGetClientsWhoOrderedProductsOrServices();
052:                } catch (Exception ex) {
053:                    ex.printStackTrace();
054:                }
055:            }
056:
057:            public SampleService() {
058:                try {
059:                    mCoreDomainSupportStub = (com.hatbuyer.suppliers.hatmaker.coredomainsupport.datamanagement.WSPType_Stub) (new com.hatbuyer.suppliers.hatmaker.coredomainsupport.datamanagement.DataManagementWebService_Impl()
060:                            .getWSP());
061:                    mMainDomainSupportStub = (com.hatbuyer.suppliers.hatmaker.maindomainsupport.datamanagement.WSPType_Stub) (new com.hatbuyer.suppliers.hatmaker.maindomainsupport.datamanagement.DataManagementWebService_Impl()
062:                            .getWSP());
063:                    mMarketingQueriesStub = (com.hatbuyer.suppliers.hatmaker.miscellaneousservices.marketingqueries.WSPType_Stub) (new com.hatbuyer.suppliers.hatmaker.miscellaneousservices.marketingqueries.MarketingQueriesWebService_Impl()
064:                            .getWSP());
065:                } catch (Exception ex) {
066:                    ex.printStackTrace();
067:                }
068:            }
069:
070:            public void testGetAllUsers() throws Exception {
071:                System.out.println("Running GetAllUsers().");
072:                GetAllUsersInput lInput = new GetAllUsersInput();
073:                GetAllUsersResult lResult = mCoreDomainSupportStub
074:                        .getAllUsers(lInput);
075:                mLastUserDetails = lResult.getUsers();
076:                if (mLastUserDetails != null) {
077:                    System.out.println("Got " + mLastUserDetails.length
078:                            + " users");
079:                    for (int i = 0; i < mLastUserDetails.length; i++) {
080:                        UserDetails lUserDetail = mLastUserDetails[i];
081:                        System.out.println("User #" + Integer.toString(i + 1)
082:                                + ". Id: " + lUserDetail.getInstanceId()
083:                                + " Name: " + lUserDetail.getName());
084:                    }
085:                } else
086:                    System.out.println("No users were found");
087:            }
088:
089:            public void testGetAllClients() throws Exception {
090:                System.out.println("Running GetAllClients().");
091:                GetAllClientsInput lInput = new GetAllClientsInput();
092:                GetAllClientsResult lResult = mMainDomainSupportStub
093:                        .getAllClients(lInput);
094:                mLastClientDetails = lResult.getClients();
095:                if (mLastClientDetails != null) {
096:                    System.out.println("Got " + mLastClientDetails.length
097:                            + " clients");
098:                    for (int i = 0; i < mLastClientDetails.length; i++) {
099:                        ClientDetails lClientDetail = mLastClientDetails[i];
100:                        System.out.println("Client #" + Integer.toString(i + 1)
101:                                + ". Id: " + lClientDetail.getInstanceId()
102:                                + " Name: " + lClientDetail.getCompanyName());
103:                    }
104:                } else
105:                    System.out.println("No clients were found");
106:            }
107:
108:            public void testGetAllProducts() throws Exception {
109:                System.out.println("Running GetAllProducts().");
110:                GetAllProductsInput lInput = new GetAllProductsInput();
111:                GetAllProductsResult lResult = mMainDomainSupportStub
112:                        .getAllProducts(lInput);
113:                mLastProductDetails = lResult.getProducts();
114:                if (mLastProductDetails != null) {
115:                    System.out.println("Got " + mLastProductDetails.length
116:                            + " products");
117:                    for (int i = 0; i < mLastProductDetails.length; i++) {
118:                        ProductDetails lProductDetail = mLastProductDetails[i];
119:                        System.out.println("Product #"
120:                                + Integer.toString(i + 1) + ". Id: "
121:                                + lProductDetail.getInstanceId() + " Name: "
122:                                + lProductDetail.getName());
123:                    }
124:                } else
125:                    System.out.println("No products were found");
126:            }
127:
128:            public void testGetClientsWhoOrderedProductsOrServices()
129:                    throws Exception {
130:                if (mLastProductDetails == null) {
131:                    System.out
132:                            .println("The GetClientsWhoOrderedProductsOrServices() test requires GetAllProducts() test.");
133:                    testGetAllProducts();
134:                    if (mLastProductDetails == null)
135:                        return;
136:                }
137:                System.out
138:                        .println("Running GetClientsWhoOrderedProductsOrServices().");
139:                for (int i = 0; i < mLastProductDetails.length; i++) {
140:                    ProductDetails lProductDetail = mLastProductDetails[i];
141:                    ProductKey lProductKey = new ProductKey();
142:                    lProductKey.setInstanceId(lProductDetail.getInstanceId());
143:                    GetClientsWhoOrderedProductsOrServicesInput lInput = new GetClientsWhoOrderedProductsOrServicesInput();
144:                    lInput.setProducts(new ProductKey[] { lProductKey });
145:                    GetClientsWhoOrderedProductsOrServicesResult lResult = mMarketingQueriesStub
146:                            .getClientsWhoOrderedProductsOrServices(lInput);
147:                    ClientDetails[] lInterestedClientDetails = lResult
148:                            .getClients();
149:                    if (lInterestedClientDetails != null) {
150:                        System.out
151:                                .println("Product " + lProductDetail.getName()
152:                                        + " have been ordered by "
153:                                        + lInterestedClientDetails.length
154:                                        + " clients:");
155:                        for (int j = 0; j < lInterestedClientDetails.length; j++) {
156:                            ClientDetails lClientDetail = lInterestedClientDetails[j];
157:                            System.out.println("    Client #"
158:                                    + Integer.toString(j + 1) + ". Id: "
159:                                    + lClientDetail.getInstanceId() + " Name: "
160:                                    + lClientDetail.getCompanyName());
161:                        }
162:                    } else
163:                        System.out.println("No matching client records found.");
164:                }
165:            }
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.