aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/service/src/main
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-08-28 23:58:12 +0000
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-08-28 23:58:12 +0000
commitc0e77765214b94cc493b181bcc1d58165ac8b09f (patch)
tree2ec2ec72af45d5a8ae8969113698a2c643ff479f /ms/controllerblueprints/modules/service/src/main
parent2ae44709f7e3b04d2150e6c15182fae2a39adc45 (diff)
Controller Blueprints Microservice
Add Resource Assignment Validation Service and their Test cases. Change-Id: I106be2bfc03115867041ca341947a4662cf126c4 Issue-ID: CCSDK-487 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/main')
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java22
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.java25
2 files changed, 29 insertions, 18 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java
index ae4fed9f..c4aebe52 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java
@@ -19,6 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service;
import com.google.common.base.Preconditions;
import org.apache.commons.lang3.StringUtils;
+import org.jetbrains.annotations.NotNull;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.core.data.*;
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService;
@@ -36,36 +37,37 @@ import java.util.Optional;
* @author Brinda Santh
*/
@Service
+@SuppressWarnings("unused")
public class BluePrintRepoDBService implements BluePrintRepoService {
private ModelTypeRepository modelTypeRepository;
-
+ @SuppressWarnings("unused")
public BluePrintRepoDBService(ModelTypeRepository modelTypeRepository) {
this.modelTypeRepository = modelTypeRepository;
}
@Override
- public Mono<NodeType> getNodeType(String nodeTypeName) throws BluePrintException {
+ public Mono<NodeType> getNodeType(@NotNull String nodeTypeName) throws BluePrintException {
return getModelType(nodeTypeName, NodeType.class);
}
@Override
- public Mono<DataType> getDataType(String dataTypeName) throws BluePrintException {
+ public Mono<DataType> getDataType(@NotNull String dataTypeName) throws BluePrintException {
return getModelType(dataTypeName, DataType.class);
}
@Override
- public Mono<ArtifactType> getArtifactType(String artifactTypeName) throws BluePrintException {
+ public Mono<ArtifactType> getArtifactType(@NotNull String artifactTypeName) throws BluePrintException {
return getModelType(artifactTypeName, ArtifactType.class);
}
@Override
- public Mono<RelationshipType> getRelationshipType(String relationshipTypeName) throws BluePrintException {
+ public Mono<RelationshipType> getRelationshipType(@NotNull String relationshipTypeName) throws BluePrintException {
return getModelType(relationshipTypeName, RelationshipType.class);
}
@Override
- public Mono<CapabilityDefinition> getCapabilityDefinition(String capabilityDefinitionName) throws BluePrintException {
+ public Mono<CapabilityDefinition> getCapabilityDefinition(@NotNull String capabilityDefinitionName) throws BluePrintException {
return getModelType(capabilityDefinitionName, CapabilityDefinition.class);
}
@@ -73,15 +75,15 @@ public class BluePrintRepoDBService implements BluePrintRepoService {
Preconditions.checkArgument(StringUtils.isNotBlank(modelName),
"Failed to get model from repo, model name is missing");
- return getModelDefinitions(modelName).map(content -> {
- Preconditions.checkArgument(StringUtils.isNotBlank(content),
- String.format("Failed to get model content for model name (%s)", modelName));
+ return getModelDefinition(modelName).map(content -> {
+ Preconditions.checkArgument(StringUtils.isNotBlank(content),
+ String.format("Failed to get model content for model name (%s)", modelName));
return JacksonUtils.readValue(content, valueClass);
}
);
}
- private Mono<String> getModelDefinitions(String modelName) throws BluePrintException {
+ private Mono<String> getModelDefinition(String modelName) throws BluePrintException {
String modelDefinition;
Optional<ModelType> modelTypeDb = modelTypeRepository.findByModelName(modelName);
if (modelTypeDb.isPresent()) {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.java
index 51ae752f..27823ef3 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.java
@@ -37,15 +37,23 @@ public interface ModelTypeRepository extends JpaRepository<ModelType, String> {
/**
* This is a findByModelName method
*
- * @param modelName
+ * @param modelName Model Name
* @return Optional<ModelType>
*/
Optional<ModelType> findByModelName(String modelName);
/**
+ * This is a findByModelNameIn method
+ *
+ * @param modelNames Model Names
+ * @return List<ModelType>
+ */
+ List<ModelType> findByModelNameIn(List<String> modelNames);
+
+ /**
* This is a findByDerivedFrom method
*
- * @param derivedFrom
+ * @param derivedFrom Derived From
* @return List<ModelType>
*/
List<ModelType> findByDerivedFrom(String derivedFrom);
@@ -54,15 +62,16 @@ public interface ModelTypeRepository extends JpaRepository<ModelType, String> {
/**
* This is a findByDerivedFromIn method
*
- * @param derivedFroms
+ * @param derivedFroms Derived Froms
* @return List<ModelType>
*/
+ @SuppressWarnings("unused")
List<ModelType> findByDerivedFromIn(List<String> derivedFroms);
/**
* This is a findByDefinitionType method
*
- * @param definitionType
+ * @param definitionType Definition Type
* @return List<ModelType>
*/
List<ModelType> findByDefinitionType(String definitionType);
@@ -70,16 +79,17 @@ public interface ModelTypeRepository extends JpaRepository<ModelType, String> {
/**
* This is a findByDefinitionTypeIn method
*
- * @param definitionTypes
+ * @param definitionTypes Definition Types
* @return List<ModelType>
*/
+ @SuppressWarnings("unused")
List<ModelType> findByDefinitionTypeIn(List<String> definitionTypes);
/**
* This is a findByTagsContainingIgnoreCase method
*
- * @param tags
+ * @param tags Tags
* @return Optional<ModelType>
*/
List<ModelType> findByTagsContainingIgnoreCase(String tags);
@@ -88,8 +98,7 @@ public interface ModelTypeRepository extends JpaRepository<ModelType, String> {
/**
* This is a deleteByModelName method
*
- * @param modelName
- * @return Optional<ModelType>
+ * @param modelName ModelName
*/
void deleteByModelName(String modelName);