Search in sources :

Example 6 with RelationshipType

use of org.structr.api.graph.RelationshipType in project structr by structr.

the class AbstractNode method getRelationships.

@Override
public final <A extends NodeInterface, B extends NodeInterface, S extends Source, T extends Target, R extends Relation<A, B, S, T>> Iterable<R> getRelationships(final Class<R> type) {
    final RelationshipFactory<R> factory = new RelationshipFactory<>(securityContext);
    final R template = getRelationshipForType(type);
    final Direction direction = template.getDirectionForType(entityType);
    final RelationshipType relType = template;
    return new IterableAdapter<>(dbNode.getRelationships(direction, relType), factory);
}
Also used : IterableAdapter(org.structr.core.IterableAdapter) RelationshipFactory(org.structr.core.graph.RelationshipFactory) RelationshipType(org.structr.api.graph.RelationshipType) Direction(org.structr.api.graph.Direction)

Example 7 with RelationshipType

use of org.structr.api.graph.RelationshipType in project structr by structr.

the class AbstractNode method getRelationshipsAsSuperUser.

protected final <A extends NodeInterface, B extends NodeInterface, S extends Source, T extends Target, R extends Relation<A, B, S, T>> Iterable<R> getRelationshipsAsSuperUser(final Class<R> type) {
    final RelationshipFactory<R> factory = new RelationshipFactory<>(SecurityContext.getSuperUserInstance());
    final R template = getRelationshipForType(type);
    final Direction direction = template.getDirectionForType(entityType);
    final RelationshipType relType = template;
    return new IterableAdapter<>(dbNode.getRelationships(direction, relType), factory);
}
Also used : IterableAdapter(org.structr.core.IterableAdapter) RelationshipFactory(org.structr.core.graph.RelationshipFactory) RelationshipType(org.structr.api.graph.RelationshipType) Direction(org.structr.api.graph.Direction)

Aggregations

RelationshipType (org.structr.api.graph.RelationshipType)7 LinkedHashSet (java.util.LinkedHashSet)2 Direction (org.structr.api.graph.Direction)2 GraphObject (org.structr.core.GraphObject)2 IterableAdapter (org.structr.core.IterableAdapter)2 AbstractRelationship (org.structr.core.entity.AbstractRelationship)2 NodeInterface (org.structr.core.graph.NodeInterface)2 RelationshipFactory (org.structr.core.graph.RelationshipFactory)2 BufferedInputStream (java.io.BufferedInputStream)1 DataInputStream (java.io.DataInputStream)1 EOFException (java.io.EOFException)1 IOException (java.io.IOException)1 DecimalFormat (java.text.DecimalFormat)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedList (java.util.LinkedList)1 Test (org.junit.Test)1 Node (org.structr.api.graph.Node)1 PropertyContainer (org.structr.api.graph.PropertyContainer)1