Subversion Repositories SmartDukaan

Rev

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