-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
10 changed files
with
417 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package apoc.export.graphml; | ||
|
||
import apoc.export.util.ExportConfig; | ||
import org.neo4j.graphdb.Node; | ||
import org.neo4j.graphdb.Relationship; | ||
|
||
import static apoc.export.util.ExportConfig.NodeConfig; | ||
|
||
public class XmlNodeExport { | ||
|
||
public interface ExportNode { | ||
NodeConfig getNodeConfig(ExportConfig config); | ||
NodeConfig getNodeConfigReader(XmlGraphMLReader reader); | ||
Node getNode(Relationship rel); | ||
} | ||
|
||
enum NodeType { | ||
SOURCE("source", new ExportNode() { | ||
@Override | ||
public ExportConfig.NodeConfig getNodeConfig(ExportConfig config) { | ||
return config.getSource(); | ||
} | ||
|
||
@Override | ||
public Node getNode(Relationship rel) { | ||
return rel.getStartNode(); | ||
} | ||
|
||
@Override | ||
public NodeConfig getNodeConfigReader(XmlGraphMLReader reader) { | ||
return reader.getSource(); | ||
} | ||
}), | ||
|
||
TARGET("target", new ExportNode() { | ||
@Override | ||
public ExportConfig.NodeConfig getNodeConfig(ExportConfig config) { | ||
return config.getTarget(); | ||
} | ||
|
||
@Override | ||
public Node getNode(Relationship rel) { | ||
return rel.getEndNode(); | ||
} | ||
|
||
@Override | ||
public NodeConfig getNodeConfigReader(XmlGraphMLReader reader) { | ||
return reader.getTarget(); | ||
} | ||
}); | ||
|
||
private final String name; | ||
private final ExportNode exportNode; | ||
|
||
NodeType(String name, ExportNode exportNode) { | ||
this.name = name; | ||
this.exportNode = exportNode; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getNameType() { | ||
return name + "Type"; | ||
} | ||
|
||
ExportNode get() { | ||
return exportNode; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.