Subversion Repositories SmartDukaan

Rev

Rev 31860 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21717 ashik.ali 1
package com.spice.profitmandi.dao.entity.user;
21545 ashik.ali 2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
 
6
import javax.persistence.Column;
22009 ashik.ali 7
import javax.persistence.Convert;
21545 ashik.ali 8
import javax.persistence.Entity;
9
import javax.persistence.GeneratedValue;
10
import javax.persistence.GenerationType;
11
import javax.persistence.Id;
12
import javax.persistence.NamedQueries;
13
import javax.persistence.NamedQuery;
14
import javax.persistence.Table;
15
import javax.persistence.UniqueConstraint;
16
 
22216 ashik.ali 17
import org.hibernate.annotations.UpdateTimestamp;
18
 
22009 ashik.ali 19
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
20
 
21545 ashik.ali 21
/**
22
 * This class basically contains address details
23
 * 
24
 * @author ashikali
25
 *
26
 */
27
@Entity
31860 tejbeer 28
@Table(name="user.address", uniqueConstraints = {@UniqueConstraint(columnNames = {"name", "line_1", "line_2", "landmark", "city", "state", "pin", "country", "phone"})})
21545 ashik.ali 29
public class Address implements Serializable{
30
 
31
	private static final long serialVersionUID = 1L;
32
 
33
	public Address() {
34
	}
35
 
36
	@Id
37
	@Column(name="id", unique=true, updatable=false)
38
	@GeneratedValue(strategy = GenerationType.IDENTITY)
39
	private int id;
40
 
41
	@Column(name="name")
42
	private String name;
43
 
44
	@Column(name = "line_1")
45
	private String line1;
46
 
47
	@Column(name = "line_2")
48
	private String line2;
49
 
50
	@Column(name = "landmark")
51
	private String landmark;
52
 
53
	@Column(name = "city")
54
	private String city;
55
 
56
	@Column(name = "state")
57
	private String state;
58
 
59
	@Column(name = "pin", length = 10)
60
	private String pinCode;
61
 
62
	@Column(name = "country", length = 100)
63
	private String country;
64
 
65
	@Column(name = "phone", length = 20)
66
	private String phoneNumber;
67
 
68
	@Column(name = "enabled", columnDefinition="tinyint(1) default 0")
69
	private boolean enabled;
21666 amit.gupta 70
 
71
	@Column(name = "user_id")
72
	private int retailerId;
21545 ashik.ali 73
 
22009 ashik.ali 74
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21545 ashik.ali 75
	@Column(name="added_on", updatable = false)
76
	private LocalDateTime createTimestamp = LocalDateTime.now();
77
 
22009 ashik.ali 78
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21545 ashik.ali 79
	@Column(name="update_timestamp")
22216 ashik.ali 80
	@UpdateTimestamp
21545 ashik.ali 81
	private LocalDateTime updateTimestamp = LocalDateTime.now();
82
 
83
	public int getId() {
84
		return id;
85
	}
86
	public void setId(int id) {
87
		this.id = id;
88
	}
89
	public void setName(String name) {
90
        this.name = name;
91
    }
92
    public String getName() {
93
        return name;
94
    }
95
    public void setLine1(String line1) {
96
		this.line1 = line1;
97
	}
98
    public String getLine1() {
99
		return line1;
100
	}
101
    public void setLine2(String line2) {
102
		this.line2 = line2;
103
	}
104
    public String getLine2() {
105
		return line2;
106
	}
107
    public void setLandmark(String landmark) {
108
		this.landmark = landmark;
109
	}
110
    public String getLandmark() {
111
		return landmark;
112
	}
113
    public void setCity(String city) {
114
		this.city = city;
115
	}
116
    public String getCity() {
117
		return city;
118
	}
119
    public void setPinCode(String pinCode) {
120
		this.pinCode = pinCode;
121
	}
122
    public String getPinCode() {
123
		return pinCode;
124
	}
125
    public void setState(String state) {
126
		this.state = state;
127
	}
128
    public String getState() {
129
		return state;
130
	}
131
    public void setCountry(String country) {
132
		this.country = country;
133
	}
134
    public String getCountry() {
135
		return country;
136
	}
137
    public void setPhoneNumber(String phoneNumber) {
138
		this.phoneNumber = phoneNumber;
139
	}
140
    public String getPhoneNumber() {
141
		return phoneNumber;
142
	}
143
    public void setEnabled(boolean enabled) {
144
		this.enabled = enabled;
145
	}
146
    public boolean isEnabled() {
147
		return enabled;
148
	}
149
 
150
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
151
		this.createTimestamp = createTimestamp;
152
	}
153
    public LocalDateTime getCreateTimestamp() {
154
		return createTimestamp;
155
	}
156
 
157
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
158
		this.updateTimestamp = updateTimestamp;
159
	}
160
    public LocalDateTime getUpdateTimestamp() {
161
		return updateTimestamp;
162
	}
163
 
21666 amit.gupta 164
	public int getRetaierId() {
165
		return retailerId;
21545 ashik.ali 166
	}
21666 amit.gupta 167
	public void setRetaierId(int retailerId) {
168
		this.retailerId = retailerId;
21545 ashik.ali 169
	}
21924 ashik.ali 170
 
171
 
22009 ashik.ali 172
 
21545 ashik.ali 173
	@Override
21924 ashik.ali 174
	public int hashCode() {
175
		final int prime = 31;
176
		int result = 1;
177
		result = prime * result + id;
178
		return result;
179
	}
180
	@Override
181
	public boolean equals(Object obj) {
182
		if (this == obj)
183
			return true;
184
		if (obj == null)
185
			return false;
186
		if (getClass() != obj.getClass())
187
			return false;
188
		Address other = (Address) obj;
189
		if (id != other.id)
190
			return false;
191
		return true;
192
	}
193
	@Override
21545 ashik.ali 194
	public String toString() {
195
		return "Address [id=" + id + ", name=" + name + ", line1=" + line1 + ", line2=" + line2 + ", landmark="
196
				+ landmark + ", city=" + city + ", state=" + state + ", pinCode=" + pinCode + ", country=" + country
197
				+ ", phoneNumber=" + phoneNumber + ", enabled=" + enabled + ", createTimestamp=" + createTimestamp
21602 ashik.ali 198
				+ ", updateTimestamp=" + updateTimestamp + "]";
21545 ashik.ali 199
	}
34373 tejus.loha 200
 
201
	public String getAddressDescription() {
202
		return name + ", " + line1 + ", " + line2 + ", " + city + ", " + state  + ", " + pinCode ;
203
	}
21545 ashik.ali 204
 
205
 
206
}