01: /*
02: * $Id: AddUserImpl.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>AddUser</code> function.
08: *
09: * <p>Description: Add the information of a new 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 AddUserImpl extends AddUser {
15:
16: /**
17: * Constructs a new <code>AddUserImpl</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 AddUserImpl(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: int accountNumber = _users.addUser(request.getFirstName(),
43: request.getLastName());
44: result.setAccountNumber(accountNumber);
45: return result;
46: }
47: }
|