Subversion Repositories SmartDukaan

Rev

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

Rev 2718 Rev 2731
Line 29... Line 29...
29
 
29
 
30
    private String id;
30
    private String id;
31
 
31
 
32
	private static Logger logger = Logger.getLogger(Class.class);
32
	private static Logger logger = Logger.getLogger(Class.class);
33
	
33
	
-
 
34
	private long entityId;
-
 
35
	
34
	private Map<String, String> slideNotes;
36
	private Map<String, String> slideNotes;
35
	
37
	
36
	public MyNotesController() {
38
	public MyNotesController() {
37
		super();
39
		super();
38
	}
40
	}
Line 42... Line 44...
42
		String responseContentType = null;
44
		String responseContentType = null;
43
		
45
		
44
        try {
46
        try {
45
        	String[] idParts = this.id.split("-");
47
        	String[] idParts = this.id.split("-");
46
        	
48
        	
47
        	long entityId = Long.parseLong(idParts[0]);
49
        	this.entityId = Long.parseLong(idParts[0]);
48
        	responseContentType = idParts[1];
50
        	responseContentType = idParts[1];
49
        	
51
        	
50
        	this.slideNotes = getSlideNames(entityId);
52
        	this.slideNotes = getSlideNames(this.entityId);
51
        	
53
        	
52
			UserContextService.Client userClient = (new UserContextServiceClient()).getClient();
54
			UserContextService.Client userClient = (new UserContextServiceClient()).getClient();
53
			List<UserNote> userNotes = userClient.getUserNotes(userinfo.getUserId(), entityId);
55
			List<UserNote> userNotes = userClient.getUserNotes(userinfo.getUserId(), this.entityId);
54
			
56
			
55
			for (UserNote note: userNotes)	{
57
			for (UserNote note: userNotes)	{
56
				slideNotes.put(note.getSlide(), note.getNote());
58
				slideNotes.put(note.getSlide(), note.getNote());
57
			}
59
			}
58
		} catch (NumberFormatException e) {
60
		} catch (NumberFormatException e) {
Line 67... Line 69...
67
	// Handle POST /save-note/
69
	// Handle POST /save-note/
68
	@Action(value="save-note",interceptorRefs={@InterceptorRef("createuser"),@InterceptorRef("myDefault")})
70
	@Action(value="save-note",interceptorRefs={@InterceptorRef("createuser"),@InterceptorRef("myDefault")})
69
	public String create()	{
71
	public String create()	{
70
        
72
        
71
		try {
73
		try {
72
        	long entityId = Long.parseLong(request.getParameter("entity"));
74
        	this.entityId = Long.parseLong(request.getParameter("entity"));
73
        	String slide = request.getParameter("slide");
75
        	String slide = request.getParameter("slide");
74
        	String note = request.getParameter("note");
76
        	String note = request.getParameter("note");
75
 
77
 
76
        	UserContextService.Client userClient = (new UserContextServiceClient()).getClient();
78
        	UserContextService.Client userClient = (new UserContextServiceClient()).getClient();
77
			userClient.putUserNote(userinfo.getUserId(), entityId, slide, note);
79
			userClient.putUserNote(userinfo.getUserId(), this.entityId, slide, note);
78
			
80
			
79
		} catch (NumberFormatException e) {
81
		} catch (NumberFormatException e) {
80
			logger.error("Number Format Exception: " + e.getMessage());
82
			logger.error("Number Format Exception: " + e.getMessage());
81
		} catch (Exception e) {
83
		} catch (Exception e) {
82
			logger.error("Exception: " + e.getMessage());
84
			logger.error("Exception: " + e.getMessage());
Line 111... Line 113...
111
        } catch (IOException e) {
113
        } catch (IOException e) {
112
            e.printStackTrace();
114
            e.printStackTrace();
113
        }
115
        }
114
        return slides;
116
        return slides;
115
    }
117
    }
-
 
118
    
-
 
119
    public long getEntityId()	{
-
 
120
    	return this.entityId;
-
 
121
    }
116
	
122
	
117
    public String getId() {
123
    public String getId() {
118
        return this.id;
124
        return this.id;
119
    }
125
    }
120
 
126