Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
21720 ashik.ali 1
package com.spice.profitmandi.dao.entity.dtr;
21545 ashik.ali 2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
 
6
import javax.persistence.Column;
22009 ashik.ali 7
import javax.persistence.Convert;
21545 ashik.ali 8
import javax.persistence.Entity;
9
import javax.persistence.EnumType;
10
import javax.persistence.Enumerated;
11
import javax.persistence.GeneratedValue;
12
import javax.persistence.GenerationType;
13
import javax.persistence.Id;
14
import javax.persistence.Table;
15
import javax.persistence.UniqueConstraint;
16
 
22009 ashik.ali 17
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
21720 ashik.ali 18
import com.spice.profitmandi.dao.enumuration.dtr.PermissionType;
22009 ashik.ali 19
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
21545 ashik.ali 20
 
21
/**
22
 * This class basically contains permission details
23
 * 
24
 * @author ashikali
25
 *
26
 */
27
@Entity
22014 ashik.ali 28
@Table(name="dtr.permission", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"type","role_type"})})
21545 ashik.ali 29
 
30
public class Permission implements Serializable{
31
 
32
	private static final long serialVersionUID = 1L;
33
 
34
	public Permission() {
35
	}
36
 
37
	@Id
38
	@Column(name="id", unique=true, updatable=false)
39
	@GeneratedValue(strategy = GenerationType.IDENTITY)
40
	private int id;
41
 
42
	@Column(name="type")
43
    @Enumerated(EnumType.STRING)
44
    private PermissionType type;
45
 
22009 ashik.ali 46
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21545 ashik.ali 47
	@Column(name="create_timestamp", updatable = false)
48
	private LocalDateTime createTimestamp = LocalDateTime.now();
49
 
22009 ashik.ali 50
	@Column(name = "role_type")
23297 ashik.ali 51
	@Enumerated(EnumType.STRING)
22009 ashik.ali 52
    private RoleType roleType;
21545 ashik.ali 53
 
54
	public int getId() {
55
		return id;
56
	}
57
	public void setId(int id) {
58
		this.id = id;
59
	}
60
	public PermissionType getType() {
61
		return type;
62
	}
63
	public void setType(PermissionType type) {
64
		this.type = type;
65
	}
66
 
22009 ashik.ali 67
	public RoleType getRoleType() {
68
		return roleType;
21545 ashik.ali 69
	}
22009 ashik.ali 70
	public void setRoleType(RoleType roleType) {
71
		this.roleType = roleType;
21545 ashik.ali 72
	}
73
 
74
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
75
		this.createTimestamp = createTimestamp;
76
	}
77
    public LocalDateTime getCreateTimestamp() {
78
		return createTimestamp;
79
	}
80
 
21924 ashik.ali 81
 
21602 ashik.ali 82
	@Override
21924 ashik.ali 83
	public int hashCode() {
84
		final int prime = 31;
85
		int result = 1;
86
		result = prime * result + id;
87
		return result;
88
	}
89
	@Override
90
	public boolean equals(Object obj) {
91
		if (this == obj)
92
			return true;
93
		if (obj == null)
94
			return false;
95
		if (getClass() != obj.getClass())
96
			return false;
97
		Permission other = (Permission) obj;
98
		if (id != other.id)
99
			return false;
100
		return true;
101
	}
102
	@Override
21602 ashik.ali 103
	public String toString() {
22009 ashik.ali 104
		return "Permission [id=" + id + ", type=" + type + ", createTimestamp=" + createTimestamp + ", roleType=" + roleType
21693 ashik.ali 105
				+ "]";
21602 ashik.ali 106
	}
107
 
108
 
21545 ashik.ali 109
 
110
}