Blame | Last modification | View Log | RSS feed
package in.shop2020.serving.controllers;import java.util.List;import in.shop2020.model.v1.user.UserContextService;import in.shop2020.model.v1.user.UserNote;import in.shop2020.thrift.clients.UserContextServiceClient;import org.apache.log4j.Logger;import org.apache.struts2.convention.annotation.Action;import org.apache.struts2.convention.annotation.InterceptorRef;/**** @author Varun Gupta**/@SuppressWarnings("serial")public class MyNotesController extends BaseController {private String id;private static Logger logger = Logger.getLogger(Class.class);private List<UserNote> notes;public MyNotesController() {super();}@Action(value="my-notes",interceptorRefs={@InterceptorRef("myDefault")})public String show() {try {long entityId = Long.parseLong(this.id);UserContextService.Client userClient = (new UserContextServiceClient()).getClient();this.notes = userClient.getUserNotes(userinfo.getUserId(), entityId);} catch (NumberFormatException e) {logger.error("Number Format Exception. String: " + this.id);} catch (Exception e) {logger.error("Exception: " + e.getMessage());}return "show";}// Handle /putnote/@Action(value="save-note",interceptorRefs={@InterceptorRef("createuser"),@InterceptorRef("myDefault")})public String create() {try {long entityId = Long.parseLong(request.getParameter("entity"));long slideId = Long.parseLong(request.getParameter("slide"));String note = request.getParameter("note");UserContextService.Client userClient = (new UserContextServiceClient()).getClient();userClient.putUserNote(userinfo.getUserId(), entityId, slideId, note);} catch (NumberFormatException e) {logger.error("Number Format Exception: " + e.getMessage());} catch (Exception e) {logger.error("Exception: " + e.getMessage());}return "success";}public List<UserNote> getNotes() {return this.notes;}public String getId() {return this.id;}/*** @param id*/public void setId(String id) {this.id = id;}}