symphony-enrico commented on PR #541:
URL: 
https://github.com/apache/directory-scimple/pull/541#issuecomment-1993888550

   > Maybe this is something that should be abstracted out?
   
   In my repository implementation I process version in this way:
   
   ```java
     /**
      * Version field may contain: null (If-Match header is not required), * 
(all version allowed,
      * same as null), a specific version or a comma separated version list 
(not very
      * useful, but it is possible according If-Match specifications)
      */
     private List<String> processVersion(String version) {
       if (StringUtils.isBlank(version) || "*".equals(version.trim())) {
         return null;
       }
       // Weak entity tag will be not processed correctly,
       // as they are prefixed W/. But this is not a problem
       // because they should not match for If-Match
       return Stream.of(version.split(","))
           .filter(StringUtils::isNotBlank)
           .map(String::trim)
           .map(etag -> etag.replaceAll("^\"|\"$", ""))
           .collect(Collectors.toList());
     }
   ```
   
   then, if it is not null, I compare it with version of scim entity.
   
   But if we want change APIs for repository inside framework, I can suggest, 
instead of:
   
   ```java
     T update(String id, String version, T resource, Set<AttributeReference> 
includedAttributes, Set<AttributeReference> excludedAttributes) throws 
ResourceException;
   ```
   
   We could pass:
   
   ```java
     T update(String id, @Nullable List<ETag> ifMatch, T resource, 
Set<AttributeReference> includedAttributes, Set<AttributeReference> 
excludedAttributes) throws ResourceException;
   ```
   
   where ETag POJO could be simply:
   
   ```java
   public class ETag {
     String value;
     boolean weak;
   }
   ```
   
   WDYT?
   


-- 
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: dev-unsubscr...@directory.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@directory.apache.org
For additional commands, e-mail: dev-h...@directory.apache.org

Reply via email to