Added UrlShortener interface/implementation. Included support for shortening of Urls generated through publishing of content.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29014 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
N Smith
2011-07-14 09:11:04 +00:00
parent 9112f357a4
commit 9c47d8662e
2 changed files with 13 additions and 2 deletions

View File

@@ -1107,6 +1107,7 @@
class="org.alfresco.repo.web.scripts.publishing.ChannelsGet" class="org.alfresco.repo.web.scripts.publishing.ChannelsGet"
parent="webscript"> parent="webscript">
<property name="channelService" ref="channelService" /> <property name="channelService" ref="channelService" />
<property name="urlShortener" ref="urlShortener" />
</bean> </bean>
<!-- Get Channel Types web script --> <!-- Get Channel Types web script -->

View File

@@ -34,6 +34,7 @@ import org.alfresco.repo.web.scripts.WebScriptUtil;
import org.alfresco.service.cmr.publishing.channels.Channel; import org.alfresco.service.cmr.publishing.channels.Channel;
import org.alfresco.service.cmr.publishing.channels.ChannelService; import org.alfresco.service.cmr.publishing.channels.ChannelService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.urlshortening.UrlShortener;
import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.Status;
@@ -49,6 +50,7 @@ public class ChannelsGet extends DeclarativeWebScript
{ {
private final PublishingModelBuilder builder = new PublishingModelBuilder(); private final PublishingModelBuilder builder = new PublishingModelBuilder();
private ChannelService channelService; private ChannelService channelService;
private UrlShortener urlShortener;
/** /**
* {@inheritDoc} * {@inheritDoc}
@@ -81,7 +83,7 @@ public class ChannelsGet extends DeclarativeWebScript
Map<String, Object> model = new HashMap<String, Object>(); Map<String, Object> model = new HashMap<String, Object>();
//TODO Implement URL shortening. //TODO Implement URL shortening.
model.put(URL_LENGTH, 20); model.put(URL_LENGTH, urlShortener.getUrlLength());
model.put(PUBLISHING_CHANNELS, builder.buildChannels(publishingChannels)); model.put(PUBLISHING_CHANNELS, builder.buildChannels(publishingChannels));
model.put(STATUS_UPDATE_CHANNELS, builder.buildChannels(statusUpdateChannels)); model.put(STATUS_UPDATE_CHANNELS, builder.buildChannels(statusUpdateChannels));
@@ -95,4 +97,12 @@ public class ChannelsGet extends DeclarativeWebScript
{ {
this.channelService = channelService; this.channelService = channelService;
} }
/**
* @param urlShortener the urlShortener to set
*/
public void setUrlShortener(UrlShortener urlShortener)
{
this.urlShortener = urlShortener;
}
} }