View Javadoc

1   /*
2    * Copyright 2010 The Kuali Foundation 
3    *
4    * Licensed under the the Educational Community License, Version 1.0
5    * (the "License"); you may not use this file except in compliance
6    * with the License.  You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl1.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13   * implied.  See the License for the specific language governing
14   * permissions and limitations under the License.
15   */
16  
17  package org.kuali.student.enrollment.lui.dto;
18  
19  import java.io.Serializable;
20  import java.util.Date;
21  import java.util.List;
22  
23  import javax.xml.bind.annotation.XmlAccessType;
24  import javax.xml.bind.annotation.XmlAccessorType;
25  import javax.xml.bind.annotation.XmlAnyElement;
26  import javax.xml.bind.annotation.XmlElement;
27  import javax.xml.bind.annotation.XmlType;
28  
29  import org.kuali.student.enrollment.lui.infc.LuiLuiRelation;
30  import org.kuali.student.r2.common.dto.IdEntityInfo;
31  import org.w3c.dom.Element;
32  
33  @XmlAccessorType(XmlAccessType.FIELD)
34  @XmlType(name = "LuiLuiRelationInfo", propOrder = { "id", "typeKey",
35  		"stateKey", "name", "descr", "luiId", "relatedLuiId", "effectiveDate",
36  		"expirationDate", "meta", "attributes", "_futureElements" })
37  public class LuiLuiRelationInfo 
38      extends IdEntityInfo 
39      implements Serializable, LuiLuiRelation {
40  
41      private static final long serialVersionUID = 1L;
42      
43      @XmlElement
44      private String luiId;
45      
46      @XmlElement
47      private String relatedLuiId;
48      
49      @XmlElement
50      private Date effectiveDate;
51      
52      @XmlElement
53      private Date expirationDate;
54      
55      @XmlAnyElement
56      private List<Element> _futureElements;
57      
58  
59      /**
60       * Constructs a new LuiLuiRelationInfo.
61       */
62      public LuiLuiRelationInfo() {
63      }
64  
65      /**
66       * Constructs a new LuiLuiRelationInfo from another LuiLuiRelation.
67       *
68       * @param llr the LuiLuiRelation to copy.
69       */
70      public LuiLuiRelationInfo(LuiLuiRelation llr) {
71          super(llr);
72          this.luiId = llr.getLuiId();
73          this.relatedLuiId = llr.getRelatedLuiId();
74          this.effectiveDate = null != llr.getEffectiveDate() ? new Date(llr.getEffectiveDate().getTime()) : null;
75          this.expirationDate = null != llr.getExpirationDate() ? new Date(llr.getExpirationDate().getTime()) : null;
76          this._futureElements = null;
77      }
78      
79      @Override
80      public String getLuiId() {
81          return luiId;
82      }
83      
84      public void setLuiId(String luiId) {
85          this.luiId = luiId;
86      }
87      
88      @Override
89      public String getRelatedLuiId() {
90          return relatedLuiId;
91      }
92      
93      public void setRelatedLuiId(String relatedLuiId) {
94          this.relatedLuiId = relatedLuiId;
95      }
96      
97      @Override
98      public Date getEffectiveDate() {
99          return effectiveDate != null ? new Date(effectiveDate.getTime()) : null;
100     }
101     
102     public void setEffectiveDate(Date effectiveDate) {
103         if (effectiveDate != null)
104             this.effectiveDate = new Date(effectiveDate.getTime());
105     }
106     
107     @Override
108     public Date getExpirationDate() {
109         return expirationDate != null ? new Date(expirationDate.getTime()) : null;
110     }
111     
112     public void setExpirationDate(Date expirationDate) {
113         if (expirationDate != null)
114             this.expirationDate = new Date(expirationDate.getTime());
115     }
116 }