Null check for ClientResponse in PolicyUril.java
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / controller / TicketEventController.java
index 222f450..76154c6 100644 (file)
@@ -1,21 +1,39 @@
 /*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the “License”);
+ * you may not use this software except in compliance with the License.
  * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * ================================================================================
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
  */
 package org.openecomp.portalapp.portal.controller;
 
@@ -33,13 +51,12 @@ import org.openecomp.portalapp.portal.domain.EPUser;
 import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
 import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
 import org.openecomp.portalapp.portal.logging.aop.EPAuditLog;
+import org.openecomp.portalapp.portal.service.TicketEventService;
 import org.openecomp.portalapp.portal.service.UserNotificationService;
 import org.openecomp.portalapp.portal.transport.EpNotificationItem;
 import org.openecomp.portalapp.portal.transport.EpRoleNotificationItem;
-import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties;
 import org.openecomp.portalapp.portal.utils.PortalConstants;
 import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
@@ -67,6 +84,9 @@ public class TicketEventController implements BasicAuthenticationController {
 
        @Autowired
        private UserNotificationService userNotificationService;
+       
+       @Autowired
+       private TicketEventService ticketEventService;
 
        private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(TicketEventController.class);
 
@@ -106,6 +126,7 @@ public class TicketEventController implements BasicAuthenticationController {
                        JsonNode event = ticketEventNotif.get("event");
                        JsonNode header = event.get("header");
                        JsonNode body = event.get("body");
+                       JsonNode application = ticketEventNotif.get("application");
                        epItem.setMsgDescription(body.toString());
                        Long eventDate = System.currentTimeMillis();
                        if (body.get("eventDate") != null) {
@@ -114,7 +135,7 @@ public class TicketEventController implements BasicAuthenticationController {
                        String eventSource = header.get("eventSource").asText();
                        epItem.setMsgSource(eventSource);
                        String ticket = body.get("ticketNum").asText();
-                       String hyperlink = SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_SYSTEM_NOTIFICATION_URL)+eventSource+"num="+ticket;
+                       String hyperlink = ticketEventService.getNotificationHyperLink(application, ticket, eventSource);                       
                        if(body.get("notificationHyperlink")!=null){
                                hyperlink=body.get("notificationHyperlink").asText();
                        }
@@ -201,7 +222,7 @@ public class TicketEventController implements BasicAuthenticationController {
                                .split(",");            
                List<EPUser> users = userNotificationService.getUsersByOrgIds(Arrays.asList(UserIds));
                if(users==null||users.size()==0)
-                       return "Invalid Attuid";
+                       return "Invalid Org User ID";
                return null;
        }