1 | |
package org.kuali.student.common.ui.client.util; |
2 | |
|
3 | |
import java.io.Serializable; |
4 | |
import java.util.List; |
5 | |
|
6 | |
public class ExportElement implements Serializable { |
7 | |
|
8 | |
private static final long serialVersionUID = 1L; |
9 | |
private String fieldLabel; |
10 | |
private boolean isMandatory; |
11 | 34 | private int printType = -1; |
12 | |
|
13 | |
private String fieldValue; |
14 | |
private String fieldValue2; |
15 | |
private String viewName; |
16 | |
|
17 | |
|
18 | 1 | public static int DEFAULT = 0; |
19 | 1 | public static int BOLD = 1; |
20 | 1 | public static int LIST_SUBREPORT = 2; |
21 | 1 | public static int SUBREPORT = 3; |
22 | 1 | public static int LIST = 4; |
23 | 1 | public static int ITALIC = 5; |
24 | 1 | public static int PROPOSAL = 6; |
25 | |
|
26 | |
public ExportElement() { |
27 | 34 | super(); |
28 | 34 | } |
29 | |
|
30 | |
public ExportElement(String viewName, String sectionName) { |
31 | 0 | super(); |
32 | 0 | this.viewName = viewName; |
33 | 0 | this.sectionName = sectionName; |
34 | 0 | } |
35 | |
|
36 | |
private String sectionName; |
37 | |
private List<ExportElement> subset; |
38 | |
|
39 | |
public String getViewName() { |
40 | 0 | return viewName; |
41 | |
} |
42 | |
|
43 | |
public void setViewName(String viewName) { |
44 | 0 | this.viewName = viewName; |
45 | 0 | } |
46 | |
|
47 | |
public String getSectionName() { |
48 | 112 | return sectionName; |
49 | |
} |
50 | |
|
51 | |
public void setSectionName(String sectionName) { |
52 | 18 | this.sectionName = sectionName; |
53 | 18 | } |
54 | |
|
55 | |
public String getFieldLabel() { |
56 | 124 | return fieldLabel; |
57 | |
} |
58 | |
|
59 | |
public void setFieldLabel(String fieldLabel) { |
60 | 22 | this.fieldLabel = fieldLabel; |
61 | 22 | } |
62 | |
|
63 | |
public String getFieldValue() { |
64 | 142 | return this.fieldValue; |
65 | |
} |
66 | |
|
67 | |
public void setFieldValue(String fieldValue) { |
68 | 25 | this.fieldValue = fieldValue; |
69 | 25 | } |
70 | |
|
71 | |
public boolean isSub() { |
72 | 60 | return subset != null; |
73 | |
} |
74 | |
|
75 | |
public void setPrintType(int printType) { |
76 | 0 | this.printType = printType; |
77 | 0 | } |
78 | |
|
79 | |
public int getPrintType() { |
80 | 54 | if (this.printType != -1) { |
81 | 0 | if (this.printType == LIST && this.getSubset() != null){ |
82 | 0 | return LIST_SUBREPORT; |
83 | |
} |
84 | 0 | return this.printType; |
85 | 54 | } else if (this.getSubset() != null && this.getValue().equals( "" )) { |
86 | 10 | return SUBREPORT; |
87 | |
} |
88 | 44 | return DEFAULT; |
89 | |
} |
90 | |
|
91 | |
public List<ExportElement> getSubset() { |
92 | 118 | return subset; |
93 | |
} |
94 | |
|
95 | |
public void setSubset(List<ExportElement> subset) { |
96 | 7 | if (subset != null && subset.size() > 0) { |
97 | 7 | this.subset = subset; |
98 | |
} |
99 | 7 | } |
100 | |
|
101 | |
public boolean isMandatory() { |
102 | 64 | return isMandatory; |
103 | |
} |
104 | |
|
105 | |
public void setMandatory(boolean isMandatory) { |
106 | 4 | this.isMandatory = isMandatory; |
107 | 4 | } |
108 | |
|
109 | |
public String getFieldValue2() { |
110 | 72 | return fieldValue2; |
111 | |
} |
112 | |
|
113 | |
public void setFieldValue2(String fieldValue2) { |
114 | 14 | this.fieldValue2 = fieldValue2; |
115 | 14 | } |
116 | |
|
117 | |
public String getKey() { |
118 | 64 | if (this.getFieldLabel() != null) { |
119 | 60 | return this.getFieldLabel(); |
120 | |
} |
121 | 4 | return ""; |
122 | |
} |
123 | |
|
124 | |
public String getValue() { |
125 | 71 | if (this.getFieldValue() != null) { |
126 | 51 | return getFieldValue(); |
127 | |
} |
128 | 20 | return ""; |
129 | |
} |
130 | |
|
131 | |
public String getProposalValue() { |
132 | 11 | if (this.getFieldValue() != null) { |
133 | 9 | return getFieldValue(); |
134 | |
} |
135 | 2 | return ""; |
136 | |
} |
137 | |
|
138 | |
public String getOriginalValue() { |
139 | 11 | if (this.getFieldValue2() != null) { |
140 | 7 | return this.getFieldValue2(); |
141 | |
} |
142 | 4 | return ""; |
143 | |
} |
144 | |
|
145 | |
public boolean isDataEmpty() { |
146 | 0 | if ((this.fieldLabel == null) && (this.fieldValue == null) && (this.fieldValue2 == null)) { |
147 | 0 | return true; |
148 | |
} |
149 | 0 | return false; |
150 | |
} |
151 | |
|
152 | |
public boolean isEmpty() { |
153 | 149 | if ((this.fieldLabel == null) && (this.fieldValue == null) && (this.fieldValue2 == null) && (this.subset == null)) { |
154 | 7 | return true; |
155 | |
} |
156 | 142 | return false; |
157 | |
} |
158 | |
|
159 | |
public String toString() { |
160 | 0 | return this.sectionName + " - " + this.viewName + " - " + this.getFieldLabel() + " - " + this.getFieldValue() + " - " + this.getFieldValue2(); |
161 | |
} |
162 | |
|
163 | |
} |