jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r774420 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/com...
Date Wed, 13 May 2009 16:32:33 GMT
Author: stefan
Date: Wed May 13 16:32:30 2009
New Revision: 774420

URL: http://svn.apache.org/viewvc?rev=774420&view=rev
Log:
JCR-1591: JSR 283: NodeType Management (WIP...)
JCR-2091: Searchability settings in PropertyDefinition (WIP...)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java?rev=774420&r1=774419&r2=774420&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
Wed May 13 16:32:30 2009
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.commons.query.qom.Operator;
 
 import javax.jcr.PropertyType;
 import javax.jcr.query.qom.QueryObjectModelConstants;
@@ -69,15 +70,7 @@
     /*
      * The 'query operators.
      */
-    private String[] queryOperators = new String[]{
-            QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
-            QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN,
-            QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO,
-            QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN,
-            QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO,
-            QueryObjectModelConstants.JCR_OPERATOR_LIKE,
-            QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO
-    };
+    private String[] queryOperators = Operator.getAllQueryOperators();
 
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java?rev=774420&r1=774419&r2=774420&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
Wed May 13 16:32:30 2009
@@ -35,6 +35,7 @@
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.Lexer;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
+import org.apache.jackrabbit.spi.commons.query.qom.Operator;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;
@@ -372,15 +373,7 @@
 
                 pdi.setFullTextSearchable(true);
                 pdi.setQueryOrderable(true);
-                pdi.setAvailableQueryOperators(new String[]{
-                        QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
-                        QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN,
-                        QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO,
-                        QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN,
-                        QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO,
-                        QueryObjectModelConstants.JCR_OPERATOR_LIKE,
-                        QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO
-                });
+                pdi.setAvailableQueryOperators(Operator.getAllQueryOperators());
 
                 nextToken();
                 doPropertyDefinition(pdi, ntd);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java?rev=774420&r1=774419&r2=774420&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
Wed May 13 16:32:30 2009
@@ -19,13 +19,12 @@
 import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 
 import javax.jcr.NamespaceException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.QueryObjectModelConstants;
 import javax.jcr.version.OnParentVersionAction;
 
 import org.apache.jackrabbit.core.nodetype.NodeDef;
@@ -35,9 +34,11 @@
 import org.apache.jackrabbit.core.nodetype.ItemDef;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
+import org.apache.jackrabbit.spi.commons.nodetype.compact.Lexer;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.query.qom.Operator;
 
 /**
  * Prints node type defs in a compact notation
@@ -194,15 +195,26 @@
      * write options
      */
     private void writeOptions(NodeTypeDef ntd) throws IOException {
+        List<String> options = new ArrayList<String>();
+        if (ntd.isAbstract()) {
+            options.add(Lexer.ABSTRACT[0]);
+        }
         if (ntd.hasOrderableChildNodes()) {
-            out.write("\n" + INDENT);
-            out.write("orderable");
-            if (ntd.isMixin()) {
-                out.write(" mixin");
+            options.add(Lexer.ORDERABLE[0]);
+        }
+        if (ntd.isMixin()) {
+            options.add(Lexer.MIXIN[0]);
+        }
+        if (!ntd.isQueryable()) {
+            options.add(Lexer.NOQUERY[0]);
+        }
+        for (int i = 0; i < options.size(); i++) {
+            if (i == 0) {
+                out.write("\n" + INDENT);
+            } else {
+                out.write(" ");
             }
-        } else if (ntd.isMixin()) {
-            out.write("\n" + INDENT);
-            out.write("mixin");
+            out.write(options.get(i));
         }
     }
 
@@ -263,6 +275,43 @@
             out.write(" ");
             out.write(OnParentVersionAction.nameFromValue(pd.getOnParentVersion()).toLowerCase());
         }
+
+        if (!pd.isFullTextSearchable()) {
+            out.write(" nofulltext");
+        }
+        if (!pd.isQueryOrderable()) {
+            out.write(" noqueryorder");
+        }
+        String[] qops = pd.getAvailableQueryOperators();
+        if (qops != null && qops.length > 0) {
+            List ops = Arrays.asList(qops);
+            List defaultOps = Arrays.asList(Operator.getAllQueryOperators());
+            if (!ops.containsAll(defaultOps)) {
+                out.write(" queryops '");
+                for (int i = 0; i < qops.length; i++) {
+                    if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO))
{
+                        out.write(Lexer.QUEROPS_EQUAL);
+                    } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO))
{
+                        out.write(Lexer.QUEROPS_NOTEQUAL);
+                    } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN))
{
+                        out.write(Lexer.QUEROPS_GREATERTHAN);
+                    } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO))
{
+                        out.write(Lexer.QUEROPS_GREATERTHANOREQUAL);
+                    } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN))
{
+                        out.write(Lexer.QUEROPS_LESSTHAN);
+                    } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO))
{
+                        out.write(Lexer.QUEROPS_LESSTHANOREQUAL);
+                    } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_LIKE))
{
+                        out.write(Lexer.QUEROPS_LIKE);
+                    }
+                    if (i < qops.length - 1) {
+                        out.write("' ");
+                    }
+                }
+                out.write("'");
+            }
+        }
+        
         writeValueConstraints(pd.getValueConstraints());
     }
 

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java?rev=774420&r1=774419&r2=774420&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImpl.java
Wed May 13 16:32:30 2009
@@ -16,9 +16,10 @@
  */
 package org.apache.jackrabbit.spi.commons.nodetype;
 
+import org.apache.jackrabbit.spi.commons.query.qom.Operator;
+
 import javax.jcr.PropertyType;
 import javax.jcr.Value;
-import javax.jcr.query.qom.QueryObjectModelConstants;
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.nodetype.PropertyDefinitionTemplate;
 
@@ -44,15 +45,7 @@
         type = PropertyType.STRING;
         fullTextSearchable = true;
         queryOrderable = true;
-        queryOperators = new String[]{
-                QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
-                QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN,
-                QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO,
-                QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN,
-                QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO,
-                QueryObjectModelConstants.JCR_OPERATOR_LIKE,
-                QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO
-        };
+        queryOperators = Operator.getAllQueryOperators();
     }
 
     /**



Mime
View raw message