@Override protected void processRelationshipOperation( RebuildRelationshipOperation operation, NodeTemplate nodeTemplate, RelationshipTemplate relationshipTemplate) { Topology topology = EditionContextManager.getTopology(); // rebuild a relationship template based on the current relationship type log.debug( "Rebuilding the relationship <{}> in the node template <{}> of topology <{}> .", operation.getRelationshipName(), operation.getNodeName(), topology.getId()); RelationshipType relType = ToscaContext.getOrFail(RelationshipType.class, relationshipTemplate.getType()); Map<String, AbstractPropertyValue> properties = Maps.newHashMap(); NodeTemplateBuilder.fillProperties( properties, relType.getProperties(), relationshipTemplate.getProperties()); relationshipTemplate.setProperties(properties); relationshipTemplate.setAttributes(relType.getAttributes()); }
@Override protected void processRelationshipOperation( DeleteRelationshipOperation operation, NodeTemplate nodeTemplate, RelationshipTemplate relationshipTemplate) { Topology topology = EditionContextManager.getTopology(); log.debug( "Removing the Relationship template <" + operation.getRelationshipName() + "> from the Node template <" + operation.getNodeName() + ">, Topology <" + topology.getId() + "> ."); topologyService.unloadType(topology, relationshipTemplate.getType()); nodeTemplate.getRelationships().remove(operation.getRelationshipName()); workflowBuilderService.removeRelationship( topology, operation.getNodeName(), operation.getRelationshipName(), relationshipTemplate); }