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 minLength, boolean history,
70          int historyCount, boolean expireable, long maxAge, long warningTime,
71          int graceLimit, boolean lockout, int maxFailure, long lockoutDuration,
72          long resetFailureCount)
73          throws com.liferay.portal.kernel.exception.PortalException,
74              com.liferay.portal.kernel.exception.SystemException {
75          try {
76              Object paramObj0 = name;
77  
78              if (name == null) {
79                  paramObj0 = new NullWrapper("java.lang.String");
80              }
81  
82              Object paramObj1 = description;
83  
84              if (description == null) {
85                  paramObj1 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj2 = new BooleanWrapper(changeable);
89  
90              Object paramObj3 = new BooleanWrapper(changeRequired);
91  
92              Object paramObj4 = new LongWrapper(minAge);
93  
94              Object paramObj5 = new BooleanWrapper(checkSyntax);
95  
96              Object paramObj6 = new BooleanWrapper(allowDictionaryWords);
97  
98              Object paramObj7 = new IntegerWrapper(minLength);
99  
100             Object paramObj8 = new BooleanWrapper(history);
101 
102             Object paramObj9 = new IntegerWrapper(historyCount);
103 
104             Object paramObj10 = new BooleanWrapper(expireable);
105 
106             Object paramObj11 = new LongWrapper(maxAge);
107 
108             Object paramObj12 = new LongWrapper(warningTime);
109 
110             Object paramObj13 = new IntegerWrapper(graceLimit);
111 
112             Object paramObj14 = new BooleanWrapper(lockout);
113 
114             Object paramObj15 = new IntegerWrapper(maxFailure);
115 
116             Object paramObj16 = new LongWrapper(lockoutDuration);
117 
118             Object paramObj17 = new LongWrapper(resetFailureCount);
119 
120             MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
121                     "addPasswordPolicy",
122                     new Object[] {
123                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
124                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
125                         paramObj10, paramObj11, paramObj12, paramObj13,
126                         paramObj14, paramObj15, paramObj16, paramObj17
127                     });
128 
129             Object returnObj = null;
130 
131             try {
132                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
133             }
134             catch (Exception e) {
135                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
136                     throw (com.liferay.portal.kernel.exception.PortalException)e;
137                 }
138 
139                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
140                     throw (com.liferay.portal.kernel.exception.SystemException)e;
141                 }
142 
143                 throw new com.liferay.portal.kernel.exception.SystemException(e);
144             }
145 
146             return (com.liferay.portal.model.PasswordPolicy)returnObj;
147         }
148         catch (com.liferay.portal.kernel.exception.SystemException se) {
149             _log.error(se, se);
150 
151             throw se;
152         }
153     }
154 
155     public static void deletePasswordPolicy(HttpPrincipal httpPrincipal,
156         long passwordPolicyId)
157         throws com.liferay.portal.kernel.exception.PortalException,
158             com.liferay.portal.kernel.exception.SystemException {
159         try {
160             Object paramObj0 = new LongWrapper(passwordPolicyId);
161 
162             MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
163                     "deletePasswordPolicy", new Object[] { paramObj0 });
164 
165             try {
166                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
167             }
168             catch (Exception e) {
169                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
170                     throw (com.liferay.portal.kernel.exception.PortalException)e;
171                 }
172 
173                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
174                     throw (com.liferay.portal.kernel.exception.SystemException)e;
175                 }
176 
177                 throw new com.liferay.portal.kernel.exception.SystemException(e);
178             }
179         }
180         catch (com.liferay.portal.kernel.exception.SystemException se) {
181             _log.error(se, se);
182 
183             throw se;
184         }
185     }
186 
187     public static com.liferay.portal.model.PasswordPolicy updatePasswordPolicy(
188         HttpPrincipal httpPrincipal, long passwordPolicyId,
189         java.lang.String name, java.lang.String description,
190         boolean changeable, boolean changeRequired, long minAge,
191         boolean checkSyntax, boolean allowDictionaryWords, int minLength,
192         boolean history, int historyCount, boolean expireable, long maxAge,
193         long warningTime, int graceLimit, boolean lockout, int maxFailure,
194         long lockoutDuration, long resetFailureCount)
195         throws com.liferay.portal.kernel.exception.PortalException,
196             com.liferay.portal.kernel.exception.SystemException {
197         try {
198             Object paramObj0 = new LongWrapper(passwordPolicyId);
199 
200             Object paramObj1 = name;
201 
202             if (name == null) {
203                 paramObj1 = new NullWrapper("java.lang.String");
204             }
205 
206             Object paramObj2 = description;
207 
208             if (description == null) {
209                 paramObj2 = new NullWrapper("java.lang.String");
210             }
211 
212             Object paramObj3 = new BooleanWrapper(changeable);
213 
214             Object paramObj4 = new BooleanWrapper(changeRequired);
215 
216             Object paramObj5 = new LongWrapper(minAge);
217 
218             Object paramObj6 = new BooleanWrapper(checkSyntax);
219 
220             Object paramObj7 = new BooleanWrapper(allowDictionaryWords);
221 
222             Object paramObj8 = new IntegerWrapper(minLength);
223 
224             Object paramObj9 = new BooleanWrapper(history);
225 
226             Object paramObj10 = new IntegerWrapper(historyCount);
227 
228             Object paramObj11 = new BooleanWrapper(expireable);
229 
230             Object paramObj12 = new LongWrapper(maxAge);
231 
232             Object paramObj13 = new LongWrapper(warningTime);
233 
234             Object paramObj14 = new IntegerWrapper(graceLimit);
235 
236             Object paramObj15 = new BooleanWrapper(lockout);
237 
238             Object paramObj16 = new IntegerWrapper(maxFailure);
239 
240             Object paramObj17 = new LongWrapper(lockoutDuration);
241 
242             Object paramObj18 = new LongWrapper(resetFailureCount);
243 
244             MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
245                     "updatePasswordPolicy",
246                     new Object[] {
247                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
248                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
249                         paramObj10, paramObj11, paramObj12, paramObj13,
250                         paramObj14, paramObj15, paramObj16, paramObj17,
251                         paramObj18
252                     });
253 
254             Object returnObj = null;
255 
256             try {
257                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
258             }
259             catch (Exception e) {
260                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
261                     throw (com.liferay.portal.kernel.exception.PortalException)e;
262                 }
263 
264                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
265                     throw (com.liferay.portal.kernel.exception.SystemException)e;
266                 }
267 
268                 throw new com.liferay.portal.kernel.exception.SystemException(e);
269             }
270 
271             return (com.liferay.portal.model.PasswordPolicy)returnObj;
272         }
273         catch (com.liferay.portal.kernel.exception.SystemException se) {
274             _log.error(se, se);
275 
276             throw se;
277         }
278     }
279 
280     private static Log _log = LogFactoryUtil.getLog(PasswordPolicyServiceHttp.class);
281 }