[SDC] Onboarding 1710 rebase.
[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 Map<String, ServiceTemplate> serviceTemplates;
37   private String entryDefinitionServiceTemplate;
38
39   public ToscaServiceModel() {
40   }
41
42   /**
43    * Instantiates a new Tosca service model.
44    *
45    * @param artifactFiles                  the artifact files
46    * @param serviceTemplates               the service templates
47    * @param entryDefinitionServiceTemplate the entry definition service template
48    */
49   public ToscaServiceModel(FileContentHandler artifactFiles,
50                            Map<String, ServiceTemplate> serviceTemplates,
51                            String entryDefinitionServiceTemplate) {
52     this.artifactFiles = artifactFiles;
53     this.serviceTemplates = serviceTemplates;
54     this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate;
55   }
56
57
58   /**
59    * Gets artifact files.
60    *
61    * @return the artifact files
62    */
63   public FileContentHandler getArtifactFiles() {
64     return artifactFiles;
65   }
66
67   public void setArtifactFiles(FileContentHandler artifactFiles) {
68     this.artifactFiles = artifactFiles;
69   }
70
71   /**
72    * Gets service templates.
73    *
74    * @return the service templates
75    */
76   public Map<String, ServiceTemplate> getServiceTemplates() {
77     return Collections.unmodifiableMap(serviceTemplates);
78   }
79
80   /**
81    * Sets service templates.
82    *
83    * @param serviceTemplates the service templates
84    */
85   public void setServiceTemplates(Map<String, ServiceTemplate> serviceTemplates) {
86     this.serviceTemplates = serviceTemplates;
87   }
88
89   /**
90    * Gets entry definition service template.
91    *
92    * @return the entry definition service template
93    */
94   public String getEntryDefinitionServiceTemplate() {
95     return entryDefinitionServiceTemplate;
96   }
97
98   /**
99    * Sets entry definition service template.
100    *
101    * @param entryDefinitionServiceTemplate the entry definition service template
102    */
103   public void setEntryDefinitionServiceTemplate(String entryDefinitionServiceTemplate) {
104     this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate;
105   }
106
107   /**
108    * Gets cloned service model.
109    *
110    * @param toscaServiceModel the tosca service model
111    * @return the cloned service model
112    */
113   public static ToscaServiceModel getClonedServiceModel(ToscaServiceModel toscaServiceModel) {
114     return ToscaServiceModel.class.cast(DataModelUtil.getClonedObject(toscaServiceModel));
115   }
116 }