Switch the Links creating webscript to be Java backed using the new service, and enhance unit tests

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30108 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-08-26 15:37:27 +00:00
parent 999cdcb5bd
commit 79ab65935c
3 changed files with 38 additions and 0 deletions

View File

@@ -40,6 +40,8 @@ import org.alfresco.repo.site.SiteServiceImpl;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.links.LinkInfo;
import org.alfresco.service.cmr.links.LinksService;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
@@ -79,6 +81,7 @@ public class LinksServiceImpl implements LinksService
private NodeService nodeService;
private SiteService siteService;
private SearchService searchService;
private ContentService contentService;
private TaggingService taggingService;
private NamespaceService namespaceService;
private DictionaryService dictionaryService;
@@ -105,6 +108,11 @@ public class LinksServiceImpl implements LinksService
this.searchService = searchService;
}
public void setContentService(ContentService contentService)
{
this.contentService = contentService;
}
public void setTaggingService(TaggingService taggingService)
{
this.taggingService = taggingService;
@@ -232,6 +240,11 @@ public class LinksServiceImpl implements LinksService
props
).getChildRef();
// Duplicate the url into the node as the content property
ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
writer.setEncoding("UTF-8");
writer.putContent(url);
// Generate the wrapping object for it
// Build it that way, so creator and created date come through
return buildLink(nodeRef, container, name);
@@ -270,6 +283,11 @@ public class LinksServiceImpl implements LinksService
}
}
// Duplicate the url into the node as the content property
ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
writer.setEncoding("UTF-8");
writer.putContent(link.getURL());
// Now do the tags
taggingService.setTags(nodeRef, link.getTags());