From 8c9c4f1296fe54d984249a146544e23564fc0f60 Mon Sep 17 00:00:00 2001 From: YuanHu Date: Mon, 21 Nov 2016 09:49:20 +0800 Subject: Filtered the relationship which target node is same to the source node. Change-Id: I5e8a8148f7d449be1e7094dea4568d68d7fcff35 Issue-id: TOSCA-183 Signed-off-by: YuanHu --- .../catalog/model/parser/yaml/aria/AriaModelParser.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'catalog-core/catalog-mgr/src') diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/aria/AriaModelParser.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/aria/AriaModelParser.java index 5145d647..71372c2c 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/aria/AriaModelParser.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/aria/AriaModelParser.java @@ -186,7 +186,8 @@ public class AriaModelParser extends AbstractModelParser { * @return * @throws CatalogResourceException */ - private List parseNodeTemplateRelationShip(Relationship[] relationships, Node sourceNode, Node[] nodes) throws CatalogResourceException { + private List parseNodeTemplateRelationShip(Relationship[] relationships, + Node sourceNode, Node[] nodes) throws CatalogResourceException { List retList = new ArrayList<>(); if (relationships == null || relationships.length == 0) { @@ -194,6 +195,10 @@ public class AriaModelParser extends AbstractModelParser { } for (Relationship relationship : relationships) { + if (relationship.getTarget_node_id().equals(sourceNode.getId())) { + continue; // target == source, ignore. + } + RelationShip ret = new RelationShip(); ret.setSourceNodeId(sourceNode.getTemplate_name()); ret.setSourceNodeName(sourceNode.getTemplate_name()); -- cgit 1.2.3-korg