You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2014/06/27 16:51:24 UTC

svn commit: r1606112 [1/2] - in /chemistry/opencmis/trunk: chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-client/chemistry-opencmis-client-binding...

Author: fmui
Date: Fri Jun 27 14:51:22 2014
New Revision: 1606112

URL: http://svn.apache.org/r1606112
Log:
code clean up

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CollectionsHelper.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/CollectionsHelperTest.java   (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieManager.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/OperationContextImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PropertyImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamHashImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AbstractAtomPubServiceCall.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/WebSphereAuthHandler.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/DeleteTreeTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/types/BaseTypesTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersionDeleteTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningSmokeTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ExtensionsPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.math.BigInteger;
@@ -86,8 +88,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl;
 import org.xmlpull.v1.XmlSerializer;
 
-import android.util.Xml;
-
 /**
  * Base class for all AtomPub client services.
  */
@@ -151,7 +151,7 @@ public abstract class AbstractAtomPubSer
 
         if (info == null) {
             List<RepositoryInfo> infoList = getRepositoriesInternal(repositoryId);
-            if (!infoList.isEmpty()) {
+            if (isNotEmpty(infoList)) {
                 info = infoList.get(0);
                 cache.put(info);
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java Fri Jun 27 14:51:22 2014
@@ -16,9 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.chemistry.opencmis.client.bindings.impl;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.io.Serializable;
 import java.math.BigInteger;
 import java.util.List;
@@ -56,7 +57,7 @@ public class RepositoryServiceImpl imple
 
     public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
         RepositoryInfo result = null;
-        boolean hasExtension = (extension != null) && (!extension.getExtensions().isEmpty());
+        boolean hasExtension = (extension != null) && isNotEmpty(extension.getExtensions());
 
         RepositoryInfoCache cache = CmisBindingsHelper.getRepositoryInfoCache(session);
 
@@ -82,7 +83,7 @@ public class RepositoryServiceImpl imple
 
     public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
         List<RepositoryInfo> result = null;
-        boolean hasExtension = (extension != null) && (!extension.getExtensions().isEmpty());
+        boolean hasExtension = (extension != null) && isNotEmpty(extension.getExtensions());
 
         // get the SPI and fetch the repository infos
         CmisSpi spi = CmisBindingsHelper.getSPI(session);
@@ -102,7 +103,7 @@ public class RepositoryServiceImpl imple
     public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
             BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
         TypeDefinitionList result = null;
-        boolean hasExtension = (extension != null) && (!extension.getExtensions().isEmpty());
+        boolean hasExtension = (extension != null) && isNotEmpty(extension.getExtensions());
         boolean propDefs = (includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue());
 
         // get the SPI and fetch the type definitions
@@ -129,7 +130,7 @@ public class RepositoryServiceImpl imple
     public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension,
             boolean useCache) {
         TypeDefinition result = null;
-        boolean hasExtension = (extension != null) && (!extension.getExtensions().isEmpty());
+        boolean hasExtension = (extension != null) && isNotEmpty(extension.getExtensions());
 
         TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(session);
 
@@ -157,7 +158,7 @@ public class RepositoryServiceImpl imple
     public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
             Boolean includePropertyDefinitions, ExtensionsData extension) {
         List<TypeDefinitionContainer> result = null;
-        boolean hasExtension = (extension != null) && (!extension.getExtensions().isEmpty());
+        boolean hasExtension = (extension != null) && isNotEmpty(extension.getExtensions());
         boolean propDefs = (includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue());
 
         // get the SPI and fetch the type definitions

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.math.BigInteger;
@@ -150,7 +152,7 @@ public abstract class AbstractAtomPubSer
 
         if (info == null) {
             List<RepositoryInfo> infoList = getRepositoriesInternal(repositoryId);
-            if (!infoList.isEmpty()) {
+            if (isNotEmpty(infoList)) {
                 info = infoList.get(0);
                 cache.put(info);
             }
@@ -560,7 +562,7 @@ public abstract class AbstractAtomPubSer
         }
         object.setProperties(properties);
 
-        if (policies != null && !policies.isEmpty()) {
+        if (isNotEmpty(policies)) {
             PolicyIdListImpl policyIdList = new PolicyIdListImpl();
             policyIdList.setPolicyIds(policies);
             object.setPolicyIds(policyIdList);
@@ -682,8 +684,8 @@ public abstract class AbstractAtomPubSer
      * Checks if at least one ACE list is not empty.
      */
     protected boolean isAclMergeRequired(Acl addAces, Acl removeAces) {
-        return (addAces != null && addAces.getAces() != null && !addAces.getAces().isEmpty())
-                || (removeAces != null && removeAces.getAces() != null && !removeAces.getAces().isEmpty());
+        return (addAces != null && isNotEmpty(addAces.getAces()))
+                || (removeAces != null && isNotEmpty(removeAces.getAces()));
     }
 
     /**

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java Fri Jun 27 14:51:22 2014
@@ -404,7 +404,7 @@ public class NavigationServiceImpl exten
      * Adds descendants level recursively.
      */
     private void addDescendantsLevel(String repositoryId, AtomFeed feed, List<ObjectInFolderContainer> containerList) {
-        if ((feed == null) || (feed.getEntries().isEmpty())) {
+        if (feed == null || feed.getEntries().isEmpty()) {
             return;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java Fri Jun 27 14:51:22 2014
@@ -68,7 +68,7 @@ public class RepositoryServiceImpl exten
     public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
         List<RepositoryInfo> repositoryInfos = getRepositoriesInternal(repositoryId);
 
-        if (repositoryInfos.size() == 0) {
+        if (repositoryInfos.isEmpty()) {
             throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
         }
 
@@ -194,7 +194,7 @@ public class RepositoryServiceImpl exten
      * Adds type descendants level recursively.
      */
     private void addTypeDescendantsLevel(String repositoryId, AtomFeed feed, List<TypeDefinitionContainer> containerList) {
-        if ((feed == null) || (feed.getEntries().isEmpty())) {
+        if (feed == null || feed.getEntries().isEmpty()) {
             return;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,9 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
+
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URLEncoder;
@@ -83,7 +86,7 @@ public final class FormDataWriter {
             String idxStr = "[" + idx + "]";
             addParameter(Constants.CONTROL_PROP_ID + idxStr, prop.getId());
 
-            if (prop.getValues() != null && prop.getValues().size() > 0) {
+            if (isNotEmpty(prop.getValues())) {
                 if (prop.getValues().size() == 1) {
                     addParameter(Constants.CONTROL_PROP_VALUE + idxStr,
                             convertPropertyValue(prop.getFirstValue(), dateTimeFormat));
@@ -138,7 +141,7 @@ public final class FormDataWriter {
 
         int idx = 0;
         for (Ace ace : acl.getAces()) {
-            if (ace.getPrincipalId() != null && ace.getPermissions() != null && !ace.getPermissions().isEmpty()) {
+            if (ace.getPrincipalId() != null && isNotEmpty(ace.getPermissions())) {
                 String idxStr = "[" + idx + "]";
                 addParameter(principalControl + idxStr, ace.getPrincipalId());
 
@@ -156,7 +159,7 @@ public final class FormDataWriter {
     }
 
     public void addObjectIdsAndChangeTokens(List<BulkUpdateObjectIdAndChangeToken> objectIdsAndChangeTokens) {
-        if (objectIdsAndChangeTokens == null || objectIdsAndChangeTokens.size() == 0) {
+        if (isNullOrEmpty(objectIdsAndChangeTokens)) {
             return;
         }
 
@@ -184,7 +187,7 @@ public final class FormDataWriter {
     }
 
     private void addSecondaryTypeIdParameters(List<String> secondaryTypeIds, String secondaryTypeIdControl) {
-        if (secondaryTypeIds == null || secondaryTypeIds.size() == 0) {
+        if (isNullOrEmpty(secondaryTypeIds)) {
             return;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java Fri Jun 27 14:51:22 2014
@@ -57,7 +57,7 @@ public class RepositoryServiceImpl exten
     public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
         List<RepositoryInfo> repositoryInfos = getRepositoriesInternal(repositoryId);
 
-        if (repositoryInfos.size() == 0) {
+        if (repositoryInfos.isEmpty()) {
             throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieManager.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieManager.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieManager.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieManager.java Fri Jun 27 14:51:22 2014
@@ -33,7 +33,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.http;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.io.BufferedOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -149,7 +151,7 @@ public abstract class AbstractApacheClie
                 Map<String, List<String>> httpHeaders = authProvider.getHTTPHeaders(url.toString());
                 if (httpHeaders != null) {
                     for (Map.Entry<String, List<String>> header : httpHeaders.entrySet()) {
-                        if (header.getKey() != null && header.getValue() != null && !header.getValue().isEmpty()) {
+                        if (header.getKey() != null && isNotEmpty(header.getValue())) {
                             String key = header.getKey();
                             if (key.equalsIgnoreCase("user-agent")) {
                                 request.setHeader("User-Agent", header.getValue().get(0));

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.http;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.io.BufferedOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -119,7 +121,7 @@ public class DefaultHttpInvoker implemen
                 Map<String, List<String>> httpHeaders = authProvider.getHTTPHeaders(url.toString());
                 if (httpHeaders != null) {
                     for (Map.Entry<String, List<String>> header : httpHeaders.entrySet()) {
-                        if (header.getKey() != null && header.getValue() != null && !header.getValue().isEmpty()) {
+                        if (header.getKey() != null && isNotEmpty(header.getValue())) {
                             String key = header.getKey();
                             if (key.equalsIgnoreCase("user-agent")) {
                                 conn.setRequestProperty("User-Agent", header.getValue().get(0));

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.http;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -190,7 +192,7 @@ public class Response {
 
     public String getHeader(String name) {
         List<String> list = headers.get(name.toLowerCase(Locale.US));
-        if ((list == null) || (list.isEmpty())) {
+        if (isNullOrEmpty(list)) {
             return null;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java Fri Jun 27 14:51:22 2014
@@ -83,7 +83,7 @@ public abstract class AbstractWebService
         BigInteger code = ex.getFaultInfo().getCode();
 
         String errorContent = null;
-        if (ex.getFaultInfo().getAny().size() > 0) {
+        if (!ex.getFaultInfo().getAny().isEmpty()) {
             StringBuilder sb = new StringBuilder();
             for (Object o : ex.getFaultInfo().getAny()) {
                 if (o != null) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java Fri Jun 27 14:51:22 2014
@@ -91,7 +91,7 @@ public class AtomParserTest extends Test
         AtomEntry entry = (AtomEntry) parseResult;
 
         assertNotNull(entry);
-        assertTrue(entry.getElements().size() > 0);
+        assertFalse(entry.getElements().isEmpty());
 
         // find the object
         ObjectData object2 = null;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.framework;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
@@ -68,10 +70,7 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Base test case for CMIS tests.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
- */
+  */
 public abstract class AbstractCmisTestCase extends TestCase {
 
     public static final String DEFAULT_TESTS_ENABLED = "true";
@@ -552,7 +551,7 @@ public abstract class AbstractCmisTestCa
                     folderId, "*", null, Boolean.TRUE, IncludeRelationships.BOTH, null, Boolean.TRUE, null, null, null);
 
             assertNotNull(children);
-            assertTrue(children.getObjects().size() > 0);
+            assertTrue(isNotEmpty(children.getObjects()));
 
             hasMore = (children.hasMoreItems() == null ? false : children.hasMoreItems().booleanValue());
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.framework;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
@@ -48,9 +50,6 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * Simple read-only tests.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public abstract class AbstractSimpleReadOnlyTests extends AbstractCmisTestCase {
 
@@ -511,7 +510,7 @@ public abstract class AbstractSimpleRead
             List<ObjectData> allVersions = getBinding().getVersioningService().getAllVersions(getTestRepositoryId(),
                     objectId, versionSeriesId, "*", Boolean.FALSE, null);
             assertNotNull(allVersions);
-            assertTrue(allVersions.size() > 0);
+            assertTrue(isNotEmpty(allVersions));
 
             boolean foundObject = false;
             boolean foundLatestObject = false;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,9 @@
  */
 package org.apache.chemistry.opencmis.client.runtime;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
+
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -119,7 +122,7 @@ public abstract class AbstractCmisObject
                     @SuppressWarnings("unchecked")
                     List<String> stids = (List<String>) objectData.getProperties().getProperties()
                             .get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues();
-                    if (stids != null && stids.size() > 0) {
+                    if (isNotEmpty(stids)) {
                         secondaryTypes = new ArrayList<SecondaryType>();
                         for (String stid : stids) {
                             if (stid != null) {
@@ -320,7 +323,7 @@ public abstract class AbstractCmisObject
     }
 
     public ObjectId updateProperties(Map<String, ?> properties, boolean refresh) {
-        if (properties == null || properties.isEmpty()) {
+        if (isNullOrEmpty(properties)) {
             throw new IllegalArgumentException("Properties must not be empty!");
         }
 
@@ -604,7 +607,7 @@ public abstract class AbstractCmisObject
             throw new IllegalStateException("ACLs are not available!");
         }
 
-        if (acl.getAces() == null || acl.getAces().isEmpty()) {
+        if (isNullOrEmpty(acl.getAces())) {
             return Collections.emptySet();
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.runtime;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import java.io.IOException;
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -126,7 +128,7 @@ public class DocumentImpl extends Abstra
 
     public List<ContentStreamHash> getContentStreamHashes() {
         List<String> hashes = getPropertyValue(PropertyIds.CONTENT_STREAM_HASH);
-        if (hashes == null || hashes.size() == 0) {
+        if (isNullOrEmpty(hashes)) {
             return null;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.runtime;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
+
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -174,7 +176,7 @@ public class FolderImpl extends Abstract
         FailedToDeleteData failed = getBinding().getObjectService().deleteTree(repositoryId, objectId, allVersions,
                 unfile, continueOnFailure, null);
 
-        if ((failed == null) || (failed.getIds() == null) || (failed.getIds().isEmpty())) {
+        if (failed == null || isNullOrEmpty(failed.getIds())) {
             getSession().removeObjectFromCache(this);
         }
 
@@ -364,7 +366,7 @@ public class FolderImpl extends Abstract
         }
 
         List<Folder> parents = getParents(getSession().getDefaultContext());
-        if ((parents == null) || (parents.isEmpty())) {
+        if (isNullOrEmpty(parents)) {
             return null;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/OperationContextImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/OperationContextImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/OperationContextImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/OperationContextImpl.java Fri Jun 27 14:51:22 2014
@@ -142,7 +142,7 @@ public class OperationContextImpl implem
                 tempSet.add(toid);
             }
 
-            if (tempSet.size() == 0) {
+            if (tempSet.isEmpty()) {
                 filter = null;
             } else {
                 filter = tempSet;
@@ -270,7 +270,7 @@ public class OperationContextImpl implem
                 tempSet.add(trf);
             }
 
-            if (tempSet.size() == 0) {
+            if (tempSet.isEmpty()) {
                 tempSet.add(RENDITION_NONE);
             }
         } else {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PropertyImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PropertyImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PropertyImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PropertyImpl.java Fri Jun 27 14:51:22 2014
@@ -84,7 +84,7 @@ public class PropertyImpl<T> extends Abs
     public <U> U getValue() {
         List<T> values = getValues();
         if (propertyDefinition.getCardinality() == Cardinality.SINGLE) {
-            return values.size() == 0 ? null : (U) values.get(0);
+            return values.isEmpty() ? null : (U) values.get(0);
         } else {
             return (U) values;
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java Fri Jun 27 14:51:22 2014
@@ -17,6 +17,8 @@
  */
 package org.apache.chemistry.opencmis.client.runtime;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import java.net.URI;
 import java.net.URL;
 import java.text.SimpleDateFormat;
@@ -96,7 +98,7 @@ public class QueryStatementImpl implemen
             throw new IllegalArgumentException("Session must be set!");
         }
 
-        if (fromTypes == null || fromTypes.size() == 0) {
+        if (isNullOrEmpty(fromTypes)) {
             throw new IllegalArgumentException("Types must be set!");
         }
 
@@ -132,7 +134,7 @@ public class QueryStatementImpl implemen
             }
 
             // exclude secondary types without properties
-            if (type.getPropertyDefinitions() != null && type.getPropertyDefinitions().size() > 0) {
+            if (isNotEmpty(type.getPropertyDefinitions())) {
                 types.put(alias, type);
             }
         }
@@ -146,7 +148,7 @@ public class QueryStatementImpl implemen
 
         StringListBuilder selectList = new StringListBuilder(",", stmt);
 
-        if (selectPropertyIds == null || selectPropertyIds.size() == 0) {
+        if (isNullOrEmpty(selectPropertyIds)) {
             // select all properties
             for (String alias : types.keySet()) {
                 selectList.add(alias + ".*");
@@ -231,7 +233,7 @@ public class QueryStatementImpl implemen
         }
 
         // ORDER BY
-        if (orderByPropertyIds != null && orderByPropertyIds.size() > 0) {
+        if (isNotEmpty(orderByPropertyIds)) {
             stmt.append(" ORDER BY ");
 
             StringListBuilder orderByList = new StringListBuilder(",", stmt);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.runtime;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
+
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -1035,7 +1037,7 @@ public class SessionImpl implements Sess
 
     public ObjectId createDocument(Map<String, ?> properties, ObjectId folderId, ContentStream contentStream,
             VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
-        if ((properties == null) || (properties.isEmpty())) {
+        if (isNullOrEmpty(properties)) {
             throw new IllegalArgumentException("Properties must not be empty!");
         }
 
@@ -1098,7 +1100,7 @@ public class SessionImpl implements Sess
         if ((folderId == null) || (folderId.getId() == null)) {
             throw new IllegalArgumentException("Folder ID must be set!");
         }
-        if ((properties == null) || (properties.isEmpty())) {
+        if (isNullOrEmpty(properties)) {
             throw new IllegalArgumentException("Properties must not be empty!");
         }
 
@@ -1116,7 +1118,7 @@ public class SessionImpl implements Sess
 
     public ObjectId createPolicy(Map<String, ?> properties, ObjectId folderId, List<Policy> policies,
             List<Ace> addAces, List<Ace> removeAces) {
-        if ((properties == null) || (properties.isEmpty())) {
+        if (isNullOrEmpty(properties)) {
             throw new IllegalArgumentException("Properties must not be empty!");
         }
 
@@ -1134,7 +1136,7 @@ public class SessionImpl implements Sess
 
     public ObjectId createItem(Map<String, ?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces,
             List<Ace> removeAces) {
-        if ((properties == null) || (properties.isEmpty())) {
+        if (isNullOrEmpty(properties)) {
             throw new IllegalArgumentException("Properties must not be empty!");
         }
 
@@ -1152,7 +1154,7 @@ public class SessionImpl implements Sess
 
     public ObjectId createRelationship(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
             List<Ace> removeAces) {
-        if ((properties == null) || (properties.isEmpty())) {
+        if (isNullOrEmpty(properties)) {
             throw new IllegalArgumentException("Properties must not be empty!");
         }
 
@@ -1247,7 +1249,7 @@ public class SessionImpl implements Sess
             throw new CmisNotSupportedException("This method is not supported for CMIS 1.0 repositories.");
         }
 
-        if ((objects == null) || objects.isEmpty()) {
+        if (isNullOrEmpty(properties)) {
             throw new IllegalArgumentException("Objects must be set!");
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.runtime.repository;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import java.io.InputStream;
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -466,7 +468,7 @@ public class ObjectFactoryImpl implement
 
             // assemble property
             PropertyData<?> propertyData = null;
-            Object firstValue = (values == null || values.isEmpty() ? null : values.get(0));
+            Object firstValue = (isNullOrEmpty(values) ? null : values.get(0));
 
             if (definition instanceof PropertyStringDefinition) {
                 if (firstValue == null) {
@@ -643,7 +645,7 @@ public class ObjectFactoryImpl implement
 
             if (properties.containsKey(PropertyIds.OBJECT_ID)) {
                 List<?> objectIdList = properties.get(PropertyIds.OBJECT_ID);
-                if ((objectIdList != null) && (!objectIdList.isEmpty())) {
+                if (isNotEmpty(objectIdList)) {
                     objectId = objectIdList.get(0).toString();
                 }
             }

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CollectionsHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CollectionsHelper.java?rev=1606112&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CollectionsHelper.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CollectionsHelper.java Fri Jun 27 14:51:22 2014
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.commons.impl;
+
+import java.util.Collection;
+import java.util.Map;
+
+public final class CollectionsHelper {
+
+    private CollectionsHelper() {
+    }
+
+    public static boolean isNotEmpty(Collection<?> col) {
+        return col != null && !col.isEmpty();
+    }
+
+    public static boolean isNotEmpty(Map<?, ?> map) {
+        return map != null && !map.isEmpty();
+    }
+
+    public static boolean isNullOrEmpty(Collection<?> col) {
+        return col == null || col.isEmpty();
+    }
+
+    public static boolean isNullOrEmpty(Map<?, ?> map) {
+        return map == null || map.isEmpty();
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CollectionsHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.commons.impl;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
 import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.*;
 
 import java.lang.reflect.Method;
@@ -222,7 +224,7 @@ public final class JSONConverter {
         setIfNotNull(JSON_REPINFO_PRINCIPAL_ID_ANONYMOUS, repositoryInfo.getPrincipalIdAnonymous(), result);
         setIfNotNull(JSON_REPINFO_PRINCIPAL_ID_ANYONE, repositoryInfo.getPrincipalIdAnyone(), result);
 
-        if (repositoryInfo.getExtensionFeatures() != null && !repositoryInfo.getExtensionFeatures().isEmpty()) {
+        if (isNotEmpty(repositoryInfo.getExtensionFeatures())) {
             JSONArray extendedFeatures = new JSONArray();
 
             for (ExtensionFeature feature : repositoryInfo.getExtensionFeatures()) {
@@ -263,7 +265,7 @@ public final class JSONConverter {
         setIfNotNull(JSON_FEATURE_VERSION_LABEL, feature.getVersionLabel(), jsonFeature);
         setIfNotNull(JSON_FEATURE_DESCRIPTION, feature.getDescription(), jsonFeature);
 
-        if (feature.getFeatureData() != null && !feature.getFeatureData().isEmpty()) {
+        if (isNotEmpty(feature.getFeatureData())) {
             JSONObject data = new JSONObject();
             data.putAll(feature.getFeatureData());
             jsonFeature.put(JSON_FEATURE_DATA, data);
@@ -285,7 +287,7 @@ public final class JSONConverter {
         JSONObject result = new JSONObject();
 
         result.put(JSON_CAP_CONTENT_STREAM_UPDATABILITY,
-                getJSONEnumValue((capabilities.getContentStreamUpdatesCapability())));
+                getJSONEnumValue(capabilities.getContentStreamUpdatesCapability()));
         result.put(JSON_CAP_CHANGES, getJSONEnumValue(capabilities.getChangesCapability()));
         result.put(JSON_CAP_RENDITIONS, getJSONEnumValue(capabilities.getRenditionsCapability()));
         result.put(JSON_CAP_GET_DESCENDANTS, capabilities.isGetDescendantsSupported());
@@ -696,7 +698,7 @@ public final class JSONConverter {
             Object allowedSourceTypes = json.get(JSON_TYPE_ALLOWED_SOURCE_TYPES);
             if (allowedSourceTypes instanceof List) {
                 List<String> types = new ArrayList<String>();
-                for (Object type : ((List<Object>) allowedSourceTypes)) {
+                for (Object type : (List<Object>) allowedSourceTypes) {
                     if (type != null) {
                         types.add(type.toString());
                     }
@@ -708,7 +710,7 @@ public final class JSONConverter {
             Object allowedTargetTypes = json.get(JSON_TYPE_ALLOWED_TARGET_TYPES);
             if (allowedTargetTypes instanceof List) {
                 List<String> types = new ArrayList<String>();
-                for (Object type : ((List<Object>) allowedTargetTypes)) {
+                for (Object type : (List<Object>) allowedTargetTypes) {
                     if (type != null) {
                         types.add(type.toString());
                     }
@@ -1107,7 +1109,7 @@ public final class JSONConverter {
         }
 
         // relationships
-        if ((object.getRelationships() != null) && (!object.getRelationships().isEmpty())) {
+        if (isNotEmpty(object.getRelationships())) {
             JSONArray relationships = new JSONArray();
 
             for (ObjectData relationship : object.getRelationships()) {
@@ -1153,7 +1155,7 @@ public final class JSONConverter {
         }
 
         // renditions
-        if ((object.getRenditions() != null) && (!object.getRenditions().isEmpty())) {
+        if (isNotEmpty(object.getRenditions())) {
             JSONArray renditions = new JSONArray();
 
             for (RenditionData rendition : object.getRenditions()) {
@@ -1234,7 +1236,7 @@ public final class JSONConverter {
             Object result = null;
 
             if (propDef != null) {
-                if ((property.getValues() == null) || (property.getValues().size() == 0)) {
+                if (isNullOrEmpty(property.getValues())) {
                     result = null;
                 } else if (propDef.getCardinality() == Cardinality.SINGLE) {
                     result = getJSONValue(property.getValues().get(0), dateTimeFormat);
@@ -1248,9 +1250,9 @@ public final class JSONConverter {
                     result = values;
                 }
             } else {
-                if ((property.getValues() == null) || (property.getValues().size() == 0)) {
+                if (isNullOrEmpty(property.getValues())) {
                     result = null;
-                } else if (property.getValues().size() > 0) {
+                } else {
                     JSONArray values = new JSONArray();
 
                     for (Object value : property.getValues()) {
@@ -1274,7 +1276,7 @@ public final class JSONConverter {
                 result.put(JSON_PROPERTY_DATATYPE, getJSONEnumValue(propDef.getPropertyType()));
                 result.put(JSON_PROPERTY_CARDINALITY, getJSONEnumValue(propDef.getCardinality()));
 
-                if ((property.getValues() == null) || (property.getValues().size() == 0)) {
+                if (isNullOrEmpty(property.getValues())) {
                     result.put(JSON_PROPERTY_VALUE, null);
                 } else if (propDef.getCardinality() == Cardinality.SINGLE) {
                     result.put(JSON_PROPERTY_VALUE, getJSONValue(property.getValues().get(0), dateTimeFormat));
@@ -1290,9 +1292,9 @@ public final class JSONConverter {
             } else {
                 result.put(JSON_PROPERTY_DATATYPE, getJSONPropertyDataType(property));
 
-                if ((property.getValues() == null) || (property.getValues().size() == 0)) {
+                if (isNullOrEmpty(property.getValues())) {
                     result.put(JSON_PROPERTY_VALUE, null);
-                } else if (property.getValues().size() > 0) {
+                } else {
                     JSONArray values = new JSONArray();
 
                     for (Object value : property.getValues()) {
@@ -1491,7 +1493,7 @@ public final class JSONConverter {
         result.put(JSON_OBJECTINFOLDERCONTAINER_OBJECT,
                 convert(container.getObject(), typeCache, succinct, dateTimeFormat));
 
-        if ((container.getChildren() != null) && (container.getChildren().size() > 0)) {
+        if (isNotEmpty(container.getChildren())) {
             JSONArray children = new JSONArray();
             for (ObjectInFolderContainer descendant : container.getChildren()) {
                 children.add(JSONConverter.convert(descendant, typeCache, succinct, dateTimeFormat));
@@ -1577,7 +1579,7 @@ public final class JSONConverter {
                     getJSONArrayFromList(((RelationshipTypeDefinition) type).getAllowedTargetTypeIds()));
         }
 
-        if ((type.getPropertyDefinitions() != null) && (!type.getPropertyDefinitions().isEmpty())) {
+        if (isNotEmpty(type.getPropertyDefinitions())) {
             JSONObject propertyDefs = new JSONObject();
 
             for (PropertyDefinition<?> pd : type.getPropertyDefinitions().values()) {
@@ -1654,7 +1656,7 @@ public final class JSONConverter {
         }
 
         // choices
-        if (propertyDefinition.getChoices() != null && !propertyDefinition.getChoices().isEmpty()) {
+        if (isNotEmpty(propertyDefinition.getChoices())) {
             result.put(
                     JSON_PROPERTY_TYPE_CHOICE,
                     convertChoices(propertyDefinition.getChoices(), propertyDefinition.getCardinality(), dateTimeFormat));
@@ -1712,7 +1714,7 @@ public final class JSONConverter {
                 jsonChoice.put(JSON_PROPERTY_TYPE_CHOICE_VALUE, values);
             }
 
-            if (choice.getChoice() != null && !choice.getChoice().isEmpty()) {
+            if (isNotEmpty(choice.getChoice())) {
                 jsonChoice.put(JSON_PROPERTY_TYPE_CHOICE_CHOICE,
                         convertChoices(choice.getChoice(), cardinality, dateTimeFormat));
             }
@@ -1793,7 +1795,7 @@ public final class JSONConverter {
         JSONObject result = new JSONObject();
         result.put(JSON_TYPESCONTAINER_TYPE, convert(container.getTypeDefinition(), dateTimeFormat));
 
-        if ((container.getChildren() != null) && (container.getChildren().size() > 0)) {
+        if (isNotEmpty(container.getChildren())) {
             JSONArray children = new JSONArray();
             for (TypeDefinitionContainer child : container.getChildren()) {
                 children.add(convert(child, dateTimeFormat));
@@ -2135,7 +2137,7 @@ public final class JSONConverter {
 
         List<Object> secTypeIds = getList(json.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS));
         List<TypeDefinition> secTypeDefs = null;
-        if (secTypeIds != null && !secTypeIds.isEmpty()) {
+        if (isNotEmpty(secTypeIds)) {
             secTypeDefs = new ArrayList<TypeDefinition>(secTypeIds.size());
             for (Object secTypeId : secTypeIds) {
                 if (secTypeId instanceof String) {
@@ -2730,7 +2732,7 @@ public final class JSONConverter {
 
         Object value = null;
 
-        if (ext.getChildren() != null && !ext.getChildren().isEmpty()) {
+        if (isNotEmpty(ext.getChildren())) {
             value = convertExtensionList(ext.getChildren());
         } else {
             value = ext.getValue();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.commons.impl;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.FilterInputStream;
@@ -340,7 +342,7 @@ public final class WSConverter {
         result.setRootFolder(repositoryInfo.getRootFolderId());
         result.setThinClientUri(repositoryInfo.getThinClientURI());
         result.setVendorName(repositoryInfo.getVendorName());
-        if (repositoryInfo.getExtendedFeatures().size() > 0) {
+        if (isNotEmpty(repositoryInfo.getExtendedFeatures())) {
             List<ExtensionFeature> extensionFeatures = new ArrayList<ExtensionFeature>();
             result.setExtensionFeature(extensionFeatures);
 
@@ -353,7 +355,7 @@ public final class WSConverter {
                 target.setVersionLabel(feature.getVersionLabel());
                 target.setDescription(feature.getDescription());
 
-                if (feature.getFeatureData().size() > 0) {
+                if (isNotEmpty(feature.getFeatureData())) {
                     Map<String, String> featureData = new HashMap<String, String>();
 
                     for (CmisExtensionFeatureKeyValuePair keyValue : feature.getFeatureData()) {
@@ -407,7 +409,7 @@ public final class WSConverter {
             CreatablePropertyTypesImpl target = new CreatablePropertyTypesImpl();
             result.setCreatablePropertyTypes(target);
 
-            if (creatablePropertyTypes.getCanCreate().size() > 0) {
+            if (isNotEmpty(creatablePropertyTypes.getCanCreate())) {
                 Set<PropertyType> propertyTypeSet = EnumSet.noneOf(PropertyType.class);
                 target.setCanCreate(propertyTypeSet);
                 for (EnumPropertyType propType : creatablePropertyTypes.getCanCreate()) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamHashImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamHashImpl.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamHashImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamHashImpl.java Fri Jun 27 14:51:22 2014
@@ -38,7 +38,7 @@ public class ContentStreamHashImpl imple
     public static final String ALGORITHM_SHA512 = "sha-512";
     public static final String ALGORITHM_SHA3 = "sha-3";
 
-    private final static char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
+    private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
 
     private String propertyValue;
     private String algorithm = null;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java Fri Jun 27 14:51:22 2014
@@ -53,7 +53,7 @@ public class JSONParser {
     private int status = S_INIT;
 
     private int peekStatus(LinkedList<Integer> statusStack) {
-        if (statusStack.size() == 0) {
+        if (statusStack.isEmpty()) {
             return -1;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.commons.impl.server;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.GregorianCalendar;
@@ -160,7 +162,7 @@ public abstract class AbstractCmisServic
         TypeDefinitionList children = getTypeChildren(repositoryId, typeId, includePropertyDefinitions,
                 BigInteger.valueOf(Integer.MAX_VALUE), BigInteger.ZERO, null);
 
-        if (children != null && children.getList() != null && children.getList().size() > 0) {
+        if (children != null && isNotEmpty(children.getList())) {
             for (TypeDefinition td : children.getList()) {
                 TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td);
                 addTypeChildren(repositoryId, includePropertyDefinitions, (d > 0 ? d - 1 : -1), tdc);
@@ -186,7 +188,7 @@ public abstract class AbstractCmisServic
         TypeDefinitionList children = getTypeChildren(repositoryId, container.getTypeDefinition().getId(),
                 includePropertyDefinitions, BigInteger.valueOf(Integer.MAX_VALUE), BigInteger.ZERO, null);
 
-        if (children != null && children.getList() != null && children.getList().size() > 0) {
+        if (children != null && isNotEmpty(children.getList())) {
             List<TypeDefinitionContainer> list = new ArrayList<TypeDefinitionContainer>();
             container.setChildren(list);
 
@@ -1124,7 +1126,7 @@ public abstract class AbstractCmisServic
                 // get latest version
                 List<ObjectData> versions = getAllVersions(repositoryId, object.getId(), info.getVersionSeriesId(),
                         null, Boolean.FALSE, null);
-                if (versions != null && versions.size() > 0) {
+                if (isNotEmpty(versions)) {
                     info.setWorkingCopyOriginalId(versions.get(0).getId());
                 }
             }
@@ -1155,7 +1157,7 @@ public abstract class AbstractCmisServic
             try {
                 List<ObjectParentData> parents = getObjectParents(repositoryId, object.getId(), null, Boolean.FALSE,
                         IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, null);
-                info.setHasParent(parents.size() > 0);
+                info.setHasParent(isNotEmpty(parents));
             } catch (CmisInvalidArgumentException e) {
                 info.setHasParent(false);
             }
@@ -1178,7 +1180,7 @@ public abstract class AbstractCmisServic
         // renditions
         info.setRenditionInfos(null);
         List<RenditionData> renditions = object.getRenditions();
-        if (renditions != null && renditions.size() > 0) {
+        if (isNotEmpty(renditions)) {
             List<RenditionInfo> renditionInfos = new ArrayList<RenditionInfo>();
             for (RenditionData rendition : renditions) {
                 RenditionInfoImpl renditionInfo = new RenditionInfoImpl();
@@ -1196,7 +1198,7 @@ public abstract class AbstractCmisServic
         info.setRelationshipSourceIds(null);
         info.setRelationshipTargetIds(null);
         List<ObjectData> relationships = object.getRelationships();
-        if (relationships != null && relationships.size() > 0) {
+        if (isNotEmpty(relationships)) {
             List<String> sourceIds = new ArrayList<String>();
             List<String> targetIds = new ArrayList<String>();
             for (ObjectData relationship : relationships) {
@@ -1209,10 +1211,10 @@ public abstract class AbstractCmisServic
                     targetIds.add(relationship.getId());
                 }
             }
-            if (sourceIds.size() > 0) {
+            if (isNotEmpty(sourceIds)) {
                 info.setRelationshipSourceIds(sourceIds);
             }
-            if (targetIds.size() > 0) {
+            if (isNotEmpty(targetIds)) {
                 info.setRelationshipTargetIds(targetIds);
             }
         }

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/CollectionsHelperTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/CollectionsHelperTest.java?rev=1606112&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/CollectionsHelperTest.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/CollectionsHelperTest.java Fri Jun 27 14:51:22 2014
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.commons.impl.misc;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.commons.impl.CollectionsHelper;
+import org.junit.Test;
+
+public class CollectionsHelperTest {
+
+    @Test
+    public void testHelpers() {
+        assertTrue(CollectionsHelper.isNullOrEmpty((List<String>) null));
+        assertTrue(CollectionsHelper.isNullOrEmpty((Map<String, String>) null));
+        assertFalse(CollectionsHelper.isNotEmpty((List<String>) null));
+        assertFalse(CollectionsHelper.isNotEmpty((Map<String, String>) null));
+
+        assertTrue(CollectionsHelper.isNullOrEmpty(Collections.emptyList()));
+        assertTrue(CollectionsHelper.isNullOrEmpty(Collections.emptyMap()));
+        assertFalse(CollectionsHelper.isNotEmpty(Collections.emptyList()));
+        assertFalse(CollectionsHelper.isNotEmpty(Collections.emptyMap()));
+
+        assertFalse(CollectionsHelper.isNullOrEmpty(Collections.singletonList("value")));
+        assertFalse(CollectionsHelper.isNullOrEmpty(Collections.singletonMap("key", "value")));
+        assertTrue(CollectionsHelper.isNotEmpty(Collections.singletonList("value")));
+        assertTrue(CollectionsHelper.isNotEmpty(Collections.singletonMap("key", "value")));
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/CollectionsHelperTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AbstractAtomPubServiceCall.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/AbstractAtomPubServiceCall.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AbstractAtomPubServiceCall.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AbstractAtomPubServiceCall.java Fri Jun 27 14:51:22 2014
@@ -22,6 +22,8 @@
  */
 package org.apache.chemistry.opencmis.server.impl.atompub;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.math.BigInteger;
 import java.util.GregorianCalendar;
 import java.util.List;
@@ -266,7 +268,7 @@ public abstract class AbstractAtomPubSer
         }
 
         // write children
-        if ((children != null) && (children.size() > 0)) {
+        if (isNotEmpty(children)) {
             writeObjectChildren(service, entry, info, children, repositoryId, baseUrl, cmisVersion);
         }
 
@@ -385,7 +387,7 @@ public abstract class AbstractAtomPubSer
         entry.writeDescribedByLink(compileUrl(baseUrl, RESOURCE_TYPE, type.getBaseTypeId().value()));
 
         // write children
-        if ((children != null) && (children.size() > 0)) {
+        if (isNotEmpty(children)) {
             writeTypeChildren(entry, type, children, repositoryId, baseUrl, cmisVersion);
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/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/atompub/ObjectService.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.server.impl.atompub;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintWriter;
@@ -346,7 +348,7 @@ public class ObjectService {
             FailedToDeleteData ftd = service.deleteTree(repositoryId, folderId, allVersions, unfileObjects,
                     continueOnFailure, null);
 
-            if ((ftd != null) && (ftd.getIds() != null) && (ftd.getIds().size() > 0)) {
+            if (ftd != null && isNotEmpty(ftd.getIds())) {
                 // print ids that could not be deleted
                 response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                 response.setContentType("text/plain");

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=1606112&r1=1606111&r2=1606112&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 Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.server.impl.atompub;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
@@ -115,7 +117,7 @@ public class VersioningService {
             List<ObjectData> versions = service.getAllVersions(repositoryId, objectId, versionSeriesId, filter,
                     includeAllowableActions, null);
 
-            if (versions == null || versions.isEmpty()) {
+            if (isNullOrEmpty(versions)) {
                 throw new CmisRuntimeException("Version list is null or empty!");
             }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.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/AbstractBrowserServiceCall.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.java Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.server.impl.browser;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.math.BigDecimal;
@@ -238,7 +240,7 @@ public abstract class AbstractBrowserSer
 
         // load primary type
         List<String> objectTypeIdsValues = properties.get(PropertyIds.OBJECT_TYPE_ID);
-        if (objectTypeIdsValues != null && !objectTypeIdsValues.isEmpty()) {
+        if (isNotEmpty(objectTypeIdsValues)) {
             TypeDefinition typeDef = typeCache.getTypeDefinition(objectTypeIdsValues.get(0));
             if (typeDef == null) {
                 throw new CmisInvalidArgumentException("Invalid type: " + objectTypeIdsValues.get(0));
@@ -247,7 +249,7 @@ public abstract class AbstractBrowserSer
 
         // load secondary types
         List<String> secondaryObjectTypeIdsValues = properties.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS);
-        if (secondaryObjectTypeIdsValues != null && !secondaryObjectTypeIdsValues.isEmpty()) {
+        if (isNotEmpty(secondaryObjectTypeIdsValues)) {
             for (String secTypeId : secondaryObjectTypeIdsValues) {
                 TypeDefinition typeDef = typeCache.getTypeDefinition(secTypeId);
                 if (typeDef == null) {
@@ -287,7 +289,7 @@ public abstract class AbstractBrowserSer
 
         // load secondary types
         List<String> secondaryObjectTypeIdsValues = properties.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS);
-        if (secondaryObjectTypeIdsValues != null && !secondaryObjectTypeIdsValues.isEmpty()) {
+        if (isNotEmpty(secondaryObjectTypeIdsValues)) {
             for (String secTypeId : secondaryObjectTypeIdsValues) {
                 TypeDefinition typeDef = typeCache.getTypeDefinition(secTypeId);
                 if (typeDef == null) {