01: /*
02: * $Id: UpdateUserImpl.java,v 1.3 2007/09/18 11:27:16 agoubard Exp $
03: */
04: package com.mycompany.rest.api;
05:
06: /**
07: * Implementation of the <code>UpdateUser</code> function.
08: *
09: * <p>Description: Update the information of an existing user.
10: *
11: * @version $Revision: 1.3 $ $Date: 2007/09/18 11:27:16 $
12: * @author <a href="mailto:anthony.goubard@japplis.com">Anthony Goubard</a>
13: */
14: public final class UpdateUserImpl extends UpdateUser {
15:
16: /**
17: * Constructs a new <code>UpdateUserImpl</code> instance.
18: *
19: * @param api
20: * the API to which this function belongs, guaranteed to be not
21: * <code>null</code>.
22: */
23: public UpdateUserImpl(APIImpl api) {
24: super (api);
25: }
26:
27: /**
28: * Calls this function. If the function fails, it may throw any kind of
29: * exception. All exceptions will be handled by the caller.
30: *
31: * @param request
32: * the request, never <code>null</code>.
33: *
34: * @return
35: * the result of the function call, should never be <code>null</code>.
36: *
37: * @throws Throwable
38: * if anything went wrong.
39: */
40: public Result call(Request request) throws Throwable {
41: SuccessfulResult result = new SuccessfulResult();
42: boolean updated = _users.updateUser(request.getAccountNumber(),
43: request.getFirstName(), request.getLastName());
44: if (!updated) {
45: return new AccountNotFoundResult();
46: }
47: return result;
48: }
49: }
|