Subversion Repositories SmartDukaan

Rev

Rev 22608 | Go to most recent revision | Details | 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)
56
	@Column(name = "create_timestamp")
57
	private LocalDateTime createdTimestamp = LocalDateTime.now();
58
 
59
	@Column(name = "created_by")
60
	private int createdBy;
61
 
62
	@Column(name = "active", columnDefinition="tinyint(1) default 0")
63
	private boolean active;
64
 
65
	public int getId() {
66
		return id;
67
	}
68
	public void setId(int id) {
69
		this.id = id;
70
	}
71
 
72
	public int getItemId() {
73
		return itemId;
74
	}
75
	public void setItemId(int itemId) {
76
		this.itemId = itemId;
77
	}
78
 
79
	public int getSchemeTagId() {
80
		return schemeTagId;
81
	}
82
	public void setSchemeTagId(int schemeTagId) {
83
		this.schemeTagId = schemeTagId;
84
	}
85
 
86
	public SchemeAmountType getAmountType() {
87
		return amountType;
88
	}
89
 
90
	public void setAmountType(SchemeAmountType amountType) {
91
		this.amountType = amountType;
92
	}
93
 
94
	public float getAmount() {
95
		return amount;
96
	}
97
	public void setAmount(float amount) {
98
		this.amount = amount;
99
	}
100
 
101
	public LocalDateTime getStartDate() {
102
		return startDate;
103
	}
104
	public void setStartDate(LocalDateTime startDate) {
105
		this.startDate = startDate;
106
	}
107
	public LocalDateTime getCreatedTimestamp() {
108
		return createdTimestamp;
109
	}
110
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
111
		this.createdTimestamp = createdTimestamp;
112
	}
113
	public int getCreatedBy() {
114
		return createdBy;
115
	}
116
	public void setCreatedBy(int createdBy) {
117
		this.createdBy = createdBy;
118
	}
119
    public boolean isActive() {
120
		return active;
121
	}
122
    public void setActive(boolean active) {
123
		this.active = active;
124
	}
125
 
126
	@Override
127
	public int hashCode() {
128
		final int prime = 31;
129
		int result = 1;
130
		result = prime * result + id;
131
		return result;
132
	}
133
	@Override
134
	public boolean equals(Object obj) {
135
		if (this == obj)
136
			return true;
137
		if (obj == null)
138
			return false;
139
		if (getClass() != obj.getClass())
140
			return false;
141
		Scheme other = (Scheme) obj;
142
		if (id != other.id)
143
			return false;
144
		return true;
145
	}
146
	@Override
147
	public String toString() {
148
		return "Scheme [id=" + id + ", itemId=" + itemId + ", schemeTagId=" + schemeTagId + ", amountType=" + amountType
149
				+ ", amount=" + amount + ", startDate=" + startDate + ", createdTimestamp=" + createdTimestamp
150
				+ ", createdBy=" + createdBy + ", active=" + active + "]";
151
	}
152
 
153
}