Subversion Repositories SmartDukaan

Rev

Rev 22600 | Rev 22653 | 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;
12
import javax.persistence.Table;
13
import javax.persistence.UniqueConstraint;
14
 
15
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
16
import com.spice.profitmandi.dao.enumuration.catalog.SchemeAmountType;
17
 
18
/**
19
 * This class basically contains scheme details
20
 * 
21
 * @author ashikali
22
 *
23
 */
24
@Entity
25
@Table(name="catalog.scheme", schema = "catalog", uniqueConstraints = {@UniqueConstraint(columnNames = {"item_id", "scheme_tag_id", "start_date"})})
26
 
27
public class Scheme implements Serializable{
28
 
29
	private static final long serialVersionUID = 1L;
30
 
31
	public Scheme() {
32
	}
33
 
34
	@Id
35
	@Column(name="id")
36
	@GeneratedValue(strategy = GenerationType.IDENTITY)
37
	private int id;
38
 
39
	@Column(name="item_id")
40
	private int itemId;
41
 
42
	@Column(name = "scheme_tag_id")
43
	private int schemeTagId;
44
 
45
	@Column(name = "amount_type")
46
	private SchemeAmountType amountType;
47
 
48
	@Column(name = "amount")
49
	private float amount;
50
 
51
	@Convert(converter = LocalDateTimeAttributeConverter.class)
52
	@Column(name = "start_date")
53
	private LocalDateTime startDate = LocalDateTime.now();
54
 
55
	@Convert(converter = LocalDateTimeAttributeConverter.class)
22608 ashik.ali 56
	@Column(name = "end_date")
57
	private LocalDateTime endDate = LocalDateTime.now();
58
 
59
	@Convert(converter = LocalDateTimeAttributeConverter.class)
22600 ashik.ali 60
	@Column(name = "create_timestamp")
61
	private LocalDateTime createdTimestamp = LocalDateTime.now();
62
 
63
	@Column(name = "created_by")
64
	private int createdBy;
65
 
66
	@Column(name = "active", columnDefinition="tinyint(1) default 0")
67
	private boolean active;
68
 
69
	public int getId() {
70
		return id;
71
	}
72
	public void setId(int id) {
73
		this.id = id;
74
	}
75
 
76
	public int getItemId() {
77
		return itemId;
78
	}
79
	public void setItemId(int itemId) {
80
		this.itemId = itemId;
81
	}
82
 
83
	public int getSchemeTagId() {
84
		return schemeTagId;
85
	}
86
	public void setSchemeTagId(int schemeTagId) {
87
		this.schemeTagId = schemeTagId;
88
	}
89
 
90
	public SchemeAmountType getAmountType() {
91
		return amountType;
92
	}
93
 
94
	public void setAmountType(SchemeAmountType amountType) {
95
		this.amountType = amountType;
96
	}
97
 
98
	public float getAmount() {
99
		return amount;
100
	}
101
	public void setAmount(float amount) {
102
		this.amount = amount;
103
	}
104
 
105
	public LocalDateTime getStartDate() {
106
		return startDate;
107
	}
108
	public void setStartDate(LocalDateTime startDate) {
109
		this.startDate = startDate;
110
	}
111
	public LocalDateTime getCreatedTimestamp() {
112
		return createdTimestamp;
113
	}
114
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
115
		this.createdTimestamp = createdTimestamp;
116
	}
117
	public int getCreatedBy() {
118
		return createdBy;
119
	}
120
	public void setCreatedBy(int createdBy) {
121
		this.createdBy = createdBy;
122
	}
123
    public boolean isActive() {
124
		return active;
125
	}
126
    public void setActive(boolean active) {
127
		this.active = active;
128
	}
129
 
130
	@Override
131
	public int hashCode() {
132
		final int prime = 31;
133
		int result = 1;
134
		result = prime * result + id;
135
		return result;
136
	}
137
	@Override
138
	public boolean equals(Object obj) {
139
		if (this == obj)
140
			return true;
141
		if (obj == null)
142
			return false;
143
		if (getClass() != obj.getClass())
144
			return false;
145
		Scheme other = (Scheme) obj;
146
		if (id != other.id)
147
			return false;
148
		return true;
149
	}
150
	@Override
151
	public String toString() {
152
		return "Scheme [id=" + id + ", itemId=" + itemId + ", schemeTagId=" + schemeTagId + ", amountType=" + amountType
153
				+ ", amount=" + amount + ", startDate=" + startDate + ", createdTimestamp=" + createdTimestamp
154
				+ ", createdBy=" + createdBy + ", active=" + active + "]";
155
	}
156
 
157
}