Subversion Repositories SmartDukaan

Rev

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

Rev 942 Rev 974
Line 21... Line 21...
21
 
21
 
22
import org.apache.commons.lang.StringUtils;
22
import org.apache.commons.lang.StringUtils;
23
import org.apache.juli.logging.Log;
23
import org.apache.juli.logging.Log;
24
import org.apache.juli.logging.LogFactory;
24
import org.apache.juli.logging.LogFactory;
25
import org.apache.log4j.Logger;
25
import org.apache.log4j.Logger;
-
 
26
import org.apache.struts2.convention.annotation.Action;
-
 
27
import org.apache.struts2.convention.annotation.Actions;
-
 
28
import org.apache.struts2.convention.annotation.Result;
26
import org.apache.struts2.rest.DefaultHttpHeaders;
29
import org.apache.struts2.rest.DefaultHttpHeaders;
27
import org.apache.struts2.rest.HttpHeaders;
30
import org.apache.struts2.rest.HttpHeaders;
28
 
31
 
29
/**
32
/**
30
 * @author rajveer
33
 * @author rajveer
31
 *
34
 *
32
 */
35
 */
-
 
36
@Result(name = "show", location = "category-show.vm")
33
public class CategoryController extends BaseController {
37
public class CategoryController extends BaseController {
34
	
38
	
35
	/**
39
	/**
36
	 * 
40
	 * 
37
	 */
41
	 */
Line 48... Line 52...
48
	 * 
52
	 * 
49
	 */
53
	 */
50
	private String id;
54
	private String id;
51
	
55
	
52
	private String categoryName;
56
	private String categoryName;
-
 
57
	private String categoryTitle;
53
	
58
	
54
	private String query;
59
	private String query;
55
	
60
	
56
	private Double minPrice;
61
	private Double minPrice;
57
	private Double maxPrice;
62
	private Double maxPrice;
Line 63... Line 68...
63
	private long beginIndex = 0;
68
	private long beginIndex = 0;
64
	private String url;
69
	private String url;
65
	private String priceUrl;
70
	private String priceUrl;
66
 
71
 
67
	/**
72
	/**
68
	 * GET /category/10004
73
	 * GET /abc/10004
69
	 * 
74
	 * 
70
	 */
75
	 */
-
 
76
	@Actions({
-
 
77
		@Action("/business-phones"),
-
 
78
		@Action("/high-end-multimedia-phones"),
-
 
79
		@Action("/low-end-multimedia-phones"),
-
 
80
		@Action("/basic-phones"),
-
 
81
		
-
 
82
		@Action("/bluetooth-headset"),
-
 
83
		@Action("/memory-card"),
-
 
84
		@Action("/battery"),
-
 
85
		@Action("/headset"),
-
 
86
		@Action("/charger"),
-
 
87
		@Action("/pen-drive"),
-
 
88
		@Action("/carrying-case"),
-
 
89
		@Action("/car-charger")
-
 
90
	})
-
 
91
	 
71
    public HttpHeaders show() throws SecurityException, IOException {
92
    public HttpHeaders show() throws SecurityException, IOException {
72
    	log.info("id=" + id);
93
    	log.info("id=" + id);
73
    	this.categoryName = CategoryManager.getCategoryManager().getCategoryLabel(Long.parseLong(id));
94
    	this.categoryName = CategoryManager.getCategoryManager().getCategoryLabel(Long.parseLong(id));
-
 
95
    	
-
 
96
    	this.categoryTitle = this.categoryName.replace("Phones", "Mobile Phones");
74
 
97
 
75
		String[] facetDefIDs = new String[] {"Category","F_50002","F_50001",  "F_50006", "F_50007" };
98
		String[] facetDefIDs = new String[] {"Category","F_50002","F_50001",  "F_50006", "F_50007" };
76
    	
99
    	
77
    	String[] facetLabels = new String[] {"Category","Price", "Brand", "Data Connectivity", "Camera Resolution" 	};
100
    	String[] facetLabels = new String[] {"Category","Price", "Brand", "Data Connectivity", "Camera Resolution" 	};
78
 
101
 
Line 201... Line 224...
201
    
224
    
202
    public String getCategoryName() {
225
    public String getCategoryName() {
203
    	return this.categoryName;
226
    	return this.categoryName;
204
    }	
227
    }	
205
	
228
	
-
 
229
    public String getPageMetaDesc() {
-
 
230
    	return "Best price " + this.categoryName.replaceAll("phones", "mobile phones") 
-
 
231
    	    + " in India.  Experience n' buy online. FREE Next Day delivery. Original product - Full manufacturer warranty. Comprehensive reviews."; 
-
 
232
    }
-
 
233
    
-
 
234
    public String getPageMetaKeywords() {
-
 
235
        if(CategoryManager.getCategoryManager().getCategory(Long.parseLong(id)).getParentCategoryId()== 10001){
-
 
236
        	return this.categoryName + ", mobile phone";
-
 
237
    	}
-
 
238
        if(CategoryManager.getCategoryManager().getCategory(Long.parseLong(id)).getParentCategoryId()== 10011){
-
 
239
        	return this.categoryName + ", phone accessories";
-
 
240
    	}
-
 
241
        return "";
-
 
242
    }
-
 
243
    
-
 
244
    public String getCategoryTitle() {
-
 
245
    	return this.categoryTitle;
-
 
246
    }	
-
 
247
	
206
	public String getQuery() {
248
	public String getQuery() {
207
    	return this.query;
249
    	return this.query;
208
    }
250
    }
209
    
251
    
210
    
252