01: package org.apache.ojb.otm;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import java.util.ArrayList;
19: import java.io.Serializable;
20:
21: public class Person implements Serializable {
22:
23: private int id;
24: private String firstname;
25: private String lastname;
26: private Integer mainAddressId;
27: private Address mainAddress;
28: private ArrayList otherAddresses;
29:
30: public Person() {
31: }
32:
33: public Person(String firstname, String lastname) {
34: this .firstname = firstname;
35: this .lastname = lastname;
36: }
37:
38: public int getId() {
39: return id;
40: }
41:
42: public void setId(int id) {
43: this .id = id;
44: }
45:
46: public String getFirstname() {
47: return firstname;
48: }
49:
50: public void setFirstname(String firstname) {
51: this .firstname = firstname;
52: }
53:
54: public String getLastname() {
55: return lastname;
56: }
57:
58: public void setLastname(String lastname) {
59: this .lastname = lastname;
60: }
61:
62: public Integer getMainAddressId() {
63: return mainAddressId;
64: }
65:
66: public void setMainAddressId(Integer mainAddressId) {
67: this .mainAddressId = mainAddressId;
68: }
69:
70: public Address getMainAddress() {
71: return mainAddress;
72: }
73:
74: public void setMainAddress(Address mainAddress) {
75: this .mainAddress = mainAddress;
76: }
77:
78: public ArrayList getOtherAddresses() {
79: return otherAddresses;
80: }
81:
82: public void setOtherAddresses(ArrayList otherAddresses) {
83: this .otherAddresses = otherAddresses;
84: }
85:
86: public void addOtherAddress(String desc, Address address) {
87: if (otherAddresses == null) {
88: otherAddresses = new ArrayList();
89: }
90: AddressDesc addrDesc = new AddressDesc(desc, address);
91: this.otherAddresses.add(addrDesc);
92: addrDesc.setPerson(this);
93: }
94:
95: }
|