01: /*
02: * $Id: DataSectionImpl.java,v 1.9 2007/09/18 11:27:12 agoubard Exp $
03: */
04: package com.mycompany.allinone.api;
05:
06: /**
07: * Implementation of the <code>DataSection</code> function.
08: *
09: * @version $Revision: 1.9 $ $Date: 2007/09/18 11:27:12 $
10: * @author <a href="mailto:anthony.goubard@japplis.com">Anthony Goubard</a>
11: */
12: public class DataSectionImpl extends DataSection {
13:
14: /**
15: * Constructs a new <code>DataSectionImpl</code> instance.
16: *
17: * @param api
18: * the API to which this function belongs, guaranteed to be not
19: * <code>null</code>.
20: */
21: public DataSectionImpl(APIImpl api) {
22: super (api);
23: }
24:
25: public final Result call(Request request) throws Throwable {
26: SuccessfulResult result = new SuccessfulResult();
27:
28: // Always add the superuser
29: User su = new User();
30: su.setName("superuser");
31: su.setAddress("12 Madison Avenue");
32: su.pcdata("This user has the root authorisation.");
33: result.addUser(su);
34:
35: if (request.isSetInputText()) {
36: User user = new User();
37: user.setName(request.getInputText());
38: user.setAddress("Unknown");
39: result.addUser(user);
40: }
41: return result;
42: }
43: }
|