1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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.portal.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.BooleanWrapper;
28  import com.liferay.portal.kernel.util.IntegerWrapper;
29  import com.liferay.portal.kernel.util.LongWrapper;
30  import com.liferay.portal.kernel.util.MethodWrapper;
31  import com.liferay.portal.kernel.util.NullWrapper;
32  import com.liferay.portal.security.auth.HttpPrincipal;
33  import com.liferay.portal.service.PasswordPolicyServiceUtil;
34  
35  /**
36   * <a href="PasswordPolicyServiceHttp.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.portal.service.PasswordPolicyServiceUtil} 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       PasswordPolicyServiceSoap
68   * @see       com.liferay.portal.security.auth.HttpPrincipal
69   * @see       com.liferay.portal.service.PasswordPolicyServiceUtil
70   * @generated
71   */
72  public class PasswordPolicyServiceHttp {
73      public static com.liferay.portal.model.PasswordPolicy addPasswordPolicy(
74          HttpPrincipal httpPrincipal, java.lang.String name,
75          java.lang.String description, boolean changeable,
76          boolean changeRequired, long minAge, boolean checkSyntax,
77          boolean allowDictionaryWords, int minLength, boolean history,
78          int historyCount, boolean expireable, long maxAge, long warningTime,
79          int graceLimit, boolean lockout, int maxFailure, long lockoutDuration,
80          long resetFailureCount)
81          throws com.liferay.portal.PortalException,
82              com.liferay.portal.SystemException {
83          try {
84              Object paramObj0 = name;
85  
86              if (name == null) {
87                  paramObj0 = new NullWrapper("java.lang.String");
88              }
89  
90              Object paramObj1 = description;
91  
92              if (description == null) {
93                  paramObj1 = new NullWrapper("java.lang.String");
94              }
95  
96              Object paramObj2 = new BooleanWrapper(changeable);
97  
98              Object paramObj3 = new BooleanWrapper(changeRequired);
99  
100             Object paramObj4 = new LongWrapper(minAge);
101 
102             Object paramObj5 = new BooleanWrapper(checkSyntax);
103 
104             Object paramObj6 = new BooleanWrapper(allowDictionaryWords);
105 
106             Object paramObj7 = new IntegerWrapper(minLength);
107 
108             Object paramObj8 = new BooleanWrapper(history);
109 
110             Object paramObj9 = new IntegerWrapper(historyCount);
111 
112             Object paramObj10 = new BooleanWrapper(expireable);
113 
114             Object paramObj11 = new LongWrapper(maxAge);
115 
116             Object paramObj12 = new LongWrapper(warningTime);
117 
118             Object paramObj13 = new IntegerWrapper(graceLimit);
119 
120             Object paramObj14 = new BooleanWrapper(lockout);
121 
122             Object paramObj15 = new IntegerWrapper(maxFailure);
123 
124             Object paramObj16 = new LongWrapper(lockoutDuration);
125 
126             Object paramObj17 = new LongWrapper(resetFailureCount);
127 
128             MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
129                     "addPasswordPolicy",
130                     new Object[] {
131                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
132                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
133                         paramObj10, paramObj11, paramObj12, paramObj13,
134                         paramObj14, paramObj15, paramObj16, paramObj17
135                     });
136 
137             Object returnObj = null;
138 
139             try {
140                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
141             }
142             catch (Exception e) {
143                 if (e instanceof com.liferay.portal.PortalException) {
144                     throw (com.liferay.portal.PortalException)e;
145                 }
146 
147                 if (e instanceof com.liferay.portal.SystemException) {
148                     throw (com.liferay.portal.SystemException)e;
149                 }
150 
151                 throw new com.liferay.portal.SystemException(e);
152             }
153 
154             return (com.liferay.portal.model.PasswordPolicy)returnObj;
155         }
156         catch (com.liferay.portal.SystemException se) {
157             _log.error(se, se);
158 
159             throw se;
160         }
161     }
162 
163     public static void deletePasswordPolicy(HttpPrincipal httpPrincipal,
164         long passwordPolicyId)
165         throws com.liferay.portal.PortalException,
166             com.liferay.portal.SystemException {
167         try {
168             Object paramObj0 = new LongWrapper(passwordPolicyId);
169 
170             MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
171                     "deletePasswordPolicy", new Object[] { paramObj0 });
172 
173             try {
174                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
175             }
176             catch (Exception e) {
177                 if (e instanceof com.liferay.portal.PortalException) {
178                     throw (com.liferay.portal.PortalException)e;
179                 }
180 
181                 if (e instanceof com.liferay.portal.SystemException) {
182                     throw (com.liferay.portal.SystemException)e;
183                 }
184 
185                 throw new com.liferay.portal.SystemException(e);
186             }
187         }
188         catch (com.liferay.portal.SystemException se) {
189             _log.error(se, se);
190 
191             throw se;
192         }
193     }
194 
195     public static com.liferay.portal.model.PasswordPolicy updatePasswordPolicy(
196         HttpPrincipal httpPrincipal, long passwordPolicyId,
197         java.lang.String name, java.lang.String description,
198         boolean changeable, boolean changeRequired, long minAge,
199         boolean checkSyntax, boolean allowDictionaryWords, int minLength,
200         boolean history, int historyCount, boolean expireable, long maxAge,
201         long warningTime, int graceLimit, boolean lockout, int maxFailure,
202         long lockoutDuration, long resetFailureCount)
203         throws com.liferay.portal.PortalException,
204             com.liferay.portal.SystemException {
205         try {
206             Object paramObj0 = new LongWrapper(passwordPolicyId);
207 
208             Object paramObj1 = name;
209 
210             if (name == null) {
211                 paramObj1 = new NullWrapper("java.lang.String");
212             }
213 
214             Object paramObj2 = description;
215 
216             if (description == null) {
217                 paramObj2 = new NullWrapper("java.lang.String");
218             }
219 
220             Object paramObj3 = new BooleanWrapper(changeable);
221 
222             Object paramObj4 = new BooleanWrapper(changeRequired);
223 
224             Object paramObj5 = new LongWrapper(minAge);
225 
226             Object paramObj6 = new BooleanWrapper(checkSyntax);
227 
228             Object paramObj7 = new BooleanWrapper(allowDictionaryWords);
229 
230             Object paramObj8 = new IntegerWrapper(minLength);
231 
232             Object paramObj9 = new BooleanWrapper(history);
233 
234             Object paramObj10 = new IntegerWrapper(historyCount);
235 
236             Object paramObj11 = new BooleanWrapper(expireable);
237 
238             Object paramObj12 = new LongWrapper(maxAge);
239 
240             Object paramObj13 = new LongWrapper(warningTime);
241 
242             Object paramObj14 = new IntegerWrapper(graceLimit);
243 
244             Object paramObj15 = new BooleanWrapper(lockout);
245 
246             Object paramObj16 = new IntegerWrapper(maxFailure);
247 
248             Object paramObj17 = new LongWrapper(lockoutDuration);
249 
250             Object paramObj18 = new LongWrapper(resetFailureCount);
251 
252             MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
253                     "updatePasswordPolicy",
254                     new Object[] {
255                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
256                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
257                         paramObj10, paramObj11, paramObj12, paramObj13,
258                         paramObj14, paramObj15, paramObj16, paramObj17,
259                         paramObj18
260                     });
261 
262             Object returnObj = null;
263 
264             try {
265                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
266             }
267             catch (Exception e) {
268                 if (e instanceof com.liferay.portal.PortalException) {
269                     throw (com.liferay.portal.PortalException)e;
270                 }
271 
272                 if (e instanceof com.liferay.portal.SystemException) {
273                     throw (com.liferay.portal.SystemException)e;
274                 }
275 
276                 throw new com.liferay.portal.SystemException(e);
277             }
278 
279             return (com.liferay.portal.model.PasswordPolicy)returnObj;
280         }
281         catch (com.liferay.portal.SystemException se) {
282             _log.error(se, se);
283 
284             throw se;
285         }
286     }
287 
288     private static Log _log = LogFactoryUtil.getLog(PasswordPolicyServiceHttp.class);
289 }