You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2011/09/07 14:00:20 UTC
svn commit: r1166138 [8/12] - in /jackrabbit/sandbox/jackrabbit-mk:
jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/
jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/
jackrabbit-spi-commons/src/main/ja...
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/NumericConstraint.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/NumericConstraint.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/NumericConstraint.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/NumericConstraint.java Wed Sep 7 12:00:14 2011
@@ -16,18 +16,17 @@
*/
package org.apache.jackrabbit.spi.commons.nodetype.constraint;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.commons.nodetype.InvalidConstraintException;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.ConstraintViolationException;
-
-import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.commons.nodetype.InvalidConstraintException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
- * <code>NumericConstraint</code> ...
+ * {@code NumericConstraint} ...
*/
class NumericConstraint extends ValueConstraint {
@@ -68,27 +67,27 @@ class NumericConstraint extends ValueCon
s = matcher.group(4);
upperInclusive = s.equals("]");
if (lowerLimit == null && upperLimit == null) {
- String msg = "'" + definition + "' is not a valid value constraint"
+ String msg = '\'' + definition + "' is not a valid value constraint"
+ " format for numeric types: neither lower- nor upper-limit specified";
log.debug(msg);
throw new InvalidConstraintException(msg);
}
if (lowerLimit != null && upperLimit != null) {
if (lowerLimit > upperLimit) {
- String msg = "'" + definition
+ String msg = '\'' + definition
+ "' is not a valid value constraint format for numeric types: lower-limit exceeds upper-limit";
log.debug(msg);
throw new InvalidConstraintException(msg);
}
}
} catch (NumberFormatException nfe) {
- String msg = "'" + definition
+ String msg = '\'' + definition
+ "' is not a valid value constraint format for numeric types";
log.debug(msg);
throw new InvalidConstraintException(msg, nfe);
}
} else {
- String msg = "'" + definition
+ String msg = '\'' + definition
+ "' is not a valid value constraint format for numeric values";
log.debug(msg);
throw new InvalidConstraintException(msg);
@@ -101,13 +100,13 @@ class NumericConstraint extends ValueCon
if (number < lowerLimit) {
throw new ConstraintViolationException(number
+ " does not satisfy the constraint '"
- + getString() + "'");
+ + getString() + '\'');
}
} else {
if (number <= lowerLimit) {
throw new ConstraintViolationException(number
+ " does not satisfy the constraint '"
- + getString() + "'");
+ + getString() + '\'');
}
}
}
@@ -116,13 +115,13 @@ class NumericConstraint extends ValueCon
if (number > upperLimit) {
throw new ConstraintViolationException(number
+ " does not satisfy the constraint '"
- + getString() + "'");
+ + getString() + '\'');
}
} else {
if (number >= upperLimit) {
throw new ConstraintViolationException(number
+ " does not satisfy the constraint '"
- + getString() + "'");
+ + getString() + '\'');
}
}
}
@@ -131,10 +130,11 @@ class NumericConstraint extends ValueCon
/**
* @see org.apache.jackrabbit.spi.QValueConstraint#check(QValue)
*/
- public void check(QValue value) throws ConstraintViolationException, RepositoryException {
+ @Override
+ public void check(QValue value) throws RepositoryException {
if (value == null) {
throw new ConstraintViolationException("null value does not satisfy the constraint '"
- + getString() + "'");
+ + getString() + '\'');
}
switch (value.getType()) {
case PropertyType.LONG:
@@ -151,10 +151,10 @@ class NumericConstraint extends ValueCon
case PropertyType.BINARY:
long length = value.getLength();
- if (length != -1) {
- check(length);
- } else {
+ if (length == -1) {
log.warn("failed to determine length of binary value");
+ } else {
+ check(length);
}
return;
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/PathConstraint.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/PathConstraint.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/PathConstraint.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/PathConstraint.java Wed Sep 7 12:00:14 2011
@@ -16,23 +16,23 @@
*/
package org.apache.jackrabbit.spi.commons.nodetype.constraint;
-import javax.jcr.NamespaceException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.ConstraintViolationException;
-
import org.apache.jackrabbit.spi.Path;
-import org.apache.jackrabbit.spi.QValue;
import org.apache.jackrabbit.spi.PathFactory;
+import org.apache.jackrabbit.spi.QValue;
import org.apache.jackrabbit.spi.commons.conversion.NameException;
import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
-import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
import org.apache.jackrabbit.spi.commons.nodetype.InvalidConstraintException;
+import javax.jcr.NamespaceException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
/**
- * <code>PathConstraint</code> ...
+ * {@code PathConstraint} ...
*/
class PathConstraint extends ValueConstraint {
@@ -77,7 +77,7 @@ class PathConstraint extends ValueConstr
}
path = resolver.getQPath(jcrPath);
}
- StringBuffer definition = new StringBuffer(path.getString());
+ StringBuilder definition = new StringBuilder(path.getString());
if (deep) {
definition.append(WILDCARD);
}
@@ -101,7 +101,7 @@ class PathConstraint extends ValueConstr
/**
* Uses {@link NamePathResolver#getJCRPath(Path)} to convert the
- * <code>Path</code> present with this constraint into a JCR path.
+ * {@code Path} present with this constraint into a JCR path.
*
* @see ValueConstraint#getDefinition(NamePathResolver)
* @param resolver name-path resolver
@@ -113,7 +113,7 @@ class PathConstraint extends ValueConstr
if (!deep) {
return p;
} else if (path.denotesRoot()) {
- return p + "*";
+ return p + '*';
} else {
return p + "/*";
}
@@ -126,9 +126,10 @@ class PathConstraint extends ValueConstr
/**
* @see org.apache.jackrabbit.spi.QValueConstraint#check(QValue)
*/
- public void check(QValue value) throws ConstraintViolationException, RepositoryException {
+ @Override
+ public void check(QValue value) throws RepositoryException {
if (value == null) {
- throw new ConstraintViolationException("null value does not satisfy the constraint '" + getString() + "'");
+ throw new ConstraintViolationException("null value does not satisfy the constraint '" + getString() + '\'');
}
switch (value.getType()) {
case PropertyType.PATH:
@@ -146,20 +147,20 @@ class PathConstraint extends ValueConstr
if (!p0.isAncestorOf(p1)) {
throw new ConstraintViolationException(p
+ " does not satisfy the constraint '"
- + getString() + "'");
+ + getString() + '\'');
}
} catch (RepositoryException e) {
// can't compare relative with absolute path
throw new ConstraintViolationException(p
+ " does not satisfy the constraint '"
- + getString() + "'");
+ + getString() + '\'');
}
} else {
// exact match required
if (!p0.equals(p1)) {
throw new ConstraintViolationException(p
+ " does not satisfy the constraint '"
- + getString() + "'");
+ + getString() + '\'');
}
}
return;
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ReferenceConstraint.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ReferenceConstraint.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ReferenceConstraint.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ReferenceConstraint.java Wed Sep 7 12:00:14 2011
@@ -16,11 +16,6 @@
*/
package org.apache.jackrabbit.spi.commons.nodetype.constraint;
-import javax.jcr.NamespaceException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.ConstraintViolationException;
-
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.QValue;
import org.apache.jackrabbit.spi.commons.conversion.NameException;
@@ -28,8 +23,13 @@ import org.apache.jackrabbit.spi.commons
import org.apache.jackrabbit.spi.commons.conversion.NameResolver;
import org.apache.jackrabbit.spi.commons.nodetype.InvalidConstraintException;
+import javax.jcr.NamespaceException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
/**
- * <code>ReferenceConstraint</code> ...
+ * {@code ReferenceConstraint} ...
*/
class ReferenceConstraint extends ValueConstraint {
@@ -64,7 +64,7 @@ class ReferenceConstraint extends ValueC
/**
* Uses {@link NamePathResolver#getJCRName(Name)} to convert the node type
- * <code>Name</code> present with this constraint into a JCR name String.
+ * {@code Name} present with this constraint into a JCR name String.
*
* @see ValueConstraint#getDefinition(NamePathResolver)
* @param resolver name-path resolver
@@ -82,9 +82,10 @@ class ReferenceConstraint extends ValueC
/**
* @see org.apache.jackrabbit.spi.QValueConstraint#check(QValue)
*/
- public void check(QValue value) throws ConstraintViolationException, RepositoryException {
+ @Override
+ public void check(QValue value) throws RepositoryException {
if (value == null) {
- throw new ConstraintViolationException("Null value does not satisfy the constraint '" + getString() + "'");
+ throw new ConstraintViolationException("Null value does not satisfy the constraint '" + getString() + '\'');
}
switch (value.getType()) {
case PropertyType.REFERENCE:
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/StringConstraint.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/StringConstraint.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/StringConstraint.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/StringConstraint.java Wed Sep 7 12:00:14 2011
@@ -16,19 +16,18 @@
*/
package org.apache.jackrabbit.spi.commons.nodetype.constraint;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.commons.nodetype.InvalidConstraintException;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.ConstraintViolationException;
-
-import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.commons.nodetype.InvalidConstraintException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
/**
- * <code>StringConstraint</code> ...
+ * {@code StringConstraint} ...
*/
class StringConstraint extends ValueConstraint {
@@ -41,7 +40,7 @@ class StringConstraint extends ValueCons
try {
pattern = Pattern.compile(definition);
} catch (PatternSyntaxException pse) {
- String msg = "'" + definition + "' is not valid regular expression syntax";
+ String msg = '\'' + definition + "' is not valid regular expression syntax";
log.debug(msg);
throw new InvalidConstraintException(msg, pse);
}
@@ -50,9 +49,10 @@ class StringConstraint extends ValueCons
/**
* @see org.apache.jackrabbit.spi.QValueConstraint#check(QValue)
*/
- public void check(QValue value) throws ConstraintViolationException, RepositoryException {
+ @Override
+ public void check(QValue value) throws RepositoryException {
if (value == null) {
- throw new ConstraintViolationException("null value does not satisfy the constraint '" + getString() + "'");
+ throw new ConstraintViolationException("null value does not satisfy the constraint '" + getString() + '\'');
}
switch (value.getType()) {
case PropertyType.STRING:
@@ -60,7 +60,7 @@ class StringConstraint extends ValueCons
String text = value.getString();
Matcher matcher = pattern.matcher(text);
if (!matcher.matches()) {
- throw new ConstraintViolationException("'" + text + "' does not satisfy the constraint '" + getString() + "'");
+ throw new ConstraintViolationException('\'' + text + "' does not satisfy the constraint '" + getString() + '\'');
}
return;
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java Wed Sep 7 12:00:14 2011
@@ -17,10 +17,6 @@
package org.apache.jackrabbit.spi.commons.nodetype.constraint;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.ConstraintViolationException;
-
import org.apache.jackrabbit.spi.NameFactory;
import org.apache.jackrabbit.spi.QPropertyDefinition;
import org.apache.jackrabbit.spi.QValue;
@@ -31,8 +27,12 @@ import org.apache.jackrabbit.spi.commons
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
/**
- * <code>ValueConstraint</code> and its subclasses are used to check the
+ * {@code ValueConstraint} and its subclasses are used to check the
* syntax of a value constraint and to test if a specific value satisfies
* it.
*/
@@ -53,35 +53,38 @@ public abstract class ValueConstraint im
/**
* For constraints that are not namespace prefix mapping sensitive this
- * method returns the same result as <code>{@link #getString()}</code>.
+ * method returns the same result as {@code }{@link #getString()}</code>.
* <p/>
* Those that are namespace prefix mapping sensitive (e.g.
- * <code>NameConstraint</code>, <code>PathConstraint</code> and
- * <code>ReferenceConstraint</code>) use the given <code>nsResolver</code>
+ * {@code NameConstraint}, {@code PathConstraint} and
+ * {@code ReferenceConstraint}) use the given {@code nsResolver}
* to reflect the current mapping in the returned value.
* In other words: subclasses, that need to make a conversion to JCR value
- * must overwrite this and return a value that has the <code>Name</code>s
- * or <code>Path</code> properly resolved to their JCR representation.
+ * must overwrite this and return a value that has the {@code Name}s
+ * or {@code Path} properly resolved to their JCR representation.
*
* @return the definition of this constraint.
* @see #getString ()
* @param resolver name-path resolver
* @see NamePathResolver#getJCRName(org.apache.jackrabbit.spi.Name)
- * @see NamePathResolver#getJCRPath(org.apache.jackrabbit.spi.Path)
+ * @see NamePathResolver#getJCRPath(org.apache.jackrabbit.spi.Path)
*/
public String getDefinition(NamePathResolver resolver) {
return definition;
}
//---------------------------------------------------< QValueConstraint >---
+
/**
* @see org.apache.jackrabbit.spi.QValueConstraint#getString()
*/
+ @Override
public String getString() {
return definition;
}
//---------------------------------------------------< java.lang.Object >---
+
/**
* Same as {@link #getString()}
* @return the internal definition String
@@ -115,8 +118,8 @@ public abstract class ValueConstraint im
//-----------------------------------< static factory and check methods >---
/**
- * Create a new <code>ValueConstraint</code> from the String representation.
- * Note, that the definition must be independant of session specific namespace
+ * Create a new {@code ValueConstraint} from the String representation.
+ * Note, that the definition must be independent of session specific namespace
* mappings in case of the following constraint types:
* <ul><li>{@link PropertyType#NAME},</li>
* <li>{@link PropertyType#PATH} or</li>
@@ -173,7 +176,7 @@ public abstract class ValueConstraint im
}
/**
- * Create a new <code>ValueConstraint</code> array from the String
+ * Create a new {@code ValueConstraint} array from the String
* representation. Note, that the definition must be in the internal format
* in case of the following types:
* <ul><li>{@link PropertyType#NAME},</li>
@@ -189,17 +192,17 @@ public abstract class ValueConstraint im
public static ValueConstraint[] create(int type, String[] definition)
throws InvalidConstraintException {
if (definition == null || definition.length == 0) {
- return ValueConstraint.EMPTY_ARRAY;
+ return EMPTY_ARRAY;
}
ValueConstraint[] ret = new ValueConstraint[definition.length];
for (int i=0; i<ret.length; i++) {
- ret[i] = ValueConstraint.create(type, definition[i]);
+ ret[i] = create(type, definition[i]);
}
return ret;
}
/**
- * Create a new <code>ValueConstraint</code> array from the specified JCR
+ * Create a new {@code ValueConstraint} array from the specified JCR
* representations.
*
* @param type the required type
@@ -208,14 +211,14 @@ public abstract class ValueConstraint im
* @return the array of constraints
* @throws InvalidConstraintException if one of the constraints is invalid
*/
- public static ValueConstraint[] create(int type, String jcrDefinition[], NamePathResolver resolver)
+ public static ValueConstraint[] create(int type, String[] jcrDefinition, NamePathResolver resolver)
throws InvalidConstraintException {
if (jcrDefinition == null || jcrDefinition.length == 0) {
- return ValueConstraint.EMPTY_ARRAY;
+ return EMPTY_ARRAY;
}
ValueConstraint[] ret = new ValueConstraint[jcrDefinition.length];
for (int i=0; i<ret.length; i++) {
- ret[i] = ValueConstraint.create(type, jcrDefinition[i], resolver);
+ ret[i] = create(type, jcrDefinition[i], resolver);
}
return ret;
}
@@ -270,18 +273,17 @@ public abstract class ValueConstraint im
/**
* Tests if the value constraints defined in the property definition
- * <code>pd</code> are satisfied by the the specified <code>values</code>.
+ * {@code pd} are satisfied by the the specified {@code values}.
* <p/>
* Note that the <i>protected</i> flag is not checked. Also note that no
* type conversions are attempted if the type of the given values does not
* match the required type as specified in the given definition.
*
- * @param pd propert definition
+ * @param pd property definition
* @param values values to check
* @throws ConstraintViolationException if the constraints are violated
*/
- public static void checkValueConstraints(QPropertyDefinition pd, QValue[] values)
- throws ConstraintViolationException, RepositoryException {
+ public static void checkValueConstraints(QPropertyDefinition pd, QValue[] values) throws RepositoryException {
// check multi-value flag
if (!pd.isMultiple() && values != null && values.length > 1) {
throw new ConstraintViolationException("the property is not multi-valued");
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/ParseException.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/ParseException.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/ParseException.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/ParseException.java Wed Sep 7 12:00:14 2011
@@ -17,7 +17,7 @@
package org.apache.jackrabbit.spi.commons.privilege;
/**
- * <code>ParseException</code>...
+ * {@code ParseException}...
*/
public class ParseException extends Exception {
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionImpl.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionImpl.java Wed Sep 7 12:00:14 2011
@@ -23,7 +23,7 @@ import java.util.Collections;
import java.util.Set;
/**
- * <code>PrivilegeDefinition</code>
+ * {@code PrivilegeDefinition}
*/
public class PrivilegeDefinitionImpl implements PrivilegeDefinition {
@@ -38,9 +38,11 @@ public class PrivilegeDefinitionImpl imp
}
//------------------------------------------------< PrivilegeDefinition >---
+
/**
* @see PrivilegeDefinition#getName()
*/
+ @Override
public Name getName() {
return name;
}
@@ -48,6 +50,7 @@ public class PrivilegeDefinitionImpl imp
/**
* @see PrivilegeDefinition#isAbstract()
*/
+ @Override
public boolean isAbstract() {
return isAbstract;
}
@@ -55,20 +58,30 @@ public class PrivilegeDefinitionImpl imp
/**
* @see PrivilegeDefinition#getDeclaredAggregateNames()
*/
+ @Override
public Set<Name> getDeclaredAggregateNames() {
return declaredAggregateNames;
}
//-------------------------------------------------------------< Object >---
+
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
PrivilegeDefinitionImpl that = (PrivilegeDefinitionImpl) o;
- if (isAbstract != that.isAbstract) return false;
- if (name != null ? !name.equals(that.name) : that.name != null) return false;
+ if (isAbstract != that.isAbstract) {
+ return false;
+ }
+ if (name != null ? !name.equals(that.name) : that.name != null) {
+ return false;
+ }
return declaredAggregateNames.equals(that.declaredAggregateNames);
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionReader.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionReader.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionReader.java Wed Sep 7 12:00:14 2011
@@ -24,7 +24,7 @@ import java.util.HashMap;
import java.util.Map;
/**
- * Reads privilege definitions for the specified <code>InputStream</code>. Note,
+ * Reads privilege definitions for the specified {@code InputStream}. Note,
* that this reader will not apply any validation.
*/
public class PrivilegeDefinitionReader {
@@ -33,7 +33,7 @@ public class PrivilegeDefinitionReader {
private final Map<String, String> namespaces = new HashMap<String, String>();
/**
- * Creates a new <code>PrivilegeDefinitionReader</code> for the given
+ * Creates a new {@code PrivilegeDefinitionReader} for the given
* input stream. The specified content type is used in order to determine
* the type of privilege serialization.
*
@@ -55,7 +55,7 @@ public class PrivilegeDefinitionReader {
}
/**
- * Creates a new <code>PrivilegeDefinitionReader</code> for the given
+ * Creates a new {@code PrivilegeDefinitionReader} for the given
* input stream. The specified content type is used in order to determine
* the type of privilege serialization.
*
@@ -79,7 +79,7 @@ public class PrivilegeDefinitionReader {
/**
* Returns the privilege definitions retrieved from the input stream.
*
- * @return an array of <code>PrivilegeDefinition</code>
+ * @return an array of {@code PrivilegeDefinition}
*/
public PrivilegeDefinition[] getPrivilegeDefinitions() {
return privilegeDefinitions;
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionWriter.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionWriter.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionWriter.java Wed Sep 7 12:00:14 2011
@@ -31,7 +31,7 @@ public class PrivilegeDefinitionWriter {
private final PrivilegeHandler ph;
/**
- * Creates a new <code>PrivilegeDefinitionWriter</code>.
+ * Creates a new {@code PrivilegeDefinitionWriter}.
*
* @param contentType The content type used to determine the type of
* serialization.
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeXmlHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeXmlHandler.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeXmlHandler.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeXmlHandler.java Wed Sep 7 12:00:14 2011
@@ -50,10 +50,11 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
/**
- * The <code>PrivilegeXmlHandler</code> loads and stores privilege definitions from a XML document using the
+ * The {@code PrivilegeXmlHandler} loads and stores privilege definitions from a XML document using the
* following format:
* <xmp>
* <!DOCTYPE privileges [
@@ -85,27 +86,27 @@ class PrivilegeXmlHandler implements Pri
private static final NameFactory NAME_FACTORY = NameFactoryImpl.getInstance();
private static String createLicenseHeader() {
- return "\n" +
- " Licensed to the Apache Software Foundation (ASF) under one or more\n" +
- " contributor license agreements. See the NOTICE file distributed with\n" +
- " this work for additional information regarding copyright ownership.\n" +
- " The ASF licenses this file to You under the Apache License, Version 2.0\n" +
- " (the \"License\"); you may not use this file except in compliance with\n" +
- " the License. You may obtain a copy of the License at\n" +
- "\n" +
- " http://www.apache.org/licenses/LICENSE-2.0\n" +
- "\n" +
- " Unless required by applicable law or agreed to in writing, software\n" +
- " distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
- " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
- " See the License for the specific language governing permissions and\n" +
- " limitations under the License.\n";
+ return '\n' +
+ " Licensed to the Apache Software Foundation (ASF) under one or more\n" +
+ " contributor license agreements. See the NOTICE file distributed with\n" +
+ " this work for additional information regarding copyright ownership.\n" +
+ " The ASF licenses this file to You under the Apache License, Version 2.0\n" +
+ " (the \"License\"); you may not use this file except in compliance with\n" +
+ " the License. You may obtain a copy of the License at\n" +
+ '\n' +
+ " http://www.apache.org/licenses/LICENSE-2.0\n" +
+ '\n' +
+ " Unless required by applicable law or agreed to in writing, software\n" +
+ " distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
+ " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
+ " See the License for the specific language governing permissions and\n" +
+ " limitations under the License.\n";
}
/**
- * Constant for <code>DocumentBuilderFactory</code>.
+ * Constant for {@code DocumentBuilderFactory}.
*/
- private static DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = createFactory();
+ private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = createFactory();
private static DocumentBuilderFactory createFactory() {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@@ -116,32 +117,27 @@ class PrivilegeXmlHandler implements Pri
}
/**
- * Constant for <code>TransformerFactory</code>
+ * Constant for {@code TransformerFactory}
*/
- private static TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
+ private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
/**
- * Create a new instance.
- */
- PrivilegeXmlHandler() {
-
- }
-
- /**
- * Returns <code>true</code> if the specified content type can be handled by this class.
+ * Returns {@code true} if the specified content type can be handled by this class.
*
* @param contentType
- * @return <code>true</code> if the specified content type can be handled
- * by this class; <code>false</code> otherwise.
+ * @return {@code true} if the specified content type can be handled
+ * by this class; {@code false} otherwise.
*/
static boolean isSupportedContentType(String contentType) {
return TEXT_XML.equals(contentType) || APPLICATION_XML.equals(contentType);
}
//---------------------------------------------------< PrivilegeHandler >---
+
/**
* @see PrivilegeHandler#readDefinitions(java.io.InputStream, java.util.Map)
*/
+ @Override
public PrivilegeDefinition[] readDefinitions(InputStream in, Map<String, String> namespaces) throws ParseException {
return readDefinitions(new InputSource(in), namespaces);
@@ -150,11 +146,14 @@ class PrivilegeXmlHandler implements Pri
/**
* @see PrivilegeHandler#readDefinitions(java.io.Reader, java.util.Map)
*/
+ @Override
public PrivilegeDefinition[] readDefinitions(Reader reader, Map<String, String> namespaces) throws ParseException {
return readDefinitions(new InputSource(reader), namespaces);
}
- private PrivilegeDefinition[] readDefinitions(InputSource input, Map<String, String> namespaces) throws ParseException {
+ private static PrivilegeDefinition[] readDefinitions(InputSource input, Map<String, String> namespaces)
+ throws ParseException {
+
try {
List<PrivilegeDefinition> defs = new ArrayList<PrivilegeDefinition>();
@@ -189,18 +188,26 @@ class PrivilegeXmlHandler implements Pri
/**
* @see PrivilegeHandler#writeDefinitions(java.io.OutputStream, PrivilegeDefinition[], java.util.Map)
*/
- public void writeDefinitions(OutputStream out, PrivilegeDefinition[] definitions, Map<String, String> namespaces) throws IOException {
+ @Override
+ public void writeDefinitions(OutputStream out, PrivilegeDefinition[] definitions, Map<String, String> namespaces)
+ throws IOException {
+
writeDefinitions(new StreamResult(out), definitions, namespaces);
}
/**
* @see PrivilegeHandler#writeDefinitions(java.io.Writer, PrivilegeDefinition[], java.util.Map)
*/
- public void writeDefinitions(Writer writer, PrivilegeDefinition[] definitions, Map<String, String> namespaces) throws IOException {
+ @Override
+ public void writeDefinitions(Writer writer, PrivilegeDefinition[] definitions, Map<String, String> namespaces)
+ throws IOException {
+
writeDefinitions(new StreamResult(writer), definitions, namespaces);
}
- private void writeDefinitions(Result result, PrivilegeDefinition[] definitions, Map<String, String> namespaces) throws IOException {
+ private static void writeDefinitions(Result result, PrivilegeDefinition[] definitions, Map<String, String> namespaces)
+ throws IOException {
+
try {
Map<String, String> uriToPrefix = new HashMap<String, String>(namespaces.size());
DocumentBuilder builder = createDocumentBuilder();
@@ -208,20 +215,20 @@ class PrivilegeXmlHandler implements Pri
doc.appendChild(doc.createComment(LICENSE_HEADER));
Element privileges = (Element) doc.appendChild(doc.createElement(XML_PRIVILEGES));
- for (String prefix : namespaces.keySet()) {
- String uri = namespaces.get(prefix);
- privileges.setAttribute(ATTR_XMLNS + prefix, uri);
- uriToPrefix.put(uri, prefix);
+ for (Entry<String, String> stringStringEntry : namespaces.entrySet()) {
+ String uri = stringStringEntry.getValue();
+ privileges.setAttribute(ATTR_XMLNS + stringStringEntry.getKey(), uri);
+ uriToPrefix.put(uri, stringStringEntry.getKey());
}
for (PrivilegeDefinition def : definitions) {
- Element priv = (Element) privileges.appendChild(doc.createElement(XML_PRIVILEGE));
- priv.setAttribute(ATTR_NAME, getQualifiedName(def.getName(), uriToPrefix));
- priv.setAttribute(ATTR_ABSTRACT, Boolean.valueOf(def.isAbstract()).toString());
-
- for (Name aggrName : def.getDeclaredAggregateNames()) {
- Element contains = (Element) priv.appendChild(doc.createElement(XML_CONTAINS));
- contains.setAttribute(ATTR_NAME, getQualifiedName(aggrName, uriToPrefix));
+ Element privilege = (Element) privileges.appendChild(doc.createElement(XML_PRIVILEGE));
+ privilege.setAttribute(ATTR_NAME, getQualifiedName(def.getName(), uriToPrefix));
+ privilege.setAttribute(ATTR_ABSTRACT, Boolean.valueOf(def.isAbstract()).toString());
+
+ for (Name name : def.getDeclaredAggregateNames()) {
+ Element contains = (Element) privilege.appendChild(doc.createElement(XML_CONTAINS));
+ contains.setAttribute(ATTR_NAME, getQualifiedName(name, uriToPrefix));
}
}
@@ -238,13 +245,14 @@ class PrivilegeXmlHandler implements Pri
}
//--------------------------------------------------------------------------
+
/**
- * Build a new <code>PrivilegeDefinition</code> from the given XML node.
+ * Build a new {@code PrivilegeDefinition} from the given XML node.
* @param n
* @param namespaces
* @return
*/
- private PrivilegeDefinition parseDefinition(Node n, Map<String, String> namespaces) {
+ private static PrivilegeDefinition parseDefinition(Node n, Map<String, String> namespaces) {
if (n.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element) n;
@@ -253,18 +261,18 @@ class PrivilegeXmlHandler implements Pri
Name name = getName(elem.getAttribute(ATTR_NAME), namespaces);
boolean isAbstract = Boolean.parseBoolean(elem.getAttribute(ATTR_ABSTRACT));
- Set<Name> aggrNames = new HashSet<Name>();
+ Set<Name> names = new HashSet<Name>();
NodeList nodeList = elem.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node contains = nodeList.item(i);
if (isElement(n) && XML_CONTAINS.equals(contains.getNodeName())) {
- String aggrName = ((Element) contains).getAttribute(ATTR_NAME);
- if (aggrName != null) {
- aggrNames.add(getName(aggrName, namespaces));
+ String attName = ((Element) contains).getAttribute(ATTR_NAME);
+ if (attName != null) {
+ names.add(getName(attName, namespaces));
}
}
}
- return new PrivilegeDefinitionImpl(name, isAbstract, aggrNames);
+ return new PrivilegeDefinitionImpl(name, isAbstract, names);
}
// could not parse into privilege definition
@@ -272,9 +280,9 @@ class PrivilegeXmlHandler implements Pri
}
/**
- * Create a new <code>DocumentBuilder</code>
+ * Create a new {@code DocumentBuilder}
*
- * @return a new <code>DocumentBuilder</code>
+ * @return a new {@code DocumentBuilder}
* @throws ParserConfigurationException
*/
private static DocumentBuilder createDocumentBuilder() throws ParserConfigurationException {
@@ -303,24 +311,24 @@ class PrivilegeXmlHandler implements Pri
}
/**
- * Returns <code>true</code> if the given XML node is an element.
+ * Returns {@code true} if the given XML node is an element.
*
* @param n
- * @return <code>true</code> if the given XML node is an element; <code>false</code> otherwise.
+ * @return {@code true} if the given XML node is an element; {@code false} otherwise.
*/
private static boolean isElement(Node n) {
return n.getNodeType() == Node.ELEMENT_NODE;
}
- private Name getName(String jcrName, Map<String,String> namespaces) {
+ private static Name getName(String jcrName, Map<String, String> namespaces) {
String prefix = Text.getNamespacePrefix(jcrName);
- String uri = (Name.NS_EMPTY_PREFIX.equals(prefix)) ? Name.NS_DEFAULT_URI : namespaces.get(prefix);
+ String uri = Name.NS_EMPTY_PREFIX.equals(prefix) ? Name.NS_DEFAULT_URI : namespaces.get(prefix);
return NAME_FACTORY.create(uri, Text.getLocalName(jcrName));
}
- private String getQualifiedName(Name name, Map<String,String> uriToPrefix) {
+ private static String getQualifiedName(Name name, Map<String, String> uriToPrefix) {
String uri = name.getNamespaceURI();
- String prefix = (Name.NS_DEFAULT_URI.equals(uri)) ? Name.NS_EMPTY_PREFIX : uriToPrefix.get(uri);
- return prefix + ":" + name.getLocalName();
+ String prefix = Name.NS_DEFAULT_URI.equals(uri) ? Name.NS_EMPTY_PREFIX : uriToPrefix.get(uri);
+ return prefix + ':' + name.getLocalName();
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/AndQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/AndQueryNode.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/AndQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/AndQueryNode.java Wed Sep 7 12:00:14 2011
@@ -25,21 +25,22 @@ import javax.jcr.RepositoryException;
public class AndQueryNode extends NAryQueryNode<QueryNode> {
/**
- * Creates a new <code>AndQueryNode</code> with a <code>parent</code>
+ * Creates a new {@code AndQueryNode} with a {@code parent}
* query node.
*
- * @param parent the parent of <code>this</code> <code>AndQueryNode</code>.
+ * @param parent the parent of {@code this} {@code AndQueryNode}.
*/
protected AndQueryNode(QueryNode parent) {
super(parent);
}
/**
- * This method can return <code>null</code> to indicate that this
- * <code>AndQueryNode</code> does not contain any operands.
+ * This method can return {@code null} to indicate that this
+ * {@code AndQueryNode} does not contain any operands.
* {@inheritDoc}
* @throws RepositoryException
*/
+ @Override
public Object accept(QueryNodeVisitor visitor, Object data) throws RepositoryException {
return visitor.visit(this, data);
}
@@ -48,6 +49,7 @@ public class AndQueryNode extends NAryQu
* Returns the type of this node.
* @return the type of this node.
*/
+ @Override
public int getType() {
return QueryNode.TYPE_AND;
}
@@ -56,9 +58,6 @@ public class AndQueryNode extends NAryQu
* @inheritDoc
*/
public boolean equals(Object obj) {
- if (obj instanceof AndQueryNode) {
- return super.equals(obj);
- }
- return false;
+ return obj instanceof AndQueryNode && super.equals(obj);
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ConstantNameProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ConstantNameProvider.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ConstantNameProvider.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ConstantNameProvider.java Wed Sep 7 12:00:14 2011
@@ -22,9 +22,9 @@ package org.apache.jackrabbit.spi.common
public interface ConstantNameProvider {
/**
- * Returns a descriptive name for the given <code>constant</code>.
+ * Returns a descriptive name for the given {@code constant}.
* @param constant A integer constant
- * @return A descriptive name
+ * @return A descriptive name
*/
- public String getName(int constant);
+ String getName(int constant);
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DefaultQueryNodeFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DefaultQueryNodeFactory.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DefaultQueryNodeFactory.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DefaultQueryNodeFactory.java Wed Sep 7 12:00:14 2011
@@ -16,10 +16,10 @@
*/
package org.apache.jackrabbit.spi.commons.query;
-import java.util.Collection;
-
import org.apache.jackrabbit.spi.Name;
+import java.util.Collection;
+
/**
* Default implementation of a {@link QueryNodeFactory}.
*/
@@ -34,98 +34,67 @@ public class DefaultQueryNodeFactory imp
* Creates a DefaultQueryNodeFactory with the given node types under
* /jcr:system .
*/
- public DefaultQueryNodeFactory(
- Collection<Name> validJcrSystemNodeTypeNames) {
+ public DefaultQueryNodeFactory(Collection<Name> validJcrSystemNodeTypeNames) {
this.validJcrSystemNodeTypeNames = validJcrSystemNodeTypeNames;
}
- /**
- * {@inheritDoc}
- */
- public NodeTypeQueryNode createNodeTypeQueryNode(QueryNode parent,
- Name nodeType) {
+ @Override
+ public NodeTypeQueryNode createNodeTypeQueryNode(QueryNode parent, Name nodeType) {
return new NodeTypeQueryNode(parent, nodeType);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public AndQueryNode createAndQueryNode(QueryNode parent) {
return new AndQueryNode(parent);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public LocationStepQueryNode createLocationStepQueryNode(QueryNode parent) {
return new LocationStepQueryNode(parent);
}
- /**
- * {@inheritDoc}
- */
- public DerefQueryNode createDerefQueryNode(QueryNode parent,
- Name nameTest,
- boolean descendants) {
+ @Override
+ public DerefQueryNode createDerefQueryNode(QueryNode parent, Name nameTest, boolean descendants) {
return new DerefQueryNode(parent, nameTest, descendants);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public NotQueryNode createNotQueryNode(QueryNode parent) {
return new NotQueryNode(parent);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public OrQueryNode createOrQueryNode(QueryNode parent) {
return new OrQueryNode(parent);
}
- /**
- * {@inheritDoc}
- */
- public RelationQueryNode createRelationQueryNode(QueryNode parent,
- int operation) {
+ @Override
+ public RelationQueryNode createRelationQueryNode(QueryNode parent, int operation) {
return new RelationQueryNode(parent, operation, this);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public PathQueryNode createPathQueryNode(QueryNode parent) {
return new PathQueryNode(parent, validJcrSystemNodeTypeNames);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public OrderQueryNode createOrderQueryNode(QueryNode parent) {
return new OrderQueryNode(parent);
}
- /**
- * {@inheritDoc}
- */
- public PropertyFunctionQueryNode createPropertyFunctionQueryNode(
- QueryNode parent, String functionName) {
+ @Override
+ public PropertyFunctionQueryNode createPropertyFunctionQueryNode(QueryNode parent, String functionName) {
return new PropertyFunctionQueryNode(parent, functionName);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public QueryRootNode createQueryRootNode() {
return new QueryRootNode();
}
- /**
- * {@inheritDoc}
- */
- public TextsearchQueryNode createTextsearchQueryNode(QueryNode parent,
- String query) {
+ @Override
+ public TextsearchQueryNode createTextsearchQueryNode(QueryNode parent, String query) {
return new TextsearchQueryNode(parent, query);
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DefaultQueryNodeVisitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DefaultQueryNodeVisitor.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DefaultQueryNodeVisitor.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DefaultQueryNodeVisitor.java Wed Sep 7 12:00:14 2011
@@ -19,59 +19,72 @@ package org.apache.jackrabbit.spi.common
import javax.jcr.RepositoryException;
/**
- * Implements the <code>QueryNodeVisitor</code> interface with default behaviour.
- * All methods are no-ops and return the <code>data</code> argument.
+ * Implements the {@code QueryNodeVisitor} interface with default behaviour.
+ * All methods are no-ops and return the {@code data} argument.
*/
public class DefaultQueryNodeVisitor implements QueryNodeVisitor {
+ @Override
public Object visit(QueryRootNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(OrQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(AndQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(NotQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(ExactQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(NodeTypeQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(TextsearchQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(PathQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(LocationStepQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(RelationQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(OrderQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(DerefQueryNode node, Object data) throws RepositoryException {
return data;
}
+ @Override
public Object visit(PropertyFunctionQueryNode node, Object data) throws RepositoryException {
return data;
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DerefQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DerefQueryNode.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DerefQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/DerefQueryNode.java Wed Sep 7 12:00:14 2011
@@ -16,10 +16,10 @@
*/
package org.apache.jackrabbit.spi.commons.query;
-import javax.jcr.RepositoryException;
-
import org.apache.jackrabbit.spi.Name;
+import javax.jcr.RepositoryException;
+
/**
* Represents query node that dereferences a reference property into a node and
* does an optional name test on the target node.
@@ -30,12 +30,12 @@ public class DerefQueryNode extends Loca
private Name refProperty;
/**
- * Creates a new <code>DerefQueryNode</code> without a name set for the
+ * Creates a new {@code DerefQueryNode} without a name set for the
* reference property.
* @param parent the parent query node.
- * @param nameTest the name test on the target node, or <code>null</code>
+ * @param nameTest the name test on the target node, or {@code null}
* if no name test should be performed on the target node.
- * @param descendants if <code>true</code> this location step uses the
+ * @param descendants if {@code true} this location step uses the
* descendant-or-self axis; otherwise the child axis.
*/
protected DerefQueryNode(QueryNode parent, Name nameTest, boolean descendants) {
@@ -53,26 +53,21 @@ public class DerefQueryNode extends Loca
}
/**
- * Returns the name of the reference property or <code>null</code> if
+ * Returns the name of the reference property or {@code null} if
* none is set.
- * @return the name of the reference property or <code>null</code> if
+ * @return the name of the reference property or {@code null} if
* none is set.
*/
public Name getRefProperty() {
return refProperty;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public int getType() {
return TYPE_DEREF;
}
- /**
- * {@inheritDoc}
- * @throws RepositoryException
- */
+ @Override
public Object accept(QueryNodeVisitor visitor, Object data) throws RepositoryException {
return visitor.visit(this, data);
}
@@ -89,9 +84,7 @@ public class DerefQueryNode extends Loca
return false;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public boolean needsSystemTree() {
// Always return true since we don't know if the referenced nodes path
// is a child of /jcr:system
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ExactQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ExactQueryNode.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ExactQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/ExactQueryNode.java Wed Sep 7 12:00:14 2011
@@ -16,10 +16,10 @@
*/
package org.apache.jackrabbit.spi.commons.query;
-import javax.jcr.RepositoryException;
-
import org.apache.jackrabbit.spi.Name;
+import javax.jcr.RepositoryException;
+
/**
* Implements a query node that defines an exact match of a property and a
* value.
@@ -37,9 +37,9 @@ public class ExactQueryNode extends Quer
private final Name value;
/**
- * Creates a new <code>ExactQueryNode</code> instance.
+ * Creates a new {@code ExactQueryNode} instance.
*
- * @param parent the parent node for this <code>ExactQueryNode</code>.
+ * @param parent the parent node for this {@code ExactQueryNode}.
* @param property the name of the property to match.
* @param value the value of the property to match.
*/
@@ -52,17 +52,12 @@ public class ExactQueryNode extends Quer
this.value = value;
}
- /**
- * {@inheritDoc}
- * @throws RepositoryException
- */
+ @Override
public Object accept(QueryNodeVisitor visitor, Object data) throws RepositoryException {
return visitor.visit(this, data);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public int getType() {
return QueryNode.TYPE_EXACT;
}
@@ -97,9 +92,7 @@ public class ExactQueryNode extends Quer
return false;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public boolean needsSystemTree() {
return false;
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/LocationStepQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/LocationStepQueryNode.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/LocationStepQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/LocationStepQueryNode.java Wed Sep 7 12:00:14 2011
@@ -16,15 +16,15 @@
*/
package org.apache.jackrabbit.spi.commons.query;
-import javax.jcr.RepositoryException;
-
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
+import javax.jcr.RepositoryException;
+
/**
* Defines a location step for querying the path of a node.
* <p/>
- * <code>
+ * {@code }
* /foo -> descendants = false, nameTest = foo<br>
* //foo -> descendants = true, nameTest = foo<br>
* //* -> descendants = true, nameTest = null<br>
@@ -47,28 +47,28 @@ public class LocationStepQueryNode exten
*/
public static final Name EMPTY_NAME = NameFactoryImpl.getInstance().create("", "");
- /** Empty <code>QueryNode</code> array for us as return value */
+ /** Empty {@code QueryNode} array for us as return value */
private static final QueryNode[] EMPTY = new QueryNode[0];
/**
- * Name test for this location step. A <code>null</code> value indicates
+ * Name test for this location step. A {@code null} value indicates
* a '*' name test.
*/
private Name nameTest;
/**
- * If set to <code>true</code> this location step uses the descendant-or-self
+ * If set to {@code true} this location step uses the descendant-or-self
* axis.
*/
private boolean includeDescendants;
/**
- * The context position <code>index</code>. Initially {@link #NONE}.
+ * The context position {@code index}. Initially {@link #NONE}.
*/
private int index = NONE;
/**
- * Creates a new <code>LocationStepQueryNode</code> that matches only the
+ * Creates a new {@code LocationStepQueryNode} that matches only the
* empty name (the repository root). The created location step uses only the
* child axis.
*
@@ -76,12 +76,12 @@ public class LocationStepQueryNode exten
*/
protected LocationStepQueryNode(QueryNode parent) {
super(parent);
- this.nameTest = EMPTY_NAME;
- this.includeDescendants = false;
+ nameTest = EMPTY_NAME;
+ includeDescendants = false;
}
/**
- * Returns the label of the node for this location step, or <code>null</code>
+ * Returns the label of the node for this location step, or {@code null}
* if the name test is '*'.
* @return the label of the node for this location step.
*/
@@ -91,17 +91,17 @@ public class LocationStepQueryNode exten
/**
* Sets a new name test.
- * @param nameTest the name test or <code>null</code> to match all names.
+ * @param nameTest the name test or {@code null} to match all names.
*/
public void setNameTest(Name nameTest) {
this.nameTest = nameTest;
}
/**
- * Returns <code>true</code> if this location step uses the
- * descendant-or-self axis, <code>false</code> if this step uses the child
+ * Returns {@code true} if this location step uses the
+ * descendant-or-self axis, {@code false} if this step uses the child
* axis.
- * @return <code>true</code> if this step uses the descendant-or-self axis.
+ * @return {@code true} if this step uses the descendant-or-self axis.
*/
public boolean getIncludeDescendants() {
return includeDescendants;
@@ -113,7 +113,7 @@ public class LocationStepQueryNode exten
* @see #getIncludeDescendants()
*/
public void setIncludeDescendants(boolean include) {
- this.includeDescendants = include;
+ includeDescendants = include;
}
/**
@@ -158,17 +158,12 @@ public class LocationStepQueryNode exten
return index;
}
- /**
- * {@inheritDoc}
- * @throws RepositoryException
- */
+ @Override
public Object accept(QueryNodeVisitor visitor, Object data) throws RepositoryException {
return visitor.visit(this, data);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public int getType() {
return QueryNode.TYPE_LOCATION;
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NAryQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NAryQueryNode.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NAryQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NAryQueryNode.java Wed Sep 7 12:00:14 2011
@@ -16,13 +16,12 @@
*/
package org.apache.jackrabbit.spi.commons.query;
+import javax.jcr.RepositoryException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
-import javax.jcr.RepositoryException;
-
/**
* Defines an abstract query node for nodes that have child nodes.
*/
@@ -36,10 +35,10 @@ public abstract class NAryQueryNode<T ex
/**
* The list of operands / children
*/
- protected List<T> operands = null;
+ protected List<T> operands;
/**
- * Creates a new <code>NAryQueryNode</code> with a reference to a parent
+ * Creates a new {@code NAryQueryNode} with a reference to a parent
* {@link QueryNode}.
*
* @param parent the parent node.
@@ -49,11 +48,11 @@ public abstract class NAryQueryNode<T ex
}
/**
- * Creates a new <code>NAryQueryNode</code> with a reference to a parent
- * {@link QueryNode} and initial <code>operands</code>.
+ * Creates a new {@code NAryQueryNode} with a reference to a parent
+ * {@link QueryNode} and initial {@code operands}.
*
* @param parent the parent node.
- * @param operands child nodes of this <code>NAryQueryNode</code>.
+ * @param operands child nodes of this {@code NAryQueryNode}.
*/
public NAryQueryNode(QueryNode parent, T[] operands) {
super(parent);
@@ -64,7 +63,7 @@ public abstract class NAryQueryNode<T ex
}
/**
- * Adds a new <code>operand</code> (child node) to this query node.
+ * Adds a new {@code operand} (child node) to this query node.
*
* @param operand the child {@link QueryNode} to add.
*/
@@ -76,12 +75,12 @@ public abstract class NAryQueryNode<T ex
}
/**
- * Removes an <code>operand</code> (child node) from this query node.
+ * Removes an {@code operand} (child node) from this query node.
*
* @param operand the child to remove.
- * @return <code>true</code> if the operand was in the list of child nodes
- * and has been removed; <code>false</code> if this node does not contain
- * <code>operand</code> as a child node.
+ * @return {@code true} if the operand was in the list of child nodes
+ * and has been removed; {@code false} if this node does not contain
+ * {@code operand} as a child node.
*/
public boolean removeOperand(T operand) {
if (operands == null) {
@@ -99,10 +98,10 @@ public abstract class NAryQueryNode<T ex
}
/**
- * Returns an array of currently set <code>QueryNode</code> operands of this
- * <code>QueryNode</code>. Returns an empty array if no operands are set.
+ * Returns an array of currently set {@code QueryNode} operands of this
+ * {@code QueryNode}. Returns an empty array if no operands are set.
*
- * @return currently set <code>QueryNode</code> operands.
+ * @return currently set {@code QueryNode} operands.
*/
public QueryNode[] getOperands() {
if (operands == null) {
@@ -125,12 +124,12 @@ public abstract class NAryQueryNode<T ex
}
/**
- * Helper class to accept a <code>visitor</code> for all operands
- * of this <code>NAryQueryNode</code>.
+ * Helper class to accept a {@code visitor} for all operands
+ * of this {@code NAryQueryNode}.
*
* @param visitor the visitor to call back.
* @param data arbitrary data for the visitor.
- * @return the return values of the <code>visitor.visit()</code> calls.
+ * @return the return values of the {@code visitor.visit()} calls.
* @throws RepositoryException if an error occurs.
*/
public Object[] acceptOperands(QueryNodeVisitor visitor, Object data) throws RepositoryException {
@@ -159,9 +158,7 @@ public abstract class NAryQueryNode<T ex
return false;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public boolean needsSystemTree() {
if (operands == null) {
return false;
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NodeTypeQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NodeTypeQueryNode.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NodeTypeQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NodeTypeQueryNode.java Wed Sep 7 12:00:14 2011
@@ -16,18 +16,18 @@
*/
package org.apache.jackrabbit.spi.commons.query;
-import javax.jcr.RepositoryException;
-
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import javax.jcr.RepositoryException;
+
/**
* Implements a query node that defines a node type match.
*/
public class NodeTypeQueryNode extends ExactQueryNode {
/**
- * Creates a new <code>NodeTypeQueryNode</code>.
+ * Creates a new {@code NodeTypeQueryNode}.
*
* @param parent the parent node for this query node.
* @param nodeType the name of the node type.
@@ -39,10 +39,7 @@ public class NodeTypeQueryNode extends E
super(parent, NameConstants.JCR_PRIMARYTYPE, nodeType);
}
- /**
- * {@inheritDoc}
- * @throws RepositoryException
- */
+ @Override
public Object accept(QueryNodeVisitor visitor, Object data) throws RepositoryException {
return visitor.visit(this, data);
}
@@ -52,6 +49,7 @@ public class NodeTypeQueryNode extends E
*
* @return the type of this node.
*/
+ @Override
public int getType() {
return QueryNode.TYPE_NODETYPE;
}
@@ -60,9 +58,6 @@ public class NodeTypeQueryNode extends E
* @inheritDoc
*/
public boolean equals(Object obj) {
- if (obj instanceof NodeTypeQueryNode) {
- return super.equals(obj);
- }
- return false;
+ return obj instanceof NodeTypeQueryNode && super.equals(obj);
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NotQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NotQueryNode.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NotQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/NotQueryNode.java Wed Sep 7 12:00:14 2011
@@ -24,7 +24,7 @@ import javax.jcr.RepositoryException;
public class NotQueryNode extends NAryQueryNode<QueryNode> {
/**
- * Creates a new <code>NotQueryNode</code> instance.
+ * Creates a new {@code NotQueryNode} instance.
*
* @param parent the parent node for this query node.
*/
@@ -32,10 +32,7 @@ public class NotQueryNode extends NAryQu
super(parent);
}
- /**
- * {@inheritDoc}
- * @throws RepositoryException
- */
+ @Override
public Object accept(QueryNodeVisitor visitor, Object data) throws RepositoryException {
return visitor.visit(this, data);
}
@@ -45,6 +42,7 @@ public class NotQueryNode extends NAryQu
*
* @return the type of this node.
*/
+ @Override
public int getType() {
return QueryNode.TYPE_NOT;
}
@@ -53,9 +51,6 @@ public class NotQueryNode extends NAryQu
* @inheritDoc
*/
public boolean equals(Object obj) {
- if (obj instanceof NotQueryNode) {
- return super.equals(obj);
- }
- return false;
+ return obj instanceof NotQueryNode && super.equals(obj);
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrQueryNode.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrQueryNode.java Wed Sep 7 12:00:14 2011
@@ -25,19 +25,16 @@ import javax.jcr.RepositoryException;
public class OrQueryNode extends NAryQueryNode<QueryNode> {
/**
- * Creates a new <code>OrQueryNode</code> with a <code>parent</code>
+ * Creates a new {@code OrQueryNode} with a {@code parent}
* query node.
*
- * @param parent the parent of <code>this</code> <code>OrQueryNode</code>.
+ * @param parent the parent of {@code this} {@code OrQueryNode}.
*/
protected OrQueryNode(QueryNode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- * @throws RepositoryException
- */
+ @Override
public Object accept(QueryNodeVisitor visitor, Object data) throws RepositoryException {
return visitor.visit(this, data);
}
@@ -47,6 +44,7 @@ public class OrQueryNode extends NAryQue
*
* @return the type of this node.
*/
+ @Override
public int getType() {
return QueryNode.TYPE_OR;
}
@@ -55,9 +53,6 @@ public class OrQueryNode extends NAryQue
* @inheritDoc
*/
public boolean equals(Object obj) {
- if (obj instanceof OrQueryNode) {
- return super.equals(obj);
- }
- return false;
+ return obj instanceof OrQueryNode && super.equals(obj);
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java?rev=1166138&r1=1166137&r2=1166138&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java Wed Sep 7 12:00:14 2011
@@ -16,10 +16,7 @@
*/
package org.apache.jackrabbit.spi.commons.query;
-import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.Path;
-import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
-import org.apache.jackrabbit.spi.commons.name.PathBuilder;
import javax.jcr.RepositoryException;
import java.util.ArrayList;
@@ -37,7 +34,7 @@ public class OrderQueryNode extends Quer
private final List<OrderSpec> specs = new ArrayList<OrderSpec>();
/**
- * Creates a new <code>OrderQueryNode</code> with a reference to a parent
+ * Creates a new {@code OrderQueryNode} with a reference to a parent
* node and sort properties.
*
* @param parent the parent node of this query node.
@@ -51,6 +48,7 @@ public class OrderQueryNode extends Quer
*
* @return the type of this node.
*/
+ @Override
public int getType() {
return QueryNode.TYPE_ORDER;
}
@@ -59,19 +57,19 @@ public class OrderQueryNode extends Quer
* Create and add a new (empty) order specification to this query node.
*/
public void newOrderSpec() {
- specs.add(new OrderSpec((Path) null, true));
+ specs.add(new OrderSpec(null, true));
}
/**
* Set the last order specification of this query node to ascending/descending
* @see OrderSpec#setAscending(boolean)
*
- * @param value <code>true</code>true> for ascending and <code>false</code> for
+ * @param value {@code true}true> for ascending and {@code false} for
* descending.
- * @throws IllegalStateException if no order specification is set
+ * @throws IllegalStateException if no order specification is set
*/
public void setAscending(boolean value) {
- if (specs.size() == 0) {
+ if (specs.isEmpty()) {
throw new IllegalStateException("No order specification set");
}
@@ -87,7 +85,7 @@ public class OrderQueryNode extends Quer
* @throws IllegalStateException if no order specification is set
*/
public void setPath(Path path) {
- if (specs.size() == 0) {
+ if (specs.isEmpty()) {
throw new IllegalStateException("No order specification set");
}
@@ -103,7 +101,7 @@ public class OrderQueryNode extends Quer
* @throws IllegalStateException if no order specification is set
*/
public void setFunction(String name) {
- if (specs.size() == 0) {
+ if (specs.isEmpty()) {
throw new IllegalStateException("No order specification set");
}
@@ -113,9 +111,9 @@ public class OrderQueryNode extends Quer
/**
* Checks whether all order specifications of this query node have at least
- * its path specified (i.e. non <code>null</code>.)
+ * its path specified (i.e. non {@code null}.)
*
- * @return <code>true</code> iff all order specification of this query node are valid.
+ * @return {@code true} iff all order specification of this query node are valid.
*/
public boolean isValid() {
for (OrderSpec spec : specs) {
@@ -131,8 +129,8 @@ public class OrderQueryNode extends Quer
* Adds an order specification to this query node.
*
* @param property the relative path of the property.
- * @param ascending if <code>true</code> values of this properties are
- * ordered ascending; descending if <code>false</code>.
+ * @param ascending if {@code true} values of this properties are
+ * ordered ascending; descending if {@code false}.
*/
public void addOrderSpec(Path property, boolean ascending) {
specs.add(new OrderSpec(property, ascending));
@@ -147,29 +145,26 @@ public class OrderQueryNode extends Quer
specs.add(spec);
}
- /**
- * {@inheritDoc}
- * @throws RepositoryException
- */
+ @Override
public Object accept(QueryNodeVisitor visitor, Object data) throws RepositoryException {
return visitor.visit(this, data);
}
/**
- * Returns <code>true</code> if the property <code>i</code> should be orderd
- * ascending. If <code>false</code> the property is ordered descending.
+ * Returns {@code true} if the property {@code i} should be orderd
+ * ascending. If {@code false} the property is ordered descending.
*
* @param i index of the property
- * @return the order spec for the property <code>i</code>.
+ * @return the order spec for the property {@code i}.
* @throws IndexOutOfBoundsException if there is no property with
- * index <code>i</code>.
+ * index {@code i}.
*/
public boolean isAscending(int i) throws IndexOutOfBoundsException {
return specs.get(i).ascending;
}
/**
- * Returns a <code>OrderSpec</code> array that contains order by
+ * Returns a {@code OrderSpec} array that contains order by
* specifications.
*
* @return order by specs.
@@ -203,7 +198,7 @@ public class OrderQueryNode extends Quer
private Path property;
/**
- * If <code>true</code> this property is ordered ascending
+ * If {@code true} this property is ordered ascending
*/
private boolean ascending;
@@ -213,10 +208,10 @@ public class OrderQueryNode extends Quer
private String function;
/**
- * Creates a new <code>OrderSpec</code> for <code>property</code>.
+ * Creates a new {@code OrderSpec} for {@code property}.
*
* @param property the relative path of the property.
- * @param ascending if <code>true</code> the property is ordered
+ * @param ascending if {@code true} the property is ordered
* ascending, otherwise descending.
*/
public OrderSpec(Path property, boolean ascending) {
@@ -234,10 +229,10 @@ public class OrderQueryNode extends Quer
}
/**
- * If <code>true</code> the property is ordered ascending, otherwise
+ * If {@code true} the property is ordered ascending, otherwise
* descending.
*
- * @return <code>true</code> for ascending; <code>false</code> for
+ * @return {@code true} for ascending; {@code false} for
* descending.
*/
public boolean isAscending() {
@@ -247,7 +242,7 @@ public class OrderQueryNode extends Quer
/**
* Sets the new value for the ascending property.
*
- * @param ascending <code>true</code> for ascending; <code>false</code>
+ * @param ascending {@code true} for ascending; {@code false}
* for descending.
*/
public void setAscending(boolean ascending) {
@@ -260,7 +255,7 @@ public class OrderQueryNode extends Quer
* @param path a path
*/
public void setPath(Path path) {
- this.property = path;
+ property = path;
}
/**
@@ -269,7 +264,7 @@ public class OrderQueryNode extends Quer
* @param name a function name
*/
public void setFunction(String name) {
- this.function = name;
+ function = name;
}
/**
@@ -280,11 +275,11 @@ public class OrderQueryNode extends Quer
}
/**
- * Returns <code>true</code> if <code>this</code> order spec is equal
- * to <code>obj</code>
+ * Returns {@code true} if {@code this} order spec is equal
+ * to {@code obj}
* @param obj the reference object with which to compare.
- * @return <code>true</code> if <code>this</code> order spec is equal
- * to <code>obj</code>; <code>false</code> otherwise.
+ * @return {@code true} if {@code this} order spec is equal
+ * to {@code obj}; {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj instanceof OrderSpec) {
@@ -297,29 +292,9 @@ public class OrderQueryNode extends Quer
}
- /**
- * {@inheritDoc}
- */
+ @Override
public boolean needsSystemTree() {
return false;
}
- //--------------------------------< internal >------------------------------
-
- /**
- * Creates a path with a single element out of the given <code>name</code>.
- *
- * @param name the name to create the path from.
- * @return a path with a single element.
- */
- private static Path createPath(Name name) {
- try {
- PathBuilder builder = new PathBuilder();
- builder.addLast(name);
- return builder.getPath();
- } catch (MalformedPathException e) {
- // never happens, we just added an element
- throw new InternalError();
- }
- }
}