Subversion Repositories SmartDukaan

Rev

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

Rev 3562 Rev 3599
Line 4... Line 4...
4
import in.shop2020.model.v1.catalog.Item;
4
import in.shop2020.model.v1.catalog.Item;
5
import in.shop2020.model.v1.user.Cart;
5
import in.shop2020.model.v1.user.Cart;
6
import in.shop2020.model.v1.user.Line;
6
import in.shop2020.model.v1.user.Line;
7
import in.shop2020.model.v1.user.ShoppingCartException;
7
import in.shop2020.model.v1.user.ShoppingCartException;
8
import in.shop2020.model.v1.user.UserContextService;
8
import in.shop2020.model.v1.user.UserContextService;
9
import in.shop2020.serving.utils.FileUtils;
9
import in.shop2020.serving.services.ContentServingService;
10
import in.shop2020.serving.utils.FormattingUtils;
10
import in.shop2020.serving.utils.FormattingUtils;
11
import in.shop2020.serving.utils.Utils;
11
import in.shop2020.serving.utils.SnippetType;
12
import in.shop2020.thrift.clients.CatalogClient;
12
import in.shop2020.thrift.clients.CatalogClient;
13
import in.shop2020.thrift.clients.UserClient;
13
import in.shop2020.thrift.clients.UserClient;
14
import in.shop2020.utils.DataLogger;
14
import in.shop2020.utils.DataLogger;
15
 
15
 
16
import java.io.File;
-
 
17
import java.io.FileNotFoundException;
-
 
18
import java.io.IOException;
-
 
19
import java.util.ArrayList;
16
import java.util.ArrayList;
20
import java.util.HashMap;
17
import java.util.HashMap;
21
import java.util.List;
18
import java.util.List;
22
import java.util.Map;
19
import java.util.Map;
23
import java.util.StringTokenizer;
20
import java.util.StringTokenizer;
Line 349... Line 346...
349
		CatalogClient csc;
346
		CatalogClient csc;
350
		try {
347
		try {
351
			csc = new CatalogClient();
348
			csc = new CatalogClient();
352
			List<Long> similarItems = csc.getClient().getSimilarItemsCatalogIds(0, 4, itemId);
349
			List<Long> similarItems = csc.getClient().getSimilarItemsCatalogIds(0, 4, itemId);
353
			for(Long catalogId: similarItems){
350
			for(Long catalogId: similarItems){
354
				try {
-
 
355
					snippets += FileUtils.read( Utils.EXPORT_ENTITIES_PATH + catalogId + File.separator + "WidgetSnippet.html");
351
				snippets = snippets + ContentServingService.getSnippet(SnippetType.WIDGET_SNIPPET, catalogId+"", sourceId);
356
		    	}
-
 
357
	            catch (FileNotFoundException e) {
-
 
358
	                log.error("File not found : " + Utils.EXPORT_ENTITIES_PATH + catalogId + File.separator +"WidgetSnippet.html");
-
 
359
	            }
-
 
360
	            catch (IOException e) {
-
 
361
	                log.error("IO exception : " + Utils.EXPORT_ENTITIES_PATH + catalogId + File.separator +"WidgetSnippet.html");
-
 
362
	            }
-
 
363
			}
352
			}
364
		} catch (Exception e) {
353
		} catch (Exception e) {
365
			log.error("Unable to initialise Catalogservice Client");
354
			log.error("Unable to initialise Catalogservice Client");
366
		}	    
355
		}	    
367
	    return snippets;
356
	    return snippets;