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.List;
19  
20  import org.apache.commons.lang.StringUtils;
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.HideShowLayoutElement;
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 AccountingLineViewHideShowLinesDefinition extends DataDictionaryDefinitionBase implements AccountingLineViewLineFillingDefinition {
32      private String label;
33      private String name;
34      private List<AccountingLineViewLineFillingDefinition> lines;
35  
36      
37  
38  
39  
40      public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {
41          if (StringUtils.isBlank(name)) {
42              throw new AttributeValidationException("Please specify a name for the Hide/Show lines element");
43          }
44          if (lines == null || lines.size() == 0) {
45              throw new AttributeValidationException("Please specify at least one child line for the Hide/Show lines element");
46          }
47      }
48  
49      
50  
51  
52      public TableJoining createLayoutElement(Class<? extends AccountingLine> accountingLineClass) {
53          HideShowLayoutElement hideShowElement = new HideShowLayoutElement();
54          hideShowElement.setDefinition(this);
55          for (AccountingLineViewLineFillingDefinition line : lines) {
56              hideShowElement.addLine(line.createLineFillingLayoutElement(accountingLineClass));
57          }
58          return hideShowElement;
59      }
60  
61      
62  
63  
64      public AccountingLineViewLineFillingElement createLineFillingLayoutElement(Class<? extends AccountingLine> accountingLineClass) {
65          return (AccountingLineViewLineFillingElement)createLayoutElement(accountingLineClass);
66      }
67  
68      
69  
70  
71  
72      public String getLabel() {
73          return label;
74      }
75  
76      
77  
78  
79  
80      public void setLabel(String label) {
81          this.label = label;
82      }
83  
84      
85  
86  
87  
88      public List<AccountingLineViewLineFillingDefinition> getLines() {
89          return lines;
90      }
91  
92      
93  
94  
95  
96      public void setLines(List<AccountingLineViewLineFillingDefinition> lines) {
97          this.lines = lines;
98      }
99  
100     
101 
102 
103 
104     public String getName() {
105         return name;
106     }
107 
108     
109 
110 
111 
112     public void setName(String name) {
113         this.name = name;
114     }
115     
116 }