summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/models')
-rw-r--r--catalog-ui/src/app/models/properties-inputs/property-be-model.ts16
-rw-r--r--catalog-ui/src/app/models/property-source.ts25
-rw-r--r--catalog-ui/src/app/models/tosca-get-function-dto.ts76
-rw-r--r--catalog-ui/src/app/models/tosca-get-function-type-converter.ts47
-rw-r--r--catalog-ui/src/app/models/tosca-get-function-type.ts (renamed from catalog-ui/src/app/models/tosca-get-function-type.enum.ts)0
5 files changed, 161 insertions, 3 deletions
diff --git a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
index 267a2adc71..a5bf3cb7a0 100644
--- a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
+++ b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
@@ -23,7 +23,9 @@ import {SchemaProperty, SchemaPropertyGroupModel} from '../schema-property';
import {ToscaPresentationData} from '../tosca-presentation';
import {PropertyInputDetail} from './property-input-detail';
import {Metadata} from '../metadata';
-import {ToscaGetFunctionType} from "../tosca-get-function-type.enum";
+import {ToscaGetFunctionType} from "../tosca-get-function-type";
+import {ToscaGetFunctionDto} from '../tosca-get-function-dto';
+import {PropertySource} from '../property-source';
export enum DerivedPropertyType {
SIMPLE,
@@ -66,7 +68,9 @@ export class PropertyBEModel {
inputPath: string;
toscaPresentation: ToscaPresentationData;
metadata: Metadata;
+ //deprecated
toscaGetFunctionType: ToscaGetFunctionType;
+ toscaGetFunction: ToscaGetFunctionDto;
constructor(property?: PropertyBEModel) {
if (property) {
@@ -92,7 +96,13 @@ export class PropertyBEModel {
this.getPolicyValues = property.getPolicyValues;
this.inputPath = property.inputPath;
this.metadata = property.metadata;
- this.toscaGetFunctionType = property.toscaGetFunctionType;
+ if (property.toscaGetFunction) {
+ this.toscaGetFunction = property.toscaGetFunction;
+ } else if (property.toscaGetFunctionType) {
+ this.toscaGetFunction = new ToscaGetFunctionDto();
+ this.toscaGetFunction.functionType = property.toscaGetFunctionType;
+ this.toscaGetFunction.propertySource = PropertySource.SELF;
+ }
}
if (!this.schema || !this.schema.property) {
@@ -171,7 +181,7 @@ export class PropertyBEModel {
* Checks whether the property value is a tosca get function (e.g. get_input, get_property, get_attribute)
*/
public isToscaGetFunction(): boolean {
- return this.toscaGetFunctionType != null;
+ return this.toscaGetFunction != null;
}
}
diff --git a/catalog-ui/src/app/models/property-source.ts b/catalog-ui/src/app/models/property-source.ts
new file mode 100644
index 0000000000..41ba1b6185
--- /dev/null
+++ b/catalog-ui/src/app/models/property-source.ts
@@ -0,0 +1,25 @@
+/*
+ * -
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+export enum PropertySource {
+ SELF = 'SELF',
+ INSTANCE = 'INSTANCE'
+}
diff --git a/catalog-ui/src/app/models/tosca-get-function-dto.ts b/catalog-ui/src/app/models/tosca-get-function-dto.ts
new file mode 100644
index 0000000000..b5ddad7b71
--- /dev/null
+++ b/catalog-ui/src/app/models/tosca-get-function-dto.ts
@@ -0,0 +1,76 @@
+/*
+ * -
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import {ToscaGetFunctionType} from './tosca-get-function-type';
+import {PropertySource} from './property-source';
+
+export class ToscaGetFunctionDto {
+ propertyUniqueId: string;
+ propertyName: string;
+ propertySource: PropertySource;
+ sourceUniqueId: string;
+ sourceName: string;
+ functionType: ToscaGetFunctionType;
+ propertyPathFromSource: Array<string>;
+}
+
+export class ToscaGetFunctionDtoBuilder {
+ toscaGetFunctionDto: ToscaGetFunctionDto = new ToscaGetFunctionDto();
+
+ withPropertyUniqueId(propertyUniqueId: string): ToscaGetFunctionDtoBuilder {
+ this.toscaGetFunctionDto.propertyUniqueId = propertyUniqueId;
+ return this;
+ }
+
+ withPropertyName(propertyName: string): ToscaGetFunctionDtoBuilder {
+ this.toscaGetFunctionDto.propertyName = propertyName;
+ return this;
+ }
+
+ withPropertySource(propertySource: PropertySource): ToscaGetFunctionDtoBuilder {
+ this.toscaGetFunctionDto.propertySource = propertySource;
+ return this;
+ }
+
+ withSourceUniqueId(sourceUniqueId: string): ToscaGetFunctionDtoBuilder {
+ this.toscaGetFunctionDto.sourceUniqueId = sourceUniqueId;
+ return this;
+ }
+
+ withSourceName(sourceName: string): ToscaGetFunctionDtoBuilder {
+ this.toscaGetFunctionDto.sourceName = sourceName;
+ return this;
+ }
+
+ withFunctionType(functionType: ToscaGetFunctionType): ToscaGetFunctionDtoBuilder {
+ this.toscaGetFunctionDto.functionType = functionType;
+ return this;
+ }
+
+ withPropertyPathFromSource(propertyPathFromSource: Array<string>): ToscaGetFunctionDtoBuilder {
+ this.toscaGetFunctionDto.propertyPathFromSource = propertyPathFromSource;
+ return this;
+ }
+
+ build(): ToscaGetFunctionDto {
+ return this.toscaGetFunctionDto;
+ }
+}
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
new file mode 100644
index 0000000000..0447c4bce3
--- /dev/null
+++ b/catalog-ui/src/app/models/tosca-get-function-type-converter.ts
@@ -0,0 +1,47 @@
+/*
+ * -
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import {ToscaGetFunctionType} from './tosca-get-function-type';
+
+export class ToscaGetFunctionTypeConverter {
+
+ static convertFromString(toscaGetFunction: string): ToscaGetFunctionType {
+ if (!toscaGetFunction) {
+ return;
+ }
+
+ if (ToscaGetFunctionType.GET_INPUT === toscaGetFunction.toUpperCase()) {
+ return ToscaGetFunctionType.GET_INPUT;
+ }
+
+ if (ToscaGetFunctionType.GET_PROPERTY === toscaGetFunction.toUpperCase()) {
+ return ToscaGetFunctionType.GET_PROPERTY;
+ }
+
+ if (ToscaGetFunctionType.GET_ATTRIBUTE === toscaGetFunction.toUpperCase()) {
+ return ToscaGetFunctionType.GET_ATTRIBUTE;
+ }
+
+ return undefined;
+
+ }
+
+}
diff --git a/catalog-ui/src/app/models/tosca-get-function-type.enum.ts b/catalog-ui/src/app/models/tosca-get-function-type.ts
index 1ee4ae1eae..1ee4ae1eae 100644
--- a/catalog-ui/src/app/models/tosca-get-function-type.enum.ts
+++ b/catalog-ui/src/app/models/tosca-get-function-type.ts