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


001:        /*
002:         * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
003:         *
004:         * Redistribution and use in source and binary forms, with or without
005:         * modification, are permitted provided that the following conditions
006:         * are met:
007:         *
008:         * - Redistributions of source code must retain the above copyright
009:         *   notice, this list of conditions and the following disclaimer.
010:         *
011:         * - Redistribution in binary form must reproduce the above copyright
012:         *   notice, this list of conditions and the following disclaimer in
013:         *   the documentation and/or other materials provided with the
014:         *   distribution.
015:         *
016:         * Neither the name of Sun Microsystems, Inc. or the names of
017:         * contributors may be used to endorse or promote products derived
018:         * from this software without specific prior written permission.
019:         *
020:         * This software is provided "AS IS," without a warranty of any
021:         * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
022:         * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
023:         * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
024:         * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
025:         * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
026:         * DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
027:         * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
028:         * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
029:         * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
030:         * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE,
031:         * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
032:         *
033:         * You acknowledge that Software is not designed, licensed or intended
034:         * for use in the design, construction, operation or maintenance of
035:         * any nuclear facility.
036:         */
037:        package com.sun.portal.siebelportlet.util;
038:
039:        import java.util.Enumeration;
040:        import java.util.Vector;
041:        import java.util.Hashtable;
042:        import java.io.IOException;
043:        import java.io.Writer;
044:        import java.util.logging.*;
045:
046:        import javax.portlet.*;
047:
048:        import com.sun.portal.iwayutil.config.*;
049:        import com.sun.portal.iwayutil.connection.*;
050:
051:        /**
052:         *
053:         * This class provides the utility methods to get parse the Siebel response
054:         *
055:         * @version 1.0
056:         * @author Deepak H P
057:         * @date 25 Feb 2005
058:         *
059:         **/
060:        public class SiebelResponseUtils {
061:
062:            static Logger logger = SiebelLogger.getLogger();
063:
064:            /**
065:             * This method parses the Siebel response to a vector containing
066:             * the Account Summary
067:             */
068:            public static Vector getAccountSummary(String resStr) {
069:                String[] fields = SiebelAccountRequestUtils.accountSummaryFields;
070:                return getRecords(resStr, fields);
071:            }
072:
073:            /**
074:             * This method parses the Siebel response to a vector containing
075:             * the Account Details
076:             */
077:            public static Vector getAccountDetails(String resStr) {
078:                String[] fields = SiebelAccountRequestUtils.accountDetailsFields;
079:                return getRecords(resStr, fields);
080:            }
081:
082:            /**
083:             * This method parses the Siebel response to a vector containing
084:             * the Contact Details
085:             */
086:            public static Vector getContactDetails(String resStr) {
087:                String[] fields = SiebelContactRequestUtils.queryFields;
088:                return getRecords(resStr, fields);
089:            }
090:
091:            /**
092:             * This method parses the Siebel response to a vector containing
093:             * the Activity Details
094:             */
095:            public static Vector getActivityDetails(String resStr) {
096:                String[] fields = SiebelActivityRequestUtils.queryFields;
097:                return getRecords(resStr, fields);
098:            }
099:
100:            /**
101:             * This method parses the Siebel response to a vector containing
102:             * the Opportunity Details
103:             */
104:            public static Vector getOpportunityDetails(String resStr) {
105:                String[] fields = SiebelOpportunityRequestUtils.queryFields;
106:                return getRecords(resStr, fields);
107:            }
108:
109:            /**
110:             * This method parses the Siebel response to a vector containing
111:             * the Invoice Details
112:             */
113:            public static Vector getInvoiceDetails(String resStr) {
114:                String[] fields = SiebelInvoiceRequestUtils.queryFields;
115:                return getRecords(resStr, fields);
116:            }
117:
118:            /**
119:             * This method parses the Siebel response to a vector containing
120:             * the Revenue Forecast Details
121:             */
122:            public static Vector getForecastDetails(String resStr) {
123:                String[] fields = SiebelForecastRequestUtils.queryFields;
124:                return getRecords(resStr, fields);
125:            }
126:
127:            /**
128:             * This method parses the Siebel response to a vector containing
129:             * the hashtable. The keys of the hashtable are specified by fields
130:             */
131:            private static Vector getRecords(String outStr, String[] fields) {
132:
133:                Vector records = new Vector();
134:                String output = outStr;
135:                String tag = "record";
136:                String recordStr = null;
137:                int index = output.indexOf("</record>");
138:
139:                while (index > -1) {
140:                    recordStr = getFieldValue(output, tag);
141:                    Hashtable record = getRecord(recordStr, fields);
142:                    records.addElement(record);
143:                    output = output.substring(index + 9, output.length());
144:                    index = output.indexOf("</record>");
145:                }
146:                return records;
147:            }
148:
149:            /**
150:             * This method parses the Siebel response to a hashtable.
151:             * The keys of the hashtable are specified by fields
152:             */
153:            private static Hashtable getRecord(String recordStr, String[] fields) {
154:
155:                String tag = null;
156:                String value = null;
157:
158:                Hashtable record = new Hashtable();
159:
160:                for (int i = 0; i < fields.length; i++) {
161:
162:                    tag = fields[i].replaceAll(" ", "_spc");
163:                    tag = tag.replaceAll("#", "_pnd");
164:                    insertCellData(record, recordStr, tag);
165:                }
166:                return record;
167:            }
168:
169:            /**
170:             * This method extracts a tag value from the record and inserts it in to
171:             * the hashtable.
172:             */
173:            private static void insertCellData(Hashtable row, String record,
174:                    String tag) {
175:
176:                String value = getFieldValue(record, tag);
177:                if (value == null) {
178:                    value = "-";
179:                }
180:                row.put(tag, value);
181:            }
182:
183:            /**
184:             * This method returns the value within a XML tag
185:             */
186:            private static String getFieldValue(String oStr, String tag) {
187:
188:                String retVal = null;
189:                String sStr = "<" + tag + ">";
190:                String eStr = "</" + tag + ">";
191:                int sIndex = oStr.indexOf(sStr);
192:                int eIndex = oStr.indexOf(eStr);
193:
194:                if (sIndex < 0) {
195:                    return retVal;
196:                }
197:                if (eIndex < sIndex) {
198:                    return retVal;
199:                }
200:                sIndex = sIndex + sStr.length();
201:                retVal = oStr.substring(sIndex, eIndex).trim();
202:                return retVal;
203:            }
204:
205:            /**
206:             * This method will print the log the messages.
207:             **/
208:            private static void debug(String methodName, String msg) {
209:                logger.log(Level.INFO,
210:                        "com.sun.portal.siebelportlet.util.SiebelResponseUtils:"
211:                                + methodName + ":" + msg);
212:            }
213:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.