Subversion Repositories SmartDukaan

Rev

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