| 3024 |
mandeep.dh |
1 |
/**
|
|
|
2 |
*
|
|
|
3 |
*/
|
|
|
4 |
package in.shop2020.crm.handler;
|
|
|
5 |
|
|
|
6 |
import in.shop2020.crm.domain.Agent;
|
| 3390 |
mandeep.dh |
7 |
import in.shop2020.crm.domain.SearchFilter;
|
| 3024 |
mandeep.dh |
8 |
import in.shop2020.crm.persistence.AgentMapper;
|
|
|
9 |
|
| 3339 |
mandeep.dh |
10 |
import java.util.Date;
|
| 3088 |
mandeep.dh |
11 |
import java.util.List;
|
|
|
12 |
|
| 3024 |
mandeep.dh |
13 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
14 |
import org.springframework.stereotype.Service;
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
* Handler for read and update operations on agents in database.
|
|
|
18 |
*
|
|
|
19 |
* @author mandeep
|
|
|
20 |
*/
|
|
|
21 |
@Service
|
|
|
22 |
public class AgentHandler {
|
|
|
23 |
@Autowired
|
|
|
24 |
private AgentMapper agentMapper;
|
|
|
25 |
|
| 3088 |
mandeep.dh |
26 |
public List<String> getRoleNamesForAgent(String agentEmailId) {
|
|
|
27 |
return agentMapper.getRoleNamesForAgent(agentEmailId);
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
public List<String> getPermissionsForRoleName(String roleName) {
|
|
|
31 |
return agentMapper.getPermissionsForRoleName(roleName);
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
public void updatePasswordForAgent(String agentEmailId, String password) {
|
|
|
35 |
agentMapper.updatePasswordForAgent(agentEmailId, password);
|
|
|
36 |
}
|
| 3137 |
mandeep.dh |
37 |
|
| 3339 |
mandeep.dh |
38 |
public Date getLastEmailProcessedTimestamp() {
|
|
|
39 |
return agentMapper.getLastEmailProcessedTimestamp();
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
public void updateLastEmailProcessedTimestamp(Date timestamp) {
|
|
|
43 |
agentMapper.updateLastEmailProcessedTimestamp(timestamp);
|
|
|
44 |
}
|
| 3390 |
mandeep.dh |
45 |
|
|
|
46 |
public List<Agent> getAgents(SearchFilter searchFilter) {
|
|
|
47 |
return agentMapper.getAgents(searchFilter);
|
|
|
48 |
}
|
| 4793 |
amar.kumar |
49 |
|
|
|
50 |
public void changeAgentStatus(boolean status, String emailId) {
|
|
|
51 |
agentMapper.changeAgentStatus(status, emailId);
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
public void insertAgent(in.shop2020.crm.domain.Agent agent, List<String> roles){
|
|
|
55 |
agentMapper.insertAgent(agent);
|
|
|
56 |
for (String agentRole : roles) {
|
|
|
57 |
agentMapper.insertAgentRole(agent.getId(), agentRole);
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
}
|
| 5168 |
amar.kumar |
61 |
|
|
|
62 |
public void changeAgentRole(long id, List<String> roles) {
|
|
|
63 |
agentMapper.removeAgentRoles(id);
|
|
|
64 |
for(String agentRole : roles) {
|
|
|
65 |
agentMapper.insertAgentRole(id, agentRole);
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
}
|
| 5286 |
amar.kumar |
69 |
|
|
|
70 |
public List<Agent> getInactiveAgents(SearchFilter searchFilter) {
|
|
|
71 |
return agentMapper.getInactiveAgents(searchFilter);
|
|
|
72 |
}
|
| 3024 |
mandeep.dh |
73 |
}
|