1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.expando.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.LongWrapper;
28  import com.liferay.portal.kernel.util.MethodWrapper;
29  import com.liferay.portal.kernel.util.NullWrapper;
30  import com.liferay.portal.security.auth.HttpPrincipal;
31  import com.liferay.portal.service.http.TunnelUtil;
32  
33  import com.liferay.portlet.expando.service.ExpandoValueServiceUtil;
34  
35  /**
36   * <a href="ExpandoValueServiceHttp.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be
40   * overwritten the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class provides a HTTP utility for the
45   * {@link com.liferay.portlet.expando.service.ExpandoValueServiceUtil} service utility. The
46   * static methods of this class calls the same methods of the service utility.
47   * However, the signatures are different because it requires an additional
48   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
49   * </p>
50   *
51   * <p>
52   * The benefits of using the HTTP utility is that it is fast and allows for
53   * tunneling without the cost of serializing to text. The drawback is that it
54   * only works with Java.
55   * </p>
56   *
57   * <p>
58   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
59   * configure security.
60   * </p>
61   *
62   * <p>
63   * The HTTP utility is only generated for remote services.
64   * </p>
65   *
66   * @author    Brian Wing Shun Chan
67   * @see       ExpandoValueServiceSoap
68   * @see       com.liferay.portal.security.auth.HttpPrincipal
69   * @see       com.liferay.portlet.expando.service.ExpandoValueServiceUtil
70   * @generated
71   */
72  public class ExpandoValueServiceHttp {
73      public static com.liferay.portlet.expando.model.ExpandoValue addValue(
74          HttpPrincipal httpPrincipal, java.lang.String className,
75          java.lang.String tableName, java.lang.String columnName, long classPK,
76          java.lang.Object data)
77          throws com.liferay.portal.PortalException,
78              com.liferay.portal.SystemException {
79          try {
80              Object paramObj0 = className;
81  
82              if (className == null) {
83                  paramObj0 = new NullWrapper("java.lang.String");
84              }
85  
86              Object paramObj1 = tableName;
87  
88              if (tableName == null) {
89                  paramObj1 = new NullWrapper("java.lang.String");
90              }
91  
92              Object paramObj2 = columnName;
93  
94              if (columnName == null) {
95                  paramObj2 = new NullWrapper("java.lang.String");
96              }
97  
98              Object paramObj3 = new LongWrapper(classPK);
99  
100             Object paramObj4 = data;
101 
102             if (data == null) {
103                 paramObj4 = new NullWrapper("java.lang.Object");
104             }
105 
106             MethodWrapper methodWrapper = new MethodWrapper(ExpandoValueServiceUtil.class.getName(),
107                     "addValue",
108                     new Object[] {
109                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
110                     });
111 
112             Object returnObj = null;
113 
114             try {
115                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
116             }
117             catch (Exception e) {
118                 if (e instanceof com.liferay.portal.PortalException) {
119                     throw (com.liferay.portal.PortalException)e;
120                 }
121 
122                 if (e instanceof com.liferay.portal.SystemException) {
123                     throw (com.liferay.portal.SystemException)e;
124                 }
125 
126                 throw new com.liferay.portal.SystemException(e);
127             }
128 
129             return (com.liferay.portlet.expando.model.ExpandoValue)returnObj;
130         }
131         catch (com.liferay.portal.SystemException se) {
132             _log.error(se, se);
133 
134             throw se;
135         }
136     }
137 
138     public static java.io.Serializable getData(HttpPrincipal httpPrincipal,
139         java.lang.String className, java.lang.String tableName,
140         java.lang.String columnName, long classPK)
141         throws com.liferay.portal.PortalException,
142             com.liferay.portal.SystemException {
143         try {
144             Object paramObj0 = className;
145 
146             if (className == null) {
147                 paramObj0 = new NullWrapper("java.lang.String");
148             }
149 
150             Object paramObj1 = tableName;
151 
152             if (tableName == null) {
153                 paramObj1 = new NullWrapper("java.lang.String");
154             }
155 
156             Object paramObj2 = columnName;
157 
158             if (columnName == null) {
159                 paramObj2 = new NullWrapper("java.lang.String");
160             }
161 
162             Object paramObj3 = new LongWrapper(classPK);
163 
164             MethodWrapper methodWrapper = new MethodWrapper(ExpandoValueServiceUtil.class.getName(),
165                     "getData",
166                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
167 
168             Object returnObj = null;
169 
170             try {
171                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
172             }
173             catch (Exception e) {
174                 if (e instanceof com.liferay.portal.PortalException) {
175                     throw (com.liferay.portal.PortalException)e;
176                 }
177 
178                 if (e instanceof com.liferay.portal.SystemException) {
179                     throw (com.liferay.portal.SystemException)e;
180                 }
181 
182                 throw new com.liferay.portal.SystemException(e);
183             }
184 
185             return (java.io.Serializable)returnObj;
186         }
187         catch (com.liferay.portal.SystemException se) {
188             _log.error(se, se);
189 
190             throw se;
191         }
192     }
193 
194     private static Log _log = LogFactoryUtil.getLog(ExpandoValueServiceHttp.class);
195 }