1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.document.service.impl;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.ole.sys.businessobject.AccountingLine;
20 import org.kuali.ole.sys.document.service.DynamicNameLabelGenerator;
21 import org.kuali.rice.krad.util.ObjectUtils;
22
23 public class SubObjectCodeDynamicNameLabelGeneratorImpl implements DynamicNameLabelGenerator {
24
25
26
27
28
29 public String getDynamicNameLabelValue(AccountingLine line, String accountingLineProperty) {
30 if (line.getPostingYear() != null && !StringUtils.isBlank(line.getChartOfAccountsCode()) && !StringUtils.isBlank(line.getFinancialSubObjectCode())) {
31 line.refreshReferenceObject("subObjectCode");
32 if (!ObjectUtils.isNull(line.getSubObjectCode())) return line.getSubObjectCode().getFinancialSubObjectCodeName();
33 }
34 return null;
35 }
36
37
38
39
40
41 public String getDynamicNameLabelOnBlur(AccountingLine line, String accountingLineProperty) {
42 StringBuilder onBlur = new StringBuilder();
43 onBlur.append("loadSubObjectInfo( '");
44 onBlur.append(line.getPostingYear());
45 onBlur.append("', ");
46 onBlur.append("this.name, '");
47 onBlur.append(getDynamicNameLabelFieldName(line, accountingLineProperty));
48 onBlur.append("' );");
49 return onBlur.toString();
50 }
51
52
53
54
55
56 public String getDynamicNameLabelFieldName(AccountingLine line, String accountingLineProperty) {
57 return accountingLineProperty+".subObjectCode.financialSubObjectCodeName";
58 }
59
60 }