erant10 commented on code in PR #411:
URL: https://github.com/apache/directory-scimple/pull/411#discussion_r1397873778


##########
scim-core/src/main/java/org/apache/directory/scim/core/repository/Repository.java:
##########
@@ -60,14 +63,31 @@ public interface Repository<T extends ScimResource> {
   /**
    * Allows the SCIM server's REST implementation to update and existing
    * resource via a PUT to a valid end-point.
-   * 
-   * @param updateRequest The ScimResource to update and persist.
+   *
+   * @param id the identifier of the ScimResource to update and persist.
+   * @param version an optional version (usually used as an ETag) that be used 
to optimize update requests, may be compared against, the current {@code 
ScimResource.meta.version}.

Review Comment:
   also nit: that *can* be



##########
scim-core/src/main/java/org/apache/directory/scim/core/repository/PatchGenerator.java:
##########
@@ -0,0 +1,523 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+ 
+* http://www.apache.org/licenses/LICENSE-2.0
+
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.directory.scim.core.repository;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.*;
+import com.flipkart.zjsonpatch.DiffFlags;
+import com.flipkart.zjsonpatch.JsonDiff;
+import org.apache.directory.scim.core.json.ObjectMapperFactory;
+import org.apache.directory.scim.core.schema.SchemaRegistry;
+import org.apache.directory.scim.spec.filter.AttributeComparisonExpression;
+import org.apache.directory.scim.spec.filter.CompareOperator;
+import org.apache.directory.scim.spec.filter.FilterExpression;
+import org.apache.directory.scim.spec.filter.ValuePathExpression;
+import org.apache.directory.scim.spec.filter.attribute.AttributeReference;
+import org.apache.directory.scim.spec.patch.PatchOperation;
+import org.apache.directory.scim.spec.patch.PatchOperationPath;
+import org.apache.directory.scim.spec.resources.ScimExtension;
+import org.apache.directory.scim.spec.resources.ScimResource;
+import org.apache.directory.scim.spec.resources.TypedAttribute;
+import org.apache.directory.scim.spec.schema.AttributeContainer;
+import org.apache.directory.scim.spec.schema.Schema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class PatchGenerator {

Review Comment:
   I don't see this class used anywhere, so just making sure I understand - 
what exactly is the purpose of PatchGenerator? is it meant to be used 
optionally by anyone who wants to convert an `update` request into a `patch` 
request in their repo implementation? 
   
   Perhaps a short comment on this class and its intended use could be helpful 
for future adopters?



##########
scim-core/src/main/java/org/apache/directory/scim/core/repository/Repository.java:
##########
@@ -60,14 +63,31 @@ public interface Repository<T extends ScimResource> {
   /**
    * Allows the SCIM server's REST implementation to update and existing
    * resource via a PUT to a valid end-point.
-   * 
-   * @param updateRequest The ScimResource to update and persist.
+   *
+   * @param id the identifier of the ScimResource to update and persist.
+   * @param version an optional version (usually used as an ETag) that be used 
to optimize update requests, may be compared against, the current {@code 
ScimResource.meta.version}.

Review Comment:
   I'm a little confused by the `version <-> etag` relationship. 
   are they are equivalent?
   if etag an http concept then it makes sense to distinguish the two, but just 
curious if there was more to it than that



##########
scim-server-examples/scim-server-jersey/src/main/java/org/apache/directory/scim/example/jersey/service/InMemoryUserService.java:
##########
@@ -130,17 +134,21 @@ public ScimUser create(ScimUser resource) throws 
UnableToCreateResourceException
     return resource;
   }
 
-  /**
-   * @see Repository#update(UpdateRequest)
-   */
   @Override
-  public ScimUser update(UpdateRequest<ScimUser> updateRequest) throws 
UnableToUpdateResourceException {
-    String id = updateRequest.getId();
-    ScimUser resource = updateRequest.getResource();
+  public ScimUser update(String id, String version, ScimUser resource, 
Set<AttributeReference> includedAttributeReferences, Set<AttributeReference> 
excludedAttributeReferences) throws ResourceException {
+    users.put(id, resource);
+    return resource;
+  }
+
+  @Override
+  public ScimUser patch(String id, String version, List<PatchOperation> 
patchOperations, Set<AttributeReference> includedAttributeReferences, 
Set<AttributeReference> excludedAttributeReferences) throws ResourceException {
+    PatchHandler patchHandler = new PatchHandlerImpl(schemaRegistry);

Review Comment:
   would it make sense to inject PatchHandlerImpl to the Repositories instead 
of instantiating per request?



-- 
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