Subversion Repositories SmartDukaan

Rev

Rev 3339 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3339 Rev 3390
Line 3... Line 3...
3
 */
3
 */
4
package in.shop2020.serving.controllers;
4
package in.shop2020.serving.controllers;
5
 
5
 
6
import in.shop2020.crm.Activity;
6
import in.shop2020.crm.Activity;
7
import in.shop2020.crm.Agent;
7
import in.shop2020.crm.Agent;
-
 
8
import in.shop2020.crm.SearchFilter;
8
import in.shop2020.crm.Ticket;
9
import in.shop2020.crm.Ticket;
-
 
10
import in.shop2020.serving.auth.CRMAuthorizingRealm;
-
 
11
import in.shop2020.thrift.clients.CRMClient;
9
 
12
 
10
import org.apache.thrift.TException;
13
import org.apache.thrift.TException;
11
 
14
 
12
/**
15
/**
13
 * Action class to display activity details.
16
 * Action class to display activity details.
Line 18... Line 21...
18
     * 
21
     * 
19
     */
22
     */
20
    private static final long serialVersionUID = 1L;
23
    private static final long serialVersionUID = 1L;
21
    private long activityId;
24
    private long activityId;
22
    private Ticket ticket;
25
    private Ticket ticket;
23
    private Activity lastActivity;
-
 
24
    private Activity activity;
26
    private Activity activity;
25
 
27
 
26
    public String index() throws TException
28
    public String index() throws TException
27
    {
29
    {
28
        createServiceClients();
30
        SearchFilter searchFilter = new SearchFilter();
29
        activity = crmServiceClient.getActivity(activityId);
31
        searchFilter.setActivityId(activityId);
30
        lastActivity = activity;
32
        crmServiceClient         = new CRMClient().getClient();
-
 
33
        activity = crmServiceClient.getActivities(searchFilter).get(0);
31
 
34
 
32
        if (activity != null && activity.isSetTicketId()) {
35
        if (activity != null && activity.isSetTicketId()) {
33
            lastActivity = crmServiceClient.getLastActivity(activity.getTicketId());
36
            searchFilter.setTicketId(activity.getTicketId());
34
            ticket = crmServiceClient.getTicket(activity.getTicketId());
37
            ticket = crmServiceClient.getTickets(searchFilter).get(0);
35
        }
38
        }
36
 
39
 
37
        return INDEX;
40
        return INDEX;
38
    }
41
    }
39
 
42
 
40
    public Ticket getTicket() {
43
    public Ticket getTicket() {
41
        return ticket;
44
        return ticket;
42
    }
45
    }
43
 
46
 
44
    public Activity getLastActivity() {
-
 
45
        return lastActivity;
-
 
46
    }
-
 
47
 
-
 
48
    public Activity getActivity() {
47
    public Activity getActivity() {
49
        return activity;
48
        return activity;
50
    }
49
    }
51
 
50
 
52
    public void setActivityId(long activityId) {
51
    public void setActivityId(long activityId) {
53
        this.activityId = activityId;
52
        this.activityId = activityId;
54
    }
53
    }
55
 
54
 
56
    public Agent getAgent(long agentId) throws TException {
55
    public Agent getAgent(long agentId) throws TException {
57
        return crmServiceClient.getAgent(agentId);
56
        return CRMAuthorizingRealm.getAgent(agentId);
58
    }
57
    }
59
}
58
}