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 ObjectCodeDynamicNameLabelGeneratorImpl 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.getFinancialObjectCode())) {
31 line.refreshReferenceObject("objectCode");
32 if (!ObjectUtils.isNull(line.getObjectCode())) return line.getObjectCode().getFinancialObjectCodeName();
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("loadObjectInfo( '");
44 onBlur.append(line.getPostingYear());
45 onBlur.append("', '");
46 onBlur.append(accountingLineProperty+".objectType.name");
47 onBlur.append("', '");
48 onBlur.append(accountingLineProperty+".objectTypeCode");
49 onBlur.append("', ");
50 onBlur.append("this.name, '");
51 onBlur.append(getDynamicNameLabelFieldName(line, accountingLineProperty));
52 onBlur.append("' );");
53 return onBlur.toString();
54 }
55
56
57
58
59
60 public String getDynamicNameLabelFieldName(AccountingLine line, String accountingLineProperty) {
61 return accountingLineProperty+".objectCode.financialObjectCodeName";
62 }
63
64 }