Skip to content

Commit

Permalink
#7 add error throw and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Feb 25, 2019
1 parent afefc65 commit 43194d7
Showing 1 changed file with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.emc.metalnx.services.notification;

import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -10,23 +8,30 @@
import org.datacommons.api.NotificationsApi;
import org.datacommons.client.ApiException;
import org.datacommons.model.Notification;
import org.irods.jargon.core.exception.JargonRuntimeException;
import org.irods.jargon.extensions.notification.NotificationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class NotificationServiceImpl implements NotificationService{
public class NotificationServiceImpl implements NotificationService {

private static final Logger logger = LoggerFactory.getLogger(NotificationServiceImpl.class);

//@Autowired
// @Autowired
NotificationsApi apiInstance = new NotificationsApi();

@Override
public List<Notification> getAllNotification(String userId) {
// TODO Auto-generated method stub
List<Notification> result = new ArrayList<>();
try {
try {
result = apiInstance.getNotification(userId);
} catch (ApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.error("unable to retrieve notifications", e);
throw new JargonRuntimeException("error retrieving notifications", e); // TODO: consider what exception
// hierarchy needs to look like
}
return result;
}
Expand All @@ -46,26 +51,26 @@ public Map<String, Integer> getUnseenCounts(String userId) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return result;
}

@Override
public void deleteNotifications(List<String> uuids) {
// TODO Auto-generated method stub



}

@Override
public void markToSeen(List<String> uuids) {
/* NOTE - Conversion should be kept in the services-- this should be the list of String/UUIDs.
and the services should convert to any supported or desired format.*/
/*try {
apiInstance.markSeen(uuids);
} catch (ApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
/*
* NOTE - Conversion should be kept in the services-- this should be the list of
* String/UUIDs. and the services should convert to any supported or desired
* format.
*/
/*
* try { apiInstance.markSeen(uuids); } catch (ApiException e) { // TODO
* Auto-generated catch block e.printStackTrace(); }
*/
}
}

0 comments on commit 43194d7

Please sign in to comment.