Subversion Repositories SmartDukaan

Rev

Rev 5286 | Rev 7058 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5286 Rev 5937
Line 12... Line 12...
12
import org.apache.thrift.TException;
12
import org.apache.thrift.TException;
13
import org.apache.thrift.transport.TTransportException;
13
import org.apache.thrift.transport.TTransportException;
14
 
14
 
15
public class AgentController extends BaseController {
15
public class AgentController extends BaseController {
16
	
16
	
-
 
17
	private static final String adminEmailId = "admin@shop2020.in";
-
 
18
	
17
	private List<Agent>  agents = new ArrayList<Agent>();
19
	private List<Agent>  agents = new ArrayList<Agent>();
18
	private int id;
20
	private int id;
19
	private String name;
21
	private String name;
20
	private String emailId;
22
	private String emailId;
21
	private String password;
23
	private String password;
Line 155... Line 157...
155
	public void setNewPassword(String newPassword) {
157
	public void setNewPassword(String newPassword) {
156
		this.newPassword = newPassword;
158
		this.newPassword = newPassword;
157
	}
159
	}
158
 
160
 
159
	public List<Agent> getAgents() {
161
	public List<Agent> getAgents() {
-
 
162
		String currentEmailId = getCurrentAgentEmailId();
-
 
163
		long managerId = 0;
-
 
164
		List<Agent> managedAgents = new ArrayList<Agent>();
-
 
165
		for(Agent tempAgent : agents) {
-
 
166
			if(tempAgent.getEmailId().equals(currentEmailId)) {
-
 
167
				managerId = tempAgent.getId();
-
 
168
				break;
-
 
169
			}
-
 
170
		}
-
 
171
		
-
 
172
		if(!currentEmailId.equals(adminEmailId)) {
160
		return agents;
173
			return agents;
-
 
174
		} else {
-
 
175
			if(managerId!=0) {
-
 
176
				for(Agent tempAgent : agents) {
-
 
177
					if(tempAgent.getManagerId() == managerId){
-
 
178
						managedAgents.add(tempAgent);
-
 
179
					}
-
 
180
				}
-
 
181
				return managedAgents;
-
 
182
			}
-
 
183
			else {
-
 
184
				return agents;
-
 
185
			}
-
 
186
				
-
 
187
		}
-
 
188
		
161
	}
189
	}
162
 
190
 
163
	public void setAgents(List<Agent> agents) {
191
	public void setAgents(List<Agent> agents) {
164
		this.agents = agents;
192
		this.agents = agents;
165
	}
193
	}