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: /**
049: *
050: * This class provides the utility methods to get parse the Siebel response
051: *
052: * @version 1.0
053: * @author Deepak H P
054: * @date 16 June 2005
055: *
056: **/
057: public class SiebelConfigUtils {
058:
059: static Logger logger = SiebelLogger.getLogger();
060: static String defaultAccountRows = null;
061: static String defaultContactRows = null;
062: static String defaultActivityRows = null;
063: static String defaultOpportunityRows = null;
064: static String defaultInvoiceRows = null;
065: static String defaultForecastRows = null;
066:
067: public static void loadSiebelPortletConfiguration(
068: PortletConfig config) {
069: String rowCount = config.getInitParameter("DefaultAccountRows");
070: defaultAccountRows = checkIntegerValue(rowCount);
071: rowCount = config.getInitParameter("DefaultContactRows");
072: defaultContactRows = checkIntegerValue(rowCount);
073: rowCount = config.getInitParameter("DefaultActivityRows");
074: defaultActivityRows = checkIntegerValue(rowCount);
075: rowCount = config.getInitParameter("DefaultOpportunitytRows");
076: defaultOpportunityRows = checkIntegerValue(rowCount);
077: rowCount = config.getInitParameter("DefaultInvoiceRows");
078: defaultInvoiceRows = checkIntegerValue(rowCount);
079: rowCount = config.getInitParameter("DefaultForecastRows");
080: defaultForecastRows = checkIntegerValue(rowCount);
081: }
082:
083: private static String checkIntegerValue(String intValStr) {
084:
085: String retVal = null;
086: try {
087: int row = Integer.parseInt(intValStr);
088: retVal = intValStr;
089: } catch (Exception ex) {
090: retVal = "3";
091: }
092: return retVal;
093: }
094:
095: public static String getDefaultAccountRowCount() {
096: return defaultAccountRows;
097: }
098:
099: public static String getDefaultContactRowCount() {
100: return defaultContactRows;
101: }
102:
103: public static String getDefaultActivityRowCount() {
104: return defaultActivityRows;
105: }
106:
107: public static String getDefaultOpportunityRowCount() {
108: return defaultOpportunityRows;
109: }
110:
111: public static String getDefaultInvoiceRowCount() {
112: return defaultInvoiceRows;
113: }
114:
115: public static String getDefaultForecastRowCount() {
116: return defaultForecastRows;
117: }
118:
119: /**
120: * This method will print the log the messages.
121: **/
122: private static void debug(String methodName, String msg) {
123: logger.log(Level.INFO,
124: "com.sun.portal.siebelportlet.util.SiebelConfigUtils:"
125: + methodName + ":" + msg);
126: }
127: }
|