PageRenderTime 283ms CodeModel.GetById 100ms app.highlight 98ms RepoModel.GetById 75ms app.codeStats 0ms

/src/mpv5/db/objects/Address.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 256 lines | 128 code | 34 blank | 94 comment | 9 complexity | 6aad88ad45e68d8ea8b0158b27dc03e2 MD5 | raw file
  1/*
  2 *  This file is part of YaBS.
  3 *
  4 *      YaBS is free software: you can redistribute it and/or modify
  5 *      it under the terms of the GNU General Public License as published by
  6 *      the Free Software Foundation, either version 3 of the License, or
  7 *      (at your option) any later version.
  8 *
  9 *      YaBS is distributed in the hope that it will be useful,
 10 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12 *      GNU General Public License for more details.
 13 *
 14 *      You should have received a copy of the GNU General Public License
 15 *      along with YaBS.  If not, see <http://www.gnu.org/licenses/>.
 16 */
 17package mpv5.db.objects;
 18
 19import java.util.HashMap;
 20
 21import javax.swing.JComponent;
 22import mpv5.db.common.Context;
 23import mpv5.db.common.DatabaseObject;
 24import mpv5.globals.Messages;
 25import mpv5.logging.Log;
 26import mpv5.utils.images.MPIcon;
 27
 28/**
 29 *
 30 *  
 31 */
 32public class Address extends DatabaseObject {
 33
 34    private String taxnumber = "";
 35    private String title = "";
 36    private String prename = "";
 37    private String street = "";
 38    private String zip = "";
 39    private String city = "";
 40    private String company = "";
 41    private String department = "";
 42    private String country = "";
 43    private boolean ismale = true;
 44    private int contactsids = 0;
 45    private int inttype = 2;// [0 = billing adress, 1 = delivery adress, 2 = both, 3 = undefined]
 46    public static final int TYPE_INVOICE = 0;
 47    public static final int TYPE_DELIVERY = 1;
 48    public static final int TYPE_ALL = 2;
 49    public static final int TYPE_NONE = 3;
 50
 51    public Address() {
 52        setContext(Context.getAddress());
 53    }
 54
 55    /**
 56     * @return the taxnumber
 57     */
 58    public String __getTaxnumber() {
 59        return taxnumber;
 60    }
 61
 62    /**
 63     * @param taxnumber the taxnumber to set
 64     */
 65    public void setTaxnumber(String taxnumber) {
 66        this.taxnumber = taxnumber;
 67    }
 68
 69    /**
 70     * @return the title
 71     */
 72    public String __getTitle() {
 73        return title;
 74    }
 75
 76    /**
 77     * @param title the title to set
 78     */
 79    public void setTitle(String title) {
 80        this.title = title;
 81    }
 82
 83    /**
 84     * @return the prename
 85     */
 86    public String __getPrename() {
 87        return prename;
 88    }
 89
 90    /**
 91     * @param prename the prename to set
 92     */
 93    public void setPrename(String prename) {
 94        this.prename = prename;
 95    }
 96
 97    /**
 98     * @return the street
 99     */
100    public String __getStreet() {
101        return street;
102    }
103
104    /**
105     * @param street the street to set
106     */
107    public void setStreet(String street) {
108        this.street = street;
109    }
110
111    /**
112     * @return the zip
113     */
114    public String __getZip() {
115        return zip;
116    }
117
118    /**
119     * @param zip the zip to set
120     */
121    public void setZip(String zip) {
122        this.zip = zip;
123    }
124
125    /**
126     * @return the city
127     */
128    public String __getCity() {
129        return city;
130    }
131
132    /**
133     * @param city the city to set
134     */
135    public void setCity(String city) {
136        this.city = city;
137    }
138
139    /**
140     * @return the company
141     */
142    public String __getCompany() {
143        return company;
144    }
145
146    /**
147     * @param company the company to set
148     */
149    public void setCompany(String company) {
150        this.company = company;
151    }
152
153    /**
154     * @return the department
155     */
156    public String __getDepartment() {
157        return department;
158    }
159
160    /**
161     * @param department the department to set
162     */
163    public void setDepartment(String department) {
164        this.department = department;
165    }
166
167    /**
168     * @return the ismale
169     */
170    public boolean __getIsmale() {
171        return ismale;
172    }
173
174    /**
175     * @param ismale the ismale to set
176     */
177    public void setIsmale(boolean ismale) {
178        this.ismale = ismale;
179    }
180
181    /**
182     * @return the contactsids
183     */
184    public int __getContactsids() {
185        return contactsids;
186    }
187
188    /**
189     * @param contactsids the contactsids to set
190     */
191    public void setContactsids(int contactsids) {
192        this.contactsids = contactsids;
193    }
194
195    /**
196     * @return the country
197     */
198    public String __getCountry() {
199        return country;
200    }
201
202    /**
203     * @param country the country to set
204     */
205    public void setCountry(String country) {
206        this.country = country;
207    }
208
209    @Override
210    public JComponent getView() {
211        throw new UnsupportedOperationException("Not supported yet.");
212    }
213
214    @Override
215    public MPIcon getIcon() {
216        return null;
217    }
218
219    /**
220     * @return the inttype
221     */
222    public int __getInttype() {
223        return inttype;
224    }
225
226    /**
227     * @param inttype the inttype to set
228     */
229    public void setInttype(int inttype) {
230        this.inttype = inttype;
231    }
232
233    @Override
234    public HashMap<String, Object> resolveReferences(HashMap<String, Object> map) {
235        super.resolveReferences(map);
236
237        try {
238            if (map.containsKey("inttype")) {
239                // [0 = billing adress, 1 = delivery adress, 2 = both, 3 = undefined]
240                if (__getInttype() == TYPE_ALL) {
241                    map.put("type", Messages.ADDRESS_TYPE_BOTH);
242                } else if (__getInttype() == TYPE_DELIVERY) {
243                    map.put("type", Messages.ADDRESS_TYPE_DELIVERY);
244                } else if (__getInttype() == TYPE_INVOICE) {
245                    map.put("type", Messages.ADDRESS_TYPE_INVOICE);
246                }
247
248                map.remove("inttype");
249            }
250        } catch (Exception n) {
251            //already resolved?
252            Log.Debug(n);
253        }
254        return map;
255    }
256}