@@ -45,7 +45,6 @@ import org.svis.lib.database.Database
4545import org.svis.lib.database.DBConnector
4646import org.neo4j.graphdb.Node
4747import org.neo4j.graphdb.Label
48- import org.neo4j.graphdb.traversal.Evaluators
4948import org.neo4j.graphdb.Direction
5049import org.neo4j.graphdb.traversal.Uniqueness
5150
@@ -114,6 +113,8 @@ class Famix2Famix extends WorkflowComponentWithConfig {
114113 type = " Class"
115114 } else if (label. name == " Method" ) {
116115 type = " Method"
116+ } else if (label. name == " Field" ) {
117+ type = " Field"
117118 }
118119 }
119120 switch (type) {
@@ -171,6 +172,22 @@ class Famix2Famix extends WorkflowComponentWithConfig {
171172 method. sourceAnchor = anchorRef
172173 famixDocument. elements + = method
173174 }
175+ case " Field" : {
176+ val attribute = createAttribute(node)
177+ val parentClass = classes. get(parent. id)
178+ var ref = famixFactory. createIntegerReference
179+ ref. ref = parentClass
180+ attribute. parentType = ref
181+ val fileAnchor = famixFactory. createFAMIXFileAnchor
182+ val anchorRef = famixFactory. createIntegerReference
183+ val attributeRef = famixFactory. createIntegerReference
184+ fileAnchor. filename = parent. getProperty(" sourceFileName" ) as String
185+ anchorRef. ref = attribute
186+ attributeRef. ref = fileAnchor
187+ fileAnchor. element = attributeRef
188+ attribute. sourceAnchor = anchorRef
189+ famixDocument. elements+ = attribute
190+ }
174191 }
175192 ]
176193 ]
@@ -679,7 +696,7 @@ class Famix2Famix extends WorkflowComponentWithConfig {
679696
680697 def createNamespace (Node node ) {
681698 val namespace = famixFactory. createFAMIXNamespace
682- val id = node. getId . toString
699+ val id = node. id . toString
683700 namespace. name = id
684701 namespace. id = id
685702 namespace. value = node. getProperty(" name" ) as String
@@ -689,7 +706,7 @@ class Famix2Famix extends WorkflowComponentWithConfig {
689706
690707 def createClass (Node node ) {
691708 val class = famixFactory. createFAMIXClass
692- class. name = node. getId . toString
709+ class. name = node. id . toString
693710 if (node. hasProperty(" name" )) {
694711 class. value = node. getProperty(" name" ) as String
695712 }
@@ -712,7 +729,7 @@ class Famix2Famix extends WorkflowComponentWithConfig {
712729
713730 def createMethod (Node node ) {
714731 val method = famixFactory. createFAMIXMethod
715- method. name = node. getId . toString
732+ method. name = node. id . toString
716733 if (node. hasProperty(" name" )) {
717734 method. value = node. getProperty(" name" ) as String
718735 }
@@ -728,4 +745,16 @@ class Famix2Famix extends WorkflowComponentWithConfig {
728745 method. signature = node. getProperty(" signature" ) as String
729746 return method
730747 }
748+
749+ def createAttribute (Node node ) {
750+ val attribute = famixFactory. createFAMIXAttribute
751+ attribute. name = node. id. toString
752+ if (node. hasProperty(" name" )) {
753+ attribute. value = node. getProperty(" name" ) as String
754+ }
755+ if (node. hasProperty(" visibility" )) {
756+ attribute. modifiers+ = node. getProperty(" visibility" ) as String
757+ }
758+ return attribute
759+ }
731760}
0 commit comments