Search in sources :

Example 26 with WonNodeInformationService

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();
}
Also used : Dataset(org.apache.jena.query.Dataset) WonNodeInformationService(won.protocol.service.WonNodeInformationService) URI(java.net.URI)

Example 27 with WonNodeInformationService

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();
}
Also used : Dataset(org.apache.jena.query.Dataset) WonNodeInformationService(won.protocol.service.WonNodeInformationService) URI(java.net.URI)

Example 28 with WonNodeInformationService

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();
}
Also used : Dataset(org.apache.jena.query.Dataset) WonNodeInformationService(won.protocol.service.WonNodeInformationService) URI(java.net.URI)

Example 29 with WonNodeInformationService

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();
}
Also used : Dataset(org.apache.jena.query.Dataset) WonNodeInformationService(won.protocol.service.WonNodeInformationService) URI(java.net.URI)

Example 30 with WonNodeInformationService

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();
}
Also used : Dataset(org.apache.jena.query.Dataset) WonNodeInformationService(won.protocol.service.WonNodeInformationService) URI(java.net.URI)

Aggregations

URI (java.net.URI)35 WonNodeInformationService (won.protocol.service.WonNodeInformationService)35 Dataset (org.apache.jena.query.Dataset)28 Event (won.bot.framework.eventbot.event.Event)7 FailureResponseEvent (won.bot.framework.eventbot.event.impl.wonmessage.FailureResponseEvent)7 EventListener (won.bot.framework.eventbot.listener.EventListener)7 WonMessage (won.protocol.message.WonMessage)7 EventListenerContext (won.bot.framework.eventbot.EventListenerContext)6 DefaultNeedModelWrapper (won.protocol.util.DefaultNeedModelWrapper)4 NeedCreationFailedEvent (won.bot.framework.eventbot.event.NeedCreationFailedEvent)3 NeedCreatedEvent (won.bot.framework.eventbot.event.impl.needlifecycle.NeedCreatedEvent)3 Resource (org.apache.jena.rdf.model.Resource)2 WonURI (won.bot.framework.eventbot.action.impl.mail.model.WonURI)2 EventBus (won.bot.framework.eventbot.bus.EventBus)2 NeedCreatedEventForMatcher (won.bot.framework.eventbot.event.impl.matcher.NeedCreatedEventForMatcher)2 NeedContentPropertyType (won.protocol.model.NeedContentPropertyType)2 NeedModelWrapper (won.protocol.util.NeedModelWrapper)2 InvalidParameterException (java.security.InvalidParameterException)1 MessagingException (javax.mail.MessagingException)1 MimeMessage (javax.mail.internet.MimeMessage)1