Change Management Schedule Optimization 27/67927/1
authorRamaPrasad Amaranarayana (ra5425) <ra5425@att.com>
Wed, 19 Sep 2018 22:38:46 +0000 (18:38 -0400)
committerRamaPrasad Amaranarayana (ra5425) <ra5425@att.com>
Wed, 19 Sep 2018 22:38:46 +0000 (18:38 -0400)
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) <ra5425@att.com>
24 files changed:
cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/Domain.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAO.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java [new file with mode: 0644]

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