2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
22 * Created by osonsino on 16/05/2016.
25 import { PROPERTY_DATA } from 'app/utils/constants';
27 export class SchemaPropertyGroupModel {
28 property: SchemaProperty;
30 constructor(schemaProperty?: SchemaProperty) {
31 this.property = schemaProperty;
35 export class SchemaProperty {
44 isSimpleType: boolean;
46 private _derivedFromSimpleTypeName: string;
47 get derivedFromSimpleTypeName(): string {
48 return this._derivedFromSimpleTypeName;
50 set derivedFromSimpleTypeName(derivedFromSimpleTypeName: string) {
51 this._derivedFromSimpleTypeName = derivedFromSimpleTypeName;
54 constructor(schemaProperty?: SchemaProperty) {
56 this.type = schemaProperty.type;
57 this.required = schemaProperty.required;
58 this.definition = schemaProperty.definition;
59 this.description = schemaProperty.description;
60 this.password = schemaProperty.password;
61 this.simpleType = schemaProperty.simpleType;
62 this.isSimpleType = (-1 < PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.type));
63 this.isDataType = PROPERTY_DATA.TYPES.indexOf(this.type) === -1;
67 public toJSON = (): any => {
68 this.simpleType = undefined;
69 this.isSimpleType = undefined;
70 this.isDataType = undefined;
71 this._derivedFromSimpleTypeName = undefined;