From b646d524270c8ca093974751b6696e0c0e0b3a08 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Thu, 15 Mar 2018 11:26:17 +0100 Subject: Fix Checkstyle issues Fix the checkstyle issues reported by the build Issue-ID: CLAMP-74 Change-Id: Ia2b3e332808d59aefcc7140d9638c7a18ef24e65 Signed-off-by: Determe, Sebastien (sd378r) --- src/main/java/org/onap/clamp/clds/dao/CldsDao.java | 14 +-- .../clamp/clds/model/CLDSMonitoringDetails.java | 104 --------------------- .../onap/clamp/clds/model/CldsDBServiceCache.java | 80 ---------------- .../onap/clamp/clds/model/CldsDbServiceCache.java | 80 ++++++++++++++++ .../clamp/clds/model/CldsMonitoringDetails.java | 104 +++++++++++++++++++++ .../org/onap/clamp/clds/service/CldsService.java | 10 +- 6 files changed, 196 insertions(+), 196 deletions(-) delete mode 100644 src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java delete mode 100644 src/main/java/org/onap/clamp/clds/model/CldsDBServiceCache.java create mode 100644 src/main/java/org/onap/clamp/clds/model/CldsDbServiceCache.java create mode 100644 src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java (limited to 'src/main/java/org/onap') diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java index 5946416ad..143cb14bb 100644 --- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java +++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java @@ -35,8 +35,8 @@ import java.util.Map; import javax.sql.DataSource; -import org.onap.clamp.clds.model.CLDSMonitoringDetails; -import org.onap.clamp.clds.model.CldsDBServiceCache; +import org.onap.clamp.clds.model.CldsMonitoringDetails; +import org.onap.clamp.clds.model.CldsDbServiceCache; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.model.CldsModelInstance; @@ -381,7 +381,7 @@ public class CldsDao { } } - public void setCldsServiceCache(CldsDBServiceCache cldsDBServiceCache) { + public void setCldsServiceCache(CldsDbServiceCache cldsDBServiceCache) { if (cldsDBServiceCache != null && cldsDBServiceCache.getInvariantId() != null && cldsDBServiceCache.getServiceId() != null) { String invariantUuid = cldsDBServiceCache.getInvariantId(); @@ -442,16 +442,16 @@ public class CldsDao { * generate the ClosedLoop model. ACTION_CD | Current state of the * ClosedLoop in CLDS application. */ - public List getCLDSMonitoringDetails() { + public List getCLDSMonitoringDetails() { SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss"); - List cldsMonitoringDetailsList = new ArrayList(); + List cldsMonitoringDetailsList = new ArrayList(); String modelsSql = "SELECT CONCAT(M.CONTROL_NAME_PREFIX, M.CONTROL_NAME_UUID) AS CLOSELOOP_NAME , M.MODEL_NAME, M.SERVICE_TYPE_ID, M.DEPLOYMENT_ID, T.TEMPLATE_NAME, E.ACTION_CD, E.USER_ID, E.TIMESTAMP " + "FROM MODEL M, TEMPLATE T, EVENT E " + "WHERE M.TEMPLATE_ID = T.TEMPLATE_ID AND M.EVENT_ID = E.EVENT_ID " + "ORDER BY ACTION_CD"; List> rows = jdbcTemplateObject.queryForList(modelsSql); - CLDSMonitoringDetails cldsMonitoringDetails = null; + CldsMonitoringDetails cldsMonitoringDetails = null; for (Map row : rows) { - cldsMonitoringDetails = new CLDSMonitoringDetails(); + cldsMonitoringDetails = new CldsMonitoringDetails(); cldsMonitoringDetails.setCloseloopName((String) row.get("CLOSELOOP_NAME")); cldsMonitoringDetails.setModelName((String) row.get("MODEL_NAME")); cldsMonitoringDetails.setServiceTypeId((String) row.get("SERVICE_TYPE_ID")); diff --git a/src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java b/src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java deleted file mode 100644 index be4f95096..000000000 --- a/src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * 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. - * ============LICENSE_END============================================ - * =================================================================== - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ - -package org.onap.clamp.clds.model; - -/** - * Maintains model and template details. - */ -public class CLDSMonitoringDetails { - - private String closeloopName; - private String modelName; - private String serviceTypeId; - private String deploymentId; - private String templateName; - private String action; - private String userid; - private String timestamp; - - public String getCloseloopName() { - return closeloopName; - } - - public void setCloseloopName(String closeloopName) { - this.closeloopName = closeloopName; - } - - public String getModelName() { - return modelName; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public String getServiceTypeId() { - return serviceTypeId; - } - - public void setServiceTypeId(String serviceTypeId) { - this.serviceTypeId = serviceTypeId; - } - - public String getDeploymentId() { - return deploymentId; - } - - public void setDeploymentId(String deploymentId) { - this.deploymentId = deploymentId; - } - - public String getTemplateName() { - return templateName; - } - - public void setTemplateName(String templateName) { - this.templateName = templateName; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getUserid() { - return userid; - } - - public void setUserid(String userid) { - this.userid = userid; - } - - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String time) { - this.timestamp = time; - } - -} diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDBServiceCache.java b/src/main/java/org/onap/clamp/clds/model/CldsDBServiceCache.java deleted file mode 100644 index 80e8d8538..000000000 --- a/src/main/java/org/onap/clamp/clds/model/CldsDBServiceCache.java +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * 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. - * ============LICENSE_END============================================ - * =================================================================== - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ - -package org.onap.clamp.clds.model; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectOutputStream; - -public class CldsDBServiceCache { - - private String invariantId; - private String serviceId; - private InputStream cldsDataInstream; - - public CldsDBServiceCache(CldsServiceData cldsServiceData) throws IOException { - setCldsDataInstream(cldsServiceData); - setInvariantId(cldsServiceData.getServiceInvariantUUID()); - setServiceId(cldsServiceData.getServiceUUID()); - } - - public String getInvariantId() { - return invariantId; - } - - public void setInvariantId(String invariantId) { - this.invariantId = invariantId; - } - - public String getServiceId() { - return serviceId; - } - - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - - public InputStream getCldsDataInstream() { - return cldsDataInstream; - } - - public void setCldsDataInstream(InputStream cldsDataInputstream) { - this.cldsDataInstream = cldsDataInputstream; - } - - public void setCldsDataInstream(CldsServiceData cldsServiceData) throws IOException { - this.cldsDataInstream = getInstreamFromObject(cldsServiceData); - } - - private InputStream getInstreamFromObject(CldsServiceData cldsServiceData) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(cldsServiceData); - oos.flush(); - oos.close(); - return new ByteArrayInputStream(baos.toByteArray()); - } -} diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDbServiceCache.java b/src/main/java/org/onap/clamp/clds/model/CldsDbServiceCache.java new file mode 100644 index 000000000..fe3088bc4 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/CldsDbServiceCache.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * 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. + * ============LICENSE_END============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.model; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectOutputStream; + +public class CldsDbServiceCache { + + private String invariantId; + private String serviceId; + private InputStream cldsDataInstream; + + public CldsDbServiceCache(CldsServiceData cldsServiceData) throws IOException { + setCldsDataInstream(cldsServiceData); + setInvariantId(cldsServiceData.getServiceInvariantUUID()); + setServiceId(cldsServiceData.getServiceUUID()); + } + + public String getInvariantId() { + return invariantId; + } + + public void setInvariantId(String invariantId) { + this.invariantId = invariantId; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public InputStream getCldsDataInstream() { + return cldsDataInstream; + } + + public void setCldsDataInstream(InputStream cldsDataInputstream) { + this.cldsDataInstream = cldsDataInputstream; + } + + public void setCldsDataInstream(CldsServiceData cldsServiceData) throws IOException { + this.cldsDataInstream = getInstreamFromObject(cldsServiceData); + } + + private InputStream getInstreamFromObject(CldsServiceData cldsServiceData) throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(cldsServiceData); + oos.flush(); + oos.close(); + return new ByteArrayInputStream(baos.toByteArray()); + } +} diff --git a/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java b/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java new file mode 100644 index 000000000..a042ae4fb --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * 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. + * ============LICENSE_END============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.model; + +/** + * Maintains model and template details. + */ +public class CldsMonitoringDetails { + + private String closeloopName; + private String modelName; + private String serviceTypeId; + private String deploymentId; + private String templateName; + private String action; + private String userid; + private String timestamp; + + public String getCloseloopName() { + return closeloopName; + } + + public void setCloseloopName(String closeloopName) { + this.closeloopName = closeloopName; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getServiceTypeId() { + return serviceTypeId; + } + + public void setServiceTypeId(String serviceTypeId) { + this.serviceTypeId = serviceTypeId; + } + + public String getDeploymentId() { + return deploymentId; + } + + public void setDeploymentId(String deploymentId) { + this.deploymentId = deploymentId; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getUserid() { + return userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String time) { + this.timestamp = time; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index 9bd9c4173..34bd3d787 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -67,8 +67,8 @@ import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.exception.CldsConfigException; import org.onap.clamp.clds.exception.policy.PolicyClientException; import org.onap.clamp.clds.exception.sdc.SdcCommunicationException; -import org.onap.clamp.clds.model.CLDSMonitoringDetails; -import org.onap.clamp.clds.model.CldsDBServiceCache; +import org.onap.clamp.clds.model.CldsMonitoringDetails; +import org.onap.clamp.clds.model.CldsDbServiceCache; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsHealthCheck; import org.onap.clamp.clds.model.CldsInfo; @@ -156,10 +156,10 @@ public class CldsService extends SecureServiceBase { @GET @Path("/cldsDetails") @Produces(MediaType.APPLICATION_JSON) - public List getCLDSDetails() { + public List getCLDSDetails() { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: GET model details", getPrincipalName()); - List cldsMonitoringDetailsList = new ArrayList(); + List cldsMonitoringDetailsList = new ArrayList(); cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails(); // audit log LoggingUtils.setTimeContext(startTime, new Date()); @@ -610,7 +610,7 @@ public class CldsService extends SecureServiceBase { } if (sdcCatalogServices.isCldsSdcCacheDataExpired(cldsServiceData)) { cldsServiceData = sdcCatalogServices.getCldsServiceDataWithAlarmConditions(serviceInvariantUUID); - cldsDao.setCldsServiceCache(new CldsDBServiceCache(cldsServiceData)); + cldsDao.setCldsServiceCache(new CldsDbServiceCache(cldsServiceData)); } // filter out VFs the user is not authorized for cldsServiceData.filterVfs(this); -- cgit 1.2.3-korg