Subversion Repositories SmartDukaan

Rev

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

Rev 3105 Rev 3125
Line 1... Line 1...
1
package in.shop2020.support.controllers;
1
package in.shop2020.support.controllers;
2
 
2
 
3
import in.shop2020.model.v1.catalog.Warehouse;
3
import in.shop2020.model.v1.catalog.Warehouse;
4
import in.shop2020.thrift.clients.CatalogServiceClient;
4
import in.shop2020.thrift.clients.CatalogClient;
5
import in.shop2020.thrift.clients.HelperServiceClient;
5
import in.shop2020.thrift.clients.HelperClient;
6
import in.shop2020.utils.LogisticsUser;
6
import in.shop2020.utils.LogisticsUser;
7
 
7
 
8
import java.io.ByteArrayOutputStream;
8
import java.io.ByteArrayOutputStream;
9
import java.io.File;
9
import java.io.File;
10
import java.io.FileInputStream;
10
import java.io.FileInputStream;
Line 60... Line 60...
60
	// Handler for POST /courier-details
60
	// Handler for POST /courier-details
61
	public String create(){
61
	public String create(){
62
		String username = request.getParameter("username");
62
		String username = request.getParameter("username");
63
		String password = request.getParameter("password");
63
		String password = request.getParameter("password");
64
		try{
64
		try{
65
			HelperServiceClient helperServiceClient = new HelperServiceClient();
65
			HelperClient helperServiceClient = new HelperClient();
66
			in.shop2020.utils.HelperService.Client client = helperServiceClient.getClient();
66
			in.shop2020.utils.HelperService.Client client = helperServiceClient.getClient();
67
			LogisticsUser user = client.authenticateLogisticsUser(username, password);
67
			LogisticsUser user = client.authenticateLogisticsUser(username, password);
68
			session.setAttribute("username", user.getUsername());
68
			session.setAttribute("username", user.getUsername());
69
			session.setAttribute("providerId", Long.valueOf(user.getProviderId()));
69
			session.setAttribute("providerId", Long.valueOf(user.getProviderId()));
70
		}catch(Exception e){
70
		}catch(Exception e){
Line 232... Line 232...
232
     * @return the mapping of warehouse if to its display namee
232
     * @return the mapping of warehouse if to its display namee
233
     */
233
     */
234
	public Map<Long, String> getWarehouses(){
234
	public Map<Long, String> getWarehouses(){
235
		Map<Long, String> warehouseMap = new HashMap<Long, String>();
235
		Map<Long, String> warehouseMap = new HashMap<Long, String>();
236
		try{
236
		try{
237
			CatalogServiceClient csc = new CatalogServiceClient();
237
			CatalogClient csc = new CatalogClient();
238
			in.shop2020.model.v1.catalog.InventoryService.Client catalogClient= csc.getClient();
238
			in.shop2020.model.v1.catalog.InventoryService.Client catalogClient= csc.getClient();
239
			List<Warehouse> warehouses = catalogClient.getAllWarehouses(true);
239
			List<Warehouse> warehouses = catalogClient.getAllWarehouses(true);
240
			for(Warehouse warehouse : warehouses){
240
			for(Warehouse warehouse : warehouses){
241
				warehouseMap.put(warehouse.getId(), warehouse.getDisplayName());
241
				warehouseMap.put(warehouse.getId(), warehouse.getDisplayName());
242
			}
242
			}