package org.kingsski.kaas.service.organisation;

import org.kingsski.kaas.database.organisation.Organisation;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Defines the API for querying {@link Organisation}s
 */
@RestController
public class OrganisationRestController {

    @Resource
    private OrganisationService organisationService;

    @RequestMapping(
            method = RequestMethod.GET,
            path = "/organisations",
            produces = "application/json"
    )
    public ResponseEntity organisations() {
        return ResponseEntity.ok(organisationService.getOrganisations());
    }

    @RequestMapping(
            method = RequestMethod.GET,
            path = "/organisation/{id:\\d+}",
            produces = "application/json"
    )
    public ResponseEntity organisationById(@PathVariable("id") long id) {
        Organisation organisation = organisationService.getOrganisationById(id);
        if (organisation == null) {
            return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
        }
        return ResponseEntity.ok(organisationService.getOrganisationById(id));
    }

    @RequestMapping(
            method = RequestMethod.GET,
            path = "/organisation/{name:[A-Za-z]+.*}",
            produces = "application/json"
    )
    public ResponseEntity organisationByName(@PathVariable("name") String name) {
        Organisation organisation = organisationService.getOrganisationByName(name);
        if (organisation == null) {
            return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
        }
        return ResponseEntity.ok(organisationService.getOrganisationByName(name));
    }
}

@@ -246,75 +246,10 @@
 ion.
-PathVariable;%0Aimport org.springframework.web.bind.annotation.Reques
+Ge
 tMap
@@ -301,29 +301,28 @@
 otation.
-RequestMethod
+PathVariable
 ;%0Aimport
@@ -604,30 +604,26 @@
 vice;%0A%0A    @
-Reques
+Ge
 tMapping(%0A  
@@ -624,48 +624,8 @@
 ng(%0A
-            method = RequestMethod.GET,%0A
     
@@ -827,38 +827,34 @@
 ));%0A    %7D%0A%0A    @
-Reques
+Ge
 tMapping(%0A      
@@ -851,48 +851,8 @@
 ng(%0A
-            method = RequestMethod.GET,%0A
     
@@ -1305,22 +1305,18 @@
 %7D%0A%0A    @
-Reques
+Ge
 tMapping
@@ -1321,48 +1321,8 @@
 ng(%0A
-            method = RequestMethod.GET,%0A
     

Change instances of RequestMapping to GetMapping in controller