summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/clamp/clds/Application.java3
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java5
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java6
-rw-r--r--src/main/java/org/onap/clamp/clds/client/GuardPolicyDelegate.java25
-rw-r--r--src/main/java/org/onap/clamp/clds/client/GuardPolicyDeleteDelegate.java16
-rw-r--r--src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java4
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java9
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java9
-rw-r--r--src/main/java/org/onap/clamp/clds/dao/CldsDao.java16
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/BadRequestException.java14
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java6
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java6
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java6
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java17
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java15
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java15
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java15
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java15
-rw-r--r--src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java1
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsTemplate.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsToscaModelDetails.java3
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsToscaModelRevision.java3
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java16
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/Holmes.java18
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java38
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/Policy.java17
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java6
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/Tca.java18
-rw-r--r--src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java27
-rw-r--r--src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java27
-rw-r--r--src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java27
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintArtifact.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java1
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java6
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/MicroService.java6
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java20
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java4
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java24
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsToscaService.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java18
-rw-r--r--src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java55
-rw-r--r--src/main/java/org/onap/clamp/clds/service/UserService.java3
-rw-r--r--src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java21
-rw-r--r--src/main/java/org/onap/clamp/clds/transform/XslTransformer.java10
-rw-r--r--src/main/java/org/onap/clamp/clds/util/ClampVersioning.java7
-rw-r--r--src/main/java/org/onap/clamp/clds/util/CryptoUtils.java18
-rw-r--r--src/main/java/org/onap/clamp/clds/util/LogMessages.java3
-rw-r--r--src/main/java/org/onap/clamp/clds/util/LoggingUtils.java99
-rw-r--r--src/main/java/org/onap/clamp/clds/util/XmlTools.java17
-rwxr-xr-xsrc/main/java/org/onap/clamp/clds/util/drawing/ClampGraph.java7
-rwxr-xr-xsrc/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/util/drawing/ImageBuilder.java33
-rwxr-xr-xsrc/main/java/org/onap/clamp/clds/util/drawing/Painter.java6
-rw-r--r--src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java18
-rw-r--r--src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java7
62 files changed, 486 insertions, 370 deletions
diff --git a/src/main/java/org/onap/clamp/clds/Application.java b/src/main/java/org/onap/clamp/clds/Application.java
index 025dbabda..c144a1464 100644
--- a/src/main/java/org/onap/clamp/clds/Application.java
+++ b/src/main/java/org/onap/clamp/clds/Application.java
@@ -135,7 +135,8 @@ public class Application extends SpringBootServletInitializer {
private Connector createRedirectConnector(int redirectSecuredPort) {
if (redirectSecuredPort <= 0) {
eelfLogger.warn(
- "HTTP port redirection to HTTPS is disabled because the HTTPS port is 0 (random port) or -1 (Connector disabled)");
+ "HTTP port redirection to HTTPS is disabled because the HTTPS port is 0 (random port) or -1"
+ + " (Connector disabled)");
return null;
}
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
index 024785e2e..f7aff0eff 100644
--- a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
@@ -100,7 +100,9 @@ public class DcaeDispatcherServices {
Date startTime = new Date();
LoggingUtils.setTargetContext("DCAE", "getOperationStatus");
try {
- String responseStr = dcaeHttpConnectionManager.doHttpRequest(statusUrl, "GET", null, null, "DCAE", null, null);
+ String responseStr = dcaeHttpConnectionManager.doHttpRequest(statusUrl, "GET", null,
+ null, "DCAE", null,
+ null);
JSONObject jsonObj = parseResponse(responseStr);
String operationType = (String) jsonObj.get("operationType");
String status = (String) jsonObj.get(DCAE_STATUS_FIELD);
@@ -157,6 +159,7 @@ public class DcaeDispatcherServices {
/***
* Returns status URL for deleteExistingDeployment operation.
+ *
* @param deploymentId
* The deployment ID
* @param serviceTypeId
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
index dcf05423b..7f209199d 100644
--- a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
@@ -70,7 +70,7 @@ public class DcaeInventoryServices {
*/
@Autowired
public DcaeInventoryServices(ClampProperties refProp, CldsDao cldsDao,
- HttpConnectionManager httpConnectionManager) {
+ HttpConnectionManager httpConnectionManager) {
this.refProp = refProp;
this.cldsDao = cldsDao;
this.httpConnectionManager = httpConnectionManager;
@@ -97,8 +97,8 @@ public class DcaeInventoryServices {
}
try {
// Below are the properties required for calling the dcae inventory
- ModelProperties prop = new ModelProperties(cldsModel.getName(), cldsModel.getControlName(), null, false,
- "{}", cldsModel.getPropText());
+ ModelProperties prop = new ModelProperties(cldsModel.getName(), cldsModel.getControlName(), null,
+ false, "{}", cldsModel.getPropText());
Global global = prop.getGlobal();
String invariantServiceUuid = global.getService();
List<String> resourceUuidList = global.getResourceVf();
diff --git a/src/main/java/org/onap/clamp/clds/client/GuardPolicyDelegate.java b/src/main/java/org/onap/clamp/clds/client/GuardPolicyDelegate.java
index a758716b8..3229337b0 100644
--- a/src/main/java/org/onap/clamp/clds/client/GuardPolicyDelegate.java
+++ b/src/main/java/org/onap/clamp/clds/client/GuardPolicyDelegate.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -26,19 +28,15 @@ package org.onap.clamp.clds.client;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import java.io.UnsupportedEncodingException;
-
import org.apache.camel.Exchange;
import org.apache.camel.Handler;
import org.onap.clamp.clds.client.req.policy.GuardPolicyAttributesConstructor;
import org.onap.clamp.clds.client.req.policy.PolicyClient;
-import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.model.properties.Policy;
import org.onap.clamp.clds.model.properties.PolicyChain;
import org.onap.clamp.clds.model.properties.PolicyItem;
import org.onap.clamp.clds.util.LoggingUtils;
-import org.onap.policy.controlloop.policy.builder.BuilderException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -52,41 +50,32 @@ public class GuardPolicyDelegate {
protected static final EELFLogger logger = EELFManager.getInstance().getLogger(GuardPolicyDelegate.class);
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
private final PolicyClient policyClient;
- private final ClampProperties refProp;
@Autowired
- public GuardPolicyDelegate(PolicyClient policyClient, ClampProperties refProp) {
+ public GuardPolicyDelegate(PolicyClient policyClient) {
this.policyClient = policyClient;
- this.refProp = refProp;
}
/**
* Perform activity. Send Guard Policies info to policy api.
*
- * @param camelExchange
- * The Camel Exchange object containing the properties
- * @throws BuilderException
- * In case of issues with OperationalPolicyRequestAttributesConstructor
- * @throws UnsupportedEncodingException
- * In case of issues with the Charset encoding
+ * @param camelExchange The Camel Exchange object containing the properties
*/
@Handler
- public void execute(Exchange camelExchange) throws BuilderException, UnsupportedEncodingException {
+ public void execute(Exchange camelExchange) {
ModelProperties prop = ModelProperties.create(camelExchange);
Policy policy = prop.getType(Policy.class);
if (policy.isFound()) {
for (PolicyChain policyChain : prop.getType(Policy.class).getPolicyChains()) {
- for (PolicyItem policyItem:GuardPolicyAttributesConstructor
+ for (PolicyItem policyItem : GuardPolicyAttributesConstructor
.getAllPolicyGuardsFromPolicyChain(policyChain)) {
prop.setCurrentModelElementId(policy.getId());
prop.setPolicyUniqueId(policyChain.getPolicyId());
prop.setGuardUniqueId(policyItem.getId());
policyClient.sendGuardPolicy(GuardPolicyAttributesConstructor
- .formatAttributes(prop, policyItem), prop, LoggingUtils.getRequestId(), policyItem);
+ .formatAttributes(prop, policyItem), prop, LoggingUtils.getRequestId(), policyItem);
}
}
}
}
-
-
}
diff --git a/src/main/java/org/onap/clamp/clds/client/GuardPolicyDeleteDelegate.java b/src/main/java/org/onap/clamp/clds/client/GuardPolicyDeleteDelegate.java
index 941f519e5..ae962a0bb 100644
--- a/src/main/java/org/onap/clamp/clds/client/GuardPolicyDeleteDelegate.java
+++ b/src/main/java/org/onap/clamp/clds/client/GuardPolicyDeleteDelegate.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -30,7 +32,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Handler;
import org.onap.clamp.clds.client.req.policy.GuardPolicyAttributesConstructor;
import org.onap.clamp.clds.client.req.policy.PolicyClient;
-import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.model.properties.Policy;
@@ -46,21 +47,19 @@ import org.springframework.stereotype.Component;
public class GuardPolicyDeleteDelegate {
protected static final EELFLogger logger = EELFManager.getInstance()
- .getLogger(GuardPolicyDeleteDelegate.class);
+ .getLogger(GuardPolicyDeleteDelegate.class);
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
private final PolicyClient policyClient;
- private final ClampProperties refProp;
@Autowired
- public GuardPolicyDeleteDelegate(PolicyClient policyClient, ClampProperties refProp) {
+ public GuardPolicyDeleteDelegate(PolicyClient policyClient) {
this.policyClient = policyClient;
- this.refProp = refProp;
}
+
/**
* Perform activity. Delete Operational Policy via policy api.
*
- * @param camelExchange
- * The Camel Exchange object containing the properties
+ * @param camelExchange The Camel Exchange object containing the properties
*/
@Handler
public void execute(Exchange camelExchange) {
@@ -70,7 +69,7 @@ public class GuardPolicyDeleteDelegate {
String eventAction = (String) camelExchange.getProperty("eventAction");
if (!eventAction.equalsIgnoreCase(CldsEvent.ACTION_CREATE) && policy.isFound()) {
for (PolicyChain policyChain : prop.getType(Policy.class).getPolicyChains()) {
- for (PolicyItem policyItem:GuardPolicyAttributesConstructor
+ for (PolicyItem policyItem : GuardPolicyAttributesConstructor
.getAllPolicyGuardsFromPolicyChain(policyChain)) {
prop.setCurrentModelElementId(policy.getId());
prop.setPolicyUniqueId(policyChain.getPolicyId());
@@ -80,5 +79,4 @@ public class GuardPolicyDeleteDelegate {
}
}
}
-
}
diff --git a/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java
index 283d8c528..052ea7304 100644
--- a/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java
@@ -203,8 +203,8 @@ public class SdcSingleControllerConfiguration implements IConfiguration {
@Override
public boolean activateServerTLSAuth() {
- if (jsonRootNode != null && jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH) != null &&
- jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH).isJsonPrimitive()) {
+ if (jsonRootNode != null && jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH) != null
+ && jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH).isJsonPrimitive()) {
return jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH).getAsBoolean();
} else {
return false;
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
index e0a804e4b..1fdc898a4 100644
--- a/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
@@ -49,7 +49,7 @@ public class CldsConfiguration {
/**
* Clds Identity database DataSource configuration.
*
- * @return
+ * @return encoded password data source
*/
@Bean(name = "cldsDataSource")
@ConfigurationProperties(prefix = "spring.datasource.cldsdb")
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
index 3f1403f1e..92b0272a9 100644
--- a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
@@ -57,6 +57,9 @@ public class CldsSdcControllerConfiguration {
@Autowired
protected CsarInstaller csarInstaller;
+ /**
+ * Loads SDC controllers configuration.
+ */
@PostConstruct
public void loadSdcControllers() {
SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration();
@@ -67,6 +70,9 @@ public class CldsSdcControllerConfiguration {
});
}
+ /**
+ * Checks whether all SDC controllers defined are up and running.
+ */
@Scheduled(fixedRate = 120000)
public void checkAllSdcControllers() {
logger.info("Checking that all SDC Controllers defined are up and running");
@@ -82,6 +88,9 @@ public class CldsSdcControllerConfiguration {
logger.info("SDC Controllers check completed");
}
+ /**
+ * Closes all SDC Controller and the SDC Client.
+ */
@PreDestroy
public void killSdcControllers() {
sdcControllersList.forEach(e -> {
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
index 2977d1a84..55b90cc52 100644
--- a/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
@@ -56,6 +56,9 @@ public class SdcControllerConfiguration {
@Autowired
protected CsarInstaller csarInstaller;
+ /**
+ * Loads SDC controller configuration.
+ */
@PostConstruct
public void loadSdcControllers() {
SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration();
@@ -66,6 +69,9 @@ public class SdcControllerConfiguration {
});
}
+ /**
+ * Checks whether all SDC controllers defined are up and running.
+ */
@Scheduled(fixedRate = 120000)
public void checkAllSdcControllers() {
logger.info("Checking that all SDC Controllers defined are up and running");
@@ -81,6 +87,9 @@ public class SdcControllerConfiguration {
logger.info("SDC Controllers check completed");
}
+ /**
+ * Closes all SDC Controller and the SDC Client.
+ */
@PreDestroy
public void killSdcControllers() {
sdcControllersList.forEach(e -> {
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 8378af8c5..1cff6bb26 100644
--- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
+++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
@@ -507,14 +507,14 @@ public class CldsDao {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
List<CldsToscaModel> cldsToscaModels = new ArrayList<>();
- String toscaModelSql = new StringBuilder("SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, " +
- "tmr.tosca_model_revision_id, tmr.tosca_model_json, tmr.version, tmr.user_id, tmr.createdTimestamp, " +
- "tmr.lastUpdatedTimestamp")
- .append(toscaModelName != null ? (", tmr.tosca_model_yaml") : "")
+ String toscaModelSql = new StringBuilder("SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, "
+ + "tmr.tosca_model_revision_id, tmr.tosca_model_json, tmr.version, tmr.user_id, tmr.createdTimestamp,"
+ + "tmr.lastUpdatedTimestamp").append(toscaModelName != null ? (", tmr.tosca_model_yaml") : "")
.append(" FROM tosca_model tm, tosca_model_revision tmr WHERE tm.tosca_model_id = tmr.tosca_model_id")
.append(toscaModelName != null ? (" AND tm.tosca_model_name = '" + toscaModelName + "'") : "")
.append(policyType != null ? (" AND tm.policy_type = '" + policyType + "'") : "")
- .append(" AND tmr.version = (select max(version) from tosca_model_revision st where tmr.tosca_model_id=st.tosca_model_id)")
+ .append(" AND tmr.version = (select max(version) from tosca_model_revision st where tmr.tosca_model_id"
+ + "=st.tosca_model_id)")
.toString();
List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(toscaModelSql);
@@ -633,7 +633,7 @@ public class CldsDao {
String whereFilter = " WHERE ";
if (dictionaryName != null) {
whereFilter += "dictionary_name = '" + dictionaryName + "'";
- if (dictionaryId != null){
+ if (dictionaryId != null) {
whereFilter += " AND dictionary_id = '" + dictionaryId + "'";
}
} else if (dictionaryId != null) {
@@ -641,8 +641,8 @@ public class CldsDao {
} else {
whereFilter = "";
}
- String dictionarySql = new StringBuilder("SELECT dictionary_id, dictionary_name, created_by, " +
- "modified_by, timestamp FROM dictionary")
+ String dictionarySql = new StringBuilder("SELECT dictionary_id, dictionary_name, created_by, "
+ + "modified_by, timestamp FROM dictionary")
.append(whereFilter).toString();
List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql);
diff --git a/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java b/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java
index c6b0d5556..caf525eee 100644
--- a/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java
@@ -30,20 +30,20 @@ package org.onap.clamp.clds.exception;
public class BadRequestException extends RuntimeException {
/**
- *
- */
- private static final long serialVersionUID = -5738167530541646123L;
+ * The serial version ID.
+ */
+ private static final long serialVersionUID = -5738167530541646123L;
- /**
+ /**
* This constructor can be used to create a new CldsConfigException.
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public BadRequestException(String message, Throwable e) {
- super(message, e);
+ public BadRequestException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java b/src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java
index c06d10153..93d98151a 100644
--- a/src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception;
public class CldsConfigException extends RuntimeException {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = 5958873136187918505L;
@@ -39,11 +39,11 @@ public class CldsConfigException extends RuntimeException {
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public CldsConfigException(String message, Throwable e) {
- super(message, e);
+ public CldsConfigException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java b/src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java
index 0f54f3bfe..270bfa1e2 100644
--- a/src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception;
public class CldsUsersException extends RuntimeException {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = 933535057227505342L;
@@ -39,11 +39,11 @@ public class CldsUsersException extends RuntimeException {
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public CldsUsersException(String message, Throwable e) {
- super(message, e);
+ public CldsUsersException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java b/src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java
index 02d570328..5892dfc53 100644
--- a/src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java
@@ -41,11 +41,11 @@ public class ModelBpmnException extends RuntimeException {
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public ModelBpmnException(String message, Throwable e) {
- super(message, e);
+ public ModelBpmnException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java b/src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java
index b17616bcc..8d474fc0b 100644
--- a/src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java
@@ -40,11 +40,11 @@ public class ModelPropertiesException extends RuntimeException {
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public ModelPropertiesException(String message, Throwable e) {
- super(message, e);
+ public ModelPropertiesException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java b/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java
index 4ea050392..1bdf18e7e 100644
--- a/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception;
public class NotAuthorizedException extends RuntimeException {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = -5738167530541646123L;
@@ -39,11 +39,11 @@ public class NotAuthorizedException extends RuntimeException {
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public NotAuthorizedException(String message, Throwable e) {
- super(message, e);
+ public NotAuthorizedException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java b/src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java
index 92d36633c..3bfb5ea7c 100644
--- a/src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception;
public class TcaRequestFormatterException extends RuntimeException {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = 169875373143236667L;
@@ -40,11 +40,11 @@ public class TcaRequestFormatterException extends RuntimeException {
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public TcaRequestFormatterException(String message, Throwable e) {
- super(message, e);
+ public TcaRequestFormatterException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java b/src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java
index 9e1132172..e733da53d 100644
--- a/src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception.dcae;
public class DcaeDeploymentException extends RuntimeException {
/**
- * Generated ID
+ * Generated ID.
*/
private static final long serialVersionUID = 8452294782552680243L;
@@ -39,11 +39,11 @@ public class DcaeDeploymentException extends RuntimeException {
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public DcaeDeploymentException(String message, Throwable e) {
- super(message, e);
+ public DcaeDeploymentException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java b/src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java
index 85695a250..06dcdbf02 100644
--- a/src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java
@@ -39,11 +39,11 @@ public class PolicyClientException extends RuntimeException {
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public PolicyClientException(String message, Throwable e) {
- super(message, e);
+ public PolicyClientException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java
index 862b2133f..b70b1140a 100644
--- a/src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception.sdc;
public class SdcCommunicationException extends RuntimeException {
/**
- * Generated ID
+ * Generated ID.
*/
private static final long serialVersionUID = 8452294782552680243L;
@@ -39,11 +39,11 @@ public class SdcCommunicationException extends RuntimeException {
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public SdcCommunicationException(String message, Throwable e) {
- super(message, e);
+ public SdcCommunicationException(String message, Throwable ex) {
+ super(message, ex);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java
index 4e1b8eac7..c3ebde1f8 100644
--- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java
@@ -29,25 +29,24 @@ package org.onap.clamp.clds.exception.sdc.controller;
public class CsarHandlerException extends Exception {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = -7628640776124409155L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new CsarHandlerException.
+ *
+ * @param message The message to dump
*/
public CsarHandlerException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new CsarHandlerException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public CsarHandlerException(final String message, final Throwable cause) {
super(message, cause);
diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java
index eba3263d3..523766af1 100644
--- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java
@@ -34,20 +34,19 @@ public class SdcArtifactInstallerException extends Exception {
private static final long serialVersionUID = 4095937499475915021L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcArtifactInstallerException.
+ *
+ * @param message The message to dump
*/
public SdcArtifactInstallerException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcArtifactInstallerException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public SdcArtifactInstallerException(final String message, final Throwable cause) {
super(message, cause);
diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java
index 1a7afd263..d73001d78 100644
--- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java
@@ -34,20 +34,19 @@ public class SdcControllerException extends Exception {
private static final long serialVersionUID = -4236006447255525130L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcControllerException.
+ *
+ * @param message The message to dump
*/
public SdcControllerException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcControllerException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public SdcControllerException(final String message, final Throwable cause) {
super(message, cause);
diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java
index fa92499a0..6cd3fb88d 100644
--- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java
@@ -34,20 +34,19 @@ public class SdcDownloadException extends Exception {
private static final long serialVersionUID = -5276848693231134901L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcDownloadException.
+ *
+ * @param message The message to dump
*/
public SdcDownloadException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcDownloadException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public SdcDownloadException(final String message, final Throwable cause) {
super(message, cause);
diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java
index 8a11a6efd..bfe63cbfb 100644
--- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java
+++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java
@@ -34,20 +34,19 @@ public class SdcParametersException extends RuntimeException {
private static final long serialVersionUID = 8425657297510362736L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcParametersException.
+ *
+ * @param message The message to dump
*/
public SdcParametersException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcParametersException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public SdcParametersException(final String message, final Throwable cause) {
super(message, cause);
diff --git a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
index f058a9e6a..586899a13 100644
--- a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
+++ b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
@@ -20,6 +20,7 @@
* ===================================================================
*
*/
+
package org.onap.clamp.clds.filter;
import com.att.eelf.configuration.EELFLogger;
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsTemplate.java b/src/main/java/org/onap/clamp/clds/model/CldsTemplate.java
index 8f66204bb..8f3408375 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsTemplate.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsTemplate.java
@@ -73,7 +73,7 @@ public class CldsTemplate {
* @param name The template name to retrieve
* @param okIfNotFound
* The flag indicating whether exception will be returned in case nothing is found
- * @return
+ * @return Clds template from DB
*/
public static CldsTemplate retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) {
// get from db
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsToscaModelDetails.java b/src/main/java/org/onap/clamp/clds/model/CldsToscaModelDetails.java
index a4ee734c7..4ee1debc3 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsToscaModelDetails.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsToscaModelDetails.java
@@ -27,8 +27,7 @@ import java.util.ArrayList;
import java.util.List;
/**
- * Represents a CLDS Tosca model
- *
+ * Represents a CLDS Tosca model.
*/
public class CldsToscaModelDetails {
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsToscaModelRevision.java b/src/main/java/org/onap/clamp/clds/model/CldsToscaModelRevision.java
index 68cd49652..b9a7e0d58 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsToscaModelRevision.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsToscaModelRevision.java
@@ -22,8 +22,7 @@
*/
/**
- * Represents a CLDS Tosca model revision
- *
+ * Represents a CLDS Tosca model revision.
*/
package org.onap.clamp.clds.model;
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java
index 73f708c29..9c15524d6 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -36,21 +38,15 @@ public abstract class AbstractModelElement {
protected static final EELFLogger logger = EELFManager.getInstance().getLogger(AbstractModelElement.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
- private final String type;
- private final ModelBpmn modelBpmn;
private final String id;
protected String topicPublishes;
protected final JsonElement modelElementJsonNode;
- private boolean isFound;
- private final ModelProperties modelProp;
+ private final boolean isFound;
/**
* Perform base parsing of properties for a ModelElement (such as, VesCollector, Policy and Tca).
*/
- protected AbstractModelElement(String type, ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
- this.type = type;
- this.modelProp = modelProp;
- this.modelBpmn = modelBpmn;
+ protected AbstractModelElement(String type, ModelBpmn modelBpmn, JsonObject modelJson) {
this.id = modelBpmn.getId(type);
this.modelElementJsonNode = modelJson.get(id);
this.isFound = modelBpmn.isModelElementTypeInList(type);
@@ -58,15 +54,16 @@ public abstract class AbstractModelElement {
/**
* Get the topic publishes.
+ *
* @return the topicPublishes
*/
public String getTopicPublishes() {
return topicPublishes;
}
-
/**
* Get the id.
+ *
* @return the id
*/
public String getId() {
@@ -75,6 +72,7 @@ public abstract class AbstractModelElement {
/**
* Get the isFound flag.
+ *
* @return the isFound
*/
public boolean isFound() {
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java b/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java
index 63c677d9a..a93b09cfa 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -18,7 +20,7 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.model.properties;
@@ -30,27 +32,22 @@ import org.onap.clamp.clds.util.JsonUtils;
* Parse Holmes bpmn parameters json properties.
* Example json:
* [{"name":"correlationalLogic","value":"vcwx"},{"name":"configPolicyName","value":"cccc"}]
- *
*/
public class Holmes extends AbstractModelElement {
private static final String TYPE_HOLMES = "holmes";
- private String correlationLogic;
-
- private String configPolicyName;
+ private String correlationLogic;
+ private String configPolicyName;
/**
* Default constructor for Holmes Element.
*
- * @param modelProp
- * The ModelProperties containing the all the info, like bpmn,
- * bpmn params, etc ...
* @param modelBpmn The model bpmn
* @param modelJson The model json
*/
- public Holmes(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
- super(TYPE_HOLMES, modelProp, modelBpmn, modelJson);
+ public Holmes(ModelBpmn modelBpmn, JsonObject modelJson) {
+ super(TYPE_HOLMES, modelBpmn, modelJson);
correlationLogic = JsonUtils.getStringValueByName(modelElementJsonNode, "correlationalLogic");
configPolicyName = JsonUtils.getStringValueByName(modelElementJsonNode, "configPolicyName");
@@ -67,5 +64,4 @@ public class Holmes extends AbstractModelElement {
public String getConfigPolicyName() {
return configPolicyName;
}
-
}
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java
index 5160e10a3..9b7f85d90 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -118,19 +120,19 @@ public class ModelProperties {
// Parse the list of base Model Elements and build up the
// ModelElements
modelElementClasses.entrySet().stream().parallel()
- .filter(entry -> (AbstractModelElement.class.isAssignableFrom(entry.getKey())
- && missingTypes.contains(entry.getValue())))
- .forEach(entry -> {
- try {
- modelElements.put(entry.getValue(),
- (entry.getKey().getConstructor(ModelProperties.class, ModelBpmn.class, JsonObject.class)
- .newInstance(this, modelBpmn, modelJson)));
- } catch (InstantiationException | NoSuchMethodException | IllegalAccessException
- | InvocationTargetException e) {
- logger.warn("Unable to instantiate a ModelElement " + entry.getValue()
- + ", exception follows: ", e);
- }
- });
+ .filter(entry -> (AbstractModelElement.class.isAssignableFrom(entry.getKey())
+ && missingTypes.contains(entry.getValue())))
+ .forEach(entry -> {
+ try {
+ modelElements.put(entry.getValue(),
+ (entry.getKey().getConstructor(ModelBpmn.class, JsonObject.class)
+ .newInstance(modelBpmn, modelJson)));
+ } catch (InstantiationException | NoSuchMethodException | IllegalAccessException
+ | InvocationTargetException e) {
+ logger.warn("Unable to instantiate a ModelElement " + entry.getValue()
+ + ", exception follows: ", e);
+ }
+ });
}
}
@@ -277,8 +279,8 @@ public class ModelProperties {
/**
* Replace all '-' with '_' within policy scope and name.
*
- * @param inName
- * @return
+ * @param inName policy scope and name
+ * @return policy scope and name with "-" replaced with "_"
*/
private String normalizePolicyScopeName(String inName) {
return inName.replaceAll("-", "_");
@@ -357,6 +359,12 @@ public class ModelProperties {
return global;
}
+ /**
+ * Registers model element.
+ *
+ * @param modelElementClass model element class
+ * @param type model element type
+ */
public static final synchronized void registerModelElement(Class<? extends AbstractModelElement> modelElementClass,
String type) {
if (!modelElementClasses.containsKey(modelElementClass.getClass())) {
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/Policy.java b/src/main/java/org/onap/clamp/clds/model/properties/Policy.java
index 9cb3635f0..9537cb9ed 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/Policy.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/Policy.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -25,9 +27,9 @@ package org.onap.clamp.clds.model.properties;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
@@ -51,23 +53,22 @@ import java.util.Map.Entry;
* "vf3RtPi"]}]]}]
*/
public class Policy extends AbstractModelElement {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Policy.class);
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Policy.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
- private List<PolicyChain> policyChains;
+ private List<PolicyChain> policyChains;
- private static final String TYPE_POLICY = "policy";
+ private static final String TYPE_POLICY = "policy";
/**
* Parse Policy given json node.
*
- * @param modelProp The model properties.
* @param modelBpmn The model bpmn
* @param modelJson The model json
* @throws IOException The IO Exception
*/
- public Policy(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) throws IOException {
- super(TYPE_POLICY, modelProp, modelBpmn, modelJson);
+ public Policy(ModelBpmn modelBpmn, JsonObject modelJson) throws IOException {
+ super(TYPE_POLICY, modelBpmn, modelJson);
// process policies
if (modelElementJsonNode != null) {
@@ -81,6 +82,7 @@ public class Policy extends AbstractModelElement {
/**
* Get the policy chains.
+ *
* @return the policyChains
*/
public List<PolicyChain> getPolicyChains() {
@@ -90,5 +92,4 @@ public class Policy extends AbstractModelElement {
public static final String getType() {
return TYPE_POLICY;
}
-
}
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java
index 6d766bec7..185546878 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java
@@ -83,10 +83,10 @@ public class PolicyItem implements Cloneable {
private String guardActiveEnd;
/**
- * Parse Policy given json node.
+ * Parse Policy given JSON node.
*
- * @param item
- * @throws IOException
+ * @param item policy in JSON format
+ * @throws IOException IO exception
*/
public PolicyItem(JsonElement item) throws IOException {
id = JsonUtils.getStringValueByName(item, "_id");
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/Tca.java b/src/main/java/org/onap/clamp/clds/model/properties/Tca.java
index 0d17b9542..efa0188e9 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/Tca.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/Tca.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -18,7 +20,7 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.model.properties;
@@ -27,31 +29,30 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+
import java.util.Map.Entry;
import java.util.Set;
/**
* Parse ONAP Tca json properties.
- *
*/
public class Tca extends AbstractModelElement {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Tca.class);
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Tca.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
- private TcaItem tcaItem;
+ private TcaItem tcaItem;
- private static final String TYPE_TCA = "tca";
+ private static final String TYPE_TCA = "tca";
/**
* Parse Tca given json node.
*
- * @param modelProp The model properties
* @param modelBpmn The model bpmn
* @param modelJson The model json
*/
- public Tca(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
- super(TYPE_TCA, modelProp, modelBpmn, modelJson);
+ public Tca(ModelBpmn modelBpmn, JsonObject modelJson) {
+ super(TYPE_TCA, modelBpmn, modelJson);
// process Server_Configurations
if (modelElementJsonNode != null) {
@@ -68,5 +69,4 @@ public class Tca extends AbstractModelElement {
public static final String getType() {
return TYPE_TCA;
}
-
}
diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java
index 2474da073..515e77dfe 100644
--- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java
+++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java
@@ -126,31 +126,38 @@ public class SdcResource implements Comparable<SdcResource> {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
SdcResource other = (SdcResource) obj;
if (resourceInstanceName == null) {
- if (other.resourceInstanceName != null)
+ if (other.resourceInstanceName != null) {
return false;
- } else if (!resourceInstanceName.equals(other.resourceInstanceName))
+ }
+ } else if (!resourceInstanceName.equals(other.resourceInstanceName)) {
return false;
+ }
if (resourceVersion == null) {
- if (other.resourceVersion != null)
+ if (other.resourceVersion != null) {
return false;
- } else if (!resourceVersion.equals(other.resourceVersion))
+ }
+ } else if (!resourceVersion.equals(other.resourceVersion)) {
return false;
+ }
return true;
}
/**
- * Convert version String into a BigDecimal
+ * Convert version String into a BigDecimal.
*
- * @param versionText
- * @return
+ * @param versionText version
+ * @return version in BigDecimal
*/
private BigDecimal convertVersion(String versionText) {
BigDecimal rtn = BigDecimal.valueOf(0.0);
diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java
index e853621b4..47192a540 100644
--- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java
+++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java
@@ -71,31 +71,38 @@ public class SdcResourceBasicInfo implements Comparable<SdcResourceBasicInfo> {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
SdcResourceBasicInfo other = (SdcResourceBasicInfo) obj;
if (name == null) {
- if (other.name != null)
+ if (other.name != null) {
return false;
- } else if (!name.equals(other.name))
+ }
+ } else if (!name.equals(other.name)) {
return false;
+ }
if (version == null) {
- if (other.version != null)
+ if (other.version != null) {
return false;
- } else if (!version.equals(other.version))
+ }
+ } else if (!version.equals(other.version)) {
return false;
+ }
return true;
}
/**
- * Convert version String into a BigDecimal
+ * Convert version String into a BigDecimal.
*
- * @param version
- * @return
+ * @param version version
+ * @return version in BigDecimal
*/
private BigDecimal convertVersion(String version) {
BigDecimal rtn = BigDecimal.valueOf(0.0);
diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java
index a9c1e64da..bb9f3f8a5 100644
--- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java
+++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java
@@ -146,31 +146,38 @@ public class SdcServiceInfo implements Comparable<SdcServiceInfo> {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
SdcServiceInfo other = (SdcServiceInfo) obj;
if (name == null) {
- if (other.name != null)
+ if (other.name != null) {
return false;
- } else if (!name.equals(other.name))
+ }
+ } else if (!name.equals(other.name)) {
return false;
+ }
if (version == null) {
- if (other.version != null)
+ if (other.version != null) {
return false;
- } else if (!version.equals(other.version))
+ }
+ } else if (!version.equals(other.version)) {
return false;
+ }
return true;
}
/**
- * Convert version String into a BigDecimal
+ * Convert version String into a BigDecimal.
*
- * @param versionText
- * @return
+ * @param versionText version
+ * @return version in BigDecimal
*/
private BigDecimal convertVersion(String versionText) {
try {
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintArtifact.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintArtifact.java
index 6c7bfbb14..35bc909dc 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintArtifact.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintArtifact.java
@@ -20,15 +20,15 @@
* ===================================================================
*
*/
-/**
- * This class is useful to store the information concerning
- * blueprint artifact extracted from SDC CSAR
- */
package org.onap.clamp.clds.sdc.controller.installer;
import org.onap.sdc.api.notification.IResourceInstance;
+/**
+ * This class is useful to store the information concerning
+ * blueprint artifact extracted from SDC CSAR.
+ */
public class BlueprintArtifact {
private String dcaeBlueprint;
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java
index 5a8ccca91..5dcffd61c 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java
@@ -21,6 +21,7 @@
* ===================================================================
*
*/
+
package org.onap.clamp.clds.sdc.controller.installer;
import com.google.gson.Gson;
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
index 65d5592a8..5a21a1f8d 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
@@ -75,10 +75,10 @@ public class CsarHandler {
public static final String DATA_DEFINITION_NAME_SUFFIX = "Definitions/data.yml";
public static final String DATA_DEFINITION_KEY = "data_types:";
- public CsarHandler(INotificationData iNotif, String controller, String clampCsarPath) throws CsarHandlerException {
- this.sdcNotification = iNotif;
+ public CsarHandler(INotificationData data, String controller, String clampCsarPath) throws CsarHandlerException {
+ this.sdcNotification = data;
this.controllerName = controller;
- this.artifactElement = searchForUniqueCsar(iNotif);
+ this.artifactElement = searchForUniqueCsar(data);
this.csarFilePath = buildFilePathForCsar(artifactElement, clampCsarPath);
}
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/MicroService.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/MicroService.java
index a785f41ef..ac4daeffb 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/MicroService.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/MicroService.java
@@ -21,6 +21,7 @@
* ===================================================================
*
*/
+
package org.onap.clamp.clds.sdc.controller.installer;
import java.util.Objects;
@@ -58,8 +59,9 @@ public class MicroService {
@Override
public String toString() {
- return "MicroService{" + "name='" + name + '\'' + ", modelType='" + modelType + '\'' + ", inputFrom='" + inputFrom + '\'' + ", mappedNameJpa='"
- + mappedNameJpa + '\'' + ", blueprintName='" + blueprintName + '\'' + '}';
+ return "MicroService{" + "name='" + name + '\'' + ", modelType='" + modelType + '\'' + ", inputFrom='"
+ + inputFrom + '\'' + ", mappedNameJpa='" + mappedNameJpa + '\'' + ", blueprintName='"
+ + blueprintName + '\'' + '}';
}
public String getMappedNameJpa() {
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java
index 0fb1e0f3a..76417132b 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java
@@ -39,7 +39,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
/**
- * REST services to manage dictionary and dictionary items for Tosca Model
+ * REST services to manage dictionary and dictionary items for Tosca Model.
*/
@Component
public class CldsDictionaryService extends SecureServiceBase {
@@ -65,10 +65,10 @@ public class CldsDictionaryService extends SecureServiceBase {
}
/**
- * REST Service that creates or Updates a Dictionary
+ * REST Service that creates or Updates a Dictionary.
*
- * @param dictionaryName
- * @param cldsDictionary
+ * @param dictionaryName dictionary name
+ * @param cldsDictionary clds dictionary
* @return CldsDictionary that was created in DB.
*/
public ResponseEntity<CldsDictionary> createOrUpdateDictionary(String dictionaryName,
@@ -90,10 +90,10 @@ public class CldsDictionaryService extends SecureServiceBase {
/**
* REST Service that creates or Updates a Dictionary Elements for dictionary
- * in DB
+ * in DB.
*
- * @param dictionaryName
- * @param dictionaryItem
+ * @param dictionaryName dictionary name
+ * @param dictionaryItem dictionary item
* @return CldsDictionaryItem A dictionary items that was created or updated
* in DB
*/
@@ -111,7 +111,7 @@ public class CldsDictionaryService extends SecureServiceBase {
}
/**
- * Rest Service that retrieves all CLDS dictionary in DB
+ * Rest Service that retrieves all CLDS dictionary in DB.
*
* @return CldsDictionary List List of CldsDictionary available in DB
*/
@@ -129,9 +129,9 @@ public class CldsDictionaryService extends SecureServiceBase {
/**
* Rest Service that retrieves all CLDS dictionary items in DB for a give
- * dictionary name
+ * dictionary name.
*
- * @param dictionaryName
+ * @param dictionaryName dictionary name
* @return CldsDictionaryItem list List of CLDS Dictionary items for a given
* dictionary name
*/
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 b9cce087d..2a89b1984 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -85,7 +85,7 @@ public class CldsService extends SecureServiceBase {
* The constant LIST_OF_SDC_SERVICE_INFO_TYPE.
*/
public static final Type LIST_OF_SDC_SERVICE_INFO_TYPE = new TypeToken<List<SdcServiceInfo>>() {
- }.getType();
+ }.getType();
@Produce(uri = "direct:processSubmit")
private CamelProxy camelProxy;
/**
@@ -551,7 +551,7 @@ public class CldsService extends SecureServiceBase {
* UUID. If not authorized, then NotAuthorizedException is thrown.
*
* @param model The clds model
- * @return
+ * @return boolean or throws NotAuthorizedException
*/
private boolean isAuthorizedForVf(CldsModel model) {
String vf = ModelProperties.getVf(model);
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
index d82e7c6e7..f60c63830 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
@@ -52,7 +52,7 @@ public class CldsTemplateService extends SecureServiceBase {
private SecureServicePermission permissionReadTemplate;
private SecureServicePermission permissionUpdateTemplate;
@Autowired
- private HttpServletRequest request;
+ private HttpServletRequest request;
@PostConstruct
private final void afterConstruction() {
@@ -71,11 +71,11 @@ public class CldsTemplateService extends SecureServiceBase {
* database. This is subset of the json getModel. This is only expected to
* be used for testing purposes, not by the UI.
*
- * @param templateName
+ * @param templateName template name
* @return bpmn xml text - content of bpmn given name
*/
public String getBpmnTemplate(String templateName) {
- util.entering(request, "CldsTemplateService: GET template bpmn");
+ util.entering(request, "CldsTemplateService: GET template bpmn");
Date startTime = new Date();
isAuthorized(permissionReadTemplate);
logger.info("GET bpmnText for templateName=" + templateName);
@@ -92,11 +92,11 @@ public class CldsTemplateService extends SecureServiceBase {
* database. This is subset of the json getModel. This is only expected to
* be used for testing purposes, not by the UI.
*
- * @param templateName
+ * @param templateName template name
* @return image xml text - content of image given name
*/
public String getImageXml(String templateName) {
- util.entering(request, "CldsTemplateService: GET template image");
+ util.entering(request, "CldsTemplateService: GET template image");
Date startTime = new Date();
isAuthorized(permissionReadTemplate);
logger.info("GET imageText for templateName=" + templateName);
@@ -111,11 +111,11 @@ public class CldsTemplateService extends SecureServiceBase {
/**
* REST service that retrieves a CLDS template by name from the database.
*
- * @param templateName
+ * @param templateName template name
* @return clds template - clds template for the given template name
*/
public CldsTemplate getTemplate(String templateName) {
- util.entering(request, "CldsTemplateService: GET template");
+ util.entering(request, "CldsTemplateService: GET template");
Date startTime = new Date();
isAuthorized(permissionReadTemplate);
logger.info("GET model for templateName=" + templateName);
@@ -131,12 +131,12 @@ public class CldsTemplateService extends SecureServiceBase {
/**
* REST service that saves a CLDS template by name in the database.
*
- * @param templateName
- * @param cldsTemplate
+ * @param templateName template name
+ * @param cldsTemplate clds template
* @return The CldsTemplate modified and saved in DB
*/
public CldsTemplate putTemplate(String templateName, CldsTemplate cldsTemplate) {
- util.entering(request, "CldsTemplateService: PUT template");
+ util.entering(request, "CldsTemplateService: PUT template");
Date startTime = new Date();
isAuthorized(permissionUpdateTemplate);
logger.info("PUT Template for templateName=" + templateName);
@@ -158,7 +158,7 @@ public class CldsTemplateService extends SecureServiceBase {
* @return template names in JSON
*/
public List<ValueItem> getTemplateNames() {
- util.entering(request, "CldsTemplateService: GET template names");
+ util.entering(request, "CldsTemplateService: GET template names");
Date startTime = new Date();
isAuthorized(permissionReadTemplate);
logger.info("GET list of template names");
@@ -171,7 +171,7 @@ public class CldsTemplateService extends SecureServiceBase {
}
// Created for the integration test
- public void setLoggingUtil (LoggingUtils utilP) {
+ public void setLoggingUtil(LoggingUtils utilP) {
util = utilP;
}
}
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
index adebd7853..f2c75ead1 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
@@ -41,7 +41,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
/**
- * REST services to manage Tosca Model
+ * REST services to manage Tosca Model.
*/
@Component
public class CldsToscaService extends SecureServiceBase {
diff --git a/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java b/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java
index 522f682b7..f65308903 100644
--- a/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java
+++ b/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java
@@ -53,7 +53,7 @@ public abstract class SecureServiceBase {
/**
* Get the userId from AAF/CSP.
*
- * @return
+ * @return user ID
*/
public String getUserId() {
return getUserName();
@@ -62,7 +62,7 @@ public abstract class SecureServiceBase {
/**
* Get the Full name.
*
- * @return
+ * @return user name
*/
public String getUserName() {
String name = userNameHandler.retrieveUserName(securityContext);
@@ -76,7 +76,7 @@ public abstract class SecureServiceBase {
/**
* Get the principal name.
*
- * @return
+ * @return the principal name
*/
public String getPrincipalName() {
String principal = ((UserDetails)securityContext.getAuthentication().getPrincipal()).getUsername();
@@ -175,13 +175,16 @@ public abstract class SecureServiceBase {
// the rest of these don't seem to be required - isUserInRole method
// appears to take * as a wildcard
} else if (hasRole(inPermission.getKeyAllInstance())) {
- securityLogger.info("{} authorized because user has permission with * for instance: {}", getPrincipalName(), inPermission.getKey());
+ securityLogger.info("{} authorized because user has permission with * for instance: {}",
+ getPrincipalName(), inPermission.getKey());
authorized = true;
} else if (hasRole(inPermission.getKeyAllInstanceAction())) {
- securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}", getPrincipalName(), inPermission.getKey());
+ securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}",
+ getPrincipalName(), inPermission.getKey());
authorized = true;
} else if (hasRole(inPermission.getKeyAllAction())) {
- securityLogger.info("{} authorized because user has permission with * for action: {}", getPrincipalName(), inPermission.getKey());
+ securityLogger.info("{} authorized because user has permission with * for action: {}",
+ getPrincipalName(), inPermission.getKey());
authorized = true;
} else {
throw new NotAuthorizedException("");
@@ -196,8 +199,9 @@ public abstract class SecureServiceBase {
}
for (GrantedAuthority auth : authentication.getAuthorities()) {
- if (role.equals(auth.getAuthority()))
+ if (role.equals(auth.getAuthority())) {
return true;
+ }
}
return false;
diff --git a/src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java b/src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java
index ae30d2aa3..a93732c3b 100644
--- a/src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java
+++ b/src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java
@@ -37,10 +37,10 @@ public class SecureServicePermission {
/**
* Factory method to create permission given type, instance, and action.
*
- * @param type
- * @param instance
- * @param action
- * @return
+ * @param type type of the permission
+ * @param instance instance of the permission
+ * @param action action of the permission
+ * @return instance of SecureServicePermission with type, instance and action
*/
public static SecureServicePermission create(String type, String instance, String action) {
return new SecureServicePermission(type, instance, action);
@@ -50,9 +50,9 @@ public class SecureServicePermission {
* Factory method to create permission given type and instance. Default
* action to ALL/*.
*
- * @param type
- * @param instance
- * @return
+ * @param type type of the permission
+ * @param instance instance of the permission
+ * @return instance of SecureServicePermission with type, instance and default action
*/
public static SecureServicePermission create(String type, String instance) {
return new SecureServicePermission(type, instance, ALL);
@@ -62,8 +62,8 @@ public class SecureServicePermission {
* Factory method to create permission given type. Default instance and
* action to ALL/*.
*
- * @param type
- * @return
+ * @param type type of the permission
+ * @return instance of SecureServicePermission with type and default instance and action
*/
public static SecureServicePermission create(String type) {
return new SecureServicePermission(type, ALL, ALL);
@@ -72,9 +72,9 @@ public class SecureServicePermission {
/**
* Instantiate permission given type, instance, and action.
*
- * @param type
- * @param instance
- * @param action
+ * @param type type of the permission
+ * @param instance instance of the permission
+ * @param action action of the permission
*/
public SecureServicePermission(String type, String instance, String action) {
this.type = type;
@@ -99,7 +99,7 @@ public class SecureServicePermission {
}
/**
- * Override toString - return permission in key format
+ * Override toString - return permission in key format.
*/
@Override
public String toString() {
@@ -110,7 +110,7 @@ public class SecureServicePermission {
* Return Permission in Key format = type, instance, and action separate by
* pipe character.
*
- * @return
+ * @return permission in key format
*/
public String getKey() {
return type + "|" + instance + "|" + action;
@@ -120,7 +120,7 @@ public class SecureServicePermission {
* Return Permission in Key format = type, all instance, and action separate
* by pipe character.
*
- * @return
+ * @return permission in key format
*/
public String getKeyAllInstance() {
return type + "|" + ALL + "|" + action;
@@ -130,7 +130,7 @@ public class SecureServicePermission {
* Return Permission in Key format = type, all instance, and all action
* separate by pipe character.
*
- * @return
+ * @return permission in key format
*/
public String getKeyAllInstanceAction() {
return type + "|" + ALL + "|" + ALL;
@@ -140,13 +140,15 @@ public class SecureServicePermission {
* Return Permission in Key format = type, instance, and all action separate
* by pipe character.
*
- * @return
+ * @return permission in key format
*/
public String getKeyAllAction() {
return type + "|" + instance + "|" + ALL;
}
/**
+ * Returns the permission type.
+ *
* @return the type
*/
public String getType() {
@@ -154,14 +156,17 @@ public class SecureServicePermission {
}
/**
- * @param type
- * the type to set
+ * Sets the type of permission.
+ *
+ * @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
+ * Returns the instance of permission.
+ *
* @return the instance
*/
public String getInstance() {
@@ -169,14 +174,17 @@ public class SecureServicePermission {
}
/**
- * @param instance
- * the instance to set
+ * Sets the instance of permission.
+ *
+ * @param instance the instance to set
*/
public void setInstance(String instance) {
this.instance = instance;
}
/**
+ * Returns the action of permission.
+ *
* @return the action
*/
public String getAction() {
@@ -184,8 +192,9 @@ public class SecureServicePermission {
}
/**
- * @param action
- * the action to set
+ * Sets the action of permission.
+ *
+ * @param action the action to set
*/
public void setAction(String action) {
this.action = action;
diff --git a/src/main/java/org/onap/clamp/clds/service/UserService.java b/src/main/java/org/onap/clamp/clds/service/UserService.java
index cfe50c95f..cf8f66309 100644
--- a/src/main/java/org/onap/clamp/clds/service/UserService.java
+++ b/src/main/java/org/onap/clamp/clds/service/UserService.java
@@ -35,12 +35,11 @@ import org.springframework.stereotype.Controller;
@Controller
public class UserService {
- private SecurityContext securityContext= SecurityContextHolder.getContext();
+ private SecurityContext securityContext = SecurityContextHolder.getContext();
/**
* REST service that returns the username.
*
- * @param userName
* @return the user name
*/
public String getUser() {
diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
index 16a817ea4..ea4e097f8 100644
--- a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
+++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
@@ -40,7 +40,7 @@ import org.yaml.snakeyaml.Yaml;
/**
* Tosca Model Yaml parser and convertor to JSON Schema consumable for JSON
- * Editor
+ * Editor.
*
*/
public class ToscaYamlToJsonConvertor {
@@ -68,6 +68,8 @@ public class ToscaYamlToJsonConvertor {
}
/**
+ * Returns the CldsDao.
+ *
* @return the cldsDao
*/
public CldsDao getCldsDao() {
@@ -75,13 +77,20 @@ public class ToscaYamlToJsonConvertor {
}
/**
- * @param cldsDao
- * the cldsDao to set
+ * Sets the CldsDao.
+ *
+ * @param cldsDao the cldsDao to set
*/
public void setCldsDao(CldsDao cldsDao) {
this.cldsDao = cldsDao;
}
+ /**
+ * Parses Tosca YAML string.
+ *
+ * @param yamlString YAML string
+ * @return JSON string
+ */
public String parseToscaYaml(String yamlString) {
Yaml yaml = new Yaml();
@@ -91,7 +100,6 @@ public class ToscaYamlToJsonConvertor {
}
LinkedHashMap<String, Object> nodeTypes = new LinkedHashMap<>();
LinkedHashMap<String, Object> dataNodes = new LinkedHashMap<>();
- JSONObject jsonEditorObject = new JSONObject();
JSONObject jsonParentObject = new JSONObject();
JSONObject jsonTempObject = new JSONObject();
parseNodeAndDataType(loadedYaml, nodeTypes, dataNodes);
@@ -99,6 +107,7 @@ public class ToscaYamlToJsonConvertor {
if (jsonTempObject.length() > 0) {
jsonParentObject = jsonTempObject;
}
+ JSONObject jsonEditorObject = new JSONObject();
jsonEditorObject.put(JsonEditorSchemaConstants.SCHEMA, jsonParentObject);
return jsonEditorObject.toString();
}
@@ -138,8 +147,8 @@ public class ToscaYamlToJsonConvertor {
boolean isListNode = false;
parseDescription((LinkedHashMap<String, Object>) ntPropertiesElement.getValue(),
jsonParentObject);
- LinkedHashMap<String, Object> parentPropertiesMap = (LinkedHashMap<String, Object>) ntPropertiesElement
- .getValue();
+ LinkedHashMap<String, Object> parentPropertiesMap =
+ (LinkedHashMap<String, Object>) ntPropertiesElement.getValue();
if (parentPropertiesMap.containsKey(ToscaSchemaConstants.TYPE)
&& ((String) parentPropertiesMap.get(ToscaSchemaConstants.TYPE))
.contains(ToscaSchemaConstants.TYPE_MAP)
diff --git a/src/main/java/org/onap/clamp/clds/transform/XslTransformer.java b/src/main/java/org/onap/clamp/clds/transform/XslTransformer.java
index a8f233e43..85b3f5ce4 100644
--- a/src/main/java/org/onap/clamp/clds/transform/XslTransformer.java
+++ b/src/main/java/org/onap/clamp/clds/transform/XslTransformer.java
@@ -45,6 +45,12 @@ public class XslTransformer {
private Templates templates;
+ /**
+ * Sets Xsl Resource name.
+ *
+ * @param xslResourceName xsl resource name
+ * @throws TransformerConfigurationException exception if there is configuration error
+ */
public void setXslResourceName(String xslResourceName) throws TransformerConfigurationException {
TransformerFactory tfactory = new TransformerFactoryImpl();
tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
@@ -55,8 +61,8 @@ public class XslTransformer {
/**
* Given xml input, return the transformed result.
*
- * @param xml
- * @throws TransformerException
+ * @param xml xml string
+ * @throws TransformerException exception during transformation
*/
public String doXslTransformToString(String xml) throws TransformerException {
StringWriter output = new StringWriter(4096);
diff --git a/src/main/java/org/onap/clamp/clds/util/ClampVersioning.java b/src/main/java/org/onap/clamp/clds/util/ClampVersioning.java
index 06330091c..fd7a9a0fc 100644
--- a/src/main/java/org/onap/clamp/clds/util/ClampVersioning.java
+++ b/src/main/java/org/onap/clamp/clds/util/ClampVersioning.java
@@ -43,6 +43,11 @@ public class ClampVersioning {
private ClampVersioning() {
}
+ /**
+ * Returns Clds version from properties.
+ *
+ * @return Clds version from properties
+ */
public static String getCldsVersionFromProps() {
String cldsVersion = "";
Properties props = new Properties();
@@ -50,7 +55,7 @@ public class ClampVersioning {
props.load(resourceStream);
cldsVersion = props.getProperty(CLDS_VERSION_PROPERTY);
} catch (Exception ex) {
- LOGGER.error("Exception caught during the "+CLDS_VERSION_PROPERTY+" property reading", ex);
+ LOGGER.error("Exception caught during the " + CLDS_VERSION_PROPERTY + " property reading", ex);
}
return cldsVersion;
}
diff --git a/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java b/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java
index 07c4147b9..f08bf7b28 100644
--- a/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java
+++ b/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java
@@ -153,7 +153,7 @@ public final class CryptoUtils {
}
/**
- * Reads SecretKeySpec from file specified by propertiesFileName
+ * Reads SecretKeySpec from file specified by propertiesFileName.
*
* @param propertiesFileName
* File name with properties
@@ -162,15 +162,15 @@ public final class CryptoUtils {
private static SecretKeySpec readSecretKeySpec(String propertiesFileName) {
Properties props = new Properties();
try {
- //Workaround fix to make encryption key configurable.
- //System environment variable takes precedence for over clds/key.properties
- String encryptionKey = System.getenv(AES_ENCRYPTION_KEY);
- if(encryptionKey != null && encryptionKey.trim().length() > 0) {
- return getSecretKeySpec(encryptionKey);
- } else {
- props.load(ResourceFileUtil.getResourceAsStream(propertiesFileName));
+ //Workaround fix to make encryption key configurable
+ // System environment variable takes precedence for over clds/key.properties
+ String encryptionKey = System.getenv(AES_ENCRYPTION_KEY);
+ if(encryptionKey != null && encryptionKey.trim().length() > 0) {
+ return getSecretKeySpec(encryptionKey);
+ } else {
+ props.load(ResourceFileUtil.getResourceAsStream(propertiesFileName));
return getSecretKeySpec(props.getProperty(KEY_PARAM));
- }
+ }
} catch (IOException | DecoderException e) {
logger.error("Exception occurred during the key reading", e);
return null;
diff --git a/src/main/java/org/onap/clamp/clds/util/LogMessages.java b/src/main/java/org/onap/clamp/clds/util/LogMessages.java
index eaa1b2a94..7f4c8781f 100644
--- a/src/main/java/org/onap/clamp/clds/util/LogMessages.java
+++ b/src/main/java/org/onap/clamp/clds/util/LogMessages.java
@@ -27,7 +27,8 @@ import com.att.eelf.i18n.EELFResolvableErrorEnum;
import com.att.eelf.i18n.EELFResourceManager;
public enum LogMessages implements EELFResolvableErrorEnum {
- LOGSERVICE_HELLO_MESSAGE, LOGSERVICE_EMAIL_ERROR, LOGSERVICE_EMAIL_CLASS, LOGSERVICE_EMAIL_CLASS_NULL, PROCESS_INSTANCE_ID;
+ LOGSERVICE_HELLO_MESSAGE, LOGSERVICE_EMAIL_ERROR, LOGSERVICE_EMAIL_CLASS, LOGSERVICE_EMAIL_CLASS_NULL,
+ PROCESS_INSTANCE_ID;
static {
EELFResourceManager.loadMessageBundle("logmessages");
diff --git a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
index 47b4f9ab1..08bb97608 100644
--- a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
+++ b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
@@ -60,14 +60,15 @@ public class LoggingUtils {
private static final String EMPTY_MESSAGE = "";
/** Logger delegate. */
- private EELFLogger mLogger;
+ private EELFLogger mlogger;
/** Automatic UUID, overrideable per adapter or per invocation. */
private static UUID sInstanceUUID = UUID.randomUUID();
+
/**
- * Constructor
+ * Constructor.
*/
public LoggingUtils(final EELFLogger loggerP) {
- this.mLogger = checkNotNull(loggerP);
+ this.mlogger = checkNotNull(loggerP);
}
/**
@@ -173,20 +174,21 @@ public class LoggingUtils {
/**
* Report <tt>ENTERING</tt> marker.
*
- * @param request non-null incoming request (wrapper).
- * @return this.
+ * @param request non-null incoming request (wrapper)
+ * @param serviceName service name
*/
public void entering(HttpServletRequest request, String serviceName) {
MDC.clear();
checkNotNull(request);
// Extract MDC values from standard HTTP headers.
- final String requestID = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.REQUEST_ID));
- final String invocationID = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.INVOCATION_ID));
+ final String requestId = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.REQUEST_ID));
+ final String invocationId = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.INVOCATION_ID));
final String partnerName = defaultToEmpty(request.getHeader(ONAPLogConstants.Headers.PARTNER_NAME));
// Default the partner name to the user name used to login to clamp
if (partnerName.equalsIgnoreCase(EMPTY_MESSAGE)) {
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, new DefaultUserNameHandler().retrieveUserName(SecurityContextHolder.getContext()));
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, new DefaultUserNameHandler()
+ .retrieveUserName(SecurityContextHolder.getContext()));
}
// Set standard MDCs. Override this entire method if you want to set
@@ -196,28 +198,31 @@ public class LoggingUtils {
MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
ZonedDateTime.now(ZoneOffset.UTC)
.format(DateTimeFormatter.ISO_INSTANT));
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestID);
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationID);
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+ MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, defaultToEmpty(request.getRemoteAddr()));
MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, defaultToEmpty(request.getServerName()));
MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, defaultToEmpty(sInstanceUUID));
// Default the service name to the requestURI, in the event that
// no value has been provided.
- if (serviceName == null ||
- serviceName.equalsIgnoreCase(EMPTY_MESSAGE)) {
+ if (serviceName == null
+ || serviceName.equalsIgnoreCase(EMPTY_MESSAGE)) {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
} else {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName);
}
- this.mLogger.info(ONAPLogConstants.Markers.ENTRY);
+ this.mlogger.info(ONAPLogConstants.Markers.ENTRY);
}
/**
* Report <tt>EXITING</tt> marker.
*
- * @return this.
+ * @param code response code
+ * @param descrption response description
+ * @param severity response severity
+ * @param status response status code
*/
public void exiting(String code, String descrption, Level severity, ONAPLogConstants.ResponseStatus status) {
try {
@@ -225,7 +230,7 @@ public class LoggingUtils {
MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, defaultToEmpty(descrption));
MDC.put(ONAPLogConstants.MDCs.RESPONSE_SEVERITY, defaultToEmpty(severity));
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, defaultToEmpty(status));
- this.mLogger.info(ONAPLogConstants.Markers.EXIT);
+ this.mlogger.info(ONAPLogConstants.Markers.EXIT);
}
finally {
MDC.clear();
@@ -236,28 +241,29 @@ public class LoggingUtils {
* Report pending invocation with <tt>INVOKE</tt> marker,
* setting standard ONAP logging headers automatically.
*
- * @param builder request builder, for setting headers.
- * @param sync whether synchronous, nullable.
- * @return invocation ID to be passed with invocation.
+ * @param con http URL connection
+ * @param targetEntity target entity
+ * @param targetServiceName target service name
+ * @return invocation ID to be passed with invocation
*/
public HttpURLConnection invoke(final HttpURLConnection con, String targetEntity, String targetServiceName) {
- final String invocationID = UUID.randomUUID().toString();
+ final String invocationId = UUID.randomUUID().toString();
// Set standard HTTP headers on (southbound request) builder.
con.setRequestProperty(ONAPLogConstants.Headers.REQUEST_ID,
defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)));
con.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID,
- invocationID);
+ invocationId);
con.setRequestProperty(ONAPLogConstants.Headers.PARTNER_NAME,
defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)));
- invokeContext(targetEntity, targetServiceName, invocationID);
+ invokeContext(targetEntity, targetServiceName, invocationId);
// Log INVOKE*, with the invocationID as the message body.
// (We didn't really want this kind of behavior in the standard,
// but is it worse than new, single-message MDC?)
- this.mLogger.info(ONAPLogConstants.Markers.INVOKE);
- this.mLogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{"+ invocationID +"}");
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE);
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{" + invocationId + "}");
return con;
}
@@ -265,43 +271,47 @@ public class LoggingUtils {
* Report pending invocation with <tt>INVOKE</tt> marker,
* setting standard ONAP logging headers automatically.
*
- * @param builder request builder, for setting headers.
- * @param sync whether synchronous, nullable.
- * @return invocation ID to be passed with invocation.
+ * @param con http URL connection
+ * @param targetEntity target entity
+ * @param targetServiceName target service name
+ * @return invocation ID to be passed with invocation
*/
public HttpsURLConnection invokeHttps(final HttpsURLConnection con, String targetEntity, String targetServiceName) {
- final String invocationID = UUID.randomUUID().toString();
+ final String invocationId = UUID.randomUUID().toString();
// Set standard HTTP headers on (southbound request) builder.
con.setRequestProperty(ONAPLogConstants.Headers.REQUEST_ID,
defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)));
con.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID,
- invocationID);
+ invocationId);
con.setRequestProperty(ONAPLogConstants.Headers.PARTNER_NAME,
defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)));
- invokeContext(targetEntity, targetServiceName, invocationID);
+ invokeContext(targetEntity, targetServiceName, invocationId);
// Log INVOKE*, with the invocationID as the message body.
// (We didn't really want this kind of behavior in the standard,
// but is it worse than new, single-message MDC?)
- this.mLogger.info(ONAPLogConstants.Markers.INVOKE);
- this.mLogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{"+ invocationID +"}");
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE);
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{" + invocationId + "}");
return con;
}
+ /**
+ * Invokes return context.
+ */
public void invokeReturn() {
// Add the Invoke-return marker and clear the needed MDC
- this.mLogger.info(ONAPLogConstants.Markers.INVOKE_RETURN);
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE_RETURN);
invokeReturnContext();
}
/**
* Dependency-free nullcheck.
*
- * @param in to be checked.
- * @param <T> argument (and return) type.
- * @return input arg.
+ * @param in to be checked
+ * @param <T> argument (and return) type
+ * @return input arg
*/
private static <T> T checkNotNull(final T in) {
if (in == null) {
@@ -313,8 +323,8 @@ public class LoggingUtils {
/**
* Dependency-free string default.
*
- * @param in to be filtered.
- * @return input string or null.
+ * @param in to be filtered
+ * @return input string or null
*/
private static String defaultToEmpty(final Object in) {
if (in == null) {
@@ -326,8 +336,8 @@ public class LoggingUtils {
/**
* Dependency-free string default.
*
- * @param in to be filtered.
- * @return input string or null.
+ * @param in to be filtered
+ * @return input string or null
*/
private static String defaultToUUID(final String in) {
if (in == null) {
@@ -337,13 +347,13 @@ public class LoggingUtils {
}
/**
- * Set target related logging variables in thread local data via MDC
+ * Set target related logging variables in thread local data via MDC.
*
* @param targetEntity Target entity (an external/sub component, for ex. "sdc")
* @param targetServiceName Target service name (name of API invoked on target)
- * @param invocationId The invocation ID
+ * @param invocationID The invocation ID
*/
- private void invokeContext (String targetEntity, String targetServiceName, String invocationID) {
+ private void invokeContext(String targetEntity, String targetServiceName, String invocationID) {
MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, defaultToEmpty(targetEntity));
MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, defaultToEmpty(targetServiceName));
MDC.put(ONAPLogConstants.MDCs.INVOCATIONID_OUT, invocationID);
@@ -353,10 +363,9 @@ public class LoggingUtils {
}
/**
- * Clear target related logging variables in thread local data via MDC
- *
+ * Clear target related logging variables in thread local data via MDC.
*/
- private void invokeReturnContext () {
+ private void invokeReturnContext() {
MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
MDC.remove(ONAPLogConstants.MDCs.INVOCATIONID_OUT);
diff --git a/src/main/java/org/onap/clamp/clds/util/XmlTools.java b/src/main/java/org/onap/clamp/clds/util/XmlTools.java
index 391f0087d..a812fa127 100644
--- a/src/main/java/org/onap/clamp/clds/util/XmlTools.java
+++ b/src/main/java/org/onap/clamp/clds/util/XmlTools.java
@@ -37,6 +37,13 @@ import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
public class XmlTools {
+
+ /**
+ * Transforms document to XML string.
+ *
+ * @param doc XML document
+ * @return XML string
+ */
public static String exportXmlDocumentAsString(Document doc) {
try {
TransformerFactory tf = TransformerFactory.newInstance();
@@ -49,9 +56,15 @@ public class XmlTools {
throw new RuntimeException(e);
}
}
+
+ /**
+ * Creates empty svg document.
+ *
+ * @return Document
+ */
public static Document createEmptySvgDocument() {
DOMImplementation domImplementation = GenericDOMImplementation.getDOMImplementation();
- String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
- return domImplementation.createDocument(svgNS, SVGConstants.SVG_SVG_TAG, null);
+ String svgNs = SVGDOMImplementation.SVG_NAMESPACE_URI;
+ return domImplementation.createDocument(svgNs, SVGConstants.SVG_SVG_TAG, null);
}
}
diff --git a/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraph.java b/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraph.java
index f49e735eb..46aa67b7d 100755
--- a/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraph.java
+++ b/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraph.java
@@ -34,8 +34,13 @@ public class ClampGraph {
this.documentBuilder = documentBuilder;
}
+ /**
+ * Returns svg string.
+ *
+ * @return svg string
+ */
public String getAsSVG() {
- if(Objects.isNull(svg) || svg.isEmpty()) {
+ if (Objects.isNull(svg) || svg.isEmpty()) {
svg = XmlTools.exportXmlDocumentAsString(this.documentBuilder.getGroupingDocument());
}
return svg;
diff --git a/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java b/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java
index ef4c4e43d..c4ced5ef6 100755
--- a/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java
+++ b/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java
@@ -40,13 +40,13 @@ public class ClampGraphBuilder {
this.painter = painter;
}
- public ClampGraphBuilder collector(String c) {
- collector = c;
+ public ClampGraphBuilder collector(String collector) {
+ this.collector = collector;
return this;
}
- public ClampGraphBuilder policy(String p) {
- policy = p;
+ public ClampGraphBuilder policy(String policy) {
+ this.policy = policy;
return this;
}
diff --git a/src/main/java/org/onap/clamp/clds/util/drawing/ImageBuilder.java b/src/main/java/org/onap/clamp/clds/util/drawing/ImageBuilder.java
index 4d76581c3..ce21c4cfd 100644
--- a/src/main/java/org/onap/clamp/clds/util/drawing/ImageBuilder.java
+++ b/src/main/java/org/onap/clamp/clds/util/drawing/ImageBuilder.java
@@ -57,9 +57,9 @@ public class ImageBuilder {
ImageBuilder rectangle(String dataElementId, RectTypes rectType, String text) {
Point next = new Point(currentPoint.x + baseLength, currentPoint.y);
- Point p = coordinatesForRectangle(currentPoint, next);
+ Point point = coordinatesForRectangle(currentPoint, next);
- handleBasedOnRectType(rectType, text, p, baseLength, rectHeight);
+ handleBasedOnRectType(rectType, text, point, baseLength, rectHeight);
documentBuilder.pushChangestoDocument(g2d, dataElementId);
currentPoint = next;
@@ -94,36 +94,37 @@ public class ImageBuilder {
return documentBuilder;
}
- private void handleBasedOnRectType(RectTypes rectType, String text, Point p, int w, int h) {
- AwtUtils.rectWithText(g2d, text, p, w, h);
+ private void handleBasedOnRectType(RectTypes rectType, String text, Point point, int width, int height) {
+ AwtUtils.rectWithText(g2d, text, point, width, height);
switch (rectType) {
case COLECTOR:
- drawVerticalLineForCollector(p, w, h);
+ drawVerticalLineForCollector(point, width, height);
break;
case MICROSERVICE:
- drawHorizontalLineForMicroService(p, w, h);
+ drawHorizontalLineForMicroService(point, width, height);
break;
case POLICY:
- drawDiagonalLineForPolicy(p, w, h);
+ drawDiagonalLineForPolicy(point, width, height);
break;
}
}
- private void drawVerticalLineForCollector(Point p, int w, int h) {
- g2d.drawLine(p.x + w / COLLECTOR_LINE_RATIO, p.y, p.x + w / COLLECTOR_LINE_RATIO, p.y + h);
+ private void drawVerticalLineForCollector(Point point, int width, int height) {
+ g2d.drawLine(point.x + width / COLLECTOR_LINE_RATIO, point.y, point.x + width / COLLECTOR_LINE_RATIO,
+ point.y + height);
}
- private void drawHorizontalLineForMicroService(Point p, int w, int h) {
- int y = calculateMsHorizontalLineYCoordinate(p,h);
- g2d.drawLine(p.x, y, p.x + w, y);
+ private void drawHorizontalLineForMicroService(Point point, int width, int height) {
+ int y = calculateMsHorizontalLineYCoordinate(point,height);
+ g2d.drawLine(point.x, y, point.x + width, y);
}
- private void drawDiagonalLineForPolicy(Point p, int w, int h) {
- g2d.drawLine(p.x, p.y + h / POLICY_LINE_RATIO, p.x + w / POLICY_LINE_RATIO, p.y);
+ private void drawDiagonalLineForPolicy(Point point, int width, int height) {
+ g2d.drawLine(point.x, point.y + height / POLICY_LINE_RATIO, point.x + width / POLICY_LINE_RATIO, point.y);
}
- private int calculateMsHorizontalLineYCoordinate(Point p, int h) {
- return (int)(p.y * h * MS_LINE_TO_HEIGHT_RATIO);
+ private int calculateMsHorizontalLineYCoordinate(Point point, int height) {
+ return (int)(point.y * height * MS_LINE_TO_HEIGHT_RATIO);
}
private Point coordinatesForRectangle(Point from, Point next) {
diff --git a/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java b/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java
index 6263f30ba..fe2d5cb34 100755
--- a/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java
+++ b/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java
@@ -44,6 +44,12 @@ public class Painter {
private static final double RECT_RATIO = 3.0 / 2.0;
private static final int CIRCLE_RADIUS = 17;
+ /**
+ * Constructor to create instance of Painter.
+ *
+ * @param svgGraphics2D svg graphics
+ * @param documentBuilder document builder
+ */
public Painter(SVGGraphics2D svgGraphics2D, DocumentBuilder documentBuilder) {
this.g2d = svgGraphics2D;
this.documentBuilder = documentBuilder;
diff --git a/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java b/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java
index 095df9d84..c92cdcf35 100644
--- a/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java
+++ b/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java
@@ -5,6 +5,8 @@
* Copyright (C) 2019 Nokia Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -31,7 +33,9 @@ import static org.mockito.Mockito.when;
import com.google.gson.JsonObject;
import java.io.IOException;
import org.junit.Test;
+import org.mockito.Mockito;
import org.onap.clamp.clds.config.ClampProperties;
+import org.onap.clamp.clds.exception.TcaRequestFormatterException;
import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.model.properties.Tca;
import org.onap.clamp.clds.model.properties.TcaItem;
@@ -95,4 +99,18 @@ public class TcaRequestFormatterTest {
//then
assertThat(expectedRequest).isEqualTo(policyContent);
}
+
+ @Test(expected = TcaRequestFormatterException.class)
+ public void shouldThrowTcaRequestFormatterException() throws IOException{
+ //given
+ String service = "TestService";
+ String policy = "TestService_scope.PolicyName";
+ ClampProperties clampProperties = mock(ClampProperties.class);
+ ModelProperties modelProperties = mock(ModelProperties.class);
+ Tca tca = mock(Tca.class);
+ //when
+ Mockito.when(clampProperties.getJsonTemplate(any(), any())).thenThrow(IOException.class);
+ //then
+ TcaRequestFormatter.createPolicyContent(clampProperties, modelProperties, service, policy, tca);
+ }
} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java
index 871d0a651..31d0be880 100644
--- a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java
+++ b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -26,7 +28,6 @@ package org.onap.clamp.clds.model.prop;
import com.google.gson.JsonObject;
import org.onap.clamp.clds.model.properties.AbstractModelElement;
import org.onap.clamp.clds.model.properties.ModelBpmn;
-import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.util.JsonUtils;
/**
@@ -40,8 +41,8 @@ public class CustomModelElement extends AbstractModelElement {
/**
* Main Constructor.
*/
- public CustomModelElement(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
- super(CUSTOM_TYPE, modelProp, modelBpmn, modelJson);
+ public CustomModelElement(ModelBpmn modelBpmn, JsonObject modelJson) {
+ super(CUSTOM_TYPE, modelBpmn, modelJson);
topicPublishes = JsonUtils.getStringValueByName(modelElementJsonNode, "topicPublishes");
test = JsonUtils.getStringValueByName(modelElementJsonNode, "test");
}