Subversion Repositories SmartDukaan

Rev

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

Rev 22608 Rev 22653
Line 7... Line 7...
7
import javax.persistence.Convert;
7
import javax.persistence.Convert;
8
import javax.persistence.Entity;
8
import javax.persistence.Entity;
9
import javax.persistence.GeneratedValue;
9
import javax.persistence.GeneratedValue;
10
import javax.persistence.GenerationType;
10
import javax.persistence.GenerationType;
11
import javax.persistence.Id;
11
import javax.persistence.Id;
-
 
12
import javax.persistence.NamedQueries;
-
 
13
import javax.persistence.NamedQuery;
12
import javax.persistence.Table;
14
import javax.persistence.Table;
13
import javax.persistence.UniqueConstraint;
15
import javax.persistence.UniqueConstraint;
14
 
16
 
15
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
17
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
16
import com.spice.profitmandi.dao.enumuration.catalog.SchemeAmountType;
18
import com.spice.profitmandi.dao.enumuration.catalog.SchemeAmountType;
-
 
19
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
17
 
20
 
18
/**
21
/**
19
 * This class basically contains scheme details
22
 * This class basically contains scheme details
20
 * 
23
 * 
21
 * @author ashikali
24
 * @author ashikali
22
 *
25
 *
23
 */
26
 */
24
@Entity
27
@Entity
25
@Table(name="catalog.scheme", schema = "catalog", uniqueConstraints = {@UniqueConstraint(columnNames = {"item_id", "scheme_tag_id", "start_date"})})
28
@Table(name="catalog.scheme", schema = "catalog")
26
 
29
 
-
 
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
})
27
public class Scheme implements Serializable{
34
public class Scheme implements Serializable{
28
	
35
	
29
	private static final long serialVersionUID = 1L;
36
	private static final long serialVersionUID = 1L;
30
	
37
	
31
	public Scheme() {
38
	public Scheme() {
Line 34... Line 41...
34
	@Id
41
	@Id
35
	@Column(name="id")
42
	@Column(name="id")
36
	@GeneratedValue(strategy = GenerationType.IDENTITY)
43
	@GeneratedValue(strategy = GenerationType.IDENTITY)
37
	private int id;
44
	private int id;
38
	
45
	
39
	@Column(name="item_id")
46
	@Column(name = "name")
40
	private int itemId;
47
	private String name;
41
	
48
	
42
	@Column(name = "scheme_tag_id")
49
	@Column(name = "description")
-
 
50
	private String description;
-
 
51
	
-
 
52
	@Column(name = "type")
43
	private int schemeTagId;
53
	private SchemeType type;
44
	
54
	
45
	@Column(name = "amount_type")
55
	@Column(name = "amount_type")
46
	private SchemeAmountType amountType;
56
	private SchemeAmountType amountType;
47
	
57
	
48
	@Column(name = "amount")
58
	@Column(name = "amount")
Line 58... Line 68...
58
	
68
	
59
	@Convert(converter = LocalDateTimeAttributeConverter.class)
69
	@Convert(converter = LocalDateTimeAttributeConverter.class)
60
	@Column(name = "create_timestamp")
70
	@Column(name = "create_timestamp")
61
	private LocalDateTime createdTimestamp = LocalDateTime.now();
71
	private LocalDateTime createdTimestamp = LocalDateTime.now();
62
	
72
	
-
 
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
	
63
	@Column(name = "created_by")
81
	@Column(name = "created_by")
64
	private int createdBy;
82
	private int createdBy;
65
	
83
	
66
	@Column(name = "active", columnDefinition="tinyint(1) default 0")
84
	@Column(name = "all")
67
	private boolean active;
85
	private boolean all;
68
	
86
	
69
	public int getId() {
87
	public int getId() {
70
		return id;
88
		return id;
71
	}
89
	}
72
	public void setId(int id) {
90
	public void setId(int id) {
73
		this.id = id;
91
		this.id = id;
74
	}
92
	}
75
	
93
	
76
	public int getItemId() {
94
	public String getName() {
77
		return itemId;
95
		return name;
78
	}
96
	}
79
	public void setItemId(int itemId) {
97
	public void setName(String name) {
80
		this.itemId = itemId;
98
		this.name = name;
81
	}
99
	}
82
	
100
	
83
	public int getSchemeTagId() {
101
	public String getDescription() {
84
		return schemeTagId;
102
		return description;
85
	}
103
	}
-
 
104
	
86
	public void setSchemeTagId(int schemeTagId) {
105
	public void setDescription(String description) {
87
		this.schemeTagId = schemeTagId;
106
		this.description = description;
88
	}
107
	}
89
	
108
	
-
 
109
	public SchemeType getType() {
-
 
110
		return type;
-
 
111
	}
-
 
112
	
-
 
113
	public void setType(SchemeType type) {
-
 
114
		this.type = type;
-
 
115
	}
-
 
116
	
-
 
117
	
90
	public SchemeAmountType getAmountType() {
118
	public SchemeAmountType getAmountType() {
91
		return amountType;
119
		return amountType;
92
	}
120
	}
93
	
121
	
94
	public void setAmountType(SchemeAmountType amountType) {
122
	public void setAmountType(SchemeAmountType amountType) {
Line 106... Line 134...
106
		return startDate;
134
		return startDate;
107
	}
135
	}
108
	public void setStartDate(LocalDateTime startDate) {
136
	public void setStartDate(LocalDateTime startDate) {
109
		this.startDate = startDate;
137
		this.startDate = startDate;
110
	}
138
	}
-
 
139
	
-
 
140
	public LocalDateTime getEndDate() {
-
 
141
		return endDate;
-
 
142
	}
-
 
143
	public void setEndDate(LocalDateTime endDate) {
-
 
144
		this.endDate = endDate;
-
 
145
	}
-
 
146
	
111
	public LocalDateTime getCreatedTimestamp() {
147
	public LocalDateTime getCreatedTimestamp() {
112
		return createdTimestamp;
148
		return createdTimestamp;
113
	}
149
	}
114
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
150
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
115
		this.createdTimestamp = createdTimestamp;
151
		this.createdTimestamp = createdTimestamp;
Line 118... Line 154...
118
		return createdBy;
154
		return createdBy;
119
	}
155
	}
120
	public void setCreatedBy(int createdBy) {
156
	public void setCreatedBy(int createdBy) {
121
		this.createdBy = createdBy;
157
		this.createdBy = createdBy;
122
	}
158
	}
-
 
159
	
123
    public boolean isActive() {
160
	public LocalDateTime getActiveTimestamp() {
124
		return active;
161
		return activeTimestamp;
125
	}
162
	}
-
 
163
	
126
    public void setActive(boolean active) {
164
	public void setActiveTimestamp(LocalDateTime activeTimestamp) {
127
		this.active = active;
165
		this.activeTimestamp = activeTimestamp;
128
	}
166
	}
129
    
167
    
-
 
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
	}
130
	@Override
183
	@Override
131
	public int hashCode() {
184
	public int hashCode() {
132
		final int prime = 31;
185
		final int prime = 31;
133
		int result = 1;
186
		int result = 1;
134
		result = prime * result + id;
187
		result = prime * result + id;
Line 147... Line 200...
147
			return false;
200
			return false;
148
		return true;
201
		return true;
149
	}
202
	}
150
	@Override
203
	@Override
151
	public String toString() {
204
	public String toString() {
152
		return "Scheme [id=" + id + ", itemId=" + itemId + ", schemeTagId=" + schemeTagId + ", amountType=" + amountType
205
		return "Scheme [id=" + id + ", name=" + name + ", description=" + description + ", type=" + type
153
				+ ", amount=" + amount + ", startDate=" + startDate + ", createdTimestamp=" + createdTimestamp
206
				+ ", amountType=" + amountType + ", amount=" + amount + ", startDate=" + startDate + ", endDate="
154
				+ ", createdBy=" + createdBy + ", active=" + active + "]";
207
				+ endDate + ", createdTimestamp=" + createdTimestamp + ", activeTimestamp=" + activeTimestamp
-
 
208
				+ ", expireTimestamp=" + expireTimestamp + ", createdBy=" + createdBy + ", all=" + all + "]";
155
	}
209
	}
156
    
210
	
157
}
211
}
158
212