1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.rule.event; |
17 | |
|
18 | |
import org.apache.commons.lang.StringUtils; |
19 | |
import org.apache.log4j.Logger; |
20 | |
import org.kuali.rice.kns.bo.PersistableBusinessObject; |
21 | |
import org.kuali.rice.kns.document.Document; |
22 | |
import org.kuali.rice.kns.document.MaintenanceDocument; |
23 | |
import org.kuali.rice.kns.rule.AddCollectionLineRule; |
24 | |
import org.kuali.rice.kns.rule.BusinessRule; |
25 | |
|
26 | |
public class KualiAddLineEvent extends KualiDocumentEventBase { |
27 | 0 | private static final Logger LOG = Logger.getLogger(KualiAddLineEvent.class); |
28 | |
|
29 | |
private PersistableBusinessObject bo; |
30 | |
private String collectionName; |
31 | |
|
32 | |
public KualiAddLineEvent( Document document, String collectionName, PersistableBusinessObject addLine ) { |
33 | 0 | super("adding bo to document collection " + getDocumentId(document), "", document); |
34 | |
|
35 | 0 | this.bo = addLine; |
36 | 0 | this.collectionName = collectionName; |
37 | 0 | } |
38 | |
|
39 | |
public boolean invokeRuleMethod(BusinessRule rule) { |
40 | 0 | return ((AddCollectionLineRule)rule).processAddCollectionLineBusinessRules( (MaintenanceDocument)getDocument(), collectionName, bo ); |
41 | |
} |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
private void logEvent() { |
47 | 0 | if ( LOG.isDebugEnabled() ) { |
48 | 0 | StringBuffer logMessage = new StringBuffer(StringUtils.substringAfterLast(this.getClass().getName(), ".")); |
49 | 0 | logMessage.append(" with "); |
50 | |
|
51 | |
|
52 | 0 | if (bo == null) { |
53 | 0 | logMessage.append("null new bo"); |
54 | |
} else { |
55 | 0 | logMessage.append( StringUtils.substringAfterLast(bo.getObjectId(), ".") ); |
56 | |
} |
57 | |
|
58 | 0 | LOG.debug(logMessage); |
59 | |
} |
60 | 0 | } |
61 | |
|
62 | |
public Class getRuleInterfaceClass() { |
63 | 0 | return AddCollectionLineRule.class; |
64 | |
} |
65 | |
} |