+ private initValueForGetFunction(): void {
+ const property = this.$scope.editPropertyModel.property;
+ if (property.defaultValue) {
+ this.$scope.myValue = JSON.parse(property.defaultValue);
+ return;
+ }
+ if (this.isComplexType(property.type)) {
+ this.initEmptyComplexValue(property.type);
+ return;
+ }
+
+ this.$scope.myValue = undefined;
+ }
+
+ private initComponentInstanceMap() {
+ this.$scope.componentInstanceMap = new Map<string, InstanceFeDetails>();
+ if (this.compositionService.componentInstances) {
+ this.compositionService.componentInstances.forEach(value => {
+ this.$scope.componentInstanceMap.set(value.uniqueId, <InstanceFeDetails>{
+ name: value.name
+ });
+ });
+ }
+ }
+
+ private initCustomToscaFunctions() {
+ this.$scope.customToscaFunctions = [];
+ this.topologyTemplateService.getDefaultCustomFunction().toPromise().then((data) => {
+ for (let customFunction of data) {
+ this.$scope.customToscaFunctions.push(new CustomToscaFunction(customFunction));
+ }
+ });
+ }
+
+ private initEmptyComplexValue(type: string): any {
+ switch (type) {
+ case PROPERTY_TYPES.MAP:
+ this.$scope.myValue = {'': null};
+ break;
+ case PROPERTY_TYPES.LIST:
+ this.$scope.myValue = [];
+ break;
+ default:
+ this.$scope.myValue = {};
+ }
+ }
+
+ private isComplexType(type: string): boolean {
+ if (!type) {
+ return false;
+ }
+ return PROPERTY_DATA.SIMPLE_TYPES.indexOf(type) == -1;
+ }
+