PageRenderTime 28ms CodeModel.GetById 17ms RepoModel.GetById 1ms 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
Possible License(s): LGPL-3.0, Apache-2.0, GPL-3.0, GPL-2.0, AGPL-3.0, JSON, BSD-3-Clause
  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. */
  17. package mpv5.db.objects;
  18. import java.util.HashMap;
  19. import javax.swing.JComponent;
  20. import mpv5.db.common.Context;
  21. import mpv5.db.common.DatabaseObject;
  22. import mpv5.globals.Messages;
  23. import mpv5.logging.Log;
  24. import mpv5.utils.images.MPIcon;
  25. /**
  26. *
  27. *
  28. */
  29. public class Address extends DatabaseObject {
  30. private String taxnumber = "";
  31. private String title = "";
  32. private String prename = "";
  33. private String street = "";
  34. private String zip = "";
  35. private String city = "";
  36. private String company = "";
  37. private String department = "";
  38. private String country = "";
  39. private boolean ismale = true;
  40. private int contactsids = 0;
  41. private int inttype = 2;// [0 = billing adress, 1 = delivery adress, 2 = both, 3 = undefined]
  42. public static final int TYPE_INVOICE = 0;
  43. public static final int TYPE_DELIVERY = 1;
  44. public static final int TYPE_ALL = 2;
  45. public static final int TYPE_NONE = 3;
  46. public Address() {
  47. setContext(Context.getAddress());
  48. }
  49. /**
  50. * @return the taxnumber
  51. */
  52. public String __getTaxnumber() {
  53. return taxnumber;
  54. }
  55. /**
  56. * @param taxnumber the taxnumber to set
  57. */
  58. public void setTaxnumber(String taxnumber) {
  59. this.taxnumber = taxnumber;
  60. }
  61. /**
  62. * @return the title
  63. */
  64. public String __getTitle() {
  65. return title;
  66. }
  67. /**
  68. * @param title the title to set
  69. */
  70. public void setTitle(String title) {
  71. this.title = title;
  72. }
  73. /**
  74. * @return the prename
  75. */
  76. public String __getPrename() {
  77. return prename;
  78. }
  79. /**
  80. * @param prename the prename to set
  81. */
  82. public void setPrename(String prename) {
  83. this.prename = prename;
  84. }
  85. /**
  86. * @return the street
  87. */
  88. public String __getStreet() {
  89. return street;
  90. }
  91. /**
  92. * @param street the street to set
  93. */
  94. public void setStreet(String street) {
  95. this.street = street;
  96. }
  97. /**
  98. * @return the zip
  99. */
  100. public String __getZip() {
  101. return zip;
  102. }
  103. /**
  104. * @param zip the zip to set
  105. */
  106. public void setZip(String zip) {
  107. this.zip = zip;
  108. }
  109. /**
  110. * @return the city
  111. */
  112. public String __getCity() {
  113. return city;
  114. }
  115. /**
  116. * @param city the city to set
  117. */
  118. public void setCity(String city) {
  119. this.city = city;
  120. }
  121. /**
  122. * @return the company
  123. */
  124. public String __getCompany() {
  125. return company;
  126. }
  127. /**
  128. * @param company the company to set
  129. */
  130. public void setCompany(String company) {
  131. this.company = company;
  132. }
  133. /**
  134. * @return the department
  135. */
  136. public String __getDepartment() {
  137. return department;
  138. }
  139. /**
  140. * @param department the department to set
  141. */
  142. public void setDepartment(String department) {
  143. this.department = department;
  144. }
  145. /**
  146. * @return the ismale
  147. */
  148. public boolean __getIsmale() {
  149. return ismale;
  150. }
  151. /**
  152. * @param ismale the ismale to set
  153. */
  154. public void setIsmale(boolean ismale) {
  155. this.ismale = ismale;
  156. }
  157. /**
  158. * @return the contactsids
  159. */
  160. public int __getContactsids() {
  161. return contactsids;
  162. }
  163. /**
  164. * @param contactsids the contactsids to set
  165. */
  166. public void setContactsids(int contactsids) {
  167. this.contactsids = contactsids;
  168. }
  169. /**
  170. * @return the country
  171. */
  172. public String __getCountry() {
  173. return country;
  174. }
  175. /**
  176. * @param country the country to set
  177. */
  178. public void setCountry(String country) {
  179. this.country = country;
  180. }
  181. @Override
  182. public JComponent getView() {
  183. throw new UnsupportedOperationException("Not supported yet.");
  184. }
  185. @Override
  186. public MPIcon getIcon() {
  187. return null;
  188. }
  189. /**
  190. * @return the inttype
  191. */
  192. public int __getInttype() {
  193. return inttype;
  194. }
  195. /**
  196. * @param inttype the inttype to set
  197. */
  198. public void setInttype(int inttype) {
  199. this.inttype = inttype;
  200. }
  201. @Override
  202. public HashMap<String, Object> resolveReferences(HashMap<String, Object> map) {
  203. super.resolveReferences(map);
  204. try {
  205. if (map.containsKey("inttype")) {
  206. // [0 = billing adress, 1 = delivery adress, 2 = both, 3 = undefined]
  207. if (__getInttype() == TYPE_ALL) {
  208. map.put("type", Messages.ADDRESS_TYPE_BOTH);
  209. } else if (__getInttype() == TYPE_DELIVERY) {
  210. map.put("type", Messages.ADDRESS_TYPE_DELIVERY);
  211. } else if (__getInttype() == TYPE_INVOICE) {
  212. map.put("type", Messages.ADDRESS_TYPE_INVOICE);
  213. }
  214. map.remove("inttype");
  215. }
  216. } catch (Exception n) {
  217. //already resolved?
  218. Log.Debug(n);
  219. }
  220. return map;
  221. }
  222. }