Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
26629 tejbeer 1
package com.spice.profitmandi.dao.entity.fofo;
2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
 
6
import javax.persistence.Column;
7
import javax.persistence.Convert;
8
import javax.persistence.Entity;
27046 tejbeer 9
import javax.persistence.EnumType;
10
import javax.persistence.Enumerated;
26629 tejbeer 11
import javax.persistence.GeneratedValue;
12
import javax.persistence.GenerationType;
13
import javax.persistence.Id;
14
import javax.persistence.Table;
26817 amit.gupta 15
import javax.persistence.Transient;
26629 tejbeer 16
import javax.persistence.UniqueConstraint;
17
 
18
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
27046 tejbeer 19
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
26629 tejbeer 20
 
21
@Entity
22
@Table(name = "fofo.pending_order_item", schema = "fofo", uniqueConstraints = {
23
		@UniqueConstraint(name = "UK_ORDER_ID_AND_ITEM_ID", columnNames = { "order_id", "item_id" }) })
24
public class PendingOrderItem implements Serializable {
25
 
27046 tejbeer 26
	public OrderStatus getStatus() {
27
		return status;
28
	}
29
 
26817 amit.gupta 30
	public String getItemName() {
31
		return itemName;
32
	}
33
 
34
	public void setItemName(String itemName) {
35
		this.itemName = itemName;
36
	}
37
 
26629 tejbeer 38
	private static final long serialVersionUID = 1L;
39
 
40
	@Id
41
	@Column(name = "id")
42
	@GeneratedValue(strategy = GenerationType.IDENTITY)
43
	private int id;
44
 
45
	@Column(name = "order_id")
46
	private int orderId;
47
 
48
	@Column(name = "item_id")
49
	private int itemId;
27046 tejbeer 50
 
26817 amit.gupta 51
	@Transient
52
	private String itemName;
27046 tejbeer 53
 
26924 amit.gupta 54
	@Transient
55
	private String imgUrl;
26629 tejbeer 56
 
26924 amit.gupta 57
	public String getImgUrl() {
58
		return imgUrl;
59
	}
60
 
61
	public void setImgUrl(String imgUrl) {
62
		this.imgUrl = imgUrl;
63
	}
64
 
26629 tejbeer 65
	@Column(name = "quantity")
66
	private int quantity;
67
 
68
	@Column(name = "selling_price")
69
	private float sellingPrice;
70
 
26721 tejbeer 71
	@Column(name = "status")
27046 tejbeer 72
	@Enumerated(EnumType.STRING)
73
	private OrderStatus status;
74
 
75
	@Column(name = "status_description")
76
	private String statusDescription;
28311 amit.gupta 77
 
78
	@Column(name = "cancelled_timestamp")
79
	private LocalDateTime cancelledTimestamp;
27046 tejbeer 80
 
81
	@Column(name = "billed_timestamp")
82
	private LocalDateTime billedTimestamp;
83
 
84
	public String getStatusDescription() {
85
		return statusDescription;
86
	}
87
 
88
	public LocalDateTime getBilledTimestamp() {
89
		return billedTimestamp;
90
	}
91
 
92
	public void setBilledTimestamp(LocalDateTime billedTimestamp) {
93
		this.billedTimestamp = billedTimestamp;
94
	}
95
 
96
	public void setStatusDescription(String statusDescription) {
97
		this.statusDescription = statusDescription;
98
	}
99
 
100
	public void setStatus(OrderStatus status) {
101
		this.status = status;
102
	}
28311 amit.gupta 103
 
27046 tejbeer 104
 
28311 amit.gupta 105
	public LocalDateTime getCancelledTimestamp() {
106
		return cancelledTimestamp;
107
	}
108
 
109
	public void setCancelledTimestamp(LocalDateTime cancelledTimestamp) {
110
		this.cancelledTimestamp = cancelledTimestamp;
111
	}
112
 
26924 amit.gupta 113
	@Column(name = "scheduled_delivery_time")
114
	private LocalDateTime scheduledDeliveryTime;
26721 tejbeer 115
 
26629 tejbeer 116
	@Convert(converter = LocalDateTimeAttributeConverter.class)
117
	@Column(name = "create_timestamp")
118
	private LocalDateTime createTimestamp = LocalDateTime.now();
119
 
26924 amit.gupta 120
	@Override
121
	public int hashCode() {
122
		final int prime = 31;
123
		int result = 1;
28311 amit.gupta 124
		result = prime * result + ((billedTimestamp == null) ? 0 : billedTimestamp.hashCode());
125
		result = prime * result + ((cancelledTimestamp == null) ? 0 : cancelledTimestamp.hashCode());
26924 amit.gupta 126
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
127
		result = prime * result + id;
128
		result = prime * result + ((imgUrl == null) ? 0 : imgUrl.hashCode());
129
		result = prime * result + itemId;
130
		result = prime * result + ((itemName == null) ? 0 : itemName.hashCode());
131
		result = prime * result + orderId;
132
		result = prime * result + quantity;
133
		result = prime * result + ((scheduledDeliveryTime == null) ? 0 : scheduledDeliveryTime.hashCode());
134
		result = prime * result + Float.floatToIntBits(sellingPrice);
135
		result = prime * result + ((status == null) ? 0 : status.hashCode());
28311 amit.gupta 136
		result = prime * result + ((statusDescription == null) ? 0 : statusDescription.hashCode());
26924 amit.gupta 137
		return result;
138
	}
139
 
140
	@Override
141
	public boolean equals(Object obj) {
142
		if (this == obj)
143
			return true;
144
		if (obj == null)
145
			return false;
146
		if (getClass() != obj.getClass())
147
			return false;
148
		PendingOrderItem other = (PendingOrderItem) obj;
28311 amit.gupta 149
		if (billedTimestamp == null) {
150
			if (other.billedTimestamp != null)
151
				return false;
152
		} else if (!billedTimestamp.equals(other.billedTimestamp))
153
			return false;
154
		if (cancelledTimestamp == null) {
155
			if (other.cancelledTimestamp != null)
156
				return false;
157
		} else if (!cancelledTimestamp.equals(other.cancelledTimestamp))
158
			return false;
26924 amit.gupta 159
		if (createTimestamp == null) {
160
			if (other.createTimestamp != null)
161
				return false;
162
		} else if (!createTimestamp.equals(other.createTimestamp))
163
			return false;
164
		if (id != other.id)
165
			return false;
166
		if (imgUrl == null) {
167
			if (other.imgUrl != null)
168
				return false;
169
		} else if (!imgUrl.equals(other.imgUrl))
170
			return false;
171
		if (itemId != other.itemId)
172
			return false;
173
		if (itemName == null) {
174
			if (other.itemName != null)
175
				return false;
176
		} else if (!itemName.equals(other.itemName))
177
			return false;
178
		if (orderId != other.orderId)
179
			return false;
180
		if (quantity != other.quantity)
181
			return false;
182
		if (scheduledDeliveryTime == null) {
183
			if (other.scheduledDeliveryTime != null)
184
				return false;
185
		} else if (!scheduledDeliveryTime.equals(other.scheduledDeliveryTime))
186
			return false;
187
		if (Float.floatToIntBits(sellingPrice) != Float.floatToIntBits(other.sellingPrice))
188
			return false;
28311 amit.gupta 189
		if (status != other.status)
190
			return false;
191
		if (statusDescription == null) {
192
			if (other.statusDescription != null)
26924 amit.gupta 193
				return false;
28311 amit.gupta 194
		} else if (!statusDescription.equals(other.statusDescription))
26924 amit.gupta 195
			return false;
196
		return true;
197
	}
198
 
199
	public LocalDateTime getScheduledDeliveryTime() {
200
		return scheduledDeliveryTime;
201
	}
202
 
203
	public void setScheduledDeliveryTime(LocalDateTime scheduledDeliveryTime) {
204
		this.scheduledDeliveryTime = scheduledDeliveryTime;
205
	}
206
 
26629 tejbeer 207
	public int getId() {
208
		return id;
209
	}
210
 
211
	public void setId(int id) {
212
		this.id = id;
213
	}
214
 
215
	public int getOrderId() {
216
		return orderId;
217
	}
218
 
219
	public void setOrderId(int orderId) {
220
		this.orderId = orderId;
221
	}
222
 
223
	public int getItemId() {
224
		return itemId;
225
	}
226
 
227
	public void setItemId(int itemId) {
228
		this.itemId = itemId;
229
	}
230
 
231
	public int getQuantity() {
232
		return quantity;
233
	}
234
 
235
	public void setQuantity(int quantity) {
236
		this.quantity = quantity;
237
	}
238
 
239
	public float getSellingPrice() {
240
		return sellingPrice;
241
	}
242
 
243
	public void setSellingPrice(float sellingPrice) {
244
		this.sellingPrice = sellingPrice;
245
	}
246
 
247
	public LocalDateTime getCreateTimestamp() {
248
		return createTimestamp;
249
	}
250
 
251
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
252
		this.createTimestamp = createTimestamp;
253
	}
254
 
255
	public static long getSerialversionuid() {
256
		return serialVersionUID;
257
	}
258
 
259
	@Override
260
	public String toString() {
26924 amit.gupta 261
		return "PendingOrderItem [id=" + id + ", orderId=" + orderId + ", itemId=" + itemId + ", itemName=" + itemName
262
				+ ", imgUrl=" + imgUrl + ", quantity=" + quantity + ", sellingPrice=" + sellingPrice + ", status="
28311 amit.gupta 263
				+ status + ", statusDescription=" + statusDescription + ", cancelledTimestamp=" + cancelledTimestamp
264
				+ ", billedTimestamp=" + billedTimestamp + ", scheduledDeliveryTime=" + scheduledDeliveryTime
265
				+ ", createTimestamp=" + createTimestamp + "]";
26629 tejbeer 266
	}
267
 
268
}