Subversion Repositories SmartDukaan

Rev

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

Rev 3024 Rev 3106
Line 1... Line 1...
1
/**
1
/**
2
 * 
2
 * 
3
 */
3
 */
4
package in.shop2020.crm.domain;
4
package in.shop2020.crm.domain;
5
 
5
 
-
 
6
import in.shop2020.crm.TicketCategory;
-
 
7
import in.shop2020.crm.TicketPriority;
-
 
8
import in.shop2020.crm.TicketStatus;
-
 
9
 
6
import java.text.ParseException;
10
import java.text.ParseException;
7
import java.util.Date;
11
import java.util.Date;
8
 
12
 
9
/**
13
/**
10
 * Domain class for tickets in CRM. Many other fields of ticket are tracked via activity.
14
 * Domain class for tickets in CRM. Many other fields of ticket are tracked via
11
 * Especially the ones that can change through the lifetime of a ticket. A ticket should
15
 * activity. Especially the ones that can change through the lifetime of a
12
 * be thought of as a series of activities.
16
 * ticket. A ticket should be thought of as a series of activities.
13
 *
17
 * 
14
 * @author mandeep
18
 * @author mandeep
15
 */
19
 */
16
public class Ticket {
20
public class Ticket {
17
    private long   id;
21
    private long           id;
18
    private long   customerId;
22
    private long           customerId;
19
    private Date   openDate;
23
    private Date           openDate;
20
    private Date   closeDate;
24
    private Date           closeDate;
21
    private long   creatorId;
25
    private long           creatorId;
22
    private String subject;
26
    private String         description;
23
 
-
 
24
    // additional receipient of email notifications of the ticket
27
    private TicketStatus   status;
-
 
28
    private TicketPriority priority;
-
 
29
    private TicketCategory category;
25
    private long   receipientId;
30
    private Long           assigneeId;
26
    
31
 
27
    // Fields from user communication
32
    // Fields from user communication
28
    private long   orderId;
33
    private Long           orderId;
29
    private String airwayBillNo;
34
    private String         airwayBillNo;
30
    private String productName;
35
    private String         productName;
31
 
36
 
32
    /**
37
    /**
33
     * Converts thrift ticket object representation to our domain object
38
     * Converts thrift ticket object representation to our domain object
34
     *
39
     * 
35
     * @param tticket
40
     * @param tticket
36
     * @return
41
     * @return
37
     * @throws ParseException
42
     * @throws ParseException
38
     */
43
     */
39
    public static Ticket create(in.shop2020.crm.Ticket tticket)
44
    public static Ticket create(in.shop2020.crm.Ticket tticket)
40
            throws ParseException {
45
            throws ParseException {
41
        Ticket ticket = new Ticket();
46
        Ticket ticket = new Ticket();
42
        ticket.id = tticket.getId();
47
        ticket.id = tticket.getId();
43
        ticket.customerId = tticket.getCustomerId();
48
        ticket.customerId = tticket.getCustomerId();
44
        ticket.receipientId = tticket.getReceipientId();
-
 
45
        ticket.creatorId = tticket.getCreatorId();
49
        ticket.creatorId = tticket.getCreatorId();
-
 
50
        ticket.description = tticket.getDescription();
-
 
51
        
-
 
52
        if (tticket.isSetAssigneeId()) {
-
 
53
            ticket.assigneeId = tticket.getAssigneeId();
-
 
54
        }
-
 
55
 
-
 
56
        ticket.category = tticket.getCategory();
-
 
57
        ticket.priority = tticket.getPriority();
-
 
58
        ticket.status = tticket.getStatus();
46
 
59
 
47
        if (tticket.isSetOpenDate()) {
60
        if (tticket.isSetOpenDate()) {
48
            ticket.openDate = new Date(tticket.getOpenDate());
61
            ticket.openDate = new Date(tticket.getOpenDate());
49
        }
62
        }
50
 
63
 
51
        // Trying to set close date as null in database!
64
        // Trying to set close date as null in database!
52
        if (tticket.isSetCloseDate() && tticket.getCloseDate() != 0) {
65
        if (tticket.isSetCloseDate() && tticket.getCloseDate() != 0) {
53
            ticket.closeDate = new Date(tticket.getCloseDate());
66
            ticket.closeDate = new Date(tticket.getCloseDate());
54
        }
67
        }
55
 
68
 
56
        ticket.subject = tticket.getSubject();
69
        if (tticket.isSetOrderId()) {
57
        ticket.orderId = tticket.getOrderId();
70
            ticket.orderId = tticket.getOrderId();
-
 
71
        }
-
 
72
 
58
        ticket.airwayBillNo = tticket.getAirwayBillNo();
73
        ticket.airwayBillNo = tticket.getAirwayBillNo();
59
        ticket.productName = tticket.getProductName();
74
        ticket.productName = tticket.getProductName();
-
 
75
 
60
        return ticket;
76
        return ticket;
61
    }
77
    }
62
 
78
 
63
    /**
79
    /**
64
     * Converts this object to its corresponding thrift representation.
80
     * Converts this object to its corresponding thrift representation.
-
 
81
     * 
65
     * @return
82
     * @return
66
     */
83
     */
67
    public in.shop2020.crm.Ticket getThriftTicket() {
84
    public in.shop2020.crm.Ticket getThriftTicket() {
68
        in.shop2020.crm.Ticket tticket = new in.shop2020.crm.Ticket();
85
        in.shop2020.crm.Ticket tticket = new in.shop2020.crm.Ticket();
69
        tticket.setId(id);
86
        tticket.setId(id);
70
        tticket.setCustomerId(customerId);
87
        tticket.setCustomerId(customerId);
71
        tticket.setCreatorId(creatorId);
88
        tticket.setCreatorId(creatorId);
72
        tticket.setReceipientId(receipientId);
89
        tticket.setDescription(description);
-
 
90
 
-
 
91
        if (assigneeId != null) {
-
 
92
            tticket.setAssigneeId(assigneeId);
-
 
93
        }
-
 
94
        else {
-
 
95
            tticket.setAssigneeIdIsSet(false);
-
 
96
        }
-
 
97
 
-
 
98
        tticket.setCategory(category);
-
 
99
        tticket.setPriority(priority);
73
        tticket.setSubject(subject);
100
        tticket.setStatus(status);
-
 
101
        
-
 
102
        if (orderId != null) {
74
        tticket.setOrderId(orderId);
103
            tticket.setOrderId(orderId);
-
 
104
        }
-
 
105
        else {
-
 
106
            tticket.setOrderIdIsSet(false);
-
 
107
        }
-
 
108
 
75
        tticket.setAirwayBillNo(airwayBillNo);
109
        tticket.setAirwayBillNo(airwayBillNo);
76
        tticket.setProductName(productName);
110
        tticket.setProductName(productName);
77
 
111
 
78
        if (openDate != null) {
112
        if (openDate != null) {
79
            tticket.setOpenDate(openDate.getTime());
113
            tticket.setOpenDate(openDate.getTime());
80
        }
114
        }
-
 
115
        else {
-
 
116
            tticket.setOpenDateIsSet(false);
-
 
117
        }
81
 
118
 
82
        if (closeDate != null) {
119
        if (closeDate != null) {
83
            tticket.setCloseDate(closeDate.getTime());
120
            tticket.setCloseDate(closeDate.getTime());
84
        }
121
        }
-
 
122
        else {
-
 
123
            tticket.setCloseDateIsSet(false);
-
 
124
        }
85
 
125
 
86
        return tticket;
126
        return tticket;
87
    }
127
    }
88
 
128
 
89
    public long getId() {
129
    public long getId() {
Line 116... Line 156...
116
 
156
 
117
    public void setCloseDate(Date closeDate) {
157
    public void setCloseDate(Date closeDate) {
118
        this.closeDate = closeDate;
158
        this.closeDate = closeDate;
119
    }
159
    }
120
 
160
 
121
    public long getReceipientId() {
-
 
122
        return receipientId;
-
 
123
    }
-
 
124
 
-
 
125
    public void setReceipientId(long receipientId) {
-
 
126
        this.receipientId = receipientId;
-
 
127
    }
-
 
128
 
-
 
129
    public long getCreatorId() {
161
    public long getCreatorId() {
130
        return creatorId;
162
        return creatorId;
131
    }
163
    }
132
 
164
 
133
    public void setCreatorId(long creatorId) {
165
    public void setCreatorId(long creatorId) {
134
        this.creatorId = creatorId;
166
        this.creatorId = creatorId;
135
    }
167
    }
136
 
168
 
137
    public String getSubject() {
-
 
138
        return subject;
-
 
139
    }
-
 
140
 
-
 
141
    public void setSubject(String subject) {
-
 
142
        this.subject = subject;
-
 
143
    }
-
 
144
 
-
 
145
    public long getOrderId() {
169
    public Long getOrderId() {
146
        return orderId;
170
        return orderId;
147
    }
171
    }
148
 
172
 
149
    public void setOrderId(long orderId) {
173
    public void setOrderId(Long orderId) {
150
        this.orderId = orderId;
174
        this.orderId = orderId;
151
    }
175
    }
152
 
176
 
153
    public String getAirwayBillNo() {
177
    public String getAirwayBillNo() {
154
        return airwayBillNo;
178
        return airwayBillNo;
Line 163... Line 187...
163
    }
187
    }
164
 
188
 
165
    public void setProductName(String productName) {
189
    public void setProductName(String productName) {
166
        this.productName = productName;
190
        this.productName = productName;
167
    }
191
    }
-
 
192
 
-
 
193
    public String getDescription() {
-
 
194
        return description;
-
 
195
    }
-
 
196
 
-
 
197
    public void setDescription(String description) {
-
 
198
        this.description = description;
-
 
199
    }
-
 
200
 
-
 
201
    public TicketStatus getStatus() {
-
 
202
        return status;
-
 
203
    }
-
 
204
 
-
 
205
    public void setStatus(TicketStatus status) {
-
 
206
        this.status = status;
-
 
207
    }
-
 
208
 
-
 
209
    public TicketPriority getPriority() {
-
 
210
        return priority;
-
 
211
    }
-
 
212
 
-
 
213
    public void setPriority(TicketPriority priority) {
-
 
214
        this.priority = priority;
-
 
215
    }
-
 
216
 
-
 
217
    public TicketCategory getCategory() {
-
 
218
        return category;
-
 
219
    }
-
 
220
 
-
 
221
    public void setCategory(TicketCategory category) {
-
 
222
        this.category = category;
-
 
223
    }
-
 
224
 
-
 
225
    public Long getAssigneeId() {
-
 
226
        return assigneeId;
-
 
227
    }
-
 
228
 
-
 
229
    public void setAssigneeId(Long assigneeId) {
-
 
230
        this.assigneeId = assigneeId;
-
 
231
    }
168
}
232
}