| PortletServiceHttp.java |
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.service.http;
16
17 import com.liferay.portal.kernel.log.Log;
18 import com.liferay.portal.kernel.log.LogFactoryUtil;
19 import com.liferay.portal.kernel.util.BooleanWrapper;
20 import com.liferay.portal.kernel.util.LongWrapper;
21 import com.liferay.portal.kernel.util.MethodWrapper;
22 import com.liferay.portal.kernel.util.NullWrapper;
23 import com.liferay.portal.security.auth.HttpPrincipal;
24 import com.liferay.portal.service.PortletServiceUtil;
25
26 /**
27 * <a href="PortletServiceHttp.java.html"><b><i>View Source</i></b></a>
28 *
29 * <p>
30 * ServiceBuilder generated this class. Modifications in this class will be
31 * overwritten the next time is generated.
32 * </p>
33 *
34 * <p>
35 * This class provides a HTTP utility for the
36 * {@link com.liferay.portal.service.PortletServiceUtil} service utility. The
37 * static methods of this class calls the same methods of the service utility.
38 * However, the signatures are different because it requires an additional
39 * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40 * </p>
41 *
42 * <p>
43 * The benefits of using the HTTP utility is that it is fast and allows for
44 * tunneling without the cost of serializing to text. The drawback is that it
45 * only works with Java.
46 * </p>
47 *
48 * <p>
49 * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50 * configure security.
51 * </p>
52 *
53 * <p>
54 * The HTTP utility is only generated for remote services.
55 * </p>
56 *
57 * @author Brian Wing Shun Chan
58 * @see PortletServiceSoap
59 * @see com.liferay.portal.security.auth.HttpPrincipal
60 * @see com.liferay.portal.service.PortletServiceUtil
61 * @generated
62 */
63 public class PortletServiceHttp {
64 public static com.liferay.portal.kernel.json.JSONArray getWARPortlets(
65 HttpPrincipal httpPrincipal) throws com.liferay.portal.SystemException {
66 try {
67 MethodWrapper methodWrapper = new MethodWrapper(PortletServiceUtil.class.getName(),
68 "getWARPortlets", new Object[0]);
69
70 Object returnObj = null;
71
72 try {
73 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
74 }
75 catch (Exception e) {
76 throw new com.liferay.portal.SystemException(e);
77 }
78
79 return (com.liferay.portal.kernel.json.JSONArray)returnObj;
80 }
81 catch (com.liferay.portal.SystemException se) {
82 _log.error(se, se);
83
84 throw se;
85 }
86 }
87
88 public static com.liferay.portal.model.Portlet updatePortlet(
89 HttpPrincipal httpPrincipal, long companyId,
90 java.lang.String portletId, java.lang.String roles, boolean active)
91 throws com.liferay.portal.PortalException,
92 com.liferay.portal.SystemException {
93 try {
94 Object paramObj0 = new LongWrapper(companyId);
95
96 Object paramObj1 = portletId;
97
98 if (portletId == null) {
99 paramObj1 = new NullWrapper("java.lang.String");
100 }
101
102 Object paramObj2 = roles;
103
104 if (roles == null) {
105 paramObj2 = new NullWrapper("java.lang.String");
106 }
107
108 Object paramObj3 = new BooleanWrapper(active);
109
110 MethodWrapper methodWrapper = new MethodWrapper(PortletServiceUtil.class.getName(),
111 "updatePortlet",
112 new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
113
114 Object returnObj = null;
115
116 try {
117 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
118 }
119 catch (Exception e) {
120 if (e instanceof com.liferay.portal.PortalException) {
121 throw (com.liferay.portal.PortalException)e;
122 }
123
124 if (e instanceof com.liferay.portal.SystemException) {
125 throw (com.liferay.portal.SystemException)e;
126 }
127
128 throw new com.liferay.portal.SystemException(e);
129 }
130
131 return (com.liferay.portal.model.Portlet)returnObj;
132 }
133 catch (com.liferay.portal.SystemException se) {
134 _log.error(se, se);
135
136 throw se;
137 }
138 }
139
140 private static Log _log = LogFactoryUtil.getLog(PortletServiceHttp.class);
141 }