bdemers commented on PR #240:
URL: 
https://github.com/apache/directory-scimple/pull/240#issuecomment-1404220949

   @erant10 I was rebasing https://github.com/erant10/directory-scimple/pull/2 
(still needs some cleanup), but it had me thinking. We are traversing two 
different objects, the `sourceAsMap` and the `items` in collections. The 
individual items are used when testing the filter, but all of the mutations 
happen against the `sourceAsMap`. This also means we need to convert to and 
from the ScimResource for each patch operation (granted, this isn't a big deal 
with a low number of patches per request).  But with this change, I think we 
could convert a map (`sourceAsMap`), apply each patch operation, and then 
convert back to the ScimResource.
   
   This PR tweaks `InMemoryScimFilterMatcher` to allow traversal over maps (in 
addition to ScimResources).
   It's not perfect , but in my local branch of `patch_phase1`, I changed a few 
lines to use the new method, something like:
   
   ```diff
   -      Collection<Object> items = attribute.getAccessor().get(source);
   -      Predicate<Object> pred = 
FilterExpressions.inMemory(valuePathExpression.getAttributeExpression(), 
schema);
   +
   +      Collection<Map<String, Object>> items = (Collection<Map<String, 
Object>>) sourceAsMap.get(attributeReference.getAttributeName());
   +      Predicate<Object> pred = 
FilterExpressions.inMemoryMap(valuePathExpression.getAttributeExpression(), 
schema);
   ```
   
   Thoughts?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to