package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils
import kotlinx.coroutines.reactive.awaitSingle
-import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import org.onap.ccsdk.cds.controllerblueprints.core.deCompress
import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintRepoService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.reCreateNBDirs
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintArchiveUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils
import org.springframework.core.io.ByteArrayResource
import org.springframework.core.io.Resource
import org.springframework.http.HttpHeaders
import java.io.File
import java.nio.file.Paths
-class BlueprintEnhancerUtils {
+class BluePrintEnhancerUtils {
companion object {
- val log = logger(BlueprintEnhancerUtils)
+ val log = logger(BluePrintEnhancerUtils)
fun populateDataTypes(
- bluePrintContext: BlueprintContext,
- bluePrintRepoService: BlueprintRepoService,
+ bluePrintContext: BluePrintContext,
+ bluePrintRepoService: BluePrintRepoService,
dataTypeName: String
): DataType {
val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
?: bluePrintRepoService.getDataType(dataTypeName)
- ?: throw BlueprintException("couldn't get DataType($dataTypeName) from repo.")
+ ?: throw BluePrintException("couldn't get DataType($dataTypeName) from repo.")
bluePrintContext.serviceTemplate.dataTypes?.put(dataTypeName, dataType)
return dataType
}
fun populateRelationshipType(
- bluePrintContext: BlueprintContext,
- bluePrintRepoService: BlueprintRepoService,
+ bluePrintContext: BluePrintContext,
+ bluePrintRepoService: BluePrintRepoService,
relationshipName: String
): RelationshipType {
val relationshipType = bluePrintContext.serviceTemplate.relationshipTypes?.get(relationshipName)
?: bluePrintRepoService.getRelationshipType(relationshipName)
- ?: throw BlueprintException("couldn't get RelationshipType($relationshipName) from repo.")
+ ?: throw BluePrintException("couldn't get RelationshipType($relationshipName) from repo.")
bluePrintContext.serviceTemplate.relationshipTypes?.put(relationshipName, relationshipType)
return relationshipType
}
fun populateNodeType(
- bluePrintContext: BlueprintContext,
- bluePrintRepoService: BlueprintRepoService,
+ bluePrintContext: BluePrintContext,
+ bluePrintRepoService: BluePrintRepoService,
nodeTypeName: String
): NodeType {
val nodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(nodeTypeName)
?: bluePrintRepoService.getNodeType(nodeTypeName)
- ?: throw BlueprintException("couldn't get NodeType($nodeTypeName) from repo.")
+ ?: throw BluePrintException("couldn't get NodeType($nodeTypeName) from repo.")
bluePrintContext.serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
return nodeType
}
fun populateArtifactType(
- bluePrintContext: BlueprintContext,
- bluePrintRepoService: BlueprintRepoService,
+ bluePrintContext: BluePrintContext,
+ bluePrintRepoService: BluePrintRepoService,
artifactTypeName: String
): ArtifactType {
val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName)
?: bluePrintRepoService.getArtifactType(artifactTypeName)
- ?: throw BlueprintException("couldn't get ArtifactType($artifactTypeName) from repo.")
+ ?: throw BluePrintException("couldn't get ArtifactType($artifactTypeName) from repo.")
bluePrintContext.serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
return artifactType
}
outputFileName: String = "enhanced-cba.zip"
): ByteArray {
val compressedFile = normalizedFile(archiveDir, outputFileName)
- BlueprintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
+ BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
return compressedFile.readBytes()
}
):
ResponseEntity<Resource> {
val compressedFile = normalizedFile(archiveDir, outputFileName)
- BlueprintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
+ BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
return prepareResourceEntity(compressedFile)
}