Updates for checkstyle warnings 59/83759/2
authorJerry Flood <jflood@att.com>
Fri, 29 Mar 2019 16:53:11 +0000 (12:53 -0400)
committerJerry Flood <jflood@att.com>
Fri, 29 Mar 2019 17:04:02 +0000 (13:04 -0400)
Issue-ID: OPTFRA-466
Change-Id: I574203ac7723913b22bf18ec1ac2179983ae0052
Signed-off-by: Jerry Flood <jflood@att.com>
41 files changed:
cmso-ticketmgt/pom.xml
cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java
cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java
cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java
cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java
cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java
cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java
cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java
cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java
cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/Application.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/ApplicationPropertiesFiles.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/AuthProvider.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SecurityConfig.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SpringProfiles.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/FilterPriority.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/Availability.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminTool.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminToolImpl.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterfaceImpl.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheck.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheckImpl.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagementImpl.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsRequest.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsResponse.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ChangeWindow.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ElementCriteria.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckComponent.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckMessage.java
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/NameValue.java

index 278ee01..1274360 100644 (file)
@@ -22,7 +22,7 @@
                <version>1.0.1-SNAPSHOT</version>
        </parent>
 
-       <groupId>org.onap.optf.cmso</groupId>
+       <groupId>org.onap.optf.cmso.tcketmgt</groupId>
        <artifactId>cmso-ticketmgt</artifactId>
 
        <packaging>jar</packaging>
index cf49ccd..e2b8220 100644 (file)
@@ -39,12 +39,11 @@ import static com.att.eelf.configuration.Configuration.MDC_RESPONSE_DESC;
 import static com.att.eelf.configuration.Configuration.MDC_STATUS_CODE;
 import static com.att.eelf.configuration.Configuration.MDC_TARGET_ENTITY;
 import static com.att.eelf.configuration.Configuration.MDC_TARGET_SERVICE_NAME;
-
+import com.att.eelf.utils.Stopwatch;
 import java.net.URI;
 import java.util.Date;
 import java.util.Map;
 import java.util.UUID;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.client.ClientRequestContext;
 import javax.ws.rs.client.ClientResponseContext;
@@ -52,172 +51,157 @@ import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.container.ContainerResponseContext;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response.StatusType;
-
 import org.onap.observations.MessageHeaders.HeadersEnum;
 import org.slf4j.MDC;
 
-import com.att.eelf.utils.Stopwatch;
-
 /**
- * ECOMP EELF logging MDC fields not defined in the MDC Configuration (i.e.
- * MDC_ALERT_SEVERITY)
+ * ECOMP EELF logging MDC fields not defined in the MDC Configuration (i.e. MDC_ALERT_SEVERITY)
  **/
 public class Mdc {
-       public static final String SERVICE_NAME = "CSS-Scheduler";
-       public enum Enum {
-               // BeginTimestamp,
-               // EndTimeStamp,
-               // RequestId,
-               // ServiceInstanceId,
-               VirtualServerName,
-               // ServiceName,
-               // PartnerName,
-               // StatusCOde,
-               // ResponseCode,
-               // ResponseDescription,
-               // InstanceUUID,
-               // AlertSeverity,
-               // ServerIPAddress,
-               // ElapsedTime,
-               // ServerFQDN,
-               // RemoteHost,
-               ClassName, Unused,
-               // ProcessKey,
-               CustomField1, CustomField2, CustomField3, CustomField4,
-               // TargetVirtualEntity,
-               // TargetEntity,
-               // TargetServiceName,
-               ErrorCode, ErrorDescription, Timer,
-       }
-
-       public static String getCaller(int back)
-       {
-               StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
-               return stackTraceElements[back].getClassName() + "." + stackTraceElements[back].getMethodName();
-       }
-
-       public static void setCaller(int back)
-       {
-               String caller = MDC.get(Enum.ClassName.name());
-               if (caller == null)
-                       MDC.put(Enum.ClassName.name(), getCaller(back));
-       }
-
-       public static void setObservation(ObservationInterface o)
-       {
-               MDC.put(Enum.CustomField4.name(), o.name());
-       }
-
-       public static void clearCaller()
-       {
-               MDC.remove(Enum.ClassName.name());
-       }
-
-       public static Map<String, String> save() 
-       {
-               Map<String, String> save = MDC.getCopyOfContextMap();
-               return save;
-       }
-
-       public static void restore(Map<String, String> mdcSave) 
-       {
-               MDC.clear();
-               for (String name : mdcSave.keySet())
-                       MDC.put(name, mdcSave.get(name));
-       }
-
-
-
-       public static void setRequestIdIfNotSet(String requestId) {
-               if (MDC.get(MDC_KEY_REQUEST_ID) == null || MDC.get(MDC_KEY_REQUEST_ID).equals(""))
-       {
-                       setRequestId(requestId);
-               }
-       }
-       
-       public static void setRequestId(String requestId) {
-               MDC.put(MDC_KEY_REQUEST_ID, requestId);
-       }
-               
-       public static void metricStart(ClientRequestContext requestContext) {
-               MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
-               MDC.put(MDC_END_TIMESTAMP, MDC.get(MDC_BEGIN_TIMESTAMP));
-               setPartnerTargetFromUri(requestContext.getUri());
-       }
-
-       public static void metricEnd(ClientResponseContext response) 
-       {
-               
-               Date now = new Date();
-               //MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(now));
-               MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(now));
-               setResponseInfo(response.getStatusInfo());
-               
-       }
-       public static void auditStart(ContainerRequestContext requestContext, HttpServletRequest servletRequest) 
-       {
-               MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
-               MDC.put(MDC_END_TIMESTAMP, MDC.get(MDC_BEGIN_TIMESTAMP));
-               MDC.put(MDC_REMOTE_HOST, servletRequest.getRemoteHost());
-               MDC.put(Enum.ClassName.name(), getCaller(4));
-               MultivaluedMap<String, String> headers = requestContext.getHeaders();
-               String transactionId = (String) headers.getFirst(HeadersEnum.TransactionID.toString());
-               if (transactionId != null)
-               {
-                       setRequestId(transactionId);
-               }
-               else
-               {
-                       setRequestId(UUID.randomUUID().toString());
-               }
-               
-       }
-
-       public static void auditEnd(ContainerRequestContext requestContext, ContainerResponseContext response)
-       {
-               Date now = new Date();
-               //MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(now));
-               MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(now));
-               MDC.put(Enum.ClassName.name(), getCaller(4));
-               
-               setResponseInfo(response.getStatusInfo());
-               
-       }
-                
-       private static void setResponseInfo(StatusType statusInfo)
-       {
-               Integer status = statusInfo.getStatusCode();
-               String completed = "ERROR";
-               if (status >=200 && status < 300)
-               {
-                       completed = "COMPLETE";
-               }
-               MDC.put(MDC_RESPONSE_CODE, status.toString());
-               MDC.put(MDC_RESPONSE_DESC, statusInfo.getReasonPhrase());
-               MDC.put(MDC_STATUS_CODE, completed);
-       }
-               
-       public static void setEvent(String requestID) {
-               MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
-               MDC.put(MDC_END_TIMESTAMP, MDC.get(MDC_BEGIN_TIMESTAMP));
-               setRequestId(requestID);
-       }
-
-       private static void setPartnerTargetFromUri(URI uri)
-       {
-               try
-               {
-                       MDC.put(MDC_PARTNER_NAME, uri.getHost());
-                       MDC.put(MDC_TARGET_ENTITY, uri.getScheme() + "://" + uri.getHost() + ":" + uri.getPort());
-                       MDC.put(MDC_TARGET_SERVICE_NAME, uri.getPath());
-               }
-               catch (Exception e)
-               {
-                       MDC.put(MDC_PARTNER_NAME, "UNKNOWN");
-                       MDC.put(MDC_TARGET_ENTITY, "UNKNOWN");
-                       MDC.put(MDC_TARGET_SERVICE_NAME, "UNKNOWN");
-               }
-       }
-
-
-}
\ No newline at end of file
+    public static final String SERVICE_NAME = "CSS-Scheduler";
+
+    public enum Enum {
+        // BeginTimestamp,
+        // EndTimeStamp,
+        // RequestId,
+        // ServiceInstanceId,
+        VirtualServerName,
+        // ServiceName,
+        // PartnerName,
+        // StatusCOde,
+        // ResponseCode,
+        // ResponseDescription,
+        // InstanceUUID,
+        // AlertSeverity,
+        // ServerIPAddress,
+        // ElapsedTime,
+        // ServerFQDN,
+        // RemoteHost,
+        ClassName,
+        Unused,
+        // ProcessKey,
+        CustomField1,
+        CustomField2,
+        CustomField3,
+        CustomField4,
+        // TargetVirtualEntity,
+        // TargetEntity,
+        // TargetServiceName,
+        ErrorCode,
+        ErrorDescription,
+        Timer,
+    }
+
+    public static String getCaller(int back) {
+        StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
+        return stackTraceElements[back].getClassName() + "." + stackTraceElements[back].getMethodName();
+    }
+
+    public static void setCaller(int back) {
+        String caller = MDC.get(Enum.ClassName.name());
+        if (caller == null)
+            MDC.put(Enum.ClassName.name(), getCaller(back));
+    }
+
+    public static void setObservation(ObservationInterface o) {
+        MDC.put(Enum.CustomField4.name(), o.name());
+    }
+
+    public static void clearCaller() {
+        MDC.remove(Enum.ClassName.name());
+    }
+
+    public static Map<String, String> save() {
+        Map<String, String> save = MDC.getCopyOfContextMap();
+        return save;
+    }
+
+    public static void restore(Map<String, String> mdcSave) {
+        MDC.clear();
+        for (String name : mdcSave.keySet())
+            MDC.put(name, mdcSave.get(name));
+    }
+
+
+
+    public static void setRequestIdIfNotSet(String requestId) {
+        if (MDC.get(MDC_KEY_REQUEST_ID) == null || MDC.get(MDC_KEY_REQUEST_ID).equals("")) {
+            setRequestId(requestId);
+        }
+    }
+
+    public static void setRequestId(String requestId) {
+        MDC.put(MDC_KEY_REQUEST_ID, requestId);
+    }
+
+    public static void metricStart(ClientRequestContext requestContext) {
+        MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
+        MDC.put(MDC_END_TIMESTAMP, MDC.get(MDC_BEGIN_TIMESTAMP));
+        setPartnerTargetFromUri(requestContext.getUri());
+    }
+
+    public static void metricEnd(ClientResponseContext response) {
+
+        Date now = new Date();
+        // MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(now));
+        MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(now));
+        setResponseInfo(response.getStatusInfo());
+
+    }
+
+    public static void auditStart(ContainerRequestContext requestContext, HttpServletRequest servletRequest) {
+        MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
+        MDC.put(MDC_END_TIMESTAMP, MDC.get(MDC_BEGIN_TIMESTAMP));
+        MDC.put(MDC_REMOTE_HOST, servletRequest.getRemoteHost());
+        MDC.put(Enum.ClassName.name(), getCaller(4));
+        MultivaluedMap<String, String> headers = requestContext.getHeaders();
+        String transactionId = (String) headers.getFirst(HeadersEnum.TransactionID.toString());
+        if (transactionId != null) {
+            setRequestId(transactionId);
+        } else {
+            setRequestId(UUID.randomUUID().toString());
+        }
+
+    }
+
+    public static void auditEnd(ContainerRequestContext requestContext, ContainerResponseContext response) {
+        Date now = new Date();
+        // MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(now));
+        MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(now));
+        MDC.put(Enum.ClassName.name(), getCaller(4));
+
+        setResponseInfo(response.getStatusInfo());
+
+    }
+
+    private static void setResponseInfo(StatusType statusInfo) {
+        Integer status = statusInfo.getStatusCode();
+        String completed = "ERROR";
+        if (status >= 200 && status < 300) {
+            completed = "COMPLETE";
+        }
+        MDC.put(MDC_RESPONSE_CODE, status.toString());
+        MDC.put(MDC_RESPONSE_DESC, statusInfo.getReasonPhrase());
+        MDC.put(MDC_STATUS_CODE, completed);
+    }
+
+    public static void setEvent(String requestID) {
+        MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
+        MDC.put(MDC_END_TIMESTAMP, MDC.get(MDC_BEGIN_TIMESTAMP));
+        setRequestId(requestID);
+    }
+
+    private static void setPartnerTargetFromUri(URI uri) {
+        try {
+            MDC.put(MDC_PARTNER_NAME, uri.getHost());
+            MDC.put(MDC_TARGET_ENTITY, uri.getScheme() + "://" + uri.getHost() + ":" + uri.getPort());
+            MDC.put(MDC_TARGET_SERVICE_NAME, uri.getPath());
+        } catch (Exception e) {
+            MDC.put(MDC_PARTNER_NAME, "UNKNOWN");
+            MDC.put(MDC_TARGET_ENTITY, "UNKNOWN");
+            MDC.put(MDC_TARGET_SERVICE_NAME, "UNKNOWN");
+        }
+    }
+
+
+}
index d8f80a2..c936444 100644 (file)
@@ -1,26 +1,26 @@
 /*
  * Copyright Â© 2019 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.
  * You may obtain a copy of the License at
- * 
+ *
  *         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.
@@ -30,7 +30,6 @@
 
 package org.onap.observations;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -38,15 +37,17 @@ import java.util.Set;
 
 public class MessageHeaders {
     public enum HeadersEnum {
-        UNDEFINED("UNDEFINED"), TransactionID("X-TransactionId"), FromAppID("X-FromAppId"), MinorVersion(
-                "X-MinorVersion"), PatchVersion("X-PatchVersion"), LatestVersion("X-LatestVersion"),;
+        UNDEFINED("UNDEFINED"),
+        TransactionID("X-TransactionId"),
+        FromAppID("X-FromAppId"),
+        MinorVersion("X-MinorVersion"),
+        PatchVersion("X-PatchVersion"),
+        LatestVersion("X-LatestVersion"),;
 
         private final String text;
-        private final ArrayList<String> list;
 
         private HeadersEnum(String text) {
             this.text = text;
-            this.list = new ArrayList<>();
         }
 
         @Override
index 0e1b1da..83b8f8d 100644 (file)
 */
 package org.onap.observations;
 
-import org.apache.log4j.Level;
-
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
+import org.apache.log4j.Level;
+
+
+public class Observation {
+    private static EELFLogger log = EELFManager.getInstance().getLogger(Observation.class);
+    private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
+    private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();
+    private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
+    private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
 
+    // *************************************************************************************************
+    public static void report(ObservationInterface o, Exception e, String... arguments) {
+        Mdc.setCaller(4);
+        Mdc.setObservation(o);
+        if (o.getAudit()) {
+            audit.info(o, e, arguments);
+        }
+        if (o.getMetric()) {
+            metrics.info(o, e, arguments);
+        }
+        Level l = o.getLevel();
+        switch (l.toInt()) {
+            case Level.WARN_INT:
+                errors.warn(o, arguments);
+                debug.debug(o, e, arguments);
+                break;
+            case Level.INFO_INT:
+                log.info(o, e, arguments);
+                debug.debug(o, e, arguments);
+                break;
+            case Level.ERROR_INT:
+                errors.error(o, arguments);
+                debug.debug(o, e, arguments);
+                break;
+            case Level.TRACE_INT:
+                debug.trace(o, e, arguments);
+                break;
+            case Level.DEBUG_INT:
+                debug.debug(o, e, arguments);
+                break;
+            default:
+                log.info(o, e, arguments);
+        }
+        Mdc.clearCaller();
+    }
 
-public class Observation 
-{
-       private static EELFLogger log = EELFManager.getInstance().getLogger(Observation.class);
-       private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
-       private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();
-       private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
-       private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
-       
-       //*************************************************************************************************
-       public static void report(ObservationInterface o, Exception e, String ...arguments) 
-       {
-               Mdc.setCaller(4);
-               Mdc.setObservation(o);
-               if (o.getAudit())
-               {
-                       audit.info(o, e, arguments);
-               }
-               if (o.getMetric())
-               {
-                       metrics.info(o, e, arguments);
-               }
-               Level l = o.getLevel();
-               switch (l.toInt())
-               {
-               case Level.WARN_INT:
-                       errors.warn(o, arguments);
-                       debug.debug(o, e, arguments);
-                       break;
-               case Level.INFO_INT:
-                       log.info(o, e, arguments);
-                       debug.debug(o, e, arguments);
-                       break;
-               case Level.ERROR_INT:
-                       errors.error(o, arguments);
-                       debug.debug(o, e, arguments);
-                       break;
-               case Level.TRACE_INT:
-                       debug.trace(o, e, arguments);
-                       break;
-               case Level.DEBUG_INT:
-                       debug.debug(o, e, arguments);
-                       break;
-               default:
-                       log.info(o, e, arguments);
-               }
-               Mdc.clearCaller();
-       }
-       
-       public static void report(ObservationInterface o, String ...arguments) 
-       {
-               Mdc.setCaller(4);
-               Mdc.setObservation(o);
-               if (o.getAudit())
-               {
-                       audit.info(o, arguments);
-               }
-               if (o.getMetric())
-               {
-                       metrics.info(o, arguments);
-               }
-               Level l = o.getLevel();
-               switch (l.toInt())
-               {
-               case Level.WARN_INT:
-                       errors.warn(o, arguments);
-                       debug.debug(o, arguments);
-                       break;
-               case Level.INFO_INT:
-                       log.info(o, arguments);
-                       debug.debug(o, arguments);
-                       break;
-               case Level.ERROR_INT:
-                       errors.error(o, arguments);
-                       debug.debug(o, arguments);
-                       break;
-               case Level.TRACE_INT:
-                       debug.debug(o, arguments);
-                       break;
-               case Level.DEBUG_INT:
-                       debug.debug(o, arguments);
-                       break;
-               default:
-                       log.info(o, arguments);
-               }
-               Mdc.clearCaller();
-       }
+    public static void report(ObservationInterface o, String... arguments) {
+        Mdc.setCaller(4);
+        Mdc.setObservation(o);
+        if (o.getAudit()) {
+            audit.info(o, arguments);
+        }
+        if (o.getMetric()) {
+            metrics.info(o, arguments);
+        }
+        Level l = o.getLevel();
+        switch (l.toInt()) {
+            case Level.WARN_INT:
+                errors.warn(o, arguments);
+                debug.debug(o, arguments);
+                break;
+            case Level.INFO_INT:
+                log.info(o, arguments);
+                debug.debug(o, arguments);
+                break;
+            case Level.ERROR_INT:
+                errors.error(o, arguments);
+                debug.debug(o, arguments);
+                break;
+            case Level.TRACE_INT:
+                debug.debug(o, arguments);
+                break;
+            case Level.DEBUG_INT:
+                debug.debug(o, arguments);
+                break;
+            default:
+                log.info(o, arguments);
+        }
+        Mdc.clearCaller();
+    }
 
 }
index 16305bc..7a16a3f 100644 (file)
 */
 package org.onap.observations;
 
+import com.att.eelf.i18n.EELFResolvableErrorEnum;
 import javax.ws.rs.core.Response.Status;
-
 import org.apache.log4j.Level;
 
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
+public interface ObservationInterface extends EELFResolvableErrorEnum {
+    public Enum<?> getValue();
+
+    public Level getLevel();
+
+    public String getMessage();
+
+    public Status getStatus();
+
+    public String getDomain();
+
+    public String name();
+
+    public Boolean getAudit();
 
-public interface ObservationInterface extends EELFResolvableErrorEnum
-{
-       public Enum<?> getValue();
-       public Level getLevel();
-       public String getMessage();
-       public Status getStatus();
-       public String getDomain();
-       public String name();
-       public Boolean getAudit();
-       public Boolean getMetric();
-}
\ No newline at end of file
+    public Boolean getMetric();
+}
index 639db76..f41c134 100644 (file)
 */
 package org.onap.observations;
 
+import com.att.eelf.i18n.EELFResolvableErrorEnum;
+import com.att.eelf.i18n.EELFResourceManager;
 import javax.ws.rs.core.Response.Status;
-
 import org.apache.log4j.Level;
 
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-import com.att.eelf.i18n.EELFResourceManager;
 
+public class ObservationObject implements ObservationInterface {
+
+    // *************************************************************************************************
+    // Interface class that matches the ObservationInteface pattern
+    // This will be used in case we decide to provide external overrides and we need to instantiate
+    // For now, we'll just use the Enum itself.
+    //
+    //
+    private Enum<?> value = null;
+    private Level level = null;;
+    private String message = null;
+    private Status status = null;
+    private String domain = null;
+    private Boolean metric = false;
+    private Boolean audit = false;
+
+    public ObservationObject(ObservationInterface o) {
+        this.value   = o.getValue();
+        this.level   = o.getLevel();
+        this.message = o.getMessage();
+        this.status  = o.getStatus();
+        this.domain  = o.getDomain();
+        this.metric  = o.getMetric();
+        this.audit   = o.getAudit();
+
+    }
+
+    public Enum<?> getValue() {
+        return value;
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+    @Override
+    public Status getStatus() {
+        return status;
+    }
+
+    @Override
+    public String getDomain() {
+        return domain;
+    }
+
+    @Override
+    public Level getLevel() {
+        return level;
+    }
+
+    @Override
+    public String name() {
+        return value.name();
+    }
+
+    @Override
+    public Boolean getAudit() {
+        return audit;
+    }
+
+    @Override
+    public Boolean getMetric() {
+        return metric;
+    }
+
+    public String getMessage(String... arguments) {
+        return EELFResourceManager.format((EELFResolvableErrorEnum) value, arguments);
+    }
+
+    public void setValue(Enum<?> value) {
+        this.value = value;
+    }
+
+    public void setLevel(Level level) {
+        this.level = level;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
 
-public class ObservationObject implements ObservationInterface
-{
-       
-       //*************************************************************************************************
-       // Interface class that matches the ObservationInteface  pattern
-       // This will be used in case we decide to provide external overrides and we need to instantiate
-       // For now, we'll just use the Enum itself.
-       //
-       // 
-       private Enum<?> value = null;
-       private Level level = null;;
-       private String message = null;
-       private Status status = null;
-       private String domain = null;
-       private Boolean metric = false;
-       private Boolean audit = false;
-       public ObservationObject(ObservationInterface o)
-       {
-               this.value = o.getValue();
-               this.level = o.getLevel();
-               this.message = o.getMessage();
-               this.status = o.getStatus();
-               this.domain = o.getDomain();
-               this.metric = o.getMetric();
-               this.audit = o.getAudit();
-               
-       }
-       public Enum<?> getValue() {return value;}
-       @Override
-       public String getMessage() {return message;}
-       @Override
-       public Status getStatus() {return status;}
-       @Override
-       public String getDomain() {return domain;}
-
-       @Override
-       public Level getLevel() {
-               return level;
-       }
-       @Override
-       public String name() {
-               return value.name();
-       }
-       @Override
-       public Boolean getAudit() {
-               return audit;
-       }
-       @Override
-       public Boolean getMetric() {
-               return metric;
-       }
-
-       public String getMessage(String ...arguments) {
-               return EELFResourceManager.format((EELFResolvableErrorEnum)value,  arguments);
-       }
-       public void setValue(Enum<?> value) {
-               this.value = value;
-       }
-       public void setLevel(Level level) {
-               this.level = level;
-       }
-       public void setMessage(String message) {
-               this.message = message;
-       }
-       public void setStatus(Status status) {
-               this.status = status;
-       }
+    public void setStatus(Status status) {
+        this.status = status;
+    }
 
 
 }
index b238561..eb9ddad 100644 (file)
@@ -41,8 +41,10 @@ import org.springframework.core.env.MapPropertySource;
 import org.springframework.core.env.MutablePropertySources;
 
 public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor {
-    // TODO tested in ONAP springboot and this is called before all of the properties files have been loaded...
-       //      perhaps there is a post post processor? Until this works. DB password will be in the clear in the proeprties files.
+    // TODO tested in ONAP springboot and this is called before all of the properties files have been
+    // loaded...
+    // perhaps there is a post post processor? Until this works. DB password will be in the clear in the
+    // proeprties files.
     @Override
     public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
         String pwd = environment.getProperty("cmso.database.password");
index b6a59e3..115177c 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright Â© 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright Â© 2018 IBM.
+ * Copyright ï¿½ 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright ï¿½ 2018 IBM.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,6 +31,8 @@
 
 package org.onap.optf.cmso.common;
 
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import javax.servlet.http.HttpServletRequest;
@@ -38,8 +40,6 @@ import javax.ws.rs.client.ClientRequestContext;
 import javax.ws.rs.client.ClientRequestFilter;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.xml.bind.DatatypeConverter;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
 
 public class BasicAuthenticatorFilter implements ClientRequestFilter {
     private static EELFLogger log = EELFManager.getInstance().getLogger(BasicAuthenticatorFilter.class);
@@ -47,7 +47,7 @@ public class BasicAuthenticatorFilter implements ClientRequestFilter {
     private final String password;
 
     public BasicAuthenticatorFilter(String user, String password) {
-        this.user = user;
+        this.user     = user;
         this.password = password;
         log.info("user: " + user + " pass:" + password);
     }
@@ -67,7 +67,7 @@ public class BasicAuthenticatorFilter implements ClientRequestFilter {
             throw new IllegalStateException("Cannot encode with UTF-8", ex);
         }
     }
-    
+
     public static String getUser(HttpServletRequest request) {
         String user = "";
         String header = request.getHeader("Authorization");
index 1be9603..d3688f6 100644 (file)
@@ -1,27 +1,27 @@
 /*
- * Copyright Â© 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright Â© 2018 IBM.
- * 
+ * Copyright ï¿½ 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright ï¿½ 2018 IBM.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *         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.
 
 package org.onap.optf.cmso.common;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.annotation.JsonProperty;
 
 public class CMSRequestError implements Serializable {
     private static final long serialVersionUID = 1L;
-    private static EELFLogger log = EELFManager.getInstance().getLogger(CMSRequestError.class);
     @JsonProperty
     RequestError requestError;
 
@@ -62,10 +59,11 @@ public class CMSRequestError implements Serializable {
 
         private RequestError(String messageId, String text, List<String> variables) {
             this.messageId = "Scheduler." + messageId;
-            this.text = text;
+            this.text      = text;
             this.variables = variables;
         }
 
+        @Override
         public String toString() {
             StringBuffer sb = new StringBuffer();
             sb.append(messageId).append(":").append(text).append(":").append(variables);
@@ -74,6 +72,7 @@ public class CMSRequestError implements Serializable {
         }
     }
 
+    @Override
     public String toString() {
         return requestError.toString();
     }
index 8c1f2c6..77fdb11 100644 (file)
 
 package org.onap.optf.cmso.common;
 
-import java.io.UnsupportedEncodingException;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 import javax.crypto.Cipher;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.DatatypeConverter;
 import org.apache.commons.codec.binary.Base64;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
 
 @Component
 public class PropertiesManagement {
index 68418d6..0ab80a0 100644 (file)
 
 package org.onap.optf.cmso.common.exceptions;
 
+import com.att.eelf.i18n.EELFResourceManager;
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.ws.rs.core.Response.Status;
-
 import org.onap.observations.ObservationInterface;
 import org.onap.optf.cmso.common.CMSRequestError;
 
-import com.att.eelf.i18n.EELFResourceManager;
-
 public class CMSException extends Exception {
     private static final long serialVersionUID = 1L;
 
@@ -51,7 +48,7 @@ public class CMSException extends Exception {
 
     public CMSException(Status status, ObservationInterface messageCode, String... args) {
         super(EELFResourceManager.format(messageCode, args));
-        this.status = status;
+        this.status      = status;
         this.messageCode = messageCode;
         for (String arg : args)
             variables.add(arg);
index eca406d..7392e2b 100644 (file)
 
 package org.onap.optf.ticketmgt;
 
+import com.att.eelf.configuration.Configuration;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 import java.net.InetAddress;
 import java.util.TimeZone;
-
 import javax.annotation.PostConstruct;
-
 import org.onap.optf.ticketmgt.common.LogMessages;
 import org.slf4j.MDC;
 import org.springframework.boot.SpringApplication;
@@ -51,15 +52,11 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.scheduling.annotation.EnableAsync;
 
-import com.att.eelf.configuration.Configuration;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
 @SpringBootApplication
 @ComponentScan(basePackages = {"org.onap.optf.ticketmgt"})
 @EnableAsync
 
-@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
+@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
 public class Application extends SpringBootServletInitializer {
 
     private static EELFLogger log = EELFManager.getInstance().getLogger(Application.class);
@@ -99,6 +96,6 @@ public class Application extends SpringBootServletInitializer {
         return tomcat;
     }
 
-    
+
 
 }
index 8cd70a6..0fd1c45 100644 (file)
@@ -36,9 +36,6 @@ import org.springframework.context.annotation.PropertySources;
 
 
 @Configuration
-@PropertySources({
-       @PropertySource("file:etc/config/ticketmgt.properties"),
-})
-public class ApplicationPropertiesFiles 
-{
-}
\ No newline at end of file
+@PropertySources({@PropertySource("file:etc/config/ticketmgt.properties"),})
+public class ApplicationPropertiesFiles {
+}
index 43ded66..6749b72 100644 (file)
@@ -31,7 +31,6 @@
 package org.onap.optf.ticketmgt;
 
 import java.util.ArrayList;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Profile;
 import org.springframework.core.env.Environment;
@@ -43,24 +42,21 @@ import org.springframework.stereotype.Component;
 @Component
 @Profile(SpringProfiles.PROPRIETARY__AUTHENTICATION)
 
-public class AuthProvider
-  implements AuthenticationProvider {
-       @Autowired
-       Environment env;
-       
+public class AuthProvider implements AuthenticationProvider {
+
+    @Autowired
+    Environment env;
+
     @Override
     public Authentication authenticate(Authentication authentication) {
         String name = authentication.getName();
         String password = authentication.getCredentials().toString();
-        //TODO check credentials until we enable AAF 
-        return new UsernamePasswordAuthenticationToken(
-          name, password, new ArrayList<>());
+        // TODO check credentials until we enable AAF
+        return new UsernamePasswordAuthenticationToken(name, password, new ArrayList<>());
     }
+
     @Override
     public boolean supports(Class<?> authentication) {
-        return authentication.equals(
-          UsernamePasswordAuthenticationToken.class);
+        return authentication.equals(UsernamePasswordAuthenticationToken.class);
     }
 }
index f5c6345..d955e75 100644 (file)
@@ -33,7 +33,6 @@ package org.onap.optf.ticketmgt;
 
 import java.util.HashMap;
 import java.util.Map;
-
 import org.onap.optf.cmso.common.PropertiesManagement;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.env.EnvironmentPostProcessor;
@@ -42,8 +41,10 @@ import org.springframework.core.env.MapPropertySource;
 import org.springframework.core.env.MutablePropertySources;
 
 public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor {
-    // TODO tested in ONAP springboot and this is called before all of the properties files have been loaded...
-       //      perhaps there is a post post processor? Until this works. DB password will be in the clear in the proeprties files.
+    // TODO tested in ONAP springboot and this is called before all of the properties files have been
+    // loaded...
+    // perhaps there is a post post processor? Until this works. DB password will be in the clear in the
+    // proeprties files.
     @Override
     public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
         String pwd = environment.getProperty("cmso.database.password");
index 3bc0153..46c99ee 100644 (file)
 
 package org.onap.optf.ticketmgt;
 
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
 import java.util.logging.Logger;
-
 import javax.ws.rs.ApplicationPath;
 import javax.ws.rs.client.Client;
 import javax.ws.rs.client.ClientBuilder;
-
 import org.glassfish.jersey.client.ClientConfig;
 import org.glassfish.jersey.logging.LoggingFeature;
 import org.glassfish.jersey.server.ResourceConfig;
@@ -51,12 +54,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Component;
 
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
 @Component
 @ApplicationPath("/")
 public class JerseyConfiguration extends ResourceConfig {
index 27f9019..8abccf0 100644 (file)
@@ -44,20 +44,20 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
 @ComponentScan("org.onap.optf")
 @Profile(SpringProfiles.PROPRIETARY__AUTHENTICATION)
 public class SecurityConfig extends WebSecurityConfigurerAdapter {
-  
+
     @Autowired
     private AuthProvider authProvider;
+
     @Override
     protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-  
+
         auth.authenticationProvider(authProvider);
     }
+
     @Override
     protected void configure(HttpSecurity http) throws Exception {
-       
+
         http.csrf().disable().authorizeRequests().anyRequest().authenticated().and().httpBasic();
-        
+
     }
-}
\ No newline at end of file
+}
index 2cb2c99..b73959d 100644 (file)
  */
 package org.onap.optf.ticketmgt;
 
-public class SpringProfiles 
-{
+public class SpringProfiles {
 
-    public static final String AAF_AUTHENTICATION  = "aaf-auth";
-    public static final String PROPRIETARY__AUTHENTICATION  = "proprietary-auth";
+    public static final String AAF_AUTHENTICATION = "aaf-auth";
+    public static final String PROPRIETARY__AUTHENTICATION = "proprietary-auth";
 
-    private SpringProfiles(){}
+    private SpringProfiles() {}
 }
index 53a8d52..9f1f2d1 100644 (file)
 package org.onap.optf.ticketmgt.aaf;
 
 import java.io.IOException;
-
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import org.onap.observations.Observation;
 import org.onap.optf.cmso.common.exceptions.CMSException;
 import org.onap.optf.ticketmgt.SpringProfiles;
@@ -43,7 +41,7 @@ import org.springframework.stereotype.Component;
 @Component
 @Profile(SpringProfiles.AAF_AUTHENTICATION)
 @PropertySource("file:${server.local.startpath}/aaf/permissions.properties")
-public class AafAuthorizationFilter extends  OrderedRequestContextFilter {
+public class AafAuthorizationFilter extends OrderedRequestContextFilter {
 
     @Value("${permission.type}")
     String type;
@@ -54,22 +52,22 @@ public class AafAuthorizationFilter extends  OrderedRequestContextFilter {
     public AafAuthorizationFilter() {
         this.setOrder(FilterPriority.AAF_AUTHORIZATION.getPriority());
 
-       
+
     }
 
     @Override
-    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+                    throws IOException, ServletException {
         String permission = String.format("%s|%s|%s", type, instance, request.getMethod().toLowerCase());
-        if(request.getRequestURI().matches("^.*/util/echo$")){
+        if (request.getRequestURI().matches("^.*/util/echo$")) {
             filterChain.doFilter(request, response);
         }
-        if(!request.isUserInRole(permission)){
-               Observation.report(LogMessages.UNAUTHORIZED);
-            ResponseFormatter.errorResponse(request, response, 
-                       new CMSException(LogMessages.UNAUTHORIZED.getStatus(), 
-                       LogMessages.UNAUTHORIZED, ""));
-        }else{
-            filterChain.doFilter(request,response);
+        if (!request.isUserInRole(permission)) {
+            Observation.report(LogMessages.UNAUTHORIZED);
+            ResponseFormatter.errorResponse(request, response,
+                            new CMSException(LogMessages.UNAUTHORIZED.getStatus(), LogMessages.UNAUTHORIZED, ""));
+        } else {
+            filterChain.doFilter(request, response);
         }
     }
 }
index 89d6e3b..4d6c44f 100644 (file)
@@ -22,12 +22,10 @@ package org.onap.optf.ticketmgt.aaf;
 
 import java.io.IOException;
 import java.util.Properties;
-
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import org.onap.aaf.cadi.PropAccess;
 import org.onap.aaf.cadi.filter.CadiFilter;
 import org.onap.observations.Observation;
@@ -57,14 +55,14 @@ public class AafFilter extends OrderedRequestContextFilter {
     }
 
     @Override
-    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
-        if(!request.getRequestURI().matches("^.*/util/echo$")){
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+                    throws IOException, ServletException {
+        if (!request.getRequestURI().matches("^.*/util/echo$")) {
             cadiFilter.doFilter(request, response, filterChain);
-            if(response.getStatus() >=400 && response.getStatus() < 500){
-               Observation.report(LogMessages.UNAUTHENTICATED);
-                ResponseFormatter.errorResponse(request, response, 
-                               new CMSException(LogMessages.UNAUTHENTICATED.getStatus(), 
-                               LogMessages.UNAUTHENTICATED, ""));
+            if (response.getStatus() >= 400 && response.getStatus() < 500) {
+                Observation.report(LogMessages.UNAUTHENTICATED);
+                ResponseFormatter.errorResponse(request, response, new CMSException(
+                                LogMessages.UNAUTHENTICATED.getStatus(), LogMessages.UNAUTHENTICATED, ""));
             }
         } else {
             filterChain.doFilter(request, response);
index 0a74a97..4b9bd9d 100644 (file)
@@ -22,8 +22,9 @@ package org.onap.optf.ticketmgt.aaf;
 import org.springframework.core.Ordered;
 
 public enum FilterPriority {
-    AAF_AUTHENTICATION(Ordered.HIGHEST_PRECEDENCE),
-    AAF_AUTHORIZATION(Ordered.HIGHEST_PRECEDENCE + 1); //higher number = lower priority
+    AAF_AUTHENTICATION(Ordered.HIGHEST_PRECEDENCE), AAF_AUTHORIZATION(Ordered.HIGHEST_PRECEDENCE + 1); // higher number
+                                                                                                       // = lower
+                                                                                                       // priority
 
     private final int priority;
 
@@ -31,5 +32,7 @@ public enum FilterPriority {
         priority = p;
     }
 
-    public int getPriority() { return priority; }
+    public int getPriority() {
+        return priority;
+    }
 }
index 626776c..16dd74e 100644 (file)
 package org.onap.optf.ticketmgt.aaf;
 
 import java.io.IOException;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.MediaType;
-
 import org.onap.optf.cmso.common.exceptions.CMSException;
 
 class ResponseFormatter {
 
-    private static final String ACCEPT_HEADER = "accept";
 
-    static void errorResponse(HttpServletRequest request, HttpServletResponse response, CMSException error) throws IOException {
-        String accept = request.getHeader(ACCEPT_HEADER) == null ? MediaType.APPLICATION_JSON : request.getHeader(ACCEPT_HEADER);
+    static void errorResponse(HttpServletRequest request, HttpServletResponse response, CMSException error)
+                    throws IOException {
         response.setStatus(error.getStatus().getStatusCode());
         response.getWriter().write(error.getRequestError().toString());
         response.getWriter().flush();
index caf7e8b..be7b4c9 100644 (file)
 
 package org.onap.optf.ticketmgt.common;
 
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResourceManager;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-
 import javax.ws.rs.core.Response.Status;
-
 import org.apache.log4j.Level;
 import org.onap.observations.ObservationInterface;
 
-import com.att.eelf.configuration.EELFManager;
-import com.att.eelf.i18n.EELFResourceManager;
-
 public enum LogMessages implements ObservationInterface {
 
-       FETCH_TICKET("Fetch ticket {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
-       CREATE_TICKET("Create Ticket {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
-       CANCEL_TICKET("Cancel ticket {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
-       UPDATE_TICKET("Update ticket {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
-       GET_ACTIVE_TICKETS("Get active tickets {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
-       SEARCH_TICKETS("Search tickets {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
-       DELETE_ACTIVE_TICKETS("Delete active tickets {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
-       POLL_ACTIVE_TICKETS("Polling active tickets {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
-       
-       TICKET_NOT_FOUND("Ticket not found id={0}", Status.NOT_FOUND, Level.INFO),
-       INVALID_ATTRIBUTE("Invalid attribute {0}={1}", Status.BAD_REQUEST, Level.INFO),
-       MISSING_REQUIRED_ATTRIBUTE("Missing required attribute '{0}'", Status.BAD_REQUEST, Level.INFO),
-       INVALID_REQUEST("The input data structure is incorrect", Status.BAD_REQUEST, Level.INFO),
-       REQUEST_TIMED_OUT("Request timed out.", Status.INTERNAL_SERVER_ERROR, Level.ERROR),
-       UNEXPECTED_EXCEPTION("Unexpected exception encountered during processing. Please contact support : {0}", Status.INTERNAL_SERVER_ERROR, Level.ERROR),
-
-       UNDEFINED_FILTER_ATTRIBUTE("Undefined filter attribute {0}", Status.BAD_REQUEST, Level.INFO),
-       INVALID_DATE_FILTER("Invalid date filter provided {0}=(1}", Status.BAD_REQUEST, Level.INFO),
-       
-       INCOMING_MESSAGE("Incoming message method={0} path={1}", Status.OK, Level.INFO, true, false),
-       INCOMING_MESSAGE_RESPONSE("Message response method={0} path={1} status={2}", Status.OK, Level.INFO, true, false),
-       OUTGOING_MESSAGE("Outgoing message method={0} path={1}", Status.OK, Level.INFO, true, false),
-       OUTGOING_MESSAGE_RETURNED("Outgoing message returned method={0} path={1} status={2}", Status.OK, Level.INFO, true, false),
-
-       UNEXPECTED_RESPONSE("Unexpected response from {0} HTTP Status={1} : {2}", Status.OK, Level.INFO),
-       INVALID_CHANGE_WINDOW("Change window end time {1} must be after start time {0}", Status.OK, Level.INFO),
-       EXPECTED_EXCEPTION("Expected exception encountered during processing. {0}", Status.OK, Level.INFO),
-       UNABLE_TO_UPDATE_TICKET("Unable to update change ticket in TM: Schedule ID: {0} : changeid: {1} :  Reason: {2}", Status.OK, Level.INFO),
-       UNAUTHORIZED("Authorization failed.", Status.FORBIDDEN, Level.INFO),
-       UNAUTHENTICATED("Authentication failed.", Status.UNAUTHORIZED, Level.INFO),  
-       
-       ;
-       private final String defaultId;
-       private final String defaultMessage;
-       private final String defaultResolution;
-       private final String defaultAction;
-
-       private final Status status;
-       private final Level level;
-       private final Boolean audit;
-       private final Boolean metric;
-
-       
-       private LogMessages(String message, Status code, Level l)
-       {
-               defaultMessage = message;
-               level=l;
-               status = code;
-               this.defaultId = this.name();
-               this.defaultResolution = "No resolution needed";
-               this.defaultAction = "No action is required";
-               this.audit = false;
-               this.metric = false;
-       }
-
-       private LogMessages(String message, Status code, Level l, Boolean audit, Boolean metric)
-       {
-               defaultMessage = message;
-               level=l;
-               status = code;
-               this.audit = audit;
-               this.metric = metric;
-               this.defaultId = this.name();
-               this.defaultResolution = "No resolution needed";
-               this.defaultAction = "No action is required";
-       }
-       
-       private LogMessages(String message, Status code, Level l, String id, String resolution, String action)
-       {
-               level=l;
-               status = code;
-               defaultMessage = message;
-               this.defaultId = id;
-               this.defaultResolution = resolution;
-               this.defaultAction = action;
-               this.audit = false;
-               this.metric = false;
-       }
-       
-       static {
-               EELFResourceManager.loadMessageBundle("logmessages");
-       }
-       
-       public String genProperties()
-       {
-               // Use this to regenerate properties file. The desire to change messages without updating code is
-               // well understood, but the developer should be able to code the defaults without having to update 2 different files and 
-               // get it wrong. 
-               StringBuilder sb = new StringBuilder();
-               sb.append("# Generated from ").append(this.getClass().getName()).append("\n");
-               for (LogMessages lm : values())
-               {
-                       sb.append(lm.name());
-                       sb.append(" ").append(lm.defaultId);
-                       sb.append("|").append(lm.defaultMessage);
-                       sb.append("|").append(lm.defaultResolution);
-                       sb.append("|").append(lm.defaultAction);
-                       sb.append("\n");
-               }
-               return sb.toString();
-       }
-
-       
-       // interface methods
-       @Override
-       public Level getLevel() {return level;}
-       @Override
-       public String getMessage() {return defaultMessage;}
-       @Override
-       public Status getStatus() {return status;}
-       @Override
-       public Enum<?> getValue() {return this;}
-       @Override
-       public String getDomain() {return this.getClass().getSimpleName();}
-       @Override
-       public Boolean getAudit() { return audit; }
-       @Override
-       public Boolean getMetric() { return metric; }
-       
-       public static void main(String argv[])
-       {
-               System.out.println(LogMessages.UNEXPECTED_EXCEPTION.genProperties());
-               try 
-               {
-                       Files.write(Paths.get("src/main/resources/logmessages.properties"), LogMessages.UNEXPECTED_EXCEPTION.genProperties().getBytes());
-               } 
-               catch (IOException e) 
-               {
-                       EELFManager.getInstance().getDebugLogger().debug("Failed to update properties file.", e);
-
-               }
-               StringBuilder sb = new StringBuilder();
-               sb.append("<html><body><h1>Cell Site Selection Scheduler mS Observations</h1>\n<table border=\"1\">\n<tr>");
-               sb.append("<td>Code</td> ");
-               sb.append("<td>Log Level</td> ");
-               sb.append("<td>Message</td> ");
-               sb.append("</tr>\n");
-               for (LogMessages m : LogMessages.values())
-               {
-                       if (m.level == Level.ERROR || m.level == Level.WARN || m.level == Level.FATAL)
-                       {
-                               sb.append("<tr>");
-                               sb.append("<td>").append(m.name()).append("</td> ");
-                               sb.append("<td>").append(m.level).append("</td> ");
-                               sb.append("<td>").append(m.defaultMessage).append("</td> ");
-                               sb.append("</tr>\n");
-                       }
-               }
-               try 
-               {
-                       Files.write(Paths.get("logmessages.html"), sb.toString().getBytes());
-               } 
-               catch (IOException e) 
-               {
-                       EELFManager.getInstance().getDebugLogger().debug("Failed to update properties html file.", e);
-
-               }
-                               
-       }
+    FETCH_TICKET("Fetch ticket {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
+    CREATE_TICKET("Create Ticket {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
+    CANCEL_TICKET("Cancel ticket {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
+    UPDATE_TICKET("Update ticket {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
+    GET_ACTIVE_TICKETS("Get active tickets {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
+    SEARCH_TICKETS("Search tickets {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
+    DELETE_ACTIVE_TICKETS("Delete active tickets {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
+    POLL_ACTIVE_TICKETS("Polling active tickets {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
+
+    TICKET_NOT_FOUND("Ticket not found id={0}", Status.NOT_FOUND, Level.INFO),
+    INVALID_ATTRIBUTE("Invalid attribute {0}={1}", Status.BAD_REQUEST, Level.INFO),
+    MISSING_REQUIRED_ATTRIBUTE("Missing required attribute '{0}'", Status.BAD_REQUEST, Level.INFO),
+    INVALID_REQUEST("The input data structure is incorrect", Status.BAD_REQUEST, Level.INFO),
+    REQUEST_TIMED_OUT("Request timed out.", Status.INTERNAL_SERVER_ERROR, Level.ERROR),
+    UNEXPECTED_EXCEPTION("Unexpected exception encountered during processing. Please contact support : {0}",
+                    Status.INTERNAL_SERVER_ERROR, Level.ERROR),
+
+    UNDEFINED_FILTER_ATTRIBUTE("Undefined filter attribute {0}", Status.BAD_REQUEST, Level.INFO),
+    INVALID_DATE_FILTER("Invalid date filter provided {0}=(1}", Status.BAD_REQUEST, Level.INFO),
+
+    INCOMING_MESSAGE("Incoming message method={0} path={1}", Status.OK, Level.INFO, true, false),
+    INCOMING_MESSAGE_RESPONSE("Message response method={0} path={1} status={2}", Status.OK, Level.INFO, true, false),
+    OUTGOING_MESSAGE("Outgoing message method={0} path={1}", Status.OK, Level.INFO, true, false),
+    OUTGOING_MESSAGE_RETURNED("Outgoing message returned method={0} path={1} status={2}", Status.OK, Level.INFO, true,
+                    false),
+
+    UNEXPECTED_RESPONSE("Unexpected response from {0} HTTP Status={1} : {2}", Status.OK, Level.INFO),
+    INVALID_CHANGE_WINDOW("Change window end time {1} must be after start time {0}", Status.OK, Level.INFO),
+    EXPECTED_EXCEPTION("Expected exception encountered during processing. {0}", Status.OK, Level.INFO),
+    UNABLE_TO_UPDATE_TICKET("Unable to update change ticket in TM: Schedule ID: {0} : changeid: {1} :  Reason: {2}",
+                    Status.OK, Level.INFO),
+    UNAUTHORIZED("Authorization failed.", Status.FORBIDDEN, Level.INFO),
+    UNAUTHENTICATED("Authentication failed.", Status.UNAUTHORIZED, Level.INFO),
+
+    ;
+    private final String defaultId;
+    private final String defaultMessage;
+    private final String defaultResolution;
+    private final String defaultAction;
+
+    private final Status status;
+    private final Level level;
+    private final Boolean audit;
+    private final Boolean metric;
+
+
+    private LogMessages(String message, Status code, Level l) {
+        defaultMessage         = message;
+        level                  = l;
+        status                 = code;
+        this.defaultId         = this.name();
+        this.defaultResolution = "No resolution needed";
+        this.defaultAction     = "No action is required";
+        this.audit             = false;
+        this.metric            = false;
+    }
+
+    private LogMessages(String message, Status code, Level l, Boolean audit, Boolean metric) {
+        defaultMessage         = message;
+        level                  = l;
+        status                 = code;
+        this.audit             = audit;
+        this.metric            = metric;
+        this.defaultId         = this.name();
+        this.defaultResolution = "No resolution needed";
+        this.defaultAction     = "No action is required";
+    }
+
+    private LogMessages(String message, Status code, Level l, String id, String resolution, String action) {
+        level                  = l;
+        status                 = code;
+        defaultMessage         = message;
+        this.defaultId         = id;
+        this.defaultResolution = resolution;
+        this.defaultAction     = action;
+        this.audit             = false;
+        this.metric            = false;
+    }
+
+    static {
+        EELFResourceManager.loadMessageBundle("logmessages");
+    }
+
+    public String genProperties() {
+        // Use this to regenerate properties file. The desire to change messages without updating code is
+        // well understood, but the developer should be able to code the defaults without having to update 2
+        // different files and
+        // get it wrong.
+        StringBuilder sb = new StringBuilder();
+        sb.append("# Generated from ").append(this.getClass().getName()).append("\n");
+        for (LogMessages lm : values()) {
+            sb.append(lm.name());
+            sb.append(" ").append(lm.defaultId);
+            sb.append("|").append(lm.defaultMessage);
+            sb.append("|").append(lm.defaultResolution);
+            sb.append("|").append(lm.defaultAction);
+            sb.append("\n");
+        }
+        return sb.toString();
+    }
+
+
+    // interface methods
+    @Override
+    public Level getLevel() {
+        return level;
+    }
+
+    @Override
+    public String getMessage() {
+        return defaultMessage;
+    }
+
+    @Override
+    public Status getStatus() {
+        return status;
+    }
+
+    @Override
+    public Enum<?> getValue() {
+        return this;
+    }
+
+    @Override
+    public String getDomain() {
+        return this.getClass().getSimpleName();
+    }
+
+    @Override
+    public Boolean getAudit() {
+        return audit;
+    }
+
+    @Override
+    public Boolean getMetric() {
+        return metric;
+    }
+
+    public static void main(String argv[]) {
+        System.out.println(LogMessages.UNEXPECTED_EXCEPTION.genProperties());
+        try {
+            Files.write(Paths.get("src/main/resources/logmessages.properties"),
+                            LogMessages.UNEXPECTED_EXCEPTION.genProperties().getBytes());
+        } catch (IOException e) {
+            EELFManager.getInstance().getDebugLogger().debug("Failed to update properties file.", e);
+
+        }
+        StringBuilder sb = new StringBuilder();
+        sb.append("<html><body><h1>Cell Site Selection Scheduler mS Observations</h1>\n<table border=\"1\">\n<tr>");
+        sb.append("<td>Code</td> ");
+        sb.append("<td>Log Level</td> ");
+        sb.append("<td>Message</td> ");
+        sb.append("</tr>\n");
+        for (LogMessages m : LogMessages.values()) {
+            if (m.level == Level.ERROR || m.level == Level.WARN || m.level == Level.FATAL) {
+                sb.append("<tr>");
+                sb.append("<td>").append(m.name()).append("</td> ");
+                sb.append("<td>").append(m.level).append("</td> ");
+                sb.append("<td>").append(m.defaultMessage).append("</td> ");
+                sb.append("</tr>\n");
+            }
+        }
+        try {
+            Files.write(Paths.get("logmessages.html"), sb.toString().getBytes());
+        } catch (IOException e) {
+            EELFManager.getInstance().getDebugLogger().debug("Failed to update properties html file.", e);
+
+        }
+
+    }
 
 }
index c42b253..c013453 100644 (file)
@@ -1,27 +1,27 @@
 /*
  * Copyright Â© 2017-2019 AT&T Intellectual Property.
  * Modifications Copyright Â© 2018 IBM.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *         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.
 package org.onap.optf.ticketmgt.filters;
 
 import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
-
 import java.io.IOException;
-
 import javax.ws.rs.client.ClientRequestContext;
 import javax.ws.rs.client.ClientRequestFilter;
 import javax.ws.rs.client.ClientResponseContext;
 import javax.ws.rs.client.ClientResponseFilter;
 import javax.ws.rs.core.MultivaluedMap;
-
 import org.onap.observations.Mdc;
 import org.onap.observations.MessageHeaders;
 import org.onap.observations.MessageHeaders.HeadersEnum;
 import org.onap.observations.Observation;
 import org.onap.optf.ticketmgt.common.LogMessages;
-import org.onap.optf.ticketmgt.service.rs.TicketManagementImpl;
 import org.slf4j.MDC;
 import org.springframework.stereotype.Component;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
 // @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
 @Component
 public class CMSOClientFilters implements ClientRequestFilter, ClientResponseFilter {
 
-    private static EELFLogger log = EELFManager.getInstance().getLogger(TicketManagementImpl.class);
     private static String appId = "cmso";
 
     @Override
     public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
-               // On the way back
-               Mdc.metricEnd(responseContext);
-               Mdc.setCaller(17);
-               Observation.report(LogMessages.OUTGOING_MESSAGE_RETURNED, 
-                               requestContext.getMethod(),
-                               requestContext.getUri().getPath().toString(),
-                               responseContext.getStatusInfo().toString());
+        // On the way back
+        Mdc.metricEnd(responseContext);
+        Mdc.setCaller(17);
+        Observation.report(LogMessages.OUTGOING_MESSAGE_RETURNED, requestContext.getMethod(),
+                        requestContext.getUri().getPath().toString(), responseContext.getStatusInfo().toString());
     }
 
     @Override
     public void filter(ClientRequestContext requestContext) throws IOException {
-               // On the way out 
-               Mdc.metricStart(requestContext);
-               Mdc.setCaller(17);
-               Observation.report(LogMessages.OUTGOING_MESSAGE, 
-                               requestContext.getMethod(),
-                               requestContext.getUri().getPath().toString());
+        // On the way out
+        Mdc.metricStart(requestContext);
+        Mdc.setCaller(17);
+        Observation.report(LogMessages.OUTGOING_MESSAGE, requestContext.getMethod(),
+                        requestContext.getUri().getPath().toString());
         MultivaluedMap<String, Object> headers = requestContext.getHeaders();
 
         String transactionId = (String) headers.getFirst(MessageHeaders.HeadersEnum.TransactionID.toString());
index a8f08b3..162a6ba 100644 (file)
@@ -33,7 +33,6 @@ package org.onap.optf.ticketmgt.filters;
 
 import java.io.IOException;
 import java.util.UUID;
-
 import javax.annotation.Priority;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.WebApplicationException;
@@ -46,7 +45,6 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 import javax.ws.rs.ext.Provider;
-
 import org.onap.observations.Mdc;
 import org.onap.observations.MessageHeaders;
 import org.onap.observations.MessageHeaders.HeadersEnum;
@@ -60,18 +58,17 @@ import org.springframework.stereotype.Component;
 public class CMSOContainerFilters implements ContainerRequestFilter, ContainerResponseFilter {
 
 
-       @Context
-       private HttpServletRequest servletRequest;
+    @Context
+    private HttpServletRequest servletRequest;
 
     @Override
     public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
-            throws IOException {
+                    throws IOException {
         try {
-                       Mdc.auditEnd(requestContext, responseContext);
-                       Observation.report(LogMessages.INCOMING_MESSAGE_RESPONSE, 
-                                       requestContext.getMethod(),
-                                       requestContext.getUriInfo().getPath().toString(),
-                                       responseContext.getStatusInfo().toString());
+            Mdc.auditEnd(requestContext, responseContext);
+            Observation.report(LogMessages.INCOMING_MESSAGE_RESPONSE, requestContext.getMethod(),
+                            requestContext.getUriInfo().getPath().toString(),
+                            responseContext.getStatusInfo().toString());
             MultivaluedMap<String, String> reqHeaders = requestContext.getHeaders();
             MultivaluedMap<String, Object> respHeaders = responseContext.getHeaders();
             String minorVersion = (String) reqHeaders.getFirst(HeadersEnum.MinorVersion.toString());
@@ -81,9 +78,9 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe
 
         } catch (Exception e) {
             if (e instanceof WebApplicationException) {
-               Observation.report(LogMessages.EXPECTED_EXCEPTION, e.getMessage());
+                Observation.report(LogMessages.EXPECTED_EXCEPTION, e.getMessage());
             } else {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
+                Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
             }
         }
     }
@@ -92,10 +89,9 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe
     public void filter(ContainerRequestContext requestContext) throws IOException {
         try {
             // On the way in
-                       Mdc.auditStart(requestContext, servletRequest);
-                       Observation.report(LogMessages.INCOMING_MESSAGE, 
-                                       requestContext.getMethod(),
-                                       requestContext.getUriInfo().getPath().toString());
+            Mdc.auditStart(requestContext, servletRequest);
+            Observation.report(LogMessages.INCOMING_MESSAGE, requestContext.getMethod(),
+                            requestContext.getUriInfo().getPath().toString());
 
             String majorVersion = requestContext.getUriInfo().getPath();
             if (majorVersion != null) {
@@ -133,7 +129,7 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe
                 Observation.report(LogMessages.EXPECTED_EXCEPTION, e.getMessage());
                 throw e;
             } else {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
+                Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
             }
         }
 
index d7e0c94..1ab6db0 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -38,17 +43,10 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
 
 @Api("Administration")
 @Path("/{apiVersion}")
@@ -61,11 +59,10 @@ public interface AdminTool {
     @Produces({MediaType.TEXT_PLAIN})
     @RequestMapping(value = "/{apiVersion}/admin/{id}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN)
     @ApiOperation(value = "", notes = "Returns encrypted value of id.", response = String.class)
-    @ApiResponses(
-            value = {@ApiResponse(code = 200, message = "OK"), 
-                        @ApiResponse(code = 400, message = "Request failed")})
-    public Response exec(
-               @ApiParam(value = "v1|v2")  @PathVariable @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Identifier") @PathVariable @PathParam("id") String id);
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
+                    @ApiResponse(code = 400, message = "Request failed")})
+    public Response exec(@ApiParam(
+                    value = "v1|v2") @PathVariable @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Identifier") @PathVariable @PathParam("id") String id);
 
 }
index 89ecdab..f619711 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs;
 
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
-
 import org.onap.optf.cmso.common.PropertiesManagement;
 import org.springframework.stereotype.Controller;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
 @Controller
 public class AdminToolImpl implements AdminTool {
     private static EELFLogger log = EELFManager.getInstance().getLogger(AdminToolImpl.class);
 
-    
-    @Context 
+
+    @Context
     UriInfo uri;
-    
-    @Context 
+
+    @Context
     HttpServletRequest request;
-    
+
     @Override
     public Response exec(String apiVersion, String id) {
         log.info("AdminTool.exec entered " + uri.getPath());
index 60fccd1..cf9c269 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
@@ -40,7 +45,6 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-
 import org.onap.optf.cmso.common.CMSRequestError;
 import org.onap.optf.ticketmgt.service.rs.models.ActiveTicketsRequest;
 import org.onap.optf.ticketmgt.service.rs.models.ActiveTicketsResponse;
@@ -48,72 +52,65 @@ import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
 @Api("Availability Interface")
 @Path("/{apiVersion}")
 @Produces({MediaType.APPLICATION_JSON})
 public interface AvailabilityInterface {
     // ******************************************************************
-    
+
     @POST
     @Path("/activetickets")
     @Produces({MediaType.APPLICATION_JSON})
-    @RequestMapping(value = "/{apiVersion}/activetickets", method = RequestMethod.POST, 
-               consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON)
-    @ApiOperation(value = "Request Active Tickets", notes = "API to support conflict avoidance. Retrieves the active ticket data for the "
-               + "passed criteria to detemine availability of passed elements within the passed time window."
-               + "\nIf the request results in asynchronous processging, IN_PROGRESS status will be returned and the "
-               + "optimizer will begin to poll the request until COMPLETED.", 
-               response = ActiveTicketsResponse.class)
-    @ApiResponses(
-            value = {@ApiResponse(code = 200, message = "OK"), 
-                       @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class),
+    @RequestMapping(value = "/{apiVersion}/activetickets", method = RequestMethod.POST,
+                    consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON)
+    @ApiOperation(value = "Request Active Tickets",
+                    notes = "API to support conflict avoidance. Retrieves the active ticket data for the "
+                                    + "passed criteria to detemine availability of passed elements within the passed time window."
+                                    + "\nIf the request results in asynchronous processging, IN_PROGRESS status will be returned and the "
+                                    + "optimizer will begin to poll the request until COMPLETED.",
+                    response = ActiveTicketsResponse.class)
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
+                    @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class),
                     @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
     public Response getActiveTickets(
-            @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable(value="v1") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Active ticket criteria (elements and change windows).")  ActiveTicketsRequest activeTicketsRequest
-            );
+                    @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable(
+                                    value = "v1") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Active ticket criteria (elements and change windows).") ActiveTicketsRequest activeTicketsRequest);
 
     @GET
     @Path("/activetickets/{id}")
     @Produces({MediaType.APPLICATION_JSON})
-    @RequestMapping(value = "/{apiVersion}/activetickets/{id}", method = RequestMethod.GET, 
-               consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON)
-    @ApiOperation(value = "Poll Active Tickets Request", notes = "Poll for the status of the request id. Optimizser will "
-               + " poll until status is COMPLETED and issue acknowledge (DELETE) API to acknowledge the "
-               + "receipt of the response.", 
-               response = ActiveTicketsResponse.class)
-    @ApiResponses(
-            value = {@ApiResponse(code = 200, message = "OK"), 
-                       @ApiResponse(code = 404, message = "Not found.", response = CMSRequestError.class),
+    @RequestMapping(value = "/{apiVersion}/activetickets/{id}", method = RequestMethod.GET,
+                    consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON)
+    @ApiOperation(value = "Poll Active Tickets Request",
+                    notes = "Poll for the status of the request id. Optimizser will "
+                                    + " poll until status is COMPLETED and issue acknowledge (DELETE) API to acknowledge the "
+                                    + "receipt of the response.",
+                    response = ActiveTicketsResponse.class)
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
+                    @ApiResponse(code = 404, message = "Not found.", response = CMSRequestError.class),
                     @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
     public Response pollActiveTickets(
-            @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable(value="v1") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Active tickets request id.")  @PathParam("id") String id
-            );
+                    @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable(
+                                    value = "v1") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Active tickets request id.") @PathParam("id") String id);
 
     @DELETE
     @Path("/activetickets/{id}")
     @Produces({MediaType.APPLICATION_JSON})
-    @RequestMapping(value = "/{apiVersion}/activetickets/{id}", method = RequestMethod.DELETE, 
-               consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON)
+    @RequestMapping(value = "/{apiVersion}/activetickets/{id}", method = RequestMethod.DELETE,
+                    consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON)
     @ApiOperation(value = "Acknowledge Active Tickets Response", notes = "API call used to acknowledge the receipt"
-               + " of a COMPLETED asynchronous request to enable the Ticket Management service to remove it from their cache."
-               + " The service may remove from the cache on the poll request. The optimizer will treat Not found reponse on as normal.", 
-               response = ActiveTicketsResponse.class)
-    @ApiResponses(
-            value = {@ApiResponse(code = 204, message = "OK"), 
-                       @ApiResponse(code = 404, message = "Not found", response = CMSRequestError.class),
+                    + " of a COMPLETED asynchronous request to enable the Ticket Management service to remove it from their cache."
+                    + " The service may remove from the cache on the poll request. The optimizer will treat Not found reponse on as normal.",
+                    response = ActiveTicketsResponse.class)
+    @ApiResponses(value = {@ApiResponse(code = 204, message = "OK"),
+                    @ApiResponse(code = 404, message = "Not found", response = CMSRequestError.class),
                     @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
     public Response deleteActiveTicketsRequest(
-            @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable(value="v1") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Active tickets request id.")  @PathParam("id") String id
-            );
+                    @ApiParam(value = "v1") @PathParam("apiVersion") @PathVariable(
+                                    value = "v1") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Active tickets request id.") @PathParam("id") String id);
 
 
 }
index 9538f46..06c9e42 100644 (file)
@@ -1,27 +1,27 @@
 /*
  * Copyright Â© 2017-2019 AT&T Intellectual Property.
  * Modifications Copyright Â© 2018 IBM.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *         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.
 
 package org.onap.optf.ticketmgt.service.rs;
 
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
-
 import org.onap.observations.Observation;
 import org.onap.optf.ticketmgt.common.LogMessages;
 import org.onap.optf.ticketmgt.service.rs.models.ActiveTicketsRequest;
@@ -46,93 +47,90 @@ import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Controller;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
 @Controller
-public class AvailabilityInterfaceImpl  implements AvailabilityInterface {
+public class AvailabilityInterfaceImpl implements AvailabilityInterface {
+    @SuppressWarnings("unused")
     private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
 
     @Autowired
     Environment env;
-    
-    @Context 
+
+    @Context
     UriInfo uri;
-    
-    @Context 
+
+    @Context
     HttpServletRequest request;
 
 
-       @Override
-       public Response getActiveTickets(String apiVersion, ActiveTicketsRequest activeTicketsRequest) 
-       {
-               // TODO Auto-generated method stub
-               String id = activeTicketsRequest.getRequestId();
+    @Override
+    public Response getActiveTickets(String apiVersion, ActiveTicketsRequest activeTicketsRequest) {
+        // TODO Auto-generated method stub
+        String id = activeTicketsRequest.getRequestId();
         Observation.report(LogMessages.GET_ACTIVE_TICKETS, "Received", request.getRemoteAddr(), id, "");
         Response response = null;
-        try 
-        {
-               ActiveTicketsResponse atr = new ActiveTicketsResponse();
-               atr.setRequestId(activeTicketsRequest.getRequestId());
-               atr.setStatus(ActiveTicketResponseStatus.COMPLETED);
+        try {
+            ActiveTicketsResponse atr = new ActiveTicketsResponse();
+            atr.setRequestId(activeTicketsRequest.getRequestId());
+            atr.setStatus(ActiveTicketResponseStatus.COMPLETED);
             response = Response.ok(atr).build();
-//        } catch (CMSException e) {
-//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//             Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
-//            response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+            // } catch (CMSException e) {
+            // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+            // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
         } catch (Exception e) {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             response = Response.serverError().build();
         }
-        Observation.report(LogMessages.GET_ACTIVE_TICKETS, "Returned", request.getRemoteAddr(), id, response.getStatusInfo().toString());
-               return response;
-       }
+        Observation.report(LogMessages.GET_ACTIVE_TICKETS, "Returned", request.getRemoteAddr(), id,
+                        response.getStatusInfo().toString());
+        return response;
+    }
 
 
-       @Override
-       public Response pollActiveTickets(String apiVersion, String id) {
-               // TODO Auto-generated method stub
+    @Override
+    public Response pollActiveTickets(String apiVersion, String id) {
+        // TODO Auto-generated method stub
         Observation.report(LogMessages.POLL_ACTIVE_TICKETS, "Received", request.getRemoteAddr(), id, "");
         Response response = null;
-        try 
-        {
-               ActiveTicketsResponse atr = new ActiveTicketsResponse();
-               atr.setRequestId(id);
-               atr.setStatus(ActiveTicketResponseStatus.COMPLETED);
+        try {
+            ActiveTicketsResponse atr = new ActiveTicketsResponse();
+            atr.setRequestId(id);
+            atr.setStatus(ActiveTicketResponseStatus.COMPLETED);
             response = Response.ok(atr).build();
-//        } catch (CMSException e) {
-//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//             Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
-//            response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+            // } catch (CMSException e) {
+            // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+            // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
         } catch (Exception e) {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             response = Response.serverError().build();
         }
-        Observation.report(LogMessages.POLL_ACTIVE_TICKETS, "Returned", request.getRemoteAddr(), id, response.getStatusInfo().toString());
-               return response;
-       }
+        Observation.report(LogMessages.POLL_ACTIVE_TICKETS, "Returned", request.getRemoteAddr(), id,
+                        response.getStatusInfo().toString());
+        return response;
+    }
 
 
-       @Override
-       public Response deleteActiveTicketsRequest(String apiVersion, String id) {
-               // TODO Auto-generated method stub
+    @Override
+    public Response deleteActiveTicketsRequest(String apiVersion, String id) {
+        // TODO Auto-generated method stub
         Observation.report(LogMessages.DELETE_ACTIVE_TICKETS, "Received", request.getRemoteAddr(), id, "");
         Response response = null;
-        try 
-        {
+        try {
             response = Response.noContent().build();
-//        } catch (CMSException e) {
-//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//             Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
-//            response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+            // } catch (CMSException e) {
+            // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+            // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
         } catch (Exception e) {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             response = Response.serverError().build();
         }
-        Observation.report(LogMessages.DELETE_ACTIVE_TICKETS, "Returned", request.getRemoteAddr(), id, response.getStatusInfo().toString());
-               return response;
-       }
+        Observation.report(LogMessages.DELETE_ACTIVE_TICKETS, "Returned", request.getRemoteAddr(), id,
+                        response.getStatusInfo().toString());
+        return response;
+    }
 }
index d15c858..6819d99 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -39,17 +44,10 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-
 import org.onap.optf.ticketmgt.service.rs.models.HealthCheckMessage;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
 @Api("Administration")
 @Path("/{apiVersion}")
 @Produces({MediaType.APPLICATION_JSON})
@@ -62,8 +60,8 @@ public interface HealthCheck {
     @RequestMapping(value = "/{apiVersion}/health", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON)
     @ApiOperation(value = "", notes = "Returns health status of server.", response = HealthCheckMessage.class)
     @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
-            @ApiResponse(code = 400, message = "Not healthy", response = HealthCheckMessage.class)})
-    public Response healthCheck(
-               @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Check Interfaces") @QueryParam("checkInterfaces") @DefaultValue(value = "true") Boolean checkInterfaces);
+                    @ApiResponse(code = 400, message = "Not healthy", response = HealthCheckMessage.class)})
+    public Response healthCheck(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Check Interfaces") @QueryParam("checkInterfaces") @DefaultValue(
+                                    value = "true") Boolean checkInterfaces);
 }
index c23e092..efc57ec 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs;
 
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
-
 import org.onap.optf.ticketmgt.service.rs.models.HealthCheckComponent;
 import org.onap.optf.ticketmgt.service.rs.models.HealthCheckMessage;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Controller;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
 @Controller
 public class HealthCheckImpl implements HealthCheck {
     private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@@ -53,11 +51,11 @@ public class HealthCheckImpl implements HealthCheck {
     @Autowired
     Environment env;
 
-    
-    @Context 
+
+    @Context
     UriInfo uri;
-    
-    @Context 
+
+    @Context
     HttpServletRequest request;
 
     @Override
@@ -90,7 +88,7 @@ public class HealthCheckImpl implements HealthCheck {
         String url = env.getProperty("spring.datasource.url");
         hcc.setUrl(url);
         try {
-            //List<ApprovalType> approvalTypes = approvalTypeDAO.findByDomain("HealthCheck");
+            // List<ApprovalType> approvalTypes = approvalTypeDAO.findByDomain("HealthCheck");
             hcc.setHealthy(true);
             hcc.setStatus("OK");
         } catch (Exception e) {
index 13e7f6d..96c2ada 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
@@ -42,16 +47,9 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-
 import org.onap.optf.cmso.common.CMSRequestError;
 import org.onap.optf.ticketmgt.service.rs.models.TicketData;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
 @Api("Ticket Management")
 @Path("/{apiVersion}")
 @Produces({MediaType.APPLICATION_JSON})
@@ -61,39 +59,36 @@ public interface TicketManagement {
     @Path("/ticket/{id}")
     @Produces({MediaType.APPLICATION_JSON})
     @ApiOperation(value = "Fetch Ticket", notes = "Returns ticket information for the provided ticket id.",
-            response = TicketData.class)
+                    response = TicketData.class)
     @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
-            @ApiResponse(code = 404, message = "No record found", response = CMSRequestError.class),
-            @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
-    public Response fetchTicket(
-            @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Unique ticket identifier") @PathParam("id")  String id);
+                    @ApiResponse(code = 404, message = "No record found", response = CMSRequestError.class),
+                    @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+    public Response fetchTicket(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Unique ticket identifier") @PathParam("id") String id);
 
     // ******************************************************************
     @POST
     @Path("/ticket/")
     @Produces({MediaType.APPLICATION_JSON})
     @ApiOperation(value = "Create Ticket", notes = "Creates a ticket for the passed data")
-    @ApiResponses(
-            value = {@ApiResponse(code = 200, message = "Ticket Created. Ticket Id returned.", response=TicketData.class),
+    @ApiResponses(value = {
+                    @ApiResponse(code = 200, message = "Ticket Created. Ticket Id returned.",
+                                    response = TicketData.class),
                     @ApiResponse(code = 400, message = "Bad request.", response = CMSRequestError.class),
                     @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
-    public Response createTicket(
-            @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Data for creating a ticket") TicketData ticketData);
+    public Response createTicket(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Data for creating a ticket") TicketData ticketData);
 
     // ******************************************************************
     @PUT
     @Path("/ticket/")
     @Produces({MediaType.APPLICATION_JSON})
     @ApiOperation(value = "Update Ticket", notes = "Updates a ticket to the passed data")
-    @ApiResponses(
-            value = {@ApiResponse(code = 204, message = "Ticket Updated."),
+    @ApiResponses(value = {@ApiResponse(code = 204, message = "Ticket Updated."),
                     @ApiResponse(code = 400, message = "Bad request.", response = CMSRequestError.class),
                     @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
-    public Response updateTicket(
-            @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Data for updating a ticket") TicketData ticketData);
+    public Response updateTicket(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Data for updating a ticket") TicketData ticketData);
 
     // ******************************************************************
     @DELETE
@@ -101,35 +96,33 @@ public interface TicketManagement {
     @Produces({MediaType.APPLICATION_JSON})
     @ApiOperation(value = "Cancel the ticket", notes = "Cancels the ticket.")
     @ApiResponses(value = {@ApiResponse(code = 204, message = "Delete successful"),
-            @ApiResponse(code = 404, message = "No record found", response = CMSRequestError.class),
-            @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class),
-            @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+                    @ApiResponse(code = 404, message = "No record found", response = CMSRequestError.class),
+                    @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class),
+                    @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
     public Response deleteScheduleRequest(
-            @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Ticket id to uniquely identify the ticket being deleted.") @PathParam("id") String id);
+                    @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Ticket id to uniquely identify the ticket being deleted.") @PathParam("id") String id);
+
 
-    
 
     // ******************************************************************
     @GET
     @Path("/tickets")
     @Produces({MediaType.APPLICATION_JSON})
     @ApiOperation(value = "Search Tickets", notes = "Returns a list of based upon the filter criteria.",
-            response = TicketData.class, responseContainer = "List")
+                    response = TicketData.class, responseContainer = "List")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
-            @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class),
-            @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+                    @ApiResponse(code = 400, message = "Bad request", response = CMSRequestError.class),
+                    @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
     public Response searchTcikets(
-            @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
-            @ApiParam(value = "Ticket identifier",
-                    allowMultiple = true) @QueryParam("id") String id,
-            @ApiParam(value = "Element Id",
-                    allowMultiple = true) @QueryParam("elementId") String elementId,
-            @ApiParam(value = "Start time <low>,<high>",
-                    allowMultiple = true) @QueryParam("startTime") String startTime,
-            @ApiParam(value = "Finish time <low>,<high>",
-                    allowMultiple = true) @QueryParam("finishTime") String finishTime,
-            @ApiParam(value = "Maximum number of tickets to return") @QueryParam("maxTickets") Integer maxTickets,
-            @ApiParam(value = "Return tickets > last id") @QueryParam("lastId") String lastId);
+                    @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
+                    @ApiParam(value = "Ticket identifier", allowMultiple = true) @QueryParam("id") String id,
+                    @ApiParam(value = "Element Id", allowMultiple = true) @QueryParam("elementId") String elementId,
+                    @ApiParam(value = "Start time <low>,<high>",
+                                    allowMultiple = true) @QueryParam("startTime") String startTime,
+                    @ApiParam(value = "Finish time <low>,<high>",
+                                    allowMultiple = true) @QueryParam("finishTime") String finishTime,
+                    @ApiParam(value = "Maximum number of tickets to return") @QueryParam("maxTickets") Integer maxTickets,
+                    @ApiParam(value = "Return tickets > last id") @QueryParam("lastId") String lastId);
 
 }
index 4346f0b..6583c5e 100644 (file)
@@ -1,27 +1,27 @@
 /*
  * Copyright Â© 2017-2019 AT&T Intellectual Property.
  * Modifications Copyright Â© 2018 IBM.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *         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.
 
 package org.onap.optf.ticketmgt.service.rs;
 
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
-
 import org.onap.observations.Observation;
 import org.onap.optf.ticketmgt.common.LogMessages;
 import org.onap.optf.ticketmgt.service.rs.models.TicketData;
@@ -48,133 +48,131 @@ import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Controller;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
 @Controller
-public class TicketManagementImpl  implements TicketManagement {
+public class TicketManagementImpl implements TicketManagement {
+    @SuppressWarnings("unused")
     private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
 
     @Autowired
     Environment env;
-    
-    @Context 
+
+    @Context
     UriInfo uri;
-    
-    @Context 
+
+    @Context
     HttpServletRequest request;
 
-       @Override
-       public Response fetchTicket(String apiVersion, String id) {
-               // TODO Auto-generated method stub
+    @Override
+    public Response fetchTicket(String apiVersion, String id) {
+        // TODO Auto-generated method stub
         Observation.report(LogMessages.FETCH_TICKET, "Received", request.getRemoteAddr(), id, "");
         Response response = null;
-        try 
-        {
-               TicketData td = new TicketData();
-               td.setId(id);
+        try {
+            TicketData td = new TicketData();
+            td.setId(id);
             response = Response.ok(td).build();
-//        } catch (CMSException e) {
-//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//             Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
-//            response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+            // } catch (CMSException e) {
+            // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+            // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
         } catch (Exception e) {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             response = Response.serverError().build();
         }
-        Observation.report(LogMessages.FETCH_TICKET, "Returned", request.getRemoteAddr(), id, response.getStatusInfo().toString());
+        Observation.report(LogMessages.FETCH_TICKET, "Returned", request.getRemoteAddr(), id,
+                        response.getStatusInfo().toString());
         return response;
-       }
+    }
 
-       @Override
-       public Response createTicket(String apiVersion, TicketData ticketData) {
-               // TODO Auto-generated method stub
+    @Override
+    public Response createTicket(String apiVersion, TicketData ticketData) {
+        // TODO Auto-generated method stub
         String id = UUID.randomUUID().toString();
         Observation.report(LogMessages.CREATE_TICKET, "Received", request.getRemoteAddr(), id, "");
         Response response = null;
-        try 
-        {
-               ticketData.setId(id);
+        try {
+            ticketData.setId(id);
             response = Response.ok(ticketData).build();
-//        } catch (CMSException e) {
-//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//             Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
-//            response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+            // } catch (CMSException e) {
+            // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+            // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
         } catch (Exception e) {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             response = Response.serverError().build();
         }
-        Observation.report(LogMessages.CREATE_TICKET, "Returned", request.getRemoteAddr(), id, response.getStatusInfo().toString());
+        Observation.report(LogMessages.CREATE_TICKET, "Returned", request.getRemoteAddr(), id,
+                        response.getStatusInfo().toString());
         return response;
-       }
+    }
 
-       @Override
-       public Response updateTicket(String apiVersion, TicketData ticketData) {
-               // TODO Auto-generated method stub
+    @Override
+    public Response updateTicket(String apiVersion, TicketData ticketData) {
+        // TODO Auto-generated method stub
         String id = ticketData.getId();
         Observation.report(LogMessages.UPDATE_TICKET, "Received", request.getRemoteAddr(), id, "");
         Response response = null;
-        try 
-        {
+        try {
             response = Response.noContent().build();
-//        } catch (CMSException e) {
-//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//             Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
-//            response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+            // } catch (CMSException e) {
+            // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+            // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
         } catch (Exception e) {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             response = Response.serverError().build();
         }
-        Observation.report(LogMessages.UPDATE_TICKET, "Returned", request.getRemoteAddr(), id, response.getStatusInfo().toString());
-               return response;
-       }
+        Observation.report(LogMessages.UPDATE_TICKET, "Returned", request.getRemoteAddr(), id,
+                        response.getStatusInfo().toString());
+        return response;
+    }
 
 
-       @Override
-       public Response searchTcikets(String apiVersion, String id, String elementId, String startTime, String finishTime,
-                       Integer maxTickets, String lastId) {
-               // TODO Auto-generated method stub
-               // TODO Auto-generated method stub
+    @Override
+    public Response searchTcikets(String apiVersion, String id, String elementId, String startTime, String finishTime,
+                    Integer maxTickets, String lastId) {
+        // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
         Observation.report(LogMessages.SEARCH_TICKETS, "Received", request.getRemoteAddr(), uri.getPath(), "");
         Response response = null;
         List<TicketData> list = new ArrayList<>();
-        try 
-        {
+        try {
             response = Response.ok(list).build();
-//        } catch (CMSException e) {
-//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//             Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
-//            response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+            // } catch (CMSException e) {
+            // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+            // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
         } catch (Exception e) {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             response = Response.serverError().build();
         }
-        Observation.report(LogMessages.SEARCH_TICKETS, "Returned", request.getRemoteAddr(), uri.getPath(), response.getStatusInfo().toString());
-               return response;
-       }
+        Observation.report(LogMessages.SEARCH_TICKETS, "Returned", request.getRemoteAddr(), uri.getPath(),
+                        response.getStatusInfo().toString());
+        return response;
+    }
 
-       @Override
-       public Response deleteScheduleRequest(String apiVersion, String id) {
+    @Override
+    public Response deleteScheduleRequest(String apiVersion, String id) {
         Observation.report(LogMessages.CANCEL_TICKET, "Received", request.getRemoteAddr(), id, "");
         Response response = null;
-        try 
-        {
+        try {
             response = Response.noContent().build();
-//        } catch (CMSException e) {
-//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-//             Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
-//            response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+            // } catch (CMSException e) {
+            // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+            // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
         } catch (Exception e) {
-               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             response = Response.serverError().build();
         }
-        Observation.report(LogMessages.CANCEL_TICKET, "Returned", request.getRemoteAddr(), id, response.getStatusInfo().toString());
-               return response;
-       }
+        Observation.report(LogMessages.CANCEL_TICKET, "Returned", request.getRemoteAddr(), id,
+                        response.getStatusInfo().toString());
+        return response;
+    }
 
 }
index 9c979de..34093f9 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs.models;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
-@ApiModel(value = "Ticket Management Request", description = "Request to retrieve active tickets for the provided elements.")
+@ApiModel(value = "Ticket Management Request",
+                description = "Request to retrieve active tickets for the provided elements.")
 public class ActiveTicketsRequest implements Serializable {
     private static final long serialVersionUID = 1L;
     private static EELFLogger log = EELFManager.getInstance().getLogger(ActiveTicketsRequest.class);
@@ -52,57 +51,56 @@ public class ActiveTicketsRequest implements Serializable {
     private String requestId;
 
     @ApiModelProperty(
-            value = "Implementation specific name value pairs provided to be passed to Ticket Management query .")
+                    value = "Implementation specific name value pairs provided to be passed to Ticket Management query .")
     private List<NameValue> commonData;
 
-    @ApiModelProperty(
-            value = "Lists of desired change windows for which TicketData will be returned.")
+    @ApiModelProperty(value = "Lists of desired change windows for which TicketData will be returned.")
     private List<ChangeWindow> changeWindows = new ArrayList<>();
 
     @ApiModelProperty(value = "List of the elements for which TicketData will be returned.")
     private List<ElementCriteria> elements = new ArrayList<>();
 
     public String getRequestId() {
-               return requestId;
-       }
+        return requestId;
+    }
 
 
-       public void setRequestId(String requestId) {
-               this.requestId = requestId;
-       }
+    public void setRequestId(String requestId) {
+        this.requestId = requestId;
+    }
 
 
-       public List<NameValue> getCommonData() {
-               return commonData;
-       }
+    public List<NameValue> getCommonData() {
+        return commonData;
+    }
 
 
-       public void setCommonData(List<NameValue> commonData) {
-               this.commonData = commonData;
-       }
+    public void setCommonData(List<NameValue> commonData) {
+        this.commonData = commonData;
+    }
 
 
-       public List<ChangeWindow> getChangeWindows() {
-               return changeWindows;
-       }
+    public List<ChangeWindow> getChangeWindows() {
+        return changeWindows;
+    }
 
 
-       public void setChangeWindows(List<ChangeWindow> changeWindows) {
-               this.changeWindows = changeWindows;
-       }
+    public void setChangeWindows(List<ChangeWindow> changeWindows) {
+        this.changeWindows = changeWindows;
+    }
 
 
-       public List<ElementCriteria> getElements() {
-               return elements;
-       }
+    public List<ElementCriteria> getElements() {
+        return elements;
+    }
 
 
-       public void setElements(List<ElementCriteria> elements) {
-               this.elements = elements;
-       }
+    public void setElements(List<ElementCriteria> elements) {
+        this.elements = elements;
+    }
 
 
-       public String toString() {
+    public String toString() {
         ObjectMapper mapper = new ObjectMapper();
         try {
             return mapper.writeValueAsString(this);
index d3d5f7d..fe661ca 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs.models;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
-@ApiModel(value = "Ticket Management Response", description = "Response to active ticket query for the requested elements.")
+@ApiModel(value = "Ticket Management Response",
+                description = "Response to active ticket query for the requested elements.")
 public class ActiveTicketsResponse implements Serializable {
     private static final long serialVersionUID = 1L;
     private static EELFLogger log = EELFManager.getInstance().getLogger(ActiveTicketsResponse.class);
 
-    public enum ActiveTicketResponseStatus
-    {
-       IN_PROGESS,
-       COMPLETED,
+    public enum ActiveTicketResponseStatus {
+        IN_PROGESS, COMPLETED,
     }
+
     @ApiModelProperty(value = "Unique Id of the request")
     private String requestId;
 
-    @ApiModelProperty(value = "List of TicketData for the requested elements. A single ticket may apply to more than 1 passed elementId.")
+    @ApiModelProperty(
+                    value = "List of TicketData for the requested elements. A single ticket may apply to more than 1 passed elementId.")
     private List<TicketData> elements = new ArrayList<>();
-    
-    @ApiModelProperty(value = "Status of ticket request. IN_PROGRESS will indicate asynchronous processing is required.")
+
+    @ApiModelProperty(
+                    value = "Status of ticket request. IN_PROGRESS will indicate asynchronous processing is required.")
     private ActiveTicketResponseStatus status;
+
     @ApiModelProperty(value = "If request is asynchronous (IN_PROGRESS), suggested interval to the next poll.")
     private Integer pollingSeconds;
-    
+
     public String getRequestId() {
-               return requestId;
-       }
+        return requestId;
+    }
 
-       public void setRequestId(String requestId) {
-               this.requestId = requestId;
-       }
+    public void setRequestId(String requestId) {
+        this.requestId = requestId;
+    }
 
-       public List<TicketData> getElements() {
-               return elements;
-       }
+    public List<TicketData> getElements() {
+        return elements;
+    }
 
-       public void setElements(List<TicketData> elements) {
-               this.elements = elements;
-       }
+    public void setElements(List<TicketData> elements) {
+        this.elements = elements;
+    }
 
-       public ActiveTicketResponseStatus getStatus() {
-               return status;
-       }
+    public ActiveTicketResponseStatus getStatus() {
+        return status;
+    }
 
-       public void setStatus(ActiveTicketResponseStatus status) {
-               this.status = status;
-       }
+    public void setStatus(ActiveTicketResponseStatus status) {
+        this.status = status;
+    }
 
-       public Integer getPollingSeconds() {
-               return pollingSeconds;
-       }
+    public Integer getPollingSeconds() {
+        return pollingSeconds;
+    }
 
-       public void setPollingSeconds(Integer pollingSeconds) {
-               this.pollingSeconds = pollingSeconds;
-       }
+    public void setPollingSeconds(Integer pollingSeconds) {
+        this.pollingSeconds = pollingSeconds;
+    }
 
-       public String toString() {
+    public String toString() {
         ObjectMapper mapper = new ObjectMapper();
         try {
             return mapper.writeValueAsString(this);
index 9b88cf2..31a49de 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs.models;
 
-import java.io.Serializable;
-import java.util.Date;
-
-import org.springframework.format.annotation.DateTimeFormat;
-
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
+import java.util.Date;
+import org.springframework.format.annotation.DateTimeFormat;
 
-@ApiModel(value = "Change Window",
-        description = "Time window for which tickets are to returned")
+@ApiModel(value = "Change Window", description = "Time window for which tickets are to returned")
 public class ChangeWindow implements Serializable {
     private static final long serialVersionUID = 1L;
     private static EELFLogger log = EELFManager.getInstance().getLogger(ChangeWindow.class);
 
     @ApiModelProperty(value = "Earliest time for which changes may begin.")
-    @DateTimeFormat(pattern="yyyy-MM-dd'T'hh:mm:ss'Z'")
+    @DateTimeFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss'Z'")
     private Date startTime;
 
     @ApiModelProperty(value = "Latest time by which all changes must be completed.")
-    @DateTimeFormat(pattern="yyyy-MM-dd'T'hh:mm:ss'Z'")
+    @DateTimeFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss'Z'")
     private Date endTime;
 
     public Date getStartTime() {
index 8b812a2..0043dd3 100644 (file)
  ******************************************************************************/
 package org.onap.optf.ticketmgt.service.rs.models;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
 @ApiModel(value = "Element Critera", description = "Element criteria for retrieving active tickets.")
 public class ElementCriteria implements Serializable {
     private static final long serialVersionUID = 1L;
@@ -47,20 +46,20 @@ public class ElementCriteria implements Serializable {
     @ApiModelProperty(value = "Implementation specific element data.")
     public List<NameValue> elementData = new ArrayList<>();
 
-       public String getElementId() {
-               return elementId;
-       }
+    public String getElementId() {
+        return elementId;
+    }
 
-       public void setElementId(String elementId) {
-               this.elementId = elementId;
-       }
+    public void setElementId(String elementId) {
+        this.elementId = elementId;
+    }
 
-       public List<NameValue> getElementData() {
-               return elementData;
-       }
+    public List<NameValue> getElementData() {
+        return elementData;
+    }
 
-       public void setElementData(List<NameValue> elementData) {
-               this.elementData = elementData;
-       }
+    public void setElementData(List<NameValue> elementData) {
+        this.elementData = elementData;
+    }
 
 }
index 8717987..dafe38e 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs.models;
 
-import java.io.Serializable;
-
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-
 import io.swagger.annotations.ApiModel;
+import java.io.Serializable;
 
 @ApiModel
 public class HealthCheckComponent implements Serializable {
index fd313fd..e36f54e 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs.models;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-
 import io.swagger.annotations.ApiModel;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 @ApiModel
 public class HealthCheckMessage implements Serializable {
index dbbcac7..c5c53b2 100644 (file)
 
 package org.onap.optf.ticketmgt.service.rs.models;
 
-import java.io.Serializable;
-
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
-
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
 
-@ApiModel(value = "Name Value Data",
-        description = "Instance of a name/value")
+@ApiModel(value = "Name Value Data", description = "Instance of a name/value")
 public class NameValue implements Serializable {
     private static final long serialVersionUID = 1L;
     private static EELFLogger log = EELFManager.getInstance().getLogger(NameValue.class);
@@ -53,29 +49,29 @@ public class NameValue implements Serializable {
 
     @ApiModelProperty(value = "Value.")
     private Object value;
-    
-    
+
+
     public String getName() {
-               return name;
-       }
+        return name;
+    }
 
 
-       public void setName(String name) {
-               this.name = name;
-       }
+    public void setName(String name) {
+        this.name = name;
+    }
 
 
-       public Object getValue() {
-               return value;
-       }
+    public Object getValue() {
+        return value;
+    }
 
 
-       public void setValue(Object value) {
-               this.value = value;
-       }
+    public void setValue(Object value) {
+        this.value = value;
+    }
 
 
-       public String toString() {
+    public String toString() {
         ObjectMapper mapper = new ObjectMapper();
         try {
             return mapper.writeValueAsString(this);