| 5432 |
amar.kumar |
1 |
package in.shop2020.user.handler;
|
|
|
2 |
|
|
|
3 |
import java.util.ArrayList;
|
|
|
4 |
import java.util.Date;
|
|
|
5 |
import java.util.List;
|
|
|
6 |
import java.util.Map;
|
|
|
7 |
|
|
|
8 |
import org.apache.thrift.TException;
|
|
|
9 |
import org.omg.CORBA.UserException;
|
|
|
10 |
import org.slf4j.Logger;
|
|
|
11 |
import org.slf4j.LoggerFactory;
|
|
|
12 |
import org.springframework.context.ApplicationContext;
|
|
|
13 |
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|
|
14 |
import org.springframework.transaction.annotation.Transactional;
|
|
|
15 |
|
|
|
16 |
import in.shop2020.model.v1.catalog.InventoryService;
|
|
|
17 |
import in.shop2020.model.v1.user.Address;
|
|
|
18 |
import in.shop2020.model.v1.user.Affiliate;
|
|
|
19 |
import in.shop2020.model.v1.user.AuthenticationException;
|
|
|
20 |
import in.shop2020.model.v1.user.Cart;
|
|
|
21 |
import in.shop2020.model.v1.user.CartStatus;
|
|
|
22 |
import in.shop2020.model.v1.user.Discount;
|
|
|
23 |
import in.shop2020.model.v1.user.LineStatus;
|
|
|
24 |
import in.shop2020.model.v1.user.MasterAffiliate;
|
|
|
25 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
|
|
26 |
import in.shop2020.model.v1.user.TrackLog;
|
|
|
27 |
import in.shop2020.model.v1.user.TrackLogType;
|
|
|
28 |
import in.shop2020.model.v1.user.Tracker;
|
|
|
29 |
import in.shop2020.model.v1.user.User;
|
|
|
30 |
import in.shop2020.model.v1.user.UserAffiliateException;
|
|
|
31 |
import in.shop2020.model.v1.user.UserCommunication;
|
|
|
32 |
import in.shop2020.model.v1.user.UserCommunicationException;
|
|
|
33 |
import in.shop2020.model.v1.user.UserContextException;
|
|
|
34 |
import in.shop2020.model.v1.user.UserContextService.Iface;
|
|
|
35 |
import in.shop2020.model.v1.user.UserNote;
|
|
|
36 |
import in.shop2020.model.v1.user.UserType;
|
|
|
37 |
import in.shop2020.model.v1.user.WidgetException;
|
|
|
38 |
import in.shop2020.user.handler.AddressHandler;
|
|
|
39 |
import in.shop2020.user.handler.AffiliateHandler;
|
|
|
40 |
import in.shop2020.user.handler.CartHandler;
|
|
|
41 |
import in.shop2020.user.handler.MiscellaneousHandler;
|
|
|
42 |
import in.shop2020.user.handler.TrackHandler;
|
|
|
43 |
import in.shop2020.user.handler.UserHandler;
|
|
|
44 |
import in.shop2020.user.handler.UserWidgetHandler;
|
|
|
45 |
import in.shop2020.user.util.Converter;
|
|
|
46 |
|
|
|
47 |
public class UserServiceHandler implements Iface {
|
|
|
48 |
|
|
|
49 |
private static Logger logger = LoggerFactory.getLogger(UserServiceHandler.class);
|
|
|
50 |
|
|
|
51 |
private AddressHandler addressHandler;
|
|
|
52 |
private AffiliateHandler affiliateHandler;
|
|
|
53 |
private CartHandler cartHandler;
|
|
|
54 |
private MiscellaneousHandler miscellaneousHandler;
|
|
|
55 |
private TrackHandler trackHandler;
|
|
|
56 |
private UserHandler userHandler;
|
|
|
57 |
private UserWidgetHandler userWidgetHandler;
|
|
|
58 |
private ApplicationContext context;
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
public UserServiceHandler() {
|
|
|
62 |
logger.info("Creating context");
|
|
|
63 |
context = new ClassPathXmlApplicationContext("context.xml");
|
|
|
64 |
addressHandler = context.getBean(AddressHandler.class);
|
|
|
65 |
affiliateHandler = context.getBean(AffiliateHandler.class);
|
|
|
66 |
cartHandler = context.getBean(CartHandler.class);
|
|
|
67 |
miscellaneousHandler = context.getBean(MiscellaneousHandler.class);
|
|
|
68 |
trackHandler = context.getBean(TrackHandler.class);
|
|
|
69 |
userHandler = context.getBean(UserHandler.class);
|
|
|
70 |
userWidgetHandler = context.getBean(UserWidgetHandler.class);
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
@Override
|
|
|
76 |
public boolean isAlive() throws TException {
|
|
|
77 |
try {
|
|
|
78 |
userHandler.getUser(1);
|
|
|
79 |
return true;
|
|
|
80 |
} catch (Exception e) {
|
|
|
81 |
logger.error("Could not fetch users", e);
|
|
|
82 |
return false;
|
|
|
83 |
}
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
@Override
|
|
|
87 |
public void closeSession() throws TException {
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
@Transactional
|
|
|
91 |
@Override
|
|
|
92 |
public User createAnonymousUser(String jsession_id)
|
|
|
93 |
throws UserContextException, TException {
|
|
|
94 |
return userHandler.createAnonymousUser(jsession_id);
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
@Override
|
|
|
98 |
public User getUserById(long userId) throws UserContextException,
|
|
|
99 |
TException {
|
|
|
100 |
return userHandler.getUserById(userId);
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
@Override
|
|
|
104 |
public User getUserByEmail(String email) throws UserContextException,
|
|
|
105 |
TException {
|
|
|
106 |
return userHandler.getUserByEmail(email);
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
@Override
|
|
|
110 |
public User getUserByMobileNumber(long mobileNumber)
|
|
|
111 |
throws UserContextException, TException {
|
|
|
112 |
return userHandler.getUserByMobileNumber(new Long(mobileNumber).toString());
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
@Transactional
|
|
|
116 |
@Override
|
|
|
117 |
public User createUser(User user) throws UserContextException, TException {
|
|
|
118 |
return userHandler.createUser(user);
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
@Override
|
|
|
122 |
public User updateUser(User user) throws UserContextException, TException {
|
|
|
123 |
return userHandler.updateUser(user);
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
@Override
|
|
|
127 |
public User authenticateUser(String email, String password)
|
|
|
128 |
throws AuthenticationException, TException {
|
|
|
129 |
return userHandler.authenticateUser(email,password);
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
@Override
|
|
|
133 |
public boolean userExists(String email) throws UserContextException,
|
|
|
134 |
TException {
|
|
|
135 |
return userHandler.userExists(email);
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
@Override
|
|
|
139 |
public long addAddressForUser(long userId, Address address,
|
|
|
140 |
boolean setDefault) throws UserContextException, TException {
|
|
|
141 |
long addressId = -1;
|
|
|
142 |
User user = getUserById(userId);
|
|
|
143 |
if(user==null) {
|
|
|
144 |
throw new UserContextException(103, "No such user");
|
|
|
145 |
}
|
|
|
146 |
addressId = addressHandler.addAddressForUser(Converter.toDBAddress(address, userId));
|
|
|
147 |
if(setDefault||user.getDefaultAddressId()==0) {
|
|
|
148 |
setDefaultAddress(userId, addressId);
|
|
|
149 |
}
|
|
|
150 |
return addressId;
|
|
|
151 |
}
|
|
|
152 |
|
|
|
153 |
@Override
|
|
|
154 |
public boolean removeAddressForUser(long userid, long addressId)
|
|
|
155 |
throws UserContextException, TException {
|
|
|
156 |
in.shop2020.user.domain.Address address = addressHandler.getAddress(addressId);
|
|
|
157 |
|
|
|
158 |
if(address == null) {
|
|
|
159 |
throw new UserContextException(103,"No address found with this addressId");
|
|
|
160 |
}
|
|
|
161 |
if(address.getUser_id()!=userid) {
|
|
|
162 |
throw new UserContextException(104, "This address belongs to some other user");
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
addressHandler.removeAddressForUser(addressId);
|
|
|
166 |
return true;
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
@Override
|
|
|
170 |
public boolean setUserAsLoggedIn(long userId, long timestamp)
|
|
|
171 |
throws UserContextException, TException {
|
|
|
172 |
return userHandler.setUserAsLoggedIn(userId, timestamp);
|
|
|
173 |
}
|
|
|
174 |
|
|
|
175 |
@Override
|
|
|
176 |
public boolean setUserAsLoggedOut(long userId, long timestamp)
|
|
|
177 |
throws UserContextException, TException {
|
|
|
178 |
return userHandler.setUserAsLoggedOut(userId, timestamp);
|
|
|
179 |
}
|
|
|
180 |
|
|
|
181 |
@Override
|
|
|
182 |
public boolean setDefaultAddress(long userId, long addressId)
|
|
|
183 |
throws UserContextException, TException {
|
|
|
184 |
if (userHandler.getUserById(userId) == null) {
|
|
|
185 |
throw new UserContextException(103, "No such user in system");
|
|
|
186 |
}
|
|
|
187 |
in.shop2020.user.domain.Address address = addressHandler.getAddress(addressId);
|
|
|
188 |
if(address == null) {
|
|
|
189 |
throw new UserContextException(103, "Address not found");
|
|
|
190 |
}
|
|
|
191 |
if(address.getUser_id()!=userId) {
|
|
|
192 |
throw new UserContextException(104, "This address belongs to some other user");
|
|
|
193 |
}
|
|
|
194 |
userHandler.setDefaultAddress(userId, addressId);
|
|
|
195 |
return true;
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
@Override
|
|
|
199 |
public boolean updatePassword(long userid, String oldPassword,
|
|
|
200 |
String newPassword) throws UserContextException, TException {
|
|
|
201 |
return userHandler.updatePassword(userid, oldPassword, newPassword);
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
@Override
|
|
|
205 |
public boolean forgotPassword(String email, String newPassword)
|
|
|
206 |
throws UserContextException, TException {
|
|
|
207 |
return userHandler.forgotPassword(email, newPassword);
|
|
|
208 |
}
|
|
|
209 |
|
|
|
210 |
@Override
|
|
|
211 |
public List<Address> getAllAddressesForUser(long userId)
|
|
|
212 |
throws UserContextException, TException {
|
|
|
213 |
return addressHandler.getAllAddressesForUser(userId);
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
@Override
|
|
|
217 |
public Address getAddressById(long addressId) throws UserContextException,
|
|
|
218 |
TException {
|
|
|
219 |
return Converter.toThriftAddress(addressHandler.getAddress(addressId));
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
@Override
|
|
|
223 |
public long getDefaultAddressId(long userId) throws UserContextException,
|
|
|
224 |
TException {
|
|
|
225 |
User user = userHandler.getUserById(userId);
|
|
|
226 |
if(user == null) {
|
|
|
227 |
throw new UserContextException(101, "no such user in system UserId : "+userId);
|
|
|
228 |
}
|
|
|
229 |
return user.getDefaultAddressId();
|
|
|
230 |
}
|
|
|
231 |
|
|
|
232 |
@Override
|
|
|
233 |
public String getDefaultPincode(long userId) throws UserContextException,
|
|
|
234 |
TException {
|
|
|
235 |
return userHandler.getDefaultPincode(userId);
|
|
|
236 |
}
|
|
|
237 |
|
|
|
238 |
@Override
|
|
|
239 |
public boolean saveUserCommunication(long userId, String replyTo,
|
|
|
240 |
long communicationType, long orderId, String airwaybillNo,
|
|
|
241 |
String productName, String subject, String message)
|
|
|
242 |
throws UserCommunicationException, TException {
|
|
|
243 |
return userHandler.saveUserCommunication(userId, replyTo,
|
|
|
244 |
communicationType, orderId, airwaybillNo,productName,
|
|
|
245 |
subject, message);
|
|
|
246 |
}
|
|
|
247 |
|
|
|
248 |
@Override
|
|
|
249 |
public UserCommunication getUserCommunicationById(long id)
|
|
|
250 |
throws UserCommunicationException, TException {
|
|
|
251 |
return userHandler.getUserCommunicationById(id);
|
|
|
252 |
}
|
|
|
253 |
|
|
|
254 |
@Override
|
|
|
255 |
public List<UserCommunication> getUserCommunicationByUser(long userId)
|
|
|
256 |
throws UserCommunicationException, TException {
|
|
|
257 |
return userHandler.getUserCommunicationByUser(userId);
|
|
|
258 |
}
|
|
|
259 |
|
|
|
260 |
@Override
|
|
|
261 |
public List<UserCommunication> getAllUserCommunications()
|
|
|
262 |
throws UserCommunicationException, TException {
|
|
|
263 |
return userHandler.getAllUserCommunications();
|
|
|
264 |
}
|
|
|
265 |
|
|
|
266 |
public void removeUserCommunication(long id)
|
|
|
267 |
throws UserCommunicationException, TException {
|
|
|
268 |
userHandler.removeUserCommunication(id);
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
@Override
|
|
|
272 |
public MasterAffiliate createMasterAffiliate(String name, long addedOn)
|
|
|
273 |
throws UserAffiliateException, TException {
|
|
|
274 |
return affiliateHandler.createMasterAffiliate(name, addedOn);
|
|
|
275 |
}
|
|
|
276 |
|
|
|
277 |
@Override
|
|
|
278 |
public List<MasterAffiliate> getAllMasterAffiliates()
|
|
|
279 |
throws UserAffiliateException, TException {
|
|
|
280 |
return affiliateHandler.getAllMasterAffiliates();
|
|
|
281 |
}
|
|
|
282 |
|
|
|
283 |
@Override
|
|
|
284 |
public MasterAffiliate getMasterAffiliateById(long id)
|
|
|
285 |
throws UserAffiliateException, TException {
|
|
|
286 |
return affiliateHandler.getMasterAffiliateById(id);
|
|
|
287 |
}
|
|
|
288 |
|
|
|
289 |
@Override
|
|
|
290 |
public MasterAffiliate getMasterAffiliateByName(String name)
|
|
|
291 |
throws UserAffiliateException, TException {
|
|
|
292 |
return affiliateHandler.getMasterAffiliateByName(name);
|
|
|
293 |
}
|
|
|
294 |
|
|
|
295 |
@Override
|
|
|
296 |
public Affiliate createAffiliate(String name, String url,
|
|
|
297 |
long masterAffiliateId, long addedOn)
|
|
|
298 |
throws UserAffiliateException, TException {
|
|
|
299 |
return affiliateHandler.createAffiliate(name, url, masterAffiliateId, addedOn);
|
|
|
300 |
}
|
|
|
301 |
|
|
|
302 |
@Override
|
|
|
303 |
public Affiliate getAffiliateById(long id) throws UserAffiliateException,
|
|
|
304 |
TException {
|
|
|
305 |
return affiliateHandler.getAffiliateById(id);
|
|
|
306 |
}
|
|
|
307 |
|
|
|
308 |
@Override
|
|
|
309 |
public Affiliate getAffiliateByName(String name)
|
|
|
310 |
throws UserAffiliateException, TException {
|
|
|
311 |
return affiliateHandler.getAffiliateByName(name);
|
|
|
312 |
}
|
|
|
313 |
|
|
|
314 |
@Override
|
|
|
315 |
public Tracker getTrackerById(long id) throws UserAffiliateException,
|
|
|
316 |
TException {
|
|
|
317 |
return trackHandler.getTrackerById(id);
|
|
|
318 |
}
|
|
|
319 |
|
|
|
320 |
@Override
|
|
|
321 |
public List<Affiliate> getAffiliatesByMasterAffiliate(long id)
|
|
|
322 |
throws UserAffiliateException, TException {
|
|
|
323 |
return affiliateHandler.getAffiliatesByMasterAffiliate(id);
|
|
|
324 |
}
|
|
|
325 |
|
|
|
326 |
@Override
|
|
|
327 |
public long addTrackLog(long affiliateId, long userId, TrackLogType event,
|
|
|
328 |
String url, String data, long addedOn)
|
|
|
329 |
throws UserAffiliateException, TException {
|
|
|
330 |
return trackHandler.addTrackLog(affiliateId, userId, event, url,
|
|
|
331 |
data, addedOn);
|
|
|
332 |
}
|
|
|
333 |
|
|
|
334 |
@Override
|
|
|
335 |
public TrackLog getTrackLogById(long id) throws UserAffiliateException,
|
|
|
336 |
TException {
|
|
|
337 |
return Converter.toThriftTrackLog(trackHandler.getTrackLogById(id));
|
|
|
338 |
}
|
|
|
339 |
|
|
|
340 |
@Override
|
|
|
341 |
public List<TrackLog> getTrackLogsByAffiliate(long affiliateId,
|
|
|
342 |
long startDate, long endDate) throws UserAffiliateException,
|
|
|
343 |
TException {
|
|
|
344 |
return trackHandler.getTrackLogsByAffiliate(affiliateId,
|
|
|
345 |
startDate, endDate);
|
|
|
346 |
}
|
|
|
347 |
|
|
|
348 |
@Override
|
|
|
349 |
public List<TrackLog> getTrackLogsByUser(long userId)
|
|
|
350 |
throws UserAffiliateException, TException {
|
|
|
351 |
return trackHandler.getTrackLogsByUser(userId);
|
|
|
352 |
}
|
|
|
353 |
|
|
|
354 |
@Override
|
|
|
355 |
public List<TrackLog> getTrackLogs(long userId, String event, String url)
|
|
|
356 |
throws UserAffiliateException, TException {
|
|
|
357 |
return trackHandler.getTrackLogs(userId, event, url);
|
|
|
358 |
}
|
|
|
359 |
|
|
|
360 |
@Override
|
|
|
361 |
public Cart getCurrentCart(long userId) throws ShoppingCartException,
|
|
|
362 |
TException {
|
|
|
363 |
return cartHandler.getCartsForUser(userId, CartStatus.ACTIVE);
|
|
|
364 |
}
|
|
|
365 |
|
|
|
366 |
@Override
|
|
|
367 |
public Cart getCart(long cartId) throws ShoppingCartException, TException {
|
|
|
368 |
return cartHandler.getCart(cartId);
|
|
|
369 |
}
|
|
|
370 |
|
|
|
371 |
@Override
|
|
|
372 |
public List<Cart> getCartsByTime(long from_time, long to_time,
|
|
|
373 |
CartStatus status) throws ShoppingCartException, TException {
|
|
|
374 |
return cartHandler.getCartsByTime(from_time, to_time, status);
|
|
|
375 |
}
|
|
|
376 |
|
|
|
377 |
@Override
|
|
|
378 |
public String addItemToCart(long cartId, long itemId, long quantity,
|
|
|
379 |
long sourceId) throws ShoppingCartException, TException {
|
|
|
380 |
return cartHandler.addItemToCart(cartId, itemId, quantity, sourceId);
|
|
|
381 |
}
|
|
|
382 |
|
|
|
383 |
@Override
|
|
|
384 |
public void deleteItemFromCart(long cartId, long itemId)
|
|
|
385 |
throws ShoppingCartException, TException {
|
|
|
386 |
cartHandler.deleteItemFromCart(cartId, itemId);
|
|
|
387 |
}
|
|
|
388 |
|
|
|
389 |
@Override
|
|
|
390 |
public void addAddressToCart(long cartId, long addressId)
|
|
|
391 |
throws ShoppingCartException, TException {
|
|
|
392 |
cartHandler.addAddressToCart(cartId, addressId);
|
|
|
393 |
|
|
|
394 |
}
|
|
|
395 |
|
|
|
396 |
@Override
|
|
|
397 |
public void applyCouponToCart(long cartId, String couponCode,
|
|
|
398 |
double totalPrice, double discountedPrice)
|
|
|
399 |
throws ShoppingCartException, TException {
|
|
|
400 |
cartHandler.applyCouponToCart(cartId, couponCode, totalPrice, discountedPrice);
|
|
|
401 |
}
|
|
|
402 |
|
|
|
403 |
@Override
|
|
|
404 |
public void removeCoupon(long cartId) throws ShoppingCartException,
|
|
|
405 |
TException {
|
|
|
406 |
cartHandler.removeCoupon(cartId);
|
|
|
407 |
}
|
|
|
408 |
|
|
|
409 |
@Override
|
|
|
410 |
public void deleteDiscountsFromCart(long cartId)
|
|
|
411 |
throws ShoppingCartException, TException {
|
|
|
412 |
cartHandler.deleteDiscountsFromCart(cartId);
|
|
|
413 |
}
|
|
|
414 |
|
|
|
415 |
@Override
|
|
|
416 |
public void saveDiscounts(List<Discount> discounts)
|
|
|
417 |
throws ShoppingCartException, TException {
|
|
|
418 |
cartHandler.saveDiscounts(discounts);
|
|
|
419 |
}
|
|
|
420 |
|
|
|
421 |
@Override
|
|
|
422 |
public String validateCart(long cartId, long sourceId)
|
|
|
423 |
throws ShoppingCartException, TException {
|
|
|
424 |
return cartHandler.validateCart(cartId, sourceId);
|
|
|
425 |
}
|
|
|
426 |
|
|
|
427 |
@Override
|
|
|
428 |
public void mergeCart(long fromCartId, long toCartId) throws TException {
|
|
|
429 |
cartHandler.mergeCart(fromCartId, toCartId);
|
|
|
430 |
|
|
|
431 |
}
|
|
|
432 |
|
|
|
433 |
@Override
|
|
|
434 |
public boolean checkOut(long cartId) throws ShoppingCartException,
|
|
|
435 |
TException {
|
|
|
436 |
return cartHandler.checkOut(cartId);
|
|
|
437 |
}
|
|
|
438 |
|
|
|
439 |
@Override
|
|
|
440 |
public boolean resetCart(long cartId, Map<Long, Double> items)
|
|
|
441 |
throws ShoppingCartException, TException {
|
|
|
442 |
return cartHandler.resetCart(cartId, items);
|
|
|
443 |
}
|
|
|
444 |
|
|
|
445 |
@Override
|
|
|
446 |
public long getUserCount(UserType userType) throws TException {
|
|
|
447 |
return userHandler.getUserCount(userType);
|
|
|
448 |
}
|
|
|
449 |
|
|
|
450 |
@Override
|
|
|
451 |
public List<User> getAllUsers(UserType userType, long startDate,
|
|
|
452 |
long endDate) throws TException {
|
|
|
453 |
|
|
|
454 |
List<User> tUsers = new ArrayList<User>();
|
|
|
455 |
for(in.shop2020.user.domain.User user : userHandler.getAllUsers(userType, startDate, endDate)) {
|
|
|
456 |
tUsers.add(Converter.toThriftUser(user));
|
|
|
457 |
}
|
|
|
458 |
return tUsers;
|
|
|
459 |
}
|
|
|
460 |
|
|
|
461 |
@Override
|
|
|
462 |
public void putUserNote(long user_id, long entity_id, String slide,
|
|
|
463 |
String note) throws TException {
|
|
|
464 |
miscellaneousHandler.putUserNote(user_id, entity_id, slide, note);
|
|
|
465 |
|
|
|
466 |
}
|
|
|
467 |
|
|
|
468 |
@Override
|
|
|
469 |
public List<UserNote> getUserNotes(long user_id, long entity_id)
|
|
|
470 |
throws TException {
|
|
|
471 |
return miscellaneousHandler.getUserNotes(user_id, entity_id);
|
|
|
472 |
}
|
|
|
473 |
|
|
|
474 |
@Override
|
|
|
475 |
public List<Long> getMyResearchItems(long userId) throws WidgetException,
|
|
|
476 |
TException {
|
|
|
477 |
return userWidgetHandler.getMyResearchItems(userId);
|
|
|
478 |
}
|
|
|
479 |
|
|
|
480 |
@Override
|
|
|
481 |
public boolean updateMyResearch(long userId, long itemId)
|
|
|
482 |
throws WidgetException, TException {
|
|
|
483 |
return userWidgetHandler.updateMyResearch(userId, itemId);
|
|
|
484 |
}
|
|
|
485 |
|
|
|
486 |
@Override
|
|
|
487 |
public void deleteItemFromMyResearch(long userId, long itemId)
|
|
|
488 |
throws WidgetException, TException {
|
|
|
489 |
userWidgetHandler.deleteItemFromMyResearch(userId, itemId);
|
|
|
490 |
}
|
|
|
491 |
|
|
|
492 |
@Override
|
|
|
493 |
public List<Long> getBrowseHistoryItems(long userId)
|
|
|
494 |
throws WidgetException, TException {
|
|
|
495 |
return userWidgetHandler.getBrowseHistoryItems(userId);
|
|
|
496 |
}
|
|
|
497 |
|
|
|
498 |
@Override
|
|
|
499 |
public void updateBrowseHistory(long userId, long itemId) throws TException {
|
|
|
500 |
if(!userWidgetHandler.isItemInBrowseHistory(userId, itemId)) {
|
|
|
501 |
userWidgetHandler.updateBrowseHistory(userId, itemId);
|
|
|
502 |
}
|
|
|
503 |
}
|
|
|
504 |
|
|
|
505 |
@Override
|
|
|
506 |
public long getCartsWithCouponCount(String couponCode) throws TException {
|
|
|
507 |
return cartHandler.getCartsWithCouponCount(couponCode);
|
|
|
508 |
}
|
|
|
509 |
|
|
|
510 |
@Override
|
|
|
511 |
public void increaseTrustLevel(long userId, double trustLevelDelta)
|
|
|
512 |
throws TException {
|
|
|
513 |
userHandler.increaseTrustLevel(userId, trustLevelDelta);
|
|
|
514 |
}
|
|
|
515 |
|
|
|
516 |
@Override
|
|
|
517 |
public double getTrustLevel(long userId) throws TException {
|
|
|
518 |
return userHandler.getTrustLevel(userId);
|
|
|
519 |
}
|
|
|
520 |
|
|
|
521 |
@Override
|
|
|
522 |
public boolean showCODOption(long cartId, long sourceId, String pincode)
|
|
|
523 |
throws TException {
|
|
|
524 |
return cartHandler.showCODOption(cartId, sourceId, pincode);
|
|
|
525 |
}
|
|
|
526 |
|
|
|
527 |
@Override
|
|
|
528 |
public User getUserByCartId(long cartId) throws UserContextException,
|
|
|
529 |
TException {
|
|
|
530 |
return userHandler.getUserByCartId(cartId);
|
|
|
531 |
}
|
|
|
532 |
|
|
|
533 |
@Override
|
|
|
534 |
public long createOrders(long cartId, String sessionSource,
|
|
|
535 |
long sessionStartTime, String firstSource, long firstSourceTime,
|
|
|
536 |
long userId) throws ShoppingCartException, TException {
|
|
|
537 |
return cartHandler.commitCart(cartId, sessionSource, sessionStartTime,
|
|
|
538 |
firstSource, firstSourceTime, userId);
|
|
|
539 |
}
|
|
|
540 |
|
|
|
541 |
public void setDataSourceUrl(String dbHost) {
|
|
|
542 |
org.apache.commons.dbcp.BasicDataSource ds = (org.apache.commons.dbcp.BasicDataSource)context.getBean("dataSource");
|
|
|
543 |
ds.setUrl(dbHost);
|
|
|
544 |
}
|
|
|
545 |
|
|
|
546 |
public String getDataSourceUrl() {
|
|
|
547 |
org.apache.commons.dbcp.BasicDataSource ds = (org.apache.commons.dbcp.BasicDataSource)context.getBean("dataSource");
|
|
|
548 |
return ds.getUrl();
|
|
|
549 |
}
|
| 5560 |
rajveer |
550 |
|
|
|
551 |
@Override
|
|
|
552 |
public void addStoreToCart(long cartId, long storeId)
|
|
|
553 |
throws ShoppingCartException, TException {
|
|
|
554 |
cartHandler.addStoreToCart(cartId, storeId);
|
|
|
555 |
|
|
|
556 |
}
|
| 5432 |
amar.kumar |
557 |
|
|
|
558 |
}
|