1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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.IntegerWrapper;
21  import com.liferay.portal.kernel.util.LongWrapper;
22  import com.liferay.portal.kernel.util.MethodWrapper;
23  import com.liferay.portal.kernel.util.NullWrapper;
24  import com.liferay.portal.security.auth.HttpPrincipal;
25  import com.liferay.portal.service.PasswordPolicyServiceUtil;
26  
27  /**
28   * <a href="PasswordPolicyServiceHttp.java.html"><b><i>View Source</i></b></a>
29   *
30   * <p>
31   * ServiceBuilder generated this class. Modifications in this class will be
32   * overwritten the next time is generated.
33   * </p>
34   *
35   * <p>
36   * This class provides a HTTP utility for the
37   * {@link com.liferay.portal.service.PasswordPolicyServiceUtil} service utility. The
38   * static methods of this class calls the same methods of the service utility.
39   * However, the signatures are different because it requires an additional
40   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
41   * </p>
42   *
43   * <p>
44   * The benefits of using the HTTP utility is that it is fast and allows for
45   * tunneling without the cost of serializing to text. The drawback is that it
46   * only works with Java.
47   * </p>
48   *
49   * <p>
50   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
51   * configure security.
52   * </p>
53   *
54   * <p>
55   * The HTTP utility is only generated for remote services.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       PasswordPolicyServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portal.service.PasswordPolicyServiceUtil
62   * @generated
63   */
64  public class PasswordPolicyServiceHttp {
65      public static com.liferay.portal.model.PasswordPolicy addPasswordPolicy(
66          HttpPrincipal httpPrincipal, java.lang.String name,
67          java.lang.String description, boolean changeable,
68          boolean changeRequired, long minAge, boolean checkSyntax,
69          boolean allowDictionaryWords, int minAlphanumeric, int minLength,
70          int minLowerCase, int minNumbers, int minSymbols, int minUpperCase,
71          boolean history, int historyCount, boolean expireable, long maxAge,
72          long warningTime, int graceLimit, boolean lockout, int maxFailure,
73          long lockoutDuration, long resetFailureCount, long resetTicketMaxAge)
74          throws com.liferay.portal.kernel.exception.PortalException,
75              com.liferay.portal.kernel.exception.SystemException {
76          try {
77              Object paramObj0 = name;
78  
79              if (name == null) {
80                  paramObj0 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj1 = description;
84  
85              if (description == null) {
86                  paramObj1 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj2 = new BooleanWrapper(changeable);
90  
91              Object paramObj3 = new BooleanWrapper(changeRequired);
92  
93              Object paramObj4 = new LongWrapper(minAge);
94  
95              Object paramObj5 = new BooleanWrapper(checkSyntax);
96  
97              Object paramObj6 = new BooleanWrapper(allowDictionaryWords);
98  
99              Object paramObj7 = new IntegerWrapper(minAlphanumeric);
100 
101             Object paramObj8 = new IntegerWrapper(minLength);
102 
103             Object paramObj9 = new IntegerWrapper(minLowerCase);
104 
105             Object paramObj10 = new IntegerWrapper(minNumbers);
106 
107             Object paramObj11 = new IntegerWrapper(minSymbols);
108 
109             Object paramObj12 = new IntegerWrapper(minUpperCase);
110 
111             Object paramObj13 = new BooleanWrapper(history);
112 
113             Object paramObj14 = new IntegerWrapper(historyCount);
114 
115             Object paramObj15 = new BooleanWrapper(expireable);
116 
117             Object paramObj16 = new LongWrapper(maxAge);
118 
119             Object paramObj17 = new LongWrapper(warningTime);
120 
121             Object paramObj18 = new IntegerWrapper(graceLimit);
122 
123             Object paramObj19 = new BooleanWrapper(lockout);
124 
125             Object paramObj20 = new IntegerWrapper(maxFailure);
126 
127             Object paramObj21 = new LongWrapper(lockoutDuration);
128 
129             Object paramObj22 = new LongWrapper(resetFailureCount);
130 
131             Object paramObj23 = new LongWrapper(resetTicketMaxAge);
132 
133             MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
134                     "addPasswordPolicy",
135                     new Object[] {
136                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
137                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
138                         paramObj10, paramObj11, paramObj12, paramObj13,
139                         paramObj14, paramObj15, paramObj16, paramObj17,
140                         paramObj18, paramObj19, paramObj20, paramObj21,
141                         paramObj22, paramObj23
142                     });
143 
144             Object returnObj = null;
145 
146             try {
147                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
148             }
149             catch (Exception e) {
150                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
151                     throw (com.liferay.portal.kernel.exception.PortalException)e;
152                 }
153 
154                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
155                     throw (com.liferay.portal.kernel.exception.SystemException)e;
156                 }
157 
158                 throw new com.liferay.portal.kernel.exception.SystemException(e);
159             }
160 
161             return (com.liferay.portal.model.PasswordPolicy)returnObj;
162         }
163         catch (com.liferay.portal.kernel.exception.SystemException se) {
164             _log.error(se, se);
165 
166             throw se;
167         }
168     }
169 
170     public static void deletePasswordPolicy(HttpPrincipal httpPrincipal,
171         long passwordPolicyId)
172         throws com.liferay.portal.kernel.exception.PortalException,
173             com.liferay.portal.kernel.exception.SystemException {
174         try {
175             Object paramObj0 = new LongWrapper(passwordPolicyId);
176 
177             MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
178                     "deletePasswordPolicy", new Object[] { paramObj0 });
179 
180             try {
181                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
182             }
183             catch (Exception e) {
184                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
185                     throw (com.liferay.portal.kernel.exception.PortalException)e;
186                 }
187 
188                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
189                     throw (com.liferay.portal.kernel.exception.SystemException)e;
190                 }
191 
192                 throw new com.liferay.portal.kernel.exception.SystemException(e);
193             }
194         }
195         catch (com.liferay.portal.kernel.exception.SystemException se) {
196             _log.error(se, se);
197 
198             throw se;
199         }
200     }
201 
202     public static com.liferay.portal.model.PasswordPolicy updatePasswordPolicy(
203         HttpPrincipal httpPrincipal, long passwordPolicyId,
204         java.lang.String name, java.lang.String description,
205         boolean changeable, boolean changeRequired, long minAge,
206         boolean checkSyntax, boolean allowDictionaryWords, int minAlphanumeric,
207         int minLength, int minLowerCase, int minNumbers, int minSymbols,
208         int minUpperCase, boolean history, int historyCount,
209         boolean expireable, long maxAge, long warningTime, int graceLimit,
210         boolean lockout, int maxFailure, long lockoutDuration,
211         long resetFailureCount, long resetTicketMaxAge)
212         throws com.liferay.portal.kernel.exception.PortalException,
213             com.liferay.portal.kernel.exception.SystemException {
214         try {
215             Object paramObj0 = new LongWrapper(passwordPolicyId);
216 
217             Object paramObj1 = name;
218 
219             if (name == null) {
220                 paramObj1 = new NullWrapper("java.lang.String");
221             }
222 
223             Object paramObj2 = description;
224 
225             if (description == null) {
226                 paramObj2 = new NullWrapper("java.lang.String");
227             }
228 
229             Object paramObj3 = new BooleanWrapper(changeable);
230 
231             Object paramObj4 = new BooleanWrapper(changeRequired);
232 
233             Object paramObj5 = new LongWrapper(minAge);
234 
235             Object paramObj6 = new BooleanWrapper(checkSyntax);
236 
237             Object paramObj7 = new BooleanWrapper(allowDictionaryWords);
238 
239             Object paramObj8 = new IntegerWrapper(minAlphanumeric);
240 
241             Object paramObj9 = new IntegerWrapper(minLength);
242 
243             Object paramObj10 = new IntegerWrapper(minLowerCase);
244 
245             Object paramObj11 = new IntegerWrapper(minNumbers);
246 
247             Object paramObj12 = new IntegerWrapper(minSymbols);
248 
249             Object paramObj13 = new IntegerWrapper(minUpperCase);
250 
251             Object paramObj14 = new BooleanWrapper(history);
252 
253             Object paramObj15 = new IntegerWrapper(historyCount);
254 
255             Object paramObj16 = new BooleanWrapper(expireable);
256 
257             Object paramObj17 = new LongWrapper(maxAge);
258 
259             Object paramObj18 = new LongWrapper(warningTime);
260 
261             Object paramObj19 = new IntegerWrapper(graceLimit);
262 
263             Object paramObj20 = new BooleanWrapper(lockout);
264 
265             Object paramObj21 = new IntegerWrapper(maxFailure);
266 
267             Object paramObj22 = new LongWrapper(lockoutDuration);
268 
269             Object paramObj23 = new LongWrapper(resetFailureCount);
270 
271             Object paramObj24 = new LongWrapper(resetTicketMaxAge);
272 
273             MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
274                     "updatePasswordPolicy",
275                     new Object[] {
276                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
277                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
278                         paramObj10, paramObj11, paramObj12, paramObj13,
279                         paramObj14, paramObj15, paramObj16, paramObj17,
280                         paramObj18, paramObj19, paramObj20, paramObj21,
281                         paramObj22, paramObj23, paramObj24
282                     });
283 
284             Object returnObj = null;
285 
286             try {
287                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
288             }
289             catch (Exception e) {
290                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
291                     throw (com.liferay.portal.kernel.exception.PortalException)e;
292                 }
293 
294                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
295                     throw (com.liferay.portal.kernel.exception.SystemException)e;
296                 }
297 
298                 throw new com.liferay.portal.kernel.exception.SystemException(e);
299             }
300 
301             return (com.liferay.portal.model.PasswordPolicy)returnObj;
302         }
303         catch (com.liferay.portal.kernel.exception.SystemException se) {
304             _log.error(se, se);
305 
306             throw se;
307         }
308     }
309 
310     private static Log _log = LogFactoryUtil.getLog(PasswordPolicyServiceHttp.class);
311 }