From 8ab201cfb23bff22a6986beba589ce006b215bb7 Mon Sep 17 00:00:00 2001 From: Jerry Flood Date: Wed, 6 Mar 2019 17:29:17 -0500 Subject: Commit 9 for TM API definition 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 --- .../ticketmgt/service/rs/models/NameValue.java | 88 ++++++++++++++ .../ticketmgt/service/rs/models/TicketData.java | 131 +++++++++++++++++++++ 2 files changed, 219 insertions(+) create mode 100644 cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/NameValue.java create mode 100644 cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/TicketData.java (limited to 'cmso-ticketmgt/src/main/java/org') 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 index 0000000..dbbcac7 --- /dev/null +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/NameValue.java @@ -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 index 0000000..b7014b2 --- /dev/null +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/ticketmgt/service/rs/models/TicketData.java @@ -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 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 getElementIds() { + return elementIds; + } + + public void setElementIds(List 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 ""; + } +} -- cgit 1.2.3-korg