Commit 6 for Define OPtimizer API mS 12/83812/1
authorJerry Flood <jflood@att.com>
Sun, 31 Mar 2019 12:33:33 +0000 (08:33 -0400)
committerJerry Flood <jflood@att.com>
Sun, 31 Mar 2019 12:42:32 +0000 (08:42 -0400)
Multiple commits required due to commit size limitation.

Change-Id: I4d0b30c535f71a969dae74ce80f36c88d4ad7386
Issue-ID: OPTFRA-437
Signed-off-by: Jerry Flood <jflood@att.com>
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java
cmso-topology/data/vnf1.json [new file with mode: 0644]
cmso-topology/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java
cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoClientFilters.java

index 57a0751..02b803f 100644 (file)
@@ -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<String, String> qp = uri.getQueryParameters();
             // buildWhere(qp, where);
-            List<ScheduleQuery> list = scheduleQueryDAO.searchSchedules(where.toString(), maxRows);
+            List<ScheduleQuery> 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<ScheduleQuery> 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<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(sch.getUuid());
+                        List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesID(sch.getUuid());
                         sch.setGroups(groups);
                         for (ChangeManagementGroup g : groups) {
                             List<ChangeManagementSchedule> cmSchedules =
-                                            cmScheduleDAO.findByChangeManagementGroupId(g.getUuid());
+                                            cmScheduleDao.findByChangeManagementGroupId(g.getUuid());
                             g.setChangeManagementSchedules(cmSchedules);
                         }
                     }
@@ -208,8 +208,10 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
         List<Map<String, String>> smdd = sm.getDomainData();
         for (Map<String, String> 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<ChangeManagementDetail> list = cmDetailsDAO.searchScheduleDetails(where.toString(), maxRows);
+            List<ChangeManagementDetail> 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);
index 6f60248..6785646 100644 (file)
@@ -48,7 +48,8 @@ import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Controller;\r
 \r
 /**\r
- * @author jf9860\r
+ * Health check.\r
+ *\r
  *\r
  */\r
 @Controller\r
index 1f7e317..3d104d2 100644 (file)
@@ -1,27 +1,27 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
+ * Copyright  2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright  2018 IBM.\r
+ *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- * \r
+ *\r
  *         http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
  * Unless required by applicable law or agreed to in writing, software\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
  * Unless otherwise specified, all documentation contained herein is licensed\r
  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
  * you may not use this documentation except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- * \r
+ *\r
  *         https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
  * Unless required by applicable law or agreed to in writing, documentation\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
 \r
 package org.onap.optf.cmso.service.rs.models;\r
 \r
-import java.io.Serializable;\r
-import java.util.List;\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 import com.fasterxml.jackson.core.JsonProcessingException;\r
 import com.fasterxml.jackson.databind.ObjectMapper;\r
 import io.swagger.annotations.ApiModel;\r
 import io.swagger.annotations.ApiModelProperty;\r
+import java.io.Serializable;\r
+import java.util.List;\r
 \r
 /**\r
  * The persistent class for the approval_types database table.\r
- * \r
+ *\r
  */\r
 @ApiModel(value = "Change Management Scheduling Info", description = "Details of schedule being requested")\r
 public class CMSInfo implements Serializable {\r
@@ -61,12 +61,14 @@ public class CMSInfo implements Serializable {
     private Integer concurrencyLimit;\r
 \r
     @ApiModelProperty(\r
-            value = "Name of schedule optimization policy used by the change management cmso optimizer to determine available time slot")\r
+            value = "Name of schedule optimization policy used by the"\r
+                            + " change management cmso optimizer to determine available time slot")\r
     private String policyId;\r
 \r
     @ApiModelProperty(value = "Lists of the VNFs to be changed and the desired change windows")\r
     private List<VnfDetailsMessage> vnfDetails;\r
 \r
+    @Override\r
     public String toString() {\r
         ObjectMapper mapper = new ObjectMapper();\r
         try {\r
index afa4c44..cd8c946 100644 (file)
@@ -1,27 +1,27 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
+ * Copyright  2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright  2018 IBM.\r
+ *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- * \r
+ *\r
  *         http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
  * Unless required by applicable law or agreed to in writing, software\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
  * Unless otherwise specified, all documentation contained herein is licensed\r
  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
  * you may not use this documentation except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- * \r
+ *\r
  *         https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
  * Unless required by applicable law or agreed to in writing, documentation\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
 \r
 package org.onap.optf.cmso.service.rs.models;\r
 \r
-import java.io.Serializable;\r
-import org.onap.optf.cmso.common.LogMessages;\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 import com.fasterxml.jackson.databind.ObjectMapper;\r
 import io.swagger.annotations.ApiModel;\r
+import java.io.Serializable;\r
+import org.onap.optf.cmso.common.LogMessages;\r
 \r
 /**\r
  * The persistent class for the approval_types database table.\r
- * \r
+ *\r
  */\r
 @ApiModel\r
 public class CMSMessage extends ScheduleMessage implements Serializable {\r
diff --git a/cmso-topology/data/vnf1.json b/cmso-topology/data/vnf1.json
new file mode 100644 (file)
index 0000000..9e26dfe
--- /dev/null
@@ -0,0 +1 @@
+{}
\ No newline at end of file
index 5cd258e..f644aca 100644 (file)
@@ -26,8 +26,6 @@
 
 package org.onap.optf.cmso.common;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -35,7 +33,6 @@ import java.util.List;
 
 public class CmsoRequestError implements Serializable {
     private static final long serialVersionUID = 1L;
-    private static EELFLogger log = EELFManager.getInstance().getLogger(CmsoRequestError.class);
     @JsonProperty
     RequestError requestError;
 
index 51d548e..248ea43 100644 (file)
@@ -28,8 +28,6 @@ package org.onap.optf.cmso.topology.filters;
 
 import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
 import java.io.IOException;
 import javax.ws.rs.client.ClientRequestContext;
 import javax.ws.rs.client.ClientRequestFilter;
@@ -40,7 +38,6 @@ import org.onap.observations.Mdc;
 import org.onap.observations.MessageHeaders;
 import org.onap.observations.MessageHeaders.HeadersEnum;
 import org.onap.observations.Observation;
-import org.onap.optf.cmso.topology.Application;
 import org.onap.optf.cmso.topology.common.LogMessages;
 import org.slf4j.MDC;
 import org.springframework.stereotype.Component;
@@ -49,7 +46,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class CmsoClientFilters implements ClientRequestFilter, ClientResponseFilter {
 
-    private static EELFLogger log = EELFManager.getInstance().getLogger(Application.class);
     private static String appId = "cmso";
 
     @Override