Source Code Cross Referenced for EmployeeManager.java in  » Portal » Open-Portal » com » sun » portal » sapportlet » employee » 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 » Portal » Open Portal » com.sun.portal.sapportlet.employee 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: EmployeeManager.java,v 1.6 2005/10/19 10:26:29 ks161616 Exp $
003:         * Copyright 2005 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.sapportlet.employee;
014:
015:        import com.sun.portal.sapportlet.config.SAPUserConfig;
016:        import com.sun.portal.sapportlet.stubs.employee.*;
017:        import com.sun.portal.sapportlet.stubs.employee.photo.*;
018:        import com.sun.portal.sapportlet.stubs.employee.data.*; //import com.sun.portal.sapportlet.stubs.employee.edit.*;
019:        import com.sun.portal.sapportlet.SAPPortletConstants;
020:        import javax.xml.rpc.Stub;
021:        import java.util.logging.Logger;
022:        import java.rmi.RemoteException;
023:        import java.net.URL;
024:
025:        /**
026:         * This is the delegate class that handles all interactions with
027:         * the Employee related web services.
028:         *
029:         * @author nk137934
030:         */
031:        public class EmployeeManager implements  SAPPortletConstants {
032:
033:            private static Logger logger = Logger.getLogger(LOGGER_NAMESPACE);
034:
035:            private BAPI_PERSDATA_GETDETAILEDLISTPortType viewPortType = null;
036:            private HRWPC_RFC_EP_READ_PHOTO_URIPortType photoPortType = null;
037:            private HR_GETEMPLOYEEDATA_FROMUSERPortType dataPortType = null;
038:
039:            private SAPUserConfig userConfig = null;
040:            private String employeeNumber;
041:
042:            /*
043:             *  This method read the sap configuration details and initializes the
044:             *  web service stub
045:             */
046:            public void init(SAPUserConfig userConfig, String endPointAddress) {
047:
048:                //logger.fine("Init of EmployeeManager");
049:
050:                this .userConfig = userConfig;
051:                //String endPointAddress = SAPConfiguration.getEndpointAddress();
052:
053:                String userName = userConfig.getUserName();
054:                String userPass = userConfig.getUserPassword();
055:
056:                Stub stub = createViewProxy();
057:                stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
058:                        endPointAddress);
059:                stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,
060:                        userName);
061:                stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,
062:                        userPass);
063:                viewPortType = (BAPI_PERSDATA_GETDETAILEDLISTPortType) stub;
064:
065:                Stub photoStub = createPhotoProxy();
066:                photoStub._setProperty(
067:                        javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
068:                        endPointAddress);
069:                photoStub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,
070:                        userName);
071:                photoStub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,
072:                        userPass);
073:                photoPortType = (HRWPC_RFC_EP_READ_PHOTO_URIPortType) photoStub;
074:
075:                Stub dataStub = createDataProxy();
076:                dataStub._setProperty(
077:                        javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
078:                        endPointAddress);
079:                dataStub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,
080:                        userName);
081:                dataStub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,
082:                        userPass);
083:                dataPortType = (HR_GETEMPLOYEEDATA_FROMUSERPortType) dataStub;
084:
085:            }
086:
087:            public Employee getEmployee(String employeeName, String endPointHost)
088:                    throws RemoteException {
089:
090:                // Get employee number given the employee name
091:                HR_GETEMPLOYEEDATA_FROMUSER dataParams = new HR_GETEMPLOYEEDATA_FROMUSER();
092:                dataParams.setUSERNAME(employeeName);
093:                dataParams.setVALIDBEGIN(TIME_INTERVAL_HIGH);
094:                HR_GETEMPLOYEEDATA_FROMUSERResponse dataResp = dataPortType
095:                        .HR_GETEMPLOYEEDATA_FROMUSER(dataParams);
096:                String employeeNumber = dataResp.getEMPLOYEENUMBER();
097:
098:                BAPI_PERSDATA_GETDETAILEDLIST parameters = new BAPI_PERSDATA_GETDETAILEDLIST();
099:                parameters.setEMPLOYEENUMBER(employeeNumber);
100:                parameters.setTIMEINTERVALHIGH(TIME_INTERVAL_HIGH);
101:                parameters.setTIMEINTERVALLOW(TIME_INTERVAL_LOW);
102:                BAPI_PERSDATA_GETDETAILEDLISTPERSONALDATA persdata = new BAPI_PERSDATA_GETDETAILEDLISTPERSONALDATA();
103:                parameters.setPERSONALDATA(persdata);
104:                BAPI_PERSDATA_GETDETAILEDLISTResponsePERSONALDATA response = null;
105:
106:                // Invoke the Web Service
107:                response = viewPortType.BAPI_PERSDATA_GETDETAILEDLIST(
108:                        parameters).getPERSONALDATA();
109:
110:                BAPIP0002L[] items = response.getItem();
111:                Employee emp = null;
112:                if (items.length >= 1) {
113:                    emp = new Employee(items[0]);
114:
115:                } else {
116:                    return emp;
117:                }
118:                HRWPC_RFC_EP_READ_PHOTO_URI photoParams = new HRWPC_RFC_EP_READ_PHOTO_URI();
119:                photoParams.setPERNR(emp.getEmployeeNumber());
120:                HRWPC_RFC_EP_READ_PHOTO_URIResponse resp = photoPortType
121:                        .HRWPC_RFC_EP_READ_PHOTO_URI(photoParams);
122:
123:                // The URL does not contain the FQDN
124:                URL photoURL = getFullyQualifiedURL(resp.getURI(), endPointHost);
125:                emp.setPhotoURL(photoURL.toString());
126:                return emp;
127:            }
128:
129:            private URL getFullyQualifiedURL(String givenURLString,
130:                    String endPointHost) {
131:
132:                URL newURL = null;
133:                try {
134:
135:                    URL givenURL = new URL(givenURLString);
136:                    String protocol = givenURL.getProtocol();
137:                    int port = givenURL.getPort();
138:                    String file = givenURL.getFile();
139:                    newURL = new URL(protocol, endPointHost, port, file);
140:                } catch (Exception excp) {
141:                }
142:                return newURL;
143:
144:            }
145:
146:            private static Stub createViewProxy() {
147:                return (Stub) (new BAPI_PERSDATA_GETDETAILEDLISTService_Impl()
148:                        .getBAPI_PERSDATA_GETDETAILEDLISTPortType());
149:            }
150:
151:            private static Stub createPhotoProxy() {
152:                return (Stub) (new HRWPC_RFC_EP_READ_PHOTO_URIService_Impl()
153:                        .getHRWPC_RFC_EP_READ_PHOTO_URIPortType());
154:            }
155:
156:            private static Stub createDataProxy() {
157:                return (Stub) (new HR_GETEMPLOYEEDATA_FROMUSERService_Impl()
158:                        .getHR_GETEMPLOYEEDATA_FROMUSERPortType());
159:            }
160:
161:            public SAPUserConfig getUserConfig() {
162:                return userConfig;
163:            }
164:
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.