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"),
39
	@NamedQuery(name = "Retailer.selectDocumentById", query = "select d from Retailer r join Document d on d.id = r.documentId where r.id = :id")
40
})
41
public class Retailer implements Serializable{
42
 
43
	private static final long serialVersionUID = 1L;
44
 
45
	public Retailer() {
46
	}
47
 
48
	@Id
49
	@Column(name = "id", unique=true, updatable=false)
50
	private int id;
51
 
52
	@Column(name = "name")
53
	private String name;
54
 
55
	@Column(name = "number", length = 128)
56
	private String number;
57
 
58
	@Column(name = "type")
59
	@Enumerated(EnumType.STRING)
60
	private RetailerType type;
61
 
62
	@Column(name = "monthly_sale_value")
63
	private SaleValue monthlySaleValue;
64
 
65
	@Column(name = "smartphone_sale_value")
66
	private SaleValue smartphoneSaleValue;
67
 
68
	@Column(name = "recharge", columnDefinition="tinyint(1) default 0")
69
	private boolean recharge;
70
 
71
	@Column(name = "mobile", columnDefinition="tinyint(1) default 0")
72
	private boolean mobile;
73
 
74
	@Column(name = "accessories", columnDefinition="tinyint(1) default 0")
75
	private boolean accessories;
76
 
77
	@Column(name = "other1", length = 128)
78
	private String other1;
79
 
80
	@Column(name = "other2", length = 128)
81
	private String other2;
82
 
83
	@Column(name = "self_pickup", columnDefinition="tinyint(1) default 0")
84
	private boolean selfPickup;
85
 
86
	@Column(name = "active", columnDefinition = "tinyint(1) default 0")
87
	private boolean active;
88
 
89
	@Column(name = "migrated", columnDefinition = "tinyint(1) default 0")
90
	private boolean migrated;
91
 
92
	@Column(name="create_timestamp", updatable = false)
93
	private LocalDateTime createTimestamp = LocalDateTime.now();
94
 
95
	@Column(name="update_timestamp")
96
	private LocalDateTime updateTimestamp = LocalDateTime.now();
97
 
98
	@Basic(optional = false)
99
    @Column(nullable = false)
100
	@Version
101
	private int version;
102
 
103
	@Column(name = "document_id")
104
	private int documentId;
105
 
106
	@Column(name = "current_address_id")
107
	private int currentAddressId;
108
 
109
	public int getId() {
110
		return id;
111
	}
112
	public void setId(int id) {
113
		this.id = id;
114
	}
115
	public void setName(String name) {
116
        this.name = name;
117
    }
118
    public String getName() {
119
        return name;
120
    }
121
 
122
    public String getNumber() {
123
		return number;
124
	}
125
    public void setNumber(String number) {
126
		this.number = number;
127
	}
128
 
129
    public SaleValue getMonthlySaleValue() {
130
		return monthlySaleValue;
131
	}
132
    public void setMonthlySaleValue(SaleValue monthlySaleValue) {
133
		this.monthlySaleValue = monthlySaleValue;
134
	}
135
    public SaleValue getSmartphoneSaleValue() {
136
		return smartphoneSaleValue;
137
	}
138
    public void setSmartphoneSaleValue(SaleValue smartphoneSaleValue) {
139
		this.smartphoneSaleValue = smartphoneSaleValue;
140
	}
141
 
142
    public boolean isRecharge() {
143
		return recharge;
144
	}
145
    public void setRecharge(boolean recharge) {
146
		this.recharge = recharge;
147
	}
148
    public boolean isMobile() {
149
		return mobile;
150
	}
151
    public void setMobile(boolean mobile) {
152
		this.mobile = mobile;
153
	}
154
    public boolean isAccessories() {
155
		return accessories;
156
	}
157
    public void setAccessories(boolean accessories) {
158
		this.accessories = accessories;
159
	}
160
    public String getOther1() {
161
		return other1;
162
	}
163
    public void setOther1(String other1) {
164
		this.other1 = other1;
165
	}
166
    public String getOther2() {
167
		return other2;
168
	}
169
    public void setOther2(String other2) {
170
		this.other2 = other2;
171
	}
172
    public void setType(RetailerType type) {
173
		this.type = type;
174
	}
175
    public RetailerType getType() {
176
		return type;
177
	}
178
 
179
    public int getDocumentId() {
180
		return documentId;
181
	}
182
    public void setDocumentId(int documentId) {
183
		this.documentId = documentId;
184
	}
185
 
186
    public void setCurrentAddressId(int currentAddressId) {
187
		this.currentAddressId = currentAddressId;
188
	}
189
    public int getCurrentAddressId() {
190
		return currentAddressId;
191
	}
192
 
193
    public boolean isSelfPickup() {
194
		return selfPickup;
195
	}
196
    public void setSelfPickup(boolean selfPickup) {
197
		this.selfPickup = selfPickup;
198
	}
199
 
200
    public boolean isActive() {
201
		return active;
202
	}
203
    public void setActive(boolean active) {
204
		this.active = active;
205
	}
206
 
207
    public boolean isMigrated() {
208
		return migrated;
209
	}
210
    public void setMigrated(boolean migrated) {
211
		this.migrated = migrated;
212
	}
213
 
214
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
215
		this.createTimestamp = createTimestamp;
216
	}
217
    public LocalDateTime getCreateTimestamp() {
218
		return createTimestamp;
219
	}
220
 
221
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
222
		this.updateTimestamp = updateTimestamp;
223
	}
224
    public LocalDateTime getUpdateTimestamp() {
225
		return updateTimestamp;
226
	}
227
 
228
    public void setVersion(int version) {
229
		this.version = version;
230
	}
231
    public int getVersion() {
232
		return version;
233
	}
234
 
235
 
236
}