Skip to content

Commit 2e5300d

Browse files
committed
Load inheritances from db
1 parent 444f169 commit 2e5300d

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

generator/org.svis.generator/src/org/svis/generator/famix/Famix2Famix.xtend

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,19 @@ class Famix2Famix extends WorkflowComponentWithConfig {
185185
}
186186

187187
]
188+
graph.execute("MATCH p=()-[r:EXTENDS]->() RETURN r").forEach [ row |
189+
val rel = row.get("r") as Relationship
190+
if (classes.containsKey(rel.startNode.id) && classes.containsKey(rel.endNode.id)) {
191+
val inheritance = famixFactory.createFAMIXInheritance
192+
val subclassRef = famixFactory.createIntegerReference
193+
val superclassRef = famixFactory.createIntegerReference
194+
subclassRef.ref = classes.get(rel.startNode.id)
195+
superclassRef.ref = classes.get(rel.endNode.id)
196+
inheritance.subclass = subclassRef
197+
inheritance.superclass = superclassRef
198+
famixDocument.elements += inheritance
199+
}
200+
]
188201
println("finish")
189202
tx.success
190203
} catch (Exception e) {
@@ -708,6 +721,8 @@ class Famix2Famix extends WorkflowComponentWithConfig {
708721
class.name = node.id.toString
709722
if (node.hasProperty("name")) {
710723
class.value = node.getProperty("name") as String
724+
} else {
725+
class.value = ""
711726
}
712727
if (node.hasProperty("fqn")) {
713728
class.fqn = node.getProperty("fqn") as String

generator/org.svis.generator/src/org/svis/generator/famix/Rels.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
import org.neo4j.graphdb.RelationshipType;
44

55
public enum Rels implements RelationshipType {
6-
CONTAINS, DECLARES
6+
CONTAINS, DECLARES, EXTENDS
77
}

0 commit comments

Comments
 (0)