ALF-9157 Wiki Page Service CRUD unit tests (listing ones to follow)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29540 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-08-03 22:13:41 +00:00
parent 8a5a23c3b9
commit abeaaa4ca4
2 changed files with 53 additions and 50 deletions

View File

@@ -202,7 +202,7 @@ public class WikiPageServiceImpl implements WikiPageService
).getChildRef();
// Store the content
ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, false);
ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
writer.setEncoding("UTF-8");
writer.putContent(content);
@@ -223,11 +223,13 @@ public class WikiPageServiceImpl implements WikiPageService
NodeRef nodeRef = page.getNodeRef();
// Handle the rename case
boolean renamed = false;
if(! nodeService.getProperty(nodeRef, ContentModel.PROP_NAME).equals(page.getTitle()))
{
try
{
fileFolderService.rename(nodeRef, page.getTitle());
renamed = true;
}
catch(FileNotFoundException e)
{
@@ -245,6 +247,12 @@ public class WikiPageServiceImpl implements WikiPageService
// Now do the tags
taggingService.setTags(nodeRef, page.getTags());
// If we re-named, re-create the object
if(renamed)
{
page = buildPage(nodeRef, page.getContainerNodeRef(), page.getTitle(), page.getContents());
}
// All done
return page;
}