Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21545 ashik.ali 1
package com.spice.profitmandi.dao.entity;
2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
 
6
import javax.persistence.Column;
7
import javax.persistence.Entity;
8
import javax.persistence.GeneratedValue;
9
import javax.persistence.GenerationType;
10
import javax.persistence.Id;
11
import javax.persistence.NamedQueries;
12
import javax.persistence.NamedQuery;
13
import javax.persistence.Table;
14
import javax.persistence.UniqueConstraint;
15
 
16
/**
17
 * This class basically contains address details
18
 * 
19
 * @author ashikali
20
 *
21
 */
22
@Entity
21665 amit.gupta 23
@Table(name="user.address", schema = "user", uniqueConstraints = {@UniqueConstraint(columnNames = {"name", "line_1", "line_2", "landmark", "city", "state", "pin", "country", "phone"})})
21545 ashik.ali 24
@NamedQueries({
21666 amit.gupta 25
	@NamedQuery(name = "Address.selectCount", query = "select count(a) from Address a where a.retailerId= :retailerId"),
26
	@NamedQuery(name="Address.selectAll",query="select a from Address a where a.retailerId= :retailerId"),
21545 ashik.ali 27
	@NamedQuery(name="Address.selectById",query="select a from Address a where a.id= :id"),
28
	@NamedQuery(name="Address.selectByIds",query="select a from Address a where a.id in :ids"),
29
	@NamedQuery(name="Address.selectByParams",query="select a from Address a where a.name= :name and a.line1 = :line1 and a.line2 = :line2 and a.landmark = :landmark and a.city = :city and a.state = :state and a.pinCode = :pinCode and a.country = :country and a.phoneNumber = :phoneNumber"),
30
	@NamedQuery(name="Address.deleteById",query="delete from Address a where a.id= :id"),
31
})
32
public class Address implements Serializable{
33
 
34
	private static final long serialVersionUID = 1L;
35
 
36
	public Address() {
37
	}
38
 
39
	@Id
40
	@Column(name="id", unique=true, updatable=false)
41
	@GeneratedValue(strategy = GenerationType.IDENTITY)
42
	private int id;
43
 
44
	@Column(name="name")
45
	private String name;
46
 
47
	@Column(name = "line_1")
48
	private String line1;
49
 
50
	@Column(name = "line_2")
51
	private String line2;
52
 
53
	@Column(name = "landmark")
54
	private String landmark;
55
 
56
	@Column(name = "city")
57
	private String city;
58
 
59
	@Column(name = "state")
60
	private String state;
61
 
62
	@Column(name = "pin", length = 10)
63
	private String pinCode;
64
 
65
	@Column(name = "country", length = 100)
66
	private String country;
67
 
68
	@Column(name = "phone", length = 20)
69
	private String phoneNumber;
70
 
71
	@Column(name = "enabled", columnDefinition="tinyint(1) default 0")
72
	private boolean enabled;
21666 amit.gupta 73
 
74
	@Column(name = "user_id")
75
	private int retailerId;
21545 ashik.ali 76
 
77
	@Column(name="added_on", updatable = false)
78
	private LocalDateTime createTimestamp = LocalDateTime.now();
79
 
80
	@Column(name="update_timestamp")
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
	}
170
	@Override
171
	public String toString() {
172
		return "Address [id=" + id + ", name=" + name + ", line1=" + line1 + ", line2=" + line2 + ", landmark="
173
				+ landmark + ", city=" + city + ", state=" + state + ", pinCode=" + pinCode + ", country=" + country
174
				+ ", phoneNumber=" + phoneNumber + ", enabled=" + enabled + ", createTimestamp=" + createTimestamp
21602 ashik.ali 175
				+ ", updateTimestamp=" + updateTimestamp + "]";
21545 ashik.ali 176
	}
177
 
178
 
179
}