001/*
002 * Copyright 2010 The Kuali Foundation 
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the
005 * "License"); you may not use this file except in compliance with the
006 * License. You may obtain a copy of the License at
007 *
008 * http://www.osedu.org/licenses/ECL-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
013 * implied. See the License for the specific language governing
014 * permissions and limitations under the License.
015 */
016
017package org.kuali.student.r2.common.dto;
018
019import java.io.Serializable;
020import java.util.List;
021
022import javax.xml.bind.annotation.XmlAccessType;
023import javax.xml.bind.annotation.XmlAccessorType;
024import javax.xml.bind.annotation.XmlAnyElement;
025import javax.xml.bind.annotation.XmlAttribute;
026import javax.xml.bind.annotation.XmlElement;
027import javax.xml.bind.annotation.XmlType;
028
029import org.kuali.student.r2.common.infc.CurrencyAmount;
030//import org.w3c.dom.Element;
031
032/**
033 * Detailed information about an amount of currency including both the
034 * type of units and the quantity.
035 *
036 * @author Kamal
037 * @since Mon Jan 11 15:20:51 PST 2010
038 */
039
040@XmlAccessorType(XmlAccessType.FIELD)
041@XmlType(name = "CurrencyAmountInfo", propOrder = {
042                "id", "currencyTypeKey", "currencyQuantity",
043                "meta", "_futureElements" }) 
044
045public class CurrencyAmountInfo 
046    implements CurrencyAmount, Serializable {
047
048    private static final long serialVersionUID = 1L;
049
050    @XmlAttribute
051    private String id;
052    
053    @XmlElement
054    private String currencyTypeKey;
055
056    @XmlElement
057    private Integer currencyQuantity;
058    
059    @XmlElement
060    private MetaInfo meta;
061
062    
063    @XmlAnyElement
064    private List<Object> _futureElements;
065
066    /**
067     * Constructs a new CurrencyAmount.
068     */
069    public CurrencyAmountInfo() {
070    }
071
072    /**
073     * Constructs a new CurrencyAmount from another Currency.
074     *
075     * @param currency the currency to copy
076     */   
077    public CurrencyAmountInfo(CurrencyAmount currency) {
078        if (currency != null) {        
079            this.id = currency.getId();
080            this.currencyQuantity = currency.getCurrencyQuantity();
081            this.currencyTypeKey = currency.getCurrencyTypeKey();
082            if (currency.getMeta() != null ) {
083                this.meta = new MetaInfo(currency.getMeta());
084            }
085        }
086    }
087    
088    @Override
089    public String getId() {
090        return id;
091    }
092    
093    public void setId(String id) {
094        this.id = id;
095    }
096
097    @Override
098    public String getCurrencyTypeKey() {
099        return currencyTypeKey;
100    }
101
102    public void setCurrencyTypeKey(String currencyTypeKey) {
103        this.currencyTypeKey = currencyTypeKey;
104    }
105
106    @Override
107    public Integer getCurrencyQuantity() {
108        return currencyQuantity;
109    }
110
111    public void setCurrencyQuantity(Integer currencyQuantity) {
112        this.currencyQuantity = currencyQuantity;
113    }
114        
115    @Override
116    public MetaInfo getMeta() {
117        return this.meta;
118    }
119
120    public void setMeta(MetaInfo metaInfo) {
121        this.meta = metaInfo;
122    }   
123}