@RequestMapping(value = "/match/{matchId}/connect", method = RequestMethod.POST) public String connect(@PathVariable String matchId, Model model) { String ret = "noNeedFound"; try { List<Match> matches = matchRepository.findById(Long.valueOf(matchId)); if (!matches.isEmpty()) { Match match = matches.get(0); List<Need> needs = needRepository.findByNeedURI(match.getFromNeed()); if (!needs.isEmpty()) { ret = "redirect:/need/" + needs .get(0) .getId() .toString(); // viewNeed(needs.get(0).getId().toString(), model); } // TODO: match object does not contain facet info, assume OwnerFacet. com.hp.hpl.jena.rdf.model.Model facetModel = WonRdfUtils.FacetUtils.createFacetModelForHintOrConnect( FacetType.OwnerFacet.getURI(), FacetType.OwnerFacet.getURI()); ownerService.connect(match.getFromNeed(), match.getToNeed(), facetModel, null); } } catch (ConnectionAlreadyExistsException e) { logger.warn("caught ConnectionAlreadyExistsException:", e); } catch (IllegalMessageForNeedStateException e) { logger.warn("caught IllegalMessageForNeedStateException:", e); } catch (NoSuchNeedException e) { logger.warn("caught NoSuchNeedException:", e); } catch (InterruptedException e) { logger.warn("caught InterruptedEception", e); } catch (ExecutionException e) { logger.warn("caught ExecutionException", e); } catch (CamelConfigurationFailedException e) { logger.warn( "caught CamelConfigurationException", e); // To change body of catch statement use File | Settings | File Templates. logger.warn("caught CamelConfigurationFailedException"); } catch (Exception e) { logger.warn("caught Exception", e); } return ret; }
private WonMessage createWonMessage(URI needURI, URI otherNeedURI, double score, URI originator) throws WonMessageBuilderException { WonNodeInformationService wonNodeInformationService = getEventListenerContext().getWonNodeInformationService(); URI localWonNode = WonRdfUtils.NeedUtils.getWonNodeURIFromNeed( getEventListenerContext().getLinkedDataSource().getDataForResource(needURI), needURI); return WonMessageBuilder.setMessagePropertiesForHint( wonNodeInformationService.generateEventURI(localWonNode), needURI, FacetType.OwnerFacet.getURI(), localWonNode, otherNeedURI, FacetType.OwnerFacet.getURI(), originator, score) .build(); }