Subversion Repositories SmartDukaan

Rev

Rev 21988 | Rev 22243 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21988 Rev 22009
Line 4... Line 4...
4
import java.time.LocalDateTime;
4
import java.time.LocalDateTime;
5
import java.util.List;
5
import java.util.List;
6
 
6
 
7
import javax.persistence.CascadeType;
7
import javax.persistence.CascadeType;
8
import javax.persistence.Column;
8
import javax.persistence.Column;
-
 
9
import javax.persistence.Convert;
9
import javax.persistence.Entity;
10
import javax.persistence.Entity;
10
import javax.persistence.FetchType;
11
import javax.persistence.FetchType;
11
import javax.persistence.GeneratedValue;
12
import javax.persistence.GeneratedValue;
12
import javax.persistence.GenerationType;
13
import javax.persistence.GenerationType;
13
import javax.persistence.Id;
14
import javax.persistence.Id;
Line 16... Line 17...
16
import javax.persistence.NamedQueries;
17
import javax.persistence.NamedQueries;
17
import javax.persistence.NamedQuery;
18
import javax.persistence.NamedQuery;
18
import javax.persistence.OneToMany;
19
import javax.persistence.OneToMany;
19
import javax.persistence.Table;
20
import javax.persistence.Table;
20
 
21
 
-
 
22
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
-
 
23
 
21
@Entity
24
@Entity
22
@Table(name="fofo.fofo_order", schema = "fofo")
25
@Table(name="fofo.fofo_order", schema = "fofo")
23
@NamedQueries({
26
@NamedQueries({
24
	@NamedQuery(name = "FofoOrder.selectCount", query = "select count(fo) from FofoOrder fo"),
27
	@NamedQuery(name = "FofoOrder.selectCount", query = "select count(fo) from FofoOrder fo"),
25
	@NamedQuery(name = "FofoOrder.selectById", query = "select fo from FofoOrder fo where fo.id = :id"),
28
	@NamedQuery(name = "FofoOrder.selectById", query = "select fo from FofoOrder fo where fo.id = :id"),
Line 49... Line 52...
49
	private float totalAmount;
52
	private float totalAmount;
50
	
53
	
51
	@Column(name = "invoice_number", length = 50)
54
	@Column(name = "invoice_number", length = 50)
52
	private String invoiceNumber;
55
	private String invoiceNumber;
53
	
56
	
-
 
57
	@Convert(converter = LocalDateTimeAttributeConverter.class)
54
	@Column(name = "create_timestamp")
58
	@Column(name = "create_timestamp")
55
	private LocalDateTime createTimestamp = LocalDateTime.now();
59
	private LocalDateTime createTimestamp = LocalDateTime.now();
56
	
60
	
57
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
61
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
58
	@JoinColumn(name="order_id",insertable=false,updatable=false,nullable=false)
62
	@JoinColumn(name="order_id",insertable=false,updatable=false,nullable=false)
59
	private List<FofoLineItem> fofoLineItem;	
63
	private List<FofoLineItem> fofoLineItem;	
60
	
64
	
61
	@Override
-
 
62
	public int hashCode() {
-
 
63
		final int prime = 31;
-
 
64
		int result = 1;
-
 
65
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
-
 
66
		result = prime * result + ((customer == null) ? 0 : customer.hashCode());
-
 
67
		result = prime * result + customerAddressId;
-
 
68
		result = prime * result + customerId;
-
 
69
		result = prime * result + fofoId;
-
 
70
		result = prime * result + ((fofoLineItem == null) ? 0 : fofoLineItem.hashCode());
-
 
71
		result = prime * result + id;
-
 
72
		result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
-
 
73
		result = prime * result + ((paymentOption == null) ? 0 : paymentOption.hashCode());
-
 
74
		result = prime * result + Float.floatToIntBits(totalAmount);
-
 
75
		return result;
-
 
76
	}
-
 
77
	@Override
-
 
78
	public boolean equals(Object obj) {
-
 
79
		if (this == obj)
-
 
80
			return true;
-
 
81
		if (obj == null)
-
 
82
			return false;
-
 
83
		if (getClass() != obj.getClass())
-
 
84
			return false;
-
 
85
		FofoOrder other = (FofoOrder) obj;
-
 
86
		if (createTimestamp == null) {
-
 
87
			if (other.createTimestamp != null)
-
 
88
				return false;
-
 
89
		} else if (!createTimestamp.equals(other.createTimestamp))
-
 
90
			return false;
-
 
91
		if (customer == null) {
-
 
92
			if (other.customer != null)
-
 
93
				return false;
-
 
94
		} else if (!customer.equals(other.customer))
-
 
95
			return false;
-
 
96
		if (customerAddressId != other.customerAddressId)
-
 
97
			return false;
-
 
98
		if (customerId != other.customerId)
-
 
99
			return false;
-
 
100
		if (fofoId != other.fofoId)
-
 
101
			return false;
-
 
102
		if (fofoLineItem == null) {
-
 
103
			if (other.fofoLineItem != null)
-
 
104
				return false;
-
 
105
		} else if (!fofoLineItem.equals(other.fofoLineItem))
-
 
106
			return false;
-
 
107
		if (id != other.id)
-
 
108
			return false;
-
 
109
		if (invoiceNumber == null) {
-
 
110
			if (other.invoiceNumber != null)
-
 
111
				return false;
-
 
112
		} else if (!invoiceNumber.equals(other.invoiceNumber))
-
 
113
			return false;
-
 
114
		if (paymentOption == null) {
-
 
115
			if (other.paymentOption != null)
-
 
116
				return false;
-
 
117
		} else if (!paymentOption.equals(other.paymentOption))
-
 
118
			return false;
-
 
119
		if (Float.floatToIntBits(totalAmount) != Float.floatToIntBits(other.totalAmount))
-
 
120
			return false;
-
 
121
		return true;
-
 
122
	}
65
	
123
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
66
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
124
	@JoinColumn(name="order_id",insertable=false,updatable=false,nullable=false)
67
	@JoinColumn(name="order_id",insertable=false,updatable=false,nullable=false)
125
	private List<PaymentOption> paymentOption;	
68
	private List<PaymentOption> paymentOption;	
126
	
69
	
127
	public List<PaymentOption> getPaymentOption() {
70
	public List<PaymentOption> getPaymentOption() {
Line 196... Line 139...
196
		return createTimestamp;
139
		return createTimestamp;
197
	}
140
	}
198
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
141
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
199
		this.createTimestamp = createTimestamp;
142
		this.createTimestamp = createTimestamp;
200
	}
143
	}
-
 
144
	
-
 
145
	
-
 
146
	@Override
-
 
147
	public int hashCode() {
-
 
148
		final int prime = 31;
-
 
149
		int result = 1;
-
 
150
		result = prime * result + id;
-
 
151
		return result;
-
 
152
	}
-
 
153
	@Override
-
 
154
	public boolean equals(Object obj) {
-
 
155
		if (this == obj)
-
 
156
			return true;
-
 
157
		if (obj == null)
-
 
158
			return false;
-
 
159
		if (getClass() != obj.getClass())
-
 
160
			return false;
-
 
161
		FofoOrder other = (FofoOrder) obj;
-
 
162
		if (id != other.id)
-
 
163
			return false;
-
 
164
		return true;
-
 
165
	}
201
	@Override
166
	@Override
202
	public String toString() {
167
	public String toString() {
203
		return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="
168
		return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="
204
				+ customerAddressId + ", totalAmount=" + totalAmount + ", invoiceNumber=" + invoiceNumber
169
				+ customerAddressId + ", totalAmount=" + totalAmount + ", invoiceNumber=" + invoiceNumber
205
				+ ", createTimestamp=" + createTimestamp + ", fofoLineItem=" + fofoLineItem + ", paymentOption="
170
				+ ", createTimestamp=" + createTimestamp + ", fofoLineItem=" + fofoLineItem + ", paymentOption="