jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1394283 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: plugins/name/NameValidator.java security/user/MembershipProviderImpl.java
Date Thu, 04 Oct 2012 21:40:40 GMT
Author: mduerig
Date: Thu Oct  4 21:40:39 2012
New Revision: 1394283

URL: http://svn.apache.org/viewvc?rev=1394283&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
- Replace CoreValue.getString with PropertyState.getValue(Type)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java?rev=1394283&r1=1394282&r2=1394283&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
Thu Oct  4 21:40:39 2012
@@ -18,14 +18,14 @@ package org.apache.jackrabbit.oak.plugin
 
 import java.util.Set;
 
-import javax.jcr.PropertyType;
-
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
+import static org.apache.jackrabbit.oak.api.Type.NAME;
+import static org.apache.jackrabbit.oak.api.Type.NAMES;
+
 class NameValidator implements Validator {
 
     private final Set<String> prefixes;
@@ -52,16 +52,16 @@ class NameValidator implements Validator
 
     protected void checkValidValue(PropertyState property)
             throws CommitFailedException {
-        for (CoreValue value : property.getValues()) {
-            checkValidValue(value);
+        if (NAME.equals(property.getType())) {
+            for (String value : property.getValue(NAMES)) {
+                checkValidValue(value);
+            }
         }
     }
 
-    protected void checkValidValue(CoreValue value)
+    protected void checkValidValue(String value)
             throws CommitFailedException {
-        if (value.getType() == PropertyType.NAME) {
-            checkValidName(value.getString());
-        }
+        checkValidName(value);
     }
 
     //-------------------------------------------------------< NodeValidator >

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java?rev=1394283&r1=1394282&r2=1394283&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
Thu Oct  4 21:40:39 2012
@@ -44,6 +44,8 @@ import org.apache.jackrabbit.oak.util.No
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.jackrabbit.oak.api.Type.STRINGS;
+
 /**
  * {@code MembershipProvider} implementation storing group membership information
  * with the {@code Tree} associated with a given {@link org.apache.jackrabbit.api.security.user.Group}.
@@ -183,10 +185,10 @@ public class MembershipProviderImpl exte
             } else {
                 PropertyState property = groupTree.getProperty(REP_MEMBERS);
                 if (property != null) {
-                    List<CoreValue> members = property.getValues();
+                    Iterable<String> members = property.getValue(STRINGS);
                     String authorizableUUID = getContentID(authorizableTree);
-                    for (CoreValue v : members) {
-                        if (authorizableUUID.equals(v.getString())) {
+                    for (String v : members) {
+                        if (authorizableUUID.equals(v)) {
                             return true;
                         }
                     }



Mime
View raw message