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    
017    package org.kuali.kfs.vnd.businessobject;
018    
019    import java.util.LinkedHashMap;
020    import java.util.List;
021    
022    import org.kuali.rice.kns.bo.Country;
023    import org.kuali.rice.kns.bo.State;
024    import org.kuali.kfs.sys.context.SpringContext;
025    import org.kuali.rice.kns.service.CountryService;
026    import org.kuali.rice.kns.service.StateService;
027    import org.kuali.rice.kns.bo.Inactivateable;
028    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
029    import org.kuali.rice.kns.util.TypedArrayList;
030    
031    /**
032     * Container for information about how to get in Contact with a person at a Vendor for a particular purpose.
033     */
034    public class VendorContact extends PersistableBusinessObjectBase implements Inactivateable {
035    
036        private Integer vendorContactGeneratedIdentifier;
037        private Integer vendorHeaderGeneratedIdentifier;
038        private Integer vendorDetailAssignedIdentifier;
039        private String vendorContactTypeCode;
040        private String vendorContactName;
041        private String vendorContactEmailAddress;
042        private String vendorContactCommentText;
043        private String vendorLine1Address;
044        private String vendorLine2Address;
045        private String vendorCityName;
046        private String vendorStateCode;
047        private String vendorZipCode;
048        private String vendorCountryCode;
049        private String vendorAttentionName;
050        private String vendorAddressInternationalProvinceName;
051        private boolean active;
052    
053        // These aren't persisted in db, only for lookup page
054        private String phoneNumberForLookup;
055        private String tollFreeForLookup;
056        private String faxForLookup;
057    
058        private List<VendorContactPhoneNumber> vendorContactPhoneNumbers;
059    
060        private VendorDetail vendorDetail;
061        private ContactType vendorContactType;
062        private State vendorState;
063        private Country vendorCountry;
064    
065        /**
066         * Default constructor.
067         */
068        public VendorContact() {
069            vendorContactPhoneNumbers = new TypedArrayList(VendorContactPhoneNumber.class);
070        }
071    
072        public Integer getVendorContactGeneratedIdentifier() {
073            return vendorContactGeneratedIdentifier;
074        }
075    
076        public void setVendorContactGeneratedIdentifier(Integer vendorContactGeneratedIdentifier) {
077            this.vendorContactGeneratedIdentifier = vendorContactGeneratedIdentifier;
078        }
079    
080        public Integer getVendorHeaderGeneratedIdentifier() {
081            return vendorHeaderGeneratedIdentifier;
082        }
083    
084        public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) {
085            this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
086        }
087    
088        public Integer getVendorDetailAssignedIdentifier() {
089            return vendorDetailAssignedIdentifier;
090        }
091    
092        public void setVendorDetailAssignedIdentifier(Integer vendorDetailAssignedIdentifier) {
093            this.vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
094        }
095    
096        public String getVendorContactTypeCode() {
097            return vendorContactTypeCode;
098        }
099    
100        public void setVendorContactTypeCode(String vendorContactTypeCode) {
101            this.vendorContactTypeCode = vendorContactTypeCode;
102        }
103    
104        public String getVendorContactName() {
105            return vendorContactName;
106        }
107    
108        public void setVendorContactName(String vendorContactName) {
109            this.vendorContactName = vendorContactName;
110        }
111    
112        public String getVendorContactEmailAddress() {
113            return vendorContactEmailAddress;
114        }
115    
116        public void setVendorContactEmailAddress(String vendorContactEmailAddress) {
117            this.vendorContactEmailAddress = vendorContactEmailAddress;
118        }
119    
120        public String getVendorContactCommentText() {
121            return vendorContactCommentText;
122        }
123    
124        public void setVendorContactCommentText(String vendorContactCommentText) {
125            this.vendorContactCommentText = vendorContactCommentText;
126        }
127    
128        public ContactType getVendorContactType() {
129            return vendorContactType;
130        }
131    
132        /**
133         * Sets the vendorContactType attribute.
134         * 
135         * @param vendorContactType The vendorContactType to set.
136         * @deprecated
137         */
138        public void setVendorContactType(ContactType vendorContactType) {
139            this.vendorContactType = vendorContactType;
140        }
141    
142        public VendorDetail getVendorDetail() {
143            return vendorDetail;
144        }
145    
146        public void setVendorDetail(VendorDetail vendorDetail) {
147            this.vendorDetail = vendorDetail;
148        }
149    
150        public String getVendorAddressInternationalProvinceName() {
151            return vendorAddressInternationalProvinceName;
152        }
153    
154        public void setVendorAddressInternationalProvinceName(String vendorAddressInternationalProvinceName) {
155            this.vendorAddressInternationalProvinceName = vendorAddressInternationalProvinceName;
156        }
157    
158        public boolean isActive() {
159            return active;
160        }
161    
162        public void setActive(boolean active) {
163            this.active = active;
164        }
165    
166        public String getVendorAttentionName() {
167            return vendorAttentionName;
168        }
169    
170        public void setVendorAttentionName(String vendorAttentionName) {
171            this.vendorAttentionName = vendorAttentionName;
172        }
173    
174        public String getVendorCityName() {
175            return vendorCityName;
176        }
177    
178        public void setVendorCityName(String vendorCityName) {
179            this.vendorCityName = vendorCityName;
180        }
181    
182        public String getVendorCountryCode() {
183            return vendorCountryCode;
184        }
185    
186        public void setVendorCountryCode(String vendorCountryCode) {
187            this.vendorCountryCode = vendorCountryCode;
188        }
189    
190        public String getVendorLine1Address() {
191            return vendorLine1Address;
192        }
193    
194        public void setVendorLine1Address(String vendorLine1Address) {
195            this.vendorLine1Address = vendorLine1Address;
196        }
197    
198        public String getVendorLine2Address() {
199            return vendorLine2Address;
200        }
201    
202        public void setVendorLine2Address(String vendorLine2Address) {
203            this.vendorLine2Address = vendorLine2Address;
204        }
205    
206        public String getVendorStateCode() {
207            return vendorStateCode;
208        }
209    
210        public void setVendorStateCode(String vendorStateCode) {
211            this.vendorStateCode = vendorStateCode;
212        }
213    
214        public String getVendorZipCode() {
215            return vendorZipCode;
216        }
217    
218        public void setVendorZipCode(String vendorZipCode) {
219            this.vendorZipCode = vendorZipCode;
220        }
221    
222        public Country getVendorCountry() {
223            vendorCountry = SpringContext.getBean(CountryService.class).getByPrimaryIdIfNecessary(vendorCountryCode, vendorCountry);
224            return vendorCountry;
225        }
226    
227        /**
228         * Sets the vendorCountry attribute value.
229         * 
230         * @param vendorCountry The vendorCountry to set.
231         * @deprecated
232         */
233        public void setVendorCountry(Country vendorCountry) {
234            this.vendorCountry = vendorCountry;
235        }
236    
237        public State getVendorState() {
238            vendorState = SpringContext.getBean(StateService.class).getByPrimaryIdIfNecessary(vendorCountryCode, vendorStateCode, vendorState);
239            return vendorState;
240        }
241    
242        /**
243         * Sets the vendorState attribute value.
244         * 
245         * @param vendorState The vendorState to set.
246         * @deprecated
247         */
248        public void setVendorState(State vendorState) {
249            this.vendorState = vendorState;
250        }
251    
252        public String getFaxForLookup() {
253            return faxForLookup;
254        }
255    
256        public void setFaxForLookup(String faxForLookup) {
257            this.faxForLookup = faxForLookup;
258        }
259    
260        public String getPhoneNumberForLookup() {
261            return phoneNumberForLookup;
262        }
263    
264        public void setPhoneNumberForLookup(String phoneNumberForLookup) {
265            this.phoneNumberForLookup = phoneNumberForLookup;
266        }
267    
268        public String getTollFreeForLookup() {
269            return tollFreeForLookup;
270        }
271    
272        public void setTollFreeForLookup(String tollFreeForLookup) {
273            this.tollFreeForLookup = tollFreeForLookup;
274        }
275    
276        /**
277         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
278         */
279        protected LinkedHashMap toStringMapper() {
280            LinkedHashMap m = new LinkedHashMap();
281            if (this.vendorContactGeneratedIdentifier != null) {
282                m.put("vendorContactGeneratedIdentifier", this.vendorContactGeneratedIdentifier.toString());
283            }
284            return m;
285        }
286    
287        public List<VendorContactPhoneNumber> getVendorContactPhoneNumbers() {
288            return vendorContactPhoneNumbers;
289        }
290    
291        public void setVendorContactPhoneNumbers(List<VendorContactPhoneNumber> vendorContactPhoneNumbers) {
292            this.vendorContactPhoneNumbers = vendorContactPhoneNumbers;
293        }
294    
295    }