Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
3024 mandeep.dh 1
/**
2
 * 
3
 */
4
package in.shop2020.crm.domain;
5
 
3106 mandeep.dh 6
import in.shop2020.crm.ActivityType;
3024 mandeep.dh 7
import in.shop2020.crm.TicketCategory;
8
import in.shop2020.crm.TicketPriority;
9
import in.shop2020.crm.TicketStatus;
10
 
11
import java.text.ParseException;
12
import java.util.Date;
13
 
14
/**
15
 * Domain class for Activity.
16
 * 
17
 * @author mandeep
18
 */
19
public class Activity {
20
    // Basic attributes of activity
21
    private long           id;
22
    private String         description;
3106 mandeep.dh 23
    private ActivityType   type;
3269 mandeep.dh 24
    private Long           customerId;
3390 mandeep.dh 25
    private Long           userEmailId;
3024 mandeep.dh 26
 
3106 mandeep.dh 27
    // time at which the activity happened
28
    private Date           creationTimestamp;
3024 mandeep.dh 29
    private long           creatorId;
30
 
31
    // ticket attributes that can change with an activity
32
    private Long           ticketId;
33
    private TicketStatus   ticketStatus;
34
    private TicketCategory ticketCategory;
3106 mandeep.dh 35
    private Long           ticketAssigneeId;
3024 mandeep.dh 36
    private TicketPriority ticketPriority;
3106 mandeep.dh 37
    private String         ticketDescription;
3024 mandeep.dh 38
 
3390 mandeep.dh 39
    // relevant only for the activities generated by customer
40
    // tracks whether its being read by any agent or not
41
    private boolean        isRead = true;
42
 
43
    // fields for unregistered users
44
    private String         customerEmailId;
45
    private String         customerName;
46
    private String         customerMobileNumber;
47
 
3024 mandeep.dh 48
    /**
49
     * Converts a thrift activity object to our domain object for activity
3106 mandeep.dh 50
     * 
3024 mandeep.dh 51
     * @param tactivity
52
     * @return
53
     * @throws ParseException
54
     */
55
    public static Activity create(in.shop2020.crm.Activity tactivity)
56
            throws ParseException {
57
        Activity activity = new Activity();
58
        activity.id = tactivity.getId();
3390 mandeep.dh 59
        activity.userEmailId = tactivity.getUserEmailId();
3269 mandeep.dh 60
        activity.creationTimestamp = new Date(tactivity.getCreationTimestamp());
61
        activity.creatorId = tactivity.getCreatorId();
62
        activity.ticketPriority = tactivity.getTicketPriority();
63
        activity.ticketStatus = tactivity.getTicketStatus();
64
        activity.ticketCategory = tactivity.getTicketCategory();
65
        activity.ticketDescription = tactivity.getTicketDescription();
3024 mandeep.dh 66
        activity.description = tactivity.getDescription();
3269 mandeep.dh 67
        activity.type = tactivity.getType();
3405 mandeep.dh 68
 
69
        if (tactivity.isSetIsRead()) {
70
            activity.isRead = tactivity.isIsRead();
71
        }
3390 mandeep.dh 72
 
3269 mandeep.dh 73
        if (tactivity.isSetCustomerId()) {
74
            activity.customerId = tactivity.getCustomerId();
75
        }
3206 mandeep.dh 76
 
3390 mandeep.dh 77
        if (tactivity.isSetUserEmailId()) {
78
            activity.userEmailId = tactivity.getUserEmailId();
3206 mandeep.dh 79
        }
80
 
3390 mandeep.dh 81
        if (tactivity.isSetCustomerName()) {
82
            activity.customerName = tactivity.getCustomerName();
83
        }
84
 
85
        if (tactivity.isSetCustomerEmailId()) {
86
            activity.customerEmailId = tactivity.getCustomerEmailId();
87
        }
88
 
3269 mandeep.dh 89
        if (tactivity.isSetCustomerMobileNumber()) {
90
            activity.customerMobileNumber = tactivity.getCustomerMobileNumber();
91
        }
3024 mandeep.dh 92
 
3390 mandeep.dh 93
        if (tactivity.isSetTicketId()) {
3024 mandeep.dh 94
            activity.ticketId = tactivity.getTicketId();
95
        }
96
 
3106 mandeep.dh 97
        if (tactivity.isSetTicketAssigneeId()) {
98
            activity.ticketAssigneeId = tactivity.getTicketAssigneeId();
99
        }
100
 
3024 mandeep.dh 101
        return activity;
102
    }
103
 
104
    /**
105
     * Converts our domain object to its corresponding thrift model object.
3106 mandeep.dh 106
     * 
3024 mandeep.dh 107
     * @return
108
     */
109
    public in.shop2020.crm.Activity getThriftActivity() {
110
        in.shop2020.crm.Activity tactivity = new in.shop2020.crm.Activity();
111
        tactivity.setId(id);
112
        tactivity.setDescription(description);
3106 mandeep.dh 113
        tactivity.setType(type);
3269 mandeep.dh 114
        tactivity.setTicketPriority(ticketPriority);
115
        tactivity.setTicketStatus(ticketStatus);
116
        tactivity.setTicketCategory(ticketCategory);
117
        tactivity.setTicketDescription(ticketDescription);
118
        tactivity.setCreationTimestamp(creationTimestamp.getTime());
119
        tactivity.setCreatorId(creatorId);
3390 mandeep.dh 120
        tactivity.setIsRead(isRead);
3269 mandeep.dh 121
 
122
        if (customerId != null) {
123
            tactivity.setCustomerId(customerId);            
124
        }
125
 
3390 mandeep.dh 126
        if (userEmailId != null) {
127
            tactivity.setUserEmailId(userEmailId);
3269 mandeep.dh 128
        }
129
 
3024 mandeep.dh 130
        if (ticketId != null) {
131
            tactivity.setTicketId(ticketId);
132
        }
3106 mandeep.dh 133
 
134
        if (ticketAssigneeId != null) {
135
            tactivity.setTicketAssigneeId(ticketAssigneeId);
136
        }
137
 
3390 mandeep.dh 138
        if (customerMobileNumber != null) {
139
            tactivity.setCustomerMobileNumber(customerMobileNumber);
140
        }
141
 
142
        if (customerName != null) {
143
            tactivity.setCustomerName(customerName);
144
        }
145
 
146
        if (customerEmailId != null) {
147
            tactivity.setCustomerEmailId(customerEmailId);
148
        }
149
 
3024 mandeep.dh 150
        return tactivity;
151
    }
152
 
153
    public long getId() {
154
        return id;
155
    }
156
 
157
    public void setId(long id) {
158
        this.id = id;
159
    }
160
 
161
    public String getDescription() {
162
        return description;
163
    }
164
 
165
    public void setDescription(String description) {
166
        this.description = description;
167
    }
168
 
3106 mandeep.dh 169
    public Long getTicketAssigneeId() {
3024 mandeep.dh 170
        return ticketAssigneeId;
171
    }
172
 
3106 mandeep.dh 173
    public void setTicketAssigneeId(Long ticketAssigneeId) {
3024 mandeep.dh 174
        this.ticketAssigneeId = ticketAssigneeId;
175
    }
176
 
177
    public TicketPriority getTicketPriority() {
178
        return ticketPriority;
179
    }
180
 
181
    public void setTicketPriority(TicketPriority ticketPriority) {
182
        this.ticketPriority = ticketPriority;
183
    }
184
 
3269 mandeep.dh 185
    public Long getCustomerId() {
3024 mandeep.dh 186
        return customerId;
187
    }
188
 
3269 mandeep.dh 189
    public void setCustomerId(Long customerId) {
3024 mandeep.dh 190
        this.customerId = customerId;
191
    }
192
 
3088 mandeep.dh 193
    public Long getTicketId() {
3024 mandeep.dh 194
        return ticketId;
195
    }
196
 
3088 mandeep.dh 197
    public void setTicketId(Long ticketId) {
3024 mandeep.dh 198
        this.ticketId = ticketId;
199
    }
200
 
201
    public long getCreatorId() {
202
        return creatorId;
203
    }
204
 
205
    public void setCreatorId(long creatorId) {
206
        this.creatorId = creatorId;
207
    }
208
 
209
    public TicketStatus getTicketStatus() {
210
        return ticketStatus;
211
    }
212
 
213
    public void setTicketStatus(TicketStatus ticketStatus) {
214
        this.ticketStatus = ticketStatus;
215
    }
216
 
217
    public TicketCategory getTicketCategory() {
218
        return ticketCategory;
219
    }
220
 
221
    public void setTicketCategory(TicketCategory ticketCategory) {
222
        this.ticketCategory = ticketCategory;
223
    }
3106 mandeep.dh 224
 
225
    public Date getCreationTimestamp() {
226
        return creationTimestamp;
227
    }
228
 
229
    public void setCreationTimestamp(Date creationTimestamp) {
230
        this.creationTimestamp = creationTimestamp;
231
    }
232
 
233
    public String getTicketDescription() {
234
        return ticketDescription;
235
    }
236
 
237
    public void setTicketDescription(String ticketDescription) {
238
        this.ticketDescription = ticketDescription;
239
    }
240
 
241
    public ActivityType getType() {
242
        return type;
243
    }
244
 
245
    public void setType(ActivityType type) {
246
        this.type = type;
247
    }
3206 mandeep.dh 248
 
3390 mandeep.dh 249
    public Long getUserEmailId() {
250
        return userEmailId;
3206 mandeep.dh 251
    }
252
 
3390 mandeep.dh 253
    public void setUserEmailId(Long emailId) {
254
        this.userEmailId = emailId;
3206 mandeep.dh 255
    }
3269 mandeep.dh 256
 
257
    public String getCustomerMobileNumber() {
258
        return customerMobileNumber;
259
    }
260
 
261
    public void setCustomerMobileNumber(String customerMobileNumber) {
262
        this.customerMobileNumber = customerMobileNumber;
263
    }
3390 mandeep.dh 264
 
265
    public boolean isRead() {
266
        return isRead;
267
    }
268
 
269
    public void setRead(boolean isRead) {
270
        this.isRead = isRead;
271
    }
272
 
273
    public String getCustomerEmailId() {
274
        return customerEmailId;
275
    }
276
 
277
    public void setCustomerEmailId(String customerEmailId) {
278
        this.customerEmailId = customerEmailId;
279
    }
280
 
281
    public String getCustomerName() {
282
        return customerName;
283
    }
284
 
285
    public void setCustomerName(String customerName) {
286
        this.customerName = customerName;
287
    }
3024 mandeep.dh 288
}