@Test public void testEmptyContainer() throws Exception { ResourcePreparer<ScimResource> preparer = new ResourcePreparer<>(resourceTypeDefinition, "default", null, testBaseUri); ObjectNode node = (ObjectNode) JsonUtils.getObjectReader() .readTree("{\n" + " \"default\": {\n" + " \"never\": \"here\"\n" + " }\n" + "}"); GenericScimResource prepared = preparer.trimRetrievedResource(new GenericScimResource(node)); assertFalse(prepared.getObjectNode().has("default")); node = (ObjectNode) JsonUtils.getObjectReader() .readTree("{\n" + " \"default\": [\n" + " {\n" + " \"never\": \"here\"\n" + " },\n" + " {\n" + " \"always\": \"here\"\n" + " }\n" + " ]\n" + "}"); prepared = preparer.trimRetrievedResource(new GenericScimResource(node)); assertTrue(prepared.getObjectNode().has("default")); assertEquals(1, prepared.getObjectNode().get("default").size()); node = (ObjectNode) JsonUtils.getObjectReader() .readTree("{\n" + " \"default\": [\n" + " {\n" + " \"never\": \"here\"\n" + " },\n" + " {\n" + " \"never\": \"here\"\n" + " }\n" + " ]\n" + "}"); prepared = preparer.trimRetrievedResource(new GenericScimResource(node)); assertFalse(prepared.getObjectNode().has("default")); node = (ObjectNode) JsonUtils.getObjectReader().readTree("{\n" + " \"urn:ext:1\": {\n" + " \"never\": \"here\"\n" + " }\n" + "}"); prepared = preparer.trimRetrievedResource(new GenericScimResource(node)); assertFalse(prepared.getObjectNode().has("urn:ext:1")); }
public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); }
ResourcePreparer { public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); } }
ResourcePreparer { public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); } ResourcePreparer(final ResourceTypeDefinition resourceType,
                            final String attributesString,
                            final String excludedAttributesString,
                            final URI baseUri); }
ResourcePreparer { public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); } ResourcePreparer(final ResourceTypeDefinition resourceType,
                            final String attributesString,
                            final String excludedAttributesString,
                            final URI baseUri); GenericScimResource trimRetrievedResource(final T returnedResource); GenericScimResource trimCreatedResource(final T returnedResource, final T requestResource); GenericScimResource trimReplacedResource(final T returnedResource, final T requestResource); GenericScimResource trimModifiedResource(final T returnedResource, final Iterable<PatchOperation> patchOperations); void setResourceTypeAndLocation(final T returnedResource); }
ResourcePreparer { public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); } ResourcePreparer(final ResourceTypeDefinition resourceType,
                            final String attributesString,
                            final String excludedAttributesString,
                            final URI baseUri); GenericScimResource trimRetrievedResource(final T returnedResource); GenericScimResource trimCreatedResource(final T returnedResource, final T requestResource); GenericScimResource trimReplacedResource(final T returnedResource, final T requestResource); GenericScimResource trimModifiedResource(final T returnedResource, final Iterable<PatchOperation> patchOperations); void setResourceTypeAndLocation(final T returnedResource);  }