Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
24407 govind 1
/**
2
 * 
3
 */
4
package com.spice.profitmandi.dao.entity.cs;
5
 
24417 govind 6
import java.time.LocalDateTime;
24471 govind 7
import java.time.format.DateTimeFormatter;
24417 govind 8
 
24407 govind 9
import javax.persistence.Column;
24417 govind 10
import javax.persistence.Convert;
24407 govind 11
import javax.persistence.Entity;
12
import javax.persistence.EnumType;
13
import javax.persistence.Enumerated;
14
import javax.persistence.GeneratedValue;
15
import javax.persistence.GenerationType;
16
import javax.persistence.Id;
17
import javax.persistence.Table;
18
 
24417 govind 19
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
24407 govind 20
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
21
 
22
/**
23
 * @author govind
24
 *
25
 */
26
@Entity
27
@Table(name="cs.position" ,schema="cs")
28
public class Position {
29
 
30
	@Id
31
	@Column(name="id", unique=true, updatable=false)
32
	@GeneratedValue(strategy = GenerationType.IDENTITY)
33
	private int id;
34
 
35
	@Column(name="auth_user_id")
36
	private int authUserId;
37
 
38
	@Column(name="category_id")
39
	private int categoryId;
40
 
24417 govind 41
	@Column(name="region_id")
42
	private int regionId;
43
 
24407 govind 44
	@Column(name="escalation_type")
45
	@Enumerated(EnumType.STRING)
46
	private EscalationType escalationType;
24417 govind 47
 
48
	@Convert(converter = LocalDateTimeAttributeConverter.class)
49
	@Column(name = "create_timestamp")
50
	private LocalDateTime createTimestamp;
24407 govind 51
 
52
	public int getId() {
53
		return id;
54
	}
55
 
56
	public void setId(int id) {
57
		this.id = id;
58
	}
59
 
60
	public int getAuthUserId() {
61
		return authUserId;
62
	}
63
 
64
	public void setAuthUserId(int authUserId) {
65
		this.authUserId = authUserId;
66
	}
67
 
68
	public int getCategoryId() {
69
		return categoryId;
70
	}
71
 
72
	public void setCategoryId(int categoryId) {
73
		this.categoryId = categoryId;
74
	}
75
 
76
	public EscalationType getEscalationType() {
77
		return escalationType;
78
	}
79
 
80
	public void setEscalationType(EscalationType escalationType) {
81
		this.escalationType = escalationType;
82
	}
83
 
24417 govind 84
	public int getRegionId() {
85
		return regionId;
86
	}
87
 
88
	public void setRegionId(int regionId) {
89
		this.regionId = regionId;
90
	}
91
 
92
	public LocalDateTime getCreateTimestamp() {
93
		return createTimestamp;
94
	}
95
 
96
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
97
		this.createTimestamp = createTimestamp;
98
	}
24471 govind 99
	public String getFormattedCreateTimestamp(){
100
		if(createTimestamp == null){
101
			return null;
102
		}
103
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
104
		return createTimestamp.format(formatter);
105
    }
24407 govind 106
	@Override
107
	public int hashCode() {
108
		final int prime = 31;
109
		int result = 1;
110
		result = prime * result + authUserId;
111
		result = prime * result + categoryId;
24417 govind 112
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
24407 govind 113
		result = prime * result + ((escalationType == null) ? 0 : escalationType.hashCode());
114
		result = prime * result + id;
24417 govind 115
		result = prime * result + regionId;
24407 govind 116
		return result;
117
	}
118
 
119
	@Override
120
	public boolean equals(Object obj) {
121
		if (this == obj)
122
			return true;
123
		if (obj == null)
124
			return false;
125
		if (getClass() != obj.getClass())
126
			return false;
127
		Position other = (Position) obj;
128
		if (authUserId != other.authUserId)
129
			return false;
130
		if (categoryId != other.categoryId)
131
			return false;
24417 govind 132
		if (createTimestamp == null) {
133
			if (other.createTimestamp != null)
134
				return false;
135
		} else if (!createTimestamp.equals(other.createTimestamp))
136
			return false;
24407 govind 137
		if (escalationType != other.escalationType)
138
			return false;
139
		if (id != other.id)
140
			return false;
24417 govind 141
		if (regionId != other.regionId)
142
			return false;
24407 govind 143
		return true;
144
	}
145
 
146
	@Override
147
	public String toString() {
24417 govind 148
		return "Position [id=" + id + ", authUserId=" + authUserId + ", categoryId=" + categoryId + ", regionId="
149
				+ regionId + ", escalationType=" + escalationType + ", createTimestamp=" + createTimestamp + "]";
24407 govind 150
	}
151
 
152
 
153
 
154
}