001    /**
002     * Copyright (c) 2000-2013 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.util;
016    
017    import com.liferay.portal.kernel.exception.SystemException;
018    import com.liferay.portal.kernel.security.pacl.DoPrivileged;
019    import com.liferay.portal.kernel.util.PrefsProps;
020    
021    import java.util.Properties;
022    
023    import javax.portlet.PortletPreferences;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    @DoPrivileged
029    public class PrefsPropsImpl implements PrefsProps {
030    
031            public boolean getBoolean(long companyId, String name)
032                    throws SystemException {
033    
034                    return PrefsPropsUtil.getBoolean(companyId, name);
035            }
036    
037            public boolean getBoolean(long companyId, String name, boolean defaultValue)
038                    throws SystemException {
039    
040                    return PrefsPropsUtil.getBoolean(companyId, name, defaultValue);
041            }
042    
043            public boolean getBoolean(
044                    PortletPreferences preferences, long companyId, String name) {
045    
046                    return PrefsPropsUtil.getBoolean(preferences, companyId, name);
047            }
048    
049            public boolean getBoolean(
050                    PortletPreferences preferences, long companyId, String name,
051                    boolean defaultValue) {
052    
053                    return PrefsPropsUtil.getBoolean(
054                            preferences, companyId, name, defaultValue);
055            }
056    
057            public boolean getBoolean(String name) throws SystemException {
058                    return PrefsPropsUtil.getBoolean(name);
059            }
060    
061            public boolean getBoolean(String name, boolean defaultValue)
062                    throws SystemException {
063    
064                    return PrefsPropsUtil.getBoolean(name, defaultValue);
065            }
066    
067            public String getContent(long companyId, String name)
068                    throws SystemException {
069    
070                    return PrefsPropsUtil.getContent(companyId, name);
071            }
072    
073            public String getContent(
074                    PortletPreferences preferences, long companyId, String name) {
075    
076                    return PrefsPropsUtil.getContent(preferences, companyId, name);
077            }
078    
079            public String getContent(String name) throws SystemException {
080                    return PrefsPropsUtil.getContent(name);
081            }
082    
083            public double getDouble(long companyId, String name)
084                    throws SystemException {
085    
086                    return PrefsPropsUtil.getDouble(companyId, name);
087            }
088    
089            public double getDouble(long companyId, String name, double defaultValue)
090                    throws SystemException {
091    
092                    return PrefsPropsUtil.getDouble(companyId, name, defaultValue);
093            }
094    
095            public double getDouble(
096                    PortletPreferences preferences, long companyId, String name) {
097    
098                    return PrefsPropsUtil.getDouble(preferences, companyId, name);
099            }
100    
101            public double getDouble(
102                    PortletPreferences preferences, long companyId, String name,
103                    double defaultValue) {
104    
105                    return PrefsPropsUtil.getDouble(
106                            preferences, companyId, name, defaultValue);
107            }
108    
109            public double getDouble(String name) throws SystemException {
110                    return PrefsPropsUtil.getDouble(name);
111            }
112    
113            public double getDouble(String name, double defaultValue)
114                    throws SystemException {
115    
116                    return PrefsPropsUtil.getDouble(name, defaultValue);
117            }
118    
119            public int getInteger(long companyId, String name) throws SystemException {
120                    return PrefsPropsUtil.getInteger(companyId, name);
121            }
122    
123            public int getInteger(long companyId, String name, int defaultValue)
124                    throws SystemException {
125    
126                    return PrefsPropsUtil.getInteger(companyId, name, defaultValue);
127            }
128    
129            public int getInteger(
130                    PortletPreferences preferences, long companyId, String name) {
131    
132                    return PrefsPropsUtil.getInteger(preferences, companyId, name);
133            }
134    
135            public int getInteger(
136                    PortletPreferences preferences, long companyId, String name,
137                    int defaultValue) {
138    
139                    return PrefsPropsUtil.getInteger(
140                            preferences, companyId, name, defaultValue);
141            }
142    
143            public int getInteger(String name) throws SystemException {
144                    return PrefsPropsUtil.getInteger(name);
145            }
146    
147            public int getInteger(String name, int defaultValue)
148                    throws SystemException {
149    
150                    return PrefsPropsUtil.getInteger(name, defaultValue);
151            }
152    
153            public long getLong(long companyId, String name) throws SystemException {
154                    return PrefsPropsUtil.getLong(companyId, name);
155            }
156    
157            public long getLong(long companyId, String name, long defaultValue)
158                    throws SystemException {
159    
160                    return PrefsPropsUtil.getLong(companyId, name, defaultValue);
161            }
162    
163            public long getLong(
164                    PortletPreferences preferences, long companyId, String name) {
165    
166                    return PrefsPropsUtil.getLong(preferences, companyId, name);
167            }
168    
169            public long getLong(
170                    PortletPreferences preferences, long companyId, String name,
171                    long defaultValue) {
172    
173                    return PrefsPropsUtil.getLong(
174                            preferences, companyId, name, defaultValue);
175            }
176    
177            public long getLong(String name) throws SystemException {
178                    return PrefsPropsUtil.getLong(name);
179            }
180    
181            public long getLong(String name, long defaultValue) throws SystemException {
182                    return PrefsPropsUtil.getLong(name, defaultValue);
183            }
184    
185            public PortletPreferences getPreferences() throws SystemException {
186                    return PrefsPropsUtil.getPreferences();
187            }
188    
189            public PortletPreferences getPreferences(long companyId)
190                    throws SystemException {
191    
192                    return PrefsPropsUtil.getPreferences(companyId);
193            }
194    
195            public Properties getProperties(
196                    PortletPreferences preferences, long companyId, String prefix,
197                    boolean removePrefix) {
198    
199                    return PrefsPropsUtil.getProperties(
200                            preferences, companyId, prefix, removePrefix);
201            }
202    
203            public Properties getProperties(String prefix, boolean removePrefix)
204                    throws SystemException {
205    
206                    return PrefsPropsUtil.getProperties(prefix, removePrefix);
207            }
208    
209            public short getShort(long companyId, String name) throws SystemException {
210                    return PrefsPropsUtil.getShort(companyId, name);
211            }
212    
213            public short getShort(long companyId, String name, short defaultValue)
214                    throws SystemException {
215    
216                    return PrefsPropsUtil.getShort(companyId, name, defaultValue);
217            }
218    
219            public short getShort(
220                    PortletPreferences preferences, long companyId, String name) {
221    
222                    return PrefsPropsUtil.getShort(preferences, companyId, name);
223            }
224    
225            public short getShort(
226                    PortletPreferences preferences, long companyId, String name,
227                    short defaultValue) {
228    
229                    return PrefsPropsUtil.getShort(
230                            preferences, companyId, name, defaultValue);
231            }
232    
233            public short getShort(String name) throws SystemException {
234                    return PrefsPropsUtil.getShort(name);
235            }
236    
237            public short getShort(String name, short defaultValue)
238                    throws SystemException {
239    
240                    return PrefsPropsUtil.getShort(name, defaultValue);
241            }
242    
243            public String getString(long companyId, String name)
244                    throws SystemException {
245    
246                    return PrefsPropsUtil.getString(companyId, name);
247            }
248    
249            public String getString(long companyId, String name, String defaultValue)
250                    throws SystemException {
251    
252                    return PrefsPropsUtil.getString(companyId, name, defaultValue);
253            }
254    
255            public String getString(
256                    PortletPreferences preferences, long companyId, String name) {
257    
258                    return PrefsPropsUtil.getString(preferences, companyId, name);
259            }
260    
261            public String getString(
262                    PortletPreferences preferences, long companyId, String name,
263                    boolean defaultValue) {
264    
265                    return PrefsPropsUtil.getString(
266                            preferences, companyId, name, defaultValue);
267            }
268    
269            public String getString(
270                    PortletPreferences preferences, long companyId, String name,
271                    double defaultValue) {
272    
273                    return PrefsPropsUtil.getString(
274                            preferences, companyId, name, defaultValue);
275            }
276    
277            public String getString(
278                    PortletPreferences preferences, long companyId, String name,
279                    int defaultValue) {
280    
281                    return PrefsPropsUtil.getString(
282                            preferences, companyId, name, defaultValue);
283            }
284    
285            public String getString(
286                    PortletPreferences preferences, long companyId, String name,
287                    long defaultValue) {
288    
289                    return PrefsPropsUtil.getString(
290                            preferences, companyId, name, defaultValue);
291            }
292    
293            public String getString(
294                    PortletPreferences preferences, long companyId, String name,
295                    short defaultValue) {
296    
297                    return PrefsPropsUtil.getString(
298                            preferences, companyId, name, defaultValue);
299            }
300    
301            public String getString(
302                    PortletPreferences preferences, long companyId, String name,
303                    String defaultValue) {
304    
305                    return PrefsPropsUtil.getString(
306                            preferences, companyId, name, defaultValue);
307            }
308    
309            public String getString(String name) throws SystemException {
310                    return PrefsPropsUtil.getString(name);
311            }
312    
313            public String getString(String name, String defaultValue)
314                    throws SystemException {
315    
316                    return PrefsPropsUtil.getString(name, defaultValue);
317            }
318    
319            public String[] getStringArray(
320                            long companyId, String name, String delimiter)
321                    throws SystemException {
322    
323                    return PrefsPropsUtil.getStringArray(companyId, name, delimiter);
324            }
325    
326            public String[] getStringArray(
327                            long companyId, String name, String delimiter,
328                            String[] defaultValue)
329                    throws SystemException {
330    
331                    return PrefsPropsUtil.getStringArray(
332                            companyId, name, delimiter, defaultValue);
333            }
334    
335            public String[] getStringArray(
336                    PortletPreferences preferences, long companyId, String name,
337                    String delimiter) {
338    
339                    return PrefsPropsUtil.getStringArray(
340                            preferences, companyId, name, delimiter);
341            }
342    
343            public String[] getStringArray(
344                    PortletPreferences preferences, long companyId, String name,
345                    String delimiter, String[] defaultValue) {
346    
347                    return PrefsPropsUtil.getStringArray(
348                            preferences, companyId, name, delimiter, defaultValue);
349            }
350    
351            public String[] getStringArray(String name, String delimiter)
352                    throws SystemException {
353    
354                    return PrefsPropsUtil.getStringArray(name, delimiter);
355            }
356    
357            public String[] getStringArray(
358                            String name, String delimiter, String[] defaultValue)
359                    throws SystemException {
360    
361                    return PrefsPropsUtil.getStringArray(name, delimiter, defaultValue);
362            }
363    
364            public String getStringFromNames(long companyId, String... names)
365                    throws SystemException {
366    
367                    return PrefsPropsUtil.getStringFromNames(companyId, names);
368            }
369    
370    }