1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.service.http;
21  
22  import com.liferay.portal.kernel.json.JSONObject;
23  import com.liferay.portal.service.LayoutServiceUtil;
24  
25  /**
26   * <a href="LayoutServiceJSON.java.html"><b><i>View Source</i></b></a>
27   *
28   * <p>
29   * ServiceBuilder generated this class. Modifications in this class will be
30   * overwritten the next time is generated.
31   * </p>
32   *
33   * <p>
34   * This class provides a JSON utility for the
35   * <code>com.liferay.portal.service.LayoutServiceUtil</code>
36   * service utility. The static methods of this class calls the same methods of
37   * the service utility. However, the signatures are different because it is
38   * difficult for JSON to support certain types.
39   * </p>
40   *
41   * <p>
42   * ServiceBuilder follows certain rules in translating the methods. For example,
43   * if the method in the service utility returns a <code>java.util.List</code>,
44   * that is translated to a
45   * <code>com.liferay.portal.kernel.json.JSONArray</code>. If the method in the
46   * service utility returns a <code>com.liferay.portal.model.Layout</code>,
47   * that is translated to a
48   * <code>com.liferay.portal.kernel.json.JSONObject</code>. Methods that JSON
49   * cannot safely use are skipped. The logic for the translation is encapsulated
50   * in <code>com.liferay.portal.service.http.LayoutJSONSerializer</code>.
51   * </p>
52   *
53   * <p>
54   * This allows you to call the the backend services directly from JavaScript.
55   * See <code>portal-web/docroot/html/portlet/tags_admin/unpacked.js</code> for a
56   * reference of how that portlet uses the generated JavaScript in
57   * <code>portal-web/docroot/html/js/service.js</code> to call the backend
58   * services directly from JavaScript.
59   * </p>
60   *
61   * <p>
62   * The JSON utility is only generated for remote services.
63   * </p>
64   *
65   * @author Brian Wing Shun Chan
66   *
67   * @see com.liferay.portal.service.LayoutServiceUtil
68   * @see com.liferay.portal.service.http.LayoutJSONSerializer
69   *
70   */
71  public class LayoutServiceJSON {
72      public static JSONObject addLayout(long groupId, boolean privateLayout,
73          long parentLayoutId, java.lang.String name, java.lang.String title,
74          java.lang.String description, java.lang.String type, boolean hidden,
75          java.lang.String friendlyURL)
76          throws java.rmi.RemoteException, com.liferay.portal.PortalException,
77              com.liferay.portal.SystemException {
78          com.liferay.portal.model.Layout returnValue = LayoutServiceUtil.addLayout(groupId,
79                  privateLayout, parentLayoutId, name, title, description, type,
80                  hidden, friendlyURL);
81  
82          return LayoutJSONSerializer.toJSONObject(returnValue);
83      }
84  
85      public static void deleteLayout(long plid)
86          throws java.rmi.RemoteException, com.liferay.portal.PortalException,
87              com.liferay.portal.SystemException {
88          LayoutServiceUtil.deleteLayout(plid);
89      }
90  
91      public static void deleteLayout(long groupId, boolean privateLayout,
92          long layoutId)
93          throws java.rmi.RemoteException, com.liferay.portal.PortalException,
94              com.liferay.portal.SystemException {
95          LayoutServiceUtil.deleteLayout(groupId, privateLayout, layoutId);
96      }
97  
98      public static java.lang.String getLayoutName(long groupId,
99          boolean privateLayout, long layoutId, java.lang.String languageId)
100         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
101             com.liferay.portal.SystemException {
102         java.lang.String returnValue = LayoutServiceUtil.getLayoutName(groupId,
103                 privateLayout, layoutId, languageId);
104 
105         return returnValue;
106     }
107 
108     public static com.liferay.portal.model.LayoutReference[] getLayoutReferences(
109         long companyId, java.lang.String portletId, java.lang.String prefsKey,
110         java.lang.String prefsValue)
111         throws java.rmi.RemoteException, com.liferay.portal.SystemException {
112         com.liferay.portal.model.LayoutReference[] returnValue = LayoutServiceUtil.getLayoutReferences(companyId,
113                 portletId, prefsKey, prefsValue);
114 
115         return returnValue;
116     }
117 
118     public static void setLayouts(long groupId, boolean privateLayout,
119         long parentLayoutId, long[] layoutIds)
120         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
121             com.liferay.portal.SystemException {
122         LayoutServiceUtil.setLayouts(groupId, privateLayout, parentLayoutId,
123             layoutIds);
124     }
125 
126     public static void unschedulePublishToLive(long groupId,
127         java.lang.String jobName, java.lang.String groupName)
128         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
129             com.liferay.portal.SystemException {
130         LayoutServiceUtil.unschedulePublishToLive(groupId, jobName, groupName);
131     }
132 
133     public static void unschedulePublishToRemote(long groupId,
134         java.lang.String jobName, java.lang.String groupName)
135         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
136             com.liferay.portal.SystemException {
137         LayoutServiceUtil.unschedulePublishToRemote(groupId, jobName, groupName);
138     }
139 
140     public static JSONObject updateLayout(long groupId, boolean privateLayout,
141         long layoutId, java.lang.String typeSettings)
142         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
143             com.liferay.portal.SystemException {
144         com.liferay.portal.model.Layout returnValue = LayoutServiceUtil.updateLayout(groupId,
145                 privateLayout, layoutId, typeSettings);
146 
147         return LayoutJSONSerializer.toJSONObject(returnValue);
148     }
149 
150     public static JSONObject updateLookAndFeel(long groupId,
151         boolean privateLayout, long layoutId, java.lang.String themeId,
152         java.lang.String colorSchemeId, java.lang.String css, boolean wapTheme)
153         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
154             com.liferay.portal.SystemException {
155         com.liferay.portal.model.Layout returnValue = LayoutServiceUtil.updateLookAndFeel(groupId,
156                 privateLayout, layoutId, themeId, colorSchemeId, css, wapTheme);
157 
158         return LayoutJSONSerializer.toJSONObject(returnValue);
159     }
160 
161     public static JSONObject updateName(long plid, java.lang.String name,
162         java.lang.String languageId)
163         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
164             com.liferay.portal.SystemException {
165         com.liferay.portal.model.Layout returnValue = LayoutServiceUtil.updateName(plid,
166                 name, languageId);
167 
168         return LayoutJSONSerializer.toJSONObject(returnValue);
169     }
170 
171     public static JSONObject updateName(long groupId, boolean privateLayout,
172         long layoutId, java.lang.String name, java.lang.String languageId)
173         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
174             com.liferay.portal.SystemException {
175         com.liferay.portal.model.Layout returnValue = LayoutServiceUtil.updateName(groupId,
176                 privateLayout, layoutId, name, languageId);
177 
178         return LayoutJSONSerializer.toJSONObject(returnValue);
179     }
180 
181     public static JSONObject updateParentLayoutId(long plid, long parentPlid)
182         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
183             com.liferay.portal.SystemException {
184         com.liferay.portal.model.Layout returnValue = LayoutServiceUtil.updateParentLayoutId(plid,
185                 parentPlid);
186 
187         return LayoutJSONSerializer.toJSONObject(returnValue);
188     }
189 
190     public static JSONObject updateParentLayoutId(long groupId,
191         boolean privateLayout, long layoutId, long parentLayoutId)
192         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
193             com.liferay.portal.SystemException {
194         com.liferay.portal.model.Layout returnValue = LayoutServiceUtil.updateParentLayoutId(groupId,
195                 privateLayout, layoutId, parentLayoutId);
196 
197         return LayoutJSONSerializer.toJSONObject(returnValue);
198     }
199 
200     public static JSONObject updatePriority(long plid, int priority)
201         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
202             com.liferay.portal.SystemException {
203         com.liferay.portal.model.Layout returnValue = LayoutServiceUtil.updatePriority(plid,
204                 priority);
205 
206         return LayoutJSONSerializer.toJSONObject(returnValue);
207     }
208 
209     public static JSONObject updatePriority(long groupId,
210         boolean privateLayout, long layoutId, int priority)
211         throws java.rmi.RemoteException, com.liferay.portal.PortalException,
212             com.liferay.portal.SystemException {
213         com.liferay.portal.model.Layout returnValue = LayoutServiceUtil.updatePriority(groupId,
214                 privateLayout, layoutId, priority);
215 
216         return LayoutJSONSerializer.toJSONObject(returnValue);
217     }
218 }