Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
37164 amit 1
package com.spice.profitmandi.dao.entity.user;
2
 
3
import javax.persistence.*;
4
import java.time.LocalDateTime;
5
 
6
/**
7
 * One lifecycle instance of a partner agenda. At most one OPEN row per
8
 * (fofoId, agendaType) — enforced by the DB unique key uq_one_open on the
9
 * generated open_marker column (1 while OPEN, NULL when CLOSED).
10
 * AUTO instances open/close only via the nightly rule cron; MANUAL instances
11
 * are opened from the Assign Visit modal and closed by the visiting team.
12
 */
13
@Entity
14
@NamedQueries({
15
        @NamedQuery(
16
                name = "AgendaInstance.selectOpenByFofoId",
17
                query = "SELECT a FROM AgendaInstance a WHERE a.fofoId = :fofoId AND a.status = 'OPEN' ORDER BY a.openedOn ASC"),
18
        @NamedQuery(
19
                name = "AgendaInstance.selectOpenByFofoIdAndType",
20
                query = "SELECT a FROM AgendaInstance a WHERE a.fofoId = :fofoId AND a.agendaType = :agendaType AND a.status = 'OPEN'"),
21
        @NamedQuery(
22
                name = "AgendaInstance.selectOpenByFofoIds",
23
                query = "SELECT a FROM AgendaInstance a WHERE a.fofoId IN :fofoIds AND a.status = 'OPEN' ORDER BY a.fofoId ASC, a.openedOn ASC")
24
})
25
@Table(name = "user.agenda_instance")
26
public class AgendaInstance {
27
 
28
    @Id
29
    @Column(name = "id", unique = true, updatable = false)
30
    @GeneratedValue(strategy = GenerationType.IDENTITY)
31
    private int id;
32
 
33
    @Column(name = "fofo_id")
34
    private int fofoId;
35
 
36
    @Column(name = "agenda_type")
37
    private String agendaType;
38
 
39
    @Column(name = "source")
40
    private String source;
41
 
42
    @Column(name = "status")
43
    private String status;
44
 
45
    @Column(name = "opened_on")
46
    private LocalDateTime openedOn;
47
 
48
    @Column(name = "opened_by")
49
    private Integer openedBy;
50
 
51
    @Column(name = "open_metric")
52
    private String openMetric;
53
 
54
    @Column(name = "closed_on")
55
    private LocalDateTime closedOn;
56
 
57
    @Column(name = "closed_by")
58
    private Integer closedBy;
59
 
60
    @Column(name = "close_metric")
61
    private String closeMetric;
62
 
63
    @Column(name = "close_remark")
64
    private String closeRemark;
65
 
66
    // DB-generated: 1 while OPEN, NULL when CLOSED (backs uq_one_open).
67
    @Column(name = "open_marker", insertable = false, updatable = false)
68
    private Integer openMarker;
69
 
70
    public int getId() {
71
        return id;
72
    }
73
 
74
    public void setId(int id) {
75
        this.id = id;
76
    }
77
 
78
    public int getFofoId() {
79
        return fofoId;
80
    }
81
 
82
    public void setFofoId(int fofoId) {
83
        this.fofoId = fofoId;
84
    }
85
 
86
    public String getAgendaType() {
87
        return agendaType;
88
    }
89
 
90
    public void setAgendaType(String agendaType) {
91
        this.agendaType = agendaType;
92
    }
93
 
94
    public String getSource() {
95
        return source;
96
    }
97
 
98
    public void setSource(String source) {
99
        this.source = source;
100
    }
101
 
102
    public String getStatus() {
103
        return status;
104
    }
105
 
106
    public void setStatus(String status) {
107
        this.status = status;
108
    }
109
 
110
    public LocalDateTime getOpenedOn() {
111
        return openedOn;
112
    }
113
 
114
    public void setOpenedOn(LocalDateTime openedOn) {
115
        this.openedOn = openedOn;
116
    }
117
 
118
    public Integer getOpenedBy() {
119
        return openedBy;
120
    }
121
 
122
    public void setOpenedBy(Integer openedBy) {
123
        this.openedBy = openedBy;
124
    }
125
 
126
    public String getOpenMetric() {
127
        return openMetric;
128
    }
129
 
130
    public void setOpenMetric(String openMetric) {
131
        this.openMetric = openMetric;
132
    }
133
 
134
    public LocalDateTime getClosedOn() {
135
        return closedOn;
136
    }
137
 
138
    public void setClosedOn(LocalDateTime closedOn) {
139
        this.closedOn = closedOn;
140
    }
141
 
142
    public Integer getClosedBy() {
143
        return closedBy;
144
    }
145
 
146
    public void setClosedBy(Integer closedBy) {
147
        this.closedBy = closedBy;
148
    }
149
 
150
    public String getCloseMetric() {
151
        return closeMetric;
152
    }
153
 
154
    public void setCloseMetric(String closeMetric) {
155
        this.closeMetric = closeMetric;
156
    }
157
 
158
    public String getCloseRemark() {
159
        return closeRemark;
160
    }
161
 
162
    public void setCloseRemark(String closeRemark) {
163
        this.closeRemark = closeRemark;
164
    }
165
 
166
    public Integer getOpenMarker() {
167
        return openMarker;
168
    }
169
}