219 Response response=null;
220 List<String> schemas=patch.getSchemas();
222 if (schemas!=null && schemas.size()==1 && schemas.get(0).equals(PATCH_REQUEST_SCHEMA_ID)) {
223 List<PatchOperation> ops = patch.getOperations();
228 String defSchema=ScimResourceUtil.getDefaultSchemaUrn(cls);
232 for (PatchOperation op : ops){
233 if (op.getPath()!=null)
234 op.setPath(ScimResourceUtil.adjustNotationInPath(op.getPath(), defSchema, urns));
237 for (PatchOperation op : ops) {
239 if (op.getType() == null)
240 response =
getErrorResponse(BAD_REQUEST, ErrorScimType.INVALID_SYNTAX,
"Operation '" + op.getOperation() +
"' not recognized");
242 String path = op.getPath();
244 if (StringUtils.isEmpty(path) && op.getType().equals(PatchOperationType.REMOVE))
245 response =
getErrorResponse(BAD_REQUEST, ErrorScimType.NO_TARGET,
"Path attribute is required for remove operation");
247 if (op.getValue() == null && !op.getType().equals(PatchOperationType.REMOVE))
248 response =
getErrorResponse(BAD_REQUEST, ErrorScimType.INVALID_SYNTAX,
"Value attribute is required for operations other than remove");
250 if (response != null)
255 response =
getErrorResponse(BAD_REQUEST, ErrorScimType.INVALID_SYNTAX,
"Patch request MUST contain the attribute 'Operations'");
258 response =
getErrorResponse(BAD_REQUEST, ErrorScimType.INVALID_SYNTAX,
"Wrong schema(s) supplied in Search Request");
260 log.info(
"inspectPatchRequest. Preprocessing of patch request {}", response==null ?
"passed" :
"failed");
Logger log
Definition: BaseScimWebService.java:56
static Response getErrorResponse(Response.Status status, String detail)
Definition: BaseScimWebService.java:75
ExtensionService extService
Definition: BaseScimWebService.java:65
List< String > getUrnsOfExtensions(Class<? extends BaseScimResource > cls)
Definition: ExtensionService.java:86