1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.util;
16  
17  import javax.portlet.PortletPreferences;
18  
19  /**
20   * <a href="PrefsPropsUtil.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Brian Wing Shun Chan
23   */
24  public class PrefsPropsUtil {
25  
26      public static String getString(long companyId, String key)
27          throws Exception {
28  
29          Object returnObj = PortalClassInvoker.invoke(
30              false, _getStringArrayMethodKey1, companyId, key);
31  
32          if (returnObj != null) {
33              return (String)returnObj;
34          }
35          else {
36              return null;
37          }
38      }
39  
40      public static String getString(String key)
41          throws Exception {
42  
43          Object returnObj = PortalClassInvoker.invoke(
44              false, _getStringArrayMethodKey2, key);
45  
46          if (returnObj != null) {
47              return (String)returnObj;
48          }
49          else {
50              return null;
51          }
52      }
53  
54      public static String[] getStringArray(
55              long companyId, String name, String delimiter)
56          throws Exception {
57  
58          Object returnObj = PortalClassInvoker.invoke(
59              false, _getStringArray1, companyId, name, delimiter);
60  
61          if (returnObj != null) {
62              return (String[])returnObj;
63          }
64          else {
65              return null;
66          }
67      }
68  
69      public static String[] getStringArray(
70              long companyId, String name, String delimiter,
71              String[] defaultValue)
72          throws Exception {
73  
74          Object returnObj = PortalClassInvoker.invoke(
75              false, _getStringArray2, companyId, name, delimiter, defaultValue);
76  
77          if (returnObj != null) {
78              return (String[])returnObj;
79          }
80          else {
81              return null;
82          }
83      }
84  
85      public static String[] getStringArray(
86              PortletPreferences preferences, long companyId, String name,
87              String delimiter)
88          throws Exception {
89  
90          Object returnObj = PortalClassInvoker.invoke(
91              false, _getStringArray3, preferences, companyId, name, delimiter);
92  
93          if (returnObj != null) {
94              return (String[])returnObj;
95          }
96          else {
97              return null;
98          }
99      }
100 
101     public static String[] getStringArray(
102             PortletPreferences preferences, long companyId, String name,
103             String delimiter, String[] defaultValue)
104         throws Exception {
105 
106         Object returnObj = PortalClassInvoker.invoke(
107             false, _getStringArray4, preferences, companyId, name, delimiter,
108             defaultValue);
109 
110         if (returnObj != null) {
111             return (String[])returnObj;
112         }
113         else {
114             return null;
115         }
116     }
117 
118     public static String[] getStringArray(String name, String delimiter)
119         throws Exception {
120 
121         Object returnObj = PortalClassInvoker.invoke(
122             false, _getStringArray5, name, delimiter);
123 
124         if (returnObj != null) {
125             return (String[])returnObj;
126         }
127         else {
128             return null;
129         }
130     }
131 
132     public static String[] getStringArray(
133             String name, String delimiter, String[] defaultValue)
134         throws Exception {
135 
136         Object returnObj = PortalClassInvoker.invoke(
137             false, _getStringArray6, name, delimiter, defaultValue);
138 
139         if (returnObj != null) {
140             return (String[])returnObj;
141         }
142         else {
143             return null;
144         }
145     }
146 
147     private static final String _CLASS_NAME =
148         "com.liferay.portal.util.PrefsPropsUtil";
149 
150     private static MethodKey _getStringArray1 = new MethodKey(
151         _CLASS_NAME, "getStringArray", long.class, String.class, String.class);
152     private static MethodKey _getStringArray2 = new MethodKey(
153         _CLASS_NAME, "getStringArray", long.class, String.class, String.class,
154         String[].class);
155     private static MethodKey _getStringArray3 = new MethodKey(
156         _CLASS_NAME, "getStringArray", PortletPreferences.class, long.class,
157         String.class, String.class);
158     private static MethodKey _getStringArray4 = new MethodKey(
159         _CLASS_NAME, "getStringArray", PortletPreferences.class, long.class,
160         String.class, String.class, String[].class);
161     private static MethodKey _getStringArray5 = new MethodKey(
162         _CLASS_NAME, "getStringArray", String.class, String.class);
163     private static MethodKey _getStringArray6 = new MethodKey(
164         _CLASS_NAME, "getStringArray", String.class, String.class,
165         String[].class);
166     private static MethodKey _getStringArrayMethodKey1 = new MethodKey(
167         _CLASS_NAME, "getString", long.class, String.class);
168     private static MethodKey _getStringArrayMethodKey2 = new MethodKey(
169         _CLASS_NAME, "getString", String.class);
170 
171 }