001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.BooleanWrapper;
020    import com.liferay.portal.kernel.util.IntegerWrapper;
021    import com.liferay.portal.kernel.util.LongWrapper;
022    import com.liferay.portal.kernel.util.MethodWrapper;
023    import com.liferay.portal.kernel.util.NullWrapper;
024    import com.liferay.portal.security.auth.HttpPrincipal;
025    import com.liferay.portal.service.PasswordPolicyServiceUtil;
026    
027    /**
028     * <p>
029     * This class provides a HTTP utility for the
030     * {@link com.liferay.portal.service.PasswordPolicyServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
034     * </p>
035     *
036     * <p>
037     * The benefits of using the HTTP utility is that it is fast and allows for
038     * tunneling without the cost of serializing to text. The drawback is that it
039     * only works with Java.
040     * </p>
041     *
042     * <p>
043     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
044     * configure security.
045     * </p>
046     *
047     * <p>
048     * The HTTP utility is only generated for remote services.
049     * </p>
050     *
051     * @author    Brian Wing Shun Chan
052     * @see       PasswordPolicyServiceSoap
053     * @see       com.liferay.portal.security.auth.HttpPrincipal
054     * @see       com.liferay.portal.service.PasswordPolicyServiceUtil
055     * @generated
056     */
057    public class PasswordPolicyServiceHttp {
058            public static com.liferay.portal.model.PasswordPolicy addPasswordPolicy(
059                    HttpPrincipal httpPrincipal, java.lang.String name,
060                    java.lang.String description, boolean changeable,
061                    boolean changeRequired, long minAge, boolean checkSyntax,
062                    boolean allowDictionaryWords, int minAlphanumeric, int minLength,
063                    int minLowerCase, int minNumbers, int minSymbols, int minUpperCase,
064                    boolean history, int historyCount, boolean expireable, long maxAge,
065                    long warningTime, int graceLimit, boolean lockout, int maxFailure,
066                    long lockoutDuration, long resetFailureCount, long resetTicketMaxAge)
067                    throws com.liferay.portal.kernel.exception.PortalException,
068                            com.liferay.portal.kernel.exception.SystemException {
069                    try {
070                            Object paramObj0 = name;
071    
072                            if (name == null) {
073                                    paramObj0 = new NullWrapper("java.lang.String");
074                            }
075    
076                            Object paramObj1 = description;
077    
078                            if (description == null) {
079                                    paramObj1 = new NullWrapper("java.lang.String");
080                            }
081    
082                            Object paramObj2 = new BooleanWrapper(changeable);
083    
084                            Object paramObj3 = new BooleanWrapper(changeRequired);
085    
086                            Object paramObj4 = new LongWrapper(minAge);
087    
088                            Object paramObj5 = new BooleanWrapper(checkSyntax);
089    
090                            Object paramObj6 = new BooleanWrapper(allowDictionaryWords);
091    
092                            Object paramObj7 = new IntegerWrapper(minAlphanumeric);
093    
094                            Object paramObj8 = new IntegerWrapper(minLength);
095    
096                            Object paramObj9 = new IntegerWrapper(minLowerCase);
097    
098                            Object paramObj10 = new IntegerWrapper(minNumbers);
099    
100                            Object paramObj11 = new IntegerWrapper(minSymbols);
101    
102                            Object paramObj12 = new IntegerWrapper(minUpperCase);
103    
104                            Object paramObj13 = new BooleanWrapper(history);
105    
106                            Object paramObj14 = new IntegerWrapper(historyCount);
107    
108                            Object paramObj15 = new BooleanWrapper(expireable);
109    
110                            Object paramObj16 = new LongWrapper(maxAge);
111    
112                            Object paramObj17 = new LongWrapper(warningTime);
113    
114                            Object paramObj18 = new IntegerWrapper(graceLimit);
115    
116                            Object paramObj19 = new BooleanWrapper(lockout);
117    
118                            Object paramObj20 = new IntegerWrapper(maxFailure);
119    
120                            Object paramObj21 = new LongWrapper(lockoutDuration);
121    
122                            Object paramObj22 = new LongWrapper(resetFailureCount);
123    
124                            Object paramObj23 = new LongWrapper(resetTicketMaxAge);
125    
126                            MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
127                                            "addPasswordPolicy",
128                                            new Object[] {
129                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
130                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
131                                                    paramObj10, paramObj11, paramObj12, paramObj13,
132                                                    paramObj14, paramObj15, paramObj16, paramObj17,
133                                                    paramObj18, paramObj19, paramObj20, paramObj21,
134                                                    paramObj22, paramObj23
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.kernel.exception.PortalException) {
144                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
145                                    }
146    
147                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
148                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
149                                    }
150    
151                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
152                            }
153    
154                            return (com.liferay.portal.model.PasswordPolicy)returnObj;
155                    }
156                    catch (com.liferay.portal.kernel.exception.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.kernel.exception.PortalException,
166                            com.liferay.portal.kernel.exception.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.kernel.exception.PortalException) {
178                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
179                                    }
180    
181                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
182                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
183                                    }
184    
185                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
186                            }
187                    }
188                    catch (com.liferay.portal.kernel.exception.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 minAlphanumeric,
200                    int minLength, int minLowerCase, int minNumbers, int minSymbols,
201                    int minUpperCase, boolean history, int historyCount,
202                    boolean expireable, long maxAge, long warningTime, int graceLimit,
203                    boolean lockout, int maxFailure, long lockoutDuration,
204                    long resetFailureCount, long resetTicketMaxAge)
205                    throws com.liferay.portal.kernel.exception.PortalException,
206                            com.liferay.portal.kernel.exception.SystemException {
207                    try {
208                            Object paramObj0 = new LongWrapper(passwordPolicyId);
209    
210                            Object paramObj1 = name;
211    
212                            if (name == null) {
213                                    paramObj1 = new NullWrapper("java.lang.String");
214                            }
215    
216                            Object paramObj2 = description;
217    
218                            if (description == null) {
219                                    paramObj2 = new NullWrapper("java.lang.String");
220                            }
221    
222                            Object paramObj3 = new BooleanWrapper(changeable);
223    
224                            Object paramObj4 = new BooleanWrapper(changeRequired);
225    
226                            Object paramObj5 = new LongWrapper(minAge);
227    
228                            Object paramObj6 = new BooleanWrapper(checkSyntax);
229    
230                            Object paramObj7 = new BooleanWrapper(allowDictionaryWords);
231    
232                            Object paramObj8 = new IntegerWrapper(minAlphanumeric);
233    
234                            Object paramObj9 = new IntegerWrapper(minLength);
235    
236                            Object paramObj10 = new IntegerWrapper(minLowerCase);
237    
238                            Object paramObj11 = new IntegerWrapper(minNumbers);
239    
240                            Object paramObj12 = new IntegerWrapper(minSymbols);
241    
242                            Object paramObj13 = new IntegerWrapper(minUpperCase);
243    
244                            Object paramObj14 = new BooleanWrapper(history);
245    
246                            Object paramObj15 = new IntegerWrapper(historyCount);
247    
248                            Object paramObj16 = new BooleanWrapper(expireable);
249    
250                            Object paramObj17 = new LongWrapper(maxAge);
251    
252                            Object paramObj18 = new LongWrapper(warningTime);
253    
254                            Object paramObj19 = new IntegerWrapper(graceLimit);
255    
256                            Object paramObj20 = new BooleanWrapper(lockout);
257    
258                            Object paramObj21 = new IntegerWrapper(maxFailure);
259    
260                            Object paramObj22 = new LongWrapper(lockoutDuration);
261    
262                            Object paramObj23 = new LongWrapper(resetFailureCount);
263    
264                            Object paramObj24 = new LongWrapper(resetTicketMaxAge);
265    
266                            MethodWrapper methodWrapper = new MethodWrapper(PasswordPolicyServiceUtil.class.getName(),
267                                            "updatePasswordPolicy",
268                                            new Object[] {
269                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
270                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
271                                                    paramObj10, paramObj11, paramObj12, paramObj13,
272                                                    paramObj14, paramObj15, paramObj16, paramObj17,
273                                                    paramObj18, paramObj19, paramObj20, paramObj21,
274                                                    paramObj22, paramObj23, paramObj24
275                                            });
276    
277                            Object returnObj = null;
278    
279                            try {
280                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
281                            }
282                            catch (Exception e) {
283                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
284                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
285                                    }
286    
287                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
288                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
289                                    }
290    
291                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
292                            }
293    
294                            return (com.liferay.portal.model.PasswordPolicy)returnObj;
295                    }
296                    catch (com.liferay.portal.kernel.exception.SystemException se) {
297                            _log.error(se, se);
298    
299                            throw se;
300                    }
301            }
302    
303            private static Log _log = LogFactoryUtil.getLog(PasswordPolicyServiceHttp.class);
304    }