1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.actions;
18
19 import java.util.List;
20
21 import org.apache.log4j.MDC;
22 import org.kuali.rice.kew.actionrequest.ActionRequestValue;
23 import org.kuali.rice.kew.actiontaken.ActionTakenValue;
24 import org.kuali.rice.kew.exception.InvalidActionTakenException;
25 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
26 import org.kuali.rice.kew.util.KEWConstants;
27 import org.kuali.rice.kew.util.Utilities;
28 import org.kuali.rice.kim.bo.entity.KimPrincipal;
29
30
31
32
33
34
35
36 public class LogDocumentActionAction extends ActionTakenEvent {
37
38 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(LogDocumentActionAction.class);
39
40
41
42
43
44 public LogDocumentActionAction(DocumentRouteHeaderValue rh, KimPrincipal principal) {
45 super(KEWConstants.ACTION_TAKEN_LOG_DOCUMENT_ACTION_CD, rh, principal);
46 }
47
48
49
50
51
52
53 public LogDocumentActionAction(DocumentRouteHeaderValue rh, KimPrincipal principal, String annotation) {
54 super(KEWConstants.ACTION_TAKEN_LOG_DOCUMENT_ACTION_CD, rh, principal, annotation);
55 }
56
57
58
59
60 @Override
61 public String validateActionRules() {
62
63 return "";
64 }
65
66
67
68
69
70
71 public void recordAction() throws InvalidActionTakenException {
72 MDC.put("docId", getRouteHeader().getRouteHeaderId());
73
74 String errorMessage = validateActionRules();
75 if (!Utilities.isEmpty(errorMessage)) {
76 throw new InvalidActionTakenException(errorMessage);
77 }
78
79 LOG.debug("Logging document action");
80 ActionTakenValue actionTaken = saveActionTaken(Boolean.FALSE);
81
82
83 }
84
85 @Override
86 public String validateActionRules(List<ActionRequestValue> actionRequests) {
87
88 return "";
89 }
90 }