01 /*
02 * Created on Jun 28, 2004
03 *
04 * To change the template for this generated file go to
05 * Window - Preferences - Java - Code Generation - Code and Comments
06 */
07 package biz.xsoftware.examples.advanced;
08
09
10 /**
11 * The SysUnderTest here is a WebStore or something which needs
12 * to authorize purchases.
13 */
14 public class SysUnderTestImpl implements SysUnderTest {
15
16 private TaskRecordService msgSystem;
17 private TaskSystemService taskSystem;
18
19 /**
20 * @showcode
21 */
22 public SysUnderTestImpl(TaskRecordService msgSystem, TaskSystemService t) {
23 this.msgSystem = msgSystem;
24 this.taskSystem = t;
25 }
26 /**
27 * @showcode
28 */
29 public void sendUserMailWhenTaskStarted(String id, String taskName) {
30 taskSystem.addScheduleListener(new TaskStartedListener(id, taskName));
31 }
32
33 private class TaskStartedListener implements ScheduleListener {
34
35 private String name;
36 private String userId;
37 /**
38 * @showcode
39 */
40 public TaskStartedListener(String userId, String name) {
41 this.name = name;
42 this.userId = userId;
43 }
44 /**
45 * @showcode
46 * @see biz.xsoftware.examples.advanced.ScheduleListener#eventStarted(java.lang.String)
47 */
48 public void eventStarted(String title) {
49 User u = msgSystem.getUser(userId);
50
51 u.addTaskDone(name);
52 }
53 }
54
55 }
|