use of org.structr.core.graph.NodeInterface in project structr by structr.
the class StructrODFModuleTest method createTestRelationships.
protected <T extends Relation> List<T> createTestRelationships(final Class<T> relType, final int number) throws FrameworkException {
List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
final NodeInterface startNode = nodes.get(0);
final NodeInterface endNode = nodes.get(1);
try (final Tx tx = app.tx()) {
List<T> rels = new LinkedList<>();
for (int i = 0; i < number; i++) {
rels.add((T) app.create(startNode, endNode, relType));
}
tx.success();
return rels;
}
}
use of org.structr.core.graph.NodeInterface in project structr by structr.
the class StructrLDAPServerModuleTest method cleanDatabase.
@Before
public void cleanDatabase() {
try (final Tx tx = app.tx()) {
final List<? extends NodeInterface> nodes = app.nodeQuery().getAsList();
logger.info("Cleaning database: {} nodes", nodes.size());
for (final NodeInterface node : nodes) {
app.delete(node);
}
// delete remaining nodes without UUIDs etc.
app.cypher("MATCH (n)-[r]-(m) DELETE n, r, m", Collections.emptyMap());
tx.success();
} catch (FrameworkException fex) {
logger.error("Exception while trying to clean database: {}", fex);
}
}
use of org.structr.core.graph.NodeInterface in project structr by structr.
the class StructrLDAPServerModuleTest method createTestRelationships.
protected <T extends Relation> List<T> createTestRelationships(final Class<T> relType, final int number) throws FrameworkException {
List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
final NodeInterface startNode = nodes.get(0);
final NodeInterface endNode = nodes.get(1);
try (final Tx tx = app.tx()) {
List<T> rels = new LinkedList<>();
for (int i = 0; i < number; i++) {
rels.add((T) app.create(startNode, endNode, relType));
}
tx.success();
return rels;
}
}
use of org.structr.core.graph.NodeInterface in project structr by structr.
the class StructrMediaModuleTest method cleanDatabase.
@Before
public void cleanDatabase() {
try (final Tx tx = app.tx()) {
final List<? extends NodeInterface> nodes = app.nodeQuery().getAsList();
logger.info("Cleaning database: {} nodes", nodes.size());
for (final NodeInterface node : nodes) {
app.delete(node);
}
// delete remaining nodes without UUIDs etc.
app.cypher("MATCH (n)-[r]-(m) DELETE n, r, m", Collections.emptyMap());
tx.success();
} catch (FrameworkException fex) {
logger.error("Exception while trying to clean database: {}", fex);
}
}
use of org.structr.core.graph.NodeInterface in project structr by structr.
the class StructrMediaModuleTest method createTestRelationships.
protected <T extends Relation> List<T> createTestRelationships(final Class<T> relType, final int number) throws FrameworkException {
List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
final NodeInterface startNode = nodes.get(0);
final NodeInterface endNode = nodes.get(1);
try (final Tx tx = app.tx()) {
List<T> rels = new LinkedList<>();
for (int i = 0; i < number; i++) {
rels.add((T) app.create(startNode, endNode, relType));
}
tx.success();
return rels;
}
}
Aggregations