1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.document.validation.impl;
17
18 import java.util.Collection;
19
20 import org.kuali.ole.coa.businessobject.ObjectCodeGlobal;
21 import org.kuali.ole.coa.businessobject.ObjectCodeGlobalDetail;
22 import org.kuali.ole.sys.context.SpringContext;
23 import org.kuali.rice.kns.document.MaintenanceDocument;
24 import org.kuali.rice.kns.service.MaintenanceDocumentDictionaryService;
25
26
27
28
29 public class ObjectCodeGlobalPreRules extends MaintenancePreRulesBase {
30
31
32
33
34
35
36
37 protected boolean doCustomPreRules(MaintenanceDocument maintenanceDocument) {
38 ObjectCodeGlobal bo = (ObjectCodeGlobal) maintenanceDocument.getNewMaintainableObject().getBusinessObject();
39
40 Collection<ObjectCodeGlobalDetail> details = bo.getObjectCodeGlobalDetails();
41
42 for (ObjectCodeGlobalDetail detail : details) {
43 if (detail.getUniversityFiscalYear() == null) {
44 if (LOG.isDebugEnabled()) {
45 LOG.debug("setting fiscal year on ObjectCodeGlobalDetail: " + detail);
46 }
47 detail.setUniversityFiscalYear(new Integer(SpringContext.getBean(MaintenanceDocumentDictionaryService.class).getCollectionFieldDefaultValue(maintenanceDocument.getDocumentHeader().getWorkflowDocument().getDocumentTypeName(), "objectCodeGlobalDetails", "universityFiscalYear")));
48 }
49 }
50
51 return true;
52 }
53 }