ALF-9157 Start on unit tests for the new (lucene free) wiki page service

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29537 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-08-03 17:40:32 +00:00
parent b9fa6b7958
commit 8a5a23c3b9
2 changed files with 806 additions and 8 deletions

View File

@@ -62,7 +62,7 @@ public class WikiPageServiceImpl implements WikiPageService
{
public static final String WIKI_COMPONENT = "wiki";
protected static final String CANNED_QUERY_GET_CHILDREN = "linksGetChildrenCannedQueryFactory";
protected static final String CANNED_QUERY_GET_CHILDREN = "wikiGetChildrenCannedQueryFactory";
/**
* The logger
@@ -126,7 +126,7 @@ public class WikiPageServiceImpl implements WikiPageService
siteService, transactionService, taggingService);
}
private WikiPageInfo buildPage(NodeRef nodeRef, NodeRef container, String name)
private WikiPageInfo buildPage(NodeRef nodeRef, NodeRef container, String name, String preLoadedContents)
{
WikiPageInfoImpl page = new WikiPageInfoImpl(nodeRef, container, name);
@@ -135,13 +135,24 @@ public class WikiPageServiceImpl implements WikiPageService
// Start with the auditable properties
page.setCreator((String)props.get(ContentModel.PROP_CREATOR));
page.setModifier((String)props.get(ContentModel.PROP_MODIFIED));
page.setModifier((String)props.get(ContentModel.PROP_MODIFIER));
page.setCreatedAt((Date)props.get(ContentModel.PROP_CREATED));
page.setModifiedAt((Date)props.get(ContentModel.PROP_MODIFIED));
// Now the wiki ones
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
page.setContents(reader.getContentString());
page.setTitle((String)props.get(ContentModel.PROP_TITLE));
// Finally, do the content
String contents = preLoadedContents;
if(contents == null)
{
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
if(reader != null)
{
contents = reader.getContentString();
}
}
page.setContents(contents);
// Finally tags
page.setTags(taggingService.getTags(nodeRef));
@@ -164,7 +175,7 @@ public class WikiPageServiceImpl implements WikiPageService
NodeRef link = nodeService.getChildByName(container, ContentModel.ASSOC_CONTAINS, pageName);
if(link != null)
{
return buildPage(link, container, pageName);
return buildPage(link, container, pageName, null);
}
return null;
}
@@ -197,7 +208,7 @@ public class WikiPageServiceImpl implements WikiPageService
// Generate the wrapping object for it
// Build it that way, so creator and created date come through
return buildPage(nodeRef, container, title);
return buildPage(nodeRef, container, title, content);
}
@Override
@@ -320,7 +331,7 @@ public class WikiPageServiceImpl implements WikiPageService
{
NodeRef nodeRef = node.getNodeRef();
String name = node.getName();
pages.add(buildPage(nodeRef, container, name));
pages.add(buildPage(nodeRef, container, name, null));
}
return pages;
}