From e85914c8572eb0b9d4d78f72792a69f42df746c9 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Tue, 27 Mar 2018 15:29:16 +0100 Subject: [PATCH] RM-6249 Don't update the declassification date of nodes with exemptions. --- .../util/RMCollectionUtils.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java index 3b0c7a094f..4b423b7598 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java @@ -39,6 +39,8 @@ import java.util.Set; import com.google.common.collect.ImmutableSet; +import org.apache.commons.collections.CollectionUtils; + /** * Various common helper methods for Collections. This class is probably only appropriate for use with relatively * small collections as it has not been optimised for dealing with large collections. @@ -226,4 +228,21 @@ public final class RMCollectionUtils } return ImmutableSet.copyOf(collection); } + + /** + * Check if a property is null or an empty collection. Note that this is the same as + * {org.apache.commons.collections.CollectionUtils.isEmpty(Collection)}, except that it takes a Serializable rather + * than a Collection. This avoids awkward casting exceptions when working with properties. + * + * @param value The (probably Collection) value to check. + * @return true if the supplied value is null or an empty collection. + */ + public static boolean isEmpty(Serializable value) + { + if (value instanceof Collection) + { + return CollectionUtils.isEmpty((Collection) value); + } + return (value == null); + } }