Commit 9 for TM API definition 32/79832/3
authorJerry Flood <jflood@att.com>
Wed, 6 Mar 2019 22:29:17 +0000 (17:29 -0500)
committerJerry Flood <jflood@att.com>
Wed, 13 Mar 2019 02:35:41 +0000 (22:35 -0400)
Initial commit of Ticket Management simulator.

Multiple commits required due to commit size limitation

Change-Id: I57fda62e9f8bddeb903be263ffb17b9831123c36
Issue-ID: OPTFRA-432
Signed-off-by: Jerry Flood <jflood@att.com>
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/NameValue.java [new file with mode: 0644]
cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/TicketData.java [new file with mode: 0644]
cmso-ticketmgt/src/main/resources/META-INF/resources/swagger/index.html [new file with mode: 0644]

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
new file mode 100644 (file)
index 0000000..dbbcac7
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * 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 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;
+
+@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);
+
+    @ApiModelProperty(value = "Name.")
+    private String name;
+
+    @ApiModelProperty(value = "Value.")
+    private Object value;
+    
+    
+    public String getName() {
+               return name;
+       }
+
+
+       public void setName(String name) {
+               this.name = name;
+       }
+
+
+       public Object getValue() {
+               return value;
+       }
+
+
+       public void setValue(Object value) {
+               this.value = value;
+       }
+
+
+       public String toString() {
+        ObjectMapper mapper = new ObjectMapper();
+        try {
+            return mapper.writeValueAsString(this);
+        } catch (JsonProcessingException e) {
+            log.debug("Error in toString()", e);
+        }
+        return "";
+    }
+
+}
diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/TicketData.java b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/TicketData.java
new file mode 100644 (file)
index 0000000..b7014b2
--- /dev/null
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * 
+ *  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.optf.ticketmgt.service.rs.models;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.onap.optf.ticketmgt.common.Availability;
+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;
+
+@ApiModel(value = "Ticket Data", description = "Change Management Ticket Information.")
+public class TicketData implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private static EELFLogger log = EELFManager.getInstance().getLogger(TicketData.class);
+
+    @ApiModelProperty(value = "Unique ticket identifier")
+    private String id;
+
+    @ApiModelProperty(value = "Scheduled start time of change.")
+    @DateTimeFormat(pattern="yyyy-MM-dd'T'hh:mm:ss'Z'")
+    private Date startTime;
+
+    @ApiModelProperty(value = "Scheduled end time of change.")
+    @DateTimeFormat(pattern="yyyy-MM-dd'T'hh:mm:ss'Z'")
+    private Date endTime;
+
+    @ApiModelProperty(value = "Availability of element(s) during change window")
+    private Availability availability;
+
+    @ApiModelProperty(value = "List elementIds  of elements being changed. At least one maps to elementId in the request")
+    private List<String> elementIds = new ArrayList<>();
+    
+    @ApiModelProperty(value = "Details of the change.")
+    private String changeDetails;
+    public String getId() {
+               return id;
+       }
+
+       public void setId(String id) {
+               this.id = id;
+       }
+
+       public Date getStartTime() {
+               return startTime;
+       }
+
+       public void setStartTime(Date startTime) {
+               this.startTime = startTime;
+       }
+
+       public Date getEndTime() {
+               return endTime;
+       }
+
+       public void setEndTime(Date endTime) {
+               this.endTime = endTime;
+       }
+
+       public Availability getAvailability() {
+               return availability;
+       }
+
+       public void setAvailability(Availability availability) {
+               this.availability = availability;
+       }
+
+       public List<String> getElementIds() {
+               return elementIds;
+       }
+
+       public void setElementIds(List<String> elementIds) {
+               this.elementIds = elementIds;
+       }
+
+       public String getChangeDetails() {
+               return changeDetails;
+       }
+
+       public void setChangeDetails(String changeDetails) {
+               this.changeDetails = changeDetails;
+       }
+
+       public String toString() {
+        ObjectMapper mapper = new ObjectMapper();
+        try {
+            return mapper.writeValueAsString(this);
+        } catch (JsonProcessingException e) {
+            log.debug("Error in toString()", e);
+        }
+        return "";
+    }
+}
diff --git a/cmso-ticketmgt/src/main/resources/META-INF/resources/swagger/index.html b/cmso-ticketmgt/src/main/resources/META-INF/resources/swagger/index.html
new file mode 100644 (file)
index 0000000..d042784
--- /dev/null
@@ -0,0 +1,61 @@
+<!-- HTML for static distribution bundle build -->
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8">
+    <title>Swagger UI</title>
+    <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
+    <link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
+    <link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
+    <link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
+    <style>
+      html
+      {
+        box-sizing: border-box;
+        overflow: -moz-scrollbars-vertical;
+        overflow-y: scroll;
+      }
+
+      *,
+      *:before,
+      *:after
+      {
+        box-sizing: inherit;
+      }
+
+      body
+      {
+        margin:0;
+        background: #fafafa;
+      }
+    </style>
+  </head>
+
+  <body>
+    <div id="swagger-ui"></div>
+
+    <script src="./swagger-ui-bundle.js"> </script>
+    <script src="./swagger-ui-standalone-preset.js"> </script>
+    <script>
+    window.onload = function() {
+
+      // Build a system
+      const ui = SwaggerUIBundle({
+        url: "./swagger.json",
+        dom_id: '#swagger-ui',
+        deepLinking: true,
+        presets: [
+          SwaggerUIBundle.presets.apis,
+          SwaggerUIStandalonePreset
+        ],
+        plugins: [
+          SwaggerUIBundle.plugins.DownloadUrl
+        ],
+        layout: "StandaloneLayout"
+      })
+
+      window.ui = ui
+    }
+  </script>
+  </body>
+</html>