import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@ApiOperation(
value = "Accepts messages from external ticketing systems and creates notifications for Portal users.",
response = PortalRestResponse.class)
@ApiOperation(
value = "Accepts messages from external ticketing systems and creates notifications for Portal users.",
response = PortalRestResponse.class)
public PortalRestResponse<String> handleRequest(HttpServletRequest request, HttpServletResponse response,
@RequestBody String ticketEventJson) throws Exception {
public PortalRestResponse<String> handleRequest(HttpServletRequest request, HttpServletResponse response,
@RequestBody String ticketEventJson) throws Exception {
// Reject request if required fields are missing.
String error = validateTicketEventMessage(ticketEventNotif);
// Reject request if required fields are missing.
String error = validateTicketEventMessage(ticketEventNotif);
epItem.setPriority(severity);
epItem.setCreatorId(null);
Set<EpRoleNotificationItem> roles = new HashSet<>();
epItem.setPriority(severity);
epItem.setCreatorId(null);
Set<EpRoleNotificationItem> roles = new HashSet<>();
- JsonNode SubscriberInfo = ticketEventNotif.get("SubscriberInfo");
- JsonNode userList = SubscriberInfo.get("UserList");
- String UserIds[] = userList.toString().replace("[", "").replace("]", "").trim().replace("\"", "")
+ JsonNode subscriberInfo = ticketEventNotif.get("SubscriberInfo");
+ JsonNode userList = subscriberInfo.get("UserList");
+ String userIds[] = userList.toString().replace("[", "").replace("]", "").trim().replace("\"", "")
.split(",");
String assetID = eventSource + ' '
+ userList.toString().replace("[", "").replace("]", "").trim().replace("\"", "") + ' '
.split(",");
String assetID = eventSource + ' '
+ userList.toString().replace("[", "").replace("]", "").trim().replace("\"", "") + ' '
- List<EPUser> users = userNotificationService.getUsersByOrgIds(Arrays.asList(UserIds));
- for (String userId : UserIds) {
+ List<EPUser> users = userNotificationService.getUsersByOrgIds(Arrays.asList(userIds));
+ for (String userId : userIds) {
EpRoleNotificationItem roleNotifItem = new EpRoleNotificationItem();
for (EPUser user : users) {
if (user.getOrgUserId().equals(userId)) {
EpRoleNotificationItem roleNotifItem = new EpRoleNotificationItem();
for (EPUser user : users) {
if (user.getOrgUserId().equals(userId)) {
portalResponse.setMessage("processEventNotification: notification created");
portalResponse.setResponse("NotificationId is :" + epItem.notificationId);
} catch (Exception ex) {
portalResponse.setMessage("processEventNotification: notification created");
portalResponse.setResponse("NotificationId is :" + epItem.notificationId);
} catch (Exception ex) {
JsonNode header = event.get("header");
JsonNode eventSource = header.get("eventSource");
JsonNode body = event.get("body");
JsonNode header = event.get("header");
JsonNode eventSource = header.get("eventSource");
JsonNode body = event.get("body");
- JsonNode SubscriberInfo = ticketEventNotif.get("SubscriberInfo");
- JsonNode userList = SubscriberInfo.get("UserList");
+ JsonNode subscriberInfo = ticketEventNotif.get("SubscriberInfo");
+ JsonNode userList = subscriberInfo.get("UserList");
return "Application is mandatory";
if (body == null)
return "body is mandatory";
if (eventSource == null || eventSource.asText().trim().length() == 0
return "Application is mandatory";
if (body == null)
return "body is mandatory";
if (eventSource == null || eventSource.asText().trim().length() == 0
- String UserIds[] = userList.toString().replace("[", "").replace("]", "").trim().replace("\"", "")
+ String[] userIds = userList.toString().replace("[", "").replace("]", "").trim().replace("\"", "")
- List<EPUser> users = userNotificationService.getUsersByOrgIds(Arrays.asList(UserIds));
- if (users == null || users.size() == 0)
+ List<EPUser> users = userNotificationService.getUsersByOrgIds(Arrays.asList(userIds));
+ if (users == null || users.isEmpty())