Search in sources :

Example 11 with GenericNode

use of org.structr.core.entity.GenericNode in project structr by structr.

the class TextSearchModuleTest 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;
    }
}
Also used : Tx(org.structr.core.graph.Tx) GenericNode(org.structr.core.entity.GenericNode) NodeInterface(org.structr.core.graph.NodeInterface) LinkedList(java.util.LinkedList)

Example 12 with GenericNode

use of org.structr.core.entity.GenericNode in project structr by structr.

the class StructrXMPPModuleTest 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;
    }
}
Also used : Tx(org.structr.core.graph.Tx) GenericNode(org.structr.core.entity.GenericNode) NodeInterface(org.structr.core.graph.NodeInterface) LinkedList(java.util.LinkedList)

Example 13 with GenericNode

use of org.structr.core.entity.GenericNode in project structr by structr.

the class StructrUiTest method createTestRelationships.

protected List<RelationshipInterface> createTestRelationships(final Class relType, final int number) throws FrameworkException {
    List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
    final GenericNode startNode = nodes.get(0);
    final GenericNode endNode = nodes.get(1);
    List<RelationshipInterface> rels = new LinkedList<>();
    for (int i = 0; i < number; i++) {
        rels.add(app.create(startNode, endNode, relType));
    }
    return rels;
}
Also used : GenericNode(org.structr.core.entity.GenericNode) RelationshipInterface(org.structr.core.graph.RelationshipInterface) LinkedList(java.util.LinkedList)

Example 14 with GenericNode

use of org.structr.core.entity.GenericNode in project structr by structr.

the class StructrCsvModuleTest 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;
    }
}
Also used : Tx(org.structr.core.graph.Tx) GenericNode(org.structr.core.entity.GenericNode) NodeInterface(org.structr.core.graph.NodeInterface) LinkedList(java.util.LinkedList)

Example 15 with GenericNode

use of org.structr.core.entity.GenericNode in project structr by structr.

the class StructrUiTest method createTestRelationships.

protected List<RelationshipInterface> createTestRelationships(final Class relType, final int number) throws FrameworkException {
    List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
    final GenericNode startNode = nodes.get(0);
    final GenericNode endNode = nodes.get(1);
    List<RelationshipInterface> rels = new LinkedList<>();
    for (int i = 0; i < number; i++) {
        rels.add(app.create(startNode, endNode, relType));
    }
    return rels;
}
Also used : GenericNode(org.structr.core.entity.GenericNode) RelationshipInterface(org.structr.core.graph.RelationshipInterface) LinkedList(java.util.LinkedList)

Aggregations

GenericNode (org.structr.core.entity.GenericNode)24 Tx (org.structr.core.graph.Tx)21 NodeInterface (org.structr.core.graph.NodeInterface)20 LinkedList (java.util.LinkedList)19 Test (org.junit.Test)5 FrameworkException (org.structr.common.error.FrameworkException)4 NodeHasLocation (org.structr.core.entity.relationship.NodeHasLocation)3 RelationshipInterface (org.structr.core.graph.RelationshipInterface)3 PropertyMap (org.structr.core.property.PropertyMap)2 IOException (java.io.IOException)1 DecimalFormat (java.text.DecimalFormat)1 ArrayList (java.util.ArrayList)1 RelationshipType (org.structr.api.graph.RelationshipType)1 Result (org.structr.core.Result)1 App (org.structr.core.app.App)1 StructrApp (org.structr.core.app.StructrApp)1 AbstractRelationship (org.structr.core.entity.AbstractRelationship)1 GenericRelationship (org.structr.core.entity.GenericRelationship)1 StructrUiTest (org.structr.web.StructrUiTest)1