diff options
author | 2022-07-07 17:17:52 +0100 | |
---|---|---|
committer | 2022-07-18 14:22:12 +0000 | |
commit | 68733163804ed2efed8223a04ab0a7a0714a8b33 (patch) | |
tree | 013f4d25042aa776120971a612a52d64db52f7a7 /catalog-ui/src/app/models/tosca-get-function-type-converter.ts | |
parent | 4e4ec8e9c21acf7f9210aaebf8f13a60542737fc (diff) |
Support for concat TOSCA function
Adds support for the concat TOSCA function in an instance property.
Refactors the TOSCA function structure so it can be more generic to
support other functions in the future.
Change-Id: I338e4138d26afe21779da57c4eeb3f2d486c20a9
Issue-ID: SDC-4095
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-ui/src/app/models/tosca-get-function-type-converter.ts')
-rw-r--r-- | catalog-ui/src/app/models/tosca-get-function-type-converter.ts | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/catalog-ui/src/app/models/tosca-get-function-type-converter.ts b/catalog-ui/src/app/models/tosca-get-function-type-converter.ts index 0447c4bce3..ad3385af64 100644 --- a/catalog-ui/src/app/models/tosca-get-function-type-converter.ts +++ b/catalog-ui/src/app/models/tosca-get-function-type-converter.ts @@ -20,28 +20,47 @@ */ import {ToscaGetFunctionType} from './tosca-get-function-type'; +import {ToscaFunctionType} from "./tosca-function-type.enum"; export class ToscaGetFunctionTypeConverter { - static convertFromString(toscaGetFunction: string): ToscaGetFunctionType { - if (!toscaGetFunction) { - return; - } + static convertFromString(toscaGetFunction: string): ToscaGetFunctionType { + if (!toscaGetFunction) { + return; + } - if (ToscaGetFunctionType.GET_INPUT === toscaGetFunction.toUpperCase()) { - return ToscaGetFunctionType.GET_INPUT; - } + if (ToscaGetFunctionType.GET_INPUT === toscaGetFunction.toUpperCase()) { + return ToscaGetFunctionType.GET_INPUT; + } - if (ToscaGetFunctionType.GET_PROPERTY === toscaGetFunction.toUpperCase()) { - return ToscaGetFunctionType.GET_PROPERTY; - } + if (ToscaGetFunctionType.GET_PROPERTY === toscaGetFunction.toUpperCase()) { + return ToscaGetFunctionType.GET_PROPERTY; + } + + if (ToscaGetFunctionType.GET_ATTRIBUTE === toscaGetFunction.toUpperCase()) { + return ToscaGetFunctionType.GET_ATTRIBUTE; + } + + return undefined; - if (ToscaGetFunctionType.GET_ATTRIBUTE === toscaGetFunction.toUpperCase()) { - return ToscaGetFunctionType.GET_ATTRIBUTE; } - return undefined; + /** + * Converts a ToscaGetFunctionType to a ToscaFunctionType + * @param toscaGetFunctionType + */ + static convertToToscaFunctionType(toscaGetFunctionType: ToscaGetFunctionType): ToscaFunctionType { + switch (toscaGetFunctionType) { + case ToscaGetFunctionType.GET_INPUT: + return ToscaFunctionType.GET_INPUT; + case ToscaGetFunctionType.GET_ATTRIBUTE: + return ToscaFunctionType.GET_ATTRIBUTE; + case ToscaGetFunctionType.GET_PROPERTY: + return ToscaFunctionType.GET_PROPERTY; + default: + return undefined; + } - } + } } |