-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSupplier.java
185 lines (160 loc) · 6.7 KB
/
Supplier.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package DataGUI;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
*
* @author Connor
*/
@Entity
@Table(name = "supplier", catalog = "outdoorlife", schema = "")
@NamedQueries({
@NamedQuery(name = "Supplier.findAll", query = "SELECT s FROM Supplier s"),
@NamedQuery(name = "Supplier.findBySupplierID", query = "SELECT s FROM Supplier s WHERE s.supplierID = :supplierID"),
@NamedQuery(name = "Supplier.findBySupplierName", query = "SELECT s FROM Supplier s WHERE s.supplierName = :supplierName"),
@NamedQuery(name = "Supplier.findBySupplierAddress", query = "SELECT s FROM Supplier s WHERE s.supplierAddress = :supplierAddress"),
@NamedQuery(name = "Supplier.findByContactName", query = "SELECT s FROM Supplier s WHERE s.contactName = :contactName"),
@NamedQuery(name = "Supplier.findBySupplierCity", query = "SELECT s FROM Supplier s WHERE s.supplierCity = :supplierCity"),
@NamedQuery(name = "Supplier.findBySupplierPostcode", query = "SELECT s FROM Supplier s WHERE s.supplierPostcode = :supplierPostcode"),
@NamedQuery(name = "Supplier.findBySupplierPhone", query = "SELECT s FROM Supplier s WHERE s.supplierPhone = :supplierPhone")})
public class Supplier implements Serializable {
@Transient
private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "supplierID")
private Integer supplierID;
@Basic(optional = false)
@Column(name = "supplierName")
private String supplierName;
@Basic(optional = false)
@Column(name = "supplierAddress")
private String supplierAddress;
@Basic(optional = false)
@Column(name = "contactName")
private String contactName;
@Basic(optional = false)
@Column(name = "supplierCity")
private String supplierCity;
@Basic(optional = false)
@Column(name = "supplierPostcode")
private String supplierPostcode;
@Basic(optional = false)
@Column(name = "supplierPhone")
private String supplierPhone;
public Supplier() {
}
public Supplier(Integer supplierID) {
this.supplierID = supplierID;
}
public Supplier(Integer supplierID, String supplierName, String supplierAddress, String contactName, String supplierCity, String supplierPostcode, String supplierPhone) {
this.supplierID = supplierID;
this.supplierName = supplierName;
this.supplierAddress = supplierAddress;
this.contactName = contactName;
this.supplierCity = supplierCity;
this.supplierPostcode = supplierPostcode;
this.supplierPhone = supplierPhone;
}
public Integer getSupplierID() {
return supplierID;
}
public void setSupplierID(Integer supplierID) {
Integer oldSupplierID = this.supplierID;
this.supplierID = supplierID;
changeSupport.firePropertyChange("supplierID", oldSupplierID, supplierID);
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
String oldSupplierName = this.supplierName;
this.supplierName = supplierName;
changeSupport.firePropertyChange("supplierName", oldSupplierName, supplierName);
}
public String getSupplierAddress() {
return supplierAddress;
}
public void setSupplierAddress(String supplierAddress) {
String oldSupplierAddress = this.supplierAddress;
this.supplierAddress = supplierAddress;
changeSupport.firePropertyChange("supplierAddress", oldSupplierAddress, supplierAddress);
}
public String getContactName() {
return contactName;
}
public void setContactName(String contactName) {
String oldContactName = this.contactName;
this.contactName = contactName;
changeSupport.firePropertyChange("contactName", oldContactName, contactName);
}
public String getSupplierCity() {
return supplierCity;
}
public void setSupplierCity(String supplierCity) {
String oldSupplierCity = this.supplierCity;
this.supplierCity = supplierCity;
changeSupport.firePropertyChange("supplierCity", oldSupplierCity, supplierCity);
}
public String getSupplierPostcode() {
return supplierPostcode;
}
public void setSupplierPostcode(String supplierPostcode) {
String oldSupplierPostcode = this.supplierPostcode;
this.supplierPostcode = supplierPostcode;
changeSupport.firePropertyChange("supplierPostcode", oldSupplierPostcode, supplierPostcode);
}
public String getSupplierPhone() {
return supplierPhone;
}
public void setSupplierPhone(String supplierPhone) {
String oldSupplierPhone = this.supplierPhone;
this.supplierPhone = supplierPhone;
changeSupport.firePropertyChange("supplierPhone", oldSupplierPhone, supplierPhone);
}
@Override
public int hashCode() {
int hash = 0;
hash += (supplierID != null ? supplierID.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Supplier)) {
return false;
}
Supplier other = (Supplier) object;
if ((this.supplierID == null && other.supplierID != null) || (this.supplierID != null && !this.supplierID.equals(other.supplierID))) {
return false;
}
return true;
}
@Override
public String toString() {
return "DataGUI.Supplier[ supplierID=" + supplierID + " ]";
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
changeSupport.addPropertyChangeListener(listener);
}
public void removePropertyChangeListener(PropertyChangeListener listener) {
changeSupport.removePropertyChangeListener(listener);
}
}