Subversion Repositories SmartDukaan

Rev

Rev 3024 | Rev 3106 | 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
 
6
import in.shop2020.crm.ContactMedium;
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
 
21
    // Basic attributes of activity
22
    private long           id;
23
    private String         description;
24
 
25
    // time at which the activity happened
26
    private Date           contactTimestamp;
27
    private long           customerId;
28
 
29
    // id of the agent who contacted customer as part of this activity
30
    private long           contactingAgentId;
31
 
32
    // id of the agent who created this ticket
33
    private long           creatorId;
34
 
35
    // ticket attributes that can change with an activity
36
    private ContactMedium  contactMedium;
37
    private Long           ticketId;
38
    private TicketStatus   ticketStatus;
39
    private TicketCategory ticketCategory;
40
    private long           ticketAssigneeId;
41
    private TicketPriority ticketPriority;
42
 
43
    /**
44
     * Converts a thrift activity object to our domain object for activity
45
     *
46
     * @param tactivity
47
     * @return
48
     * @throws ParseException
49
     */
50
    public static Activity create(in.shop2020.crm.Activity tactivity)
51
            throws ParseException {
52
        Activity activity = new Activity();
53
        activity.id = tactivity.getId();
54
        activity.ticketAssigneeId = tactivity.getTicketAssigneeId();
55
        activity.customerId = tactivity.getCustomerId();
56
        activity.description = tactivity.getDescription();
57
        activity.contactTimestamp = new Date(tactivity.getContactTimestamp());
58
        activity.contactMedium = tactivity.getContactMedium();
59
        activity.creatorId = tactivity.getCreatorId();
60
        activity.contactingAgentId = tactivity.getContactingAgentId();
61
 
62
        if (tactivity.isSetTicketId() && tactivity.getTicketId() != 0) {
63
            activity.ticketId = tactivity.getTicketId();
64
        }
65
 
66
        activity.ticketPriority = tactivity.getTicketPriority();
67
        activity.ticketStatus = tactivity.getTicketStatus();
68
        activity.setTicketCategory(tactivity.getTicketCategory());
69
        return activity;
70
    }
71
 
72
    /**
73
     * Converts our domain object to its corresponding thrift model object.
74
     * @return
75
     */
76
    public in.shop2020.crm.Activity getThriftActivity() {
77
        in.shop2020.crm.Activity tactivity = new in.shop2020.crm.Activity();
78
        tactivity.setId(id);
79
        tactivity.setTicketAssigneeId(ticketAssigneeId);
80
        tactivity.setCustomerId(customerId);
81
        tactivity.setDescription(description);
82
 
83
        if (ticketId != null) {
84
            tactivity.setTicketId(ticketId);
85
        }
86
 
87
        tactivity.setContactMedium(contactMedium);
88
        tactivity.setContactTimestamp(contactTimestamp.getTime());
89
        tactivity.setCreatorId(creatorId);
90
        tactivity.setTicketPriority(ticketPriority);
91
        tactivity.setTicketStatus(ticketStatus);
92
        tactivity.setContactingAgentId(contactingAgentId);
93
        tactivity.setTicketCategory(ticketCategory);
94
        return tactivity;
95
    }
96
 
97
    public long getId() {
98
        return id;
99
    }
100
 
101
    public void setId(long id) {
102
        this.id = id;
103
    }
104
 
105
    public String getDescription() {
106
        return description;
107
    }
108
 
109
    public void setDescription(String description) {
110
        this.description = description;
111
    }
112
 
113
    public Date getContactTimestamp() {
114
        return contactTimestamp;
115
    }
116
 
117
    public void setContactTimestamp(Date contactTimestamp) {
118
        this.contactTimestamp = contactTimestamp;
119
    }
120
 
121
    public long getTicketAssigneeId() {
122
        return ticketAssigneeId;
123
    }
124
 
125
    public void setTicketAssigneeId(long ticketAssigneeId) {
126
        this.ticketAssigneeId = ticketAssigneeId;
127
    }
128
 
129
    public TicketPriority getTicketPriority() {
130
        return ticketPriority;
131
    }
132
 
133
    public void setTicketPriority(TicketPriority ticketPriority) {
134
        this.ticketPriority = ticketPriority;
135
    }
136
 
137
    public long getCustomerId() {
138
        return customerId;
139
    }
140
 
141
    public void setCustomerId(long customerId) {
142
        this.customerId = customerId;
143
    }
144
 
3088 mandeep.dh 145
    public Long getTicketId() {
3024 mandeep.dh 146
        return ticketId;
147
    }
148
 
3088 mandeep.dh 149
    public void setTicketId(Long ticketId) {
3024 mandeep.dh 150
        this.ticketId = ticketId;
151
    }
152
 
153
    public long getCreatorId() {
154
        return creatorId;
155
    }
156
 
157
    public void setCreatorId(long creatorId) {
158
        this.creatorId = creatorId;
159
    }
160
 
161
    public ContactMedium getContactMedium() {
162
        return contactMedium;
163
    }
164
 
165
    public void setContactMedium(ContactMedium contactMedium) {
166
        this.contactMedium = contactMedium;
167
    }
168
 
169
    public TicketStatus getTicketStatus() {
170
        return ticketStatus;
171
    }
172
 
173
    public void setTicketStatus(TicketStatus ticketStatus) {
174
        this.ticketStatus = ticketStatus;
175
    }
176
 
177
    public long getContactingAgentId() {
178
        return contactingAgentId;
179
    }
180
 
181
    public void setContactingAgentId(long contactingAgentId) {
182
        this.contactingAgentId = contactingAgentId;
183
    }
184
 
185
    public TicketCategory getTicketCategory() {
186
        return ticketCategory;
187
    }
188
 
189
    public void setTicketCategory(TicketCategory ticketCategory) {
190
        this.ticketCategory = ticketCategory;
191
    }
192
}