Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
22600 ashik.ali 1
package com.spice.profitmandi.dao.entity.catalog;
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;
9
import javax.persistence.GeneratedValue;
10
import javax.persistence.GenerationType;
11
import javax.persistence.Id;
22653 ashik.ali 12
import javax.persistence.NamedQueries;
13
import javax.persistence.NamedQuery;
22600 ashik.ali 14
import javax.persistence.Table;
15
import javax.persistence.UniqueConstraint;
16
 
17
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
18
import com.spice.profitmandi.dao.enumuration.catalog.SchemeAmountType;
22653 ashik.ali 19
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
22600 ashik.ali 20
 
21
/**
22
 * This class basically contains scheme details
23
 * 
24
 * @author ashikali
25
 *
26
 */
27
@Entity
22653 ashik.ali 28
@Table(name="catalog.scheme", schema = "catalog")
22600 ashik.ali 29
 
22653 ashik.ali 30
@NamedQueries({
31
	@NamedQuery(name = "Scheme.updateActiveTimestampById", query = "update Scheme s set s.activeTimestamp = :activeTimestamp where s.id= :id"),
32
	@NamedQuery(name = "Scheme.updateExpireTimestampById", query = "update Scheme s set s.expireTimestamp = :expireTimestamp where s.id= :id")
33
})
22600 ashik.ali 34
public class Scheme implements Serializable{
35
 
36
	private static final long serialVersionUID = 1L;
37
 
38
	public Scheme() {
39
	}
40
 
41
	@Id
42
	@Column(name="id")
43
	@GeneratedValue(strategy = GenerationType.IDENTITY)
44
	private int id;
45
 
22653 ashik.ali 46
	@Column(name = "name")
47
	private String name;
22600 ashik.ali 48
 
22653 ashik.ali 49
	@Column(name = "description")
50
	private String description;
22600 ashik.ali 51
 
22653 ashik.ali 52
	@Column(name = "type")
53
	private SchemeType type;
54
 
22600 ashik.ali 55
	@Column(name = "amount_type")
56
	private SchemeAmountType amountType;
57
 
58
	@Column(name = "amount")
59
	private float amount;
60
 
61
	@Convert(converter = LocalDateTimeAttributeConverter.class)
62
	@Column(name = "start_date")
63
	private LocalDateTime startDate = LocalDateTime.now();
64
 
65
	@Convert(converter = LocalDateTimeAttributeConverter.class)
22608 ashik.ali 66
	@Column(name = "end_date")
67
	private LocalDateTime endDate = LocalDateTime.now();
68
 
69
	@Convert(converter = LocalDateTimeAttributeConverter.class)
22600 ashik.ali 70
	@Column(name = "create_timestamp")
71
	private LocalDateTime createdTimestamp = LocalDateTime.now();
72
 
22653 ashik.ali 73
	@Convert(converter = LocalDateTimeAttributeConverter.class)
74
	@Column(name = "active_timestamp")
75
	private LocalDateTime activeTimestamp = null;
76
 
77
	@Convert(converter = LocalDateTimeAttributeConverter.class)
78
	@Column(name = "expired")
79
	private LocalDateTime expireTimestamp = null;
80
 
22600 ashik.ali 81
	@Column(name = "created_by")
82
	private int createdBy;
83
 
22653 ashik.ali 84
	@Column(name = "all")
85
	private boolean all;
22600 ashik.ali 86
 
87
	public int getId() {
88
		return id;
89
	}
90
	public void setId(int id) {
91
		this.id = id;
92
	}
93
 
22653 ashik.ali 94
	public String getName() {
95
		return name;
22600 ashik.ali 96
	}
22653 ashik.ali 97
	public void setName(String name) {
98
		this.name = name;
22600 ashik.ali 99
	}
100
 
22653 ashik.ali 101
	public String getDescription() {
102
		return description;
22600 ashik.ali 103
	}
22653 ashik.ali 104
 
105
	public void setDescription(String description) {
106
		this.description = description;
22600 ashik.ali 107
	}
108
 
22653 ashik.ali 109
	public SchemeType getType() {
110
		return type;
111
	}
112
 
113
	public void setType(SchemeType type) {
114
		this.type = type;
115
	}
116
 
117
 
22600 ashik.ali 118
	public SchemeAmountType getAmountType() {
119
		return amountType;
120
	}
121
 
122
	public void setAmountType(SchemeAmountType amountType) {
123
		this.amountType = amountType;
124
	}
125
 
126
	public float getAmount() {
127
		return amount;
128
	}
129
	public void setAmount(float amount) {
130
		this.amount = amount;
131
	}
132
 
133
	public LocalDateTime getStartDate() {
134
		return startDate;
135
	}
136
	public void setStartDate(LocalDateTime startDate) {
137
		this.startDate = startDate;
138
	}
22653 ashik.ali 139
 
140
	public LocalDateTime getEndDate() {
141
		return endDate;
142
	}
143
	public void setEndDate(LocalDateTime endDate) {
144
		this.endDate = endDate;
145
	}
146
 
22600 ashik.ali 147
	public LocalDateTime getCreatedTimestamp() {
148
		return createdTimestamp;
149
	}
150
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
151
		this.createdTimestamp = createdTimestamp;
152
	}
153
	public int getCreatedBy() {
154
		return createdBy;
155
	}
156
	public void setCreatedBy(int createdBy) {
157
		this.createdBy = createdBy;
158
	}
22653 ashik.ali 159
 
160
	public LocalDateTime getActiveTimestamp() {
161
		return activeTimestamp;
22600 ashik.ali 162
	}
22653 ashik.ali 163
 
164
	public void setActiveTimestamp(LocalDateTime activeTimestamp) {
165
		this.activeTimestamp = activeTimestamp;
22600 ashik.ali 166
	}
167
 
22653 ashik.ali 168
	public LocalDateTime getExpireTimestamp() {
169
		return expireTimestamp;
170
	}
171
 
172
	public void setExpireTimestamp(LocalDateTime expireTimestamp) {
173
		this.expireTimestamp = expireTimestamp;
174
	}
175
 
176
	public boolean isAll() {
177
		return all;
178
	}
179
 
180
	public void setAll(boolean all) {
181
		this.all = all;
182
	}
22600 ashik.ali 183
	@Override
184
	public int hashCode() {
185
		final int prime = 31;
186
		int result = 1;
187
		result = prime * result + id;
188
		return result;
189
	}
190
	@Override
191
	public boolean equals(Object obj) {
192
		if (this == obj)
193
			return true;
194
		if (obj == null)
195
			return false;
196
		if (getClass() != obj.getClass())
197
			return false;
198
		Scheme other = (Scheme) obj;
199
		if (id != other.id)
200
			return false;
201
		return true;
202
	}
203
	@Override
204
	public String toString() {
22653 ashik.ali 205
		return "Scheme [id=" + id + ", name=" + name + ", description=" + description + ", type=" + type
206
				+ ", amountType=" + amountType + ", amount=" + amount + ", startDate=" + startDate + ", endDate="
207
				+ endDate + ", createdTimestamp=" + createdTimestamp + ", activeTimestamp=" + activeTimestamp
208
				+ ", expireTimestamp=" + expireTimestamp + ", createdBy=" + createdBy + ", all=" + all + "]";
22600 ashik.ali 209
	}
22653 ashik.ali 210
 
22600 ashik.ali 211
}