From 6398f1bdced8d08116090f2c223c31c16f7b3e13 Mon Sep 17 00:00:00 2001 From: Jerry Flood Date: Sun, 31 Mar 2019 08:33:33 -0400 Subject: Commit 6 for Define OPtimizer API mS Multiple commits required due to commit size limitation. Change-Id: I4d0b30c535f71a969dae74ce80f36c88d4ad7386 Issue-ID: OPTFRA-437 Signed-off-by: Jerry Flood --- .../onap/optf/cmso/service/rs/CmsoServiceImpl.java | 38 ++++++++++++---------- .../onap/optf/cmso/service/rs/HealthCheckImpl.java | 3 +- .../onap/optf/cmso/service/rs/models/CMSInfo.java | 28 ++++++++-------- .../optf/cmso/service/rs/models/CMSMessage.java | 24 +++++++------- 4 files changed, 49 insertions(+), 44 deletions(-) (limited to 'cmso-service') 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 57a0751..02b803f 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 @@ -96,25 +96,25 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { Environment env; @Autowired - ChangeManagementScheduleDAO cmScheduleDAO; + ChangeManagementScheduleDAO cmScheduleDao; @Autowired - ChangeManagementGroupDAO cmGroupDAO; + ChangeManagementGroupDAO cmGroupDao; @Autowired - ChangeManagementChangeWindowDAO cmChangeWindowDAO; + ChangeManagementChangeWindowDAO cmChangeWindowDao; @Autowired - ChangeManagementDetailDAO cmDetailsDAO; + ChangeManagementDetailDAO cmDetailsDao; @Autowired - ScheduleQueryDAO scheduleQueryDAO; + ScheduleQueryDAO scheduleQueryDao; @Autowired - ScheduleDAO scheduleDAO; + ScheduleDAO scheduleDao; @Autowired - ElementDataDAO elementDataDAO; + ElementDataDAO elementDataDao; @Autowired TmClient tmClient; @@ -137,22 +137,22 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { int maxRows = 0; // MultivaluedMap qp = uri.getQueryParameters(); // buildWhere(qp, where); - List list = scheduleQueryDAO.searchSchedules(where.toString(), maxRows); + List list = scheduleQueryDao.searchSchedules(where.toString(), maxRows); if (list == null || !list.iterator().hasNext()) { throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, DomainsEnum.ChangeManagement.toString(), scheduleId); } Iterator iter = list.iterator(); while (iter.hasNext()) { - Schedule sch = scheduleDAO.findById(iter.next().getUuid()).orElse(null); + Schedule sch = scheduleDao.findById(iter.next().getUuid()).orElse(null); if (sch != null) { schedules.add(sch); if (includeDetails) { - List groups = cmGroupDAO.findBySchedulesID(sch.getUuid()); + List groups = cmGroupDao.findBySchedulesID(sch.getUuid()); sch.setGroups(groups); for (ChangeManagementGroup g : groups) { List cmSchedules = - cmScheduleDAO.findByChangeManagementGroupId(g.getUuid()); + cmScheduleDao.findByChangeManagementGroupId(g.getUuid()); g.setChangeManagementSchedules(cmSchedules); } } @@ -208,8 +208,10 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { List> smdd = sm.getDomainData(); for (Map map : smdd) { for (String name : map.keySet()) { - NameValue nv = new NameValue(name, map.get(name)); - dd.add(nv); + if (!name.equals(CmDomainDataEnum.CallbackData.toString())) { + NameValue nv = new NameValue(name, map.get(name)); + dd.add(nv); + } } } osm.setCommonData(dd); @@ -285,7 +287,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { Response response = null; Observation.report(LogMessages.DELETE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId, ""); try { - Schedule schedule = scheduleDAO.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId); + Schedule schedule = scheduleDao.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId); if (schedule == null) { throw new CMSNotFoundException(DomainsEnum.ChangeManagement.toString(), scheduleId); } @@ -312,7 +314,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { Observation.report(LogMessages.GET_SCHEDULE_REQUEST_INFO, "Received", request.getRemoteAddr(), scheduleId, ""); Schedule schedule = null; try { - schedule = scheduleDAO.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId); + schedule = scheduleDao.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId); if (schedule == null) { throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, DomainsEnum.ChangeManagement.toString(), scheduleId); @@ -339,7 +341,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { approval.toString()); try { String domain = DomainsEnum.ChangeManagement.toString(); - Schedule sch = scheduleDAO.findByDomainScheduleID(domain, scheduleId); + Schedule sch = scheduleDao.findByDomainScheduleID(domain, scheduleId); if (sch == null) { throw new CMSNotFoundException(domain, scheduleId); } @@ -385,7 +387,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { maxRows = maxSchedules; } buildWhere(qp, where); - List list = cmDetailsDAO.searchScheduleDetails(where.toString(), maxRows); + List list = cmDetailsDao.searchScheduleDetails(where.toString(), maxRows); if (list == null || !list.iterator().hasNext()) { throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND, DomainsEnum.ChangeManagement.toString(), scheduleId); @@ -443,7 +445,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService { msg.setMsoStatus(cms.getMsoStatus()); msg.setMsoTimeMillis(cms.getMsoTimeMillis()); if (!scheduleMap.containsKey(cms.getSchedulesUuid())) { - Schedule schedule = scheduleDAO.findById(cms.getSchedulesUuid()).orElse(null); + Schedule schedule = scheduleDao.findById(cms.getSchedulesUuid()).orElse(null); if (schedule != null) { // DO not innclude in the results schedule.setScheduleInfo(null); diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java index 6f60248..6785646 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java @@ -48,7 +48,8 @@ import org.springframework.core.env.Environment; import org.springframework.stereotype.Controller; /** - * @author jf9860 + * Health check. + * * */ @Controller diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java index 1f7e317..3d104d2 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java @@ -1,27 +1,27 @@ /* - * 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. * 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. @@ -31,18 +31,18 @@ package org.onap.optf.cmso.service.rs.models; -import java.io.Serializable; -import java.util.List; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; /** * The persistent class for the approval_types database table. - * + * */ @ApiModel(value = "Change Management Scheduling Info", description = "Details of schedule being requested") public class CMSInfo implements Serializable { @@ -61,12 +61,14 @@ public class CMSInfo implements Serializable { private Integer concurrencyLimit; @ApiModelProperty( - value = "Name of schedule optimization policy used by the change management cmso optimizer to determine available time slot") + value = "Name of schedule optimization policy used by the" + + " change management cmso optimizer to determine available time slot") private String policyId; @ApiModelProperty(value = "Lists of the VNFs to be changed and the desired change windows") private List vnfDetails; + @Override public String toString() { ObjectMapper mapper = new ObjectMapper(); try { diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java index afa4c44..cd8c946 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java @@ -1,27 +1,27 @@ /* - * 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. * 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. @@ -31,16 +31,16 @@ package org.onap.optf.cmso.service.rs.models; -import java.io.Serializable; -import org.onap.optf.cmso.common.LogMessages; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.annotations.ApiModel; +import java.io.Serializable; +import org.onap.optf.cmso.common.LogMessages; /** * The persistent class for the approval_types database table. - * + * */ @ApiModel public class CMSMessage extends ScheduleMessage implements Serializable { -- cgit 1.2.3-korg