ALF-9385. Changing return-type of BlogService.createBlogPost to BlogPostInfo. Was ChAssRef which is inconsistent with the rest of the class API.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28909 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2011-07-11 11:01:09 +00:00
parent a3b630be98
commit 4263281278
3 changed files with 26 additions and 28 deletions

View File

@@ -24,7 +24,6 @@ import org.alfresco.model.ContentModel;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.repo.security.permissions.PermissionCheckValue;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.site.SiteService;
@@ -48,11 +47,11 @@ public interface BlogService
* @param blogContent text/html content of the blog post.
* @param isDraft <tt>true</tt> if the blog post is a draft post, else <tt>false</tt>.
*
* @return The {@link ChildAssociationRef} of the newly created blog post.
* @return The {@link BlogPostInfo} of the newly created blog post.
*
* @see SiteService#getContainer(String, String) to retrieve the blogContainerNode
*/
ChildAssociationRef createBlogPost(NodeRef blogContainerNode, String blogTitle,
BlogPostInfo createBlogPost(NodeRef blogContainerNode, String blogTitle,
String blogContent, boolean isDraft);
/**
@@ -124,7 +123,7 @@ public interface BlogService
* @see SiteService#getContainer(String, String) to retrieve the blogContainerNode
*/
PagingResults<BlogPostInfo> findTaggedBlogPosts(NodeRef blogContainerNode, String tag, PagingRequest pagingReq);
/**
* Returns true if the specified blog-post node is a 'draft' blog post.
*

View File

@@ -130,10 +130,10 @@ public class BlogServiceImpl implements BlogService
}
@Override
public ChildAssociationRef createBlogPost(NodeRef blogContainerNode, String blogTitle,
public BlogPostInfo createBlogPost(NodeRef blogContainerNode, String blogTitle,
String blogContent, boolean isDraft)
{
String nodeName = getUniqueChildName(blogContainerNode, "post");
final String nodeName = getUniqueChildName(blogContainerNode, "post");
// we simply create a new file inside the blog folder
Map<QName, Serializable> nodeProps = new HashMap<QName, Serializable>();
@@ -161,7 +161,7 @@ public class BlogServiceImpl implements BlogService
setOrUpdateReleasedAndUpdatedDates(postNode.getChildRef());
}
return postNode;
return new BlogPostInfo(postNode.getChildRef(), nodeName);
}
@Override

View File

@@ -39,7 +39,6 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.MutableAuthenticationService;
@@ -209,10 +208,10 @@ public class BlogServiceImplTest
for (int i = 0; i < arbitraryNumberGreaterThanPageSize; i++)
{
ChildAssociationRef newBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "title_" + i, "Hello world", true);
BlogPostInfo newBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "title_" + i, "Hello world", true);
results.add(newBlogPost.getChildRef());
testNodesToTidy.add(newBlogPost.getChildRef());
results.add(newBlogPost.getNodeRef());
testNodesToTidy.add(newBlogPost.getNodeRef());
}
return results;
@@ -301,11 +300,11 @@ public class BlogServiceImplTest
@Override
public NodeRef execute() throws Throwable
{
ChildAssociationRef newBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "draftWithTag", "Hello world", true);
TAGGING_SERVICE.addTags(newBlogPost.getChildRef(), tags);
testNodesToTidy.add(newBlogPost.getChildRef());
BlogPostInfo newBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "draftWithTag", "Hello world", true);
TAGGING_SERVICE.addTags(newBlogPost.getNodeRef(), tags);
testNodesToTidy.add(newBlogPost.getNodeRef());
return newBlogPost.getChildRef();
return newBlogPost.getNodeRef();
}
});
@@ -343,13 +342,13 @@ public class BlogServiceImplTest
@Override
public Pair<NodeRef, NodeRef> execute() throws Throwable
{
ChildAssociationRef newDraftBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "adminDraft", "", true);
testNodesToTidy.add(newDraftBlogPost.getChildRef());
BlogPostInfo newDraftBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "adminDraft", "", true);
testNodesToTidy.add(newDraftBlogPost.getNodeRef());
ChildAssociationRef newPublishedBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "adminPublished", "", false);
testNodesToTidy.add(newPublishedBlogPost.getChildRef());
BlogPostInfo newPublishedBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "adminPublished", "", false);
testNodesToTidy.add(newPublishedBlogPost.getNodeRef());
return new Pair<NodeRef, NodeRef>(newDraftBlogPost.getChildRef(), newPublishedBlogPost.getChildRef());
return new Pair<NodeRef, NodeRef>(newDraftBlogPost.getNodeRef(), newPublishedBlogPost.getNodeRef());
}
});
@@ -361,13 +360,13 @@ public class BlogServiceImplTest
@Override
public Pair<NodeRef, NodeRef> execute() throws Throwable
{
ChildAssociationRef newDraftBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "userDraft", "", true);
testNodesToTidy.add(newDraftBlogPost.getChildRef());
BlogPostInfo newDraftBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "userDraft", "", true);
testNodesToTidy.add(newDraftBlogPost.getNodeRef());
ChildAssociationRef newPublishedBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "userPublished", "", false);
testNodesToTidy.add(newPublishedBlogPost.getChildRef());
BlogPostInfo newPublishedBlogPost = BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "userPublished", "", false);
testNodesToTidy.add(newPublishedBlogPost.getNodeRef());
return new Pair<NodeRef, NodeRef>(newDraftBlogPost.getChildRef(), newPublishedBlogPost.getChildRef());
return new Pair<NodeRef, NodeRef>(newDraftBlogPost.getNodeRef(), newPublishedBlogPost.getNodeRef());
}
});
@@ -433,11 +432,11 @@ public class BlogServiceImplTest
for (int i = 0; i < numberOfPosts; i++)
{
ChildAssociationRef newBlogPost =
BlogPostInfo newBlogPost =
BLOG_SERVICE.createBlogPost(BLOG_CONTAINER_NODE, "date-specific-post" + i, "", false);
testNodesToTidy.add(newBlogPost.getChildRef());
testNodesToTidy.add(newBlogPost.getNodeRef());
results.add(newBlogPost.getChildRef());
results.add(newBlogPost.getNodeRef());
}
return results;