jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1412597 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype: ItemDefinitionImpl.java NodeDefinitionImpl.java NodeTypeImpl.java PropertyDefinitionImpl.java
Date Thu, 22 Nov 2012 16:01:25 GMT
Author: mduerig
Date: Thu Nov 22 16:01:24 2012
New Revision: 1412597

URL: http://svn.apache.org/viewvc?rev=1412597&view=rev
Log:
- use constants for node type names
- toString implementations

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java?rev=1412597&r1=1412596&r2=1412597&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
Thu Nov 22 16:01:24 2012
@@ -20,6 +20,7 @@ import javax.jcr.nodetype.ItemDefinition
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.version.OnParentVersionAction;
 
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -57,17 +58,17 @@ class ItemDefinitionImpl implements Item
 
     @Override
     public String getName() {
-        return node.getName("jcr:name", "*");
+        return node.getName(JcrConstants.JCR_NAME, "*");
     }
 
     @Override
     public boolean isAutoCreated() {
-        return node.getBoolean("jcr:autoCreated");
+        return node.getBoolean(JcrConstants.JCR_AUTOCREATED);
     }
 
     @Override
     public boolean isMandatory() {
-        return node.getBoolean("jcr:mandatory");
+        return node.getBoolean(JcrConstants.JCR_MANDATORY);
     }
 
     @Override
@@ -84,7 +85,11 @@ class ItemDefinitionImpl implements Item
 
     @Override
     public boolean isProtected() {
-        return node.getBoolean("jcr:protected");
+        return node.getBoolean(JcrConstants.JCR_PROTECTED);
     }
 
+    @Override
+    public String toString() {
+        return getName();
+    }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java?rev=1412597&r1=1412596&r2=1412597&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
Thu Nov 22 16:01:24 2012
@@ -24,6 +24,7 @@ import javax.jcr.nodetype.NodeDefinition
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeManager;
 
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -52,7 +53,7 @@ class NodeDefinitionImpl extends ItemDef
 
     @Override
     public String[] getRequiredPrimaryTypeNames() {
-        return node.getNames("jcr:requiredPrimaryTypes", "nt:base");
+        return node.getNames(JcrConstants.JCR_REQUIREDPRIMARYTYPES, JcrConstants.NT_BASE);
     }
 
     @Override
@@ -73,7 +74,7 @@ class NodeDefinitionImpl extends ItemDef
 
     @Override
     public String getDefaultPrimaryTypeName() {
-        return node.getName("jcr:defaultPrimaryType", null);
+        return node.getName(JcrConstants.JCR_DEFAULTPRIMARYTYPE, null);
     }
 
     @Override
@@ -92,7 +93,7 @@ class NodeDefinitionImpl extends ItemDef
 
     @Override
     public boolean allowsSameNameSiblings() {
-        return node.getBoolean("jcr:sameNameSiblings");
+        return node.getBoolean(JcrConstants.JCR_SAMENAMESIBLINGS);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java?rev=1412597&r1=1412596&r2=1412597&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
Thu Nov 22 16:01:24 2012
@@ -301,6 +301,11 @@ class NodeTypeImpl implements NodeType {
         }
     }
 
+    @Override
+    public String toString() {
+        return getName();
+    }
+
     private static boolean meetsTypeConstraints(Value value, int requiredType) {
         try {
             switch (requiredType) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java?rev=1412597&r1=1412596&r2=1412597&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/PropertyDefinitionImpl.java
Thu Nov 22 16:01:24 2012
@@ -22,6 +22,7 @@ import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.query.qom.QueryObjectModelConstants;
 
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -128,7 +129,7 @@ class PropertyDefinitionImpl extends Ite
     @Override
     public int getRequiredType() {
         try {
-            return valueFromName(node.getString("jcr:requiredType", TYPENAME_UNDEFINED));
+            return valueFromName(node.getString(JcrConstants.JCR_REQUIREDTYPE, TYPENAME_UNDEFINED));
         } catch (IllegalArgumentException e) {
             log.warn("Unexpected jcr:requiredType value", e);
             return UNDEFINED;
@@ -138,7 +139,7 @@ class PropertyDefinitionImpl extends Ite
     @Override
     public String[] getValueConstraints() {
         // TODO: namespace mapping?
-        String[] constraints = node.getStrings("jcr:valueConstraints");
+        String[] constraints = node.getStrings(JcrConstants.JCR_VALUECONSTRAINTS);
         if (constraints == null) {
             constraints = new String[0];
         }
@@ -148,7 +149,7 @@ class PropertyDefinitionImpl extends Ite
     @Override
     public Value[] getDefaultValues() {
         if (factory != null) {
-            return node.getValues("jcr:defaultValues", factory);
+            return node.getValues(JcrConstants.JCR_DEFAULTVALUES, factory);
         }
         else {
             log.warn("Cannot create default values: no value factory");
@@ -158,12 +159,12 @@ class PropertyDefinitionImpl extends Ite
 
     @Override
     public boolean isMultiple() {
-        return node.getBoolean("jcr:multiple");
+        return node.getBoolean(JcrConstants.JCR_MULTIPLE);
     }
 
     @Override
     public String[] getAvailableQueryOperators() {
-        String[] ops = node.getStrings("jcr:availableQueryOperators");
+        String[] ops = node.getStrings(NodeTypeConstants.JCR_AVAILABLE_QUERY_OPERATORS);
         if (ops == null) {
             ops = new String[] {
                     QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
@@ -179,12 +180,12 @@ class PropertyDefinitionImpl extends Ite
 
     @Override
     public boolean isFullTextSearchable() {
-        return node.getBoolean("jcr:isFullTextSearchable");
+        return node.getBoolean(NodeTypeConstants.JCR_IS_FULLTEXT_SEARCHABLE);
     }
 
     @Override
     public boolean isQueryOrderable() {
-        return node.getBoolean("jcr:isQueryOrderable");
+        return node.getBoolean(NodeTypeConstants.JCR_IS_QUERY_ORDERABLE);
     }
 
 }



Mime
View raw message