Subversion Repositories SmartDukaan

Rev

Rev 24159 | Rev 26131 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
24159 tejbeer 1
package com.spice.profitmandi.dao.entity.user;
2
 
3
import java.time.LocalDateTime;
4
import java.time.format.DateTimeFormatter;
5
 
6
import javax.persistence.Column;
7
import javax.persistence.Convert;
8
import javax.persistence.Entity;
9
import javax.persistence.GeneratedValue;
10
import javax.persistence.GenerationType;
11
import javax.persistence.Id;
12
import javax.persistence.Table;
13
 
14
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
15
 
16
@Entity
17
@Table(name = "user.promoter", schema = "user")
18
public class Promoter {
19
	@Id
20
	@Column(name = "id", unique = true, updatable = false)
21
	@GeneratedValue(strategy = GenerationType.IDENTITY)
22
	private int id;
23
 
24
	@Column
25
	private String name;
26
 
24429 tejbeer 27
	/**
28
	 * 
29
	 */
24159 tejbeer 30
	@Column
31
	private String brand;
32
 
24429 tejbeer 33
	@Override
34
	public int hashCode() {
35
		final int prime = 31;
36
		int result = 1;
37
		result = prime * result + ((brand == null) ? 0 : brand.hashCode());
38
		result = prime * result + ((createdTimestamp == null) ? 0 : createdTimestamp.hashCode());
39
		result = prime * result + ((email == null) ? 0 : email.hashCode());
40
		result = prime * result + id;
41
		result = prime * result + ((mobile == null) ? 0 : mobile.hashCode());
42
		result = prime * result + ((name == null) ? 0 : name.hashCode());
43
		result = prime * result + retailerId;
44
		result = prime * result + (sdPortalAccess ? 1231 : 1237);
45
		return result;
46
	}
47
 
48
	@Override
49
	public boolean equals(Object obj) {
50
		if (this == obj)
51
			return true;
52
		if (obj == null)
53
			return false;
54
		if (getClass() != obj.getClass())
55
			return false;
56
		Promoter other = (Promoter) obj;
57
		if (brand == null) {
58
			if (other.brand != null)
59
				return false;
60
		} else if (!brand.equals(other.brand))
61
			return false;
62
		if (createdTimestamp == null) {
63
			if (other.createdTimestamp != null)
64
				return false;
65
		} else if (!createdTimestamp.equals(other.createdTimestamp))
66
			return false;
67
		if (email == null) {
68
			if (other.email != null)
69
				return false;
70
		} else if (!email.equals(other.email))
71
			return false;
72
		if (id != other.id)
73
			return false;
74
		if (mobile == null) {
75
			if (other.mobile != null)
76
				return false;
77
		} else if (!mobile.equals(other.mobile))
78
			return false;
79
		if (name == null) {
80
			if (other.name != null)
81
				return false;
82
		} else if (!name.equals(other.name))
83
			return false;
84
		if (retailerId != other.retailerId)
85
			return false;
86
		if (sdPortalAccess != other.sdPortalAccess)
87
			return false;
88
		return true;
89
	}
90
 
91
	public boolean isSdPortalAccess() {
92
		return sdPortalAccess;
93
	}
94
 
95
	public void setSdPortalAccess(boolean sdPortalAccess) {
96
		this.sdPortalAccess = sdPortalAccess;
97
	}
98
 
24159 tejbeer 99
	@Column(name = "retailer_id")
100
	private int retailerId;
101
 
102
	@Column(length = 10, name = "mobile")
103
	private String mobile;
104
 
105
	@Column(name = "email", unique = true)
106
	private String email;
24429 tejbeer 107
 
108
	@Column(name = "sdportal_access")
109
	private boolean sdPortalAccess = false;
24159 tejbeer 110
 
111
	@Convert(converter = LocalDateTimeAttributeConverter.class)
112
	@Column(name = "created_timestamp", updatable = false)
113
	private LocalDateTime createdTimestamp = LocalDateTime.now();
114
 
115
	public String getEmail() {
116
		return email;
117
	}
118
 
119
	public void setEmail(String email) {
120
		this.email = email;
121
	}
122
 
123
	public String getMobile() {
124
		return mobile;
125
	}
126
 
127
	public void setMobile(String mobile) {
128
		this.mobile = mobile;
129
	}
130
 
131
	public int getId() {
132
		return id;
133
	}
134
 
135
	public void setId(int id) {
136
		this.id = id;
137
	}
138
 
139
	public String getName() {
140
		return name;
141
	}
142
 
143
	public void setName(String name) {
144
		this.name = name;
145
	}
146
 
147
	public String getBrand() {
148
		return brand;
149
	}
150
 
151
	public void setBrand(String brand) {
152
		this.brand = brand;
153
	}
154
 
155
	public int getRetailerId() {
156
		return retailerId;
157
	}
158
 
159
	public void setRetailerId(int retailerId) {
160
		this.retailerId = retailerId;
161
	}
162
 
163
	public LocalDateTime getCreatedTimestamp() {
164
		return createdTimestamp;
165
	}
166
 
167
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
168
		this.createdTimestamp = createdTimestamp;
169
	}
170
 
171
	public String getDate(LocalDateTime ldt) {
172
		DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
173
		String s = dtf.format(ldt);
174
		return s;
175
	}
176
 
177
	@Override
178
	public String toString() {
24429 tejbeer 179
		return "Promoter [id=" + id + ", name=" + name + ", brand=" + brand + ", retailerId=" + retailerId + ", mobile="
180
				+ mobile + ", email=" + email + ", sdPortalAccess=" + sdPortalAccess + ", createdTimestamp="
181
				+ createdTimestamp + "]";
24159 tejbeer 182
	}
183
 
24429 tejbeer 184
 
185
 
24159 tejbeer 186
}