001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.util;
016    
017    import javax.portlet.PortletPreferences;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public class PrefsPropsUtil {
023    
024            public static String getString(long companyId, String key)
025                    throws Exception {
026    
027                    Object returnObj = PortalClassInvoker.invoke(
028                            false, _getStringArrayMethodKey1, companyId, key);
029    
030                    if (returnObj != null) {
031                            return (String)returnObj;
032                    }
033                    else {
034                            return null;
035                    }
036            }
037    
038            public static String getString(String key)
039                    throws Exception {
040    
041                    Object returnObj = PortalClassInvoker.invoke(
042                            false, _getStringArrayMethodKey2, key);
043    
044                    if (returnObj != null) {
045                            return (String)returnObj;
046                    }
047                    else {
048                            return null;
049                    }
050            }
051    
052            public static String[] getStringArray(
053                            long companyId, String name, String delimiter)
054                    throws Exception {
055    
056                    Object returnObj = PortalClassInvoker.invoke(
057                            false, _getStringArray1, companyId, name, delimiter);
058    
059                    if (returnObj != null) {
060                            return (String[])returnObj;
061                    }
062                    else {
063                            return null;
064                    }
065            }
066    
067            public static String[] getStringArray(
068                            long companyId, String name, String delimiter,
069                            String[] defaultValue)
070                    throws Exception {
071    
072                    Object returnObj = PortalClassInvoker.invoke(
073                            false, _getStringArray2, companyId, name, delimiter, defaultValue);
074    
075                    if (returnObj != null) {
076                            return (String[])returnObj;
077                    }
078                    else {
079                            return null;
080                    }
081            }
082    
083            public static String[] getStringArray(
084                            PortletPreferences preferences, long companyId, String name,
085                            String delimiter)
086                    throws Exception {
087    
088                    Object returnObj = PortalClassInvoker.invoke(
089                            false, _getStringArray3, preferences, companyId, name, delimiter);
090    
091                    if (returnObj != null) {
092                            return (String[])returnObj;
093                    }
094                    else {
095                            return null;
096                    }
097            }
098    
099            public static String[] getStringArray(
100                            PortletPreferences preferences, long companyId, String name,
101                            String delimiter, String[] defaultValue)
102                    throws Exception {
103    
104                    Object returnObj = PortalClassInvoker.invoke(
105                            false, _getStringArray4, preferences, companyId, name, delimiter,
106                            defaultValue);
107    
108                    if (returnObj != null) {
109                            return (String[])returnObj;
110                    }
111                    else {
112                            return null;
113                    }
114            }
115    
116            public static String[] getStringArray(String name, String delimiter)
117                    throws Exception {
118    
119                    Object returnObj = PortalClassInvoker.invoke(
120                            false, _getStringArray5, name, delimiter);
121    
122                    if (returnObj != null) {
123                            return (String[])returnObj;
124                    }
125                    else {
126                            return null;
127                    }
128            }
129    
130            public static String[] getStringArray(
131                            String name, String delimiter, String[] defaultValue)
132                    throws Exception {
133    
134                    Object returnObj = PortalClassInvoker.invoke(
135                            false, _getStringArray6, name, delimiter, defaultValue);
136    
137                    if (returnObj != null) {
138                            return (String[])returnObj;
139                    }
140                    else {
141                            return null;
142                    }
143            }
144    
145            private static final String _CLASS_NAME =
146                    "com.liferay.portal.util.PrefsPropsUtil";
147    
148            private static MethodKey _getStringArray1 = new MethodKey(
149                    _CLASS_NAME, "getStringArray", long.class, String.class, String.class);
150            private static MethodKey _getStringArray2 = new MethodKey(
151                    _CLASS_NAME, "getStringArray", long.class, String.class, String.class,
152                    String[].class);
153            private static MethodKey _getStringArray3 = new MethodKey(
154                    _CLASS_NAME, "getStringArray", PortletPreferences.class, long.class,
155                    String.class, String.class);
156            private static MethodKey _getStringArray4 = new MethodKey(
157                    _CLASS_NAME, "getStringArray", PortletPreferences.class, long.class,
158                    String.class, String.class, String[].class);
159            private static MethodKey _getStringArray5 = new MethodKey(
160                    _CLASS_NAME, "getStringArray", String.class, String.class);
161            private static MethodKey _getStringArray6 = new MethodKey(
162                    _CLASS_NAME, "getStringArray", String.class, String.class,
163                    String[].class);
164            private static MethodKey _getStringArrayMethodKey1 = new MethodKey(
165                    _CLASS_NAME, "getString", long.class, String.class);
166            private static MethodKey _getStringArrayMethodKey2 = new MethodKey(
167                    _CLASS_NAME, "getString", String.class);
168    
169    }