* @throws Exception
*/
@SubscribeMapping("/notifications")
public NotificationResume getPositions() throws Exception {
log.debug("/notifications-ws");
final NotificationResume notificationResume = new NotificationResume();
try {
final String username = getUserPrincipalUsername();
log.debug("notifications-ws User get by getUserPrincipalUsername ---> " + getUserPrincipalUsername());
UserAccount userAccount;
if (!username.isEmpty()) {
userAccount = getByUsername(username);
if (userAccount != null) {
final Long totalNot = getNotificationDao().retrieveTotalNotificationStatus(userAccount.getAccount());
log.debug("totalNot "+totalNot);
final Long totalNewNot = getNotificationDao().retrieveTotalNotReadedNotificationStatus(userAccount.getAccount());
log.debug("totalNewNot "+totalNewNot);
notificationResume.setTotalNot(totalNot);
notificationResume.setTotalNewNot(totalNewNot);
log.debug(totalNewNot + " NEW of "+totalNot+" total not");
} else {
notificationResume.setTotalNot(0L);
notificationResume.setTotalNewNot(0L);
}
} else {
throw new EnMeExpcetion("Auth object is not valid");
}
} catch (EnMeExpcetion e) {
notificationResume.setTotalNot(0L);
notificationResume.setTotalNewNot(0L);
log.fatal("cometd: username invalid");
}
return notificationResume;
}