Subversion Repositories SmartDukaan

Rev

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

Rev 15602 Rev 15634
Line 47... Line 47...
47
import org.apache.http.entity.mime.MultipartEntity;
47
import org.apache.http.entity.mime.MultipartEntity;
48
import org.apache.http.entity.mime.content.ContentBody;
48
import org.apache.http.entity.mime.content.ContentBody;
49
import org.apache.http.entity.mime.content.FileBody;
49
import org.apache.http.entity.mime.content.FileBody;
50
import org.apache.http.impl.client.DefaultHttpClient;
50
import org.apache.http.impl.client.DefaultHttpClient;
51
import org.apache.http.message.BasicNameValuePair;
51
import org.apache.http.message.BasicNameValuePair;
-
 
52
import org.apache.http.util.EntityUtils;
52
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
53
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
53
import org.apache.poi.ss.usermodel.Row;
54
import org.apache.poi.ss.usermodel.Row;
54
import org.apache.poi.ss.usermodel.Sheet;
55
import org.apache.poi.ss.usermodel.Sheet;
55
import org.apache.poi.ss.usermodel.Workbook;
56
import org.apache.poi.ss.usermodel.Workbook;
56
import org.apache.thrift.TException;
57
import org.apache.thrift.TException;
Line 445... Line 446...
445
				}
446
				}
446
			}
447
			}
447
			else{
448
			else{
448
				exitfetchinghistory = false;
449
				exitfetchinghistory = false;
449
			}
450
			}
-
 
451
			EntityUtils.consume(response.getEntity());
450
			i++;	
452
			i++;	
451
		}
453
		}
452
		InventoryClient inventoryServiceClient = new InventoryClient("inventory_service_server_host","inventory_service_server_port");
454
		InventoryClient inventoryServiceClient = new InventoryClient("inventory_service_server_host","inventory_service_server_port");
453
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
455
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
454
		List<SnapdealInventoryItem> snapdealInventoryItemHistoryList = inventoryClient.getSnapdealInventorySnapshot();
456
		List<SnapdealInventoryItem> snapdealInventoryItemHistoryList = inventoryClient.getSnapdealInventorySnapshot();
Line 540... Line 542...
540
			}
542
			}
541
			else{
543
			else{
542
				System.out.println("Fetched  " + items);
544
				System.out.println("Fetched  " + items);
543
				break;
545
				break;
544
			}
546
			}
-
 
547
			EntityUtils.consume(response.getEntity());
545
			i++;
548
			i++;
546
		}
549
		}
547
		if(currentInventoryItemList.size()==0){
550
		if(currentInventoryItemList.size()==0){
548
			try {
551
			try {
549
				mailer.sendSSLMessage(sendTo,"Snapdeal : Unable to fetch current inventory "+ sdf.format(System.currentTimeMillis()),"Error : Unable to fetch current inventory ", emailFromAddress, password, new ArrayList<File>());
552
				mailer.sendSSLMessage(sendTo,"Snapdeal : Unable to fetch current inventory "+ sdf.format(System.currentTimeMillis()),"Error : Unable to fetch current inventory ", emailFromAddress, password, new ArrayList<File>());
Line 833... Line 836...
833
							BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
836
							BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
834
							String line = "";
837
							String line = "";
835
							while ((line = rd.readLine()) != null) {
838
							while ((line = rd.readLine()) != null) {
836
								System.out.println("Response of Inventory Update: "+line);
839
								System.out.println("Response of Inventory Update: "+line);
837
							}
840
							}
-
 
841
							EntityUtils.consume(response.getEntity());
838
							Thread.sleep(2000);
842
							Thread.sleep(2000);
839
						} catch (ClientProtocolException e) {
843
						} catch (ClientProtocolException e) {
840
							System.out.println("Could not login and update inventory");
844
							System.out.println("Could not login and update inventory");
841
							e.printStackTrace();
845
							e.printStackTrace();
842
							continue;
846
							continue;
Line 935... Line 939...
935
				try {
939
				try {
936
					while ((line = rd.readLine()) != null) {
940
					while ((line = rd.readLine()) != null) {
937
						System.out.println(line);
941
						System.out.println(line);
938
						feedresponse = line;
942
						feedresponse = line;
939
					}
943
					}
-
 
944
					EntityUtils.consume(response.getEntity());
940
				} catch (IOException e) {
945
				} catch (IOException e) {
941
 
946
 
942
					e.printStackTrace();
947
					e.printStackTrace();
943
				}
948
				}
944
				System.out.println("posting response" + feedresponse);
949
				System.out.println("posting response" + feedresponse);
945
 
-
 
946
			}
950
			}
947
			int retry = 24;
951
			int retry = 24;
948
			boolean feedsuccess =false;
952
			boolean feedsuccess =false;
949
			while(retry>0){
953
			while(retry>0){
950
				try {
954
				try {