View Javadoc

1   /*
2    * Copyright 2009 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 1.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * 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 implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.student.r2.lum.clu.dto;
17  
18  import org.kuali.student.r2.common.dto.CurrencyAmountInfo;
19  import org.kuali.student.r2.common.dto.HasAttributesAndMetaInfo;
20  import org.kuali.student.r2.common.dto.RichTextInfo;
21  import org.kuali.student.r2.common.infc.CurrencyAmount;
22  import org.kuali.student.r2.lum.clu.infc.Fee;
23  //import org.w3c.dom.Element;
24  
25  import javax.xml.bind.annotation.XmlAccessType;
26  import javax.xml.bind.annotation.XmlAccessorType;
27  import javax.xml.bind.annotation.XmlAnyElement;
28  import javax.xml.bind.annotation.XmlAttribute;
29  import javax.xml.bind.annotation.XmlElement;
30  import javax.xml.bind.annotation.XmlType;
31  import java.io.Serializable;
32  import java.util.ArrayList;
33  import java.util.List;
34  
35  
36  @XmlAccessorType(XmlAccessType.FIELD)
37  @XmlType(name = "FeeInfo", propOrder = {"feeType", "rateType", "feeAmounts",
38          "descr", "key", "meta", "attributes" })//, "_futureElements" }) TODO KSCM-372: Non-GWT translatable code})
39  public class FeeInfo extends HasAttributesAndMetaInfo implements Fee, Serializable {
40  
41      private static final long serialVersionUID = 1L;
42  
43      @XmlElement
44      private String feeType;
45      @XmlElement
46      private String rateType;
47      @XmlElement
48      private List<CurrencyAmountInfo> feeAmounts;
49      @XmlElement
50      private RichTextInfo descr;
51      @XmlAttribute
52      private String key;
53  //    TODO KSCM-372: Non-GWT translatable code
54  //    @XmlAnyElement
55  //    private List<Element> _futureElements;
56  
57      public FeeInfo() {
58          this.feeAmounts = new ArrayList<CurrencyAmountInfo>();
59      }
60  
61      public FeeInfo(Fee fee) {
62          super(fee);
63          if (null != fee) {
64              this.feeType = fee.getFeeType();
65              this.rateType = fee.getRateType();
66              this.feeAmounts = new ArrayList<CurrencyAmountInfo>();
67              for (CurrencyAmount currencyAmount : fee.getFeeAmounts()) {
68                  this.feeAmounts.add(new CurrencyAmountInfo(currencyAmount));
69              }
70              this.key = fee.getKey();
71              this.descr = (null != fee.getDescr()) ? new RichTextInfo(fee.getDescr()) : null;
72          }
73      }
74  
75      @Override
76      public String getFeeType() {
77          return feeType;
78      }
79  
80      public void setFeeType(String feeType) {
81          this.feeType = feeType;
82      }
83  
84  
85      @Override
86      public String getRateType() {
87          return rateType;
88      }
89  
90      public void setRateType(String rateType) {
91          this.rateType = rateType;
92      }
93  
94      @Override
95      public List<CurrencyAmountInfo> getFeeAmounts() {
96          if (feeAmounts == null) {
97              feeAmounts = new ArrayList<CurrencyAmountInfo>(0);
98          }
99          return feeAmounts;
100     }
101 
102     public void setFeeAmounts(List<CurrencyAmountInfo> feeAmounts) {
103         this.feeAmounts = feeAmounts;
104     }
105 
106     @Override
107     public RichTextInfo getDescr() {
108         return descr;
109     }
110 
111     public void setDescr(RichTextInfo descr) {
112         this.descr = descr;
113     }
114 
115     @Override
116     public String getKey() {
117         return key;
118     }
119 
120     public void setId(String key) {
121         this.key = key;
122     }
123 }