Added exportNode() method that takes a DbMapping as second argument.
This commit is contained in:
parent
ff6b590148
commit
adbd17d6aa
1 changed files with 25 additions and 7 deletions
|
@ -463,20 +463,38 @@ public final class NodeManager {
|
||||||
/**
|
/**
|
||||||
* Insert a node into a different (relational) database than its default one.
|
* Insert a node into a different (relational) database than its default one.
|
||||||
*/
|
*/
|
||||||
public void exportNode(Node node, DbSource dbs)
|
public void exportNode(Node node, DbSource dbs)
|
||||||
|
throws IOException, SQLException, ClassNotFoundException {
|
||||||
|
if (node == null) {
|
||||||
|
throw new IllegalArgumentException("Node can't be null in exportNode");
|
||||||
|
}
|
||||||
|
|
||||||
|
DbMapping dbm = node.getDbMapping();
|
||||||
|
|
||||||
|
if (dbs == null) {
|
||||||
|
throw new IllegalArgumentException("DbSource can't be null in exportNode");
|
||||||
|
} else if ((dbm == null) || !dbm.isRelational()) {
|
||||||
|
throw new IllegalArgumentException("Can't export into non-relational database");
|
||||||
|
} else {
|
||||||
|
insertRelationalNode(node, dbm, dbs.getConnection());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a node into a different (relational) database than its default one.
|
||||||
|
*/
|
||||||
|
public void exportNode(Node node, DbMapping dbm)
|
||||||
throws IOException, SQLException, ClassNotFoundException {
|
throws IOException, SQLException, ClassNotFoundException {
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
throw new IllegalArgumentException("Node can't be null in exportNode");
|
throw new IllegalArgumentException("Node can't be null in exportNode");
|
||||||
}
|
}
|
||||||
|
|
||||||
DbMapping dbm = node.getDbMapping();
|
if (dbm == null) {
|
||||||
|
throw new IllegalArgumentException("DbMapping can't be null in exportNode");
|
||||||
if (dbs == null) {
|
|
||||||
throw new IllegalArgumentException("DbSource can't be null in exportNode");
|
|
||||||
} else if ((dbm == null) || !dbm.isRelational()) {
|
} else if ((dbm == null) || !dbm.isRelational()) {
|
||||||
throw new SQLException("Can't export into non-relational database");
|
throw new IllegalArgumentException("Can't export into non-relational database");
|
||||||
} else {
|
} else {
|
||||||
insertRelationalNode(node, dbm, dbs.getConnection());
|
insertRelationalNode(node, dbm, dbm.getConnection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue