Search in sources :

Example 31 with AbstractRelationship

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

the class GetRelationshipCommand method processMessage.

@Override
public void processMessage(final WebSocketMessage webSocketData) {
    final String nodeId = (String) webSocketData.getNodeData().get("nodeId");
    final AbstractRelationship rel = getRelationship(webSocketData.getId(), nodeId);
    if (rel != null) {
        webSocketData.setResult(Arrays.asList(rel));
        // send only over local connection (no broadcast)
        getWebSocket().send(webSocketData, true);
    } else {
        logger.warn("Relationship not found for id {}!", webSocketData.getId());
    // Not necessary to send a 404 here
    // getWebSocket().send(MessageBuilder.status().code(404).build(), true);
    }
}
Also used : AbstractRelationship(org.structr.core.entity.AbstractRelationship)

Aggregations

AbstractRelationship (org.structr.core.entity.AbstractRelationship)31 NodeInterface (org.structr.core.graph.NodeInterface)15 FrameworkException (org.structr.common.error.FrameworkException)11 AbstractNode (org.structr.core.entity.AbstractNode)9 SecurityContext (org.structr.common.SecurityContext)7 GraphObject (org.structr.core.GraphObject)6 Tx (org.structr.core.graph.Tx)6 Test (org.junit.Test)4 DatabaseService (org.structr.api.DatabaseService)4 App (org.structr.core.app.App)4 StructrApp (org.structr.core.app.StructrApp)4 ArrayList (java.util.ArrayList)3 TestOne (org.structr.core.entity.TestOne)3 PropertyKey (org.structr.core.property.PropertyKey)3 Href (org.structr.api.util.html.attr.Href)2 TestTwo (org.structr.core.entity.TestTwo)2 CreationContainer (org.structr.core.graph.CreationContainer)2 DOMNode (org.structr.web.entity.dom.DOMNode)2 FileOutputStream (java.io.FileOutputStream)1 HashSet (java.util.HashSet)1