Add new code new version
[sdc.git] / dox-sequence-diagram-ui / src / main / webapp / lib / ecomp / asdc / sequencer / model / demo / scenarios / Scenarios.js
1 /*!
2  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13  * or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  */
16
17 /**
18  * Example scenarios, for development, testing and demos.
19  */
20 export default class Scenarios {
21
22   // ///////////////////////////////////////////////////////////////////////////////////////////////
23
24   /**
25    * Construct scenarios; read model and metamodel templates.
26    */
27   constructor() {
28     this.templates = {
29       model: {
30         ecomp: require('./model/ECOMP.json'),
31         blank: require('./model/BLANK.json'),
32         dimensions: require('./model/DIMENSIONS.json'),
33       },
34       metamodel: {
35         ecomp: require('./metamodel/ECOMP.json'),
36         blank: require('./metamodel/BLANK.json'),
37       },
38     };
39   }
40
41   // ///////////////////////////////////////////////////////////////////////////////////////////////
42
43   /**
44    * Get ECOMP scenario.
45    * @return ECOMP scenario JSON.
46    */
47   getECOMP() {
48     return JSON.parse(JSON.stringify(this.templates.model.ecomp));
49   }
50
51   // ///////////////////////////////////////////////////////////////////////////////////////////////
52
53   /**
54    * Get ECOMP scenario metamodel.
55    * @return scenario metamodel JSON.
56    */
57   getECOMPMetamodel() {
58     return JSON.parse(JSON.stringify(this.templates.metamodel.ecomp));
59   }
60
61   // ///////////////////////////////////////////////////////////////////////////////////////////////
62
63   /**
64    * Get blank scenario.
65    * @return blank scenario JSON.
66    */
67   getBlank() {
68     return JSON.parse(JSON.stringify(this.templates.model.blank));
69   }
70
71   // ///////////////////////////////////////////////////////////////////////////////////////////////
72
73   /**
74    * Get empty scenario metamodel.
75    * @return empty metamodel JSON.
76    */
77   getBlankMetamodel() {
78     return JSON.parse(JSON.stringify(this.templates.metamodel.blank));
79   }
80
81   // ///////////////////////////////////////////////////////////////////////////////////////////////
82
83   /**
84    * Get scenario.
85    * @return scenario JSON.
86    */
87   getDimensions() {
88     return JSON.parse(JSON.stringify(this.templates.model.dimensions));
89   }
90
91   // ///////////////////////////////////////////////////////////////////////////////////////////////
92
93   /**
94    * Get scenario metamodel.
95    * @return metamodel JSON.
96    */
97   getDimensionsMetamodel() {
98     return JSON.parse(JSON.stringify(this.templates.metamodel.blank));
99   }
100
101   // ///////////////////////////////////////////////////////////////////////////////////////////////
102
103   /**
104    * Get demo metamodels.
105    * @returns {*[]}
106    */
107   getMetamodels() {
108     return [this.getBlankMetamodel(), this.getDimensionsMetamodel(), this.getECOMPMetamodel()];
109   }
110 }