chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1516250 [3/4] - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/ap...
Date Wed, 21 Aug 2013 18:36:17 GMT
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrTypeManager.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrTypeManager.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrTypeManager.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrTypeManager.java Wed Aug 21 18:36:15 2013
@@ -58,8 +58,8 @@ import org.slf4j.LoggerFactory;
 /**
  * Type Manager.
  */
-public class JcrTypeManager implements TypeManager { 
-    private static final Logger log = LoggerFactory.getLogger(JcrTypeManager.class);
+public class JcrTypeManager implements TypeManager {
+    private static final Logger LOG = LoggerFactory.getLogger(JcrTypeManager.class);
 
     public static final String DOCUMENT_TYPE_ID = "cmis:document";
     public static final String FOLDER_TYPE_ID = "cmis:folder";
@@ -75,8 +75,10 @@ public class JcrTypeManager implements T
 
     /**
      * Adds a type to collection with inheriting base type properties.
-     * @param type  type to add
-     * @return  <code>true</code> iff the type was successfully added
+     * 
+     * @param type
+     *            type to add
+     * @return <code>true</code> iff the type was successfully added
      */
     public boolean addType(TypeDefinition type) {
         if (type == null) {
@@ -96,17 +98,13 @@ public class JcrTypeManager implements T
             TypeDefinition baseType;
             if (newType.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
                 baseType = copyTypeDefinition(fTypes.get(DOCUMENT_TYPE_ID).getTypeDefinition());
-            }
-            else if (newType.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
+            } else if (newType.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
                 baseType = copyTypeDefinition(fTypes.get(FOLDER_TYPE_ID).getTypeDefinition());
-            }
-            else if (newType.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
+            } else if (newType.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
                 baseType = copyTypeDefinition(fTypes.get(RELATIONSHIP_TYPE_ID).getTypeDefinition());
-            }
-            else if (newType.getBaseTypeId() == BaseTypeId.CMIS_POLICY) {
+            } else if (newType.getBaseTypeId() == BaseTypeId.CMIS_POLICY) {
                 baseType = copyTypeDefinition(fTypes.get(POLICY_TYPE_ID).getTypeDefinition());
-            }
-            else {
+            } else {
                 return false;
             }
 
@@ -121,7 +119,7 @@ public class JcrTypeManager implements T
         // add it
         addTypeInternal(newType);
 
-        log.info("Added type '" + newType.getId() + "'.");
+        LOG.info("Added type '" + newType.getId() + "'.");
 
         return true;
     }
@@ -132,20 +130,18 @@ public class JcrTypeManager implements T
     }
 
     public static boolean isVersionable(TypeDefinition typeDef) {
-        return typeDef instanceof DocumentTypeDefinition
-                ? ((DocumentTypeDefinition) typeDef).isVersionable()
-                : false;
+        return typeDef instanceof DocumentTypeDefinition ? ((DocumentTypeDefinition) typeDef).isVersionable() : false;
     }
 
     public static TypeDefinition copyTypeDefinition(TypeDefinition type) {
         return WSConverter.convert(WSConverter.convert(type));
     }
-    
+
     /**
      * See CMIS 1.0 section 2.2.2.3 getTypeChildren
      */
-    public TypeDefinitionList getTypeChildren(String typeId, boolean includePropertyDefinitions,
-            BigInteger maxItems, BigInteger skipCount) {
+    public TypeDefinitionList getTypeChildren(String typeId, boolean includePropertyDefinitions, BigInteger maxItems,
+            BigInteger skipCount) {
 
         TypeDefinitionListImpl result = new TypeDefinitionListImpl(new ArrayList<TypeDefinition>());
 
@@ -170,8 +166,7 @@ public class JcrTypeManager implements T
 
             result.setHasMoreItems(result.getList().size() + skip < 2);
             result.setNumItems(BigInteger.valueOf(2));
-        }
-        else {
+        } else {
             TypeDefinitionContainer tc = fTypes.get(typeId);
             if (tc == null || tc.getChildren() == null) {
                 return result;
@@ -224,8 +219,7 @@ public class JcrTypeManager implements T
         if (typeId == null) {
             result.add(getTypesDescendants(d, fTypes.get(FOLDER_TYPE_ID), ipd));
             result.add(getTypesDescendants(d, fTypes.get(DOCUMENT_TYPE_ID), ipd));
-        }
-        else {
+        } else {
             TypeDefinitionContainer tc = fTypes.get(typeId);
             if (tc != null) {
                 result.add(getTypesDescendants(d, tc, ipd));
@@ -235,7 +229,7 @@ public class JcrTypeManager implements T
         return result;
     }
 
-    //------------------------------------------< JcrTypeManager >---
+    // ------------------------------------------< JcrTypeManager >---
 
     public TypeDefinitionContainer getTypeById(String typeId) {
         return fTypes.get(typeId);
@@ -248,7 +242,7 @@ public class JcrTypeManager implements T
                 return typeDef;
             }
         }
-        
+
         return null;
     }
 
@@ -262,7 +256,7 @@ public class JcrTypeManager implements T
         List<TypeDefinitionContainer> types = new ArrayList<TypeDefinitionContainer>(2);
         types.add(fTypes.get(FOLDER_TYPE_ID));
         types.add(fTypes.get(DOCUMENT_TYPE_ID));
-        return types; 
+        return types;
     }
 
     public String getPropertyIdForQueryName(TypeDefinition typeDefinition, String propQueryName) {
@@ -374,32 +368,32 @@ public class JcrTypeManager implements T
         AbstractPropertyDefinition<?> result;
 
         switch (datatype) {
-            case BOOLEAN:
-                result = new PropertyBooleanDefinitionImpl();
-                break;
-            case DATETIME:
-                result = new PropertyDateTimeDefinitionImpl();
-                break;
-            case DECIMAL:
-                result = new PropertyDecimalDefinitionImpl();
-                break;
-            case HTML:
-                result = new PropertyHtmlDefinitionImpl();
-                break;
-            case ID:
-                result = new PropertyIdDefinitionImpl();
-                break;
-            case INTEGER:
-                result = new PropertyIntegerDefinitionImpl();
-                break;
-            case STRING:
-                result = new PropertyStringDefinitionImpl();
-                break;
-            case URI:
-                result = new PropertyUriDefinitionImpl();
-                break;
-            default:
-                throw new RuntimeException("Unknown datatype! Spec change?");
+        case BOOLEAN:
+            result = new PropertyBooleanDefinitionImpl();
+            break;
+        case DATETIME:
+            result = new PropertyDateTimeDefinitionImpl();
+            break;
+        case DECIMAL:
+            result = new PropertyDecimalDefinitionImpl();
+            break;
+        case HTML:
+            result = new PropertyHtmlDefinitionImpl();
+            break;
+        case ID:
+            result = new PropertyIdDefinitionImpl();
+            break;
+        case INTEGER:
+            result = new PropertyIntegerDefinitionImpl();
+            break;
+        case STRING:
+            result = new PropertyStringDefinitionImpl();
+            break;
+        case URI:
+            result = new PropertyUriDefinitionImpl();
+            break;
+        default:
+            throw new RuntimeException("Unknown datatype! Spec change?");
         }
 
         result.setId(id);
@@ -417,7 +411,7 @@ public class JcrTypeManager implements T
         return result;
     }
 
-    //------------------------------------------< private >---
+    // ------------------------------------------< private >---
 
     /**
      * Adds a type to collection.

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrUnversionedDocument.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrUnversionedDocument.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrUnversionedDocument.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrUnversionedDocument.java Wed Aug 21 18:36:15 2013
@@ -29,15 +29,17 @@ import org.apache.chemistry.opencmis.jcr
 import org.apache.chemistry.opencmis.jcr.type.JcrTypeHandlerManager;
 
 /**
- * Instances of this class represent a non versionable cmis:document backed by an underlying JCR <code>Node</code>. 
+ * Instances of this class represent a non versionable cmis:document backed by
+ * an underlying JCR <code>Node</code>.
  */
 public class JcrUnversionedDocument extends JcrDocument {
-    
-    public JcrUnversionedDocument(Node node, JcrTypeManager typeManager, PathManager pathManager, JcrTypeHandlerManager typeHandlerManager) {
+
+    public JcrUnversionedDocument(Node node, JcrTypeManager typeManager, PathManager pathManager,
+            JcrTypeHandlerManager typeHandlerManager) {
         super(node, typeManager, pathManager, typeHandlerManager);
     }
 
-    //------------------------------------------< protected >--- 
+    // ------------------------------------------< protected >---
 
     @Override
     protected Node getContextNode() throws RepositoryException {
@@ -86,7 +88,7 @@ public class JcrUnversionedDocument exte
 
     @Override
     protected String getCheckedOutId() {
-        return null;   
+        return null;
     }
 
     @Override
@@ -96,8 +98,7 @@ public class JcrUnversionedDocument exte
 
     @Override
     protected String getCheckInComment() {
-        return "";   
+        return "";
     }
 
-
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersion.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersion.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersion.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersion.java Wed Aug 21 18:36:15 2013
@@ -29,8 +29,8 @@ import javax.jcr.version.Version;
 import org.apache.chemistry.opencmis.jcr.type.JcrTypeHandlerManager;
 
 /**
- * Instances of this class represent a specific version of a cmis:document backed by an underlying
- * JCR <code>Node</code>.
+ * Instances of this class represent a specific version of a cmis:document
+ * backed by an underlying JCR <code>Node</code>.
  */
 public class JcrVersion extends JcrVersionBase {
     private static final Pattern VERSION_LABEL_PATTERN = Pattern.compile("(\\d+)(\\.(\\d+))?.*");
@@ -46,19 +46,18 @@ public class JcrVersion extends JcrVersi
         this.version = version;
     }
 
-    //------------------------------------------< protected >---
+    // ------------------------------------------< protected >---
 
     @Override
     protected Node getContextNode() throws RepositoryException {
         Node frozen = version.getFrozenNode();
         if (frozen.hasNode(Node.JCR_CONTENT)) {
             return frozen.getNode(Node.JCR_CONTENT);
-        }
-        else {
-            return getNode().getNode(Node.JCR_CONTENT);  // root version
+        } else {
+            return getNode().getNode(Node.JCR_CONTENT); // root version
         }
     }
-    
+
     @Override
     protected String getObjectId() throws RepositoryException {
         return getVersionSeriesId();
@@ -85,9 +84,7 @@ public class JcrVersion extends JcrVersi
         String name = version.getName();
         String major = parseVersion(name, GROUP_MINOR);
 
-        return major == null
-                ? name
-                : (Integer.parseInt(major) + 1) + ".0";
+        return major == null ? name : (Integer.parseInt(major) + 1) + ".0";
     }
 
     @Override
@@ -95,23 +92,22 @@ public class JcrVersion extends JcrVersi
         // todo set checkinComment
         return "";
     }
-    
-    //------------------------------------------< private >---
+
+    // ------------------------------------------< private >---
 
     private static String parseVersion(String name, int group) {
         Matcher matcher = VERSION_LABEL_PATTERN.matcher(name);
-        return matcher.matches()
-                ? matcher.group(group)
-                : null;
+        return matcher.matches() ? matcher.group(group) : null;
     }
 
     /**
      * Retrieve version name.
+     * 
      * @return version name
      * @throws RepositoryException
      */
     public String getVersionName() throws RepositoryException {
-    	return version.getName();
+        return version.getName();
     }
 
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersionBase.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersionBase.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersionBase.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersionBase.java Wed Aug 21 18:36:15 2013
@@ -44,13 +44,14 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Instances of this class represent a versionable cmis:document and its versions backed by an underlying
- * JCR <code>Node</code>. 
+ * Instances of this class represent a versionable cmis:document and its
+ * versions backed by an underlying JCR <code>Node</code>.
  */
 public abstract class JcrVersionBase extends JcrDocument {
     private static final Logger log = LoggerFactory.getLogger(JcrVersionBase.class);
 
-    protected JcrVersionBase(Node node, JcrTypeManager typeManager, PathManager pathManager, JcrTypeHandlerManager typeHandlerManager) {
+    protected JcrVersionBase(Node node, JcrTypeManager typeManager, PathManager pathManager,
+            JcrTypeHandlerManager typeHandlerManager) {
         super(node, typeManager, pathManager, typeHandlerManager);
     }
 
@@ -68,20 +69,20 @@ public abstract class JcrVersionBase ext
                 }
 
                 public JcrVersion next() {
-                    return new JcrVersion(getNode(), versions.nextVersion(), typeManager, pathManager, typeHandlerManager);
+                    return new JcrVersion(getNode(), versions.nextVersion(), typeManager, pathManager,
+                            typeHandlerManager);
                 }
 
                 public void remove() {
                     throw new UnsupportedOperationException();
                 }
             };
-        }
-        catch (RepositoryException e) {
+        } catch (RepositoryException e) {
             log.debug(e.getMessage(), e);
             throw new CmisRuntimeException(e.getMessage(), e);
         }
     }
-    
+
     @Override
     public void delete(boolean allVersions, boolean isPwc) {
         Node node = getNode();
@@ -89,21 +90,17 @@ public abstract class JcrVersionBase ext
             if (node.isCheckedOut()) {
                 if (isPwc) {
                     cancelCheckout(node);
-                }
-                else {
+                } else {
                     throw new CmisStorageException("Cannot delete checked out document: " + getId());
                 }
-            }
-            else if (allVersions) {
+            } else if (allVersions) {
                 checkout(node);
                 node.remove();
                 node.getSession().save();
-            }
-            else {
+            } else {
                 throw new CmisRuntimeException("Cannot delete a single version");
             }
-        }
-        catch (RepositoryException e) {
+        } catch (RepositoryException e) {
             log.debug(e.getMessage(), e);
             throw new CmisRuntimeException(e.getMessage(), e);
         }
@@ -111,7 +108,7 @@ public abstract class JcrVersionBase ext
 
     /**
      * See CMIS 1.0 section 2.2.7.1 checkOut
-     *
+     * 
      * @throws CmisRuntimeException
      */
     public JcrPrivateWorkingCopy checkout() {
@@ -123,8 +120,7 @@ public abstract class JcrVersionBase ext
 
             checkout(node);
             return getPwc();
-        }
-        catch (RepositoryException e) {
+        } catch (RepositoryException e) {
             log.debug(e.getMessage(), e);
             throw new CmisRuntimeException(e.getMessage(), e);
         }
@@ -132,7 +128,7 @@ public abstract class JcrVersionBase ext
 
     /**
      * See CMIS 1.0 section 2.2.7.3 checkedIn
-     *
+     * 
      * @throws CmisRuntimeException
      */
     public JcrVersion checkin(Properties properties, ContentStream contentStream, String checkinComment) {
@@ -154,8 +150,7 @@ public abstract class JcrVersionBase ext
             // todo handle checkinComment
             checkin(node);
             return (JcrVersion) create(node);
-        }
-        catch (RepositoryException e) {
+        } catch (RepositoryException e) {
             log.debug(e.getMessage(), e);
             throw new CmisRuntimeException(e.getMessage(), e);
         }
@@ -163,25 +158,26 @@ public abstract class JcrVersionBase ext
 
     /**
      * See CMIS 1.0 section 2.2.7.2 cancelCheckout
-     *
+     * 
      * @throws CmisRuntimeException
      */
     public void cancelCheckout() {
         Node node = getNode();
         try {
             cancelCheckout(node);
-        }
-        catch (RepositoryException e) {
+        } catch (RepositoryException e) {
             log.debug(e.getMessage(), e);
             throw new CmisRuntimeException(e.getMessage(), e);
         }
     }
 
     /**
-     * Get the private working copy of the versions series or throw an exception if not checked out.
-     *
-     * @return  a {@link JcrPrivateWorkingCopy} instance
-     * @throws CmisObjectNotFoundException  if not checked out
+     * Get the private working copy of the versions series or throw an exception
+     * if not checked out.
+     * 
+     * @return a {@link JcrPrivateWorkingCopy} instance
+     * @throws CmisObjectNotFoundException
+     *             if not checked out
      * @throws CmisRuntimeException
      */
     public JcrPrivateWorkingCopy getPwc() {
@@ -189,12 +185,10 @@ public abstract class JcrVersionBase ext
             Node node = getNode();
             if (node.isCheckedOut()) {
                 return new JcrPrivateWorkingCopy(getNode(), typeManager, pathManager, typeHandlerManager);
-            }
-            else {
+            } else {
                 throw new CmisObjectNotFoundException("Not checked out document has no private working copy");
             }
-        }
-        catch (RepositoryException e) {
+        } catch (RepositoryException e) {
             log.debug(e.getMessage(), e);
             throw new CmisRuntimeException(e.getMessage(), e);
         }
@@ -202,9 +196,12 @@ public abstract class JcrVersionBase ext
 
     /**
      * Get a specific version by name
-     * @param name  name of the version to get
-     * @return  a {@link JcrVersion} instance for <code>name</code>
-     * @throws CmisObjectNotFoundException  if a version <code>name</code> does not exist
+     * 
+     * @param name
+     *            name of the version to get
+     * @return a {@link JcrVersion} instance for <code>name</code>
+     * @throws CmisObjectNotFoundException
+     *             if a version <code>name</code> does not exist
      * @throws CmisRuntimeException
      */
     public JcrVersion getVersion(String name) {
@@ -213,25 +210,22 @@ public abstract class JcrVersionBase ext
             VersionHistory versionHistory = getVersionHistory(node);
             Version version = versionHistory.getVersion(name);
             return new JcrVersion(node, version, typeManager, pathManager, typeHandlerManager);
-        }
-        catch (UnsupportedRepositoryOperationException e) {
+        } catch (UnsupportedRepositoryOperationException e) {
             log.debug(e.getMessage(), e);
             throw new CmisObjectNotFoundException(e.getMessage(), e);
-        }
-        catch (VersionException e) {
+        } catch (VersionException e) {
             log.debug(e.getMessage(), e);
             throw new CmisObjectNotFoundException(e.getMessage(), e);
-        }
-        catch (RepositoryException e) {
+        } catch (RepositoryException e) {
             log.debug(e.getMessage(), e);
             throw new CmisRuntimeException(e.getMessage(), e);
         }
     }
 
-    //------------------------------------------< protected >---
+    // ------------------------------------------< protected >---
 
     /**
-     * @return  Id of the version representing the base of this versions series
+     * @return Id of the version representing the base of this versions series
      * @throws RepositoryException
      */
     protected String getBaseNodeId() throws RepositoryException {
@@ -241,13 +235,13 @@ public abstract class JcrVersionBase ext
     }
 
     /**
-     * @return  Id of the private working copy of this version series
+     * @return Id of the private working copy of this version series
      * @throws RepositoryException
      */
     protected String getPwcId() throws RepositoryException {
         return null;
     }
-    
+
     @Override
     protected void compileProperties(PropertiesImpl properties, Set<String> filter, ObjectInfoImpl objectInfo)
             throws RepositoryException {
@@ -267,7 +261,7 @@ public abstract class JcrVersionBase ext
         setAction(result, Action.CAN_CHECK_IN, true);
         return result;
     }
-    
+
     @Override
     protected String getTypeIdInternal() {
         return JcrTypeManager.DOCUMENT_TYPE_ID;
@@ -280,19 +274,15 @@ public abstract class JcrVersionBase ext
 
     @Override
     protected String getCheckedOutId() throws RepositoryException {
-        return isCheckedOut()
-                ? getVersionSeriesId() + "/pwc"
-                : null;
+        return isCheckedOut() ? getVersionSeriesId() + "/pwc" : null;
     }
 
     @Override
     protected String getCheckedOutBy() throws RepositoryException {
-        return isCheckedOut()
-                ? getNode().getSession().getUserID()
-                : null;
+        return isCheckedOut() ? getNode().getSession().getUserID() : null;
     }
-    
-    //------------------------------------------< private >---
+
+    // ------------------------------------------< private >---
 
     private static void checkout(Node node) throws RepositoryException {
         getVersionManager(node).checkout(node.getPath());
@@ -306,5 +296,5 @@ public abstract class JcrVersionBase ext
         Version base = getBaseVersion(node);
         getVersionManager(node).restore(base, true);
     }
-    
+
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PathManager.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PathManager.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PathManager.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PathManager.java Wed Aug 21 18:36:15 2013
@@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
  * Utility class for mapping JCR paths to CMIS paths
  */
 public class PathManager {
-    private static final Logger log = LoggerFactory.getLogger(PathManager.class);
+    private static final Logger LOG = LoggerFactory.getLogger(PathManager.class);
 
     /**
      * Identifier of the root folder
@@ -46,7 +46,9 @@ public class PathManager {
     private final String jcrRootPath;
 
     /**
-     * Create a new <code>PathManager</code> instance for the given JCR root path.
+     * Create a new <code>PathManager</code> instance for the given JCR root
+     * path.
+     * 
      * @param jcrRootPath
      */
     public PathManager(String jcrRootPath) {
@@ -54,7 +56,7 @@ public class PathManager {
     }
 
     /**
-     * @return  the JCR root path
+     * @return the JCR root path
      */
     public String getJcrRootPath() {
         return jcrRootPath;
@@ -62,29 +64,29 @@ public class PathManager {
 
     /**
      * Determines whether a JCR <code>Node</code> is the root node wrt. to this
-     * <code>PathManager</code> instance. That is, whether the path of the node is
-     * equal to this instance's JCR root path.
+     * <code>PathManager</code> instance. That is, whether the path of the node
+     * is equal to this instance's JCR root path.
      * 
      * @param node
-     * @return  <code>true</code> iff <code>node</code> is the root node wrt. to
-     *      this <code>PathManager</code> instance.
+     * @return <code>true</code> iff <code>node</code> is the root node wrt. to
+     *         this <code>PathManager</code> instance.
      */
     public boolean isRoot(Node node) {
         try {
             return node.getPath().equals(jcrRootPath);
-        }
-        catch (RepositoryException e) {
-            log.debug(e.getMessage(), e);
+        } catch (RepositoryException e) {
+            LOG.debug(e.getMessage(), e);
             throw new CmisRuntimeException(e.getMessage(), e);
         }
     }
 
     /**
      * Determine the CMIS path given a JCR <code>Node</code>.
-     *
+     * 
      * @param node
      * @return
-     * @throws IllegalArgumentException  when <code>node</code> is not part of the hierarchy
+     * @throws IllegalArgumentException
+     *             when <code>node</code> is not part of the hierarchy
      */
     public String getPath(Node node) {
         try {
@@ -94,16 +96,16 @@ public class PathManager {
 
             String path = node.getPath().substring(jcrRootPath.length());
             return path.startsWith("/") ? path : '/' + path;
-        }
-        catch (RepositoryException e) {
-            log.debug(e.getMessage(), e);
+        } catch (RepositoryException e) {
+            LOG.debug(e.getMessage(), e);
             throw new CmisRuntimeException(e.getMessage(), e);
         }
     }
 
     /**
      * @param cmisPath
-     * @return  <code>true</code> iff <code>cmisPath</code> equals {@link PathManager#CMIS_ROOT_PATH}
+     * @return <code>true</code> iff <code>cmisPath</code> equals
+     *         {@link PathManager#CMIS_ROOT_PATH}
      */
     public static boolean isRoot(String cmisPath) {
         return CMIS_ROOT_PATH.equals(cmisPath);
@@ -111,7 +113,7 @@ public class PathManager {
 
     /**
      * @param cmisPath
-     * @return  <code>true</code> iff <code>cmisPath</code>
+     * @return <code>true</code> iff <code>cmisPath</code>
      */
     public static boolean isAbsolute(String cmisPath) {
         return cmisPath.startsWith(CMIS_ROOT_PATH);
@@ -119,33 +121,38 @@ public class PathManager {
 
     /**
      * Create a CMIS path from a parent path and a child element
-     * @param cmisPath  parent path
-     * @param child  child element
+     * 
+     * @param cmisPath
+     *            parent path
+     * @param child
+     *            child element
      * @return
      */
     public static String createCmisPath(String cmisPath, String child) {
-        return cmisPath.length() > 0 && cmisPath.charAt(cmisPath.length() - 1) == '/'
-                ? cmisPath + child
-                : cmisPath + '/' + child;
+        return cmisPath.length() > 0 && cmisPath.charAt(cmisPath.length() - 1) == '/' ? cmisPath + child : cmisPath
+                + '/' + child;
     }
 
     /**
-     * Relativize an CMIS path wrt. to a prefix.  
+     * Relativize an CMIS path wrt. to a prefix.
+     * 
      * @param prefix
      * @param cmisPath
-     * @return  a string <code>r</code> such that <code>prefix</code> + <code>r</code> = <code>cmisPath</code> 
-     * @throws IllegalArgumentException  if <code>prefix</code> is not a prefix of <code>cmisPath</code>
+     * @return a string <code>r</code> such that <code>prefix</code> +
+     *         <code>r</code> = <code>cmisPath</code>
+     * @throws IllegalArgumentException
+     *             if <code>prefix</code> is not a prefix of
+     *             <code>cmisPath</code>
      */
     public static String relativize(String prefix, String cmisPath) {
         if (cmisPath.startsWith(prefix)) {
             return cmisPath.substring(prefix.length());
-        }
-        else {
+        } else {
             throw new IllegalArgumentException(prefix + " is not a prefix of " + cmisPath);
         }
     }
 
-    //------------------------------------------< private >---
+    // ------------------------------------------< private >---
 
     private static String normalize(String path) {
         if (path == null || path.length() == 0) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PropertyHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PropertyHelper.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PropertyHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PropertyHelper.java Wed Aug 21 18:36:15 2013
@@ -50,11 +50,13 @@ public final class PropertyHelper {
 
     /**
      * Retrieve a string value.
-     *
+     * 
      * @param properties
-     * @param name  the name of the value to retrieve
-     * @return  the first value of the given <code>name</code> or <code>null</code> if either
-     *      these are no string properties or no property of <code>name</code> exists. 
+     * @param name
+     *            the name of the value to retrieve
+     * @return the first value of the given <code>name</code> or
+     *         <code>null</code> if either these are no string properties or no
+     *         property of <code>name</code> exists.
      */
     public static String getStringProperty(Properties properties, String name) {
         PropertyData<?> property = properties.getProperties().get(name);
@@ -84,17 +86,21 @@ public final class PropertyHelper {
 
     /**
      * @param prop
-     * @return  <code>true</code> iff <code>prop</code> denotes an empty property data value
+     * @return <code>true</code> iff <code>prop</code> denotes an empty property
+     *         data value
      */
     public static boolean isPropertyEmpty(PropertyData<?> prop) {
         return prop == null || prop.getValues() == null || prop.getValues().isEmpty();
     }
 
     /**
-     * Determine the default property data value for a given property definition.
+     * Determine the default property data value for a given property
+     * definition.
+     * 
      * @param propDef
      * @return
-     * @throws CmisRuntimeException  if <code>propDef</code> is invalid or unknown.
+     * @throws CmisRuntimeException
+     *             if <code>propDef</code> is invalid or unknown.
      */
     @SuppressWarnings("unchecked")
     public static PropertyData<?> getDefaultValue(PropertyDefinition<?> propDef) {
@@ -105,24 +111,24 @@ public final class PropertyHelper {
         List<?> defaultValue = propDef.getDefaultValue();
         if (defaultValue != null && !defaultValue.isEmpty()) {
             switch (propDef.getPropertyType()) {
-                case BOOLEAN:
-                    return new PropertyBooleanImpl(propDef.getId(), (List<Boolean>) defaultValue);
-                case DATETIME:
-                    return new PropertyDateTimeImpl(propDef.getId(), (List<GregorianCalendar>) defaultValue);
-                case DECIMAL:
-                    return new PropertyDecimalImpl(propDef.getId(), (List<BigDecimal>) defaultValue);
-                case HTML:
-                    return new PropertyHtmlImpl(propDef.getId(), (List<String>) defaultValue);
-                case ID:
-                    return new PropertyIdImpl(propDef.getId(), (List<String>) defaultValue);
-                case INTEGER:
-                    return new PropertyIntegerImpl(propDef.getId(), (List<BigInteger>) defaultValue);
-                case STRING:
-                    return new PropertyStringImpl(propDef.getId(), (List<String>) defaultValue);
-                case URI:
-                    return new PropertyUriImpl(propDef.getId(), (List<String>) defaultValue);
-                default:
-                    throw new CmisRuntimeException("Unknown datatype: " + propDef.getPropertyType());
+            case BOOLEAN:
+                return new PropertyBooleanImpl(propDef.getId(), (List<Boolean>) defaultValue);
+            case DATETIME:
+                return new PropertyDateTimeImpl(propDef.getId(), (List<GregorianCalendar>) defaultValue);
+            case DECIMAL:
+                return new PropertyDecimalImpl(propDef.getId(), (List<BigDecimal>) defaultValue);
+            case HTML:
+                return new PropertyHtmlImpl(propDef.getId(), (List<String>) defaultValue);
+            case ID:
+                return new PropertyIdImpl(propDef.getId(), (List<String>) defaultValue);
+            case INTEGER:
+                return new PropertyIntegerImpl(propDef.getId(), (List<BigInteger>) defaultValue);
+            case STRING:
+                return new PropertyStringImpl(propDef.getId(), (List<String>) defaultValue);
+            case URI:
+                return new PropertyUriImpl(propDef.getId(), (List<String>) defaultValue);
+            default:
+                throw new CmisRuntimeException("Unknown datatype: " + propDef.getPropertyType());
             }
         }
         return null;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/AbstractJcrTypeHandler.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/AbstractJcrTypeHandler.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/AbstractJcrTypeHandler.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/AbstractJcrTypeHandler.java Wed Aug 21 18:36:15 2013
@@ -24,8 +24,8 @@ import org.apache.chemistry.opencmis.jcr
 import org.apache.chemistry.opencmis.jcr.type.JcrTypeHandlerManager;
 
 /**
- * This abstract class takes care of collecting references set when the handler is added to
- * {@link JcrTypeHandlerManager}.
+ * This abstract class takes care of collecting references set when the handler
+ * is added to {@link JcrTypeHandlerManager}.
  */
 public abstract class AbstractJcrTypeHandler implements JcrTypeHandler {
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentIdentifierMap.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentIdentifierMap.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentIdentifierMap.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentIdentifierMap.java Wed Aug 21 18:36:15 2013
@@ -43,7 +43,6 @@ public class DefaultDocumentIdentifierMa
 
     @Override
     public String jcrTypeCondition() {
-        return (isVersionable ? "" : "not") +
-                "(@jcr:mixinTypes = 'mix:simpleVersionable')";
+        return (isVersionable ? "" : "not") + "(@jcr:mixinTypes = 'mix:simpleVersionable')";
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentTypeHandler.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentTypeHandler.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentTypeHandler.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentTypeHandler.java Wed Aug 21 18:36:15 2013
@@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory;
  */
 public class DefaultDocumentTypeHandler extends AbstractJcrTypeHandler implements JcrDocumentTypeHandler {
 
-    private static final Logger log = LoggerFactory.getLogger(JcrFolder.class);
+    private static final Logger LOG = LoggerFactory.getLogger(JcrFolder.class);
 
     public String getTypeId() {
         return BaseTypeId.CMIS_DOCUMENT.value();
@@ -100,47 +100,43 @@ public class DefaultDocumentTypeHandler 
     public boolean canHandle(Node node) throws RepositoryException {
         return node.isNodeType(NodeType.NT_FILE) && node.isNodeType(supportedVersioningType(node));
     }
-    
+
     protected String supportedVersioningType(Node node) throws RepositoryException {
-    	if (Util.supportOption(node, Repository.OPTION_SIMPLE_VERSIONING_SUPPORTED)) {
-    		return NodeType.MIX_SIMPLE_VERSIONABLE;
-    	}
-    	
-    	if(Util.supportOption(node, Repository.OPTION_VERSIONING_SUPPORTED)) {
-    		return NodeType.MIX_VERSIONABLE;
-    	}
-    	
-    	throw new RepositoryException("The repository does not support versioning!");
-    }
+        if (Util.supportOption(node, Repository.OPTION_SIMPLE_VERSIONING_SUPPORTED)) {
+            return NodeType.MIX_SIMPLE_VERSIONABLE;
+        }
 
+        if (Util.supportOption(node, Repository.OPTION_VERSIONING_SUPPORTED)) {
+            return NodeType.MIX_VERSIONABLE;
+        }
+
+        throw new RepositoryException("The repository does not support versioning!");
+    }
 
     public JcrNode createDocument(JcrFolder parentFolder, String name, Properties properties,
-                                  ContentStream contentStream, VersioningState versioningState) {
+            ContentStream contentStream, VersioningState versioningState) {
         try {
             Node fileNode = parentFolder.getNode().addNode(name, NodeType.NT_FILE);
-            addFileNodeMixins(fileNode,versioningState);
+            addFileNodeMixins(fileNode, versioningState);
             Node contentNode = fileNode.addNode(Node.JCR_CONTENT, NodeType.NT_RESOURCE);
             addContentNodeMixins(contentNode);
             // compile the properties
             setContentNodeProperties(contentNode, properties);
             // write content, if available
             updateContentNode(contentStream, contentNode);
-            //save changes
+            // save changes
             fileNode.getSession().save();
             return getJcrNode(fileNode, versioningState);
-        }
-        catch (RepositoryException e) {
-            log.debug(e.getMessage(), e);
+        } catch (RepositoryException e) {
+            LOG.debug(e.getMessage(), e);
             throw new CmisStorageException(e.getMessage(), e);
-        }
-        catch (IOException e) {
-            log.debug(e.getMessage(), e);
+        } catch (IOException e) {
+            LOG.debug(e.getMessage(), e);
             throw new CmisStorageException(e.getMessage(), e);
         }
     }
 
-    protected JcrNode getJcrNode(Node fileNode, VersioningState versioningState)
-            throws RepositoryException {
+    protected JcrNode getJcrNode(Node fileNode, VersioningState versioningState) throws RepositoryException {
         JcrNode jcrFileNode = getJcrNode(fileNode);
         if (versioningState == VersioningState.NONE) {
             return jcrFileNode;
@@ -154,18 +150,16 @@ public class DefaultDocumentTypeHandler 
         }
     }
 
-    protected void updateContentNode(ContentStream contentStream, Node contentNode)
-            throws IOException, RepositoryException {
-        Binary binary = contentStream == null || contentStream.getStream() == null
-                ? JcrBinary.EMPTY
-                : new JcrBinary(new BufferedInputStream(contentStream.getStream()));
+    protected void updateContentNode(ContentStream contentStream, Node contentNode) throws IOException,
+            RepositoryException {
+        Binary binary = contentStream == null || contentStream.getStream() == null ? JcrBinary.EMPTY : new JcrBinary(
+                new BufferedInputStream(contentStream.getStream()));
         try {
             contentNode.setProperty(Property.JCR_DATA, binary);
             if (contentStream != null && contentStream.getMimeType() != null) {
                 contentNode.setProperty(Property.JCR_MIMETYPE, contentStream.getMimeType());
             }
-        }
-        finally {
+        } finally {
             binary.dispose();
         }
     }
@@ -178,8 +172,7 @@ public class DefaultDocumentTypeHandler 
         contentNode.addMixin(NodeType.MIX_CREATED);
     }
 
-    protected void addFileNodeMixins(Node fileNode, VersioningState versioningState)
-            throws RepositoryException {
+    protected void addFileNodeMixins(Node fileNode, VersioningState versioningState) throws RepositoryException {
         if (versioningState != VersioningState.NONE) {
             fileNode.addMixin(supportedVersioningType(fileNode));
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultFolderTypeHandler.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultFolderTypeHandler.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultFolderTypeHandler.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultFolderTypeHandler.java Wed Aug 21 18:36:15 2013
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
  */
 public class DefaultFolderTypeHandler extends AbstractJcrTypeHandler implements JcrFolderTypeHandler {
 
-    private static final Logger log = LoggerFactory.getLogger(DefaultFolderTypeHandler.class);
+    private static final Logger LOG = LoggerFactory.getLogger(DefaultFolderTypeHandler.class);
 
     private static class FolderIdentifierMap extends DefaultIdentifierMapBase {
 
@@ -94,12 +94,11 @@ public class DefaultFolderTypeHandler ex
             addMixins(node);
             // compile the properties
             updateProperties(node, properties);
-            //save changes
+            // save changes
             node.getSession().save();
             return getJcrNode(node);
-        }
-        catch (RepositoryException e) {
-            log.debug(e.getMessage(), e);
+        } catch (RepositoryException e) {
+            LOG.debug(e.getMessage(), e);
             throw new CmisStorageException(e.getMessage(), e);
         }
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/Evaluator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/Evaluator.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/Evaluator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/Evaluator.java Wed Aug 21 18:36:15 2013
@@ -33,102 +33,102 @@ public interface Evaluator<T> {
     /** Create a new instance of this <code>Evaluator</code>. */
     Evaluator<T> op();
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NOT} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NOT} nodes. */
     T not(T op);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#AND} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#AND} nodes. */
     T and(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#OR} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#OR} nodes. */
     T or(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#EQ} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#EQ} nodes. */
     T eq(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NEQ} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NEQ} nodes. */
     T neq(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#GT} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#GT} nodes. */
     T gt(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#GTEQ} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#GTEQ} nodes. */
     T gteq(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#LT} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#LT} nodes. */
     T lt(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#LTEQ} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#LTEQ} nodes. */
     T lteq(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN} nodes. */
     T in(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NOT_IN} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NOT_IN} nodes. */
     T notIn(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN_ANY} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN_ANY} nodes. */
     T inAny(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NOT_IN_ANY} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NOT_IN_ANY} nodes. */
     T notInAny(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#EQ_ANY} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#EQ_ANY} nodes. */
     T eqAny(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IS_NULL} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IS_NULL} nodes. */
     T isNull(T op);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IS_NOT_NULL} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IS_NOT_NULL} nodes. */
     T notIsNull(T op);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#LIKE} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#LIKE} nodes. */
     T like(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NOT_LIKE} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NOT_LIKE} nodes. */
     T notLike(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#CONTAINS} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#CONTAINS} nodes. */
     T contains(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN_FOLDER} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN_FOLDER} nodes. */
     T inFolder(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN_TREE} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN_TREE} nodes. */
     T inTree(T op1, T op2);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN_LIST} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#IN_LIST} nodes. */
     T list(List<T> ops);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#BOOL_LIT} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#BOOL_LIT} nodes. */
     T value(boolean value);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NUM_LIT} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NUM_LIT} nodes. */
     T value(double value);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NUM_LIT} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#NUM_LIT} nodes. */
     T value(long value);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#STRING_LIT} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#STRING_LIT} nodes. */
     T value(String value);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#TIME_LIT} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#TIME_LIT} nodes. */
     T value(GregorianCalendar value);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#COL} nodes */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer#COL} nodes. */
     T col(String name);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_AND} */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_AND}. */
     T textAnd(List<T> ops);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_OR} */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_OR}. */
     T textOr(List<T> ops);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_MINUS} */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_MINUS}. */
     T textMinus(String text);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_SEARCH_WORD_LIT} */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_SEARCH_WORD_LIT}. */
     T textWord(String word);
 
-    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_SEARCH_PHRASE_STRING_LIT} */
+    /** Handle {@link org.apache.chemistry.opencmis.server.support.query.TextSearchLexer#TEXT_SEARCH_PHRASE_STRING_LIT}. */
     T textPhrase(String phrase);
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/EvaluatorXPath.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/EvaluatorXPath.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/EvaluatorXPath.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/EvaluatorXPath.java Wed Aug 21 18:36:15 2013
@@ -26,9 +26,10 @@ import org.apache.chemistry.opencmis.jcr
 import org.apache.chemistry.opencmis.jcr.util.Iterables;
 
 /**
- * This implementation of {@link Evaluator} results in an instance of a {@link XPathBuilder} which
- * can be used to validated the where clause of the original CMIS query and translate it to a
- * corresponding (i.e. semantically equal) XPath condition. 
+ * This implementation of {@link Evaluator} results in an instance of a
+ * {@link XPathBuilder} which can be used to validated the where clause of the
+ * original CMIS query and translate it to a corresponding (i.e. semantically
+ * equal) XPath condition.
  */
 public class EvaluatorXPath extends EvaluatorBase<XPathBuilder> {
 
@@ -55,11 +56,11 @@ public class EvaluatorXPath extends Eval
             public String xPath() {
                 if (eval(true) != null) {
                     return eval(true) ? "true()" : "false()";
-                }
-                else {
+                } else {
                     return "not(" + op.xPath() + ")";
                 }
             }
+
             public Boolean eval(Boolean folderPredicateValuation) {
                 return not(op.eval(folderPredicateValuation));
             }
@@ -76,17 +77,19 @@ public class EvaluatorXPath extends Eval
             public String xPath() {
                 if (eval(true) != null) {
                     return eval(true) ? "true()" : "false()";
-                }
-                else if (op1.eval(true) != null) {  // if not null, op1 must be true -> shortcut evaluation to op2
+                } else if (op1.eval(true) != null) { // if not null, op1 must be
+                                                     // true -> shortcut
+                                                     // evaluation to op2
                     return op2.xPath();
-                }
-                else if (op2.eval(true) != null) {  // if not null, op2 must be true -> shortcut evaluation to op1
+                } else if (op2.eval(true) != null) { // if not null, op2 must be
+                                                     // true -> shortcut
+                                                     // evaluation to op1
                     return op1.xPath();
-                }
-                else {
+                } else {
                     return op1.xPath() + " and " + op2.xPath();
                 }
             }
+
             public Boolean eval(Boolean folderPredicateValuation) {
                 return and(op1.eval(folderPredicateValuation), op2.eval(folderPredicateValuation));
             }
@@ -103,17 +106,19 @@ public class EvaluatorXPath extends Eval
             public String xPath() {
                 if (eval(true) != null) {
                     return eval(true) ? "true()" : "false()";
-                }
-                else if (op1.eval(true) != null) {  // if not null, op1 must be false -> shortcut evaluation to op2
+                } else if (op1.eval(true) != null) { // if not null, op1 must be
+                                                     // false -> shortcut
+                                                     // evaluation to op2
                     return op2.xPath();
-                }
-                else if (op2.eval(true) != null) {  // if not null, op2 must be false -> shortcut evaluation to op2
+                } else if (op2.eval(true) != null) { // if not null, op2 must be
+                                                     // false -> shortcut
+                                                     // evaluation to op2
                     return op1.xPath();
-                }
-                else {
+                } else {
                     return "(" + op1.xPath() + " or " + op2.xPath() + ")";
                 }
             }
+
             public Boolean eval(Boolean folderPredicateValuation) {
                 return or(op1.eval(folderPredicateValuation), op2.eval(folderPredicateValuation));
             }
@@ -156,27 +161,27 @@ public class EvaluatorXPath extends Eval
 
     @Override
     public XPathBuilder in(XPathBuilder op1, XPathBuilder op2) {
-        return super.in(op1, op2);    // todo implement in
+        return super.in(op1, op2); // todo implement in
     }
 
     @Override
     public XPathBuilder notIn(XPathBuilder op1, XPathBuilder op2) {
-        return super.notIn(op1, op2);    // todo implement notIn
+        return super.notIn(op1, op2); // todo implement notIn
     }
 
     @Override
     public XPathBuilder inAny(XPathBuilder op1, XPathBuilder op2) {
-        return super.inAny(op1, op2);    // todo implement inAny
+        return super.inAny(op1, op2); // todo implement inAny
     }
 
     @Override
     public XPathBuilder notInAny(XPathBuilder op1, XPathBuilder op2) {
-        return super.notInAny(op1, op2);    // todo implement notInAny
+        return super.notInAny(op1, op2); // todo implement notInAny
     }
 
     @Override
     public XPathBuilder eqAny(XPathBuilder op1, XPathBuilder op2) {
-        return super.eqAny(op1, op2);    // todo implement eqAny
+        return super.eqAny(op1, op2); // todo implement eqAny
     }
 
     @Override
@@ -199,7 +204,7 @@ public class EvaluatorXPath extends Eval
         return new FunctionBuilder("jcr:like", op1, op2) {
             @Override
             public String xPath() {
-                return "not(" + super.xPath() + ")"; 
+                return "not(" + super.xPath() + ")";
             }
         };
     }
@@ -210,7 +215,7 @@ public class EvaluatorXPath extends Eval
     }
 
     @Override
-    public XPathBuilder inFolder(XPathBuilder op1,XPathBuilder op2) {
+    public XPathBuilder inFolder(XPathBuilder op1, XPathBuilder op2) {
         return new FolderPredicateBuilder(op2.xPath(), false);
     }
 
@@ -221,7 +226,7 @@ public class EvaluatorXPath extends Eval
 
     @Override
     public XPathBuilder list(List<XPathBuilder> ops) {
-        return super.list(ops);    // todo implement list
+        return super.list(ops); // todo implement list
     }
 
     @Override
@@ -279,7 +284,7 @@ public class EvaluatorXPath extends Eval
         return new TextPhraseBuilder(phrase);
     }
 
-    //------------------------------------------< protected >---
+    // ------------------------------------------< protected >---
 
     /**
      * Resolve from a CMIS object id to the corresponding absolute JCR path.
@@ -290,49 +295,50 @@ public class EvaluatorXPath extends Eval
     }
 
     /**
-     * Resolve from a column name in the query to the corresponding
-     * relative JCR path. The path must be relative to the context node.
-     * This default implementations simply returns <code>name</code>.
+     * Resolve from a column name in the query to the corresponding relative JCR
+     * path. The path must be relative to the context node. This default
+     * implementations simply returns <code>name</code>.
      */
     protected String jcrPathFromCol(String name) {
-        return name; 
+        return name;
     }
 
-    //------------------------------------------< private >---
+    // ------------------------------------------< private >---
 
     /**
-     * @return  <code>null</code> if <code>b</code> is <code>null</code>, <code>!b</code> otherwise.
+     * @return <code>null</code> if <code>b</code> is <code>null</code>,
+     *         <code>!b</code> otherwise.
      */
     private static Boolean not(Boolean b) {
         return b == null ? null : !b;
     }
 
     /**
-     * @return 
-     *  <ul><li><code>true</code> if either of <code>b1</code> and <code>b2</code> is <code>true</code>,</li>
-     *      <li><code>false</code> if both <code>b1</code> and <code>b2</code> are <code>false</code>,</li>
-     *      <li><code>null</code> otherwise.</li></ul>
+     * @return <ul>
+     *         <li><code>true</code> if either of <code>b1</code> and
+     *         <code>b2</code> is <code>true</code>,</li>
+     *         <li><code>false</code> if both <code>b1</code> and
+     *         <code>b2</code> are <code>false</code>,</li>
+     *         <li><code>null</code> otherwise.</li>
+     *         </ul>
      */
     private static Boolean or(Boolean b1, Boolean b2) {
-        return Boolean.TRUE.equals(b1) || Boolean.TRUE.equals(b2)
-                ? Boolean.TRUE
-                : Boolean.FALSE.equals(b1) && Boolean.FALSE.equals(b2)
-                        ? Boolean.FALSE
-                        : null;
+        return Boolean.TRUE.equals(b1) || Boolean.TRUE.equals(b2) ? Boolean.TRUE : Boolean.FALSE.equals(b1)
+                && Boolean.FALSE.equals(b2) ? Boolean.FALSE : null;
     }
 
     /**
-     * @return
-     *  <ul><li><code>false</code> if either of <code>b1</code> and <code>b2</code> is <code>false</code>,</li>
-     *      <li><code>true</code> if both <code>b1</code> and <code>b2</code> are <code>true</code>,</li>
-     *      <li><code>null</code> otherwise.</li></ul>
+     * @return <ul>
+     *         <li><code>false</code> if either of <code>b1</code> and
+     *         <code>b2</code> is <code>false</code>,</li>
+     *         <li><code>true</code> if both <code>b1</code> and <code>b2</code>
+     *         are <code>true</code>,</li>
+     *         <li><code>null</code> otherwise.</li>
+     *         </ul>
      */
     private static Boolean and(Boolean b1, Boolean b2) {
-        return Boolean.FALSE.equals(b1) || Boolean.FALSE.equals(b2)
-                ? Boolean.FALSE
-                : Boolean.TRUE.equals(b1) && Boolean.TRUE.equals(b2)
-                        ? Boolean.TRUE
-                        : null;
+        return Boolean.FALSE.equals(b1) || Boolean.FALSE.equals(b2) ? Boolean.FALSE : Boolean.TRUE.equals(b1)
+                && Boolean.TRUE.equals(b2) ? Boolean.TRUE : null;
     }
 
     private static class RelOpBuilder implements XPathBuilder {
@@ -362,7 +368,7 @@ public class EvaluatorXPath extends Eval
     private class FolderPredicateBuilder implements XPathBuilder {
         private final String folderId;
         private final boolean includeDescendants;
-        
+
         public FolderPredicateBuilder(String folderId, boolean includeDescendants) {
             this.folderId = stripQuotes(folderId);
             this.includeDescendants = includeDescendants;
@@ -381,9 +387,8 @@ public class EvaluatorXPath extends Eval
         }
 
         private String stripQuotes(String string) {
-            return (string.startsWith("'") || string.startsWith("\"")) && string.length() >= 2
-                    ? string.substring(1, string.length() - 1)
-                    : string;
+            return (string.startsWith("'") || string.startsWith("\"")) && string.length() >= 2 ? string.substring(1,
+                    string.length() - 1) : string;
         }
 
     }
@@ -398,7 +403,7 @@ public class EvaluatorXPath extends Eval
         }
     }
 
-    private static class LiteralBuilder extends PrimitiveBuilder  {
+    private static class LiteralBuilder extends PrimitiveBuilder {
         private final String xPath;
 
         public LiteralBuilder(String value) {
@@ -426,7 +431,7 @@ public class EvaluatorXPath extends Eval
         }
     }
 
-    private class ColRefBuilder extends PrimitiveBuilder  {
+    private class ColRefBuilder extends PrimitiveBuilder {
         private final String colRef;
 
         public ColRefBuilder(String colRef) {
@@ -434,7 +439,7 @@ public class EvaluatorXPath extends Eval
         }
 
         public String xPath() {
-            return jcrPathFromCol(colRef);   
+            return jcrPathFromCol(colRef);
         }
 
     }
@@ -459,9 +464,8 @@ public class EvaluatorXPath extends Eval
         }
 
         public String xPath() {
-            return function == null
-                ? op1.xPath()
-                : function + "(" + op1.xPath() + (op2 == null ? "" : ", " + op2.xPath()) + ")";
+            return function == null ? op1.xPath() : function + "(" + op1.xPath()
+                    + (op2 == null ? "" : ", " + op2.xPath()) + ")";
         }
     }
 
@@ -482,14 +486,14 @@ public class EvaluatorXPath extends Eval
         private final String relOp;
 
         public TextOpBuilder(List<XPathBuilder> ops, String relOp) {
-            this.ops = ops;   
+            this.ops = ops;
             this.relOp = relOp;
         }
 
         public String xPath() {
             StringBuilder sb = new StringBuilder();
             String sep = "";
-            for (XPathBuilder op: ops) {
+            for (XPathBuilder op : ops) {
                 sb.append(sep).append(op.xPath());
                 sep = relOp;
             }
@@ -497,7 +501,7 @@ public class EvaluatorXPath extends Eval
             return sb.toString();
         }
     }
-    
+
     private static class TextMinusBuilder extends PrimitiveBuilder {
         private final String text;
 
@@ -509,7 +513,7 @@ public class EvaluatorXPath extends Eval
             return "-" + escape(text);
         }
     }
-    
+
     private static class TextWordBuilder extends PrimitiveBuilder {
         private final String word;
 
@@ -535,9 +539,9 @@ public class EvaluatorXPath extends Eval
     }
 
     /**
-     * Within the searchexp literal instances of single quote ('), double quote (")
-     * and hyphen (-) must be escaped with a backslash (\). Backslash itself must
-     * therefore also be escaped, ending up as double backslash (\\).
+     * Within the searchexp literal instances of single quote ('), double quote
+     * (") and hyphen (-) must be escaped with a backslash (\). Backslash itself
+     * must therefore also be escaped, ending up as double backslash (\\).
      */
     private static String escape(String s) {
         if (s == null) {



Mime
View raw message