Subversion Repositories SmartDukaan

Rev

Rev 6383 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6383 Rev 6463
Line 3... Line 3...
3
import in.shop2020.serving.cache.SnippetCacheWrapper;
3
import in.shop2020.serving.cache.SnippetCacheWrapper;
4
import in.shop2020.serving.cache.EhcacheWrapper.CacheKeys;
4
import in.shop2020.serving.cache.EhcacheWrapper.CacheKeys;
5
import in.shop2020.thrift.clients.CatalogClient;
5
import in.shop2020.thrift.clients.CatalogClient;
6
 
6
 
7
import java.util.ArrayList;
7
import java.util.ArrayList;
-
 
8
import java.util.Arrays;
8
import java.util.List;
9
import java.util.List;
9
 
10
 
10
import org.apache.log4j.Logger;
11
import org.apache.log4j.Logger;
11
import org.apache.struts2.convention.annotation.Action;
12
import org.apache.struts2.convention.annotation.Action;
12
import org.apache.struts2.convention.annotation.Actions;
13
import org.apache.struts2.convention.annotation.Actions;
Line 19... Line 20...
19
@Result(name = "index", location = "clearance-sale-index.vm")
20
@Result(name = "index", location = "clearance-sale-index.vm")
20
public class ClearanceSaleController extends BaseController {
21
public class ClearanceSaleController extends BaseController {
21
 
22
 
22
	private static Logger log = Logger.getLogger(ClearanceSaleController.class);
23
	private static Logger log = Logger.getLogger(ClearanceSaleController.class);
23
	private static List<Long> entityIds = new ArrayList<Long>();
24
	private static List<Long> entityIds = new ArrayList<Long>();
-
 
25
	private static List<Long> sonyEntityIds = Arrays.asList(1004874L, 1002111L, 1003428L, 1003376L, 1004882L, 1004204L, 1003426L, 1005156L, 1004429L, 1004842L);
24
	private static List<Long> sonyEntityIds = new ArrayList<Long>();
26
	private static List<Long> googleEntityIds = Arrays.asList(  1004707L, 1002257L, 1004381L, 1004873L, 1005156L, 1003433L, //Mobiles - Tablets
-
 
27
																1004716L, 1004722L, 1004750L, 1004751L, 1004791L, 1004795L, //Cameras
-
 
28
																1005067L, 1005081L, 										//Laptops
-
 
29
																1005024L, 1005251L);										//Accessories
-
 
30
	
-
 
31
			//1005330L, 1005366);
25
	private List<String> snippets = new ArrayList<String>();
32
	private List<String> snippets = new ArrayList<String>();
26
	private List<String> sonySnippets = new ArrayList<String>();
33
	private List<String> sonySnippets = new ArrayList<String>();
-
 
34
	private List<String> googleSnippets = new ArrayList<String>();
27
	
35
	
28
	static {
36
	static {		
29
		sonyEntityIds.add(1004874L);
-
 
30
		sonyEntityIds.add(1002111L);
-
 
31
		sonyEntityIds.add(1003428L);
-
 
32
		sonyEntityIds.add(1003376L);
-
 
33
		sonyEntityIds.add(1004882L);
-
 
34
		sonyEntityIds.add(1004204L);
-
 
35
		sonyEntityIds.add(1003426L);
-
 
36
		sonyEntityIds.add(1004838L);
-
 
37
		sonyEntityIds.add(1005156L);
-
 
38
		sonyEntityIds.add(1004429L);
-
 
39
		
-
 
40
		try {
37
		try {
41
			CatalogClient catalogClientService = new CatalogClient();
38
			CatalogClient catalogClientService = new CatalogClient();
42
			in.shop2020.model.v1.catalog.CatalogService.Client client = catalogClientService.getClient();
39
			in.shop2020.model.v1.catalog.CatalogService.Client client = catalogClientService.getClient();
43
			log.info("Getting clearance sale products snippets.");
40
			log.info("Getting clearance sale products snippets.");
44
			entityIds = client.getClearanceSaleCatalogIds();
41
			entityIds = client.getClearanceSaleCatalogIds();
Line 47... Line 44...
47
		}
44
		}
48
	}
45
	}
49
 
46
 
50
	@Actions({
47
	@Actions({
51
		@Action("/clearance-sale"),
48
		@Action("/clearance-sale"),
52
		@Action("/sony")
49
		@Action("/sony"),
-
 
50
		@Action("/google-great-online-shopping-festival")
53
	})
51
	})
54
	public String index()	{
52
	public String index()	{
55
		return "index";
53
		return "index";
56
	}
54
	}
57
	
55
	
Line 63... Line 61...
63
	        snippets.add(snippet);
61
	        snippets.add(snippet);
64
	    }
62
	    }
65
	}
63
	}
66
	
64
	
67
	public List<String> getSnippets()	{
65
	public List<String> getSnippets()	{
-
 
66
		if(request.getRequestURI().contains("google-great-online-shopping-festival")){
-
 
67
			for(long entityId: googleEntityIds){
-
 
68
				addEntityId(entityId, googleSnippets);
-
 
69
			}
-
 
70
			return sonySnippets;
68
		if(request.getRequestURI().contains("sony")){
71
		}else if(request.getRequestURI().contains("sony")){
69
			for(long entityId: sonyEntityIds){
72
			for(long entityId: sonyEntityIds){
70
				addEntityId(entityId, sonySnippets);
73
				addEntityId(entityId, sonySnippets);
71
			}
74
			}
72
			return sonySnippets;
75
			return sonySnippets;
73
		}else{
76
		}else{
Line 76... Line 79...
76
			}
79
			}
77
			return snippets;
80
			return snippets;
78
		}
81
		}
79
	}
82
	}
80
	public String getPageTitle(){
83
	public String getPageTitle(){
-
 
84
		if(request.getRequestURI().contains("google-great-online-shopping-festival")){
-
 
85
			return "Google Great Online Shopping Festival";
81
		if(request.getRequestURI().contains("sony")){
86
		}else if(request.getRequestURI().contains("sony")){
82
			return "Sony Phones at Best Price";
87
			return "Sony Phones at Best Price";
83
		} else{
88
		} else{
84
			return "Spice and Micromax Phones at Best Price | Clearance Sale";		
89
			return "Spice and Micromax Phones at Best Price | Clearance Sale";		
85
		}
90
		}
86
	}
91
	}