Subversion Repositories SmartDukaan

Rev

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

Rev 5426 Rev 5489
Line 23... Line 23...
23
import org.apache.commons.lang.StringUtils;
23
import org.apache.commons.lang.StringUtils;
24
import org.apache.log4j.Logger;
24
import org.apache.log4j.Logger;
25
import org.apache.struts2.convention.annotation.Action;
25
import org.apache.struts2.convention.annotation.Action;
26
import org.apache.struts2.convention.annotation.Actions;
26
import org.apache.struts2.convention.annotation.Actions;
27
import org.apache.struts2.convention.annotation.Result;
27
import org.apache.struts2.convention.annotation.Result;
-
 
28
import org.apache.struts2.convention.annotation.Results;
28
import org.apache.struts2.rest.DefaultHttpHeaders;
29
import org.apache.struts2.rest.DefaultHttpHeaders;
29
import org.apache.struts2.rest.HttpHeaders;
30
import org.apache.struts2.rest.HttpHeaders;
30
 
31
 
-
 
32
import com.opensymphony.xwork2.ActionContext;
-
 
33
 
31
/**
34
/**
32
 * @author rajveer
35
 * @author rajveer
33
 *
36
 *
34
 */
37
 */
-
 
38
@Results({
35
@Result(name = "show", location = "category-show.vm")
39
	@Result(name = "show", location = "category-show.vm"),
-
 
40
	@Result(name = "redirect", location = "${redirectUrl}", type = "redirect", params={"statusCode", "301"})
-
 
41
})
36
public class CategoryController extends BaseController {
42
public class CategoryController extends BaseController {
37
	
43
	
38
	private static final long serialVersionUID = 8477108528765030321L;
44
	private static final long serialVersionUID = 8477108528765030321L;
39
 
45
 
40
	private static Logger log = Logger.getLogger(Class.class);
46
	private static Logger log = Logger.getLogger(Class.class);
Line 47... Line 53...
47
	 * 
53
	 * 
48
	 */
54
	 */
49
	private String id;
55
	private String id;
50
	
56
	
51
	private String categoryName;
57
	private String categoryName;
-
 
58
	private String redirectUrl;
-
 
59
 
-
 
60
	public String getRedirectUrl() {
-
 
61
		return redirectUrl;
-
 
62
	}
-
 
63
 
-
 
64
 
52
	private String categoryTitle;
65
	private String categoryTitle;
53
	private String facetSelection = "";
66
	private String facetSelection = "";
54
	
67
	
55
	private String query;
68
	private String query;
56
	
69
	
Line 95... Line 108...
95
		@Action("/data-cable"),
108
		@Action("/data-cable"),
96
		@Action("/ear-buds"),
109
		@Action("/ear-buds"),
97
		@Action("/cleaning-kit"),
110
		@Action("/cleaning-kit"),
98
		@Action("/speaker"),
111
		@Action("/speaker"),
99
		@Action("/hard-disk-drive"),
112
		@Action("/hard-disk-drive"),
-
 
113
		@Action("/external-hard-disks"),
100
		@Action("/headphones"),
114
		@Action("/headphones"),
101
		
115
		
102
		@Action("/category")
116
		@Action("/category")
103
	})
117
	})
104
	 
118
	 
105
    public HttpHeaders show() throws SecurityException, IOException {
119
    public HttpHeaders show() throws SecurityException, IOException {
-
 
120
		if(ActionContext.getContext().getName().equals("hard-disk-drive")) {
-
 
121
			redirectUrl = "/external-hard-disks/10073";
-
 
122
	        log.info("301 Redirection to " + redirectUrl);
-
 
123
	        return new DefaultHttpHeaders("redirect");
-
 
124
		}
106
    	log.info("id=" + id);
125
    	log.info("id=" + id);
107
    	categoryId = Long.parseLong(id);
126
    	categoryId = Long.parseLong(id);
108
    	this.categoryName = CategoryManager.getCategoryManager().getCategoryLabel(categoryId);
127
    	this.categoryName = CategoryManager.getCategoryManager().getCategoryLabel(categoryId);
109
    	
128
    	
110
    	if (categoryId == Utils.MOBILE_PHONES_CATEGORY || categoryId == Utils.MOBILE_ACCESSORIES_CATEGORY || categoryId == Utils.TABLETS_CATEGORY ){
129
    	if (categoryId == Utils.MOBILE_PHONES_CATEGORY || categoryId == Utils.MOBILE_ACCESSORIES_CATEGORY || categoryId == Utils.TABLETS_CATEGORY ){