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.Basic;
7
import javax.persistence.Column;
8
import javax.persistence.Entity;
9
import javax.persistence.EnumType;
10
import javax.persistence.Enumerated;
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
import javax.persistence.Version;
17
 
18
import com.spice.profitmandi.dao.enumuration.RetailerType;
19
import com.spice.profitmandi.dao.enumuration.SaleValue;
20
 
21
/**
22
 * This class basically contains api details
23
 * 
24
 * @author ashikali
25
 *
26
 */
27
@Entity
28
@Table(name="retailer", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"number","type"})})
29
@NamedQueries({
30
	@NamedQuery(name = "Retailer.selectCount", query = "select count(r) from Retailer r"),
31
	@NamedQuery(name = "Retailer.selectAll",query="select r from Retailer r"),
32
	@NamedQuery(name = "Retailer.selectById",query="select r from Retailer r where r.id= :id"),
33
	@NamedQuery(name = "Retailer.selectByName",query="select r from Retailer r where r.name= :name"),
34
	@NamedQuery(name = "Retailer.selectCountByNumberAndType",query="select count(r) from Retailer r where r.number= :number and r.type= :type"),
35
	@NamedQuery(name = "Retailer.selectCountByDocumentId", query="select count(r) from Retailer r where r.documentId= :documentId"),
36
	@NamedQuery(name = "Retailer.selectCountByName", query = "select count(r) from Retailer r where r.name= :name"),
37
	@NamedQuery(name = "Retailer.selectCountById", query = "select count(r) from Retailer r where r.id= :id"),
38
	@NamedQuery(name = "Retailer.deleteById",query="delete from Retailer r where r.id= :id"),
21559 ashik.ali 39
	@NamedQuery(name = "Retailer.selectDocumentById", query = "select d from Retailer r join Document d on d.id = r.documentId where r.id = :id"),
21566 ashik.ali 40
	@NamedQuery(
41
			name = "Retailer.selectFofoIdAndEmailIdByEmailId",
42
			query = "select r.id, u.emailId from User u join UserAccounts ua on ua.user_id = u.id join Retailer r on r.id = ua.account_key where u.emailId = :emailId and ua.account_type = 'saholic' and r.fofo = true")
21545 ashik.ali 43
})
44
public class Retailer implements Serializable{
45
 
46
	private static final long serialVersionUID = 1L;
47
 
48
	public Retailer() {
49
	}
50
 
51
	@Id
52
	@Column(name = "id", unique=true, updatable=false)
53
	private int id;
54
 
55
	@Column(name = "name")
56
	private String name;
57
 
58
	@Column(name = "number", length = 128)
59
	private String number;
60
 
61
	@Column(name = "type")
62
	@Enumerated(EnumType.STRING)
63
	private RetailerType type;
64
 
65
	@Column(name = "monthly_sale_value")
66
	private SaleValue monthlySaleValue;
67
 
68
	@Column(name = "smartphone_sale_value")
69
	private SaleValue smartphoneSaleValue;
70
 
71
	@Column(name = "recharge", columnDefinition="tinyint(1) default 0")
72
	private boolean recharge;
73
 
74
	@Column(name = "mobile", columnDefinition="tinyint(1) default 0")
75
	private boolean mobile;
76
 
77
	@Column(name = "accessories", columnDefinition="tinyint(1) default 0")
78
	private boolean accessories;
79
 
80
	@Column(name = "other1", length = 128)
81
	private String other1;
82
 
83
	@Column(name = "other2", length = 128)
84
	private String other2;
85
 
86
	@Column(name = "self_pickup", columnDefinition="tinyint(1) default 0")
87
	private boolean selfPickup;
88
 
89
	@Column(name = "active", columnDefinition = "tinyint(1) default 0")
90
	private boolean active;
91
 
92
	@Column(name = "migrated", columnDefinition = "tinyint(1) default 0")
93
	private boolean migrated;
94
 
95
	@Column(name="create_timestamp", updatable = false)
96
	private LocalDateTime createTimestamp = LocalDateTime.now();
97
 
98
	@Column(name="update_timestamp")
99
	private LocalDateTime updateTimestamp = LocalDateTime.now();
100
 
101
	@Basic(optional = false)
102
    @Column(nullable = false)
103
	@Version
104
	private int version;
105
 
106
	@Column(name = "document_id")
107
	private int documentId;
108
 
109
	@Column(name = "current_address_id")
110
	private int currentAddressId;
111
 
21688 ashik.ali 112
	@Column(name = "fofo", columnDefinition = "tinyint(1) default 0")
21566 ashik.ali 113
	private boolean fofo;
114
 
21545 ashik.ali 115
	public int getId() {
116
		return id;
117
	}
118
	public void setId(int id) {
119
		this.id = id;
120
	}
121
	public void setName(String name) {
122
        this.name = name;
123
    }
124
    public String getName() {
125
        return name;
126
    }
127
 
128
    public String getNumber() {
129
		return number;
130
	}
131
    public void setNumber(String number) {
132
		this.number = number;
133
	}
134
 
135
    public SaleValue getMonthlySaleValue() {
136
		return monthlySaleValue;
137
	}
138
    public void setMonthlySaleValue(SaleValue monthlySaleValue) {
139
		this.monthlySaleValue = monthlySaleValue;
140
	}
141
    public SaleValue getSmartphoneSaleValue() {
142
		return smartphoneSaleValue;
143
	}
144
    public void setSmartphoneSaleValue(SaleValue smartphoneSaleValue) {
145
		this.smartphoneSaleValue = smartphoneSaleValue;
146
	}
147
 
148
    public boolean isRecharge() {
149
		return recharge;
150
	}
151
    public void setRecharge(boolean recharge) {
152
		this.recharge = recharge;
153
	}
154
    public boolean isMobile() {
155
		return mobile;
156
	}
157
    public void setMobile(boolean mobile) {
158
		this.mobile = mobile;
159
	}
160
    public boolean isAccessories() {
161
		return accessories;
162
	}
163
    public void setAccessories(boolean accessories) {
164
		this.accessories = accessories;
165
	}
166
    public String getOther1() {
167
		return other1;
168
	}
169
    public void setOther1(String other1) {
170
		this.other1 = other1;
171
	}
172
    public String getOther2() {
173
		return other2;
174
	}
175
    public void setOther2(String other2) {
176
		this.other2 = other2;
177
	}
178
    public void setType(RetailerType type) {
179
		this.type = type;
180
	}
181
    public RetailerType getType() {
182
		return type;
183
	}
184
 
185
    public int getDocumentId() {
186
		return documentId;
187
	}
188
    public void setDocumentId(int documentId) {
189
		this.documentId = documentId;
190
	}
191
 
192
    public void setCurrentAddressId(int currentAddressId) {
193
		this.currentAddressId = currentAddressId;
194
	}
195
    public int getCurrentAddressId() {
196
		return currentAddressId;
197
	}
198
 
199
    public boolean isSelfPickup() {
200
		return selfPickup;
201
	}
202
    public void setSelfPickup(boolean selfPickup) {
203
		this.selfPickup = selfPickup;
204
	}
205
 
206
    public boolean isActive() {
207
		return active;
208
	}
209
    public void setActive(boolean active) {
210
		this.active = active;
211
	}
212
 
213
    public boolean isMigrated() {
214
		return migrated;
215
	}
216
    public void setMigrated(boolean migrated) {
217
		this.migrated = migrated;
218
	}
219
 
220
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
221
		this.createTimestamp = createTimestamp;
222
	}
223
    public LocalDateTime getCreateTimestamp() {
224
		return createTimestamp;
225
	}
226
 
227
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
228
		this.updateTimestamp = updateTimestamp;
229
	}
230
    public LocalDateTime getUpdateTimestamp() {
231
		return updateTimestamp;
232
	}
233
 
234
    public void setVersion(int version) {
235
		this.version = version;
236
	}
237
    public int getVersion() {
238
		return version;
239
	}
21566 ashik.ali 240
 
241
    public boolean isFofo() {
242
		return fofo;
243
	}
244
    public void setFofo(boolean fofo) {
245
		this.fofo = fofo;
246
	}
21602 ashik.ali 247
	@Override
248
	public String toString() {
249
		return "Retailer [id=" + id + ", name=" + name + ", number=" + number + ", type=" + type + ", monthlySaleValue="
250
				+ monthlySaleValue + ", smartphoneSaleValue=" + smartphoneSaleValue + ", recharge=" + recharge
251
				+ ", mobile=" + mobile + ", accessories=" + accessories + ", other1=" + other1 + ", other2=" + other2
252
				+ ", selfPickup=" + selfPickup + ", active=" + active + ", migrated=" + migrated + ", createTimestamp="
253
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", version=" + version + ", documentId="
254
				+ documentId + ", currentAddressId=" + currentAddressId + ", fofo=" + fofo + "]";
255
	}
21545 ashik.ali 256
 
21602 ashik.ali 257
 
21545 ashik.ali 258
 
259
}