Subversion Repositories SmartDukaan

Rev

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

Rev 21984 Rev 22009
Line 22... Line 22...
22
 */
22
 */
23
@Entity
23
@Entity
24
@Table(name="fofo.purchase", schema = "fofo")
24
@Table(name="fofo.purchase", schema = "fofo")
25
 
25
 
26
public class Purchase implements Serializable{
26
public class Purchase implements Serializable{
27
	
-
 
28
	@Override
-
 
29
	public int hashCode() {
-
 
30
		final int prime = 31;
-
 
31
		int result = 1;
-
 
32
		result = prime * result + (completed ? 1231 : 1237);
-
 
33
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
-
 
34
		result = prime * result + fofoId;
-
 
35
		result = prime * result + id;
-
 
36
		result = prime * result + nonSerializedQuantity;
-
 
37
		result = prime * result + ((purchaseReference == null) ? 0 : purchaseReference.hashCode());
-
 
38
		result = prime * result + serializedQuantity;
-
 
39
		result = prime * result + unfullfilledNonSerializedQuantity;
-
 
40
		result = prime * result + unfullfilledSerializedQuantity;
-
 
41
		return result;
-
 
42
	}
-
 
43
	@Override
-
 
44
	public boolean equals(Object obj) {
-
 
45
		if (this == obj)
-
 
46
			return true;
-
 
47
		if (obj == null)
-
 
48
			return false;
-
 
49
		if (getClass() != obj.getClass())
-
 
50
			return false;
-
 
51
		Purchase other = (Purchase) obj;
-
 
52
		if (completed != other.completed)
-
 
53
			return false;
-
 
54
		if (createTimestamp == null) {
-
 
55
			if (other.createTimestamp != null)
-
 
56
				return false;
-
 
57
		} else if (!createTimestamp.equals(other.createTimestamp))
-
 
58
			return false;
-
 
59
		if (fofoId != other.fofoId)
-
 
60
			return false;
-
 
61
		if (id != other.id)
-
 
62
			return false;
-
 
63
		if (nonSerializedQuantity != other.nonSerializedQuantity)
-
 
64
			return false;
-
 
65
		if (purchaseReference == null) {
-
 
66
			if (other.purchaseReference != null)
-
 
67
				return false;
-
 
68
		} else if (!purchaseReference.equals(other.purchaseReference))
-
 
69
			return false;
-
 
70
		if (serializedQuantity != other.serializedQuantity)
-
 
71
			return false;
-
 
72
		if (unfullfilledNonSerializedQuantity != other.unfullfilledNonSerializedQuantity)
-
 
73
			return false;
-
 
74
		if (unfullfilledSerializedQuantity != other.unfullfilledSerializedQuantity)
-
 
75
			return false;
-
 
76
		return true;
-
 
77
	}
-
 
78
 
27
 
79
	private static final long serialVersionUID = 1L;
28
	private static final long serialVersionUID = 1L;
80
	
29
	
81
	public Purchase() {
30
	public Purchase() {
82
	}
31
	}
Line 159... Line 108...
159
		return completed;
108
		return completed;
160
	}
109
	}
161
	public void setCompleted(boolean completed) {
110
	public void setCompleted(boolean completed) {
162
		this.completed = completed;
111
		this.completed = completed;
163
	}
112
	}
164
	@Override
-
 
165
	public String toString() {
-
 
166
		return "Purchase [id=" + id + ", purchaseReference=" + purchaseReference + ", serializedQuantity="
-
 
167
				+ serializedQuantity + ", nonSerializedQuantity=" + nonSerializedQuantity
-
 
168
				+ ", unfullfilledSerializedQuantity=" + unfullfilledSerializedQuantity
-
 
169
				+ ", unfullfilledNonSerializedQuantity=" + unfullfilledNonSerializedQuantity + ", completed="
-
 
170
				+ completed + ", createTimestamp=" + createTimestamp + "]";
-
 
171
	}
-
 
172
	public LocalDateTime getCreateTimestamp() {
113
	public LocalDateTime getCreateTimestamp() {
173
		return createTimestamp;
114
		return createTimestamp;
174
	}
115
	}
175
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
116
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
176
		this.createTimestamp = createTimestamp;
117
		this.createTimestamp = createTimestamp;
Line 178... Line 119...
178
    
119
    
179
    public String getFormattedDate(){
120
    public String getFormattedDate(){
180
    	DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
121
    	DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
181
		return this.createTimestamp.format(formatter);
122
		return this.createTimestamp.format(formatter);
182
    }
123
    }
-
 
124
    
-
 
125
    
-
 
126
    
-
 
127
    @Override
-
 
128
	public int hashCode() {
-
 
129
		final int prime = 31;
-
 
130
		int result = 1;
-
 
131
		result = prime * result + id;
-
 
132
		return result;
183
	
133
	}
-
 
134
	@Override
-
 
135
	public boolean equals(Object obj) {
-
 
136
		if (this == obj)
-
 
137
			return true;
-
 
138
		if (obj == null)
-
 
139
			return false;
-
 
140
		if (getClass() != obj.getClass())
-
 
141
			return false;
-
 
142
		Purchase other = (Purchase) obj;
-
 
143
		if (id != other.id)
-
 
144
			return false;
-
 
145
		return true;
-
 
146
	}
-
 
147
	@Override
-
 
148
	public String toString() {
-
 
149
		return "Purchase [id=" + id + ", purchaseReference=" + purchaseReference + ", serializedQuantity="
-
 
150
				+ serializedQuantity + ", nonSerializedQuantity=" + nonSerializedQuantity
-
 
151
				+ ", unfullfilledSerializedQuantity=" + unfullfilledSerializedQuantity
-
 
152
				+ ", unfullfilledNonSerializedQuantity=" + unfullfilledNonSerializedQuantity + ", completed="
-
 
153
				+ completed + ", createTimestamp=" + createTimestamp + "]";
-
 
154
	}
184
    
155
    
185
}
156
}
186
157