1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.document.datadictionary;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.kuali.ole.sys.businessobject.AccountingLine;
22 import org.kuali.ole.sys.document.web.AccountingLineViewLineFillingElement;
23 import org.kuali.ole.sys.document.web.AccountingLineViewLines;
24 import org.kuali.ole.sys.document.web.TableJoining;
25 import org.kuali.rice.krad.datadictionary.DataDictionaryDefinitionBase;
26 import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException;
27
28
29
30
31 public class AccountingLineViewLinesDefinition extends DataDictionaryDefinitionBase implements AccountingLineViewRenderableElementDefinition {
32 private List<AccountingLineViewLineFillingDefinition> lines;
33 private String elementName;
34
35
36
37
38
39
40 public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {
41 if (lines == null || lines.size() == 0) {
42 throw new AttributeValidationException("Please specify at least one child line for the lines definition");
43 }
44 }
45
46
47
48
49
50 public List<AccountingLineViewLineFillingDefinition> getLines() {
51 return lines;
52 }
53
54
55
56
57
58 public void setLines(List<AccountingLineViewLineFillingDefinition> lines) {
59 this.lines = lines;
60 }
61
62
63
64
65
66 public String getElementName() {
67 return elementName;
68 }
69
70
71
72
73
74 public void setElementName(String elementName) {
75 this.elementName = elementName;
76 }
77
78
79
80
81 public TableJoining createLayoutElement(Class<? extends AccountingLine> accountingLineClass) {
82 AccountingLineViewLines layoutElement = new AccountingLineViewLines();
83 layoutElement.setDefinition(this);
84 layoutElement.setElements(getLayoutElementsForLines(accountingLineClass));
85 return layoutElement;
86 }
87
88
89
90
91
92 protected List<AccountingLineViewLineFillingElement> getLayoutElementsForLines(Class<? extends AccountingLine> accountingLineClass) {
93 List<AccountingLineViewLineFillingElement> elements = new ArrayList<AccountingLineViewLineFillingElement>();
94 for (AccountingLineViewLineFillingDefinition line : lines) {
95 elements.add(line.createLineFillingLayoutElement(accountingLineClass));
96 }
97 return elements;
98 }
99 }