+ /**
+ * Merge a Map of String values with a Map of TOSCA Property Objects to create a combined Map. If there are
+ * duplicate keys then the TOSCA Property value takes precedence.
+ *
+ * @param stringProps
+ * initial Map of String property values (e.g. from the TOSCA YAML metadata section)
+ * @param toscaProps
+ * Map of TOSCA Property Type Object values to merge in (or overwrite)
+ * @return a Map of the property values converted to String
+ */
+ public Map<String, String> mergeProperties(Map<String, String> stringProps, Map<String, Property> toscaProps) {
+ Map<String, String> props = new HashMap<>(stringProps);
+ toscaProps.forEach((key, toscaProp) -> props.put(key,
+ toscaProp.getValue() == null ? "" : toscaProp.getValue().toString()));
+ return props;
+ }
+
+ public Resource createInstanceGroupModel(Map<String, String> properties) {
+ Resource groupModel = new Resource(Type.INSTANCE_GROUP, true);
+ groupModel.populateModelIdentificationInformation(properties);
+ return groupModel;
+ }
+
+ /**
+ * Add the resource/widget to the specified model.
+ *
+ * @param model
+ * @param relation
+ * resource or widget model to add
+ * @throws XmlArtifactGenerationException
+ * if the relation is a widget and there is no configuration defined for the relation's widget type
+ */
+ public void addRelatedModel(final Model model, final Resource relation) throws XmlArtifactGenerationException {
+ if (relation.getModelType() == ModelType.RESOURCE) {
+ model.addResource(relation);
+ } else {
+ model.addWidget(Widget.getWidget(relation.getWidgetType()));
+ }
+ }
+
+ public boolean hasAllottedResource(Map<String, String> metadata) {
+ return ALLOTTED_RESOURCE.equals(metadata.get(CATEGORY));
+ }
+
+ public boolean hasSubCategoryTunnelXConnect(Map<String, String> metadata) {
+ return TUNNEL_XCONNECT.equals(metadata.get(SUBCATEGORY));
+ }
+
+ /**
+ * Process TOSCA Group information for VF Modules.
+ *
+ * @param resources
+ * @param model
+ * @param serviceNode
+ * @throws XmlArtifactGenerationException
+ */
+ public void processVfModules(List<Resource> resources, Model resourceModel, NodeTemplate serviceNode)
+ throws XmlArtifactGenerationException {