Subversion Repositories SmartDukaan

Rev

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

Rev 1614 Rev 1703
Line 74... Line 74...
74
		log.info("user id is " + userId);
74
		log.info("user id is " + userId);
75
		log.info("cart id is " + cartId);
75
		log.info("cart id is " + cartId);
76
		
76
		
77
		log.info("item id is " + this.reqparams.get("productid"));
77
		log.info("item id is " + this.reqparams.get("productid"));
78
		
78
		
79
		if (this.reqparams.get("historyitems") != null) {
-
 
80
			String historyItems = this.reqparams.get("productid")[0];
-
 
81
			updateHistory(historyItems);
-
 
82
		}
-
 
83
		
-
 
84
		String itemIds = "";
79
		String itemIds = "";
85
		if (this.reqparams.get("productid") != null) {
80
		if (this.reqparams.get("productid") != null) {
86
			itemIds = this.reqparams.get("productid")[0];
81
			itemIds = this.reqparams.get("productid")[0];
87
		}else{
82
		}else{
88
			return "failure";
83
			return "failure";
Line 112... Line 107...
112
		}
107
		}
113
 
108
 
114
		return "success";
109
		return "success";
115
	}		
110
	}		
116
 
111
 
117
	private void updateHistory(String historyItems) {
-
 
118
		UserContextServiceClient userServiceClient;
-
 
119
		try {
-
 
120
			userServiceClient = new UserContextServiceClient();
-
 
121
			UserContextService.Client userClient = userServiceClient.getClient();
-
 
122
			StringTokenizer tokenizer = new StringTokenizer(historyItems, "_");
-
 
123
		
-
 
124
			while (tokenizer.hasMoreTokens()) {
-
 
125
				long itemId = Long.parseLong(tokenizer.nextToken());
-
 
126
				userClient.updateBrowseHistory(userinfo.getUserId(), itemId);
-
 
127
			}	
-
 
128
		} catch (Exception e) {
-
 
129
			e.printStackTrace();
-
 
130
		}
-
 
131
 
-
 
132
			
-
 
133
	}
-
 
134
 
112
 
135
		// DELETE /entity
113
		// DELETE /entity
136
		public String destroy() {
114
		public String destroy() {
137
	    	log.info("CartController.destroy");
115
	    	log.info("CartController.destroy");
138
	    	printParams();
116
	    	printParams();