aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor
diff options
context:
space:
mode:
authorShaaban Ebrahim <shaaban.eltanany.ext@orange.com>2019-11-06 13:23:28 +0200
committerShaaban Ebrahim <shaaban.eltanany.ext@orange.com>2019-11-06 21:35:57 +0200
commit7cfca9c44b6465d7eb88d64e3fa38c7f1a09c096 (patch)
treee2a6d83273fa5ba2085b9e8c033198734e797979 /ms/blueprintsprocessor
parenta835890f817a1e3627c281e98ab786ee7bf8c2ba (diff)
add search by meta data in cds-ui server and blueprint processor
Issue-ID: CCSDK-1770 Signed-off-by: Shaaban Ebrahim <shaaban.eltanany.ext@orange.com> Change-Id: I8ac77ab4903e3141d065a61bf28404f3d16077cd
Diffstat (limited to 'ms/blueprintsprocessor')
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt19
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt15
3 files changed, 43 insertions, 1 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
index f5ef0740e..60ca1fec1 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 IBM.
+ * Modifications Copyright © 2019 Orange.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,4 +60,20 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
* @return Optional<BlueprintModelSearch>
</BlueprintModelSearch> */
fun findByTagsContainingIgnoreCase(tags: String): List<BlueprintModelSearch>
-} \ No newline at end of file
+
+ /**
+ * This is a findby some attributes method
+ *
+ * @author Shaaban Ebrahim
+ *
+ * @param updatedBy
+ * @param tags
+ * @param artifactName
+ * @param artifactVersion
+ * @param artifactType
+ * @return Optional<BlueprintModelSearch>
+ </BlueprintModelSearch>
+ */
+ fun findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(updatedBy: String, tags: String, artifactName: String, artifactVersion: String,
+ artifactType: String): List<BlueprintModelSearch>
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
index 10cc0a44a..ea5023cd5 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
@@ -1,6 +1,7 @@
/*
* Copyright © 2019 Bell Canada Intellectual Property.
* Modifications Copyright © 2019 IBM.
+ * Modifications Copyright © 2019 Orange.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
+import org.jetbrains.annotations.NotNull
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.BluePrintModelHandler
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BlueprintSortByOption
@@ -70,6 +72,14 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
return this.bluePrintModelHandler.allBlueprintModel(pageRequest)
}
+ @GetMapping("meta-data/{keyword}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @PreAuthorize("hasRole('USER')")
+ fun allBlueprintModelMetaData(@NotNull @PathVariable(value = "keyword") keyWord: String): List<BlueprintModelSearch> {
+ return this.bluePrintModelHandler.searchBluePrintModelsByKeyWord(keyWord)
+ }
+
+
@DeleteMapping("/{id}")
@Throws(BluePrintException::class)
@PreAuthorize("hasRole('USER')")
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
index f4b006867..19076c681 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
@@ -2,6 +2,7 @@
* Copyright © 2017-2018 AT&T Intellectual Property.
* Modifications Copyright © 2019 Bell Canada.
* Modifications Copyright © 2019 IBM.
+ * Modifications Copyright © 2019 Orange.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -232,6 +233,20 @@ open class BluePrintModelHandler(private val blueprintsProcessorCatalogService:
}
/**
+ * This is a searchBluePrintModelsByKeyWord method to retrieve specific BlueprintModel in Database
+ * where keyword equals updatedBy or tags or artifcat name or artifcat version or artifact type
+ * @author Shaaban Ebrahim
+ * @param keyWord
+ *
+ * @return List<BlueprintModelSearch> list of the controller blueprint
+ </BlueprintModelSearch> */
+ open fun searchBluePrintModelsByKeyWord(keyWord: String): List<BlueprintModelSearch> {
+ return blueprintModelSearchRepository.
+ findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
+ keyWord,keyWord,keyWord,keyWord,keyWord)
+ }
+
+ /**
* This is a deleteBlueprintModel method
*
* @param id id