Rev 5168 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/****/package in.shop2020.crm.handler;import in.shop2020.crm.domain.Agent;import in.shop2020.crm.domain.SearchFilter;import in.shop2020.crm.persistence.AgentMapper;import java.util.Date;import java.util.List;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;/*** Handler for read and update operations on agents in database.** @author mandeep*/@Servicepublic class AgentHandler {@Autowiredprivate AgentMapper agentMapper;public List<String> getRoleNamesForAgent(String agentEmailId) {return agentMapper.getRoleNamesForAgent(agentEmailId);}public List<String> getPermissionsForRoleName(String roleName) {return agentMapper.getPermissionsForRoleName(roleName);}public void updatePasswordForAgent(String agentEmailId, String password) {agentMapper.updatePasswordForAgent(agentEmailId, password);}public Date getLastEmailProcessedTimestamp() {return agentMapper.getLastEmailProcessedTimestamp();}public void updateLastEmailProcessedTimestamp(Date timestamp) {agentMapper.updateLastEmailProcessedTimestamp(timestamp);}public List<Agent> getAgents(SearchFilter searchFilter) {return agentMapper.getAgents(searchFilter);}public void changeAgentStatus(boolean status, String emailId) {agentMapper.changeAgentStatus(status, emailId);}public void insertAgent(in.shop2020.crm.domain.Agent agent, List<String> roles){agentMapper.insertAgent(agent);for (String agentRole : roles) {agentMapper.insertAgentRole(agent.getId(), agentRole);}}public void changeAgentRole(long id, List<String> roles) {agentMapper.removeAgentRoles(id);for(String agentRole : roles) {agentMapper.insertAgentRole(id, agentRole);}}public List<Agent> getInactiveAgents(SearchFilter searchFilter) {return agentMapper.getInactiveAgents(searchFilter);}}