|
|
@@ -33,12 +33,14 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.converter.json.MappingJacksonValue;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@@ -61,18 +63,18 @@ public class ScimOrganizationController {
|
|
|
@Autowired
|
|
|
OrganizationsService organizationsService;
|
|
|
|
|
|
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
|
|
- public MappingJacksonValue get(@PathVariable String id,
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public ScimOrganization get(@PathVariable String id,
|
|
|
@RequestParam(required = false) String attributes) {
|
|
|
_logger.debug("ScimOrganization id {} , attributes {}", id , attributes);
|
|
|
Organizations org = organizationsService.get(id);
|
|
|
ScimOrganization scimOrg = org2ScimOrg(org);
|
|
|
|
|
|
- return new MappingJacksonValue(scimOrg);
|
|
|
+ return scimOrg;
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(method = RequestMethod.POST)
|
|
|
- public MappingJacksonValue create(@RequestBody ScimOrganization scimOrg,
|
|
|
+ @PostMapping
|
|
|
+ public ScimOrganization create(@RequestBody ScimOrganization scimOrg,
|
|
|
@RequestParam(required = false) String attributes,
|
|
|
UriComponentsBuilder builder) throws IOException {
|
|
|
_logger.debug("ScimOrganization content {} , attributes {}", scimOrg , attributes);
|
|
|
@@ -81,8 +83,8 @@ public class ScimOrganizationController {
|
|
|
return get(createOrg.getId(), attributes);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
|
|
|
- public MappingJacksonValue replace(@PathVariable String id,
|
|
|
+ @PutMapping(value = "/{id}")
|
|
|
+ public ScimOrganization replace(@PathVariable String id,
|
|
|
@RequestBody ScimOrganization scimOrg,
|
|
|
@RequestParam(required = false) String attributes)throws IOException {
|
|
|
_logger.debug("ScimOrganization content {} , attributes {}", scimOrg , attributes);
|
|
|
@@ -91,20 +93,20 @@ public class ScimOrganizationController {
|
|
|
return get(id, attributes);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
|
|
+ @DeleteMapping(value = "/{id}")
|
|
|
@ResponseStatus(HttpStatus.OK)
|
|
|
public void delete(@PathVariable final String id) {
|
|
|
_logger.debug("ScimOrganization id {}", id );
|
|
|
organizationsService.delete(id);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(method = RequestMethod.GET)
|
|
|
- public MappingJacksonValue searchWithGet(@ModelAttribute ScimParameters requestParameters) {
|
|
|
+ @GetMapping
|
|
|
+ public ScimSearchResult<ScimOrganization> searchWithGet(@ModelAttribute ScimParameters requestParameters) {
|
|
|
return searchWithPost(requestParameters);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/.search", method = RequestMethod.POST)
|
|
|
- public MappingJacksonValue searchWithPost(@ModelAttribute ScimParameters requestParameters) {
|
|
|
+ @PostMapping(value = "/.search")
|
|
|
+ public ScimSearchResult<ScimOrganization> searchWithPost(@ModelAttribute ScimParameters requestParameters) {
|
|
|
requestParameters.parse();
|
|
|
_logger.debug("requestParameters {} ",requestParameters);
|
|
|
Organizations queryModel = new Organizations();
|
|
|
@@ -123,7 +125,7 @@ public class ScimOrganizationController {
|
|
|
queryModel.getPageSize(),
|
|
|
requestParameters.getStartIndex());
|
|
|
|
|
|
- return new MappingJacksonValue(scimSearchResult);
|
|
|
+ return scimSearchResult;
|
|
|
}
|
|
|
|
|
|
public ScimOrganization org2ScimOrg(Organizations org) {
|