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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.PasswordPolicyServiceUtil;
23  
24  /**
25   * <a href="PasswordPolicyServiceHttp.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class provides a HTTP utility for the
34   * {@link com.liferay.portal.service.PasswordPolicyServiceUtil} service utility. The
35   * static methods of this class calls the same methods of the service utility.
36   * However, the signatures are different because it requires an additional
37   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
38   * </p>
39   *
40   * <p>
41   * The benefits of using the HTTP utility is that it is fast and allows for
42   * tunneling without the cost of serializing to text. The drawback is that it
43   * only works with Java.
44   * </p>
45   *
46   * <p>
47   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
48   * configure security.
49   * </p>
50   *
51   * <p>
52   * The HTTP utility is only generated for remote services.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       PasswordPolicyServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.PasswordPolicyServiceUtil
59   * @generated
60   */
61  public class PasswordPolicyServiceHttp {
62      public static com.liferay.portal.model.PasswordPolicy addPasswordPolicy(
63          HttpPrincipal httpPrincipal, java.lang.String name,
64          java.lang.String description, boolean changeable,
65          boolean changeRequired, long minAge, boolean checkSyntax,
66          boolean allowDictionaryWords, int minLength, boolean history,
67          int historyCount, boolean expireable, long maxAge, long warningTime,
68          int graceLimit, boolean lockout, int maxFailure, long lockoutDuration,
69          long resetFailureCount)
70          throws com.liferay.portal.PortalException,
71              com.liferay.portal.SystemException {
72          try {
73              MethodKey methodKey = new MethodKey(PasswordPolicyServiceUtil.class.getName(),
74                      "addPasswordPolicy", _addPasswordPolicyParameterTypes0);
75  
76              MethodHandler methodHandler = new MethodHandler(methodKey, name,
77                      description, changeable, changeRequired, minAge,
78                      checkSyntax, allowDictionaryWords, minLength, history,
79                      historyCount, expireable, maxAge, warningTime, graceLimit,
80                      lockout, maxFailure, lockoutDuration, resetFailureCount);
81  
82              Object returnObj = null;
83  
84              try {
85                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
86              }
87              catch (Exception e) {
88                  if (e instanceof com.liferay.portal.PortalException) {
89                      throw (com.liferay.portal.PortalException)e;
90                  }
91  
92                  if (e instanceof com.liferay.portal.SystemException) {
93                      throw (com.liferay.portal.SystemException)e;
94                  }
95  
96                  throw new com.liferay.portal.SystemException(e);
97              }
98  
99              return (com.liferay.portal.model.PasswordPolicy)returnObj;
100         }
101         catch (com.liferay.portal.SystemException se) {
102             _log.error(se, se);
103 
104             throw se;
105         }
106     }
107 
108     public static void deletePasswordPolicy(HttpPrincipal httpPrincipal,
109         long passwordPolicyId)
110         throws com.liferay.portal.PortalException,
111             com.liferay.portal.SystemException {
112         try {
113             MethodKey methodKey = new MethodKey(PasswordPolicyServiceUtil.class.getName(),
114                     "deletePasswordPolicy", _deletePasswordPolicyParameterTypes1);
115 
116             MethodHandler methodHandler = new MethodHandler(methodKey,
117                     passwordPolicyId);
118 
119             try {
120                 TunnelUtil.invoke(httpPrincipal, methodHandler);
121             }
122             catch (Exception e) {
123                 if (e instanceof com.liferay.portal.PortalException) {
124                     throw (com.liferay.portal.PortalException)e;
125                 }
126 
127                 if (e instanceof com.liferay.portal.SystemException) {
128                     throw (com.liferay.portal.SystemException)e;
129                 }
130 
131                 throw new com.liferay.portal.SystemException(e);
132             }
133         }
134         catch (com.liferay.portal.SystemException se) {
135             _log.error(se, se);
136 
137             throw se;
138         }
139     }
140 
141     public static com.liferay.portal.model.PasswordPolicy updatePasswordPolicy(
142         HttpPrincipal httpPrincipal, long passwordPolicyId,
143         java.lang.String name, java.lang.String description,
144         boolean changeable, boolean changeRequired, long minAge,
145         boolean checkSyntax, boolean allowDictionaryWords, int minLength,
146         boolean history, int historyCount, boolean expireable, long maxAge,
147         long warningTime, int graceLimit, boolean lockout, int maxFailure,
148         long lockoutDuration, long resetFailureCount)
149         throws com.liferay.portal.PortalException,
150             com.liferay.portal.SystemException {
151         try {
152             MethodKey methodKey = new MethodKey(PasswordPolicyServiceUtil.class.getName(),
153                     "updatePasswordPolicy", _updatePasswordPolicyParameterTypes2);
154 
155             MethodHandler methodHandler = new MethodHandler(methodKey,
156                     passwordPolicyId, name, description, changeable,
157                     changeRequired, minAge, checkSyntax, allowDictionaryWords,
158                     minLength, history, historyCount, expireable, maxAge,
159                     warningTime, graceLimit, lockout, maxFailure,
160                     lockoutDuration, resetFailureCount);
161 
162             Object returnObj = null;
163 
164             try {
165                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
166             }
167             catch (Exception e) {
168                 if (e instanceof com.liferay.portal.PortalException) {
169                     throw (com.liferay.portal.PortalException)e;
170                 }
171 
172                 if (e instanceof com.liferay.portal.SystemException) {
173                     throw (com.liferay.portal.SystemException)e;
174                 }
175 
176                 throw new com.liferay.portal.SystemException(e);
177             }
178 
179             return (com.liferay.portal.model.PasswordPolicy)returnObj;
180         }
181         catch (com.liferay.portal.SystemException se) {
182             _log.error(se, se);
183 
184             throw se;
185         }
186     }
187 
188     private static Log _log = LogFactoryUtil.getLog(PasswordPolicyServiceHttp.class);
189     private static final Class<?>[] _addPasswordPolicyParameterTypes0 = new Class[] {
190             java.lang.String.class, java.lang.String.class, boolean.class,
191             boolean.class, long.class, boolean.class, boolean.class, int.class,
192             boolean.class, int.class, boolean.class, long.class, long.class,
193             int.class, boolean.class, int.class, long.class, long.class
194         };
195     private static final Class<?>[] _deletePasswordPolicyParameterTypes1 = new Class[] {
196             long.class
197         };
198     private static final Class<?>[] _updatePasswordPolicyParameterTypes2 = new Class[] {
199             long.class, java.lang.String.class, java.lang.String.class,
200             boolean.class, boolean.class, long.class, boolean.class,
201             boolean.class, int.class, boolean.class, int.class, boolean.class,
202             long.class, long.class, int.class, boolean.class, int.class,
203             long.class, long.class
204         };
205 }