Subversion Repositories SmartDukaan

Rev

Rev 3206 | Rev 3390 | 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;
25
    private String         customerMobileNumber;
3206 mandeep.dh 26
    private Long           emailId;
3024 mandeep.dh 27
 
3106 mandeep.dh 28
    // time at which the activity happened
29
    private Date           creationTimestamp;
3024 mandeep.dh 30
    private long           creatorId;
31
 
32
    // ticket attributes that can change with an activity
33
    private Long           ticketId;
34
    private TicketStatus   ticketStatus;
35
    private TicketCategory ticketCategory;
3106 mandeep.dh 36
    private Long           ticketAssigneeId;
3024 mandeep.dh 37
    private TicketPriority ticketPriority;
3106 mandeep.dh 38
    private String         ticketDescription;
3024 mandeep.dh 39
 
40
    /**
41
     * Converts a thrift activity object to our domain object for activity
3106 mandeep.dh 42
     * 
3024 mandeep.dh 43
     * @param tactivity
44
     * @return
45
     * @throws ParseException
46
     */
47
    public static Activity create(in.shop2020.crm.Activity tactivity)
48
            throws ParseException {
49
        Activity activity = new Activity();
50
        activity.id = tactivity.getId();
3269 mandeep.dh 51
        activity.emailId = tactivity.getEmailId();
52
        activity.creationTimestamp = new Date(tactivity.getCreationTimestamp());
53
        activity.creatorId = tactivity.getCreatorId();
54
        activity.ticketPriority = tactivity.getTicketPriority();
55
        activity.ticketStatus = tactivity.getTicketStatus();
56
        activity.ticketCategory = tactivity.getTicketCategory();
57
        activity.ticketDescription = tactivity.getTicketDescription();
3024 mandeep.dh 58
        activity.description = tactivity.getDescription();
3269 mandeep.dh 59
        activity.type = tactivity.getType();
60
 
61
        if (tactivity.isSetCustomerId()) {
62
            activity.customerId = tactivity.getCustomerId();
63
        }
3206 mandeep.dh 64
 
65
        if (tactivity.isSetEmailId()) {
66
            activity.emailId = tactivity.getEmailId();
67
        }
68
 
3269 mandeep.dh 69
        if (tactivity.isSetCustomerMobileNumber()) {
70
            activity.customerMobileNumber = tactivity.getCustomerMobileNumber();
71
        }
3024 mandeep.dh 72
 
73
        if (tactivity.isSetTicketId() && tactivity.getTicketId() != 0) {
74
            activity.ticketId = tactivity.getTicketId();
75
        }
76
 
3106 mandeep.dh 77
        if (tactivity.isSetTicketAssigneeId()) {
78
            activity.ticketAssigneeId = tactivity.getTicketAssigneeId();
79
        }
80
 
3024 mandeep.dh 81
        return activity;
82
    }
83
 
84
    /**
85
     * Converts our domain object to its corresponding thrift model object.
3106 mandeep.dh 86
     * 
3024 mandeep.dh 87
     * @return
88
     */
89
    public in.shop2020.crm.Activity getThriftActivity() {
90
        in.shop2020.crm.Activity tactivity = new in.shop2020.crm.Activity();
91
        tactivity.setId(id);
92
        tactivity.setDescription(description);
3106 mandeep.dh 93
        tactivity.setType(type);
3269 mandeep.dh 94
        tactivity.setTicketPriority(ticketPriority);
95
        tactivity.setTicketStatus(ticketStatus);
96
        tactivity.setTicketCategory(ticketCategory);
97
        tactivity.setTicketDescription(ticketDescription);
98
        tactivity.setCreationTimestamp(creationTimestamp.getTime());
99
        tactivity.setCreatorId(creatorId);
100
 
101
        if (customerId != null) {
102
            tactivity.setCustomerId(customerId);            
103
        }
104
 
105
        if (customerMobileNumber != null) {
106
            tactivity.setCustomerMobileNumber(customerMobileNumber);
107
        }
108
 
3206 mandeep.dh 109
        if (emailId != null) {
110
            tactivity.setEmailId(emailId);
111
        }
3024 mandeep.dh 112
 
113
        if (ticketId != null) {
114
            tactivity.setTicketId(ticketId);
115
        }
3106 mandeep.dh 116
 
117
        if (ticketAssigneeId != null) {
118
            tactivity.setTicketAssigneeId(ticketAssigneeId);
119
        }
120
 
3024 mandeep.dh 121
        return tactivity;
122
    }
123
 
124
    public long getId() {
125
        return id;
126
    }
127
 
128
    public void setId(long id) {
129
        this.id = id;
130
    }
131
 
132
    public String getDescription() {
133
        return description;
134
    }
135
 
136
    public void setDescription(String description) {
137
        this.description = description;
138
    }
139
 
3106 mandeep.dh 140
    public Long getTicketAssigneeId() {
3024 mandeep.dh 141
        return ticketAssigneeId;
142
    }
143
 
3106 mandeep.dh 144
    public void setTicketAssigneeId(Long ticketAssigneeId) {
3024 mandeep.dh 145
        this.ticketAssigneeId = ticketAssigneeId;
146
    }
147
 
148
    public TicketPriority getTicketPriority() {
149
        return ticketPriority;
150
    }
151
 
152
    public void setTicketPriority(TicketPriority ticketPriority) {
153
        this.ticketPriority = ticketPriority;
154
    }
155
 
3269 mandeep.dh 156
    public Long getCustomerId() {
3024 mandeep.dh 157
        return customerId;
158
    }
159
 
3269 mandeep.dh 160
    public void setCustomerId(Long customerId) {
3024 mandeep.dh 161
        this.customerId = customerId;
162
    }
163
 
3088 mandeep.dh 164
    public Long getTicketId() {
3024 mandeep.dh 165
        return ticketId;
166
    }
167
 
3088 mandeep.dh 168
    public void setTicketId(Long ticketId) {
3024 mandeep.dh 169
        this.ticketId = ticketId;
170
    }
171
 
172
    public long getCreatorId() {
173
        return creatorId;
174
    }
175
 
176
    public void setCreatorId(long creatorId) {
177
        this.creatorId = creatorId;
178
    }
179
 
180
    public TicketStatus getTicketStatus() {
181
        return ticketStatus;
182
    }
183
 
184
    public void setTicketStatus(TicketStatus ticketStatus) {
185
        this.ticketStatus = ticketStatus;
186
    }
187
 
188
    public TicketCategory getTicketCategory() {
189
        return ticketCategory;
190
    }
191
 
192
    public void setTicketCategory(TicketCategory ticketCategory) {
193
        this.ticketCategory = ticketCategory;
194
    }
3106 mandeep.dh 195
 
196
    public Date getCreationTimestamp() {
197
        return creationTimestamp;
198
    }
199
 
200
    public void setCreationTimestamp(Date creationTimestamp) {
201
        this.creationTimestamp = creationTimestamp;
202
    }
203
 
204
    public String getTicketDescription() {
205
        return ticketDescription;
206
    }
207
 
208
    public void setTicketDescription(String ticketDescription) {
209
        this.ticketDescription = ticketDescription;
210
    }
211
 
212
    public ActivityType getType() {
213
        return type;
214
    }
215
 
216
    public void setType(ActivityType type) {
217
        this.type = type;
218
    }
3206 mandeep.dh 219
 
220
    public Long getEmailId() {
221
        return emailId;
222
    }
223
 
224
    public void setEmailId(Long emailId) {
225
        this.emailId = emailId;
226
    }
3269 mandeep.dh 227
 
228
    public String getCustomerMobileNumber() {
229
        return customerMobileNumber;
230
    }
231
 
232
    public void setCustomerMobileNumber(String customerMobileNumber) {
233
        this.customerMobileNumber = customerMobileNumber;
234
    }
3024 mandeep.dh 235
}