Support occurrences on node templates
[sdc.git] / catalog-ui / src / app / ng2 / services / properties.service.ts
index a22e2ae..f6b7732 100644 (file)
@@ -1,14 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+import * as _ from "lodash";
 import { Injectable } from '@angular/core';
-import { DataTypeModel, PropertyFEModel, PropertyBEModel, SchemaProperty, DerivedFEProperty, DerivedFEPropertyMap, DerivedPropertyType, InputFEModel} from "app/models";
-import { DataTypeService } from "./data-type.service";
-import { PROPERTY_TYPES } from "app/utils";
-import { ContentAfterLastDotPipe } from "../pipes/contentAfterLastDot.pipe";
-import { UUID } from "angular2-uuid";
+import { PropertyFEModel, PropertyBEModel, PropertyDeclareAPIModel, DerivedFEProperty} from "app/models";
 
 @Injectable()
 export class PropertiesService {
 
-    constructor(private dataTypeService: DataTypeService, private contentAfterLastDotPipe: ContentAfterLastDotPipe) {
+    checkedPropertyType: string;
+
+    constructor() {
     }
 
     public getParentPropertyFEModelFromPath = (properties: Array<PropertyFEModel>, path: string) => {
@@ -48,14 +67,14 @@ export class PropertiesService {
     }
 
     public getCheckedProperties = (properties: Array<PropertyFEModel>): Array<PropertyBEModel> => {
-        let selectedProps: Array<PropertyBEModel> = [];
+        let selectedProps: Array<PropertyDeclareAPIModel> = [];
         properties.forEach(prop => {
             if (prop.isSelected && !prop.isDeclared && !prop.isDisabled) {
-                selectedProps.push(new PropertyBEModel(prop));
+                selectedProps.push(new PropertyDeclareAPIModel(prop));
             } else if (prop.flattenedChildren) {
                 prop.flattenedChildren.forEach((child) => {
                     if (child.isSelected && !child.isDeclared && !child.isDisabled) {
-                        let childProp = new PropertyBEModel(prop, child); //create it from the parent
+                        let childProp = new PropertyDeclareAPIModel(prop, child); //create it from the parent
                         selectedProps.push(childProp);
                     }
                 })
@@ -64,5 +83,13 @@ export class PropertiesService {
         return selectedProps;
     }
 
+    setCheckedPropertyType(type: string){
+        this.checkedPropertyType = type;
+    }
+
+    getCheckedPropertyType(){
+        return this.checkedPropertyType;
+    }
+
 
-}
\ No newline at end of file
+}