Subversion Repositories SmartDukaan

Rev

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