001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     * http://www.opensource.org/licenses/ecl2.php
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 implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.kfs.sys.businessobject;
017    
018    import java.util.LinkedHashMap;
019    
020    import org.kuali.kfs.sys.context.SpringContext;
021    import org.kuali.rice.kns.service.CountryService;
022    import org.kuali.rice.kns.service.CountyService;
023    import org.kuali.rice.kns.bo.Country;
024    import org.kuali.rice.kns.bo.County;
025    import org.kuali.rice.kns.bo.Inactivateable;
026    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
027    
028    public class TaxRegionCounty extends PersistableBusinessObjectBase implements Inactivateable {
029            
030        private String postalCountryCode;
031            private String countyCode;
032            private String stateCode;
033            private String taxRegionCode;
034            private boolean active;
035            
036            private Country country;
037            private County county;
038            private TaxRegion taxRegion;
039            
040            public String getCountyCode() {
041                    return countyCode;
042            }
043            public void setCountyCode(String countyCode) {
044                    this.countyCode = countyCode;
045            }
046            public boolean isActive() {
047                    return active;
048            }
049            public void setActive(boolean active) {
050                    this.active = active;
051            }
052            public TaxRegion getTaxRegion() {
053            return taxRegion;
054        }
055        public void setTaxRegion(TaxRegion taxRegion) {
056            this.taxRegion = taxRegion;
057        }
058        public String getStateCode() {
059                    return stateCode;
060            }
061            public void setStateCode(String stateCode) {
062                    this.stateCode = stateCode;
063            }
064            public String getTaxRegionCode() {
065                    return taxRegionCode;
066            }
067            public void setTaxRegionCode(String taxRegionCode) {
068                    this.taxRegionCode = taxRegionCode;
069            }
070            
071        protected LinkedHashMap toStringMapper() {
072            LinkedHashMap m = new LinkedHashMap();
073            m.put("countyCode", this.countyCode);
074            m.put("stateCode", this.stateCode);
075            m.put("taxRegionCode", this.taxRegionCode);
076            return m;
077        }
078            public County getCounty() {
079                county = SpringContext.getBean(CountyService.class).getByPrimaryIdIfNecessary(postalCountryCode, stateCode, countyCode, county);
080                    return county;
081            }
082            public void setCounty(County county) {
083                    this.county = county;
084            }
085        /**
086         * Gets the postalCountryCode attribute. 
087         * @return Returns the postalCountryCode.
088         */
089        public String getPostalCountryCode() {
090            return postalCountryCode;
091        }
092        /**
093         * Sets the postalCountryCode attribute value.
094         * @param postalCountryCode The postalCountryCode to set.
095         */
096        public void setPostalCountryCode(String postalCountryCode) {
097            this.postalCountryCode = postalCountryCode;
098        }
099        /**
100         * Gets the country attribute. 
101         * @return Returns the country.
102         */
103        public Country getCountry() {
104            country = SpringContext.getBean(CountryService.class).getByPrimaryIdIfNecessary(postalCountryCode, country);
105            return country;
106        }
107        /**
108         * Sets the country attribute value.
109         * @param country The country to set.
110         */
111        public void setCountry(Country country) {
112            this.country = country;
113        }
114    }