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