Subversion Repositories SmartDukaan

Rev

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

Rev 462 Rev 507
Line 11... Line 11...
11
import in.shop2020.thrift.clients.WidgetServiceClient;
11
import in.shop2020.thrift.clients.WidgetServiceClient;
12
 
12
 
13
import java.io.IOException;
13
import java.io.IOException;
14
import java.util.HashMap;
14
import java.util.HashMap;
15
import java.util.Map;
15
import java.util.Map;
-
 
16
import java.util.StringTokenizer;
16
 
17
 
17
import javax.servlet.ServletContext;
18
import javax.servlet.ServletContext;
18
 
19
 
19
import org.apache.juli.logging.Log;
20
import org.apache.juli.logging.Log;
20
import org.apache.juli.logging.LogFactory;
21
import org.apache.juli.logging.LogFactory;
-
 
22
import org.apache.struts2.convention.annotation.Action;
-
 
23
import org.apache.struts2.convention.annotation.Actions;
21
import org.apache.struts2.convention.annotation.Result;
24
import org.apache.struts2.convention.annotation.Result;
22
import org.apache.struts2.convention.annotation.Results;
25
import org.apache.struts2.convention.annotation.Results;
23
import org.apache.struts2.rest.DefaultHttpHeaders;
26
import org.apache.struts2.rest.DefaultHttpHeaders;
24
import org.apache.struts2.rest.HttpHeaders;
27
import org.apache.struts2.rest.HttpHeaders;
25
import org.apache.struts2.util.ServletContextAware;
28
import org.apache.struts2.util.ServletContextAware;
Line 30... Line 33...
30
 * 
33
 * 
31
 * @author naveen
34
 * @author naveen
32
 *
35
 *
33
 */
36
 */
34
@Results({
37
@Results({
35
    @Result(name="success", type="redirectAction", params = {"actionName" , 
38
	@Result(name="success", location="/entity-show")
36
    		"entity"})
-
 
37
})
39
})
38
public class EntityController extends BaseController 
40
public class EntityController extends BaseController 
39
	implements  ModelDriven<Object>, ServletContextAware  {
41
	implements  ModelDriven<Object>, ServletContextAware  {
40
	
42
		  
41
	private PageManager pageManager = null;
43
	private PageManager pageManager = null;
42
	
44
	
43
	/**
45
	/**
44
	 * 
46
	 * 
45
	 */
47
	 */
Line 61... Line 63...
61
	
63
	
62
	public EntityController(){
64
	public EntityController(){
63
		super();
65
		super();
64
		pageManager = PageManager.getPageManager();
66
		pageManager = PageManager.getPageManager();
65
	}
67
	}
-
 
68
 
66
    // GET /entity/1000001
69
	// GET /entity/1000001
-
 
70
	@Actions({
-
 
71
		@Action("/mobiles"),
-
 
72
		@Action("/books"),
-
 
73
		@Action("/mobile"),
-
 
74
		@Action("/entity")
-
 
75
	})
67
    public HttpHeaders show() throws SecurityException, IOException {
76
    public HttpHeaders show() throws SecurityException, IOException {
68
    	log.info("id=" + id);
77
    	log.info("id=" + id);
69
    	Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
78
    	Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
70
    	
79
    	
71
    	params.put(PageContentKeys.ENTITY_ID, id);
80
    	params.put(PageContentKeys.ENTITY_ID, id);
Line 121... Line 130...
121
    /**
130
    /**
122
     * 
131
     * 
123
     * @param id
132
     * @param id
124
     */
133
     */
125
    public void setId(String id) {
134
    public void setId(String id) {
-
 
135
    	StringTokenizer tokenizer = new StringTokenizer(id,"-");
-
 
136
    	while(tokenizer.hasMoreTokens()){
126
        this.id = id;
137
    		this.id = tokenizer.nextToken();
-
 
138
    	}
127
    }
139
    }
128
 
140
 
129
	/* (non-Javadoc)
141
	/* (non-Javadoc)
130
	 * @see com.opensymphony.xwork2.ModelDriven#getModel()
142
	 * @see com.opensymphony.xwork2.ModelDriven#getModel()
131
	 */
143
	 */