001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.security.auth.HttpPrincipal;
022    import com.liferay.portal.kernel.service.PasswordPolicyServiceUtil;
023    import com.liferay.portal.kernel.service.http.TunnelUtil;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    
027    /**
028     * Provides the HTTP utility for the
029     * {@link PasswordPolicyServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link HttpPrincipal} parameter.
033     *
034     * <p>
035     * The benefits of using the HTTP utility is that it is fast and allows for
036     * tunneling without the cost of serializing to text. The drawback is that it
037     * only works with Java.
038     * </p>
039     *
040     * <p>
041     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
042     * configure security.
043     * </p>
044     *
045     * <p>
046     * The HTTP utility is only generated for remote services.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see PasswordPolicyServiceSoap
051     * @see HttpPrincipal
052     * @see PasswordPolicyServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class PasswordPolicyServiceHttp {
057            public static com.liferay.portal.kernel.model.PasswordPolicy addPasswordPolicy(
058                    HttpPrincipal httpPrincipal, java.lang.String name,
059                    java.lang.String description, boolean changeable,
060                    boolean changeRequired, long minAge, boolean checkSyntax,
061                    boolean allowDictionaryWords, int minAlphanumeric, int minLength,
062                    int minLowerCase, int minNumbers, int minSymbols, int minUpperCase,
063                    java.lang.String regex, boolean history, int historyCount,
064                    boolean expireable, long maxAge, long warningTime, int graceLimit,
065                    boolean lockout, int maxFailure, long lockoutDuration,
066                    long resetFailureCount, long resetTicketMaxAge,
067                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
068                    throws com.liferay.portal.kernel.exception.PortalException {
069                    try {
070                            MethodKey methodKey = new MethodKey(PasswordPolicyServiceUtil.class,
071                                            "addPasswordPolicy", _addPasswordPolicyParameterTypes0);
072    
073                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
074                                            description, changeable, changeRequired, minAge,
075                                            checkSyntax, allowDictionaryWords, minAlphanumeric,
076                                            minLength, minLowerCase, minNumbers, minSymbols,
077                                            minUpperCase, regex, history, historyCount, expireable,
078                                            maxAge, warningTime, graceLimit, lockout, maxFailure,
079                                            lockoutDuration, resetFailureCount, resetTicketMaxAge,
080                                            serviceContext);
081    
082                            Object returnObj = null;
083    
084                            try {
085                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
086                            }
087                            catch (Exception e) {
088                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
089                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
090                                    }
091    
092                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
093                            }
094    
095                            return (com.liferay.portal.kernel.model.PasswordPolicy)returnObj;
096                    }
097                    catch (com.liferay.portal.kernel.exception.SystemException se) {
098                            _log.error(se, se);
099    
100                            throw se;
101                    }
102            }
103    
104            public static void deletePasswordPolicy(HttpPrincipal httpPrincipal,
105                    long passwordPolicyId)
106                    throws com.liferay.portal.kernel.exception.PortalException {
107                    try {
108                            MethodKey methodKey = new MethodKey(PasswordPolicyServiceUtil.class,
109                                            "deletePasswordPolicy", _deletePasswordPolicyParameterTypes1);
110    
111                            MethodHandler methodHandler = new MethodHandler(methodKey,
112                                            passwordPolicyId);
113    
114                            try {
115                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
116                            }
117                            catch (Exception e) {
118                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
119                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
120                                    }
121    
122                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
123                            }
124                    }
125                    catch (com.liferay.portal.kernel.exception.SystemException se) {
126                            _log.error(se, se);
127    
128                            throw se;
129                    }
130            }
131    
132            public static com.liferay.portal.kernel.model.PasswordPolicy fetchPasswordPolicy(
133                    HttpPrincipal httpPrincipal, long passwordPolicyId)
134                    throws com.liferay.portal.kernel.exception.PortalException {
135                    try {
136                            MethodKey methodKey = new MethodKey(PasswordPolicyServiceUtil.class,
137                                            "fetchPasswordPolicy", _fetchPasswordPolicyParameterTypes2);
138    
139                            MethodHandler methodHandler = new MethodHandler(methodKey,
140                                            passwordPolicyId);
141    
142                            Object returnObj = null;
143    
144                            try {
145                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
146                            }
147                            catch (Exception e) {
148                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
149                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
150                                    }
151    
152                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
153                            }
154    
155                            return (com.liferay.portal.kernel.model.PasswordPolicy)returnObj;
156                    }
157                    catch (com.liferay.portal.kernel.exception.SystemException se) {
158                            _log.error(se, se);
159    
160                            throw se;
161                    }
162            }
163    
164            public static com.liferay.portal.kernel.model.PasswordPolicy updatePasswordPolicy(
165                    HttpPrincipal httpPrincipal, long passwordPolicyId,
166                    java.lang.String name, java.lang.String description,
167                    boolean changeable, boolean changeRequired, long minAge,
168                    boolean checkSyntax, boolean allowDictionaryWords, int minAlphanumeric,
169                    int minLength, int minLowerCase, int minNumbers, int minSymbols,
170                    int minUpperCase, java.lang.String regex, boolean history,
171                    int historyCount, boolean expireable, long maxAge, long warningTime,
172                    int graceLimit, boolean lockout, int maxFailure, long lockoutDuration,
173                    long resetFailureCount, long resetTicketMaxAge,
174                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
175                    throws com.liferay.portal.kernel.exception.PortalException {
176                    try {
177                            MethodKey methodKey = new MethodKey(PasswordPolicyServiceUtil.class,
178                                            "updatePasswordPolicy", _updatePasswordPolicyParameterTypes3);
179    
180                            MethodHandler methodHandler = new MethodHandler(methodKey,
181                                            passwordPolicyId, name, description, changeable,
182                                            changeRequired, minAge, checkSyntax, allowDictionaryWords,
183                                            minAlphanumeric, minLength, minLowerCase, minNumbers,
184                                            minSymbols, minUpperCase, regex, history, historyCount,
185                                            expireable, maxAge, warningTime, graceLimit, lockout,
186                                            maxFailure, lockoutDuration, resetFailureCount,
187                                            resetTicketMaxAge, serviceContext);
188    
189                            Object returnObj = null;
190    
191                            try {
192                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
193                            }
194                            catch (Exception e) {
195                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
196                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
197                                    }
198    
199                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
200                            }
201    
202                            return (com.liferay.portal.kernel.model.PasswordPolicy)returnObj;
203                    }
204                    catch (com.liferay.portal.kernel.exception.SystemException se) {
205                            _log.error(se, se);
206    
207                            throw se;
208                    }
209            }
210    
211            private static Log _log = LogFactoryUtil.getLog(PasswordPolicyServiceHttp.class);
212            private static final Class<?>[] _addPasswordPolicyParameterTypes0 = new Class[] {
213                            java.lang.String.class, java.lang.String.class, boolean.class,
214                            boolean.class, long.class, boolean.class, boolean.class, int.class,
215                            int.class, int.class, int.class, int.class, int.class,
216                            java.lang.String.class, boolean.class, int.class, boolean.class,
217                            long.class, long.class, int.class, boolean.class, int.class,
218                            long.class, long.class, long.class,
219                            com.liferay.portal.kernel.service.ServiceContext.class
220                    };
221            private static final Class<?>[] _deletePasswordPolicyParameterTypes1 = new Class[] {
222                            long.class
223                    };
224            private static final Class<?>[] _fetchPasswordPolicyParameterTypes2 = new Class[] {
225                            long.class
226                    };
227            private static final Class<?>[] _updatePasswordPolicyParameterTypes3 = new Class[] {
228                            long.class, java.lang.String.class, java.lang.String.class,
229                            boolean.class, boolean.class, long.class, boolean.class,
230                            boolean.class, int.class, int.class, int.class, int.class, int.class,
231                            int.class, java.lang.String.class, boolean.class, int.class,
232                            boolean.class, long.class, long.class, int.class, boolean.class,
233                            int.class, long.class, long.class, long.class,
234                            com.liferay.portal.kernel.service.ServiceContext.class
235                    };
236    }