Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
29515 tejbeer 1
package com.spice.profitmandi.dao.entity.dtr;
2
 
33665 ranu 3
import com.spice.profitmandi.dao.enumuration.inventory.ScratchedGift;
4
 
5
import javax.persistence.*;
29515 tejbeer 6
import java.io.Serializable;
7
import java.time.LocalDateTime;
8
 
9
@Entity
31860 tejbeer 10
@Table(name = "dtr.scratch_offer")
33665 ranu 11
@NamedQueries({@NamedQuery(name = "ScratchOffer.selectAllCountOfOffer",
12
		query = "SELECT so.offerName, COUNT(so) FROM ScratchOffer so " +
13
				"WHERE so.createdTimestamp BETWEEN :startDate AND :endDate " +
14
				"GROUP BY so.offerName")
15
})
29515 tejbeer 16
public class ScratchOffer implements Serializable {
17
 
18
	/**
19
	 * 
20
	 */
21
	private static final long serialVersionUID = 1L;
22
 
23
	@Id
24
	@Column(name = "id", unique = true, updatable = false)
25
	@GeneratedValue(strategy = GenerationType.IDENTITY)
26
	private int id;
27
 
28
	@Column(name = "invoice_number")
29
	private String invoiceNumber;
30
 
31
	@Column(name = "customer_id")
32
	private int customerId;
33
 
34
	@Column(name = "offer_name")
35
	@Enumerated(EnumType.STRING)
36
	private ScratchedGift offerName;
37
 
38
	@Column(name = "scratched")
39
	private boolean scratched;
40
 
41
	@Column(name = "created_timestamp")
42
	private LocalDateTime createdTimestamp;
43
 
44
	@Column(name = "unlocked_at")
45
	private LocalDateTime unlockedAt;
46
 
47
	@Column(name = "scracthed_at")
48
	private LocalDateTime scracthedAt;
49
 
50
	public LocalDateTime getScracthedAt() {
51
		return scracthedAt;
52
	}
53
 
54
	public void setScracthedAt(LocalDateTime scracthedAt) {
55
		this.scracthedAt = scracthedAt;
56
	}
57
 
58
	@Transient
59
	private boolean unlocked;
60
 
61
	@Transient
62
	private LocalDateTime expiredTimestamp;
63
 
32671 ranu 64
	@Transient
65
	private boolean expired;
66
 
67
	public boolean isExpired() {
68
		return expired;
69
	}
70
 
71
	public void setExpired(boolean expired) {
72
		this.expired = expired;
73
	}
74
 
29515 tejbeer 75
	public LocalDateTime getExpiredTimestamp() {
76
		return expiredTimestamp;
77
	}
78
 
79
	public void setExpiredTimestamp(LocalDateTime expiredTimestamp) {
80
		this.expiredTimestamp = expiredTimestamp;
81
	}
82
 
83
	public boolean isUnlocked() {
84
		return unlocked;
85
	}
86
 
87
	public void setUnlocked(boolean unlocked) {
88
		this.unlocked = unlocked;
89
	}
90
 
91
	public LocalDateTime getUnlockedAt() {
92
		return unlockedAt;
93
	}
94
 
95
	public void setUnlockedAt(LocalDateTime unlockedAt) {
96
		this.unlockedAt = unlockedAt;
97
	}
98
 
99
	public int getId() {
100
		return id;
101
	}
102
 
103
	public void setId(int id) {
104
		this.id = id;
105
	}
106
 
107
	public int getCustomerId() {
108
		return customerId;
109
	}
110
 
111
	public void setCustomerId(int customerId) {
112
		this.customerId = customerId;
113
	}
114
 
115
	public String getInvoiceNumber() {
116
		return invoiceNumber;
117
	}
118
 
119
	public void setInvoiceNumber(String invoiceNumber) {
120
		this.invoiceNumber = invoiceNumber;
121
	}
122
 
123
	public ScratchedGift getOfferName() {
124
		return offerName;
125
	}
126
 
127
	public void setOfferName(ScratchedGift offerName) {
128
		this.offerName = offerName;
129
	}
130
 
131
	public boolean isScratched() {
132
		return scratched;
133
	}
134
 
135
	public void setScratched(boolean scratched) {
136
		this.scratched = scratched;
137
	}
138
 
139
	public LocalDateTime getCreatedTimestamp() {
140
		return createdTimestamp;
141
	}
142
 
143
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
144
		this.createdTimestamp = createdTimestamp;
145
	}
146
 
147
	@Override
148
	public int hashCode() {
149
		final int prime = 31;
150
		int result = 1;
151
		result = prime * result + ((createdTimestamp == null) ? 0 : createdTimestamp.hashCode());
152
		result = prime * result + customerId;
153
		result = prime * result + ((expiredTimestamp == null) ? 0 : expiredTimestamp.hashCode());
154
		result = prime * result + id;
155
		result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
156
		result = prime * result + ((offerName == null) ? 0 : offerName.hashCode());
157
		result = prime * result + ((scracthedAt == null) ? 0 : scracthedAt.hashCode());
158
		result = prime * result + (scratched ? 1231 : 1237);
159
		result = prime * result + (unlocked ? 1231 : 1237);
160
		result = prime * result + ((unlockedAt == null) ? 0 : unlockedAt.hashCode());
161
		return result;
162
	}
163
 
164
	@Override
165
	public boolean equals(Object obj) {
166
		if (this == obj)
167
			return true;
168
		if (obj == null)
169
			return false;
170
		if (getClass() != obj.getClass())
171
			return false;
172
		ScratchOffer other = (ScratchOffer) obj;
173
		if (createdTimestamp == null) {
174
			if (other.createdTimestamp != null)
175
				return false;
176
		} else if (!createdTimestamp.equals(other.createdTimestamp))
177
			return false;
178
		if (customerId != other.customerId)
179
			return false;
180
		if (expiredTimestamp == null) {
181
			if (other.expiredTimestamp != null)
182
				return false;
183
		} else if (!expiredTimestamp.equals(other.expiredTimestamp))
184
			return false;
185
		if (id != other.id)
186
			return false;
187
		if (invoiceNumber == null) {
188
			if (other.invoiceNumber != null)
189
				return false;
190
		} else if (!invoiceNumber.equals(other.invoiceNumber))
191
			return false;
192
		if (offerName != other.offerName)
193
			return false;
194
		if (scracthedAt == null) {
195
			if (other.scracthedAt != null)
196
				return false;
197
		} else if (!scracthedAt.equals(other.scracthedAt))
198
			return false;
199
		if (scratched != other.scratched)
200
			return false;
201
		if (unlocked != other.unlocked)
202
			return false;
203
		if (unlockedAt == null) {
204
			if (other.unlockedAt != null)
205
				return false;
206
		} else if (!unlockedAt.equals(other.unlockedAt))
207
			return false;
208
		return true;
209
	}
210
 
211
	@Override
212
	public String toString() {
213
		return "ScratchOffer [id=" + id + ", invoiceNumber=" + invoiceNumber + ", customerId=" + customerId
214
				+ ", offerName=" + offerName + ", scratched=" + scratched + ", createdTimestamp=" + createdTimestamp
215
				+ ", unlockedAt=" + unlockedAt + ", scracthedAt=" + scracthedAt + ", unlocked=" + unlocked
216
				+ ", expiredTimestamp=" + expiredTimestamp + "]";
217
	}
218
 
219
}