use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.
the class ExecuteFeedbackCommandAction method createWonMessage.
protected WonMessage createWonMessage(FeedbackCommandEvent feedbackCommandEvent) throws WonMessageBuilderException {
URI connectionURI = feedbackCommandEvent.getConnectionURI();
WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService();
Dataset connectionRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(connectionURI);
URI localNeed = WonRdfUtils.ConnectionUtils.getLocalNeedURIFromConnection(connectionRDF, connectionURI);
URI wonNode = WonRdfUtils.ConnectionUtils.getWonNodeURIFromConnection(connectionRDF, connectionURI);
// TODO: make more generic by using the URIs specified in the command.
return WonMessageBuilder.setMessagePropertiesForHintFeedback(wonNodeInformationService.generateEventURI(wonNode), connectionURI, localNeed, wonNode, URI.create(WON.GOOD.getURI()).equals(feedbackCommandEvent.getValue())).build();
}
use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.
the class ExecuteOpenCommandAction method createWonMessage.
protected WonMessage createWonMessage(OpenCommandEvent connectCommandEvent) throws WonMessageBuilderException {
URI connectionURI = connectCommandEvent.getConnectionURI();
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.setMessagePropertiesForOpen(wonNodeInformationService.generateEventURI(wonNode), connectionURI, localNeed, wonNode, WonRdfUtils.ConnectionUtils.getRemoteConnectionURIFromConnection(connectionRDF, connectionURI), remoteNeed, WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, remoteNeed), connectCommandEvent.getWelcomeMessage()).build();
}
use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.
the class OpenConnectionAction method createOpenWonMessage.
private WonMessage createOpenWonMessage(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.setMessagePropertiesForOpen(wonNodeInformationService.generateEventURI(wonNode), connectionURI, localNeed, wonNode, WonRdfUtils.ConnectionUtils.getRemoteConnectionURIFromConnection(connectionRDF, connectionURI), remoteNeed, WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, remoteNeed), welcomeMessage).build();
}
use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.
the class OpenConnectionAction method createConnectWonMessage.
private WonMessage createConnectWonMessage(URI fromUri, URI toUri, URI localFacet, URI remoteFacet) 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 SendFeedbackForHintAction method createFeedbackMessage.
private WonMessage createFeedbackMessage(URI connectionURI, boolean booleanFeedbackValue) throws WonMessageBuilderException {
WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService();
Dataset connectionRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(connectionURI);
URI localNeed = WonRdfUtils.ConnectionUtils.getLocalNeedURIFromConnection(connectionRDF, connectionURI);
URI wonNode = WonRdfUtils.ConnectionUtils.getWonNodeURIFromConnection(connectionRDF, connectionURI);
return WonMessageBuilder.setMessagePropertiesForHintFeedback(wonNodeInformationService.generateEventURI(wonNode), connectionURI, localNeed, wonNode, booleanFeedbackValue).build();
}
Aggregations