001
014
015 package com.liferay.portal.kernel.util;
016
017 import javax.portlet.PortletPreferences;
018
019
022 public class PrefsPropsUtil {
023
024 public static int getInteger(long companyId, String key)
025 throws Exception {
026
027 Object returnObj = PortalClassInvoker.invoke(
028 false, _getIntegerMethodKey1, companyId, key);
029
030 if (returnObj != null) {
031 return (Integer)returnObj;
032 }
033 else {
034 return 0;
035 }
036 }
037
038 public static int getInteger(String key) throws Exception {
039 Object returnObj = PortalClassInvoker.invoke(
040 false, _getIntegerMethodKey2, key);
041
042 if (returnObj != null) {
043 return (Integer)returnObj;
044 }
045 else {
046 return 0;
047 }
048 }
049
050 public static long getLong(long companyId, String key)
051 throws Exception {
052
053 Object returnObj = PortalClassInvoker.invoke(
054 false, _getLongMethodKey1, companyId, key);
055
056 if (returnObj != null) {
057 return (Long)returnObj;
058 }
059 else {
060 return 0;
061 }
062 }
063
064 public static long getLong(String key) throws Exception {
065 Object returnObj = PortalClassInvoker.invoke(
066 false, _getLongMethodKey2, key);
067
068 if (returnObj != null) {
069 return (Long)returnObj;
070 }
071 else {
072 return 0;
073 }
074 }
075
076 public static String getString(long companyId, String key)
077 throws Exception {
078
079 Object returnObj = PortalClassInvoker.invoke(
080 false, _getStringMethodKey1, companyId, key);
081
082 if (returnObj != null) {
083 return (String)returnObj;
084 }
085 else {
086 return null;
087 }
088 }
089
090 public static String getString(String key) throws Exception {
091 Object returnObj = PortalClassInvoker.invoke(
092 false, _getStringMethodKey2, key);
093
094 if (returnObj != null) {
095 return (String)returnObj;
096 }
097 else {
098 return null;
099 }
100 }
101
102 public static String[] getStringArray(
103 long companyId, String name, String delimiter)
104 throws Exception {
105
106 Object returnObj = PortalClassInvoker.invoke(
107 false, _getStringArrayMethodKey1, companyId, name, delimiter);
108
109 if (returnObj != null) {
110 return (String[])returnObj;
111 }
112 else {
113 return null;
114 }
115 }
116
117 public static String[] getStringArray(
118 long companyId, String name, String delimiter,
119 String[] defaultValue)
120 throws Exception {
121
122 Object returnObj = PortalClassInvoker.invoke(
123 false, _getStringArrayMethodKey2, companyId, name, delimiter,
124 defaultValue);
125
126 if (returnObj != null) {
127 return (String[])returnObj;
128 }
129 else {
130 return null;
131 }
132 }
133
134 public static String[] getStringArray(
135 PortletPreferences preferences, long companyId, String name,
136 String delimiter)
137 throws Exception {
138
139 Object returnObj = PortalClassInvoker.invoke(
140 false, _getStringArrayMethodKey3, preferences, companyId, name,
141 delimiter);
142
143 if (returnObj != null) {
144 return (String[])returnObj;
145 }
146 else {
147 return null;
148 }
149 }
150
151 public static String[] getStringArray(
152 PortletPreferences preferences, long companyId, String name,
153 String delimiter, String[] defaultValue)
154 throws Exception {
155
156 Object returnObj = PortalClassInvoker.invoke(
157 false, _getStringArrayMethodKey4, preferences, companyId, name,
158 delimiter, defaultValue);
159
160 if (returnObj != null) {
161 return (String[])returnObj;
162 }
163 else {
164 return null;
165 }
166 }
167
168 public static String[] getStringArray(String name, String delimiter)
169 throws Exception {
170
171 Object returnObj = PortalClassInvoker.invoke(
172 false, _getStringArrayMethodKey5, name, delimiter);
173
174 if (returnObj != null) {
175 return (String[])returnObj;
176 }
177 else {
178 return null;
179 }
180 }
181
182 public static String[] getStringArray(
183 String name, String delimiter, String[] defaultValue)
184 throws Exception {
185
186 Object returnObj = PortalClassInvoker.invoke(
187 false, _getStringArrayMethodKey6, name, delimiter, defaultValue);
188
189 if (returnObj != null) {
190 return (String[])returnObj;
191 }
192 else {
193 return null;
194 }
195 }
196
197 private static final String _CLASS_NAME =
198 "com.liferay.portal.util.PrefsPropsUtil";
199
200 private static MethodKey _getIntegerMethodKey1 = new MethodKey(
201 _CLASS_NAME, "getInteger", long.class, String.class);
202 private static MethodKey _getIntegerMethodKey2 = new MethodKey(
203 _CLASS_NAME, "getInteger", String.class);
204 private static MethodKey _getLongMethodKey1 = new MethodKey(
205 _CLASS_NAME, "getLong", long.class, String.class);
206 private static MethodKey _getLongMethodKey2 = new MethodKey(
207 _CLASS_NAME, "getLong", String.class);
208 private static MethodKey _getStringArrayMethodKey1 = new MethodKey(
209 _CLASS_NAME, "getStringArray", long.class, String.class, String.class);
210 private static MethodKey _getStringArrayMethodKey2 = new MethodKey(
211 _CLASS_NAME, "getStringArray", long.class, String.class, String.class,
212 String[].class);
213 private static MethodKey _getStringArrayMethodKey3 = new MethodKey(
214 _CLASS_NAME, "getStringArray", PortletPreferences.class, long.class,
215 String.class, String.class);
216 private static MethodKey _getStringArrayMethodKey4 = new MethodKey(
217 _CLASS_NAME, "getStringArray", PortletPreferences.class, long.class,
218 String.class, String.class, String[].class);
219 private static MethodKey _getStringArrayMethodKey5 = new MethodKey(
220 _CLASS_NAME, "getStringArray", String.class, String.class);
221 private static MethodKey _getStringArrayMethodKey6 = new MethodKey(
222 _CLASS_NAME, "getStringArray", String.class, String.class,
223 String[].class);
224 private static MethodKey _getStringMethodKey1 = new MethodKey(
225 _CLASS_NAME, "getString", long.class, String.class);
226 private static MethodKey _getStringMethodKey2 = new MethodKey(
227 _CLASS_NAME, "getString", String.class);
228
229 }