summaryrefslogtreecommitdiffstats
path: root/cmso-service
diff options
context:
space:
mode:
authorJerry Flood <jflood@att.com>2019-03-19 16:43:06 -0400
committerJerry Flood <jflood@att.com>2019-03-19 16:43:34 -0400
commit2ce511263486d6002df45920eb99aa5d0e5fb527 (patch)
treec1c9187dc195211a6e61dbcfad8258525ff92384 /cmso-service
parentca6b4dad4d74ce7a46ec7bf1b0c54a3947f3e970 (diff)
DB Upgrade code re-factoring
Changed DB generated keys to UUID Issue-ID: OPTFRA-459 Change-Id: Ic9314e580478c1db76c4c39e88c577908b2f0f0e Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-service')
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java7
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java13
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java8
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java16
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java16
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java24
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java49
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java39
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java48
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java46
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java28
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java58
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java32
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java52
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java163
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java23
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java18
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java20
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java18
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java27
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java15
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java53
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java18
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java5
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java27
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleService.java (renamed from cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/CMSOOptimizedScheduleService.java)0
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleServiceImpl.java (renamed from cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/CMSOOptimizedScheduleServiceImpl.java)0
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizerCallbackImpl.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java51
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java342
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java6
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java11
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java15
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java17
39 files changed, 574 insertions, 739 deletions
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java
index 880566a..f29d6c6 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java
@@ -32,6 +32,7 @@
package org.onap.optf.cmso.dispatcher;
import java.util.Map;
+import java.util.UUID;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@@ -103,19 +104,19 @@ public class CmJob implements Job {
public void execute(JobExecutionContext context) throws JobExecutionException {
Mdc.quartzJobBegin(context);
debug.debug(LogMessages.CM_JOB, "Entered");
- Integer id = context.getJobDetail().getJobDataMap().getInt("key");
+ String id = context.getJobDetail().getJobDataMap().getString("key");
try {
// Hand this off to a transactional service
loopback(id);
} catch (Exception e) {
log.warn("Unexpected exception", e);
} finally {
- dispatchedEventList.remove(id);
+ dispatchedEventList.remove(UUID.fromString(id));
}
debug.debug(LogMessages.CM_JOB, "Exited");
}
- public void loopback(Integer id) {
+ public void loopback(String id) {
Map<String, String> mdcSave = Mdc.save();
try {
String url = env.getProperty("cmso.dispatch.url", "http://localhost:8089");
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java
index cb8597f..60d8bdb 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,8 @@ import java.net.InetAddress;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
+import java.util.UUID;
+
import org.onap.optf.cmso.common.CMSStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.model.ChangeManagementGroup;
@@ -52,6 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.eelf.i18n.EELFResourceManager;
@@ -86,15 +89,15 @@ public class DispatchJob {
@Autowired
Environment env;
- public void execute(Integer id) throws JobExecutionException {
+ public void execute(UUID id) throws JobExecutionException {
debug.debug(LogMessages.CM_JOB, "Entered");
try {
// No other instance can read this cmso until we are done.
ChangeManagementSchedule cmSchedule = cmScheduleDAO.lockOne(id);
cmSchedule.setDispatcherInstance(InetAddress.getLocalHost().getHostAddress());
- ChangeManagementGroup group = cmGroupDAO.findById(cmSchedule.getChangeManagementGroupsId()).orElse(null);
+ ChangeManagementGroup group = cmGroupDAO.findById(cmSchedule.getChangeManagementGroupUuid()).orElse(null);
if (group != null) {
- Schedule schedule = scheduleDAO.findById(group.getSchedulesId()).orElse(null);
+ Schedule schedule = scheduleDAO.findById(group.getSchedulesUuid()).orElse(null);
if (schedule != null) {
schedule.setStatus(CMSStatusEnum.NotificationsInitiated.toString());
if (safeToDispatch(cmSchedule, schedule))
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java
index adc3260..3c53759 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java
@@ -59,7 +59,7 @@ public interface DispacherService {
@ApiOperation(value = "", notes = "Does dispsatch of provided cm schedule id.", response = Integer.class)
@ApiResponses(
value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Request failed")})
- public Response dispatchSchedule(@ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") Integer id,
+ public Response dispatchSchedule(@ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") String id,
@Context UriInfo uri, @Context HttpServletRequest request);
// ******************************************************************
@@ -70,7 +70,7 @@ public interface DispacherService {
@ApiResponses(
value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Request failed")})
public Response dispatchOptimizer(
- @ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") Integer id, @Context UriInfo uri,
+ @ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") String id, @Context UriInfo uri,
@Context HttpServletRequest request);
// ******************************************************************
@@ -81,7 +81,7 @@ public interface DispacherService {
@ApiResponses(
value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Request failed")})
public Response dispatchScheduleStatus(
- @ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") Integer id, @Context UriInfo uri,
+ @ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") String id, @Context UriInfo uri,
@Context HttpServletRequest request);
// ******************************************************************
@@ -91,7 +91,7 @@ public interface DispacherService {
@ApiOperation(value = "", notes = "Does dispsatch of provided cm schedule id.", response = Integer.class)
@ApiResponses(
value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Request failed")})
- public Response dispatchSoStatus(@ApiParam(value = "Identifier", allowMultiple = true) @PathParam("id") Integer id,
+ public Response dispatchSoStatus(@ApiParam(value = "Identifier", allowMultiple = true) @PathParam("id") String id,
@Context UriInfo uri, @Context HttpServletRequest request);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
index 67a69cb..feea350 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
@@ -31,6 +31,8 @@
package org.onap.optf.cmso.dispatcher.rs;
+import java.util.UUID;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
@@ -68,10 +70,11 @@ public class DispatcherServiceImpl implements DispacherService {
@Override
@Transactional
- public Response dispatchSchedule(Integer id, UriInfo uri, HttpServletRequest request) {
+ public Response dispatchSchedule(String id, UriInfo uri, HttpServletRequest request) {
debug.debug("dispatchSchedule entered {}" , id);
try {
- dispatchJob.execute(id);
+ UUID uuid = UUID.fromString(id);
+ dispatchJob.execute(uuid);
} catch (Exception e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
@@ -82,10 +85,11 @@ public class DispatcherServiceImpl implements DispacherService {
@Override
@Transactional
- public Response dispatchOptimizer(Integer id, UriInfo uri, HttpServletRequest request) {
+ public Response dispatchOptimizer(String id, UriInfo uri, HttpServletRequest request) {
debug.debug("dispatchOptimizer entered {}", id);
try {
- optimizerClient.scheduleOptimization(id);
+ UUID uuid = UUID.fromString(id);
+ optimizerClient.scheduleOptimization(uuid);
} catch (Exception e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
@@ -97,7 +101,7 @@ public class DispatcherServiceImpl implements DispacherService {
@Override
@Transactional
- public Response dispatchScheduleStatus(Integer id, UriInfo uri, HttpServletRequest request) {
+ public Response dispatchScheduleStatus(String id, UriInfo uri, HttpServletRequest request) {
debug.debug("dispatchScheduleStatus entered {}", id);
try {
tmStatusClient.checkStatus(id);
@@ -111,7 +115,7 @@ public class DispatcherServiceImpl implements DispacherService {
@Override
@Transactional
- public Response dispatchSoStatus(Integer id, UriInfo uri, HttpServletRequest request) {
+ public Response dispatchSoStatus(String id, UriInfo uri, HttpServletRequest request) {
debug.debug("dispatchSoStatus entered {}", id);
try {
msoStatusClient.execute(id);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java
index 59df59f..0987f8b 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -87,9 +87,9 @@ public class CMSQueueJob {
return false;
for (ChangeManagementSchedule schedule : schedules) {
try {
- if (!dispatchedEventList.isAlreadyDispatched(schedule.getId())) {
+ if (!dispatchedEventList.isAlreadyDispatched(schedule.getUuid())) {
scheduleCmJob(schedule);
- dispatchedEventList.addToDispathcedEventList(schedule.getId());
+ dispatchedEventList.addToDispathcedEventList(schedule.getUuid());
}
} catch (org.quartz.SchedulerException e) {
debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
@@ -118,7 +118,7 @@ public class CMSQueueJob {
dispatchTime = startTime - dispatherLeadTime;
JobDetail jobDetail = JobBuilder.newJob(CmJob.class).build();
- jobDetail.getJobDataMap().put("key", schedule.getId());
+ jobDetail.getJobDataMap().put("key", schedule.getUuid().toString());
TriggerBuilder<Trigger> tb = TriggerBuilder.newTrigger().forJob(jobDetail);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java
index 0c346d3..3e02cd1 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +33,8 @@ package org.onap.optf.cmso.eventq;
import java.util.HashSet;
import java.util.Set;
+import java.util.UUID;
+
import org.springframework.stereotype.Component;
/**
@@ -45,18 +47,18 @@ import org.springframework.stereotype.Component;
@Component
public class DispatchedEventList {
- private Set<Integer> list = new HashSet<>();
+ private Set<UUID> list = new HashSet<>();
- public synchronized void addToDispathcedEventList(Integer id) {
+ public synchronized void addToDispathcedEventList(UUID id) {
list.add(id);
}
- public synchronized void remove(Integer id) {
+ public synchronized void remove(UUID id) {
list.remove(id);
}
- public synchronized boolean isAlreadyDispatched(Integer id) {
- return list.contains(id);
+ public synchronized boolean isAlreadyDispatched(UUID uuid) {
+ return list.contains(uuid);
}
}
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
index 121774b..6009040 100644
--- 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
@@ -32,10 +32,10 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@@ -51,8 +51,7 @@ public class ApprovalType implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@Column(name = "approval_count")
private Integer approvalCount;
@@ -66,15 +65,18 @@ public class ApprovalType implements Serializable {
public ApprovalType() {}
- public Integer getId() {
- return this.id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
- public Integer getApprovalCount() {
+ public Integer getApprovalCount() {
return this.approvalCount;
}
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
index 7224508..210e61a 100644
--- 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
@@ -32,17 +32,20 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -59,8 +62,7 @@ public class ChangeManagementChangeWindow implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@JsonIgnore
@Column(name = "finish_time")
@@ -81,18 +83,11 @@ public class ChangeManagementChangeWindow implements Serializable {
private String startTime;
@JsonIgnore
- @Column(name = "change_management_groups_id")
- private Integer changeManagementGroupsId;
+ @Column(name = "change_management_group_uuid")
+ private UUID changeManagementGroupUuid;
public ChangeManagementChangeWindow() {}
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
public String getFinishTime() {
if (finishTimeMillis != null)
@@ -110,15 +105,29 @@ public class ChangeManagementChangeWindow implements Serializable {
public void setStartTime(String startTime) {}
- public Integer getChangeManagementGroupsId() {
- return changeManagementGroupsId;
- }
- public void setChangeManagementGroupsId(Integer changeManagementGroupsId) {
- this.changeManagementGroupsId = changeManagementGroupsId;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+
+ public UUID getChangeManagementGroupUuid() {
+ return changeManagementGroupUuid;
+ }
+
+
+ public void setChangeManagementGroupUuid(UUID changeManagementGroupUuid) {
+ this.changeManagementGroupUuid = changeManagementGroupUuid;
+ }
+
- public Long getFinishTimeMillis() {
+ public Long getFinishTimeMillis() {
return finishTimeMillis;
}
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
index 31c4a2b..4f0e804 100644
--- 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
@@ -31,16 +31,19 @@
package org.onap.optf.cmso.model;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -59,8 +62,7 @@ import io.swagger.annotations.ApiModelProperty;
public class ChangeManagementDetail {
@Id
@JsonIgnore
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@ApiModelProperty(value = "Name of the VNF.")
@Column(name = "vnf_name")
@@ -168,7 +170,8 @@ public class ChangeManagementDetail {
private String msoTime;
@JsonIgnore
- private Integer schedules_id;
+ @Column(name = "schedules_uuid")
+ private UUID schedulesUuid;
public String getVnfName() {
return vnfName;
@@ -242,15 +245,27 @@ public class ChangeManagementDetail {
this.policyId = policyId;
}
- public Integer getSchedulesId() {
- return schedules_id;
- }
- public void setSchedulesId(Integer schedules_id) {
- this.schedules_id = schedules_id;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+
+
+ public UUID getSchedulesUuid() {
+ return schedulesUuid;
+ }
+
+ public void setSchedulesUuid(UUID schedulesUuid) {
+ this.schedulesUuid = schedulesUuid;
+ }
- public Long getStartTimeMillis() {
+ public Long getStartTimeMillis() {
return startTimeMillis;
}
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
index 6aeb325..39efb3f 100644
--- 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
@@ -33,17 +33,20 @@ package org.onap.optf.cmso.model;
import java.io.Serializable;
import java.util.List;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -60,8 +63,7 @@ public class ChangeManagementGroup implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@JsonIgnore
@Column(name = "finish_time")
@@ -95,8 +97,8 @@ public class ChangeManagementGroup implements Serializable {
private String startTime;
@JsonIgnore
- @Column(name = "schedules_id")
- private Integer schedulesId;
+ @Column(name = "schedules_uuid")
+ private UUID schedulesUuid;
@Column(name = "additional_duration_in_secs")
@ApiModelProperty(value = "Time added to the workflow interval to allow for rollback in case of failure.")
@@ -122,13 +124,6 @@ public class ChangeManagementGroup implements Serializable {
public ChangeManagementGroup() {}
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
public String getFinishTime() {
if (finishTimeMillis != null)
@@ -162,13 +157,6 @@ public class ChangeManagementGroup implements Serializable {
public void setStartTime(String startTime) {}
- public Integer getSchedulesId() {
- return schedulesId;
- }
-
- public void setSchedulesId(Integer schedulesId) {
- this.schedulesId = schedulesId;
- }
public Integer getAdditionalDurationInSecs() {
return additionalDurationInSecs;
@@ -234,4 +222,24 @@ public class ChangeManagementGroup implements Serializable {
this.changeManagementSchedules = changeManagementSchedules;
}
+
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+ public UUID getSchedulesUuid() {
+ return schedulesUuid;
+ }
+
+
+ public void setSchedulesUuid(UUID schedulesUuid) {
+ this.schedulesUuid = schedulesUuid;
+ }
+
}
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
index 9690290..680fc99 100644
--- 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
@@ -32,18 +32,21 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -61,8 +64,7 @@ public class ChangeManagementSchedule implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@ApiModelProperty(value = "TM Change Id")
@Column(name = "tm_change_id")
@@ -107,9 +109,9 @@ public class ChangeManagementSchedule implements Serializable {
@Column(name = "vnf_name")
private String vnfName;
- @Column(name = "change_management_groups_id")
+ @Column(name = "change_management_group_uuid")
@JsonIgnore
- private Integer changeManagementGroupsId;
+ private UUID changeManagementGroupUuid;
@JsonIgnore
@Column(name = "dispatch_time")
@@ -162,14 +164,6 @@ public class ChangeManagementSchedule implements Serializable {
public ChangeManagementSchedule() {}
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
public String getFinishTime() {
if (finishTimeMillis != null)
return ISODateTimeFormat.dateTimeNoMillis().print(finishTimeMillis);
@@ -218,15 +212,25 @@ public class ChangeManagementSchedule implements Serializable {
this.tmChangeId = tmChangeId;
}
- public Integer getChangeManagementGroupsId() {
- return changeManagementGroupsId;
- }
- public void setChangeManagementGroupsId(Integer changeManagementGroupsId) {
- this.changeManagementGroupsId = changeManagementGroupsId;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+ public UUID getChangeManagementGroupUuid() {
+ return changeManagementGroupUuid;
+ }
+
+ public void setChangeManagementGroupUuid(UUID changeManagementGroupUuid) {
+ this.changeManagementGroupUuid = changeManagementGroupUuid;
+ }
- public String getDispatchTime() {
+ public String getDispatchTime() {
if (dispatchTimeMillis != null)
return ISODateTimeFormat.dateTimeNoMillis().print(dispatchTimeMillis);
return null;
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
index fc86964..3bb0bea 100644
--- 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
@@ -32,15 +32,17 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
+
import io.swagger.annotations.ApiModel;
/**
@@ -56,29 +58,31 @@ public class DomainData implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
private String name;
private String value;
@ManyToOne(optional = true)
- @JoinColumn(name = "schedules_id", nullable = false, updatable = false)
+ @JoinColumn(name = "schedules_uuid", nullable = false, updatable = false)
@JsonIgnore
private Schedule schedule;
public DomainData() {}
- public Integer getId() {
- return this.id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
- public String getName() {
+ public String getName() {
return this.name;
}
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
deleted file mode 100644
index ed09ad7..0000000
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.onap.optf.cmso.model;
-
-public class HelloWorld {
-
- private String message;
-
- public HelloWorld() {
- // needed for deserializer
- }
-
- public HelloWorld(String message) {
- this.message = message;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- @Override
- public String toString() {
- return "message = " + getMessage();
- }
-}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java
index d6fe4f9..624e376 100644
--- 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
@@ -34,22 +34,25 @@ package org.onap.optf.cmso.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
+
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModelProperty;
/**
@@ -64,8 +67,7 @@ public class Schedule implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@JsonIgnore
@Column(name = "create_date_time")
@@ -160,15 +162,23 @@ public class Schedule implements Serializable {
public Schedule() {}
- public Integer getId() {
- return this.id;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
- public void setId(Integer id) {
- this.id = id;
- }
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+ public void setDomainData(List<DomainData> domainData) {
+ this.domainData = domainData;
+ }
+
+ public void setScheduleApprovals(List<ScheduleApproval> scheduleApprovals) {
+ this.scheduleApprovals = scheduleApprovals;
+ }
- public String getCreateDateTime() {
+ public String getCreateDateTime() {
if (createDateTimeMillis != null)
return ISODateTimeFormat.dateTimeNoMillis().print(this.createDateTimeMillis);
return null;
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
index dee3c42..3239ae3 100644
--- 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
@@ -32,19 +32,22 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -60,9 +63,8 @@ public class ScheduleApproval implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
@JsonIgnore
- private Integer id;
+ private UUID uuid;
@JsonIgnore
@Column(name = "approval_date_time")
@@ -82,23 +84,16 @@ public class ScheduleApproval implements Serializable {
private String userId;
@ManyToOne(optional = true)
- @JoinColumn(name = "schedules_id", nullable = false, updatable = false)
+ @JoinColumn(name = "schedules_uuid", nullable = false, updatable = false)
@JsonIgnore
private Schedule schedule;
@JsonIgnore
- @Column(name = "approval_type_id")
- private Integer approvalTypeId;
+ @Column(name = "approval_types_uuid")
+ private UUID approvalTypesUuid;
public ScheduleApproval() {}
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
public String getApprovalDateTime() {
if (approvalDateTimeMillis != null)
@@ -124,13 +119,6 @@ public class ScheduleApproval implements Serializable {
this.userId = userId;
}
- public Integer getApprovalTypeId() {
- return approvalTypeId;
- }
-
- public void setApprovalTypeId(Integer approvalTypeId) {
- this.approvalTypeId = approvalTypeId;
- }
public void setSchedule(Schedule schedule) {
this.schedule = schedule;
@@ -148,4 +136,26 @@ public class ScheduleApproval implements Serializable {
this.approvalDateTimeMillis = approvalDateTimeMillis;
}
+
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+ public UUID getApprovalTypesUuid() {
+ return approvalTypesUuid;
+ }
+
+
+ public void setApprovalTypesUuid(UUID approvalTypesUuid) {
+ this.approvalTypesUuid = approvalTypesUuid;
+ }
+
+
+
}
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
deleted file mode 100644
index 46cb46e..0000000
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.onap.optf.cmso.model;
-
-import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Lob;
-import javax.persistence.NamedQuery;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import org.joda.time.format.ISODateTimeFormat;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * The persistent class for the schedule_events database table.
- *
- */
-@Entity
-@Table(name = "SCHEDULE_EVENTS")
-@NamedQuery(name = "ScheduleEvent.findAll", query = "SELECT s FROM ScheduleEvent s")
-public class ScheduleEvent implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
-
- private String domain;
-
- @Lob
- @Column(name = "event_text")
- private String eventText;
-
- @JsonIgnore
- @Column(name = "event_time")
- private Long eventTimeMillis;
-
- @JsonProperty
- @Transient
- private String eventTime;
-
- @JsonIgnore
- @Column(name = "reminder_time")
- private Long reminderTimeMillis;
-
- @JsonProperty
- @Transient
- private String reminderTime;
-
- @Column(name = "schedules_id")
- private Integer schedulesId;
-
- private String status;
-
- public ScheduleEvent() {}
-
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getDomain() {
- return this.domain;
- }
-
- public void setDomain(String domain) {
- this.domain = domain;
- }
-
- public String getEventText() {
- return this.eventText;
- }
-
- public void setEventText(String eventText) {
- this.eventText = eventText;
- }
-
- public Integer getSchedulesId() {
- return this.schedulesId;
- }
-
- public void setSchedulesId(Integer schedulesId) {
- this.schedulesId = schedulesId;
- }
-
- public String getStatus() {
- return this.status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public Long getEventTimeMillis() {
- return eventTimeMillis;
- }
-
- public void setEventTimeMillis(Long eventTimeMillis) {
- this.eventTimeMillis = eventTimeMillis;
- }
-
- public String getEventTime() {
- if (eventTimeMillis != null)
- return ISODateTimeFormat.dateTimeNoMillis().print(this.eventTimeMillis);
- return null;
- }
-
- public void setEventTime(String eventTime) {}
-
- public Long getReminderTimeMillis() {
- return reminderTimeMillis;
- }
-
- public void setReminderTimeMillis(Long reminderTimeMillis) {
- this.reminderTimeMillis = reminderTimeMillis;
- }
-
- public String getReminderTime() {
- if (reminderTimeMillis != null)
- return ISODateTimeFormat.dateTimeNoMillis().print(this.reminderTimeMillis);
- return null;
- }
-
- public void setReminderTime(String reminderTime) {}
-
-}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java
index 84d3e5c..628fc6f 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +31,8 @@
package org.onap.optf.cmso.model;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@@ -38,15 +40,16 @@ import javax.persistence.Id;
@Entity
public class ScheduleQuery {
@Id
- @Column(name = "id")
- private Integer id;
+ @Column(name = "uuid")
+ private UUID uuid;
+
+ public UUID getUuid() {
+ return uuid;
+ }
- public Integer getId() {
- return id;
- }
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
- public void setId(Integer id) {
- this.id = id;
- }
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java
index 7eb2430..9e4b546 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,12 +33,14 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.ApprovalType;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ApprovalTypeDAO extends PagingAndSortingRepository<ApprovalType, Integer> {
- Optional<ApprovalType> findById(Integer id);
+public interface ApprovalTypeDAO extends PagingAndSortingRepository<ApprovalType, UUID> {
+ Optional<ApprovalType> findById(UUID id);
ApprovalType save(ApprovalType persisted);
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
index 293209e..303be20 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,24 +33,26 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.ChangeManagementChangeWindow;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ChangeManagementChangeWindowDAO
- extends PagingAndSortingRepository<ChangeManagementChangeWindow, Integer> {
- Optional<ChangeManagementChangeWindow> findById(Integer id);
+ extends PagingAndSortingRepository<ChangeManagementChangeWindow, UUID> {
+ Optional<ChangeManagementChangeWindow> findById(UUID id);
ChangeManagementChangeWindow save(ChangeManagementChangeWindow persisted);
void delete(ChangeManagementChangeWindow toDelete);
- @Query(value = "SELECT d FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupsId = ?1")
- List<ChangeManagementChangeWindow> findByGroupsID(Integer id);
+ @Query(value = "SELECT d FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupUuid = ?1")
+ List<ChangeManagementChangeWindow> findByGroupsUUID(UUID id);
@Modifying
- @Query(value = "DELETE FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupsId = ?1")
- int deleteByChangeManagementGroupId(int id);
+ @Query(value = "DELETE FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupUuid = ?1")
+ int deleteByChangeManagementGroupUuid(UUID id);
}
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
index 2c083d6..028241c 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class ChangeManagementDetailDAOImpl implements ChangeManagementDetailDAO
@Override
public List<ChangeManagementDetail> searchScheduleDetails(String where, int limit) {
StringBuilder sql = new StringBuilder();
- sql.append("select distinct" + " s.id as id," + " s.vnf_name as vnf_name," + " s.vnf_id as vnf_id,"
+ sql.append("select distinct" + " s.uuid as uuid," + " s.vnf_name as vnf_name," + " s.vnf_id as vnf_id,"
+ " s.status as status," + " s.tm_change_id as tm_change_Id," + " s.start_time as start_time,"
+ " s.finish_time as finish_time," + " s.mso_request_id as mso_request_id,"
+ " s.mso_status as mso_status," + " s.mso_message as mso_message," + " s.mso_time as mso_time,"
@@ -54,17 +54,17 @@ public class ChangeManagementDetailDAOImpl implements ChangeManagementDetailDAO
+ " s.status_message as status_message," + " s.tm_approval_status as tm_approval_status,"
+ " s.tm_status as tm_status," + " g.group_id as group_id,"
+ " g.last_instance_start_time as last_instance_start_time," + " g.policy_id as policy_id,"
- + " g.schedules_id as schedules_id"
+ + " g.schedules_uuid as schedules_uuid"
// + " ss.schedule_id as scheduleId,"
// + " dd.name"
+ " from" + " CHANGE_MANAGEMENT_SCHEDULES s"
- + " inner join CHANGE_MANAGEMENT_GROUPS g on s.change_management_groups_id = g.id"
- + " inner join SCHEDULES ss on g.schedules_id = ss.id "
- + " left outer join DOMAIN_DATA dd on ss.id = dd.schedules_id"
- + " left outer join SCHEDULE_APPROVALS sa on ss.id = sa.schedules_id"
- + " left outer join APPROVAL_TYPES at on sa.approval_type_id = at.id ");
+ + " inner join CHANGE_MANAGEMENT_GROUPS g on s.change_management_group_uuid = g.uuid"
+ + " inner join SCHEDULES ss on g.schedules_uuid = ss.uuid "
+ + " left outer join DOMAIN_DATA dd on ss.uuid = dd.schedules_uuid"
+ + " left outer join SCHEDULE_APPROVALS sa on ss.uuid = sa.schedules_uuid"
+ + " left outer join APPROVAL_TYPES at on sa.approval_types_uuid = at.uuid ");
sql.append(where);
- sql.append(" order by id ");
+ sql.append(" order by uuid ");
if (limit > 0)
sql.append("LIMIT " + limit);
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
index 39f4baa..7acc228 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,21 +33,23 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.ChangeManagementGroup;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ChangeManagementGroupDAO extends PagingAndSortingRepository<ChangeManagementGroup, Integer> {
- Optional<ChangeManagementGroup> findById(Integer id);
+public interface ChangeManagementGroupDAO extends PagingAndSortingRepository<ChangeManagementGroup, UUID> {
+ Optional<ChangeManagementGroup> findById(UUID id);
ChangeManagementGroup save(ChangeManagementGroup persisted);
void delete(ChangeManagementGroup toDelete);
- @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesId = ?1")
- List<ChangeManagementGroup> findBySchedulesID(Integer id);
+ @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesUuid = ?1")
+ List<ChangeManagementGroup> findBySchedulesID(UUID id);
- @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesId = ?1 AND d.groupId = ?2")
- ChangeManagementGroup findOneBySchedulesIDGroupID(Integer id, String groupId);
+ @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesUuid = ?1 AND d.groupId = ?2")
+ ChangeManagementGroup findOneBySchedulesIDGroupID(UUID id, String groupId);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java
index a089c2b..ad01a34 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,29 +33,32 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import javax.persistence.LockModeType;
+
import org.onap.optf.cmso.model.ChangeManagementSchedule;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ChangeManagementScheduleDAO extends PagingAndSortingRepository<ChangeManagementSchedule, Integer> {
- Optional<ChangeManagementSchedule> findById(Integer id);
+public interface ChangeManagementScheduleDAO extends PagingAndSortingRepository<ChangeManagementSchedule, UUID> {
+ Optional<ChangeManagementSchedule> findById(UUID id);
ChangeManagementSchedule save(ChangeManagementSchedule persisted);
void delete(ChangeManagementSchedule toDelete);
- @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupsId = ?1")
- List<ChangeManagementSchedule> findByChangeManagementGroupId(Integer id);
+ @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupUuid = ?1")
+ List<ChangeManagementSchedule> findByChangeManagementGroupId(UUID id);
@Modifying
- @Query(value = "DELETE FROM ChangeManagementSchedule d WHERE d.changeManagementGroupsId = ?1")
- public int deleteByChangeManagementGroupsId(Integer id);
+ @Query(value = "DELETE FROM ChangeManagementSchedule d WHERE d.changeManagementGroupUuid = ?1")
+ public int deleteByChangeManagementGroupsId(UUID id);
- @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupsId = ?1 AND d.vnfName = ?2")
- ChangeManagementSchedule findOneByGroupIDAndVnfName(Integer id, String vnfName);
+ @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupUuid = ?1 AND d.vnfName = ?2")
+ ChangeManagementSchedule findOneByGroupIDAndVnfName(UUID id, String vnfName);
@Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE (d.status = ?1 AND d.startTimeMillis <= ?2) or d.status = 'Scheduled Immediate' order by d.startTimeMillis")
List<ChangeManagementSchedule> findByStatusAndEndTime(String status, Long date);
@@ -70,8 +73,8 @@ public interface ChangeManagementScheduleDAO extends PagingAndSortingRepository<
@Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.tmApprovalStatus = 'Pending Approval'")
List<ChangeManagementSchedule> findAllAwaitingTmApproval();
- @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.id = ?1")
+ @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.uuid = ?1")
@Lock(LockModeType.PESSIMISTIC_WRITE)
- ChangeManagementSchedule lockOne(Integer id);
+ ChangeManagementSchedule lockOne(UUID id);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java
index 9556938..75299a1 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,11 +32,13 @@
package org.onap.optf.cmso.model.dao;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.DomainData;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface DomainDataDAO extends PagingAndSortingRepository<DomainData, Integer> {
- Optional<DomainData> findById(Integer id);
+public interface DomainDataDAO extends PagingAndSortingRepository<DomainData, UUID> {
+ Optional<DomainData> findById(UUID id);
DomainData save(DomainData persisted);
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
index d9badd0..3fabd63 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,11 +32,13 @@
package org.onap.optf.cmso.model.dao;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.ScheduleApproval;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ScheduleApprovalDAO extends PagingAndSortingRepository<ScheduleApproval, Integer> {
- Optional<ScheduleApproval> findById(Integer id);
+public interface ScheduleApprovalDAO extends PagingAndSortingRepository<ScheduleApproval, UUID> {
+ Optional<ScheduleApproval> findById(UUID id);
ScheduleApproval save(ScheduleApproval persisted);
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
index f68fd22..90843c4 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,14 +33,17 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import javax.persistence.LockModeType;
+
import org.onap.optf.cmso.model.Schedule;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ScheduleDAO extends PagingAndSortingRepository<Schedule, Integer> {
- Optional<Schedule> findById(Integer id);
+public interface ScheduleDAO extends PagingAndSortingRepository<Schedule, UUID> {
+ Optional<Schedule> findById(UUID id);
Schedule save(Schedule persited);
@@ -58,9 +61,9 @@ public interface ScheduleDAO extends PagingAndSortingRepository<Schedule, Intege
@Query(value = "SELECT s FROM Schedule s WHERE s.domain = ?1 AND s.status = 'Notifications Initiated'")
List<Schedule> findAllInProgress(String string);
- @Query(value = "SELECT d FROM Schedule d WHERE d.id = ?1")
+ @Query(value = "SELECT d FROM Schedule d WHERE d.uuid = ?1")
@Lock(LockModeType.PESSIMISTIC_WRITE)
- Schedule lockOne(Integer id);
+ Schedule lockOne(UUID id);
@Query(value = "SELECT s FROM Schedule s WHERE s.optimizerTransactionId= ?1")
@Lock(LockModeType.PESSIMISTIC_WRITE)
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
deleted file mode 100644
index c3c2483..0000000
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.onap.optf.cmso.model.dao;
-
-import java.util.List;
-import java.util.Optional;
-import org.onap.optf.cmso.model.ScheduleEvent;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.PagingAndSortingRepository;
-
-public interface ScheduleEventDAO extends PagingAndSortingRepository<ScheduleEvent, Integer> {
- Optional<ScheduleEvent> findById(Integer id);
-
- ScheduleEvent save(ScheduleEvent persisted);
-
- void delete(ScheduleEvent toDelete);
-
- @Query(value = "SELECT d FROM ScheduleEvent d WHERE d.schedulesId = ?1")
- List<ScheduleEvent> findByScheduleId(Integer id);
-
- @Query(value = "SELECT d FROM ScheduleEvent d WHERE d.status = ?1 AND d.reminderTimeMillis <= ?2")
- List<ScheduleEvent> findByStatusAndEndTime(String status, Long date);
-
-}
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
index 37fbf52..80bb7f0 100644
--- 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
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,14 +46,14 @@ public class ScheduleQueryDAOImpl implements ScheduleQueryDAO {
@Override
public List<ScheduleQuery> searchSchedules(String where, int limit) {
StringBuilder sql = new StringBuilder();
- sql.append("select distinct" + " ss.id as id" + " from" + " SCHEDULES ss"
- + " left outer join CHANGE_MANAGEMENT_GROUPS g on ss.id = g.schedules_id"
- + " left outer join CHANGE_MANAGEMENT_SCHEDULES s on g.id = s.change_management_groups_id"
- + " left outer join DOMAIN_DATA dd on ss.id = dd.schedules_id"
- + " left outer join SCHEDULE_APPROVALS sa on ss.id = sa.schedules_id"
- + " left outer join APPROVAL_TYPES at on sa.approval_type_id = at.id ");
+ sql.append("select distinct" + " ss.uuid as uuid" + " from" + " SCHEDULES ss"
+ + " left outer join CHANGE_MANAGEMENT_GROUPS g on ss.uuid = g.schedules_uuid"
+ + " left outer join CHANGE_MANAGEMENT_SCHEDULES s on g.uuid = s.change_management_group_uuid"
+ + " left outer join DOMAIN_DATA dd on ss.uuid = dd.schedules_uuid"
+ + " left outer join SCHEDULE_APPROVALS sa on ss.uuid = sa.schedules_uuid"
+ + " left outer join APPROVAL_TYPES at on sa.approval_types_uuid = at.uuid ");
sql.append(where);
- sql.append(" order by id ");
+ sql.append(" order by uuid ");
if (limit > 0)
sql.append("LIMIT " + limit);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java
index 9feea2d..a773798 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java
@@ -85,7 +85,7 @@ public class CMSOptimizerClient {
@Autowired
PropertiesManagement pm;
- public boolean scheduleOptimization(Integer id) {
+ public boolean scheduleOptimization(UUID uuid) {
Map<String, String> mdcSave = Mdc.save();
try {
String optimizerurl = env.getProperty("cmso.optimizer.url");
@@ -94,7 +94,7 @@ public class CMSOptimizerClient {
Integer maxAttempts = env.getProperty("cmso.optimizer.maxAttempts", Integer.class, 20);
// Ensure that only one cmso is requsting this call to optimizer
- Schedule schedule = scheduleDAO.lockOne(id);
+ Schedule schedule = scheduleDAO.lockOne(uuid);
if (!schedule.getStatus().equals(CMSStatusEnum.PendingSchedule.toString()))
return false;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
index 39d590b..12d56f3 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
@@ -33,6 +33,8 @@ package org.onap.optf.cmso.optimizer;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
+
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;
@@ -57,6 +59,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -107,7 +110,7 @@ public class OptimizerQuartzJob extends QuartzJobBean {
}
public void scheduleOptimization(Schedule s) {
- Integer id = s.getId();
+ UUID id = s.getUuid();
Map<String, String> mdcSave = Mdc.save();
try {
String url = env.getProperty("cmso.dispatch.url", "http://localhost:8089");
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java
index 2e0cfeb..787bd60 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java
@@ -35,7 +35,10 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
+
import javax.ws.rs.core.Response.Status;
+
import org.onap.optf.cmso.common.ApprovalStatusEnum;
import org.onap.optf.cmso.common.CMSStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
@@ -54,6 +57,7 @@ import org.onap.optf.cmso.service.rs.models.ApprovalMessage;
import org.onap.optf.cmso.service.rs.models.ScheduleMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -82,6 +86,7 @@ public class BaseSchedulerServiceImpl {
throw new CMSAlreadyExistsException(scheduleMessage.getDomain(), scheduleMessage.getScheduleId());
}
s = new Schedule();
+ s.setUuid(UUID.randomUUID());
s.setUserId(scheduleMessage.getUserId());
s.setCreateDateTimeMillis(System.currentTimeMillis());
s.setDomain(scheduleMessage.getDomain());
@@ -96,6 +101,7 @@ public class BaseSchedulerServiceImpl {
s.setStatus(CMSStatusEnum.PendingSchedule.toString());
scheduleDAO.save(s);
for (DomainData dd : domainData) {
+ dd.setUuid(UUID.randomUUID());
s.addDomainData(dd);
domainDataDAO.save(dd);
}
@@ -153,15 +159,16 @@ public class BaseSchedulerServiceImpl {
if (s.getScheduleApprovals() != null) {
for (ScheduleApproval scheduleApproval : s.getScheduleApprovals()) {
if (scheduleApproval.getUserId().equals(approvalMessage.getApprovalUserId())
- && scheduleApproval.getApprovalTypeId().equals(approvalType.getId())) {
+ && scheduleApproval.getApprovalTypesUuid().equals(approvalType.getUuid())) {
sa = scheduleApproval;
}
}
}
if (sa == null) {
sa = new ScheduleApproval();
+ sa.setUuid(UUID.randomUUID());
sa.setSchedule(s);
- sa.setApprovalTypeId(approvalType.getId());
+ sa.setApprovalTypesUuid(approvalType.getUuid());
sa.setUserId(approvalMessage.getApprovalUserId());
}
// Ignore what time is on the message
@@ -181,18 +188,18 @@ public class BaseSchedulerServiceImpl {
}
private boolean allApprovalsReceived(Schedule schedule, ScheduleApproval sa) {
- Map<Integer, Integer> requiredApprovalsByType = new HashMap<Integer, Integer>(); // Approval
+ Map<UUID, Integer> requiredApprovalsByType = new HashMap<>(); // Approval
// countdown
- Map<Integer, ApprovalType> approvalsByType = new HashMap<Integer, ApprovalType>(); // Just
+ Map<UUID, ApprovalType> approvalsByType = new HashMap<>(); // Just
// for
// logging
List<ApprovalType> approvalTypes = approvalTypeDAO.findByDomain(schedule.getDomain());
for (ApprovalType at : approvalTypes) {
- Integer type = at.getId();
+ UUID type = at.getUuid();
Integer count = at.getApprovalCount();
requiredApprovalsByType.put(type, count);
- approvalsByType.put(at.getId(), at);
+ approvalsByType.put(at.getUuid(), at);
}
// Account for approvals so far
@@ -205,17 +212,17 @@ public class BaseSchedulerServiceImpl {
}
for (ScheduleApproval approval : existingApprovals) {
if (approval.getStatus().equals(ApprovalStatusEnum.Accepted.toString())) {
- Integer remaining = requiredApprovalsByType.get(approval.getApprovalTypeId());
+ Integer remaining = requiredApprovalsByType.get(approval.getApprovalTypesUuid());
if (remaining != null) {
remaining = remaining - 1;
- requiredApprovalsByType.put(approval.getApprovalTypeId(), remaining);
+ requiredApprovalsByType.put(approval.getApprovalTypesUuid(), remaining);
} else {
- log.warn("Ignored Unidentified approval type {0} for domain {1}", approval.getApprovalTypeId(),
+ log.warn("Ignored Unidentified approval type {0} for domain {1}", approval.getApprovalTypesUuid(),
schedule.getDomain());
}
}
}
- for (Integer id : requiredApprovalsByType.keySet()) {
+ for (UUID id : requiredApprovalsByType.keySet()) {
Integer remaining = requiredApprovalsByType.get(id);
if (remaining > 0) {
return false;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/CMSOOptimizedScheduleService.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleService.java
index c0806d7..c0806d7 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/CMSOOptimizedScheduleService.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleService.java
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/CMSOOptimizedScheduleServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleServiceImpl.java
index aa397ae..aa397ae 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/CMSOOptimizedScheduleServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleServiceImpl.java
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizerCallbackImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizerCallbackImpl.java
index 679dd02..50d2ff2 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizerCallbackImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizerCallbackImpl.java
@@ -167,7 +167,7 @@ public class CMSOOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen
DateTime latestInstanceStartTime =
convertDate(sniroSchedule.getLatestInstanceStartTime(), "latestInstanceStartTime");
DateTime startTime = convertDate(sniroSchedule.getStartTime(), "startTime");
- ChangeManagementGroup group = cmGroupDAO.findOneBySchedulesIDGroupID(schedule.getId(), groupId);
+ ChangeManagementGroup group = cmGroupDAO.findOneBySchedulesIDGroupID(schedule.getUuid(), groupId);
if (group == null) {
throw new CMSException(Status.PRECONDITION_FAILED,
LogMessages.CHANGE_MANAGEMENT_GROUP_NOT_FOUND, schedule.getScheduleId(), groupId);
@@ -232,7 +232,7 @@ public class CMSOOptimizerCallbackImpl extends BaseSchedulerServiceImpl implemen
private void processNode(Schedule schedule, ChangeManagementGroup group, String node,
Map<String, Map<String, Long>> startAndFinishTimeMap) throws CMSException {
Map<String, Long> map = startAndFinishTimeMap.get(node);
- ChangeManagementSchedule detail = cmScheduleDAO.findOneByGroupIDAndVnfName(group.getId(), node);
+ ChangeManagementSchedule detail = cmScheduleDAO.findOneByGroupIDAndVnfName(group.getUuid(), node);
if (detail == null) {
throw new CMSException(Status.NOT_FOUND, LogMessages.UNABLE_TO_LOCATE_SCHEDULE_DETAIL,
schedule.getScheduleId(), group.getGroupId(), node);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java
index d65dd25..cc304db 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java
@@ -39,6 +39,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
+import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.MultivaluedMap;
@@ -143,15 +144,15 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
}
Iterator<ScheduleQuery> iter = list.iterator();
while (iter.hasNext()) {
- Schedule s = scheduleDAO.findById(iter.next().getId()).orElse(null);
+ Schedule s = scheduleDAO.findById(iter.next().getUuid()).orElse(null);
if (s != null) {
schedules.add(s);
if (includeDetails) {
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getId());
+ List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getUuid());
s.setGroups(groups);
for (ChangeManagementGroup g : groups) {
List<ChangeManagementSchedule> cmSchedules =
- cmScheduleDAO.findByChangeManagementGroupId(g.getId());
+ cmScheduleDAO.findByChangeManagementGroupId(g.getUuid());
g.setChangeManagementSchedules(cmSchedules);
}
}
@@ -300,7 +301,8 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
CMSInfo schedulingInfo = scheduleMessage.getSchedulingInfo();
for (VnfDetailsMessage vnfDetail : schedulingInfo.getVnfDetails()) {
ChangeManagementGroup cmg = new ChangeManagementGroup();
- cmg.setSchedulesId(schedule.getId());
+ cmg.setUuid(UUID.randomUUID());
+ cmg.setSchedulesUuid(schedule.getUuid());
cmg.setGroupId("");
if (vnfDetail.getGroupId() != null)
cmg.setGroupId(vnfDetail.getGroupId());
@@ -311,7 +313,8 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
cmGroupDAO.save(cmg);
for (ChangeWindowMessage cw : vnfDetail.getChangeWindow()) {
ChangeManagementChangeWindow cmcw = new ChangeManagementChangeWindow();
- cmcw.setChangeManagementGroupsId(cmg.getId());
+ cmcw.setUuid(UUID.randomUUID());
+ cmcw.setChangeManagementGroupUuid(cmg.getUuid());
DateTime start = CMSOOptimizerCallbackImpl.convertISODate(cw.getStartTime(), "startTime");
DateTime end = CMSOOptimizerCallbackImpl.convertISODate(cw.getEndTime(), "startTime");
cmcw.setStartTimeMillis(start.getMillis());
@@ -321,7 +324,8 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
for (String vnf : vnfDetail.getNode()) {
ChangeManagementSchedule cms = new ChangeManagementSchedule();
- cms.setChangeManagementGroupsId(cmg.getId());
+ cms.setUuid(UUID.randomUUID());
+ cms.setChangeManagementGroupUuid(cmg.getUuid());
cms.setVnfName(vnf);
cms.setStatus(CMSStatusEnum.PendingSchedule.toString());
cmScheduleDAO.save(cms);
@@ -333,7 +337,8 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
CMSInfo schedulingInfo = scheduleMessage.getSchedulingInfo();
for (VnfDetailsMessage vnfDetail : schedulingInfo.getVnfDetails()) {
ChangeManagementGroup cmg = new ChangeManagementGroup();
- cmg.setSchedulesId(schedule.getId());
+ cmg.setUuid(UUID.randomUUID());
+ cmg.setSchedulesUuid(schedule.getUuid());
cmg.setGroupId("");
int duration = schedulingInfo.getNormalDurationInSeconds();
int backout = schedulingInfo.getAdditionalDurationInSeconds();
@@ -346,20 +351,22 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
cmGroupDAO.save(cmg);
for (String vnf : vnfDetail.getNode()) {
ChangeManagementSchedule cms = new ChangeManagementSchedule();
- cms.setChangeManagementGroupsId(cmg.getId());
+ cms.setUuid(UUID.randomUUID());
+ cms.setChangeManagementGroupUuid(cmg.getUuid());
cms.setVnfName(vnf);
cms.setStatus(CMSStatusEnum.PendingApproval.toString());
cmScheduleDAO.save(cms);
}
schedule.setStatus(CMSStatusEnum.PendingApproval.toString());
+ scheduleDAO.save(schedule);
}
}
private void deleteChangeManagement(Schedule schedule) throws CMSException {
- List<ChangeManagementGroup> cmgs = cmGroupDAO.findBySchedulesID(schedule.getId());
+ List<ChangeManagementGroup> cmgs = cmGroupDAO.findBySchedulesID(schedule.getUuid());
for (ChangeManagementGroup cmg : cmgs) {
- List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(cmg.getId());
+ List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(cmg.getUuid());
for (ChangeManagementSchedule s : schedules) {
CMSStatusEnum currentState = CMSStatusEnum.Completed.fromString(s.getStatus());
switch (currentState) {
@@ -494,7 +501,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
private void processApproveScheduleRequest(Schedule s, ApprovalMessage approval, List<DomainData> domainData)
throws CMSException {
- s = scheduleDAO.lockOne(s.getId());
+ s = scheduleDAO.lockOne(s.getUuid());
String domain = DomainsEnum.ChangeManagement.toString();
processApproval(s, domain, approval);
if (s.getStatus().equals(CMSStatusEnum.Accepted.toString())) {
@@ -510,10 +517,10 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
Integer max_vnfs_per_ticket = env.getProperty("tm.vnfs.per.ticket", Integer.class, 1);
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getId());
+ List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getUuid());
for (ChangeManagementGroup group : groups) {
- List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getId());
+ List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
List<List<ChangeManagementSchedule>> ticketList = new ArrayList<List<ChangeManagementSchedule>>();
List<ChangeManagementSchedule> current = null;
for (ChangeManagementSchedule cms : schedules) {
@@ -560,9 +567,9 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
private void updateChangeManagementSchedules(Schedule s, CMSStatusEnum approvalrejected) {
debug.debug("Entered updateChangeManagementSchedules");
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getId());
+ List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getUuid());
for (ChangeManagementGroup group : groups) {
- List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getId());
+ List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
for (ChangeManagementSchedule schedule : schedules) {
schedule.setStatus(approvalrejected.toString());
cmScheduleDAO.save(schedule);
@@ -603,7 +610,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
DomainsEnum.ChangeManagement.toString(), scheduleId);
}
Iterator<ChangeManagementDetail> iter = list.iterator();
- Map<Integer, Schedule> scheduleMap = new HashMap<Integer, Schedule>();
+ Map<UUID, Schedule> scheduleMap = new HashMap<UUID, Schedule>();
while (iter.hasNext()) {
ChangeManagementDetail cms = iter.next();
CmDetailsMessage msg = buildResponse(cms, scheduleMap);
@@ -636,7 +643,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
}
- private CmDetailsMessage buildResponse(ChangeManagementDetail cms, Map<Integer, Schedule> scheduleMap) {
+ private CmDetailsMessage buildResponse(ChangeManagementDetail cms, Map<UUID, Schedule> scheduleMap) {
CmDetailsMessage msg = new CmDetailsMessage();
msg.setVnfId(cms.getVnfId());
msg.setVnfName(cms.getVnfName());
@@ -656,17 +663,17 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
msg.setMsoRequestId(cms.getMsoRequestId());
msg.setMsoStatus(cms.getMsoStatus());
msg.setMsoTimeMillis(cms.getMsoTimeMillis());
- if (!scheduleMap.containsKey(cms.getSchedulesId())) {
- Schedule schedule = scheduleDAO.findById(cms.getSchedulesId()).orElse(null);
+ if (!scheduleMap.containsKey(cms.getSchedulesUuid())) {
+ Schedule schedule = scheduleDAO.findById(cms.getSchedulesUuid()).orElse(null);
if (schedule != null) {
// DO not innclude in the results
schedule.setScheduleInfo(null);
// schedule.setSchedule(null);
- scheduleMap.put(cms.getSchedulesId(), schedule);
+ scheduleMap.put(cms.getSchedulesUuid(), schedule);
}
}
- if (scheduleMap.containsKey(cms.getSchedulesId())) {
- msg.setScheduleRequest(scheduleMap.get(cms.getSchedulesId()));
+ if (scheduleMap.containsKey(cms.getSchedulesUuid())) {
+ msg.setScheduleRequest(scheduleMap.get(cms.getSchedulesUuid()));
}
return msg;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java
index 1a9c29d..9877d33 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,188 +43,180 @@ import org.onap.optf.cmso.model.DomainData;
public class CmQueryParameters {
- public enum QueryColumns {
- RequestScheduleId("request.scheduleId", String.class, "ss.schedule_id"), RequestScheduleName(
- "request.scheduleName", String.class,
- "ss.schedule_name"), RequestUserId("request.userId", String.class, "ss.user_id"), RequestStatus(
- "request.status", String.class, "ss.status"), RequestCreateDateTime("request.createDateTime",
- Date.class, "ss.create_date_time"), RequestOptimizerStatus("request.optimizerStatus",
- String.class, "ss.optimizer_status"), RequestApprovalUserId(
- "request.approvalUserId", String.class,
- "sa.user_id"), RequestApprovalStatus("request.approvalStatus",
- String.class, "sa.status"), RequestApprovalType(
- "request.approvalType", String.class,
- "at.approval_type"), WorkflowName("WorkflowName",
- DomainData.class,
- "dd.value"), vnfName("vnfName", String.class,
- "s.vnf_name"), vnfId("vnfId",
- String.class,
- "s.vnf_id"), vnfStatus(
- "vnfStatus",
- String.class,
- "s.vnf_status"),
- // vnfScheduleId("vnfScheduleId", String.class, "s.id"),
- startTime("startTime", Date.class, "s.start_time"), finishTime("finishTime", Date.class,
- "s.finish_ime"), lastInstanceTime("lastInstanceTime", Date.class, "g.last_instance_time"), tmChangeId(
- "tmChangeId", String.class, "s.tm_change_id"), concurrenyLimit("request.concurrencyLimit",
- Integer.class, "g.concurrency_limit"),
- // approvalUserId("approvalUserId", String.class, "approvalUserId"),
- // approvalStatus("approvalStatus", String.class, "approvalStatus"),
- // approvalType("approvalType", String.class, "approvalType"),
- ;
+ public enum QueryColumns {
+ RequestScheduleId("request.scheduleId", String.class, "ss.schedule_id"),
+ RequestScheduleName("request.scheduleName", String.class, "ss.schedule_name"),
+ RequestUserId("request.userId", String.class, "ss.user_id"),
+ RequestStatus("request.status", String.class, "ss.status"),
+ RequestCreateDateTime("request.createDateTime", Date.class, "ss.create_date_time"),
+ RequestOptimizerStatus("request.optimizerStatus", String.class, "ss.optimizer_status"),
+ RequestApprovalUserId("request.approvalUserId", String.class, "sa.user_id"),
+ RequestApprovalStatus("request.approvalStatus", String.class, "sa.status"),
+ RequestApprovalType("request.approvalType", String.class, "at.approval_type"),
+ WorkflowName("WorkflowName", DomainData.class, "dd.value"), vnfName("vnfName", String.class, "s.vnf_name"),
+ vnfId("vnfId", String.class, "s.vnf_id"), vnfStatus("vnfStatus", String.class, "s.vnf_status"),
+ // vnfScheduleId("vnfScheduleId", String.class, "s.id"),
+ startTime("startTime", Date.class, "s.start_time"), finishTime("finishTime", Date.class, "s.finish_ime"),
+ lastInstanceTime("lastInstanceTime", Date.class, "g.last_instance_time"),
+ tmChangeId("tmChangeId", String.class, "s.tm_change_id"),
+ concurrenyLimit("request.concurrencyLimit", Integer.class, "g.concurrency_limit"),
+ // approvalUserId("approvalUserId", String.class, "approvalUserId"),
+ // approvalStatus("approvalStatus", String.class, "approvalStatus"),
+ // approvalType("approvalType", String.class, "approvalType"),
+ ;
- private final String urlName;
- private final Class<?> type;
- private final String col;
+ private final String urlName;
+ private final Class<?> type;
+ private final String col;
- private QueryColumns(String urlName, Class<?> type, String col) {
- this.urlName = urlName;
- this.type = type;
- this.col = col;
- }
+ private QueryColumns(String urlName, Class<?> type, String col) {
+ this.urlName = urlName;
+ this.type = type;
+ this.col = col;
+ }
- }
+ }
- public static QueryColumns getQueryColumn(String urlName) {
- for (QueryColumns qc : QueryColumns.values()) {
- if (qc.urlName.equals(urlName))
- return qc;
- }
- return null;
- }
+ public static QueryColumns getQueryColumn(String urlName) {
+ for (QueryColumns qc : QueryColumns.values()) {
+ if (qc.urlName.equals(urlName))
+ return qc;
+ }
+ return null;
+ }
- public static String buildClause(String urlName, List<String> values) throws CMSException {
- QueryColumns qc = getQueryColumn(urlName);
- if (qc == null) {
- throw new CMSException(Status.BAD_REQUEST, LogMessages.UNDEFINED_FILTER_ATTRIBUTE, urlName);
- }
- if (qc.type == Date.class) {
- return formatDate(urlName, values, qc);
- }
- if (qc.type == DomainData.class) {
- return formatDomainData(urlName, values, qc);
- }
- return formatString(urlName, values, qc);
- }
+ public static String buildClause(String urlName, List<String> values) throws CMSException {
+ QueryColumns qc = getQueryColumn(urlName);
+ if (qc == null) {
+ throw new CMSException(Status.BAD_REQUEST, LogMessages.UNDEFINED_FILTER_ATTRIBUTE, urlName);
+ }
+ if (qc.type == Date.class) {
+ return formatDate(urlName, values, qc);
+ }
+ if (qc.type == DomainData.class) {
+ return formatDomainData(urlName, values, qc);
+ }
+ return formatString(urlName, values, qc);
+ }
- private static String formatString(String urlName, List<String> values, QueryColumns qc) {
- StringBuilder clause = new StringBuilder();
- List<String> likes = new ArrayList<String>();
- List<String> in = new ArrayList<String>();
- for (String value : values) {
- if (value.contains("%"))
- likes.add(value);
- else
- in.add(value);
- }
- String delim = "(";
- if (in.size() > 0) {
- clause.append(delim).append(qc.col).append(" in ('");
- String inDelim = "";
- for (String value : in) {
- clause.append(inDelim).append(value).append("'");
- inDelim = ", '";
- }
- clause.append(") ");
- delim = " OR ";
- }
- if (likes.size() > 0) {
- for (String value : likes) {
- clause.append(delim).append(qc.col).append(" like '").append(value).append("'");
- delim = " OR ";
- }
- }
- if (!delim.equals("("))
- clause.append(")");
- return clause.toString();
- }
+ private static String formatString(String urlName, List<String> values, QueryColumns qc) {
+ StringBuilder clause = new StringBuilder();
+ List<String> likes = new ArrayList<String>();
+ List<String> in = new ArrayList<String>();
+ for (String value : values) {
+ if (value.contains("%"))
+ likes.add(value);
+ else
+ in.add(value);
+ }
+ String delim = "(";
+ if (in.size() > 0) {
+ clause.append(delim).append(qc.col).append(" in ('");
+ String inDelim = "";
+ for (String value : in) {
+ clause.append(inDelim).append(value).append("'");
+ inDelim = ", '";
+ }
+ clause.append(") ");
+ delim = " OR ";
+ }
+ if (likes.size() > 0) {
+ for (String value : likes) {
+ clause.append(delim).append(qc.col).append(" like '").append(value).append("'");
+ delim = " OR ";
+ }
+ }
+ if (!delim.equals("("))
+ clause.append(")");
+ return clause.toString();
+ }
- private static String formatDomainData(String urlName, List<String> values, QueryColumns qc) {
- StringBuilder clause = new StringBuilder();
- String delim = "(";
- if (values.size() > 0) {
- for (String value : values) {
- clause.append(delim).append(" (dd.name = '").append(qc.urlName).append("' AND dd.value = '")
- .append(value).append("')");
- delim = " OR ";
- }
- }
- if (!delim.equals("("))
- clause.append(")");
- return clause.toString();
- }
+ private static String formatDomainData(String urlName, List<String> values, QueryColumns qc) {
+ StringBuilder clause = new StringBuilder();
+ String delim = "(";
+ if (values.size() > 0) {
+ for (String value : values) {
+ clause.append(delim).append(" (dd.name = '").append(qc.urlName).append("' AND dd.value = '")
+ .append(value).append("')");
+ delim = " OR ";
+ }
+ }
+ if (!delim.equals("("))
+ clause.append(")");
+ return clause.toString();
+ }
- private static String formatDate(String urlName, List<String> values, QueryColumns qc) throws CMSException {
- List<String> clauses = new ArrayList<String>();
- for (String value : values) {
- String dates[] = value.split(",");
- switch (dates.length) {
- case 2:
- formatDatePair(qc, dates[0].trim(), dates[1].trim(), clauses);
- break;
- case 1:
- formatDatePair(qc, dates[0].trim(), "", clauses);
- break;
- default:
- throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, value);
- }
- }
- StringBuilder clause = new StringBuilder();
- String delim = "(";
- for (String c : clauses) {
- clause.append(delim).append(c);
- delim = " OR ";
- }
- if (!delim.equals(")")) {
- clause.append(")");
- }
- return clause.toString();
- }
+ private static String formatDate(String urlName, List<String> values, QueryColumns qc) throws CMSException {
+ List<String> clauses = new ArrayList<String>();
+ for (String value : values) {
+ String dates[] = value.split(",");
+ switch (dates.length) {
+ case 2:
+ formatDatePair(qc, dates[0].trim(), dates[1].trim(), clauses);
+ break;
+ case 1:
+ formatDatePair(qc, dates[0].trim(), "", clauses);
+ break;
+ default:
+ throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, value);
+ }
+ }
+ StringBuilder clause = new StringBuilder();
+ String delim = "(";
+ for (String c : clauses) {
+ clause.append(delim).append(c);
+ delim = " OR ";
+ }
+ if (!delim.equals(")")) {
+ clause.append(")");
+ }
+ return clause.toString();
+ }
- private static void formatDatePair(QueryColumns qc, String lowDate, String highDate, List<String> clauses)
- throws CMSException {
- StringBuilder clause = new StringBuilder();
- DateTime date1 = null;
- DateTime date2 = null;
- if (!lowDate.equals(""))
- date1 = convertDate(lowDate, qc.urlName);
- if (!highDate.equals(""))
- date2 = convertDate(highDate, qc.urlName);
- String delim = "(";
- if (date1 != null) {
- clause.append(delim).append(qc.col).append(" >= ").append(date1.getMillis());
- delim = " AND ";
- }
- if (date2 != null) {
- clause.append(delim).append(qc.col).append(" <= ").append(date2.getMillis());
- delim = " AND ";
- }
- if (!delim.equals(")")) {
- clause.append(")\n");
- clauses.add(clause.toString());
- }
- }
+ private static void formatDatePair(QueryColumns qc, String lowDate, String highDate, List<String> clauses)
+ throws CMSException {
+ StringBuilder clause = new StringBuilder();
+ DateTime date1 = null;
+ DateTime date2 = null;
+ if (!lowDate.equals(""))
+ date1 = convertDate(lowDate, qc.urlName);
+ if (!highDate.equals(""))
+ date2 = convertDate(highDate, qc.urlName);
+ String delim = "(";
+ if (date1 != null) {
+ clause.append(delim).append(qc.col).append(" >= ").append(date1.getMillis());
+ delim = " AND ";
+ }
+ if (date2 != null) {
+ clause.append(delim).append(qc.col).append(" <= ").append(date2.getMillis());
+ delim = " AND ";
+ }
+ if (!delim.equals(")")) {
+ clause.append(")\n");
+ clauses.add(clause.toString());
+ }
+ }
- private static DateTime convertDate(String utcDate, String urlName) throws CMSException {
- DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
- if (dateTime != null)
- return dateTime;
- throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
- }
+ private static DateTime convertDate(String utcDate, String urlName) throws CMSException {
+ DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
+ if (dateTime != null)
+ return dateTime;
+ throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
+ }
- // public static void main(String argv[])
- // {
- // List<String> values = new ArrayList<String>();
- // values.add("2017-07-08T11:12:13Z,2017-07-08T11:12:13Z");
- // values.add("2017-07-09T11:12:13Z,2017-07-09T11:12:13Z");
- // values.add(",2017-07-09T11:12:13Z");
- // values.add(" 2017-07-09T11:12:13Z");
- // try {
- // System.out.println(buildClause("request.createDateTime", values));
- // } catch (SchedulerException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- //
- // }
+ // public static void main(String argv[])
+ // {
+ // List<String> values = new ArrayList<String>();
+ // values.add("2017-07-08T11:12:13Z,2017-07-08T11:12:13Z");
+ // values.add("2017-07-09T11:12:13Z,2017-07-09T11:12:13Z");
+ // values.add(",2017-07-09T11:12:13Z");
+ // values.add(" 2017-07-09T11:12:13Z");
+ // try {
+ // System.out.println(buildClause("request.createDateTime", values));
+ // } catch (SchedulerException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ //
+ // }
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java
index 7a7821e..41534f8 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java
@@ -34,6 +34,7 @@ package org.onap.optf.cmso.sostatus;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
+import java.util.UUID;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.Client;
@@ -87,10 +88,11 @@ public class MsoStatusClient {
@Autowired
PropertiesManagement pm;
- public void execute(Integer id) throws JobExecutionException {
+ public void execute(String id) throws JobExecutionException {
debug.debug(LogMessages.MSO_STATUS_JOB, "Entered", id.toString());
try {
- ChangeManagementSchedule cmSchedule = cmScheduleDAO.lockOne(id);
+ UUID uuid = UUID.fromString(id);
+ ChangeManagementSchedule cmSchedule = cmScheduleDAO.lockOne(uuid);
if (cmSchedule == null) {
Observation.report(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id.toString());
return;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java
index df9f361..6c52cc3 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java
@@ -31,6 +31,8 @@
package org.onap.optf.cmso.sostatus;
+import java.util.UUID;
+
import org.onap.observations.Mdc;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
@@ -73,20 +75,21 @@ public class MsoStatusJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
Mdc.quartzJobBegin(context);
- Integer id = context.getJobDetail().getJobDataMap().getInt(ContextKeys.scheduleId.toString());
+ String id = context.getJobDetail().getJobDataMap().getString(ContextKeys.scheduleId.toString());
String requestId = context.getJobDetail().getJobDataMap().getString(ContextKeys.msoRequestId.toString());
debug.debug(LogMessages.MSO_STATUS_JOB, "Entered", requestId, id.toString());
try {
- ChangeManagementSchedule cmSchedule = cmScheduleDAO.findById(id).orElse(null);
+ UUID uuid = UUID.fromString(id);
+ ChangeManagementSchedule cmSchedule = cmScheduleDAO.findById(uuid).orElse(null);
if (cmSchedule == null) {
- log.warn(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id.toString(), requestId);
+ log.warn(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id, requestId);
return;
}
mso.poll(cmSchedule);
} catch (Exception e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
}
- debug.debug(LogMessages.MSO_STATUS_JOB, "Exited", requestId, id.toString());
+ debug.debug(LogMessages.MSO_STATUS_JOB, "Exited", requestId, id);
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java
index c3254aa..1c3677c 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java
@@ -33,6 +33,7 @@ package org.onap.optf.cmso.sostatus;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@@ -93,8 +94,8 @@ public class ScheduleStatusJob implements Job {
// First poll SO for WF status
List<ChangeManagementSchedule> list = cmScheduleDAO.findAllTriggered();
for (ChangeManagementSchedule s : list) {
- debug.debug("Dispathcing to check status of CM schedule Id=" + s.getId());
- dispatchMso(s.getId());
+ debug.debug("Dispathcing to check status of CM schedule Id=" + s.getUuid());
+ dispatchMso(s.getUuid());
}
} catch (Exception e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
@@ -106,7 +107,7 @@ public class ScheduleStatusJob implements Job {
List<Schedule> list = scheduleDAO.findAllInProgress(DomainsEnum.ChangeManagement.toString());
for (Schedule s : list) {
debug.debug("Dispatching to check status of scheduleId=" + s.getScheduleId());
- dispatchScheduleStatusChecker(s.getId());
+ dispatchScheduleStatusChecker(s.getUuid());
}
} catch (Exception e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
@@ -114,12 +115,12 @@ public class ScheduleStatusJob implements Job {
debug.debug(LogMessages.SCHEDULE_STATUS_JOB, "Exited");
}
- public void dispatchScheduleStatusChecker(Integer id) {
+ public void dispatchScheduleStatusChecker(UUID uuid) {
Map<String, String> mdcSave = Mdc.save();
try {
String url = env.getProperty("cmso.dispatch.url", "http://localhost:8089");
String path = env.getProperty("cmso.dispatch.status.path", "/cmso/dispatch/schedulestatus/");
- url = url + path + id;
+ url = url + path + uuid;
String user = env.getProperty("mechid.user", "");
String pass = pm.getProperty("mechid.pass", "");
Client client = ClientBuilder.newClient();
@@ -152,12 +153,12 @@ public class ScheduleStatusJob implements Job {
}
- public void dispatchMso(Integer id) {
+ public void dispatchMso(UUID uuid) {
Map<String, String> mdcSave = Mdc.save();
try {
String url = env.getProperty("cmso.dispatch.url", "http://localhost:8089");
String path = env.getProperty("cmso.dispatch.sostatus.path", "/cmso/dispatch/sostatus/");
- url = url + path + id;
+ url = url + path + uuid;
String user = env.getProperty("mechid.user", "");
String pass = pm.getProperty("mechid.pass", "");
Client client = ClientBuilder.newClient();
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java
index e5c14b1..e327acc 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.UUID;
+
import javax.transaction.Transactional;
import org.onap.optf.cmso.common.CMSStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
@@ -97,11 +99,12 @@ public class TmStatusClient {
TmClient tmClient;
@Transactional
- public void checkStatus(Integer id) {
+ public void checkStatus(String id) {
debug.debug("Entered checkStatus id=" + id);
try {
// Multiple cmso instance support - re-get the record with a Schedule lock
- Schedule s = scheduleDAO.lockOne(id);
+ UUID uuid = UUID.fromString(id);
+ Schedule s = scheduleDAO.lockOne(uuid);
if (!s.getStatus().equals(CMSStatusEnum.NotificationsInitiated.toString())) {
debug.debug(s.getScheduleId() + " is no longer in " + CMSStatusEnum.NotificationsInitiated.toString()
+ " : it is " + s.getStatus());
@@ -110,7 +113,7 @@ public class TmStatusClient {
}
Map<GroupAuditStatus, List<ChangeManagementGroup>> groupStatus =
new HashMap<GroupAuditStatus, List<ChangeManagementGroup>>();
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(id);
+ List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(uuid);
// Close tickets for completed VNFs
for (ChangeManagementGroup group : groups) {
@@ -155,7 +158,7 @@ public class TmStatusClient {
Map<String, List<ChangeManagementSchedule>> inProgress = new HashMap<String, List<ChangeManagementSchedule>>();
Map<String, List<ChangeManagementSchedule>> completed = new HashMap<String, List<ChangeManagementSchedule>>();
Map<String, List<ChangeManagementSchedule>> tmClosed = new HashMap<String, List<ChangeManagementSchedule>>();
- List<ChangeManagementSchedule> cmSchedules = cmScheduleDAO.findByChangeManagementGroupId(group.getId());
+ List<ChangeManagementSchedule> cmSchedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
for (ChangeManagementSchedule cmSchedule : cmSchedules) {
String status = cmSchedule.getStatus();
String changeId = cmSchedule.getTmChangeId();
@@ -230,7 +233,7 @@ public class TmStatusClient {
Set<String> failedNames = new HashSet<String>();
Set<String> completedNames = new HashSet<String>();
Long startDate = group.getStartTimeMillis();
- List<ChangeManagementSchedule> cmSchedules = cmScheduleDAO.findByChangeManagementGroupId(group.getId());
+ List<ChangeManagementSchedule> cmSchedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
for (ChangeManagementSchedule cmSchedule : cmSchedules) {
String vnfName = cmSchedule.getVnfName();
vnfNames.add(vnfName);