1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package mocks;
17
18 import java.sql.Timestamp;
19 import java.util.Collection;
20 import java.util.Date;
21
22 import org.kuali.rice.kew.actionitem.ActionItem;
23 import org.kuali.rice.kew.doctype.bo.DocumentType;
24 import org.kuali.rice.kew.feedback.web.FeedbackForm;
25 import org.kuali.rice.kew.mail.EmailContent;
26 import org.kuali.rice.kew.mail.service.impl.StyleableEmailContentServiceImpl;
27 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
28 import org.kuali.rice.kew.util.KEWConstants;
29 import org.kuali.rice.kim.bo.Person;
30
31
32
33
34
35
36
37
38 public class MockStyleableEmailContentServiceImpl extends StyleableEmailContentServiceImpl implements MockStyleableEmailContentService {
39
40 private boolean wasAccessed = false;
41
42 @Override
43 public EmailContent generateImmediateReminder(Person user, ActionItem actionItem, DocumentType documentType) {
44 wasAccessed = true;
45 return super.generateImmediateReminder(user, actionItem, documentType);
46 }
47
48 @Override
49 public EmailContent generateDailyReminder(Person user, Collection<ActionItem> actionItems) {
50 wasAccessed = true;
51 return super.generateDailyReminder(user, actionItems);
52 }
53
54 @Override
55 public EmailContent generateWeeklyReminder(Person user, Collection<ActionItem> actionItems) {
56 wasAccessed = true;
57 return super.generateWeeklyReminder(user, actionItems);
58 }
59
60 @Override
61 public EmailContent generateFeedback(FeedbackForm form) {
62 wasAccessed = true;
63 return super.generateFeedback(form);
64 }
65
66
67
68
69
70
71 @Override
72 public DocumentRouteHeaderValue getRouteHeader(ActionItem actionItem) {
73 if (actionItem.getRouteHeader() != null) {
74 return super.getRouteHeader(actionItem);
75 }
76 DocumentRouteHeaderValue routeHeader = new DocumentRouteHeaderValue();
77 routeHeader.setDocRouteStatus(KEWConstants.ROUTE_HEADER_ENROUTE_CD);
78 routeHeader.setCreateDate(new Timestamp(new Date().getTime()));
79 return routeHeader;
80 }
81
82
83
84
85 public boolean wasServiceAccessed() {
86 return this.wasAccessed;
87 }
88
89
90
91
92 public void resetServiceAccessed() {
93 this.wasAccessed = false;
94 }
95
96 }