From dbf513442236a52d75d32f96fc7da78e99f6acbd Mon Sep 17 00:00:00 2001 From: David Webster Date: Tue, 20 Oct 2015 09:11:29 +0000 Subject: [PATCH] ACE-4174: Add concept of hidden channels to ChannelService and mark old core social publishing channels as hidden by default. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@114759 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/facebook-publishing-context.xml | 1 + config/alfresco/flickr-publishing-context.xml | 1 + config/alfresco/linkedin-publishing-context.xml | 1 + config/alfresco/slideshare-publishing-context.xml | 1 + config/alfresco/twitter-publishing-context.xml | 1 + config/alfresco/youtube-publishing-context.xml | 1 + .../repo/publishing/AbstractChannelType.java | 12 ++++++++++++ .../alfresco/repo/publishing/ChannelServiceImpl.java | 10 +++++++++- .../cmr/publishing/channels/ChannelService.java | 2 +- .../service/cmr/publishing/channels/ChannelType.java | 12 ++++++++++++ 10 files changed, 40 insertions(+), 2 deletions(-) diff --git a/config/alfresco/facebook-publishing-context.xml b/config/alfresco/facebook-publishing-context.xml index b2784558e6..abb5d6aaf2 100644 --- a/config/alfresco/facebook-publishing-context.xml +++ b/config/alfresco/facebook-publishing-context.xml @@ -20,6 +20,7 @@ + diff --git a/config/alfresco/flickr-publishing-context.xml b/config/alfresco/flickr-publishing-context.xml index 83cd3d888a..10dd078202 100644 --- a/config/alfresco/flickr-publishing-context.xml +++ b/config/alfresco/flickr-publishing-context.xml @@ -23,6 +23,7 @@ + diff --git a/config/alfresco/linkedin-publishing-context.xml b/config/alfresco/linkedin-publishing-context.xml index 9f0e6d7de3..db1c40bce8 100644 --- a/config/alfresco/linkedin-publishing-context.xml +++ b/config/alfresco/linkedin-publishing-context.xml @@ -21,6 +21,7 @@ + diff --git a/config/alfresco/slideshare-publishing-context.xml b/config/alfresco/slideshare-publishing-context.xml index 6b18d27423..f7c90fb762 100644 --- a/config/alfresco/slideshare-publishing-context.xml +++ b/config/alfresco/slideshare-publishing-context.xml @@ -32,6 +32,7 @@ + diff --git a/config/alfresco/twitter-publishing-context.xml b/config/alfresco/twitter-publishing-context.xml index 8c7c4ff7ca..5d40a0a602 100644 --- a/config/alfresco/twitter-publishing-context.xml +++ b/config/alfresco/twitter-publishing-context.xml @@ -26,6 +26,7 @@ + diff --git a/config/alfresco/youtube-publishing-context.xml b/config/alfresco/youtube-publishing-context.xml index 709260f398..68122bccc6 100644 --- a/config/alfresco/youtube-publishing-context.xml +++ b/config/alfresco/youtube-publishing-context.xml @@ -26,5 +26,6 @@ + diff --git a/source/java/org/alfresco/repo/publishing/AbstractChannelType.java b/source/java/org/alfresco/repo/publishing/AbstractChannelType.java index c84c347294..32e660b105 100644 --- a/source/java/org/alfresco/repo/publishing/AbstractChannelType.java +++ b/source/java/org/alfresco/repo/publishing/AbstractChannelType.java @@ -46,6 +46,7 @@ public abstract class AbstractChannelType implements ChannelType, ChannelTypePub private NodeService nodeService; private ChannelService channelService; private MetadataEncryptor encryptor; + private boolean hidden = false; public void setChannelService(ChannelService channelService) { @@ -197,4 +198,15 @@ public abstract class AbstractChannelType implements ChannelType, ChannelTypePub return url; } + @Override + public boolean isHidden() + { + return hidden; + } + + @Override + public void setHidden(boolean hidden) + { + this.hidden = hidden; + } } diff --git a/source/java/org/alfresco/repo/publishing/ChannelServiceImpl.java b/source/java/org/alfresco/repo/publishing/ChannelServiceImpl.java index 26cb5192dd..4556b835a8 100644 --- a/source/java/org/alfresco/repo/publishing/ChannelServiceImpl.java +++ b/source/java/org/alfresco/repo/publishing/ChannelServiceImpl.java @@ -118,7 +118,15 @@ public class ChannelServiceImpl implements ChannelService */ public List getChannelTypes() { - return new ArrayList(channelTypes.values()); + List result = new ArrayList(); + for (ChannelType channelType : channelTypes.values()) + { + if (!channelType.isHidden()) + { + result.add(channelType); + } + } + return result; } /** diff --git a/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java b/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java index 4a0e596bad..70e530d88f 100644 --- a/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java +++ b/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java @@ -53,7 +53,7 @@ public interface ChannelService ChannelType getChannelType(String id); /** - * Retrieve all the registered channel types + * Retrieve all the registered channel types, excluding any that are hidden * @return A list of ChannelType objects, each representing a channel type registered with this channel service */ @NotAuditable diff --git a/source/java/org/alfresco/service/cmr/publishing/channels/ChannelType.java b/source/java/org/alfresco/service/cmr/publishing/channels/ChannelType.java index 49d96e49ed..624eaf0d83 100644 --- a/source/java/org/alfresco/service/cmr/publishing/channels/ChannelType.java +++ b/source/java/org/alfresco/service/cmr/publishing/channels/ChannelType.java @@ -160,4 +160,16 @@ public interface ChannelType * @return The resource that represents the requested icon if available. null otherwise. */ Resource getIcon(String size); + + /** + * If a channel type is hidden then it doesn't appear in the list returned by {@link ChannelService#getChannelTypes()} + * @param hidden + */ + void setHidden(boolean hidden); + + /** + * If a channel type is hidden then it doesn't appear in the list returned by {@link ChannelService#getChannelTypes()} + * @param hidden + */ + boolean isHidden(); }