Create new VSP, onboard from TOSCA file - UI
[sdc.git] / openecomp-be / lib / openecomp-tosca-lib / src / main / java / org / openecomp / sdc / tosca / datatypes / ToscaServiceModel.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.tosca.datatypes;
22
23 import org.openecomp.core.utilities.file.FileContentHandler;
24 import org.openecomp.sdc.datatypes.model.AsdcModel;
25 import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
26 import org.openecomp.sdc.tosca.services.DataModelUtil;
27
28 import java.util.Collections;
29 import java.util.Map;
30
31 /**
32  * Tosca service model.
33  */
34 public class ToscaServiceModel implements AsdcModel {
35   private FileContentHandler artifactFiles;
36   private FileContentHandler externalFiles;
37   private Map<String, ServiceTemplate> serviceTemplates;
38   private String entryDefinitionServiceTemplate;
39
40   public ToscaServiceModel() {
41   }
42
43   /**
44    * Instantiates a new Tosca service model.
45    *
46    * @param artifactFiles                  the artifact files
47    * @param serviceTemplates               the service templates
48    * @param entryDefinitionServiceTemplate the entry definition service template
49    */
50   public ToscaServiceModel(FileContentHandler artifactFiles,
51                            Map<String, ServiceTemplate> serviceTemplates,
52                            String entryDefinitionServiceTemplate) {
53     this.artifactFiles = artifactFiles;
54     this.serviceTemplates = serviceTemplates;
55     this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate;
56   }
57
58   public ToscaServiceModel(FileContentHandler artifactFiles,
59                            FileContentHandler externalFiles,
60                            Map<String, ServiceTemplate> serviceTemplates,
61                            String entryDefinitionServiceTemplate) {
62     this.artifactFiles = artifactFiles;
63     this.externalFiles = externalFiles;
64     this.serviceTemplates = serviceTemplates;
65     this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate;
66   }
67
68   /**
69    * Gets artifact files.
70    *
71    * @return the artifact files
72    */
73   public FileContentHandler getArtifactFiles() {
74     return artifactFiles;
75   }
76
77   public void setArtifactFiles(FileContentHandler artifactFiles) {
78     this.artifactFiles = artifactFiles;
79   }
80
81   /**
82    * Gets service templates.
83    *
84    * @return the service templates
85    */
86   public Map<String, ServiceTemplate> getServiceTemplates() {
87     return Collections.unmodifiableMap(serviceTemplates);
88   }
89
90   /**
91    * Sets service templates.
92    *
93    * @param serviceTemplates the service templates
94    */
95   public void setServiceTemplates(Map<String, ServiceTemplate> serviceTemplates) {
96     this.serviceTemplates = serviceTemplates;
97   }
98
99   /**
100    * Gets entry definition service template.
101    *
102    * @return the entry definition service template
103    */
104   public String getEntryDefinitionServiceTemplate() {
105     return entryDefinitionServiceTemplate;
106   }
107
108   /**
109    * Sets entry definition service template.
110    *
111    * @param entryDefinitionServiceTemplate the entry definition service template
112    */
113   public void setEntryDefinitionServiceTemplate(String entryDefinitionServiceTemplate) {
114     this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate;
115   }
116
117   /**
118    * Gets cloned service model.
119    *
120    * @param toscaServiceModel the tosca service model
121    * @return the cloned service model
122    */
123   public static ToscaServiceModel getClonedServiceModel(ToscaServiceModel toscaServiceModel) {
124     return ToscaServiceModel.class.cast(DataModelUtil.getClonedObject(toscaServiceModel));
125   }
126
127   public FileContentHandler getExternalFiles() {
128     return externalFiles;
129   }
130
131   public void setExternalFiles(FileContentHandler externalFiles) {
132     this.externalFiles = externalFiles;
133   }
134 }