1 | public class Customer {↵ | | 1 | public class User {↵
|
|
2 | private String customerId;↵ | | 2 | private Integer id;↵
|
3 | private String name;↵ | | 3 | private String userid;↵
|
4 | private String address;↵ | | 4 | private S↵
|
5 | private List orders = new ArrayList();↵ | | |
|
6 | /**↵ | | |
|
7 | * @return Returns the address.↵ | | |
|
8 | */↵ | | |
|
9 | public String getAddress() {↵ | | |
|
10 | return address;↵ | | |
|
11 | }↵ | | |
|
12 | /**↵ | | |
|
13 | * @param address The address to set.↵ | | |
|
14 | */↵ | | |
|
15 | public void setAddress↵ | | 5 | et mail = new HashSet();↵
|
|
| | | 6 | public User() {↵
|
| | | 7 | }↵
|
|
16 | (String address) {↵ | | 8 | public User(String userid) {↵
|
17 | this.address = address;↵ | | 9 | this.↵
|
18 | }↵ | | |
|
19 | /**↵ | | |
|
20 | * @return Returns the customerId.↵ | | |
|
21 | */↵ | | |
|
22 | public String getCustomer↵ | | 10 | userid = userid;↵
|
| | | 11 | }↵
|
|
23 | Id() {↵ | | 12 | public Integer getId() {↵
|
24 | return customerId;↵ | | 13 | return ↵
|
25 | }↵ | | |
|
26 | /**↵ | | |
|
27 | * @param customerId The customerId to set.↵ | | |
|
28 | */↵ | | |
|
29 | public void setCustomerId(String customerId) {↵ | | |
|
30 | this.customerId = customerId;↵ | | |
|
31 | }↵ | | |
|
32 | /**↵ | | |
|
33 | * @return Returns the name.↵ | | |
|
34 | */↵ | | 14 | id;↵
|
| | | 15 | }↵
|
|
| | | 16 | protected void setId(Integer id) {↵
|
| | | 17 | this.id = id;↵
|
| | | 18 | }↵
|
|
35 | public String getName() {↵ | | 19 | public String getUserid() {↵
|
36 | return name;↵ | | 20 | return ↵
|
37 | }↵ | | |
|
38 | /**↵ | | |
|
39 | * @param name The name to set.↵ | | |
|
40 | */↵ | | 21 | userid;↵
|
| | | 22 | }↵
|
|
41 | public void setName(String name) {↵ | | 23 | public void setUserid(String userid) {↵
|
42 | this.name = name;↵ | | 24 | this.↵
|
43 | }↵ | | |
|
44 | /**↵ | | |
|
45 | * @return Returns the orders.↵ | | |
|
46 | */↵ | | 25 | userid = userid;↵
|
| | | 26 | }↵
|
|
47 | public List getOrders() {↵ | | 27 | public Set getMail() {↵
|
48 | return orders;↵ | | 28 | return ↵
|
49 | }↵ | | |
|
50 | /**↵ | | |
|
51 | * @param orders The orders to set.↵ | | |
|
52 | */↵ | | |
|
53 | public void setOrders(List orders) {↵ | | |
|
54 | this.orders = orders;↵ | | |
|
55 | }↵ | | |
|
|
56 | public Order generateNewOrder(BigDecimal total) {↵ | | |
|
57 | Order order = new Order(↵ | | 29 | mail;↵
|
| | | 30 | }↵
|
|
| | | 31 | private void setMail(Set mail) {↵
|
| | | 32 | this.mail = mail;↵
|
| | | 33 | }↵
|
|
| | | 34 | public Mail addMail(String alias) {↵
|
58 | this);↵ | | 35 | Mail mail = new Mail( alias, this );↵
|
59 | order.setOrderDate( new GregorianCalendar() );↵ | | 36 | ↵
|
60 | order.setTotal( total );↵ | | |
|
| | | 37 | getMail().add( mail );↵
|
| | | 38 | return mail;↵
|
| | | 39 | }↵
|
|
| | | 40 | public void removeMail(Mail mail) {↵
|
61 | return order | | 41 | getMail().remove( mail )
|