From c47d835762dfd4423ab77d3c525a2c541af6b36e Mon Sep 17 00:00:00 2001 From: "RamaPrasad Amaranarayana (ra5425)" Date: Wed, 19 Sep 2018 18:38:46 -0400 Subject: Change Management Schedule Optimization Adding CMSO Service Common Utilities and Table Model Dao Files for Change Management Schedule Optimization Change-Id: I93c0f86598789fae3b3e1bc105a939730a609d97 Issue-ID: OPTFRA-353 Signed-off-by: RamaPrasad Amaranarayana (ra5425) --- .../org/onap/optf/cmso/model/ApprovalType.java | 100 ++++++ .../cmso/model/ChangeManagementChangeWindow.java | 136 ++++++++ .../optf/cmso/model/ChangeManagementDetail.java | 372 +++++++++++++++++++++ .../optf/cmso/model/ChangeManagementGroup.java | 236 +++++++++++++ .../optf/cmso/model/ChangeManagementSchedule.java | 348 +++++++++++++++++++ .../main/java/org/onap/optf/cmso/model/Domain.java | 63 ++++ .../java/org/onap/optf/cmso/model/DomainData.java | 104 ++++++ .../java/org/onap/optf/cmso/model/HelloWorld.java | 58 ++++ .../java/org/onap/optf/cmso/model/Schedule.java | 360 ++++++++++++++++++++ .../org/onap/optf/cmso/model/ScheduleApproval.java | 150 +++++++++ .../org/onap/optf/cmso/model/ScheduleEvent.java | 160 +++++++++ .../org/onap/optf/cmso/model/ScheduleQuery.java | 52 +++ .../onap/optf/cmso/model/dao/ApprovalTypeDAO.java | 52 +++ .../model/dao/ChangeManagementChangeWindowDAO.java | 56 ++++ .../cmso/model/dao/ChangeManagementDetailDAO.java | 41 +++ .../model/dao/ChangeManagementDetailDAOImpl.java | 75 +++++ .../cmso/model/dao/ChangeManagementGroupDAO.java | 53 +++ .../model/dao/ChangeManagementScheduleDAO.java | 77 +++++ .../onap/optf/cmso/model/dao/DomainDataDAO.java | 45 +++ .../optf/cmso/model/dao/ScheduleApprovalDAO.java | 45 +++ .../org/onap/optf/cmso/model/dao/ScheduleDAO.java | 69 ++++ .../onap/optf/cmso/model/dao/ScheduleEventDAO.java | 53 +++ .../onap/optf/cmso/model/dao/ScheduleQueryDAO.java | 41 +++ .../optf/cmso/model/dao/ScheduleQueryDAOImpl.java | 64 ++++ 24 files changed, 2810 insertions(+) create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/Domain.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAO.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java new file mode 100644 index 0000000..d4ab593 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java @@ -0,0 +1,100 @@ +/* + * 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.model; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +/** + * The persistent class for the approval_types database table. + * + */ +@Entity +@Table(name = "APPROVAL_TYPES") +@NamedQuery(name = "ApprovalType.findAll", query = "SELECT a FROM ApprovalType a") +public class ApprovalType implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue + private int id; + + @Column(name = "approval_count") + private int approvalCount; + + @Column(name = "approval_type") + private String approvalType; + + // bi-directional many-to-one association to Domain + @Column(name = "domain") + private String domain; + + public ApprovalType() {} + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public int getApprovalCount() { + return this.approvalCount; + } + + public void setApprovalCount(int approvalCount) { + this.approvalCount = approvalCount; + } + + public String getApprovalType() { + return this.approvalType; + } + + public void setApprovalType(String approvalType) { + this.approvalType = approvalType; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java new file mode 100644 index 0000000..ceece9a --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java @@ -0,0 +1,136 @@ +/* + * 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.model; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Transient; +import org.joda.time.format.ISODateTimeFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * The persistent class for the change_management_change_windows database table. + * + */ +@Entity +@Table(name = "CHANGE_MANAGEMENT_CHANGE_WINDOWS") +@NamedQuery(name = "ChangeManagementChangeWindow.findAll", query = "SELECT c FROM ChangeManagementChangeWindow c") +@ApiModel(value = "Change Window", description = "Desired window within which the VNF changes are to be execututed.") +public class ChangeManagementChangeWindow implements Serializable { + private static final long serialVersionUID = 1L; + + @JsonIgnore + @Id + @GeneratedValue + private int id; + + @JsonIgnore + @Column(name = "finish_time") + private Long finishTimeMillis; + + @ApiModelProperty(value = "Time by which all changes must be completed") + @JsonProperty + @Transient + private String finishTime; + + @JsonIgnore + @Column(name = "start_time") + private Long startTimeMillis; + + @ApiModelProperty(value = "Earliest date/time to initiate changes") + @JsonProperty + @Transient + private String startTime; + + @JsonIgnore + @Column(name = "change_management_groups_id") + private int changeManagementGroupsId; + + public ChangeManagementChangeWindow() {} + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getFinishTime() { + if (finishTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.finishTimeMillis); + return null; + } + + public void setFinishTime(String finishTime) {} + + public String getStartTime() { + if (startTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.startTimeMillis); + return null; + } + + public void setStartTime(String startTime) {} + + public int getChangeManagementGroupsId() { + return changeManagementGroupsId; + } + + public void setChangeManagementGroupsId(int changeManagementGroupsId) { + this.changeManagementGroupsId = changeManagementGroupsId; + } + + public Long getFinishTimeMillis() { + return finishTimeMillis; + } + + public void setFinishTimeMillis(Long finishTimeMillis) { + this.finishTimeMillis = finishTimeMillis; + } + + public Long getStartTimeMillis() { + return startTimeMillis; + } + + public void setStartTimeMillis(Long startTimeMillis) { + this.startTimeMillis = startTimeMillis; + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java new file mode 100644 index 0000000..3b82c62 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java @@ -0,0 +1,372 @@ +/* + * 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.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.Transient; +import org.joda.time.format.ISODateTimeFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@Entity + +// @NamedNativeQueries({ +// @NamedNativeQuery( +// name = "searchScheduleDetails", +// query = "SELECT id, firstName, lastName, email, department.id, department.name " + +// "FROM employee, department", +// resultClass=ChangeManagementDetail.class +// ), +// }) +@ApiModel(value = "Change Management Details", + description = "VNF information returned for Change Management Schedule Search request") +public class ChangeManagementDetail { + @Id + @JsonIgnore + @GeneratedValue + private int id; + + @ApiModelProperty(value = "Name of the VNF.") + @Column(name = "vnf_name") + private String vnfName; + + @JsonIgnore + @Column(name = "vnf_id") + private String vnfId; + + @ApiModelProperty(value = "Status of the VNF.", allowableValues = "See CMSStatusEnum") + @Column(name = "status") + private String status; + + @ApiModelProperty(value = "TM Change Id") + @Column(name = "tm_change_id") + private String tmChangeId; + + @ApiModelProperty(value = "TM ticket status", allowableValues = ",Closed") + @Column(name = "tm_status") + private String tmStatus; + + @ApiModelProperty(value = "TM ticket approval status", allowableValues = ",Approved") + @Column(name = "tm_approval_status") + private String tmApprovalStatus; + + @JsonIgnore + @Column(name = "start_time") + private Long startTimeMillis; + + @ApiModelProperty( + value = "Start time of this VNF workflow assigned by Scheduler based upon the group start time returned by the optimizer and concurrency.") + @JsonProperty + @Transient + private String startTime; + + @JsonIgnore + @Column(name = "finish_time") + private Long finishTimeMillis; + + @ApiModelProperty(value = "Anticipated time of completion based upon start time and duration") + @JsonProperty + @Transient + private String finishTime; + + @ApiModelProperty(value = "Name of the group of VNFs to be scheduled") + @Column(name = "group_id") + private String groupId; + + @JsonIgnore + @Column(name = "last_instance_start_time") + private Long lastInstanceStartTimeMillis; + + @ApiModelProperty(value = "The latest date/time by which a workflow is to be started.") + @JsonProperty + @Transient + private String lastInstanceStartTime; + + @ApiModelProperty(value = "Time of last poll for MSO status.") + @Column(name = "policy_id") + private String policyId; + + @JsonIgnore + @Column(name = "dispatch_time") + private Long dispatchTimeMillis; + + @ApiModelProperty(value = "Actual time the VNF workflow was dispatched.") + @JsonProperty + @Transient + private String dispatchTime; + + @JsonIgnore + @Column(name = "execution_completed_time") + private Long executionCompletedTimeMillis; + + @ApiModelProperty(value = "Actual time the VNF workflow execution was completed as reported by MSO.") + @JsonProperty + @Transient + private String executionCompletedTime; + + @ApiModelProperty(value = "MSO Request ID of the workflow returned at dispatch time.") + @Column(name = "mso_request_id") + private String msoRequestId; + + @ApiModelProperty(value = "Final MSO status.", allowableValues = "COMPLETED,FAILED") + @Column(name = "mso_status") + private String msoStatus; + + @ApiModelProperty(value = "MSO final status message.") + @Lob + @Column(name = "mso_message") + private String msoMessage; + + @ApiModelProperty(value = "Scheduler status message.") + @Lob + @Column(name = "status_message") + private String statusMessage; + + @JsonIgnore + @Column(name = "mso_time") + private Long msoTimeMillis; + + @ApiModelProperty(value = "Time of last poll for MSO status.") + @JsonProperty + @Transient + private String msoTime; + + @JsonIgnore + private int schedules_id; + + public String getVnfName() { + return vnfName; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getTmChangeId() { + return tmChangeId; + } + + public void setTmChangeId(String tmChangeId) { + this.tmChangeId = tmChangeId; + } + + public String getStartTime() { + if (startTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(startTimeMillis); + return null; + } + + public void setStartTime(String startTime) {} + + public String getFinishTime() { + if (finishTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(finishTimeMillis); + return null; + } + + public void setFinishTime(String finishTime) {} + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getLastInstanceStartTime() { + if (lastInstanceStartTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(lastInstanceStartTimeMillis); + return null; + } + + public void setLastInstanceStartTime(String lastInstanceStartTime) {} + + public String getPolicyId() { + return policyId; + } + + public void setPolicyId(String policyId) { + this.policyId = policyId; + } + + public int getSchedulesId() { + return schedules_id; + } + + public void setSchedulesId(int schedules_id) { + this.schedules_id = schedules_id; + } + + public Long getStartTimeMillis() { + return startTimeMillis; + } + + public void setStartTimeMillis(Long startTimeMillis) { + this.startTimeMillis = startTimeMillis; + } + + public Long getFinishTimeMillis() { + return finishTimeMillis; + } + + public void setFinishTimeMillis(Long finishTimeMillis) { + this.finishTimeMillis = finishTimeMillis; + } + + public Long getLastInstanceStartTimeMillis() { + return lastInstanceStartTimeMillis; + } + + public void setLastInstanceStartTimeMillis(Long lastInstanceStartTimeMillis) { + this.lastInstanceStartTimeMillis = lastInstanceStartTimeMillis; + } + + public String getTmStatus() { + return tmStatus; + } + + public void setTmStatus(String tmStatus) { + this.tmStatus = tmStatus; + } + + public String getTmApprovalStatus() { + return tmApprovalStatus; + } + + public void setTmApprovalStatus(String tmApprovalStatus) { + this.tmApprovalStatus = tmApprovalStatus; + } + + public String getMsoRequestId() { + return msoRequestId; + } + + public void setMsoRequestId(String msoRequestId) { + this.msoRequestId = msoRequestId; + } + + public String getMsoStatus() { + return msoStatus; + } + + public void setMsoStatus(String msoStatus) { + this.msoStatus = msoStatus; + } + + public String getMsoMessage() { + return msoMessage; + } + + public void setMsoMessage(String msoMessage) { + this.msoMessage = msoMessage; + } + + public Long getDispatchTimeMillis() { + return dispatchTimeMillis; + } + + public void setDispatchTimeMillis(Long dispatchTimeMillis) { + this.dispatchTimeMillis = dispatchTimeMillis; + } + + public String getDispatchTime() { + if (dispatchTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(dispatchTimeMillis); + return null; + } + + public void setDispatchTime(String dispatchTime) {} + + public Long getExecutionCompletedTimeMillis() { + return executionCompletedTimeMillis; + } + + public void setExecutionCompletedTimeMillis(Long executionCompletedTimeMillis) { + this.executionCompletedTimeMillis = executionCompletedTimeMillis; + } + + public String getExecutionCompletedTime() { + if (executionCompletedTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(executionCompletedTimeMillis); + return null; + } + + public void setExecutionCompletedTime(String executionCompletedTime) {} + + public String getStatusMessage() { + return statusMessage; + } + + public void setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + } + + public Long getMsoTimeMillis() { + return msoTimeMillis; + } + + public void setMsoTimeMillis(Long msoTimeMillis) { + this.msoTimeMillis = msoTimeMillis; + } + + public String getMsoTime() { + if (msoTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(msoTimeMillis); + return null; + } + + public void setMsoTime(String msoTime) {} + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java new file mode 100644 index 0000000..0664851 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java @@ -0,0 +1,236 @@ +/* + * 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.model; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Transient; +import org.joda.time.format.ISODateTimeFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * The persistent class for the change_management_groups database table. + * + */ +@Entity +@Table(name = "CHANGE_MANAGEMENT_GROUPS") +@NamedQuery(name = "ChangeManagementGroup.findAll", query = "SELECT c FROM ChangeManagementGroup c") +@ApiModel(value = "Change Management Group", description = "Scheduling critirea for a group of VNFs") +public class ChangeManagementGroup implements Serializable { + private static final long serialVersionUID = 1L; + + @JsonIgnore + @Id + @GeneratedValue + private int id; + + @JsonIgnore + @Column(name = "finish_time") + private Long finishTimeMillis; + + @ApiModelProperty(value = "Date/time by which all of the workflows should be completed.") + @JsonProperty + @Transient + private String finishTime; + + @ApiModelProperty(value = "Name of the group of VNFs to be scheduled") + @Column(name = "group_id") + private String groupId; + + @JsonIgnore + @Column(name = "last_instance_start_time") + private Long lastInstanceStartTimeMillis; + + @ApiModelProperty(value = "The latest date/time by which a workflow is to be started.") + @JsonProperty + @Transient + private String lastInstanceStartTime; + + @JsonIgnore + @Column(name = "start_time") + private Long startTimeMillis; + + @ApiModelProperty(value = "The date/time when workflows are to be started.") + @JsonProperty + @Transient + private String startTime; + + @JsonIgnore + @Column(name = "schedules_id") + private int schedulesId; + + @Column(name = "additional_duration_in_secs") + @ApiModelProperty(value = "Time added to the workflow interval to allow for rollback in case of failure.") + private int additionalDurationInSecs; + + @ApiModelProperty(value = "The maximum number of workflows that should be started simultaneiously.") + @Column(name = "concurrency_limit") + private int concurrencyLimit; + + @ApiModelProperty(value = "Expected duration of a successful workflow execution.") + @Column(name = "normal_duration_in_secs") + private int normalDurationInSecs; + + @ApiModelProperty( + value = "The name of the schedule optimization policy used by the change management schedule optimizer.") + @Column(name = "policy_id") + private String policyId; + + @ApiModelProperty(value = "The list of VNF workflows scheduled.") + @JsonProperty + @Transient + private List changeManagementSchedules; + + public ChangeManagementGroup() {} + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getFinishTime() { + if (finishTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.finishTimeMillis); + return null; + } + + public void setFinishTime(String finishTime) {} + + public String getGroupId() { + return this.groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getLastInstanceStartTime() { + if (lastInstanceStartTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.lastInstanceStartTimeMillis); + return null; + } + + public void setLastInstanceStartTime(String lastInstanceStartTime) {} + + public String getStartTime() { + if (startTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.startTimeMillis); + return null; + } + + public void setStartTime(String startTime) {} + + public int getSchedulesId() { + return schedulesId; + } + + public void setSchedulesId(int schedulesId) { + this.schedulesId = schedulesId; + } + + public int getAdditionalDurationInSecs() { + return additionalDurationInSecs; + } + + public void setAdditionalDurationInSecs(int additionalDurationInSecs) { + this.additionalDurationInSecs = additionalDurationInSecs; + } + + public int getConcurrencyLimit() { + return concurrencyLimit; + } + + public void setConcurrencyLimit(int concurrencyLimit) { + this.concurrencyLimit = concurrencyLimit; + } + + public int getNormalDurationInSecs() { + return normalDurationInSecs; + } + + public void setNormalDurationInSecs(int normalDurationInSecs) { + this.normalDurationInSecs = normalDurationInSecs; + } + + public String getPolicyId() { + return policyId; + } + + public void setPolicyId(String policyId) { + this.policyId = policyId; + } + + public Long getFinishTimeMillis() { + return finishTimeMillis; + } + + public void setFinishTimeMillis(Long finishTimeMillis) { + this.finishTimeMillis = finishTimeMillis; + } + + public Long getLastInstanceStartTimeMillis() { + return lastInstanceStartTimeMillis; + } + + public void setLastInstanceStartTimeMillis(Long lastInstanceStartTimeMillis) { + this.lastInstanceStartTimeMillis = lastInstanceStartTimeMillis; + } + + public Long getStartTimeMillis() { + return startTimeMillis; + } + + public void setStartTimeMillis(Long startTimeMillis) { + this.startTimeMillis = startTimeMillis; + } + + public List getChangeManagementSchedules() { + return changeManagementSchedules; + } + + public void setChangeManagementSchedules(List changeManagementSchedules) { + this.changeManagementSchedules = changeManagementSchedules; + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java new file mode 100644 index 0000000..779e8ca --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java @@ -0,0 +1,348 @@ +/* + * 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.model; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Transient; +import org.joda.time.format.ISODateTimeFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * The persistent class for the change_management_schedules database table. + * + */ +@Entity +@Table(name = "CHANGE_MANAGEMENT_SCHEDULES") +@NamedQuery(name = "ChangeManagementSchedule.findAll", query = "SELECT c FROM ChangeManagementSchedule c") + +@ApiModel(value = "Change Management Schedule", description = "VNF details for Change Management Schedule") +public class ChangeManagementSchedule implements Serializable { + private static final long serialVersionUID = 1L; + + @JsonIgnore + @Id + @GeneratedValue + private Integer id; + + @ApiModelProperty(value = "TM Change Id") + @Column(name = "tm_change_id") + private String tmChangeId; + + @ApiModelProperty(value = "TM ticket status", allowableValues = ",Closed") + @Column(name = "tm_status") + private String tmStatus; + + @ApiModelProperty(value = "TM ticket approval status", allowableValues = ",Approved") + @Column(name = "tm_approval_status") + private String tmApprovalStatus; + + @JsonIgnore + @Column(name = "finish_time") + private Long finishTimeMillis; + + @JsonProperty + @Transient + @ApiModelProperty(value = "Anticipated time of completion based upon start time and duration") + private String finishTime; + + @JsonIgnore + @Column(name = "start_time") + private Long startTimeMillis; + + @ApiModelProperty( + value = "Start time of this VNF workflow assigned by Scheduler based upon the group start time returned by the optimizer and concurrency.") + @JsonProperty + @Transient + private String startTime; + + @ApiModelProperty(value = "Status of the VNF.", allowableValues = "See CMSStatusEnum") + @Column(name = "status") + private String status; + + @JsonIgnore + @Column(name = "vnf_id") + private String vnfId; + + @ApiModelProperty(value = "Name of the VNF.") + @Column(name = "vnf_name") + private String vnfName; + + @Column(name = "change_management_groups_id") + @JsonIgnore + private int changeManagementGroupsId; + + @JsonIgnore + @Column(name = "dispatch_time") + private Long dispatchTimeMillis; + + @ApiModelProperty(value = "Actual time the VNF workflow was dispatched.") + @JsonProperty + @Transient + private String dispatchTime; + + @JsonIgnore + @Column(name = "dispatcher_instance") + private String dispatcherInstance; + + @JsonIgnore + @Column(name = "execution_completed_time") + private Long executionCompletedTimeMillis; + + @ApiModelProperty(value = "Actual time the VNF workflow execution was completed as reported by MSO.") + @JsonProperty + @Transient + private String executionCompletedTime; + + @ApiModelProperty(value = "MSO Request ID of the workflow returned at dispatch time.") + @Column(name = "mso_request_id") + private String msoRequestId; + + @ApiModelProperty(value = "Final MSO status.", allowableValues = "COMPLETED,FAILED") + @Column(name = "mso_status") + private String msoStatus; + + @ApiModelProperty(value = "MSO final status message.") + @Lob + @Column(name = "mso_message") + private String msoMessage; + + @ApiModelProperty(value = "Scheduler status message.") + @Lob + @Column(name = "status_message") + private String statusMessage; + + @JsonIgnore + @Column(name = "mso_time") + private Long msoTimeMillis; + + @ApiModelProperty(value = "Time of last poll for MSO status.") + @JsonProperty + @Transient + private String msoTime; + + public ChangeManagementSchedule() {} + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getFinishTime() { + if (finishTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(finishTimeMillis); + return null; + } + + public void setFinishTime(String finishTime) {} + + public String getStartTime() { + if (startTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(startTimeMillis); + return null; + } + + public void setStartTime(String startTime) {} + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getVnfId() { + return this.vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVnfName() { + return this.vnfName; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public String getTmChangeId() { + return tmChangeId; + } + + public void setTmChangeId(String tmChangeId) { + this.tmChangeId = tmChangeId; + } + + public int getChangeManagementGroupsId() { + return changeManagementGroupsId; + } + + public void setChangeManagementGroupsId(int changeManagementGroupsId) { + this.changeManagementGroupsId = changeManagementGroupsId; + } + + public String getDispatchTime() { + if (dispatchTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(dispatchTimeMillis); + return null; + } + + public void setDispatchTime(String dispatchTime) {} + + public String getDispatcherInstance() { + return dispatcherInstance; + } + + public void setDispatcherInstance(String dispatcherInstance) { + this.dispatcherInstance = dispatcherInstance; + } + + public String getExecutionCompletedTime() { + if (executionCompletedTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(executionCompletedTimeMillis); + return null; + } + + public void setExecutionCompletedTime(String executionCompletedTime) {} + + public String getMsoRequestId() { + return msoRequestId; + } + + public void setMsoRequestId(String msoRequestId) { + this.msoRequestId = msoRequestId; + } + + public String getStatusMessage() { + return statusMessage; + } + + public void setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + } + + public Long getFinishTimeMillis() { + return finishTimeMillis; + } + + public void setFinishTimeMillis(Long finishTimeMillis) { + this.finishTimeMillis = finishTimeMillis; + } + + public Long getStartTimeMillis() { + return startTimeMillis; + } + + public void setStartTimeMillis(Long startTimeMillis) { + this.startTimeMillis = startTimeMillis; + } + + public Long getDispatchTimeMillis() { + return dispatchTimeMillis; + } + + public void setDispatchTimeMillis(Long dispatchTimeMillis) { + this.dispatchTimeMillis = dispatchTimeMillis; + } + + public Long getExecutionCompletedTimeMillis() { + return executionCompletedTimeMillis; + } + + public void setExecutionCompletedTimeMillis(Long executionCompletedTimeMillis) { + this.executionCompletedTimeMillis = executionCompletedTimeMillis; + } + + public String getMsoStatus() { + return msoStatus; + } + + public void setMsoStatus(String msoStatus) { + this.msoStatus = msoStatus; + } + + public String getMsoMessage() { + return msoMessage; + } + + public void setMsoMessage(String msoMessage) { + this.msoMessage = msoMessage; + } + + public Long getMsoTimeMillis() { + return msoTimeMillis; + } + + public void setMsoTimeMillis(Long msoTimeMillis) { + this.msoTimeMillis = msoTimeMillis; + } + + public String getMsoTime() { + if (msoTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(msoTimeMillis); + return null; + } + + protected void setMsoTime(String msoTime) {} + + public String getTmStatus() { + return tmStatus; + } + + public void setTmStatus(String tmStatus) { + this.tmStatus = tmStatus; + } + + public String getTmApprovalStatus() { + return tmApprovalStatus; + } + + public void setTmApprovalStatus(String tmApprovalStatus) { + this.tmApprovalStatus = tmApprovalStatus; + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/Domain.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/Domain.java new file mode 100644 index 0000000..c7af7c5 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/Domain.java @@ -0,0 +1,63 @@ +/* + * 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.model; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +/** + * The persistent class for the domains database table. + * + */ +@Entity +@Table(name = "DOMAINS") +@NamedQuery(name = "Domain.findAll", query = "SELECT d FROM Domain d") +public class Domain implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private String domain; + + public Domain() {} + + public String getDomain() { + return this.domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java new file mode 100644 index 0000000..f32ff98 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java @@ -0,0 +1,104 @@ +/* + * 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.model; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; + +/** + * The persistent class for the domain_data database table. + * + */ +@Entity +@Table(name = "DOMAIN_DATA") +@NamedQuery(name = "DomainData.findAll", query = "SELECT d FROM DomainData d") +@ApiModel(value = "Domain data", description = "Domain specific data represented as name/value pairs") +public class DomainData implements Serializable { + private static final long serialVersionUID = 1L; + + @JsonIgnore + @Id + @GeneratedValue + private int id; + + private String name; + + private String value; + + @ManyToOne(optional = true) + @JoinColumn(name = "schedules_id", nullable = false, updatable = false) + @JsonIgnore + private Schedule schedule; + + public DomainData() {} + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + public Schedule getSchedule() { + return schedule; + } + + public void setSchedule(Schedule schedule) { + this.schedule = schedule; + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java new file mode 100644 index 0000000..ed09ad7 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java @@ -0,0 +1,58 @@ +/* + * 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.model; + +public class HelloWorld { + + private String message; + + public HelloWorld() { + // needed for deserializer + } + + public HelloWorld(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public String toString() { + return "message = " + getMessage(); + } +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java new file mode 100644 index 0000000..3a13563 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java @@ -0,0 +1,360 @@ +/* + * 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.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Transient; +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; +import org.joda.time.format.ISODateTimeFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +/** + * The persistent class for the schedules database table. + * + */ +@Entity +@Table(name = "SCHEDULES") +@NamedQuery(name = "Schedule.findAll", query = "SELECT s FROM Schedule s") +public class Schedule implements Serializable { + private static final long serialVersionUID = 1L; + + @JsonIgnore + @Id + @GeneratedValue + private int id; + + @JsonIgnore + @Column(name = "create_date_time") + private Long createDateTimeMillis; + + @ApiModelProperty(value = "Date/time schedule was created.") + @JsonProperty + @Transient + private String createDateTime; + + @ApiModelProperty(value = "Date/time optimizer was invoked.") + @JsonIgnore + @Column(name = "optimizer_date_time") + private Long optimizerDateTimeMillis; + + @JsonProperty + @Transient + private String optimizerDateTime; + + @Lob + @Column(name = "optimizer_message") + private String optimizerMessage; + + @Column(name = "optimizer_status") + private String optimizerStatus; + + @JsonIgnore + @Column(name = "optimizer_attempts_to_schedule") + private int optimizerAttemptsToSchedule; + + @JsonIgnore + @Column(name = "optimizer_return_date_time") + private Long optimizerReturnDateTimeMillis; + + @JsonProperty + @Transient + private String optimizerReturnDateTime; + + @Column(name = "optimizer_transaction_id") + private String optimizerTransactionId; + + @Lob + @Column(name = "schedule") + private String schedule; + + @JsonIgnore + @Column(name = "schedule_id") + private String scheduleId; + + @Column(name = "schedule_name") + private String scheduleName; + + @Lob + @Column(name = "schedule_info") + private String scheduleInfo; + + @Column(name = "status") + private String status; + + @Column(name = "user_id") + private String userId; + + @Column(name = "domain") + private String domain; + + @JsonIgnore + @Column(name = "delete_date_time") + private Long deleteDateTimeMillis; + + @JsonProperty + @Transient + private String deleteDateTime; + + @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "schedule") + @LazyCollection(value = LazyCollectionOption.FALSE) + // @JoinColumn(name="schedules_id") + private List domainData; + // + // //uni-directional many-to-one association to ScheduleApproval + @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "schedule") + @LazyCollection(value = LazyCollectionOption.FALSE) + private List scheduleApprovals; + // + // //bi-directional many-to-one association to Domain + // @ManyToOne + // @JoinColumn(name="domain") + // private Domain domainBean; + + @JsonProperty + @Transient + List groups; + + public Schedule() {} + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getCreateDateTime() { + if (createDateTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.createDateTimeMillis); + return null; + } + + public void setCreateDateTime(String datetime) { + // only set time via setCreateDateTimeMillis + } + + public void setCreateDateTimeMillis(Long millis) { + this.createDateTimeMillis = millis; + } + + public long getCreateDateTimeMillis() { + return this.createDateTimeMillis; + } + + public Long getDeleteDateTimeMillis() { + return deleteDateTimeMillis; + } + + public void setDeleteDateTimeMillis(Long deleteDateTimeMillis) { + this.deleteDateTimeMillis = deleteDateTimeMillis; + } + + public String getDeleteDateTime() { + if (deleteDateTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.deleteDateTimeMillis); + return null; + } + + public void setDeleteDateTime(String deleteDateTime) {} + + public String getOptimizerDateTime() { + if (optimizerDateTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.optimizerDateTimeMillis); + return null; + } + + public void setOptimizerDateTime(String optimizerDateTime) {} + + public String getOptimizerMessage() { + return this.optimizerMessage; + } + + public void setOptimizerMessage(String optimizerMessage) { + this.optimizerMessage = optimizerMessage; + } + + public String getOptimizerStatus() { + return this.optimizerStatus; + } + + public void setOptimizerStatus(String optimizerStatus) { + this.optimizerStatus = optimizerStatus; + } + + public String getSchedule() { + return this.schedule; + } + + public void setSchedule(String schedule) { + this.schedule = schedule; + } + + public String getScheduleId() { + return this.scheduleId; + } + + public void setScheduleId(String scheduleId) { + this.scheduleId = scheduleId; + } + + public String getScheduleName() { + return this.scheduleName; + } + + public void setScheduleName(String scheduleName) { + this.scheduleName = scheduleName; + } + + public String getScheduleInfo() { + return this.scheduleInfo; + } + + public void setScheduleInfo(String scheduleInfo) { + this.scheduleInfo = scheduleInfo; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getUserId() { + return this.userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public List getDomainData() { + return domainData; + } + + public List getScheduleApprovals() { + return scheduleApprovals; + } + + public DomainData addDomainData(DomainData domainData) { + List list = getDomainData(); + if (list == null) + list = new ArrayList(); + list.add(domainData); + domainData.setSchedule(this); + return domainData; + } + + public ScheduleApproval addScheduleApproval(ScheduleApproval sa) { + List list = getScheduleApprovals(); + if (list == null) + list = new ArrayList(); + list.add(sa); + sa.setSchedule(this); + return sa; + } + + public int getOptimizerAttemptsToSchedule() { + return optimizerAttemptsToSchedule; + } + + public void setOptimizerAttemptsToSchedule(int optimizerAttemptsToSchedule) { + this.optimizerAttemptsToSchedule = optimizerAttemptsToSchedule; + } + + public String getOptimizerReturnDateTime() { + if (optimizerReturnDateTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.optimizerReturnDateTimeMillis); + return null; + } + + public void setOptimizerReturnDateTime(String optimizerReturnDateTime) { + + } + + public String getOptimizerTransactionId() { + return optimizerTransactionId; + } + + public void setOptimizerTransactionId(String optimizerTransactionId) { + this.optimizerTransactionId = optimizerTransactionId; + } + + public Long getOptimizerDateTimeMillis() { + return optimizerDateTimeMillis; + } + + public void setOptimizerDateTimeMillis(Long optimizerDateTimeMillis) { + this.optimizerDateTimeMillis = optimizerDateTimeMillis; + } + + public Long getOptimizerReturnDateTimeMillis() { + return optimizerReturnDateTimeMillis; + } + + public void setOptimizerReturnDateTimeMillis(Long optimizerReturnDateTimeMillis) { + this.optimizerReturnDateTimeMillis = optimizerReturnDateTimeMillis; + } + + public List getGroups() { + return groups; + } + + public void setGroups(List groups) { + this.groups = groups; + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java new file mode 100644 index 0000000..adfafd1 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java @@ -0,0 +1,150 @@ +/* + * 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.model; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Transient; +import org.joda.time.format.ISODateTimeFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * The persistent class for the schedule_approvals database table. + * + */ +@Entity +@Table(name = "SCHEDULE_APPROVALS") +@NamedQuery(name = "ScheduleApproval.findAll", query = "SELECT s FROM ScheduleApproval s") +@ApiModel(value = "Schedule Approval", description = "Details of a schedule approval/rejection.") +public class ScheduleApproval implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue + @JsonIgnore + private int id; + + @JsonIgnore + @Column(name = "approval_date_time") + private Long approvalDateTimeMillis; + + @ApiModelProperty(value = "Date/time schedule time slot was accepted/rejected.") + @JsonProperty + @Transient + private String approvalDateTime; + + @ApiModelProperty(value = "Approval status.", allowableValues = "Accepted,Rejected") + @Column(name = "status") + private String status; + + @ApiModelProperty(value = "ATTUID of the user accepting/rejecting the time slot.") + @Column(name = "user_id") + private String userId; + + @ManyToOne(optional = true) + @JoinColumn(name = "schedules_id", nullable = false, updatable = false) + @JsonIgnore + private Schedule schedule; + + @JsonIgnore + @Column(name = "approval_type_id") + private Integer approvalTypeId; + + public ScheduleApproval() {} + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getApprovalDateTime() { + if (approvalDateTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.approvalDateTimeMillis); + return null; + } + + public void setApprovalDateTime(String approvalDateTime) {} + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getUserId() { + return this.userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public Integer getApprovalTypeId() { + return approvalTypeId; + } + + public void setApprovalTypeId(Integer approvalTypeId) { + this.approvalTypeId = approvalTypeId; + } + + public void setSchedule(Schedule schedule) { + this.schedule = schedule; + } + + public Schedule getSchedule() { + return schedule; + } + + public Long getApprovalDateTimeMillis() { + return approvalDateTimeMillis; + } + + public void setApprovalDateTimeMillis(Long approvalDateTimeMillis) { + this.approvalDateTimeMillis = approvalDateTimeMillis; + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java new file mode 100644 index 0000000..97a96f0 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java @@ -0,0 +1,160 @@ +/* + * 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.model; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Transient; +import org.joda.time.format.ISODateTimeFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The persistent class for the schedule_events database table. + * + */ +@Entity +@Table(name = "SCHEDULE_EVENTS") +@NamedQuery(name = "ScheduleEvent.findAll", query = "SELECT s FROM ScheduleEvent s") +public class ScheduleEvent implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + private int id; + + private String domain; + + @Lob + @Column(name = "event_text") + private String eventText; + + @JsonIgnore + @Column(name = "event_time") + private Long eventTimeMillis; + + @JsonProperty + @Transient + private String eventTime; + + @JsonIgnore + @Column(name = "reminder_time") + private Long reminderTimeMillis; + + @JsonProperty + @Transient + private String reminderTime; + + @Column(name = "schedules_id") + private int schedulesId; + + private String status; + + public ScheduleEvent() {} + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getDomain() { + return this.domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public String getEventText() { + return this.eventText; + } + + public void setEventText(String eventText) { + this.eventText = eventText; + } + + public int getSchedulesId() { + return this.schedulesId; + } + + public void setSchedulesId(int schedulesId) { + this.schedulesId = schedulesId; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Long getEventTimeMillis() { + return eventTimeMillis; + } + + public void setEventTimeMillis(Long eventTimeMillis) { + this.eventTimeMillis = eventTimeMillis; + } + + public String getEventTime() { + if (eventTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.eventTimeMillis); + return null; + } + + public void setEventTime(String eventTime) {} + + public Long getReminderTimeMillis() { + return reminderTimeMillis; + } + + public void setReminderTimeMillis(Long reminderTimeMillis) { + this.reminderTimeMillis = reminderTimeMillis; + } + + public String getReminderTime() { + if (reminderTimeMillis != null) + return ISODateTimeFormat.dateTimeNoMillis().print(this.reminderTimeMillis); + return null; + } + + public void setReminderTime(String reminderTime) {} + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java new file mode 100644 index 0000000..84d3e5c --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java @@ -0,0 +1,52 @@ +/* + * 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.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class ScheduleQuery { + @Id + @Column(name = "id") + private Integer id; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java new file mode 100644 index 0000000..7eb2430 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java @@ -0,0 +1,52 @@ +/* + * 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.model.dao; + +import java.util.List; +import java.util.Optional; +import org.onap.optf.cmso.model.ApprovalType; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface ApprovalTypeDAO extends PagingAndSortingRepository { + Optional findById(Integer id); + + ApprovalType save(ApprovalType persisted); + + void delete(ApprovalType toDelete); + + @Query(value = "SELECT d FROM ApprovalType d WHERE d.domain = ?1 AND d.approvalType = ?2") + ApprovalType findByDomainAndType(String domain, String type); + + @Query(value = "SELECT d FROM ApprovalType d WHERE d.domain = ?1") + List findByDomain(String domain); +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java new file mode 100644 index 0000000..293209e --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java @@ -0,0 +1,56 @@ +/* + * 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.model.dao; + +import java.util.List; +import java.util.Optional; +import org.onap.optf.cmso.model.ChangeManagementChangeWindow; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface ChangeManagementChangeWindowDAO + extends PagingAndSortingRepository { + Optional findById(Integer id); + + ChangeManagementChangeWindow save(ChangeManagementChangeWindow persisted); + + void delete(ChangeManagementChangeWindow toDelete); + + @Query(value = "SELECT d FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupsId = ?1") + List findByGroupsID(Integer id); + + @Modifying + @Query(value = "DELETE FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupsId = ?1") + int deleteByChangeManagementGroupId(int id); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAO.java new file mode 100644 index 0000000..7dabf5e --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAO.java @@ -0,0 +1,41 @@ +/* + * 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.model.dao; + +import java.util.List; +import org.onap.optf.cmso.model.ChangeManagementDetail; + +public interface ChangeManagementDetailDAO { + + List searchScheduleDetails(String where, int limit); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java new file mode 100644 index 0000000..2c083d6 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java @@ -0,0 +1,75 @@ +/* + * 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.model.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import org.onap.optf.cmso.model.ChangeManagementDetail; +import org.springframework.stereotype.Repository; + +@Repository +public class ChangeManagementDetailDAOImpl implements ChangeManagementDetailDAO { + @PersistenceContext + private EntityManager manager; + + @Override + public List searchScheduleDetails(String where, int limit) { + StringBuilder sql = new StringBuilder(); + sql.append("select distinct" + " s.id as id," + " s.vnf_name as vnf_name," + " s.vnf_id as vnf_id," + + " s.status as status," + " s.tm_change_id as tm_change_Id," + " s.start_time as start_time," + + " s.finish_time as finish_time," + " s.mso_request_id as mso_request_id," + + " s.mso_status as mso_status," + " s.mso_message as mso_message," + " s.mso_time as mso_time," + + " s.dispatch_time as dispatch_time," + " s.execution_completed_time as execution_completed_time," + + " s.status_message as status_message," + " s.tm_approval_status as tm_approval_status," + + " s.tm_status as tm_status," + " g.group_id as group_id," + + " g.last_instance_start_time as last_instance_start_time," + " g.policy_id as policy_id," + + " g.schedules_id as schedules_id" + // + " ss.schedule_id as scheduleId," + // + " dd.name" + + " from" + " CHANGE_MANAGEMENT_SCHEDULES s" + + " inner join CHANGE_MANAGEMENT_GROUPS g on s.change_management_groups_id = g.id" + + " inner join SCHEDULES ss on g.schedules_id = ss.id " + + " left outer join DOMAIN_DATA dd on ss.id = dd.schedules_id" + + " left outer join SCHEDULE_APPROVALS sa on ss.id = sa.schedules_id" + + " left outer join APPROVAL_TYPES at on sa.approval_type_id = at.id "); + sql.append(where); + sql.append(" order by id "); + if (limit > 0) + sql.append("LIMIT " + limit); + + Query q = manager.createNativeQuery(sql.toString(), ChangeManagementDetail.class); + List list = q.getResultList(); + return list; + } +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java new file mode 100644 index 0000000..39f4baa --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java @@ -0,0 +1,53 @@ +/* + * 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.model.dao; + +import java.util.List; +import java.util.Optional; +import org.onap.optf.cmso.model.ChangeManagementGroup; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface ChangeManagementGroupDAO extends PagingAndSortingRepository { + Optional findById(Integer id); + + ChangeManagementGroup save(ChangeManagementGroup persisted); + + void delete(ChangeManagementGroup toDelete); + + @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesId = ?1") + List findBySchedulesID(Integer id); + + @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesId = ?1 AND d.groupId = ?2") + ChangeManagementGroup findOneBySchedulesIDGroupID(Integer id, String groupId); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java new file mode 100644 index 0000000..a089c2b --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java @@ -0,0 +1,77 @@ +/* + * 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.model.dao; + +import java.util.List; +import java.util.Optional; +import javax.persistence.LockModeType; +import org.onap.optf.cmso.model.ChangeManagementSchedule; +import org.springframework.data.jpa.repository.Lock; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface ChangeManagementScheduleDAO extends PagingAndSortingRepository { + Optional findById(Integer id); + + ChangeManagementSchedule save(ChangeManagementSchedule persisted); + + void delete(ChangeManagementSchedule toDelete); + + @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupsId = ?1") + List findByChangeManagementGroupId(Integer id); + + @Modifying + @Query(value = "DELETE FROM ChangeManagementSchedule d WHERE d.changeManagementGroupsId = ?1") + public int deleteByChangeManagementGroupsId(Integer id); + + @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupsId = ?1 AND d.vnfName = ?2") + ChangeManagementSchedule findOneByGroupIDAndVnfName(Integer id, String vnfName); + + @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE (d.status = ?1 AND d.startTimeMillis <= ?2) or d.status = 'Scheduled Immediate' order by d.startTimeMillis") + List findByStatusAndEndTime(String status, Long date); + + @Modifying + @Query(value = "Update ChangeManagementSchedule d set d.status = 'Scheduled', d.dispatcherInstance = '' WHERE d.status = 'Queued for Dispatch' AND d.dispatcherInstance = ?1") + public int requeueQueuedForDispatch(String dispatcherInstance); + + @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.status = 'Triggered'") + List findAllTriggered(); + + @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.tmApprovalStatus = 'Pending Approval'") + List findAllAwaitingTmApproval(); + + @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.id = ?1") + @Lock(LockModeType.PESSIMISTIC_WRITE) + ChangeManagementSchedule lockOne(Integer id); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java new file mode 100644 index 0000000..9556938 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java @@ -0,0 +1,45 @@ +/* + * 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.model.dao; + +import java.util.Optional; +import org.onap.optf.cmso.model.DomainData; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface DomainDataDAO extends PagingAndSortingRepository { + Optional findById(Integer id); + + DomainData save(DomainData persisted); + + void delete(DomainData toDelete); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java new file mode 100644 index 0000000..d9badd0 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java @@ -0,0 +1,45 @@ +/* + * 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.model.dao; + +import java.util.Optional; +import org.onap.optf.cmso.model.ScheduleApproval; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface ScheduleApprovalDAO extends PagingAndSortingRepository { + Optional findById(Integer id); + + ScheduleApproval save(ScheduleApproval persisted); + + void delete(ScheduleApproval toDelete); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java new file mode 100644 index 0000000..f68fd22 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java @@ -0,0 +1,69 @@ +/* + * 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.model.dao; + +import java.util.List; +import java.util.Optional; +import javax.persistence.LockModeType; +import org.onap.optf.cmso.model.Schedule; +import org.springframework.data.jpa.repository.Lock; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface ScheduleDAO extends PagingAndSortingRepository { + Optional findById(Integer id); + + Schedule save(Schedule persited); + + void delete(Schedule toDelete); + + @Query(value = "SELECT s FROM Schedule s WHERE s.domain = ?1 AND s.scheduleId= ?2 ") + Schedule findByDomainScheduleID(String domain, String scheduleId); + + @Query(value = "SELECT s FROM Schedule s WHERE s.domain = ?1 AND s.status = ?2 ") + List findByDomainStatus(String domain, String Status); + + @Query(value = "SELECT s FROM Schedule s WHERE s.optimizerTransactionId= ?1") + Schedule findOneByTransactionId(String transactionId); + + @Query(value = "SELECT s FROM Schedule s WHERE s.domain = ?1 AND s.status = 'Notifications Initiated'") + List findAllInProgress(String string); + + @Query(value = "SELECT d FROM Schedule d WHERE d.id = ?1") + @Lock(LockModeType.PESSIMISTIC_WRITE) + Schedule lockOne(Integer id); + + @Query(value = "SELECT s FROM Schedule s WHERE s.optimizerTransactionId= ?1") + @Lock(LockModeType.PESSIMISTIC_WRITE) + Schedule lockOneByTransactionId(String transactionId); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java new file mode 100644 index 0000000..c3c2483 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java @@ -0,0 +1,53 @@ +/* + * 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.model.dao; + +import java.util.List; +import java.util.Optional; +import org.onap.optf.cmso.model.ScheduleEvent; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface ScheduleEventDAO extends PagingAndSortingRepository { + Optional findById(Integer id); + + ScheduleEvent save(ScheduleEvent persisted); + + void delete(ScheduleEvent toDelete); + + @Query(value = "SELECT d FROM ScheduleEvent d WHERE d.schedulesId = ?1") + List findByScheduleId(Integer id); + + @Query(value = "SELECT d FROM ScheduleEvent d WHERE d.status = ?1 AND d.reminderTimeMillis <= ?2") + List findByStatusAndEndTime(String status, Long date); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAO.java new file mode 100644 index 0000000..f974eb5 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAO.java @@ -0,0 +1,41 @@ +/* + * 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.model.dao; + +import java.util.List; +import org.onap.optf.cmso.model.ScheduleQuery; + +public interface ScheduleQueryDAO { + + List searchSchedules(String where, int limit); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java new file mode 100644 index 0000000..37fbf52 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java @@ -0,0 +1,64 @@ +/* + * 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.model.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import org.onap.optf.cmso.model.ScheduleQuery; +import org.springframework.stereotype.Repository; + +@Repository +public class ScheduleQueryDAOImpl implements ScheduleQueryDAO { + @PersistenceContext + private EntityManager manager; + + @Override + public List searchSchedules(String where, int limit) { + StringBuilder sql = new StringBuilder(); + sql.append("select distinct" + " ss.id as id" + " from" + " SCHEDULES ss" + + " left outer join CHANGE_MANAGEMENT_GROUPS g on ss.id = g.schedules_id" + + " left outer join CHANGE_MANAGEMENT_SCHEDULES s on g.id = s.change_management_groups_id" + + " left outer join DOMAIN_DATA dd on ss.id = dd.schedules_id" + + " left outer join SCHEDULE_APPROVALS sa on ss.id = sa.schedules_id" + + " left outer join APPROVAL_TYPES at on sa.approval_type_id = at.id "); + sql.append(where); + sql.append(" order by id "); + if (limit > 0) + sql.append("LIMIT " + limit); + + Query q = manager.createNativeQuery(sql.toString(), ScheduleQuery.class); + List list = q.getResultList(); + return list; + } +} -- cgit 1.2.3-korg