| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.core.academiccalendar.dto; |
| 17 | |
|
| 18 | |
import java.io.Serializable; |
| 19 | |
import java.util.Date; |
| 20 | |
import java.util.List; |
| 21 | |
import java.util.ArrayList; |
| 22 | |
import org.w3c.dom.Element; |
| 23 | |
|
| 24 | |
import javax.xml.bind.annotation.XmlAccessType; |
| 25 | |
import javax.xml.bind.annotation.XmlAccessorType; |
| 26 | |
import javax.xml.bind.annotation.XmlAnyElement; |
| 27 | |
import javax.xml.bind.annotation.XmlAttribute; |
| 28 | |
import javax.xml.bind.annotation.XmlElement; |
| 29 | |
import javax.xml.bind.annotation.XmlType; |
| 30 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| 31 | |
|
| 32 | |
import org.kuali.student.common.infc.ModelBuilder; |
| 33 | |
import org.kuali.student.common.dto.KeyEntityInfo; |
| 34 | |
import org.kuali.student.core.academiccalendar.infc.TermInfc; |
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
@XmlAccessorType(XmlAccessType.FIELD) |
| 45 | |
@XmlType(name = "TermCalendarInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "startDate", "endDate", "terms", "metaInfo", "attributes", "_futureElements"}) |
| 46 | |
public class TermInfo extends KeyEntityInfo implements TermInfc, Serializable { |
| 47 | |
|
| 48 | |
private static final long serialVersionUID = 1L; |
| 49 | |
|
| 50 | |
@XmlElement |
| 51 | |
private final Date startDate; |
| 52 | |
|
| 53 | |
@XmlElement |
| 54 | |
private final Date endDate; |
| 55 | |
|
| 56 | |
@XmlElement |
| 57 | |
private final List<TermInfo> terms; |
| 58 | |
|
| 59 | |
@XmlAnyElement |
| 60 | |
private final List<Element> _futureElements; |
| 61 | |
|
| 62 | 0 | private TermInfo() { |
| 63 | 0 | startDate = null; |
| 64 | 0 | endDate = null; |
| 65 | 0 | terms = null; |
| 66 | 0 | _futureElements = null; |
| 67 | 0 | } |
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
public TermInfo(TermInfc term) { |
| 76 | 0 | super(term); |
| 77 | 0 | this.startDate = null != term.getStartDate() ? new Date(term.getStartDate().getTime()) : null; |
| 78 | 0 | this.endDate = null != term.getEndDate() ? new Date(term.getEndDate().getTime()) : null; |
| 79 | |
|
| 80 | 0 | if (term.getTerms() != null) { |
| 81 | 0 | this.terms = new ArrayList<TermInfo>(term.getTerms().size()); |
| 82 | 0 | for (TermInfc t : term.getTerms()) { |
| 83 | 0 | this.terms.add(new TermInfo(t)); |
| 84 | |
} |
| 85 | |
} else { |
| 86 | 0 | this.terms = new ArrayList<TermInfo>(); |
| 87 | |
} |
| 88 | 0 | _futureElements = null; |
| 89 | 0 | } |
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
|
| 94 | |
|
| 95 | |
|
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | |
@Override |
| 103 | |
public Date getStartDate() { |
| 104 | 0 | return startDate; |
| 105 | |
} |
| 106 | |
|
| 107 | |
|
| 108 | |
|
| 109 | |
|
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | |
@Override |
| 120 | |
public Date getEndDate() { |
| 121 | 0 | return endDate; |
| 122 | |
} |
| 123 | |
|
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
@Override |
| 130 | |
public List<TermInfo> getTerms() { |
| 131 | 0 | return terms; |
| 132 | |
} |
| 133 | |
|
| 134 | |
|
| 135 | |
|
| 136 | |
|
| 137 | 0 | public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<TermInfo>, TermInfc { |
| 138 | |
|
| 139 | |
private Date startDate; |
| 140 | |
private Date endDate; |
| 141 | |
private List<TermInfo> terms; |
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
|
| 146 | 0 | public Builder() {} |
| 147 | |
|
| 148 | |
|
| 149 | |
|
| 150 | |
|
| 151 | |
public Builder(TermInfc term) { |
| 152 | 0 | super(term); |
| 153 | 0 | this.startDate = term.getStartDate(); |
| 154 | 0 | this.startDate = term.getEndDate(); |
| 155 | 0 | if (term.getTerms() != null) { |
| 156 | 0 | this.terms = new ArrayList(term.getTerms().size()); |
| 157 | 0 | for (TermInfc t : term.getTerms()) { |
| 158 | 0 | this.terms.add(new TermInfo(t)); |
| 159 | |
} |
| 160 | |
} |
| 161 | 0 | } |
| 162 | |
|
| 163 | |
|
| 164 | |
|
| 165 | |
|
| 166 | |
|
| 167 | |
|
| 168 | |
public TermInfo build() { |
| 169 | 0 | return new TermInfo(this); |
| 170 | |
} |
| 171 | |
|
| 172 | |
|
| 173 | |
|
| 174 | |
|
| 175 | |
|
| 176 | |
|
| 177 | |
@Override |
| 178 | |
public Date getStartDate() { |
| 179 | 0 | return startDate; |
| 180 | |
} |
| 181 | |
|
| 182 | |
|
| 183 | |
|
| 184 | |
|
| 185 | |
|
| 186 | |
|
| 187 | |
public void setStartDate(Date startDate) { |
| 188 | 0 | this.startDate = startDate; |
| 189 | 0 | } |
| 190 | |
|
| 191 | |
|
| 192 | |
|
| 193 | |
|
| 194 | |
|
| 195 | |
|
| 196 | |
@Override |
| 197 | |
public Date getEndDate() { |
| 198 | 0 | return endDate; |
| 199 | |
} |
| 200 | |
|
| 201 | |
|
| 202 | |
|
| 203 | |
|
| 204 | |
|
| 205 | |
|
| 206 | |
|
| 207 | |
public void setEndDate(Date endDate) { |
| 208 | 0 | this.endDate = endDate; |
| 209 | 0 | } |
| 210 | |
|
| 211 | |
|
| 212 | |
|
| 213 | |
|
| 214 | |
@Override |
| 215 | |
public List<TermInfo> getTerms() { |
| 216 | 0 | return terms; |
| 217 | |
} |
| 218 | |
|
| 219 | |
public void setTerms(List<TermInfo> terms) { |
| 220 | 0 | this.terms = terms; |
| 221 | 0 | } |
| 222 | |
} |
| 223 | |
} |