From f9d6401d97b370a8e28d7c502a39665b8eb172be Mon Sep 17 00:00:00 2001 From: gakin <gakin> Date: Mon, 12 Sep 2016 18:42:57 +0000 Subject: [PATCH] SSDM-4099: Add differentiation to the DOT representation for experiments with the same codes. SVN: 37056 --- .../shared/entitygraph/EntityGraph.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/shared/entitygraph/EntityGraph.java b/openbis/source/java/ch/ethz/sis/openbis/generic/shared/entitygraph/EntityGraph.java index 4e0e8f43332..be39a04a156 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/shared/entitygraph/EntityGraph.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/shared/entitygraph/EntityGraph.java @@ -114,20 +114,36 @@ public class EntityGraph<N extends Node<?>> List<EdgeNodePair> list = adjacencyMap.get(node); if (list.isEmpty() && node.getEntityKind().equals("DATA_SET") == false) { - sb.append("\"" + node.getCode() + "(" + node.getEntityKind().charAt(0) + ")\";"); + sb.append(getRightHandNodeRep(node)); sb.append(System.getProperty("line.separator")); continue; } for (EdgeNodePair edgeNodePair : list) { Node<?> neighbourNode = edgeNodePair.getNode(); - sb.append("\"" + node.getCode() + "(" + node.getEntityKind().charAt(0) + ")\" -> \"" - + neighbourNode.getCode() + "(" + neighbourNode.getEntityKind().charAt(0) + ")\";"); + sb.append("\"" + node.getCode() + "(" + node.getEntityKind().charAt(0) + getDifferentiatorStr(node) + ")\" -> " + + getRightHandNodeRep(neighbourNode)); sb.append(System.getProperty("line.separator")); } } return sb.toString(); } + + private String getRightHandNodeRep(Node<?> node) + { + return "\"" + node.getCode() + "(" + node.getEntityKind().charAt(0) + getDifferentiatorStr(node) + ")\";"; + } + + private String getDifferentiatorStr(Node<?> node) + { + String differentiatorStr = ""; + if (node.getEntityKind().equals("EXPERIMENT")) // in order to differentiate between experiments in the same space but under different projects + { + differentiatorStr = + node.getPermId().substring(node.getPermId().indexOf('-') + 1); + } + return differentiatorStr; + } private void printGraphInDOT(String spaceId) { -- GitLab