use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.
the class ExecuteConnectCommandAction method createWonMessage.
protected WonMessage createWonMessage(ConnectCommandEvent connectCommandEvent) throws WonMessageBuilderException {
WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService();
Dataset localNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(connectCommandEvent.getNeedURI());
Dataset remoteNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(connectCommandEvent.getRemoteNeedURI());
URI localWonNode = WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(localNeedRDF, connectCommandEvent.getNeedURI());
URI remoteWonNode = WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, connectCommandEvent.getRemoteNeedURI());
return WonMessageBuilder.setMessagePropertiesForConnect(wonNodeInformationService.generateEventURI(localWonNode), connectCommandEvent.getLocalFacet(), connectCommandEvent.getNeedURI(), localWonNode, connectCommandEvent.getRemoteFacet(), connectCommandEvent.getRemoteNeedURI(), remoteWonNode, connectCommandEvent.getWelcomeMessage()).build();
}
use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.
the class ExecuteConnectionMessageCommandAction method createWonMessage.
@Override
protected WonMessage createWonMessage(ConnectionMessageCommandEvent messageCommandEvent) throws WonMessageBuilderException {
WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService();
Model localMessageModel = RdfUtils.cloneModel(messageCommandEvent.getMessageModel());
Dataset connectionRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(messageCommandEvent.getConnectionURI());
URI remoteNeed = WonRdfUtils.ConnectionUtils.getRemoteNeedURIFromConnection(connectionRDF, messageCommandEvent.getConnectionURI());
URI localNeed = WonRdfUtils.ConnectionUtils.getLocalNeedURIFromConnection(connectionRDF, messageCommandEvent.getConnectionURI());
URI wonNode = WonRdfUtils.ConnectionUtils.getWonNodeURIFromConnection(connectionRDF, messageCommandEvent.getConnectionURI());
Dataset remoteNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(remoteNeed);
URI messageURI = wonNodeInformationService.generateEventURI(wonNode);
RdfUtils.replaceBaseURI(localMessageModel, messageURI.toString());
return WonMessageBuilder.setMessagePropertiesForConnectionMessage(messageURI, messageCommandEvent.getConnectionURI(), localNeed, wonNode, WonRdfUtils.ConnectionUtils.getRemoteConnectionURIFromConnection(connectionRDF, messageCommandEvent.getConnectionURI()), remoteNeed, WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, remoteNeed), localMessageModel).build();
}
use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.
the class CloseConnectionAction method createWonMessage.
private WonMessage createWonMessage(URI connectionURI) throws WonMessageBuilderException {
WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService();
Dataset connectionRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(connectionURI);
URI remoteNeed = WonRdfUtils.ConnectionUtils.getRemoteNeedURIFromConnection(connectionRDF, connectionURI);
URI localNeed = WonRdfUtils.ConnectionUtils.getLocalNeedURIFromConnection(connectionRDF, connectionURI);
URI wonNode = WonRdfUtils.ConnectionUtils.getWonNodeURIFromConnection(connectionRDF, connectionURI);
Dataset remoteNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(remoteNeed);
return WonMessageBuilder.setMessagePropertiesForClose(wonNodeInformationService.generateEventURI(wonNode), connectionURI, localNeed, wonNode, WonRdfUtils.ConnectionUtils.getRemoteConnectionURIFromConnection(connectionRDF, connectionURI), remoteNeed, WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, remoteNeed), farewellMessage).build();
}
use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.
the class ConnectTwoNeedsAction method createWonMessage.
private WonMessage createWonMessage(URI fromUri, URI toUri) throws WonMessageBuilderException {
WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService();
Dataset localNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(fromUri);
Dataset remoteNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(toUri);
URI localWonNode = WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(localNeedRDF, fromUri);
URI remoteWonNode = WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, toUri);
return WonMessageBuilder.setMessagePropertiesForConnect(wonNodeInformationService.generateEventURI(localWonNode), localFacet, fromUri, localWonNode, remoteFacet, toUri, remoteWonNode, welcomeMessage).build();
}
use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.
the class AutomaticMessageResponderListener method createWonMessage.
private WonMessage createWonMessage(URI connectionURI, String message) throws WonMessageBuilderException {
WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService();
Dataset connectionRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(connectionURI);
URI remoteNeed = WonRdfUtils.ConnectionUtils.getRemoteNeedURIFromConnection(connectionRDF, connectionURI);
URI localNeed = WonRdfUtils.ConnectionUtils.getLocalNeedURIFromConnection(connectionRDF, connectionURI);
URI wonNode = WonRdfUtils.ConnectionUtils.getWonNodeURIFromConnection(connectionRDF, connectionURI);
Dataset remoteNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(remoteNeed);
URI messageURI = wonNodeInformationService.generateEventURI(wonNode);
return WonMessageBuilder.setMessagePropertiesForConnectionMessage(messageURI, connectionURI, localNeed, wonNode, WonRdfUtils.ConnectionUtils.getRemoteConnectionURIFromConnection(connectionRDF, connectionURI), remoteNeed, WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, remoteNeed), message).build();
}
Aggregations