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