View Javadoc

1   /*
2    * Copyright 2011 The Kuali Foundation 
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with the
6    * License. You may obtain a copy of the License at
7    *
8    * http://www.osedu.org/licenses/ECL-2.0
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.courseregistration.dto;
18  
19  import java.io.Serializable;
20  import java.util.ArrayList;
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.courseregistration.infc.RegistrationRequest;
30  import org.kuali.student.enrollment.courseregistration.infc.RegistrationRequestItem;
31  import org.kuali.student.r2.common.dto.IdEntityInfo;
32  import org.w3c.dom.Element;
33  
34  @XmlAccessorType(XmlAccessType.FIELD)
35  @XmlType(name = "RegistrationRequestInfo", propOrder = {
36                  "id", "name", "descr", "typeKey", "stateKey", 
37                  "requestorId", "termId", "registrationRequestItems", 
38                  "meta", "attributes", "_futureElements"})
39  
40  public class RegistrationRequestInfo 
41      extends IdEntityInfo 
42      implements RegistrationRequest, Serializable {
43  
44      private static final long serialVersionUID = 1L;
45  
46      @XmlElement
47      private String requestorId;
48  
49      @XmlElement
50      private String termId;
51  
52      @XmlElement
53      private List<RegistrationRequestItemInfo> registrationRequestItems;
54  
55      @XmlAnyElement
56      private List<Element> _futureElements;
57  
58  
59      /**
60       * Constructs a new RegistrationRequestInfo.
61       */
62      public RegistrationRequestInfo() { 
63      }
64  
65      /**
66       * Constructs a new RegistrationRequestInfo from another
67       * RegistrationRequest.
68       *
69       * @param registrationRequest the RegistrationRequest to copy
70       */
71      public RegistrationRequestInfo(RegistrationRequest registrationRequest) {
72          super(registrationRequest);
73  
74          if (registrationRequest != null) {
75              this.requestorId = registrationRequest.getRequestorId();
76              this.termId = registrationRequest.getTermId();
77              this.registrationRequestItems = new ArrayList<RegistrationRequestItemInfo>();
78        
79              for (RegistrationRequestItem registrationRequestItem : registrationRequest.getRegistrationRequestItems()) {
80                  this.registrationRequestItems.add(new RegistrationRequestItemInfo(registrationRequestItem));
81              }
82          }
83      }
84  
85      @Override
86      public String getRequestorId() {
87          return requestorId;
88      }
89  
90      public void setRequestorId(String requestorId) {
91          this.requestorId = requestorId;
92      }
93  
94      @Override
95      public String getTermId() {
96          return termId;
97      }
98  
99      public void setTermId(String termId) {
100         this.termId = termId;
101     }
102 
103     @Override
104     public List<RegistrationRequestItemInfo> getRegistrationRequestItems() {
105         if (this.registrationRequestItems == null) {
106             this.registrationRequestItems = new ArrayList<RegistrationRequestItemInfo>();
107         }
108 
109         return registrationRequestItems;
110     }
111 
112     public void setRegistrationRequestItems(List<RegistrationRequestItemInfo> registrationRequestItems) {
113         this.registrationRequestItems = registrationRequestItems;
114     }
115 }