diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/channels.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/channels.get.desc.xml
index a8315255a5..69691f85bb 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/channels.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/channels.get.desc.xml
@@ -39,9 +39,11 @@
{
"url": string,
"name": string,
+ "title": string,
"channelType":
{
"id": string,
+ "title": string,
"url": string,
"channelNodeType": string,
"contentRootNodeType": string,
@@ -61,9 +63,11 @@
{
"url": string,
"name": string,
+ "title": string,
"channelType":
{
"id": string,
+ "title": string,
"url": string,
"channelNodeType": string,
"contentRootNodeType": string,
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/channels.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/channels.get.json.ftl
index f62df898ae..8658650106 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/channels.get.json.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/channels.get.json.ftl
@@ -2,10 +2,11 @@
<#import "publishing.lib.ftl" as publishLib />
{
"data":
- [
- <#list data as channel>
- <@publishLib.channelJSON channel=channel />
- <#if channel_has_next>,#if>
- #list>
- ]
+ {
+ urlLength: ${data.urlLength},
+ "publishChannels":
+ <@publishLib.channelsJSON channels=data.publishChannels />,
+ "statusUpdateChannels":
+ <@publishLib.channelsJSON channels=data.statusUpdateChannels />
+ }
}
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/publishing.lib.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/publishing.lib.ftl
index b30875664c..2be177a135 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/publishing.lib.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/publishing.lib.ftl
@@ -1,20 +1,31 @@
+<#-- Renders a List of Channel.s -->
+<#macro channelsJSON channels>
+<#escape x as jsonUtils.encodeJSONString(x)>
+ [
+ <#list channels as channel>
+ <@channelJSON channel=channel />
+ <#if channel_has_next>,#if>
+ #list>
+ ]
+#escape>
+#macro>
+
<#-- Renders a Channel. -->
<#macro channelJSON channel>
-<#escape x as jsonUtils.encodeJSONString(x)>
{
"url": "${channel.url}",
"name": "${channel.name}",
+ "title": "${channel.title}",
"channelType":
<@channelTypeJSON type=channel.channelType />
}
-#escape>
#macro>
<#-- Renders a Channel Type. -->
<#macro channelTypeJSON type>
-<#escape x as jsonUtils.encodeJSONString(x)>
{
"id": "${type.id}",
+ "title": "${type.title}",
"url": "${type.url}",
"channelNodeType": "${type.channelNodeType}",
"contentRootNodeType": "${type.contentRootNodeType}",
@@ -22,21 +33,20 @@
<@iterateStringsJSON strings=type.supportedContentTypes />,
"supportedMimeTypes":
<@iterateStringsJSON strings=type.supportedMimeTypes/>,
- "canPublish": "${type.canPublish}",
- "canPublishStatusUpdates": "${type.canPublishStatusUpdates}",
- "canUnpublish": "${type.canUnpublish}"
+ "canPublish": ${type.canPublish},
+ "canPublishStatusUpdates": ${type.canPublishStatusUpdates},
+ "canUnpublish": ${type.canUnpublish},
+ "maxStatusLength": ${type.maxStatusLength},
+ "icon": "${type.icon}"
}
-#escape>
#macro>
<#-- Renders a List of Strings. -->
<#macro iterateStringsJSON strings>
-<#escape x as jsonUtils.encodeJSONString(x)>
[
<#list strings as string>
"${string}"
<#if string_has_next>,#if>
#list>
]
-#escape>
#macro>
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/supported-channels.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/supported-channels.get.desc.xml
deleted file mode 100644
index 820a0de5dc..0000000000
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/publishing/supported-channels.get.desc.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
- Get Supported Delivery Channels
- Get the publishing channels for the specified Node.
- /api/publishing/{store_protocol}/{store_id}/{node_id}/channels
-
- user
- required
- public_api
-
-
- store_protocol
- The Store protocol.
-
-
- store_id
- The Store id.
-
-
- node_id
- The Node id.
-
-
-
-
- json
-
-
-
-
-
-
\ No newline at end of file
diff --git a/source/java/org/alfresco/repo/web/scripts/publishing/ChannelsGet.java b/source/java/org/alfresco/repo/web/scripts/publishing/ChannelsGet.java
index 13cd86c795..24d6f69725 100644
--- a/source/java/org/alfresco/repo/web/scripts/publishing/ChannelsGet.java
+++ b/source/java/org/alfresco/repo/web/scripts/publishing/ChannelsGet.java
@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import org.alfresco.service.cmr.publishing.channels.Channel;
import org.alfresco.service.cmr.publishing.channels.ChannelService;
+import org.alfresco.service.cmr.repository.NodeRef;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
@@ -40,18 +41,25 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
*/
public class ChannelsGet extends DeclarativeWebScript
{
- public static final String DATA_KEY = "data";
public static final String SITE_ID = "site_id";
+ public static final String STORE_PROTOCOL = "store_protocol";
+ public static final String STORE_ID = "store_id";
+ public static final String NODE_ID = "node_id";
+
+ // Model Keys
+ public static final String DATA_KEY = "data";
+ public static final String URL_LENGTH = "urlLength";
+ public static final String PUBLISHING_CHANNELS = "publishChannels";
+ public static final String STATUS_UPDATE_CHANNELS = "statusUpdateChannels";
private ChannelService channelService;
-
+
/**
* {@inheritDoc}
*/
@Override
protected Map executeImpl(WebScriptRequest req, Status status, Cache cache)
{
-
PublishingModelBuilder builder = new PublishingModelBuilder();
return buildModel(builder, req, status, cache);
}
@@ -61,14 +69,46 @@ public class ChannelsGet extends DeclarativeWebScript
{
Map params = req.getServiceMatch().getTemplateVars();
String siteId = params.get(SITE_ID);
- if (siteId== null)
+
+ List publishingChannels;
+ List statusUpdateChannels;
+ if (siteId!= null)
{
- throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "A Site ID must be specified!");
+ publishingChannels = channelService.getPublishingChannels(siteId);
+ statusUpdateChannels = channelService.getStatusUpdateChannels(siteId);
+ }
+ else
+ {
+ NodeRef node = getNodeRef(params);
+ if(node == null)
+ {
+ String msg = "Either a Site ID or valid NodeRef must be specified!";
+ throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, msg);
+ }
+ publishingChannels = channelService.getRelevantPublishingChannels(node);
+ statusUpdateChannels = channelService.getStatusUpdateChannels(node);
}
- List channels = channelService.getChannels(siteId);
- List