Subversion Repositories SmartDukaan

Rev

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

Rev 4939 Rev 4996
Line 23... Line 23...
23
 */
23
 */
24
public class QuicklinksController extends ValidationAwareSupport implements ServletRequestAware {
24
public class QuicklinksController extends ValidationAwareSupport implements ServletRequestAware {
25
 
25
 
26
    private static Logger logger = LoggerFactory.getLogger(VendorReconciliationController.class);
26
    private static Logger logger = LoggerFactory.getLogger(VendorReconciliationController.class);
27
    
27
    
-
 
28
    private String id;
-
 
29
    private long quicklinkId;
28
	private ServletRequest request;
30
	private ServletRequest request;
29
	private String url;
31
	private String url;
30
	private String text;
32
	private String text;
-
 
33
	private String formtype;
31
	
34
	
32
	private List<QuickLink> quicklinks;
35
	private List<QuickLink> quicklinks;
33
 
36
 
34
	public String index()	{
37
	public String index()	{
35
		populateQuicklinks();
38
		populateQuicklinks();
-
 
39
		
36
		return "index";
40
		return "index";
37
	}
41
	}
38
	
42
	
39
	public String create()	{
43
	public String create()	{
40
		if (url.equals("") || text.equals(""))	{
44
		if (url.equals("") || text.equals(""))	{
41
			addActionError("URL or Text field cannot be left blank");
45
			addActionError("URL or Text field cannot be left blank");
42
			return "index";
46
			return "index";
43
		}
47
		}
-
 
48
		logger.info("Form Type: " + formtype);
44
		try	{
49
		try	{
45
			HelperClient helperClient = new HelperClient("helper_service_server_host_prod", "9008");
50
			HelperClient helperClient = new HelperClient("helper_service_server_host_prod", "9008");
46
			Client hsc = helperClient.getClient();
51
			Client hsc = helperClient.getClient();
47
			
52
			
-
 
53
			if (id == null)	{
48
			hsc.saveQuickLink(url, text);
54
				hsc.saveQuickLink(url, text);
49
			addActionMessage("URL ( " + url + ") is added.");
55
				addActionMessage("URL ( " + url + ") is added.");
-
 
56
				
-
 
57
			} else	{
-
 
58
				hsc.updateQuickLink(quicklinkId, url, text);
-
 
59
				addActionMessage("URL ( " + url + ") is updated.");
-
 
60
			}
50
			populateQuicklinks();
61
			populateQuicklinks();
51
			
62
			
52
		} catch (TTransportException e)	{
63
		} catch (TTransportException e)	{
53
			logger.error("TTransportException " + e);
64
			logger.error("TTransportException " + e);
54
			
65
			
Line 93... Line 104...
93
	}
104
	}
94
 
105
 
95
	public void setText(String text) {
106
	public void setText(String text) {
96
		this.text = text;
107
		this.text = text;
97
	}
108
	}
-
 
109
 
-
 
110
	public void setId(String id) {
-
 
111
		this.id = id;
-
 
112
		this.quicklinkId = Long.parseLong(id);
-
 
113
	}
-
 
114
 
-
 
115
	public String getId() {
-
 
116
		return id;
-
 
117
	}
-
 
118
 
-
 
119
	public void setFormtype(String formtype) {
-
 
120
		this.formtype = formtype;
-
 
121
	}
98
}
122
}
99
123