Beispiel #1
0
 @RequestMapping(value = "/{needId}/toggle", method = RequestMethod.POST)
 public String toggleNeed(@PathVariable String needId, Model model)
     throws NoSuchConnectionFault, IllegalMessageForConnectionStateFault {
   List<Need> needs = needRepository.findById(Long.valueOf(needId));
   if (needs.isEmpty()) return "noNeedFound";
   Need need = needs.get(0);
   try {
     if (need.getState() == NeedState.ACTIVE) {
       ownerService.deactivate(need.getNeedURI(), null);
     } else {
       ownerService.activate(need.getNeedURI(), null);
     }
   } catch (NoSuchNeedException e) {
     logger.warn("caught NoSuchNeedException:", e);
   } catch (Exception e) {
     logger.warn("caught Exception", e);
   }
   return "redirect:/need/" + need.getId().toString();
   // return viewNeed(need.getId().toString(), model);
 }
Beispiel #2
0
  @RequestMapping(value = "/{needId}/connect", method = RequestMethod.POST)
  public String connect2Need(
      @PathVariable String needId, @ModelAttribute("SpringWeb") NeedPojo needPojo, Model model) {
    try {
      List<Need> needs = needRepository.findById(Long.valueOf(needId));
      if (needs.isEmpty()) return "noNeedFound";

      Need need1 = needs.get(0);

      com.hp.hpl.jena.rdf.model.Model facetModel =
          WonRdfUtils.FacetUtils.createFacetModelForHintOrConnect(
              URI.create(needPojo.getOwnFacetURI()), URI.create(needPojo.getRemoteFacetURI()));
      ownerService.connect(need1.getNeedURI(), new URI(needPojo.getNeedURI()), facetModel, null);
      return "redirect:/need/"
          + need1.getId().toString(); // viewNeed(need1.getId().toString(), model);
    } catch (URISyntaxException e) {
      logger.warn("caught URISyntaxException:", e);
    } 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 InterruptedException", e);
    } catch (ExecutionException e) {
      logger.warn("caught ExcutionException", e);
    } catch (CamelConfigurationFailedException e) {
      logger.warn("caught CameConfigurationException", e);
      logger.warn("caught CamelConfigurationFailedException", e);
    } catch (Exception e) {
      logger.warn("caught Exception", e);
    }

    return "noNeedFound";
  }
Beispiel #3
0
 @RequestMapping(value = "/import", method = RequestMethod.POST)
 public String importNeedPost(@RequestParam("needURI") URI needURI) {
   Need importedNeed = dataReloadService.importNeed(needURI);
   return "redirect:/need/" + importedNeed.getId();
 }