aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmso-service/pom.xml2
-rw-r--r--cmso-ticketmgt/src/main/docker/Dockerfile33
-rw-r--r--cmso-ticketmgt/src/main/docker/assembly/cmso-files.xml64
-rw-r--r--cmso-ticketmgt/src/main/docker/extra-files/startService.sh7
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java223
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java104
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java125
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java48
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java109
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java59
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java95
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java138
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagementImpl.java180
-rw-r--r--cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsRequest.java115
14 files changed, 1301 insertions, 1 deletions
diff --git a/cmso-service/pom.xml b/cmso-service/pom.xml
index d03a3ac..a68744b 100644
--- a/cmso-service/pom.xml
+++ b/cmso-service/pom.xml
@@ -55,7 +55,7 @@
<eelf.version>1.0.0</eelf.version>
<pact.version>3.3.9</pact.version>
<spring.version>5.0.10.RELEASE</spring.version>
- <spring.boot.version>2.1.0.RELEASE</spring.boot.version>
+ <spring.boot.version>2.1.3.RELEASE</spring.boot.version>
<springfox.swagger2.version>2.9.2</springfox.swagger2.version>
<maven.compiler.target>1.8</maven.compiler.target>
diff --git a/cmso-ticketmgt/src/main/docker/Dockerfile b/cmso-ticketmgt/src/main/docker/Dockerfile
new file mode 100644
index 0000000..3555d62
--- /dev/null
+++ b/cmso-ticketmgt/src/main/docker/Dockerfile
@@ -0,0 +1,33 @@
+FROM ubuntu:16.04
+
+MAINTAINER "The Onap Team"
+LABEL Description="This image contains ubuntu 16.04 with the openjdk installed" Version="16.04-8"
+ENV APP_HOME=/opt/app/cmso
+ARG http_proxy
+ARG https_proxy
+ENV HTTP_PROXY=$http_proxy
+ENV HTTPS_PROXY=$https_proxy
+ENV http_proxy=$HTTP_PROXY
+ENV https_proxy=$HTTPS_PROXY
+
+RUN test -n "$http_proxy" && echo "Acquire::Proxy \"http://$http_proxy\";" > /etc/apt/apt.conf.d/02proxy || true && \
+ apt-get update && \
+ apt-get -y dist-upgrade && \
+ apt-get install -y openjdk-8-jre-headless
+
+COPY onap-cmso-tm/cmso-ticketmgt.jar ${APP_HOME}/app.jar
+
+VOLUME /share/etc
+VOLUME /share/logs
+VOLUME /share/debug-logs
+
+COPY onap-cmso-tm/startService.sh ${APP_HOME}/startService.sh
+COPY onap-cmso-tm/data ${APP_HOME}/data
+
+RUN chmod 700 ${APP_HOME}/startService.sh
+RUN ln -s /share/etc ${APP_HOME}/etc
+RUN ln -s /share/logs ${APP_HOME}/logs
+RUN ln -s /share/debug-logs ${APP_HOME}/debug-logs
+
+WORKDIR ${APP_HOME}
+ENTRYPOINT ./startService.sh
diff --git a/cmso-ticketmgt/src/main/docker/assembly/cmso-files.xml b/cmso-ticketmgt/src/main/docker/assembly/cmso-files.xml
new file mode 100644
index 0000000..37804ec
--- /dev/null
+++ b/cmso-ticketmgt/src/main/docker/assembly/cmso-files.xml
@@ -0,0 +1,64 @@
+<!-- ============LICENSE_START=======================================================
+ ECOMP CMSO ================================================================================
+ Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. ================================================================================
+ 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. ============LICENSE_END========================================================= -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd">
+ <id>cmso-files</id>
+
+ <formats>
+ <format>tar.gz</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+
+ <fileSets>
+ <!-- include config files -->
+ <fileSet>
+ <includes>
+ <include>${project.build.finalName}.jar</include>
+ </includes>
+ <directory>${project.build.directory}</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <includes>
+ <include>**</include>
+ </includes>
+ <directory>src/main/docker/extra-files</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <includes>
+ <include>**</include>
+ </includes>
+ <directory>data</directory>
+ <outputDirectory>/data</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <outputDirectory>./resources</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/etc/config</directory>
+ <outputDirectory>./</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+
+ </fileSets>
+
+</assembly>
diff --git a/cmso-ticketmgt/src/main/docker/extra-files/startService.sh b/cmso-ticketmgt/src/main/docker/extra-files/startService.sh
new file mode 100644
index 0000000..199c637
--- /dev/null
+++ b/cmso-ticketmgt/src/main/docker/extra-files/startService.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+VM_ARGS="${VM_ARGS} -Dserver.local.startpath=${RESOURCES_HOME}"
+
+echo "VM_ARGS="${VM_ARGS}
+
+java -Djava.security.egd=file:/dev/./urandom ${VM_ARGS} -Xms256m -Xmx1024m -jar ./app.jar
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java b/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java
new file mode 100644
index 0000000..cf49ccd
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java
@@ -0,0 +1,223 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.onap.observations;
+
+import static com.att.eelf.configuration.Configuration.MDC_BEGIN_TIMESTAMP;
+import static com.att.eelf.configuration.Configuration.MDC_END_TIMESTAMP;
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+import static com.att.eelf.configuration.Configuration.MDC_PARTNER_NAME;
+import static com.att.eelf.configuration.Configuration.MDC_REMOTE_HOST;
+import static com.att.eelf.configuration.Configuration.MDC_RESPONSE_CODE;
+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 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;
+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)
+ **/
+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
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java b/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java
new file mode 100644
index 0000000..d8f80a2
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/MessageHeaders.java
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.observations;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+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"),;
+
+ private final String text;
+ private final ArrayList<String> list;
+
+ private HeadersEnum(String text) {
+ this.text = text;
+ this.list = new ArrayList<>();
+ }
+
+ @Override
+ public String toString() {
+ return text;
+ }
+ }
+
+ public static final Map<String, String> supportedMajorVersions = new HashMap<String, String>();
+ static {
+ supportedMajorVersions.put("v1", "0");
+ supportedMajorVersions.put("v2", "0");
+ }
+ public static final Set<String> supportedMajorMinorVersions = new HashSet<String>();
+ static {
+ supportedMajorMinorVersions.add("v1.0");
+ supportedMajorMinorVersions.add("v2.0");
+ }
+ public static final String latestVersion = "2.0.0";
+ public static final String patchVersion = "0";
+
+ public static HeadersEnum fromString(String text) {
+ for (HeadersEnum e : HeadersEnum.values())
+ if (e.text.equals(text))
+ return e;
+ return HeadersEnum.UNDEFINED;
+ }
+
+ public static String getPatchVersion() {
+ return patchVersion;
+ }
+
+ public static String getLatestVersion() {
+ return latestVersion;
+ }
+
+ public static boolean validateMajorVersion(String major) {
+ String majorKey = major.toLowerCase();
+ if (!supportedMajorVersions.containsKey(majorKey))
+ return false;
+ return true;
+ }
+
+ public static boolean validateMajorMinorVersion(String major, String minor) {
+ String majorKey = major.toLowerCase();
+ if (!supportedMajorVersions.containsKey(majorKey))
+ return false;
+
+ if (minor != null) {
+ String majorMinorKey = majorKey + "." + minor;
+ return supportedMajorMinorVersions.contains(majorMinorKey);
+ }
+ return true;
+ }
+}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java b/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
new file mode 100644
index 0000000..0e1b1da
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/Observation.java
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.onap.observations;
+
+import org.apache.log4j.Level;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+
+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();
+ }
+
+}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java
new file mode 100644
index 0000000..16305bc
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationInterface.java
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.onap.observations;
+
+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 Boolean getMetric();
+} \ No newline at end of file
diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java
new file mode 100644
index 0000000..639db76
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/observations/ObservationObject.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.onap.observations;
+
+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 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
new file mode 100644
index 0000000..b238561
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.cmso;
+
+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;
+import org.springframework.core.env.ConfigurableEnvironment;
+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.
+ @Override
+ public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
+ String pwd = environment.getProperty("cmso.database.password");
+ if (pwd != null) {
+ pwd = PropertiesManagement.getDecryptedValue(pwd);
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("spring.datasource.password", pwd);
+ MapPropertySource propertySource = new MapPropertySource("abc", map);
+ MutablePropertySources proeprtySources = environment.getPropertySources();
+ proeprtySources.addLast(propertySource);
+ }
+ }
+
+}
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
new file mode 100644
index 0000000..b6a59e3
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.cmso.common;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import javax.servlet.http.HttpServletRequest;
+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);
+ private final String user;
+ private final String password;
+
+ public BasicAuthenticatorFilter(String user, String password) {
+ this.user = user;
+ this.password = password;
+ log.info("user: " + user + " pass:" + password);
+ }
+
+ @Override
+ public void filter(ClientRequestContext requestContext) throws IOException {
+ MultivaluedMap<String, Object> headers = requestContext.getHeaders();
+ final String basicAuthentication = getBasicAuthentication();
+ headers.add("Authorization", basicAuthentication);
+ }
+
+ private String getBasicAuthentication() {
+ String token = this.user + ":" + this.password;
+ try {
+ return "Basic " + DatatypeConverter.printBase64Binary(token.getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ throw new IllegalStateException("Cannot encode with UTF-8", ex);
+ }
+ }
+
+ public static String getUser(HttpServletRequest request) {
+ String user = "";
+ String header = request.getHeader("Authorization");
+ if (header != null) {
+ String[] auth = header.split("Basic ");
+ if (auth.length == 2) {
+ String token = getToken(auth[1]);
+ if (token.contains(":")) {
+ String[] tokens = token.split(":");
+ user = tokens[0];
+ }
+ }
+ }
+ return user;
+ }
+
+ private static String getToken(String auth) {
+ try {
+ String token = new String(DatatypeConverter.parseBase64Binary(auth));
+ return token;
+ } catch (Exception e) {
+ return auth;
+ }
+ }
+}
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
new file mode 100644
index 0000000..1931296
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagement.java
@@ -0,0 +1,138 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.ticketmgt.service.rs;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+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})
+public interface TicketManagement {
+ // ******************************************************************
+ @GET
+ @Path("/ticket/{id}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "Fetch Ticket", notes = "Returns ticket information for the provided ticket id.",
+ 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);
+
+ // ******************************************************************
+ @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),
+ @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);
+
+ // ******************************************************************
+ @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."),
+ @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);
+
+ // ******************************************************************
+ @DELETE
+ @Path("/ticket/{id}")
+ @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)})
+ 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);
+
+
+
+ // ******************************************************************
+ @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")
+ @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 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);
+
+}
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
new file mode 100644
index 0000000..4346f0b
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/TicketManagementImpl.java
@@ -0,0 +1,180 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.ticketmgt.service.rs;
+
+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;
+import org.springframework.beans.factory.annotation.Autowired;
+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 {
+ private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+
+ @Autowired
+ Environment env;
+
+ @Context
+ UriInfo uri;
+
+ @Context
+ HttpServletRequest request;
+
+ @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);
+ 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 (Exception e) {
+ 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());
+ return response;
+ }
+
+ @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);
+ 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 (Exception e) {
+ 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());
+ return response;
+ }
+
+ @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
+ {
+ 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 (Exception e) {
+ 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;
+ }
+
+
+ @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
+ {
+ 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 (Exception e) {
+ 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;
+ }
+
+ @Override
+ public Response deleteScheduleRequest(String apiVersion, String id) {
+ Observation.report(LogMessages.CANCEL_TICKET, "Received", request.getRemoteAddr(), id, "");
+ Response response = null;
+ 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 (Exception e) {
+ 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;
+ }
+
+}
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
new file mode 100644
index 0000000..9c979de
--- /dev/null
+++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/ActiveTicketsRequest.java
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+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;
+
+@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);
+
+ @ApiModelProperty(value = "Unique Id of the request")
+ private String requestId;
+
+ @ApiModelProperty(
+ 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.")
+ 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;
+ }
+
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+
+ public List<NameValue> getCommonData() {
+ return commonData;
+ }
+
+
+ public void setCommonData(List<NameValue> commonData) {
+ this.commonData = commonData;
+ }
+
+
+ public List<ChangeWindow> getChangeWindows() {
+ return changeWindows;
+ }
+
+
+ public void setChangeWindows(List<ChangeWindow> changeWindows) {
+ this.changeWindows = changeWindows;
+ }
+
+
+ public List<ElementCriteria> getElements() {
+ return elements;
+ }
+
+
+ public void setElements(List<ElementCriteria> elements) {
+ this.elements = elements;
+ }
+
+
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ log.debug("Error in toString()", e);
+ }
+ return "";
+ }
+
+}