summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/service/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/main/kotlin')
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt4
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeController.kt56
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ModelTypeHandler.kt116
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ResourceDictionaryHandler.kt138
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt10
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ResourceDictionaryLoadService.kt6
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.kt85
7 files changed, 405 insertions, 10 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt
index 50e19b2f..c818410f 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt
@@ -94,8 +94,8 @@ open class BluePrintRepoFileService(private val modelTypeRepository: ModelTypeRe
private fun getModelDefinition(modelName: String): JsonNode {
val modelDefinition: JsonNode
val modelTypeDb = modelTypeRepository.findByModelName(modelName)
- if (modelTypeDb.isPresent) {
- modelDefinition = modelTypeDb.get().definition
+ if (modelTypeDb != null) {
+ modelDefinition = modelTypeDb.definition
} else {
throw BluePrintException(String.format("failed to get model definition (%s) from repo", modelName))
}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeController.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeController.kt
new file mode 100644
index 00000000..db82849e
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ModelTypeController.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.controller
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
+import org.onap.ccsdk.apps.controllerblueprints.service.handler.ModelTypeHandler
+import org.springframework.http.MediaType
+import org.springframework.web.bind.annotation.*
+
+@RestController
+@RequestMapping(value = arrayOf("/api/v1/model-type"))
+open class ModelTypeController(private val modelTypeHandler: ModelTypeHandler) {
+
+ @GetMapping(path = arrayOf("/{name}"), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ fun getModelTypeByName(@PathVariable(value = "name") name: String): ModelType? {
+ return modelTypeHandler.getModelTypeByName(name)
+ }
+
+ @GetMapping(path = arrayOf("/search/{tags}"), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ fun searchModelTypes(@PathVariable(value = "tags") tags: String): List<ModelType> {
+ return modelTypeHandler.searchModelTypes(tags)
+ }
+
+ @GetMapping(path = arrayOf("/by-definition/{definitionType}"), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ @ResponseBody
+ fun getModelTypeByDefinitionType(@PathVariable(value = "definitionType") definitionType: String): List<ModelType> {
+ return modelTypeHandler.getModelTypeByDefinitionType(definitionType)
+ }
+
+ @PostMapping(path = arrayOf(""), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE), consumes = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun saveModelType(@RequestBody modelType: ModelType): ModelType {
+ return modelTypeHandler.saveModel(modelType)
+ }
+
+ @DeleteMapping(path = arrayOf("/{name}"))
+ fun deleteModelTypeByName(@PathVariable(value = "name") name: String) {
+ modelTypeHandler.deleteByModelName(name)
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ModelTypeHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ModelTypeHandler.kt
new file mode 100644
index 00000000..8099d07f
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ModelTypeHandler.kt
@@ -0,0 +1,116 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.handler
+
+import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ModelTypeRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.validator.ModelTypeValidator
+import org.springframework.stereotype.Service
+
+@Service
+open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository) {
+
+ private val log = EELFManager.getInstance().getLogger(ModelTypeHandler::class.java)!!
+
+ /**
+ * This is a getModelTypeByName service
+ *
+ * @param modelTypeName modelTypeName
+ * @return ModelType
+ */
+ fun getModelTypeByName(modelTypeName: String): ModelType? {
+ log.info("Searching : $modelTypeName")
+ check(modelTypeName.isNotBlank()) { "Model Name Information is missing." }
+ return modelTypeRepository.findByModelName(modelTypeName)
+ }
+
+
+ /**
+ * This is a searchModelTypes service
+ *
+ * @param tags tags
+ * @return List<ModelType>
+ </ModelType> */
+ fun searchModelTypes(tags: String): List<ModelType> {
+ check(tags.isNotBlank()) { "No Search Information provide" }
+ return modelTypeRepository.findByTagsContainingIgnoreCase(tags)
+ }
+
+ /**
+ * This is a saveModel service
+ *
+ * @param modelType modelType
+ * @return ModelType
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun saveModel(modelType: ModelType): ModelType {
+ lateinit var dbModel: ModelType
+ ModelTypeValidator.validateModelType(modelType)
+ val dbModelType: ModelType? = modelTypeRepository.findByModelName(modelType.modelName)
+ if (dbModelType != null) {
+ dbModel = dbModelType
+ dbModel.description = modelType.description
+ dbModel.definition = modelType.definition
+ dbModel.definitionType = modelType.definitionType
+ dbModel.derivedFrom = modelType.derivedFrom
+ dbModel.tags = modelType.tags
+ dbModel.version = modelType.version
+ dbModel.updatedBy = modelType.updatedBy
+ dbModel = modelTypeRepository.save(dbModel)
+ } else {
+ dbModel = modelTypeRepository.save(modelType)
+ }
+ return dbModel
+ }
+
+
+ /**
+ * This is a deleteByModelName service
+ *
+ * @param modelName modelName
+ */
+ open fun deleteByModelName(modelName: String) {
+ check(modelName.isNotBlank()) { "Model Name Information is missing." }
+ modelTypeRepository.deleteByModelName(modelName)
+
+ }
+
+ /**
+ * This is a getModelTypeByDefinitionType service
+ *
+ * @param definitionType definitionType
+ * @return List<ModelType>
+ */
+ fun getModelTypeByDefinitionType(definitionType: String): List<ModelType> {
+ check(definitionType.isNotBlank()) { "Model definitionType Information is missing." }
+ return modelTypeRepository.findByDefinitionType(definitionType)
+ }
+
+ /**
+ * This is a getModelTypeByDerivedFrom service
+ *
+ * @param derivedFrom derivedFrom
+ * @return List<ModelType>
+ */
+ fun getModelTypeByDerivedFrom(derivedFrom: String): List<ModelType> {
+ check(derivedFrom.isNotBlank()) { "Model derivedFrom Information is missing." }
+ return modelTypeRepository.findByDerivedFrom(derivedFrom)
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ResourceDictionaryHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ResourceDictionaryHandler.kt
new file mode 100644
index 00000000..c2493148
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/ResourceDictionaryHandler.kt
@@ -0,0 +1,138 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.handler
+
+import com.google.common.base.Preconditions
+import org.apache.commons.collections.CollectionUtils
+import org.apache.commons.lang3.StringUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionValidationService
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.validator.ResourceDictionaryValidator
+import org.springframework.stereotype.Service
+
+@Service
+class ResourceDictionaryHandler(private val resourceDictionaryRepository: ResourceDictionaryRepository,
+ private val resourceDictionaryValidationService: ResourceDefinitionValidationService) {
+
+
+ /**
+ * This is a getDataDictionaryByName service
+ *
+ * @param name name
+ * @return DataDictionary
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ fun getResourceDictionaryByName(name: String): ResourceDictionary {
+ Preconditions.checkArgument(StringUtils.isNotBlank(name), "Resource dictionary Name Information is missing.")
+ val resourceDictionaryDb = resourceDictionaryRepository.findByName(name)
+ return if (resourceDictionaryDb.isPresent) {
+ resourceDictionaryDb.get()
+ } else {
+ throw BluePrintException(String.format("couldn't get resource dictionary for name (%s)", name))
+ }
+ }
+
+ /**
+ * This is a searchResourceDictionaryByNames service
+ *
+ * @param names names
+ * @return List<ResourceDictionary>
+ </ResourceDictionary> */
+ fun searchResourceDictionaryByNames(names: List<String>): List<ResourceDictionary> {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(names), "No Search Information provide")
+ return resourceDictionaryRepository.findByNameIn(names)
+ }
+
+ /**
+ * This is a searchResourceDictionaryByTags service
+ *
+ * @param tags tags
+ * @return List<ResourceDictionary>
+ </ResourceDictionary> */
+ fun searchResourceDictionaryByTags(tags: String): List<ResourceDictionary> {
+ Preconditions.checkArgument(StringUtils.isNotBlank(tags), "No search tag information provide")
+ return resourceDictionaryRepository.findByTagsContainingIgnoreCase(tags)
+ }
+
+ /**
+ * This is a saveDataDictionary service
+ *
+ * @param resourceDictionary resourceDictionary
+ * @return DataDictionary
+ */
+ @Throws(BluePrintException::class)
+ fun saveResourceDictionary(resourceDictionary: ResourceDictionary): ResourceDictionary {
+ var resourceDictionary = resourceDictionary
+
+ val resourceDefinition = resourceDictionary.definition
+ Preconditions.checkNotNull(resourceDefinition, "failed to get resource definition from content")
+ // Validate the Resource Definitions
+ resourceDictionaryValidationService.validate(resourceDefinition)
+
+ resourceDictionary.tags = resourceDefinition.tags
+ resourceDefinition.updatedBy = resourceDictionary.updatedBy
+ // Set the Property Definitions
+ val propertyDefinition = resourceDefinition.property
+ resourceDictionary.description = propertyDefinition.description
+ resourceDictionary.dataType = propertyDefinition.type
+ if (propertyDefinition.entrySchema != null) {
+ resourceDictionary.entrySchema = propertyDefinition.entrySchema!!.type
+ }
+
+ ResourceDictionaryValidator.validateResourceDictionary(resourceDictionary)
+
+ val dbResourceDictionaryData = resourceDictionaryRepository.findByName(resourceDictionary.name)
+ if (dbResourceDictionaryData.isPresent) {
+ val dbResourceDictionary = dbResourceDictionaryData.get()
+
+ dbResourceDictionary.name = resourceDictionary.name
+ dbResourceDictionary.definition = resourceDictionary.definition
+ dbResourceDictionary.description = resourceDictionary.description
+ dbResourceDictionary.tags = resourceDictionary.tags
+ dbResourceDictionary.updatedBy = resourceDictionary.updatedBy
+ dbResourceDictionary.dataType = resourceDictionary.dataType
+ dbResourceDictionary.entrySchema = resourceDictionary.entrySchema
+ resourceDictionary = resourceDictionaryRepository.save(dbResourceDictionary)
+ } else {
+ resourceDictionary = resourceDictionaryRepository.save(resourceDictionary)
+ }
+
+ return resourceDictionary
+ }
+
+ /**
+ * This is a deleteResourceDictionary service
+ *
+ * @param name name
+ */
+ fun deleteResourceDictionary(name: String) {
+ check(name.isNotBlank()) { "Resource dictionary name is missing." }
+ resourceDictionaryRepository.deleteByName(name)
+ }
+
+ /**
+ * This is a getResourceSourceMapping service
+ */
+ fun getResourceSourceMapping(): ResourceSourceMapping {
+ return ResourceSourceMappingFactory.getRegisterSourceMapping()
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt
index 31b1a16b..51bbca7d 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt
@@ -25,14 +25,14 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType
import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
+import org.onap.ccsdk.apps.controllerblueprints.service.handler.ModelTypeHandler
import org.springframework.stereotype.Service
import java.io.File
import java.nio.charset.Charset
@Service
-open class ModelTypeLoadService(private val modelTypeService: ModelTypeService) {
+open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler) {
private val log = EELFManager.getInstance().getLogger(ModelTypeLoadService::class.java)
private val updateBySystem = "System"
@@ -100,7 +100,7 @@ open class ModelTypeLoadService(private val modelTypeService: ModelTypeService)
modelType.version = dataType.version
modelType.updatedBy = updateBySystem
modelType.tags = (dataKey + "," + dataType.derivedFrom + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
- modelTypeService.saveModel(modelType)
+ modelTypeHandler.saveModel(modelType)
log.trace("DataType(${file.name}) loaded successfully ")
} catch (e: Exception) {
errorBuilder.appendln("Couldn't load DataType(${file.name}: ${e.message}")
@@ -124,7 +124,7 @@ open class ModelTypeLoadService(private val modelTypeService: ModelTypeService)
modelType.version = artifactType.version
modelType.updatedBy = updateBySystem
modelType.tags = (dataKey + "," + artifactType.derivedFrom + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE)
- modelTypeService.saveModel(modelType)
+ modelTypeHandler.saveModel(modelType)
log.trace("ArtifactType(${file.name}) loaded successfully ")
} catch (e: Exception) {
errorBuilder.appendln("Couldn't load ArtifactType(${file.name}: ${e.message}")
@@ -148,7 +148,7 @@ open class ModelTypeLoadService(private val modelTypeService: ModelTypeService)
modelType.version = nodeType.version
modelType.updatedBy = updateBySystem
modelType.tags = (nodeKey + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE + "," + nodeType.derivedFrom)
- modelTypeService.saveModel(modelType)
+ modelTypeHandler.saveModel(modelType)
log.trace("NodeType(${file.name}) loaded successfully ")
} catch (e: Exception) {
errorBuilder.appendln("Couldn't load NodeType(${file.name}: ${e.message}")
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ResourceDictionaryLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ResourceDictionaryLoadService.kt
index 4bb8a2f3..8100cac3 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ResourceDictionaryLoadService.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ResourceDictionaryLoadService.kt
@@ -25,14 +25,14 @@ import org.apache.commons.lang3.text.StrBuilder
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
-import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary
+import org.onap.ccsdk.apps.controllerblueprints.service.handler.ResourceDictionaryHandler
import org.springframework.stereotype.Service
import java.io.File
import java.nio.charset.Charset
@Service
-open class ResourceDictionaryLoadService(private val resourceDictionaryService: ResourceDictionaryService) {
+open class ResourceDictionaryLoadService(private val resourceDictionaryHandler: ResourceDictionaryHandler) {
private val log = EELFManager.getInstance().getLogger(ResourceDictionaryLoadService::class.java)
@@ -92,7 +92,7 @@ open class ResourceDictionaryLoadService(private val resourceDictionaryService:
} else {
resourceDictionary.tags = resourceDefinition.tags
}
- resourceDictionaryService.saveResourceDictionary(resourceDictionary)
+ resourceDictionaryHandler.saveResourceDictionary(resourceDictionary)
log.trace("Resource dictionary(${file.name}) loaded successfully ")
} else {
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.kt
new file mode 100644
index 00000000..990cc651
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ModelTypeRepository.kt
@@ -0,0 +1,85 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.repository
+
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
+import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.stereotype.Repository
+import javax.transaction.Transactional
+
+@Repository
+interface ModelTypeRepository : JpaRepository<ModelType, String> {
+ /**
+ * This is a findByModelName method
+ *
+ * @param modelName Model Name
+ * @return Optional<ModelType>
+ */
+ fun findByModelName(modelName: String): ModelType?
+ /**
+ * This is a findByModelNameIn method
+ *
+ * @param modelNames Model Names
+ * @return List<ModelType>
+ */
+ fun findByModelNameIn(modelNames: List<String>): List<ModelType>
+ /**
+ * This is a findByDerivedFrom method
+ *
+ * @param derivedFrom Derived From
+ * @return List<ModelType>
+ */
+ fun findByDerivedFrom(derivedFrom: String): List<ModelType>
+ /**
+ * This is a findByDerivedFromIn method
+ *
+ * @param derivedFroms Derived Froms
+ * @return List<ModelType>
+ */
+ fun findByDerivedFromIn(derivedFroms: List<String>): List<ModelType>
+
+ /**
+ * This is a findByDefinitionType method
+ *
+ * @param definitionType Definition Type
+ * @return List<ModelType>
+ */
+ fun findByDefinitionType(definitionType: String): List<ModelType>
+ /**
+ * This is a findByDefinitionTypeIn method
+ *
+ * @param definitionTypes Definition Types
+ * @return List<ModelType>
+ */
+ fun findByDefinitionTypeIn(definitionTypes: List<String>): List<ModelType>
+
+ /**
+ * This is a findByTagsContainingIgnoreCase method
+ *
+ * @param tags Tags
+ * @return Optional<ModelType>
+ */
+ fun findByTagsContainingIgnoreCase(tags: String): List<ModelType>
+
+ /**
+ * This is a deleteByModelName method
+ *
+ * @param modelName ModelName
+ */
+ @Transactional
+ fun deleteByModelName(modelName: String)
+}