aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-ticketmgt/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'cmso-ticketmgt/src/main/java/org')
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java314
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java25
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java166
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java30
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java156
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java6
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java12
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java27
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java6
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java7
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/Application.java13
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/ApplicationPropertiesFiles.java9
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/AuthProvider.java22
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java7
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java13
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SecurityConfig.java14
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SpringProfiles.java9
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java24
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java16
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/FilterPriority.java9
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java8
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/Availability.java2
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java336
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java45
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java30
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminTool.java23
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminToolImpl.java16
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java85
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterfaceImpl.java124
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheck.java20
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheckImpl.java16
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java79
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagementImpl.java166
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsRequest.java64
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsResponse.java78
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ChangeWindow.java16
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ElementCriteria.java29
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckComponent.java4
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckMessage.java8
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/NameValue.java36
40 files changed, 999 insertions, 1071 deletions
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java b/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java
index cf49ccd..e2b8220 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java
@@ -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");
+ }
+ }
+
+
+}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java b/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java
index d8f80a2..c936444 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java
@@ -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
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java b/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
index 0e1b1da..83b8f8d 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
@@ -29,97 +29,87 @@
*/
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();
+ }
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java
index 16305bc..7a16a3f 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java
@@ -29,20 +29,24 @@
*/
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();
+}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java
index 639db76..f41c134 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java
@@ -29,81 +29,97 @@
*/
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;
+ }
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java
index b238561..eb9ddad 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java
@@ -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");
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java
index b6a59e3..115177c 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java
@@ -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");
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java
index 1be9603..d3688f6 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java
@@ -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.
@@ -31,16 +31,13 @@
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();
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java
index 8c1f2c6..77fdb11 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/PropertiesManagement.java
@@ -31,17 +31,15 @@
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 {
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java
index 68418d6..0ab80a0 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/exceptions/CMSException.java
@@ -31,16 +31,13 @@
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);
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/Application.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/Application.java
index eca406d..7392e2b 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/Application.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/Application.java
@@ -31,11 +31,12 @@
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;
}
-
+
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/ApplicationPropertiesFiles.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/ApplicationPropertiesFiles.java
index 8cd70a6..0fd1c45 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/ApplicationPropertiesFiles.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/ApplicationPropertiesFiles.java
@@ -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 {
+}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/AuthProvider.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/AuthProvider.java
index 43ded66..6749b72 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/AuthProvider.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/AuthProvider.java
@@ -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);
}
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java
index f5c6345..d955e75 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/CMSEnvironmentPostProcessor.java
@@ -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");
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java
index 3bc0153..46c99ee 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/JerseyConfiguration.java
@@ -31,12 +31,15 @@
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 {
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SecurityConfig.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SecurityConfig.java
index 27f9019..8abccf0 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SecurityConfig.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SecurityConfig.java
@@ -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
+}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SpringProfiles.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SpringProfiles.java
index 2cb2c99..b73959d 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SpringProfiles.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/SpringProfiles.java
@@ -19,11 +19,10 @@
*/
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() {}
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java
index 53a8d52..9f1f2d1 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafAuthorizationFilter.java
@@ -20,12 +20,10 @@
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);
}
}
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java
index 89d6e3b..4d6c44f 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/AafFilter.java
@@ -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);
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/FilterPriority.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/FilterPriority.java
index 0a74a97..4b9bd9d 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/FilterPriority.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/FilterPriority.java
@@ -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;
+ }
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java
index 626776c..16dd74e 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/aaf/ResponseFormatter.java
@@ -20,19 +20,15 @@
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();
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/Availability.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/Availability.java
index 15d8c5c..c650354 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/Availability.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/Availability.java
@@ -31,5 +31,5 @@
package org.onap.optf.ticketmgt.common;
public enum Availability {
-full, partial, unavailable
+ full, partial, unavailable
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java
index caf7e8b..be7b4c9 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/common/LogMessages.java
@@ -32,178 +32,186 @@
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);
+
+ }
+
+ }
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java
index c42b253..c013453 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOClientFilters.java
@@ -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.
@@ -32,53 +32,42 @@
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());
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java
index a8f08b3..162a6ba 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/filters/CMSOContainerFilters.java
@@ -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());
}
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminTool.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminTool.java
index d7e0c94..1ab6db0 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminTool.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminTool.java
@@ -31,6 +31,11 @@
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);
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminToolImpl.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminToolImpl.java
index 89ecdab..f619711 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminToolImpl.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AdminToolImpl.java
@@ -31,28 +31,26 @@
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());
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java
index 60fccd1..cf9c269 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterface.java
@@ -31,6 +31,11 @@
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);
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterfaceImpl.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterfaceImpl.java
index 9538f46..06c9e42 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterfaceImpl.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/AvailabilityInterfaceImpl.java
@@ -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.
@@ -31,11 +31,12 @@
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;
+ }
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheck.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheck.java
index d15c858..6819d99 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheck.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheck.java
@@ -31,6 +31,11 @@
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);
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheckImpl.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheckImpl.java
index c23e092..efc57ec 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheckImpl.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/HealthCheckImpl.java
@@ -31,20 +31,18 @@
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) {
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java
index 13e7f6d..96c2ada 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java
@@ -31,6 +31,11 @@
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);
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagementImpl.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagementImpl.java
index 4346f0b..6583c5e 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagementImpl.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagementImpl.java
@@ -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.
@@ -31,15 +31,15 @@
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;
+ }
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsRequest.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsRequest.java
index 9c979de..34093f9 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsRequest.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsRequest.java
@@ -31,19 +31,18 @@
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);
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsResponse.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsResponse.java
index d3d5f7d..fe661ca 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsResponse.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsResponse.java
@@ -31,73 +31,73 @@
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);
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ChangeWindow.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ChangeWindow.java
index 9b88cf2..31a49de 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ChangeWindow.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ChangeWindow.java
@@ -31,31 +31,27 @@
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() {
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ElementCriteria.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ElementCriteria.java
index 8b812a2..0043dd3 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ElementCriteria.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ElementCriteria.java
@@ -30,13 +30,12 @@
******************************************************************************/
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;
+ }
}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckComponent.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckComponent.java
index 8717987..dafe38e 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckComponent.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckComponent.java
@@ -31,14 +31,12 @@
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 {
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckMessage.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckMessage.java
index fd313fd..e36f54e 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckMessage.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/HealthCheckMessage.java
@@ -31,16 +31,14 @@
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 {
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/NameValue.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/NameValue.java
index dbbcac7..c5c53b2 100644
--- a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/NameValue.java
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/NameValue.java
@@ -31,19 +31,15 @@
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);