001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service.http;
022:
023: import com.liferay.portal.kernel.log.Log;
024: import com.liferay.portal.kernel.log.LogFactoryUtil;
025: import com.liferay.portal.kernel.util.BooleanWrapper;
026: import com.liferay.portal.kernel.util.IntegerWrapper;
027: import com.liferay.portal.kernel.util.LongWrapper;
028: import com.liferay.portal.kernel.util.MethodWrapper;
029: import com.liferay.portal.kernel.util.NullWrapper;
030: import com.liferay.portal.security.auth.HttpPrincipal;
031: import com.liferay.portal.service.PasswordPolicyServiceUtil;
032:
033: /**
034: * <a href="PasswordPolicyServiceHttp.java.html"><b><i>View Source</i></b></a>
035: *
036: * <p>
037: * ServiceBuilder generated this class. Modifications in this class will be
038: * overwritten the next time is generated.
039: * </p>
040: *
041: * <p>
042: * This class provides a HTTP utility for the
043: * <code>com.liferay.portal.service.PasswordPolicyServiceUtil</code> service
044: * utility. The static methods of this class calls the same methods of the
045: * service utility. However, the signatures are different because it requires an
046: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
047: * parameter.
048: * </p>
049: *
050: * <p>
051: * The benefits of using the HTTP utility is that it is fast and allows for
052: * tunneling without the cost of serializing to text. The drawback is that it
053: * only works with Java.
054: * </p>
055: *
056: * <p>
057: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
058: * portal.properties to configure security.
059: * </p>
060: *
061: * <p>
062: * The HTTP utility is only generated for remote services.
063: * </p>
064: *
065: * @author Brian Wing Shun Chan
066: *
067: * @see com.liferay.portal.security.auth.HttpPrincipal
068: * @see com.liferay.portal.service.PasswordPolicyServiceUtil
069: * @see com.liferay.portal.service.http.PasswordPolicyServiceSoap
070: *
071: */
072: public class PasswordPolicyServiceHttp {
073: public static com.liferay.portal.model.PasswordPolicy addPasswordPolicy(
074: HttpPrincipal httpPrincipal, java.lang.String name,
075: java.lang.String description, boolean changeable,
076: boolean changeRequired, long minAge, boolean checkSyntax,
077: boolean allowDictionaryWords, int minLength,
078: boolean history, int historyCount, boolean expireable,
079: long maxAge, long warningTime, int graceLimit,
080: boolean lockout, int maxFailure, long lockoutDuration,
081: long resetFailureCount)
082: throws com.liferay.portal.SystemException,
083: com.liferay.portal.PortalException {
084: try {
085: Object paramObj0 = name;
086:
087: if (name == null) {
088: paramObj0 = new NullWrapper("java.lang.String");
089: }
090:
091: Object paramObj1 = description;
092:
093: if (description == null) {
094: paramObj1 = new NullWrapper("java.lang.String");
095: }
096:
097: Object paramObj2 = new BooleanWrapper(changeable);
098:
099: Object paramObj3 = new BooleanWrapper(changeRequired);
100:
101: Object paramObj4 = new LongWrapper(minAge);
102:
103: Object paramObj5 = new BooleanWrapper(checkSyntax);
104:
105: Object paramObj6 = new BooleanWrapper(allowDictionaryWords);
106:
107: Object paramObj7 = new IntegerWrapper(minLength);
108:
109: Object paramObj8 = new BooleanWrapper(history);
110:
111: Object paramObj9 = new IntegerWrapper(historyCount);
112:
113: Object paramObj10 = new BooleanWrapper(expireable);
114:
115: Object paramObj11 = new LongWrapper(maxAge);
116:
117: Object paramObj12 = new LongWrapper(warningTime);
118:
119: Object paramObj13 = new IntegerWrapper(graceLimit);
120:
121: Object paramObj14 = new BooleanWrapper(lockout);
122:
123: Object paramObj15 = new IntegerWrapper(maxFailure);
124:
125: Object paramObj16 = new LongWrapper(lockoutDuration);
126:
127: Object paramObj17 = new LongWrapper(resetFailureCount);
128:
129: MethodWrapper methodWrapper = new MethodWrapper(
130: PasswordPolicyServiceUtil.class.getName(),
131: "addPasswordPolicy", new Object[] { paramObj0,
132: paramObj1, paramObj2, paramObj3, paramObj4,
133: paramObj5, paramObj6, paramObj7, paramObj8,
134: paramObj9, paramObj10, paramObj11,
135: paramObj12, paramObj13, paramObj14,
136: paramObj15, paramObj16, paramObj17 });
137:
138: Object returnObj = null;
139:
140: try {
141: returnObj = TunnelUtil.invoke(httpPrincipal,
142: methodWrapper);
143: } catch (Exception e) {
144: if (e instanceof com.liferay.portal.SystemException) {
145: throw (com.liferay.portal.SystemException) e;
146: }
147:
148: if (e instanceof com.liferay.portal.PortalException) {
149: throw (com.liferay.portal.PortalException) e;
150: }
151:
152: throw new com.liferay.portal.SystemException(e);
153: }
154:
155: return (com.liferay.portal.model.PasswordPolicy) returnObj;
156: } catch (com.liferay.portal.SystemException se) {
157: _log.error(se, se);
158:
159: throw se;
160: }
161: }
162:
163: public static void deletePasswordPolicy(
164: HttpPrincipal httpPrincipal, long passwordPolicyId)
165: throws com.liferay.portal.SystemException,
166: com.liferay.portal.PortalException {
167: try {
168: Object paramObj0 = new LongWrapper(passwordPolicyId);
169:
170: MethodWrapper methodWrapper = new MethodWrapper(
171: PasswordPolicyServiceUtil.class.getName(),
172: "deletePasswordPolicy", new Object[] { paramObj0 });
173:
174: try {
175: TunnelUtil.invoke(httpPrincipal, methodWrapper);
176: } catch (Exception e) {
177: if (e instanceof com.liferay.portal.SystemException) {
178: throw (com.liferay.portal.SystemException) e;
179: }
180:
181: if (e instanceof com.liferay.portal.PortalException) {
182: throw (com.liferay.portal.PortalException) e;
183: }
184:
185: throw new com.liferay.portal.SystemException(e);
186: }
187: } catch (com.liferay.portal.SystemException se) {
188: _log.error(se, se);
189:
190: throw se;
191: }
192: }
193:
194: public static com.liferay.portal.model.PasswordPolicy updatePasswordPolicy(
195: HttpPrincipal httpPrincipal, long passwordPolicyId,
196: java.lang.String name, java.lang.String description,
197: boolean changeable, boolean changeRequired, long minAge,
198: boolean checkSyntax, boolean allowDictionaryWords,
199: int minLength, boolean history, int historyCount,
200: boolean expireable, long maxAge, long warningTime,
201: int graceLimit, boolean lockout, int maxFailure,
202: long lockoutDuration, long resetFailureCount)
203: throws com.liferay.portal.SystemException,
204: com.liferay.portal.PortalException {
205: try {
206: Object paramObj0 = new LongWrapper(passwordPolicyId);
207:
208: Object paramObj1 = name;
209:
210: if (name == null) {
211: paramObj1 = new NullWrapper("java.lang.String");
212: }
213:
214: Object paramObj2 = description;
215:
216: if (description == null) {
217: paramObj2 = new NullWrapper("java.lang.String");
218: }
219:
220: Object paramObj3 = new BooleanWrapper(changeable);
221:
222: Object paramObj4 = new BooleanWrapper(changeRequired);
223:
224: Object paramObj5 = new LongWrapper(minAge);
225:
226: Object paramObj6 = new BooleanWrapper(checkSyntax);
227:
228: Object paramObj7 = new BooleanWrapper(allowDictionaryWords);
229:
230: Object paramObj8 = new IntegerWrapper(minLength);
231:
232: Object paramObj9 = new BooleanWrapper(history);
233:
234: Object paramObj10 = new IntegerWrapper(historyCount);
235:
236: Object paramObj11 = new BooleanWrapper(expireable);
237:
238: Object paramObj12 = new LongWrapper(maxAge);
239:
240: Object paramObj13 = new LongWrapper(warningTime);
241:
242: Object paramObj14 = new IntegerWrapper(graceLimit);
243:
244: Object paramObj15 = new BooleanWrapper(lockout);
245:
246: Object paramObj16 = new IntegerWrapper(maxFailure);
247:
248: Object paramObj17 = new LongWrapper(lockoutDuration);
249:
250: Object paramObj18 = new LongWrapper(resetFailureCount);
251:
252: MethodWrapper methodWrapper = new MethodWrapper(
253: PasswordPolicyServiceUtil.class.getName(),
254: "updatePasswordPolicy", new Object[] { paramObj0,
255: paramObj1, paramObj2, paramObj3, paramObj4,
256: paramObj5, paramObj6, paramObj7, paramObj8,
257: paramObj9, paramObj10, paramObj11,
258: paramObj12, paramObj13, paramObj14,
259: paramObj15, paramObj16, paramObj17,
260: paramObj18 });
261:
262: Object returnObj = null;
263:
264: try {
265: returnObj = TunnelUtil.invoke(httpPrincipal,
266: methodWrapper);
267: } catch (Exception e) {
268: if (e instanceof com.liferay.portal.SystemException) {
269: throw (com.liferay.portal.SystemException) e;
270: }
271:
272: if (e instanceof com.liferay.portal.PortalException) {
273: throw (com.liferay.portal.PortalException) e;
274: }
275:
276: throw new com.liferay.portal.SystemException(e);
277: }
278:
279: return (com.liferay.portal.model.PasswordPolicy) returnObj;
280: } catch (com.liferay.portal.SystemException se) {
281: _log.error(se, se);
282:
283: throw se;
284: }
285: }
286:
287: private static Log _log = LogFactoryUtil
288: .getLog(PasswordPolicyServiceHttp.class);
289: }
|