You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by sf...@apache.org on 2011/04/24 18:12:31 UTC

svn commit: r1096340 [2/7] - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/j...

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java Sun Apr 24 16:12:27 2011
@@ -48,6 +48,9 @@ import org.apache.chemistry.opencmis.com
  */
 public class RelationshipService {
 
+    private RelationshipService() {
+    }
+
     /**
      * Get object relationships.
      */
@@ -107,14 +110,12 @@ public class RelationshipService {
                 relationships.hasMoreItems(), AtomPubUtils.PAGE_SIZE);
 
         // write entries
-        if (relationships != null) {
-            AtomEntry entry = new AtomEntry(feed.getWriter());
-            for (ObjectData object : relationships.getObjects()) {
-                if (object == null) {
-                    continue;
-                }
-                writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false);
+        AtomEntry entry = new AtomEntry(feed.getWriter());
+        for (ObjectData object : relationships.getObjects()) {
+            if (object == null) {
+                continue;
             }
+            writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false);
         }
 
         // we are done

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java Sun Apr 24 16:12:27 2011
@@ -31,9 +31,9 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * Service document class.
- * 
+ *
  * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ *
  */
 public class ServiceDocument extends AtomDocumentBase {
 
@@ -62,7 +62,7 @@ public class ServiceDocument extends Ato
         getWriter().writeEndElement();
     }
 
-    public void writeRepositoryInfo(RepositoryInfo repInfo) throws XMLStreamException, JAXBException {
+    public void writeRepositoryInfo(RepositoryInfo repInfo) throws JAXBException {
         CmisRepositoryInfoType repInfoJaxb = convert(repInfo);
         if (repInfoJaxb == null) {
             return;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java Sun Apr 24 16:12:27 2011
@@ -45,6 +45,9 @@ import org.apache.chemistry.opencmis.com
  */
 public class VersioningService {
 
+    private VersioningService() {
+    }
+
     /**
      * Check Out.
      */
@@ -152,7 +155,7 @@ public class VersioningService {
      * Delete object.
      */
     public static void deleteAllVersions(CallContext context, CmisService service, String repositoryId,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
+            HttpServletRequest request, HttpServletResponse response) {
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java Sun Apr 24 16:12:27 2011
@@ -282,7 +282,7 @@ public class CmisBrowserBindingServlet e
     /**
      * Translates an exception in an appropriate HTTP error code.
      */
-    private int getErrorCode(CmisBaseException ex) {
+    private static int getErrorCode(CmisBaseException ex) {
         if (ex instanceof CmisConstraintException) {
             return 409;
         } else if (ex instanceof CmisContentAlreadyExistsException) {
@@ -316,7 +316,7 @@ public class CmisBrowserBindingServlet e
      * Prints the error as JSON.
      */
     @SuppressWarnings("unchecked")
-    private void printError(Exception ex, HttpServletRequest request, HttpServletResponse response, CallContext context) {
+    private static void printError(Exception ex, HttpServletRequest request, HttpServletResponse response, CallContext context) {
         int statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
         String exceptionName = "runtime";
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ControlParser.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ControlParser.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ControlParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ControlParser.java Sun Apr 24 16:12:27 2011
@@ -85,7 +85,7 @@ public class ControlParser {
         }
     }
 
-    private int getFirstIndex(String controlName) {
+    private static int getFirstIndex(String controlName) {
         int result = -1;
 
         int open = controlName.indexOf('[');
@@ -107,7 +107,7 @@ public class ControlParser {
         return result;
     }
 
-    private int getSecondIndex(String controlName) {
+    private static int getSecondIndex(String controlName) {
         int result = -1;
 
         int open = controlName.indexOf("][");
@@ -129,7 +129,7 @@ public class ControlParser {
         return result;
     }
 
-    private List<String> convertToList(String controlName, Map<Integer, String> map) {
+    private static List<String> convertToList(String controlName, Map<Integer, String> map) {
         if (map == null) {
             return null;
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.java Sun Apr 24 16:12:27 2011
@@ -42,6 +42,9 @@ import org.json.simple.JSONObject;
  */
 public class DiscoveryService {
 
+    private DiscoveryService() {
+    }
+
     /**
      * query.
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java Sun Apr 24 16:12:27 2011
@@ -46,6 +46,9 @@ import org.json.simple.JSONObject;
  */
 public final class NavigationService {
 
+    private NavigationService() {
+    }
+
     /**
      * getChildren.
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java Sun Apr 24 16:12:27 2011
@@ -51,6 +51,9 @@ public final class ObjectService {
 
     private static final int BUFFER_SIZE = 64 * 1024;
 
+    private ObjectService() {
+    }
+
     /**
      * createDocument.
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java Sun Apr 24 16:12:27 2011
@@ -47,6 +47,9 @@ import org.json.simple.JSONValue;
  */
 public final class RepositoryService {
 
+    private RepositoryService() {
+    }
+
     /**
      * getRepositories.
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java Sun Apr 24 16:12:27 2011
@@ -39,6 +39,9 @@ import org.json.simple.JSONArray;
  */
 public class VersioningService {
 
+    private VersioningService() {
+    }
+
     /**
      * getAllVersions.
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.java Sun Apr 24 16:12:27 2011
@@ -40,64 +40,75 @@ import org.apache.chemistry.opencmis.com
  */
 public class DummyService extends AbstractCmisService {
 
-	private final RepositoryInfoImpl fRepInfo;
+    private final RepositoryInfoImpl fRepInfo;
 
-	public DummyService(String id, String name) {
-		fRepInfo = new RepositoryInfoImpl();
+    public DummyService(String id, String name) {
+        fRepInfo = new RepositoryInfoImpl();
 
-		fRepInfo.setId(id);
-		fRepInfo.setName(name);
-		fRepInfo.setDescription(name);
-		fRepInfo.setCmisVersionSupported("1.0");
-		fRepInfo.setRootFolder("root");
-
-		fRepInfo.setVendorName("OpenCMIS");
-		fRepInfo.setProductName("OpenCMIS Server");
-		fRepInfo.setProductVersion("1.0");
-	}
-
-	public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
-		if (!fRepInfo.getId().equals(repositoryId)) {
-			throw new CmisObjectNotFoundException("A repository with repository id '" + repositoryId
-					+ "' does not exist!");
-		}
-
-		return fRepInfo;
-	}
-
-	public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
-		return Collections.singletonList((RepositoryInfo) fRepInfo);
-	}
-
-	@Override
-	public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
-			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-		throw new CmisNotSupportedException();
-	}
-
-	@Override
-	public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
-			IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
-			Boolean includeAcl, ExtensionsData extension) {
-		throw new CmisNotSupportedException();
-	}
-
-	@Override
-	public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
-			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			Boolean includeRelativePathSegment, ExtensionsData extension) {
-		throw new CmisNotSupportedException();
-	}
-
-	@Override
-	public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
-			BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-		throw new CmisNotSupportedException();
-	}
-
-	@Override
-	public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
-		throw new CmisNotSupportedException();
-	}
+        fRepInfo.setId(id);
+        fRepInfo.setName(name);
+        fRepInfo.setDescription(name);
+        fRepInfo.setCmisVersionSupported("1.0");
+        fRepInfo.setRootFolder("root");
+
+        fRepInfo.setVendorName("OpenCMIS");
+        fRepInfo.setProductName("OpenCMIS Server");
+        fRepInfo.setProductVersion("1.0");
+    }
+
+    @Override
+    public RepositoryInfo getRepositoryInfo(String repositoryId,
+            ExtensionsData extension) {
+        if (!fRepInfo.getId().equals(repositoryId)) {
+            throw new CmisObjectNotFoundException(
+                    "A repository with repository id '" + repositoryId
+                            + "' does not exist!");
+        }
+
+        return fRepInfo;
+    }
+
+    @Override
+    public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
+        return Collections.singletonList((RepositoryInfo) fRepInfo);
+    }
+
+    @Override
+    public ObjectInFolderList getChildren(String repositoryId, String folderId,
+            String filter, String orderBy, Boolean includeAllowableActions,
+            IncludeRelationships includeRelationships, String renditionFilter,
+            Boolean includePathSegment, BigInteger maxItems,
+            BigInteger skipCount, ExtensionsData extension) {
+        throw new CmisNotSupportedException();
+    }
+
+    @Override
+    public ObjectData getObject(String repositoryId, String objectId,
+            String filter, Boolean includeAllowableActions,
+            IncludeRelationships includeRelationships, String renditionFilter,
+            Boolean includePolicyIds, Boolean includeAcl,
+            ExtensionsData extension) {
+        throw new CmisNotSupportedException();
+    }
+
+    @Override
+    public List<ObjectParentData> getObjectParents(String repositoryId,
+            String objectId, String filter, Boolean includeAllowableActions,
+            IncludeRelationships includeRelationships, String renditionFilter,
+            Boolean includeRelativePathSegment, ExtensionsData extension) {
+        throw new CmisNotSupportedException();
+    }
+
+    @Override
+    public TypeDefinitionList getTypeChildren(String repositoryId,
+            String typeId, Boolean includePropertyDefinitions,
+            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+        throw new CmisNotSupportedException();
+    }
+
+    @Override
+    public TypeDefinition getTypeDefinition(String repositoryId, String typeId,
+            ExtensionsData extension) {
+        throw new CmisNotSupportedException();
+    }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/Dispatcher.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/Dispatcher.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/Dispatcher.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/Dispatcher.java Sun Apr 24 16:12:27 2011
@@ -67,7 +67,7 @@ public class Dispatcher implements Seria
 
     /**
      * Find the appropriate method an call it.
-     * 
+     *
      * @return <code>true</code> if the method was found, <code>false</code>
      *         otherwise.
      */
@@ -84,8 +84,6 @@ public class Dispatcher implements Seria
 
         try {
             m.invoke(null, context, service, repositoryId, request, response);
-        } catch (IllegalArgumentException e) {
-            throw e;
         } catch (IllegalAccessException e) {
             throw new CmisRuntimeException("Internal error!", e);
         } catch (InvocationTargetException e) {
@@ -102,7 +100,7 @@ public class Dispatcher implements Seria
     /**
      * Generates a map key from a resource and an HTTP method.
      */
-    private String getKey(String resource, String httpMethod) {
+    private static String getKey(String resource, String httpMethod) {
         return resource + "/" + httpMethod;
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java Sun Apr 24 16:12:27 2011
@@ -35,6 +35,9 @@ import org.apache.chemistry.opencmis.ser
  */
 public class HttpUtils {
 
+    private HttpUtils() {
+    }
+
     /**
      * Creates a {@link CallContext} object from a servlet request.
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/AtomEntryParserTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/AtomEntryParserTest.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/AtomEntryParserTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/AtomEntryParserTest.java Sun Apr 24 16:12:27 2011
@@ -205,7 +205,7 @@ public class AtomEntryParserTest {
         assertNull(aep.getProperties());
     }
 
-    private byte[] parse(byte[] entry) throws Exception {
+    private static byte[] parse(byte[] entry) throws Exception {
         AtomEntryParser aep = new AtomEntryParser(new ByteArrayInputStream(entry));
         ContentStream contentStream = aep.getContentStream();
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java Sun Apr 24 16:12:27 2011
@@ -160,7 +160,7 @@ public class FileShareRepository {
 
     /**
      * Constructor.
-     * 
+     *
      * @param repId
      *            CMIS repository id
      * @param root
@@ -267,7 +267,7 @@ public class FileShareRepository {
         fRepositoryInfo.setAclCapabilities(aclCapability);
     }
 
-    private PermissionDefinition createPermission(String permission, String description) {
+    private static PermissionDefinition createPermission(String permission, String description) {
         PermissionDefinitionDataImpl pd = new PermissionDefinitionDataImpl();
         pd.setPermission(permission);
         pd.setDescription(description);
@@ -275,7 +275,7 @@ public class FileShareRepository {
         return pd;
     }
 
-    private PermissionMapping createMapping(String key, String permission) {
+    private static PermissionMapping createMapping(String key, String permission) {
         PermissionMappingDataImpl pm = new PermissionMappingDataImpl();
         pm.setKey(key);
         pm.setPermissions(Collections.singletonList(permission));
@@ -1202,7 +1202,7 @@ public class FileShareRepository {
 
     /**
      * Removes a folder and its content.
-     * 
+     *
      * @throws
      */
     private boolean deleteFolder(File folder, boolean continueOnFailure, FailedToDeleteDataImpl ftd) {
@@ -1237,14 +1237,14 @@ public class FileShareRepository {
 
     /**
      * Checks if the given name is valid for a file system.
-     * 
+     *
      * @param name
      *            the name to check
-     * 
+     *
      * @return <code>true</code> if the name is valid, <code>false</code>
      *         otherwise
      */
-    private boolean isValidName(String name) {
+    private static boolean isValidName(String name) {
         if ((name == null) || (name.length() == 0) || (name.indexOf(File.separatorChar) != -1)
                 || (name.indexOf(File.pathSeparatorChar) != -1)) {
             return false;
@@ -1256,13 +1256,13 @@ public class FileShareRepository {
     /**
      * Checks if a folder is empty. A folder is considered as empty if no files
      * or only the shadow file reside in the folder.
-     * 
+     *
      * @param folder
      *            the folder
-     * 
+     *
      * @return <code>true</code> if the folder is empty.
      */
-    private boolean isFolderEmpty(File folder) {
+    private static boolean isFolderEmpty(File folder) {
         if (!folder.isDirectory()) {
             return true;
         }
@@ -1653,7 +1653,7 @@ public class FileShareRepository {
         return result;
     }
 
-    private boolean isEmptyProperty(PropertyData<?> prop) {
+    private static boolean isEmptyProperty(PropertyData<?> prop) {
         if ((prop == null) || (prop.getValues() == null)) {
             return true;
         }
@@ -1740,7 +1740,7 @@ public class FileShareRepository {
      * Adds the default value of property if defined.
      */
     @SuppressWarnings("unchecked")
-    private boolean addPropertyDefault(PropertiesImpl props, PropertyDefinition<?> propDef) {
+    private static boolean addPropertyDefault(PropertiesImpl props, PropertyDefinition<?> propDef) {
         if ((props == null) || (props.getProperties() == null)) {
             throw new IllegalArgumentException("Props must not be null!");
         }
@@ -1833,7 +1833,7 @@ public class FileShareRepository {
         return result;
     }
 
-    private void addAction(Set<Action> aas, Action action, boolean condition) {
+    private static void addAction(Set<Action> aas, Action action, boolean condition) {
         if (condition) {
             aas.add(action);
         }
@@ -1873,7 +1873,7 @@ public class FileShareRepository {
     /**
      * Writes the properties for a document or folder.
      */
-    private void writePropertiesFile(File file, Properties properties) {
+    private static void writePropertiesFile(File file, Properties properties) {
         File propFile = getPropertiesFile(file);
 
         // if no properties set delete the properties file
@@ -1904,7 +1904,7 @@ public class FileShareRepository {
     /**
      * Converts milliseconds into a calendar object.
      */
-    private GregorianCalendar millisToCalendar(long millis) {
+    private static GregorianCalendar millisToCalendar(long millis) {
         GregorianCalendar result = new GregorianCalendar();
         result.setTimeZone(TimeZone.getTimeZone("GMT"));
         result.setTimeInMillis(millis);
@@ -1917,7 +1917,7 @@ public class FileShareRepository {
      * <code>filter</code> is <code>null</code>, empty or one of the properties
      * is '*' , an empty collection will be returned.
      */
-    private Set<String> splitFilter(String filter) {
+    private static Set<String> splitFilter(String filter) {
         if (filter == null) {
             return null;
         }
@@ -1948,7 +1948,7 @@ public class FileShareRepository {
     /**
      * Gets the type id from a set of properties.
      */
-    private String getTypeId(Properties properties) {
+    private static String getTypeId(Properties properties) {
         PropertyData<?> typeProperty = properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID);
         if (!(typeProperty instanceof PropertyId)) {
             throw new CmisInvalidArgumentException("Type id must be set!");
@@ -1965,7 +1965,7 @@ public class FileShareRepository {
     /**
      * Returns the first value of an id property.
      */
-    private String getIdProperty(Properties properties, String name) {
+    private static String getIdProperty(Properties properties, String name) {
         PropertyData<?> property = properties.getProperties().get(name);
         if (!(property instanceof PropertyId)) {
             return null;
@@ -1977,7 +1977,7 @@ public class FileShareRepository {
     /**
      * Returns the first value of an string property.
      */
-    private String getStringProperty(Properties properties, String name) {
+    private static String getStringProperty(Properties properties, String name) {
         PropertyData<?> property = properties.getProperties().get(name);
         if (!(property instanceof PropertyString)) {
             return null;
@@ -1989,7 +1989,7 @@ public class FileShareRepository {
     /**
      * Returns the first value of an datetime property.
      */
-    private GregorianCalendar getDateTimeProperty(Properties properties, String name) {
+    private static GregorianCalendar getDateTimeProperty(Properties properties, String name) {
         PropertyData<?> property = properties.getProperties().get(name);
         if (!(property instanceof PropertyDateTime)) {
             return null;
@@ -2022,7 +2022,7 @@ public class FileShareRepository {
     /**
      * Returns the properties file of the given file.
      */
-    private File getPropertiesFile(File file) {
+    private static File getPropertiesFile(File file) {
         if (file.isDirectory()) {
             return new File(file, SHADOW_FOLDER);
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java Sun Apr 24 16:12:27 2011
@@ -163,7 +163,7 @@ public class FileShareServiceFactory ext
         }
     }
 
-    private List<String> split(String csl) {
+    private static List<String> split(String csl) {
         if (csl == null) {
             return Collections.emptyList();
         }
@@ -176,7 +176,7 @@ public class FileShareServiceFactory ext
         return result;
     }
 
-    private String replaceSystemProperties(String s) {
+    private static String replaceSystemProperties(String s) {
         if (s == null) {
             return null;
         }
@@ -212,7 +212,7 @@ public class FileShareServiceFactory ext
     }
 
     @SuppressWarnings("unchecked")
-    private TypeDefinition loadType(String filename) {
+    private static TypeDefinition loadType(String filename) {
         TypeDefinition result = null;
 
         try {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/TypeManager.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/TypeManager.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/TypeManager.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/TypeManager.java Sun Apr 24 16:12:27 2011
@@ -177,7 +177,7 @@ public class TypeManager {
         // addTypeInteral(policyType);
     }
 
-    private void addBasePropertyDefinitions(AbstractTypeDefinition type) {
+    private static void addBasePropertyDefinitions(AbstractTypeDefinition type) {
         type.addPropertyDefinition(createPropDef(PropertyIds.BASE_TYPE_ID, "Base Type Id", "Base Type Id",
                 PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));
 
@@ -207,7 +207,7 @@ public class TypeManager {
                 PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
     }
 
-    private void addFolderPropertyDefinitions(FolderTypeDefinitionImpl type) {
+    private static void addFolderPropertyDefinitions(FolderTypeDefinitionImpl type) {
         type.addPropertyDefinition(createPropDef(PropertyIds.PARENT_ID, "Parent Id", "Parent Id", PropertyType.ID,
                 Cardinality.SINGLE, Updatability.READONLY, false, false));
 
@@ -219,7 +219,7 @@ public class TypeManager {
                 Cardinality.SINGLE, Updatability.READONLY, false, false));
     }
 
-    private void addDocumentPropertyDefinitions(DocumentTypeDefinitionImpl type) {
+    private static void addDocumentPropertyDefinitions(DocumentTypeDefinitionImpl type) {
         type.addPropertyDefinition(createPropDef(PropertyIds.IS_IMMUTABLE, "Is Immutable", "Is Immutable",
                 PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false, false));
 
@@ -267,7 +267,7 @@ public class TypeManager {
     /**
      * Creates a property definition object.
      */
-    private PropertyDefinition<?> createPropDef(String id, String displayName, String description,
+    private static PropertyDefinition<?> createPropDef(String id, String displayName, String description,
             PropertyType datatype, Cardinality cardinality, Updatability updateability, boolean inherited,
             boolean required) {
         AbstractPropertyDefinition<?> result = null;
@@ -535,7 +535,7 @@ public class TypeManager {
         return copyTypeDefintion(tc.getTypeDefinition());
     }
 
-    private TypeDefinition copyTypeDefintion(TypeDefinition type) {
+    private static TypeDefinition copyTypeDefintion(TypeDefinition type) {
         return Converter.convert(Converter.convert(type));
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigurationSettings.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigurationSettings.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigurationSettings.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigurationSettings.java Sun Apr 24 16:12:27 2011
@@ -28,13 +28,13 @@ public class ConfigurationSettings {
     private static final Log LOG = LogFactory.getLog(ConfigurationSettings.class.getName());
 
     private static ConfigurationSettings singleInstance;
-    
+
     final Map<String, String> parameters;
-    
+
     private ConfigurationSettings(Map<String, String> parameters) {
         this.parameters = parameters;
     }
-    
+
     private String getConfigurationValueIntern(String key) {
         return parameters.get(key);
     }
@@ -46,20 +46,21 @@ public class ConfigurationSettings {
         }
         return singleInstance.getConfigurationValueIntern(key);
     }
-    
+
     public static Long getConfigurationValueAsLong(String key) {
         String str = getConfigurationValueAsString(key);
-        if (null != str)
+        if (null != str) {
             return Long.valueOf(str);
-        else
+        } else {
             return null;
+        }
     }
-    
+
     public static void init(Map<String, String> parameters) {
-        singleInstance = new ConfigurationSettings(parameters);        
+        singleInstance = new ConfigurationSettings(parameters);
     }
-    
+
     public static Map<String, String> getParameters() {
-        return singleInstance.parameters;        
+        return singleInstance.parameters;
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/FilterParser.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/FilterParser.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/FilterParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/FilterParser.java Sun Apr 24 16:12:27 2011
@@ -36,27 +36,29 @@ public class FilterParser {
     }
 
     public static boolean isContainedInFilter(String propertyId, List<String> requestedIds) {
-        if (requestedIds.contains("*"))
+        if (requestedIds.contains("*")) {
             return true;
+        }
         return requestedIds.contains(propertyId);
     }
 
     public static List<String> getRequestedIdsFromFilter(String filter) {
-        if (filter == null || filter.length() == 0)
+        if (filter == null || filter.length() == 0) {
             return Collections.singletonList("*");
-        else {
+        } else {
             List<String> requestedIds = Arrays.asList(filter.split(",\\s*")); // comma
             // plus
             // whitespace
-            
+
             // add object id because this is always needed in AtomPub binding:
             if (!(requestedIds.contains(PropertyIds.OBJECT_ID))) {
                 requestedIds = new ArrayList<String>(requestedIds); // copy immutable list
                 requestedIds.add(PropertyIds.OBJECT_ID);
             }
-            
-            if (requestedIds.contains("*"))
+
+            if (requestedIds.contains("*")) {
                 requestedIds = Collections.singletonList("*");
+            }
             return requestedIds;
         }
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java Sun Apr 24 16:12:27 2011
@@ -31,22 +31,25 @@ public class NameValidator {
     /**
      * check whether id contains only valid characters Allowed are 'a'..'z',
      * 'A'..'Z', '0'..'9', '.', '-', ' ', '_';
-     * 
+     *
      * @param s
      *            string to verify
      */
     public static boolean isValidId(String s) {
-        if (null == s || s.length() == 0)
+        if (null == s || s.length() == 0) {
             return false;
-        
-        if (s.startsWith("cmis:"))
+        }
+
+        if (s.startsWith("cmis:")) {
             s = s.substring(5);
+        }
 
         for (int i = 0; i < s.length(); i++) {
             char c = s.charAt(i);
             if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '-'
-                    || c == '_' || c == ' '))
+                    || c == '_' || c == ' ')) {
                 return false;
+            }
         }
         return true;
     }
@@ -58,7 +61,7 @@ public class NameValidator {
     /**
      * check whether id contains only valid characters Allowed are 'a'..'z',
      * 'A'..'Z', '0'..'9', '.', '-', ' ', '_';
-     * 
+     *
      * @param s
      *            string to verify
      */
@@ -66,8 +69,9 @@ public class NameValidator {
         for (int i = 0; i < s.length(); i++) {
             char c = s.charAt(i);
             if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '-'
-                    || c == '_' || c == ' '))
+                    || c == '_' || c == ' ')) {
                 return false;
+            }
         }
         return true;
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java Sun Apr 24 16:12:27 2011
@@ -42,9 +42,9 @@ import org.apache.chemistry.opencmis.ser
 /**
  * Class that manages a type system for a repository types can be added, the
  * inheritance can be managed and type can be retrieved for a given type id.
- * 
+ *
  * @author Jens
- * 
+ *
  */
 public class TypeManagerImpl implements TypeManager {
 
@@ -65,8 +65,9 @@ public class TypeManagerImpl implements 
      */
     public TypeDefinition getTypeByQueryName(String typeQueryName) {
         for (Entry<String, TypeDefinitionContainer> entry : fTypesMap.entrySet()) {
-            if (entry.getValue().getTypeDefinition().getQueryName().equals(typeQueryName))
+            if (entry.getValue().getTypeDefinition().getQueryName().equals(typeQueryName)) {
                 return entry.getValue().getTypeDefinition();
+            }
         }
         return null;
     }
@@ -79,8 +80,9 @@ public class TypeManagerImpl implements 
         List<TypeDefinitionContainer> typeRoots = new ArrayList<TypeDefinitionContainer>();
         // iterate types map and return a list collecting the root types:
         for (TypeDefinitionContainer typeDef : fTypesMap.values()) {
-            if (typeDef.getTypeDefinition().getParentTypeId() == null)
+            if (typeDef.getTypeDefinition().getParentTypeId() == null) {
                 typeRoots.add(typeDef);
+            }
         }
 
         return typeRoots;
@@ -93,9 +95,11 @@ public class TypeManagerImpl implements 
         // just take first repository
         List<TypeDefinitionContainer> rootTypes = new ArrayList<TypeDefinitionContainer>();
 
-        for (TypeDefinitionContainer type : fTypesMap.values())
-            if (isRootType(type))
+        for (TypeDefinitionContainer type : fTypesMap.values()) {
+            if (isRootType(type)) {
                 rootTypes.add(type);
+            }
+        }
 
         return rootTypes;
     }
@@ -104,10 +108,10 @@ public class TypeManagerImpl implements 
      * Initialize the type system with the given types. This list must not
      * contain the CMIS default types. The default type are always contained by
      * default.
-     * 
+     *
      * @param typesList
      *            list of types to add to the repository
-     * 
+     *
      */
     public void initTypeSystem(List<TypeDefinition> typesList) {
 
@@ -117,8 +121,9 @@ public class TypeManagerImpl implements 
         // children
         // and property lists
         if (null != typesList) {
-            for (TypeDefinition typeDef : typesList)
+            for (TypeDefinition typeDef : typesList) {
                 addTypeDefinition(typeDef);
+            }
         }
 
     }
@@ -126,22 +131,24 @@ public class TypeManagerImpl implements 
     /**
      * Add a type to the type system. Add all properties from inherited types,
      * add type to children of parent types.
-     * 
+     *
      * @param repositoryId
      *            repository to which the type is added
      * @param cmisType
      *            new type to add
      */
     public void addTypeDefinition(TypeDefinition cmisType) {
-        if (fTypesMap.containsKey(cmisType.getId()))
+        if (fTypesMap.containsKey(cmisType.getId())) {
             throw new RuntimeException("You cannot add type with id " + cmisType.getId()
                     + " because it already exists.");
+        }
 
         TypeDefinitionContainerImpl typeContainer = new TypeDefinitionContainerImpl(cmisType);
 
-        if (!fTypesMap.containsKey(cmisType.getParentTypeId()))
+        if (!fTypesMap.containsKey(cmisType.getParentTypeId())) {
             throw new RuntimeException("Cannot add type, because parent with id " + cmisType.getParentTypeId()
                     + " does not exist.");
+        }
 
         // add new type to children of parent types
         TypeDefinitionContainer parentTypeContainer = fTypesMap.get(cmisType.getParentTypeId());
@@ -159,40 +166,44 @@ public class TypeManagerImpl implements 
      * Remove all types from the type system. After this call only the default
      * CMIS types are present in the type system. Use this method with care, its
      * mainly intended for unit tests
-     * 
+     *
      * @param repositoryId
      */
     public void clearTypeSystem() {
         fTypesMap.clear();
         createCmisDefaultTypes();
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.chemistry.opencmis.inmemory.TypeManager#getPropertyIdForQueryName(org.apache.chemistry.opencmis.commons.definitions.TypeDefinition, java.lang.String)
      */
     public String getPropertyIdForQueryName(TypeDefinition typeDefinition, String propQueryName) {
         for (PropertyDefinition<?> pd : typeDefinition.getPropertyDefinitions().values()) {
-            if (pd.getQueryName().equals(propQueryName))
+            if (pd.getQueryName().equals(propQueryName)) {
                 return pd.getId();
+            }
         }
         return null;
     }
 
     private void addInheritedProperties(Map<String, PropertyDefinition<?>> propDefs, TypeDefinition typeDefinition) {
 
-        if (null == typeDefinition)
+        if (null == typeDefinition) {
             return;
+        }
 
         if (null != typeDefinition.getPropertyDefinitions())
+         {
             addInheritedPropertyDefinitions(propDefs, typeDefinition.getPropertyDefinitions());
         // propDefs.putAll(typeDefinition.getPropertyDefinitions());
+        }
 
         TypeDefinitionContainer parentTypeContainer = fTypesMap.get(typeDefinition.getParentTypeId());
         TypeDefinition parentType = (null == parentTypeContainer ? null : parentTypeContainer.getTypeDefinition());
         addInheritedProperties(propDefs, parentType);
     }
 
-    private void addInheritedPropertyDefinitions(Map<String, PropertyDefinition<?>> propDefs,
+    private static void addInheritedPropertyDefinitions(Map<String, PropertyDefinition<?>> propDefs,
             Map<String, PropertyDefinition<?>> superPropDefs) {
 
         for (Entry<String, PropertyDefinition<?>> superProp : superPropDefs.entrySet()) {
@@ -215,10 +226,11 @@ public class TypeManagerImpl implements 
         if (c.getTypeDefinition().equals(InMemoryFolderTypeDefinition.getRootFolderType())
                 || c.getTypeDefinition().equals(InMemoryDocumentTypeDefinition.getRootDocumentType())
                 || c.getTypeDefinition().equals(InMemoryRelationshipTypeDefinition.getRootRelationshipType())
-                || c.getTypeDefinition().equals(InMemoryPolicyTypeDefinition.getRootPolicyType()))
+                || c.getTypeDefinition().equals(InMemoryPolicyTypeDefinition.getRootPolicyType())) {
             return true;
-        else
+        } else {
             return false;
+        }
     }
 
     private static PropertyDefinition<?> clonePropertyDefinition(PropertyDefinition<?> src) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java Sun Apr 24 16:12:27 2011
@@ -115,20 +115,26 @@ public class InMemoryQueryProcessor {
         ObjectListImpl res = new ObjectListImpl();
         res.setNumItems(BigInteger.valueOf(matches.size()));
         int start = 0;
-        if (skipCount != null)
+        if (skipCount != null) {
             start = (int) skipCount.longValue();
-        if (start < 0)
+        }
+        if (start < 0) {
             start = 0;
-        if (start > matches.size())
+        }
+        if (start > matches.size()) {
             start = matches.size();
+        }
         int stop = 0;
-        if (maxItems != null)
+        if (maxItems != null) {
             stop = start + (int) maxItems.longValue();
-        if (stop <= 0 || stop > matches.size())
+        }
+        if (stop <= 0 || stop > matches.size()) {
             stop = matches.size();
+        }
         res.setHasMoreItems(stop < matches.size());
-        if (start > 0 || stop > 0)
+        if (start > 0 || stop > 0) {
             matches = matches.subList(start, stop);
+        }
         List<ObjectData> objDataList = new ArrayList<ObjectData>();
         Map<String, String> props = queryObj.getRequestedProperties();
         Map<String, String> funcs = queryObj.getRequestedFuncs();
@@ -158,8 +164,9 @@ public class InMemoryQueryProcessor {
 
     private void sortMatches() {
         final List<SortSpec> orderBy = queryObj.getOrderBys();
-        if (orderBy.size() > 1)
+        if (orderBy.size() > 1) {
             LOG.warn("ORDER BY has more than one sort criterium, all but the first are ignored.");
+        }
         class ResultComparator implements Comparator<StoredObject> {
 
             @SuppressWarnings("unchecked")
@@ -172,27 +179,30 @@ public class InMemoryQueryProcessor {
                     String propId = ((ColumnReference) sel).getPropertyId();
                     Object propVal1 = so1.getProperties().get(propId).getFirstValue();
                     Object propVal2 = so2.getProperties().get(propId).getFirstValue();
-                    if (propVal1 == null && propVal2 == null)
+                    if (propVal1 == null && propVal2 == null) {
                         result = 0;
-                    else if (propVal1 == null)
+                    } else if (propVal1 == null) {
                         result = -1;
-                    else if (propVal2 == null)
+                    } else if (propVal2 == null) {
                         result = 1;
-                    else
+                    } else {
                         result = ((Comparable<Object>) propVal1).compareTo(propVal2);
+                    }
                 } else {
                     // String funcName = ((FunctionReference) sel).getName();
                     // evaluate function here, currently ignore
                     result = 0;
                 }
-                if (!s.isAscending())
+                if (!s.isAscending()) {
                     result = -result;
+                }
                 return result;
             }
         }
 
-        if (orderBy.size() > 0)
+        if (orderBy.size() > 0) {
             Collections.sort(matches, new ResultComparator());
+        }
 
     }
 
@@ -200,7 +210,7 @@ public class InMemoryQueryProcessor {
      * Check for each object contained in the in-memory repository if it matches
      * the current query expression. If yes add it to the list of matched
      * objects.
-     * 
+     *
      * @param so
      *            object stored in the in-memory repository
      */
@@ -222,26 +232,31 @@ public class InMemoryQueryProcessor {
                                                         // series
         boolean typeMatches = typeMatches(td, so);
         if (!searchAllVersions && so instanceof DocumentVersion
-                && ((DocumentVersion) so).getParentDocument().getLatestVersion(false) != so)
+                && ((DocumentVersion) so).getParentDocument().getLatestVersion(false) != so) {
             skip = true;
+        }
         // ... then check expression...
-        if (typeMatches && !skip)
+        if (typeMatches && !skip) {
             evalWhereTree(whereTree, so);
+        }
     }
 
     private void evalWhereTree(Tree node, StoredObject so) {
         boolean match = true;
-        if (null != node)
+        if (null != node) {
             match = evalWhereNode(so, node);
+        }
         if (match)
+         {
             matches.add(so); // add to list
+        }
     }
 
     /**
      * For each object check if it matches and append it to match-list if it
      * does. We do here our own walking mechanism so that we can pass additional
      * parameters and define the return types.
-     * 
+     *
      * @param node
      *            node in where clause
      * @return true if it matches, false if it not matches
@@ -320,11 +335,11 @@ public class InMemoryQueryProcessor {
             PropertyDefinition<?> pd = colRef.getPropertyDefinition();
             PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
             List<Object> literals = onLiteralList(listNode);
-            if (pd.getCardinality() != Cardinality.SINGLE)
+            if (pd.getCardinality() != Cardinality.SINGLE) {
                 throw new IllegalStateException("Operator IN only is allowed on single-value properties ");
-            else if (lVal == null)
+            } else if (lVal == null) {
                 return false;
-            else {
+            } else {
                 Object prop = lVal.getFirstValue();
                 return literals.contains(prop);
             }
@@ -339,11 +354,11 @@ public class InMemoryQueryProcessor {
             PropertyDefinition<?> pd = colRef.getPropertyDefinition();
             PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
             List<Object> literals = onLiteralList(listNode);
-            if (pd.getCardinality() != Cardinality.SINGLE)
+            if (pd.getCardinality() != Cardinality.SINGLE) {
                 throw new IllegalStateException("Operator IN only is allowed on single-value properties ");
-            else if (lVal == null)
+            } else if (lVal == null) {
                 return false;
-            else {
+            } else {
                 Object prop = lVal.getFirstValue();
                 return !literals.contains(prop);
             }
@@ -355,16 +370,17 @@ public class InMemoryQueryProcessor {
             PropertyDefinition<?> pd = colRef.getPropertyDefinition();
             PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
             List<Object> literals = onLiteralList(listNode);
-            if (pd.getCardinality() != Cardinality.MULTI)
+            if (pd.getCardinality() != Cardinality.MULTI) {
                 throw new IllegalStateException("Operator ANY...IN only is allowed on multi-value properties ");
-            else if (lVal == null)
+            } else if (lVal == null) {
                 return false;
-            else {
+            } else {
                 List<?> props = lVal.getValues();
                 for (Object prop : props) {
                     LOG.debug("comparing with: " + prop);
-                    if (literals.contains(prop))
+                    if (literals.contains(prop)) {
                         return true;
+                    }
                 }
                 return false;
             }
@@ -379,16 +395,17 @@ public class InMemoryQueryProcessor {
             PropertyDefinition<?> pd = colRef.getPropertyDefinition();
             PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
             List<Object> literals = onLiteralList(listNode);
-            if (pd.getCardinality() != Cardinality.MULTI)
+            if (pd.getCardinality() != Cardinality.MULTI) {
                 throw new IllegalStateException("Operator ANY...IN only is allowed on multi-value properties ");
-            else if (lVal == null)
+            } else if (lVal == null) {
                 return false;
-            else {
+            } else {
                 List<?> props = lVal.getValues();
                 for (Object prop : props) {
                     LOG.debug("comparing with: " + prop);
-                    if (literals.contains(prop))
+                    if (literals.contains(prop)) {
                         return false;
+                    }
                 }
                 return true;
             }
@@ -400,11 +417,11 @@ public class InMemoryQueryProcessor {
             PropertyDefinition<?> pd = colRef.getPropertyDefinition();
             PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
             Object literal = walkExpr(literalNode);
-            if (pd.getCardinality() != Cardinality.MULTI)
+            if (pd.getCardinality() != Cardinality.MULTI) {
                 throw new IllegalStateException("Operator = ANY only is allowed on multi-value properties ");
-            else if (lVal == null)
+            } else if (lVal == null) {
                 return false;
-            else {
+            } else {
                 List<?> props = lVal.getValues();
                 return props.contains(literal);
             }
@@ -425,17 +442,20 @@ public class InMemoryQueryProcessor {
         @Override
         public Boolean walkLike(Tree opNode, Tree colNode, Tree stringNode) {
             Object rVal = walkExpr(stringNode);
-            if (!(rVal instanceof String))
+            if (!(rVal instanceof String)) {
                 throw new IllegalStateException("LIKE operator requires String literal on right hand side.");
+            }
 
             ColumnReference colRef = getColumnReference(colNode);
             PropertyDefinition<?> pd = colRef.getPropertyDefinition();
             PropertyType propType = pd.getPropertyType();
             if (propType != PropertyType.STRING && propType != PropertyType.HTML && propType != PropertyType.ID
-                    && propType != PropertyType.URI)
+                    && propType != PropertyType.URI) {
                 throw new IllegalStateException("Property type " + propType.value() + " is not allowed FOR LIKE");
-            if (pd.getCardinality() != Cardinality.SINGLE)
+            }
+            if (pd.getCardinality() != Cardinality.SINGLE) {
                 throw new IllegalStateException("LIKE is not allowed for multi-value properties ");
+            }
 
             String propVal = (String) so.getProperties().get(colRef.getPropertyId()).getFirstValue();
             String pattern = translatePattern((String) rVal); // SQL to Java
@@ -463,15 +483,17 @@ public class InMemoryQueryProcessor {
                 // only one from without join support
             }
             Object lit = walkExpr(paramNode);
-            if (!(lit instanceof String))
+            if (!(lit instanceof String)) {
                 throw new IllegalStateException("Folder id in IN_FOLDER must be of type String");
+            }
             String folderId = (String) lit;
 
             // check if object is in folder
-            if (so instanceof Filing)
+            if (so instanceof Filing) {
                 return hasParent((Filing) so, folderId);
-            else
+            } else {
                 return false;
+            }
         }
 
         @Override
@@ -482,15 +504,17 @@ public class InMemoryQueryProcessor {
                 // only one from without join support
             }
             Object lit = walkExpr(paramNode);
-            if (!(lit instanceof String))
+            if (!(lit instanceof String)) {
                 throw new IllegalStateException("Folder id in IN_FOLDER must be of type String");
+            }
             String folderId = (String) lit;
 
             // check if object is in folder
-            if (so instanceof Filing)
+            if (so instanceof Filing) {
                 return hasAncestor((Filing) so, folderId);
-            else
+            } else {
                 return false;
+            }
         }
 
         protected Integer compareTo(Tree leftChild, Tree rightChild) {
@@ -501,10 +525,11 @@ public class InMemoryQueryProcessor {
             ColumnReference colRef = getColumnReference(leftChild);
             PropertyDefinition<?> pd = colRef.getPropertyDefinition();
             PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
-            if (lVal instanceof List<?>)
+            if (lVal instanceof List<?>) {
                 throw new IllegalStateException("You can't query operators <, <=, ==, !=, >=, > on multi-value properties ");
-            else
+            } else {
                 return InMemoryQueryProcessor.this.compareTo(pd, lVal, rVal);
+            }
         }
 
         @SuppressWarnings("unchecked")
@@ -513,24 +538,30 @@ public class InMemoryQueryProcessor {
         }
     }
 
-    private boolean hasParent(Filing objInFolder, String folderId) {
+    private static boolean hasParent(Filing objInFolder, String folderId) {
         List<Folder> parents = objInFolder.getParents();
 
-        for (Folder folder : parents)
-            if (folderId.equals(folder.getId()))
+        for (Folder folder : parents) {
+            if (folderId.equals(folder.getId())) {
                 return true;
+            }
+        }
         return false;
     }
 
     private boolean hasAncestor(Filing objInFolder, String folderId) {
         List<Folder> parents = objInFolder.getParents();
 
-        for (Folder folder : parents)
-            if (folderId.equals(folder.getId()))
+        for (Folder folder : parents) {
+            if (folderId.equals(folder.getId())) {
                 return true;
-        for (Folder folder : parents)
-            if (hasAncestor(folder, folderId))
+            }
+        }
+        for (Folder folder : parents) {
+            if (hasAncestor(folder, folderId)) {
                 return true;
+            }
+        }
         return false;
     }
 
@@ -538,19 +569,21 @@ public class InMemoryQueryProcessor {
         Object lValue = lVal.getFirstValue();
         switch (td.getPropertyType()) {
         case BOOLEAN:
-            if (rVal instanceof Boolean)
+            if (rVal instanceof Boolean) {
                 return ((Boolean) lValue).compareTo((Boolean) rVal);
-            else
+            } else {
                 throwIncompatibleTypesException(lValue, rVal);
+            }
             break;
         case INTEGER: {
             Long lLongValue = ((BigInteger) lVal.getFirstValue()).longValue();
-            if (rVal instanceof Long)
+            if (rVal instanceof Long) {
                 return (lLongValue).compareTo((Long) rVal);
-            else if (rVal instanceof Double)
+            } else if (rVal instanceof Double) {
                 return Double.valueOf(((Integer) lValue).doubleValue()).compareTo((Double) rVal);
-            else
+            } else {
                 throwIncompatibleTypesException(lValue, rVal);
+            }
             break;
         }
         case DATETIME:
@@ -560,17 +593,19 @@ public class InMemoryQueryProcessor {
                 // " right: " +
                 // CalendarHelper.toString((GregorianCalendar)rVal));
                 return ((GregorianCalendar) lValue).compareTo((GregorianCalendar) rVal);
-            } else
+            } else {
                 throwIncompatibleTypesException(lValue, rVal);
+            }
             break;
         case DECIMAL: {
             Double lDoubleValue = ((BigDecimal) lVal.getFirstValue()).doubleValue();
-            if (rVal instanceof Double)
+            if (rVal instanceof Double) {
                 return lDoubleValue.compareTo((Double) rVal);
-            else if (rVal instanceof Long)
+            } else if (rVal instanceof Long) {
                 return Double.valueOf(((Integer) lValue).doubleValue()).compareTo(((Long)rVal).doubleValue());
-            else
+            } else {
                 throwIncompatibleTypesException(lValue, rVal);
+            }
             break;
         }
         case HTML:
@@ -580,8 +615,9 @@ public class InMemoryQueryProcessor {
             if (rVal instanceof String) {
                 LOG.debug("compare strings: " + lValue + " with " + rVal);
                 return ((String) lValue).compareTo((String) rVal);
-            } else
+            } else {
                 throwIncompatibleTypesException(lValue, rVal);
+            }
             break;
         }
         return 0;
@@ -589,19 +625,21 @@ public class InMemoryQueryProcessor {
 
     private ColumnReference getColumnReference(Tree columnNode) {
         CmisSelector sel = queryObj.getColumnReference(columnNode.getTokenStartIndex());
-        if (null == sel)
+        if (null == sel) {
             throw new IllegalStateException("Unknown property query name " + columnNode.getChild(0));
-        else if (sel instanceof ColumnReference)
+        } else if (sel instanceof ColumnReference) {
             return (ColumnReference) sel;
-        else
+        } else {
             throw new IllegalStateException("Unexpected numerical value function in where clause");
+        }
     }
 
     private String getTableReference(Tree tableNode) {
         String typeQueryName = queryObj.getTypeQueryName(tableNode.getText());
-        if (null == typeQueryName)
+        if (null == typeQueryName) {
             throw new IllegalStateException("Inavlid type in IN_FOLDER() or IN_TREE(), must be in FROM list: "
                     + tableNode.getText());
+        }
         return typeQueryName;
     }
 
@@ -609,13 +647,14 @@ public class InMemoryQueryProcessor {
         ColumnReference colRef = getColumnReference(columnNode);
         PropertyDefinition<?> pd = colRef.getPropertyDefinition();
         PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
-        if (null == lVal)
+        if (null == lVal) {
             return null;
-        else {
-            if (pd.getCardinality() == Cardinality.SINGLE)
+        } else {
+            if (pd.getCardinality() == Cardinality.SINGLE) {
                 return lVal.getFirstValue();
-            else
+            } else {
                 return lVal.getValues();
+            }
         }
     }
 
@@ -627,13 +666,14 @@ public class InMemoryQueryProcessor {
 
         while (index >= 0) {
             index = wildcardString.indexOf('%', start);
-            if (index < 0)
+            if (index < 0) {
                 res.append(wildcardString.substring(start));
-            else if (index == 0 || index > 0 && wildcardString.charAt(index - 1) != '\\') {
+            } else if (index == 0 || index > 0 && wildcardString.charAt(index - 1) != '\\') {
                 res.append(wildcardString.substring(start, index));
                 res.append(".*");
-            } else
+            } else {
                 res.append(wildcardString.substring(start, index + 1));
+            }
             start = index + 1;
         }
         wildcardString = res.toString();
@@ -644,19 +684,20 @@ public class InMemoryQueryProcessor {
 
         while (index >= 0) {
             index = wildcardString.indexOf('_', start);
-            if (index < 0)
+            if (index < 0) {
                 res.append(wildcardString.substring(start));
-            else if (index == 0 || index > 0 && wildcardString.charAt(index - 1) != '\\') {
+            } else if (index == 0 || index > 0 && wildcardString.charAt(index - 1) != '\\') {
                 res.append(wildcardString.substring(start, index));
                 res.append(".");
-            } else
+            } else {
                 res.append(wildcardString.substring(start, index + 1));
+            }
             start = index + 1;
         }
         return res.toString();
     }
 
-    private void throwIncompatibleTypesException(Object o1, Object o2) {
+    private static void throwIncompatibleTypesException(Object o1, Object o2) {
         throw new IllegalArgumentException("Incompatible Types to compare: " + o1 + " and " + o2);
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java Sun Apr 24 16:12:27 2011
@@ -32,9 +32,9 @@ import org.apache.chemistry.opencmis.inm
 
 /**
  * Common functionality for all service implementations
- * 
+ *
  * @author Jens
- * 
+ *
  */
 public class AbstractServiceImpl {
 
@@ -48,7 +48,7 @@ public class AbstractServiceImpl {
      * check if repository is known and that object exists. To avoid later calls
      * to again retrieve the object from the id return the retrieved object for
      * later use.
-     * 
+     *
      * @param repositoryId
      *            repository id
      * @param objectId
@@ -59,23 +59,25 @@ public class AbstractServiceImpl {
 
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
 
-        if (objStore == null)
+        if (objStore == null) {
             throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+        }
 
         StoredObject so = objStore.getObjectById(objectId);
 
-        if (so == null)
+        if (so == null) {
             throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+        }
 
         return so;
     }
 
     protected StoredObject checkExistingObjectId(ObjectStore objStore, String objectId) {
-
         StoredObject so = objStore.getObjectById(objectId);
 
-        if (so == null)
+        if (so == null) {
             throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+        }
 
         return so;
     }
@@ -83,15 +85,17 @@ public class AbstractServiceImpl {
     protected void checkRepositoryId(String repositoryId) {
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
 
-        if (objStore == null)
+        if (objStore == null) {
             throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+        }
     }
 
     protected TypeDefinition getTypeDefinition(String repositoryId, Properties properties) {
         String typeId = (String) properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue();
         TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
-        if (typeDefC == null)
+        if (typeDefC == null) {
             throw new RuntimeException("Cannot create object, a type with id " + typeId + " is unknown");
+        }
 
         return typeDefC.getTypeDefinition();
     }
@@ -106,13 +110,12 @@ public class AbstractServiceImpl {
      * We allow checkin, cancel, checkout operations on a single version as well
      * as on a version series This method returns the versioned document
      * (version series) in each case
-     * 
+     *
      * @param value
      *            version or version series id of a document
      * @return version series id
      */
     protected VersionedDocument getVersionedDocumentOfObjectId(StoredObject so) {
-
         VersionedDocument verDoc;
         if (so instanceof DocumentVersion) {
             // get document the version is contained in to c
@@ -127,14 +130,14 @@ public class AbstractServiceImpl {
     protected VersionedDocument testIsNotCheckedOutBySomeoneElse(StoredObject so, String user) {
         checkIsVersionableObject(so);
         VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
-        if (verDoc.isCheckedOut())
+        if (verDoc.isCheckedOut()) {
             testCheckedOutByCurrentUser(user, verDoc);
+        }
 
         return verDoc;
     }
 
     protected VersionedDocument testHasProperCheckedOutStatus(StoredObject so, String user) {
-
         checkIsVersionableObject(so);
         VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
 
@@ -147,25 +150,29 @@ public class AbstractServiceImpl {
     }
 
     protected void checkIsVersionableObject(StoredObject so) {
-        if (!(so instanceof VersionedDocument || so instanceof DocumentVersion))
+        if (!(so instanceof VersionedDocument || so instanceof DocumentVersion)) {
             throw new RuntimeException(
                     "Object is of a versionable type but not instance of VersionedDocument or DocumentVersion.");
+        }
     }
 
     protected void checkHasUser(String user) {
-        if (null == user || user.length() == 0)
+        if (null == user || user.length() == 0) {
             throw new CmisUpdateConflictException("Object can't be checked-in, no user is given.");
+        }
     }
 
     protected void testCheckedOutByCurrentUser(String user, VersionedDocument verDoc) {
-        if (!user.equals(verDoc.getCheckedOutBy()))
+        if (!user.equals(verDoc.getCheckedOutBy())) {
             throw new CmisUpdateConflictException("Object can't be checked-in, user " + verDoc.getCheckedOutBy()
                     + " has checked out the document.");
+        }
     }
 
     protected void testIsCheckedOut(VersionedDocument verDoc) {
-        if (!verDoc.isCheckedOut())
+        if (!verDoc.isCheckedOut()) {
             throw new CmisUpdateConflictException("Canot check-in: Document " + verDoc.getId() + " is not checked out.");
+        }
     }
 
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java?rev=1096340&r1=1096339&r2=1096340&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java Sun Apr 24 16:12:27 2011
@@ -41,9 +41,9 @@ import org.apache.chemistry.opencmis.inm
  * For the Atom binding more information might be required than the result of a
  * service call provides (mainly to fill all the links). This class fills the
  * objectInfoHolder that was introduced for this purpose
- * 
+ *
  * @author Jens
- * 
+ *
  */
 public class AtomLinkInfoProvider {
 
@@ -56,7 +56,7 @@ public class AtomLinkInfoProvider {
     /**
      * FillObjectInfoHolder object with required information needed for Atom
      * binding for a single object
-     * 
+     *
      * @param repositoryId
      *            id of repository
      * @param objectId
@@ -65,8 +65,9 @@ public class AtomLinkInfoProvider {
      *            Holder to fill with information
      */
     public void fillInformationForAtomLinks(String repositoryId, StoredObject so, ObjectData od, ObjectInfoImpl objInfo) {
-        if (null == objInfo || null == so)
+        if (null == objInfo || null == so) {
             return;
+        }
         TypeDefinition typeDef = fStoreManager.getTypeById(repositoryId, so.getTypeId()).getTypeDefinition();
 
         // Fill all setters:
@@ -141,13 +142,13 @@ public class AtomLinkInfoProvider {
     }
 
     public void fillInformationForAtomLinks(String repositoryId, StoredObject so, ObjectInfoImpl objectInfo) {
-        fillInformationForAtomLinks(repositoryId, so, null, objectInfo);        
+        fillInformationForAtomLinks(repositoryId, so, null, objectInfo);
     }
 
     /**
      * FillObjectInfoHolder object with required information needed for Atom
      * binding for a single object
-     * 
+     *
      * @param repositoryId
      *            id of repository
      * @param objectId
@@ -156,8 +157,9 @@ public class AtomLinkInfoProvider {
      *            Holder to fill with information
      */
    public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoImpl objectInfo) {
-        if (null == objectInfo || null == objectId)
+        if (null == objectInfo || null == objectId) {
             return;
+        }
 
         ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
         StoredObject so = objectStore.getObjectById(objectId);
@@ -168,7 +170,7 @@ public class AtomLinkInfoProvider {
     /**
      * FillObjectInfoHolder object with required information needed for Atom
      * binding after a getChildren() call in navigation service
-     * 
+     *
      * @param repositoryId
      *            id of repository
      * @param objectId
@@ -181,9 +183,10 @@ public class AtomLinkInfoProvider {
     public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHandler objectInfos,
             ObjectInFolderList objList) {
 
-        if (null == objectInfos || null == objList || null == objectId)
+        if (null == objectInfos || null == objList || null == objectId) {
             return;
-        
+        }
+
 
         // Fill object information for requested object
         ObjectInfoImpl objectInfo = new ObjectInfoImpl();
@@ -201,7 +204,7 @@ public class AtomLinkInfoProvider {
     /**
      * FillObjectInfoHolder object with required information needed for Atom
      * binding for an object list
-     * 
+     *
      * @param repositoryId
      *            id of repository
      * @param objectId
@@ -224,12 +227,13 @@ public class AtomLinkInfoProvider {
         if (null != objList && null != objList.getObjects()) {
             // Fill object information for all children in result list
             List<ObjectData> listObjects = objList.getObjects();
-            if (null != listObjects)
+            if (null != listObjects) {
                 for (ObjectData object : listObjects) {
                     objectInfo = new ObjectInfoImpl();
                     fillInformationForAtomLinks(repositoryId, object.getId(), objectInfo);
                     objectInfos.addObjectInfo(objectInfo);
                 }
+            }
         }
 
     }
@@ -237,7 +241,7 @@ public class AtomLinkInfoProvider {
     /**
      * FillObjectInfoHolder object with required information needed for Atom
      * binding for an ObjectInFolderContainer
-     * 
+     *
      * @param repositoryId
      *            id of repository
      * @param objectId
@@ -250,25 +254,27 @@ public class AtomLinkInfoProvider {
     private void fillInformationForAtomLinks(String repositoryId, ObjectInfoHandler objectInfos,
             ObjectInFolderContainer oifc) {
 
-        if (null == objectInfos || null == oifc)
+        if (null == objectInfos || null == oifc) {
             return;
+        }
 
         // Fill object information for all elements in result list
         fillInformationForAtomLinks(repositoryId, objectInfos, oifc.getObject());
 
-        if (null != oifc.getChildren())
+        if (null != oifc.getChildren()) {
             for (ObjectInFolderContainer object : oifc.getChildren()) {
                 // call recursively
                 ObjectInfoImpl objectInfo = new ObjectInfoImpl();
                 fillInformationForAtomLinks(repositoryId, objectInfos, object);
                 objectInfos.addObjectInfo(objectInfo);
             }
+        }
     }
 
     /**
      * FillObjectInfoHolder object with required information needed for Atom
      * binding for a list with ObjectInFolderContainers
-     * 
+     *
      * @param repositoryId
      *            id of repository
      * @param objectId
@@ -281,8 +287,9 @@ public class AtomLinkInfoProvider {
     public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHandler objectInfos,
             List<ObjectInFolderContainer> oifcList) {
 
-        if (null == objectInfos || null == oifcList || null == objectId)
+        if (null == objectInfos || null == oifcList || null == objectId) {
             return;
+        }
 
         ObjectInfoImpl objectInfo = new ObjectInfoImpl();
         // Fill object information for requested object
@@ -305,7 +312,7 @@ public class AtomLinkInfoProvider {
     /**
      * FillObjectInfoHolder object with required information needed for Atom
      * binding for a list with ObjectParentData objects
-     * 
+     *
      * @param repositoryId
      *            id of repository
      * @param objectId
@@ -318,8 +325,9 @@ public class AtomLinkInfoProvider {
     public void fillInformationForAtomLinksGetParents(String repositoryId, String objectId,
             ObjectInfoHandler objectInfos, List<ObjectParentData> objParents) {
 
-        if (null == objectInfos || null == objParents || null == objectId)
+        if (null == objectInfos || null == objParents || null == objectId) {
             return;
+        }
 
         // Fill object information for requested object
         ObjectInfoImpl objectInfo = new ObjectInfoImpl();