Search in sources :

Example 11 with WonNodeInformationService

use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.

the class RespondWithEchoToMessageAction method createWonMessage.

private WonMessage createWonMessage(URI connectionURI, String textMessage) 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), textMessage).build();
}
Also used : Dataset(org.apache.jena.query.Dataset) WonNodeInformationService(won.protocol.service.WonNodeInformationService) URI(java.net.URI)

Example 12 with WonNodeInformationService

use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.

the class ExecuteCloseCommandAction method createWonMessage.

protected WonMessage createWonMessage(CloseCommandEvent 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.setMessagePropertiesForClose(wonNodeInformationService.generateEventURI(wonNode), connectionURI, localNeed, wonNode, WonRdfUtils.ConnectionUtils.getRemoteConnectionURIFromConnection(connectionRDF, connectionURI), remoteNeed, WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, remoteNeed), connectCommandEvent.getCloseMessage()).build();
}
Also used : Dataset(org.apache.jena.query.Dataset) WonNodeInformationService(won.protocol.service.WonNodeInformationService) URI(java.net.URI)

Example 13 with WonNodeInformationService

use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.

the class ConnectFromListToListAction 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), fromFacet, fromUri, localWonNode, toFacet, toUri, remoteWonNode, welcomeMessage).build();
}
Also used : Dataset(org.apache.jena.query.Dataset) WonNodeInformationService(won.protocol.service.WonNodeInformationService) URI(java.net.URI)

Example 14 with WonNodeInformationService

use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.

the class BATestScriptListener method createWonMessageForOpen.

private WonMessage createWonMessageForOpen(URI fromConUri, URI fromNeedUri, URI toConUri, URI toNeedUri) throws WonMessageBuilderException {
    WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService();
    Dataset localNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(fromNeedUri);
    Dataset remoteNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(toNeedUri);
    URI localWonNode = WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(localNeedRDF, fromNeedUri);
    URI remoteWonNode = WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, toNeedUri);
    return WonMessageBuilder.setMessagePropertiesForOpen(wonNodeInformationService.generateEventURI(localWonNode), fromConUri, fromNeedUri, localWonNode, toConUri, toNeedUri, remoteWonNode, null).build();
}
Also used : WonNodeInformationService(won.protocol.service.WonNodeInformationService) URI(java.net.URI)

Example 15 with WonNodeInformationService

use of won.protocol.service.WonNodeInformationService in project webofneeds by researchstudio-sat.

the class BATestScriptListener method createWonMessageForConnectionMessage.

private WonMessage createWonMessageForConnectionMessage(URI fromConUri, URI fromNeedUri, URI toConUri, URI toNeedUri, Model content) throws WonMessageBuilderException {
    WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService();
    Dataset localNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(fromNeedUri);
    Dataset remoteNeedRDF = getEventListenerContext().getLinkedDataSource().getDataForResource(toNeedUri);
    URI localWonNode = WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(localNeedRDF, fromNeedUri);
    URI remoteWonNode = WonRdfUtils.NeedUtils.getWonNodeURIFromNeed(remoteNeedRDF, toNeedUri);
    return WonMessageBuilder.setMessagePropertiesForConnectionMessage(wonNodeInformationService.generateEventURI(localWonNode), fromConUri, fromNeedUri, localWonNode, toConUri, toNeedUri, remoteWonNode, content).build();
}
Also used : 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