mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-8969 (SVC 42) - BlogService get*
- minor: refactor BlogInfo interface/impl (collapse a few files, update imports) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28671 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
|
||||||
*
|
|
||||||
* This file is part of Alfresco
|
|
||||||
*
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.blog;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple data object for storage of blog-related data.
|
|
||||||
*
|
|
||||||
* @author Neil Mc Erlean
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
public interface BlogPostInfo
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Gets the NodeRef representing this blog-post.
|
|
||||||
*/
|
|
||||||
public NodeRef getNodeRef();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the {@link ContentModel#PROP_NAME cm:name} of the blog post.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getName();
|
|
||||||
}
|
|
@@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
|
||||||
*
|
|
||||||
* This file is part of Alfresco
|
|
||||||
*
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.blog;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple data object responsible for holding information relevant to blog post NodeRefs.
|
|
||||||
*
|
|
||||||
* @author Neil Mc Erlean
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
public class BlogPostInfoImpl implements BlogPostInfo
|
|
||||||
{
|
|
||||||
private NodeRef nodeRef;
|
|
||||||
private Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
|
|
||||||
|
|
||||||
BlogPostInfoImpl(NodeRef nodeRef, Map<QName, Serializable> properties)
|
|
||||||
{
|
|
||||||
this.nodeRef = nodeRef;
|
|
||||||
this.properties = properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see #getNodeRef()
|
|
||||||
* @see NodeRef#equals(Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (obj instanceof BlogPostInfoImpl == false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
BlogPostInfoImpl that = (BlogPostInfoImpl) obj;
|
|
||||||
return (this.getNodeRef().equals(that.getNodeRef()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see #getNodeRef()
|
|
||||||
* @see NodeRef#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return getNodeRef().hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder(80);
|
|
||||||
sb.append(BlogPostInfo.class.getSimpleName())
|
|
||||||
.append("[name=").append(getName())
|
|
||||||
.append(", nodeRef=").append(nodeRef);
|
|
||||||
sb.append("]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NodeRef getNodeRef()
|
|
||||||
{
|
|
||||||
return nodeRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return (String) properties.get(ContentModel.PROP_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -20,6 +20,7 @@ package org.alfresco.repo.blog;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.query.PagingRequest;
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -119,4 +120,38 @@ public interface BlogService
|
|||||||
* @return <tt>true</tt> if it is a draft post, else <tt>false</tt>.
|
* @return <tt>true</tt> if it is a draft post, else <tt>false</tt>.
|
||||||
*/
|
*/
|
||||||
boolean isDraftBlogPost(NodeRef blogPostNode);
|
boolean isDraftBlogPost(NodeRef blogPostNode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple data object for storage of blog-related data.
|
||||||
|
*
|
||||||
|
* @author Neil Mc Erlean
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
public class BlogPostInfo
|
||||||
|
{
|
||||||
|
private final NodeRef nodeRef;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public BlogPostInfo(NodeRef nodeRef, String name)
|
||||||
|
{
|
||||||
|
this.nodeRef = nodeRef;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets the NodeRef representing this blog-post.
|
||||||
|
*/
|
||||||
|
public NodeRef getNodeRef()
|
||||||
|
{
|
||||||
|
return nodeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link ContentModel#PROP_NAME cm:name} of the blog post.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
package org.alfresco.repo.blog;
|
package org.alfresco.repo.blog;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -192,28 +191,36 @@ public class BlogServiceImpl implements BlogService
|
|||||||
/**
|
/**
|
||||||
* This method creates a paged result set based on the supplied {@link PagingRequest} and {@link CannedQueryResults}.
|
* This method creates a paged result set based on the supplied {@link PagingRequest} and {@link CannedQueryResults}.
|
||||||
*/
|
*/
|
||||||
private PagingResults<BlogPostInfo> createPagedResults(PagingRequest pagingReq, CannedQueryResults<BlogPostInfo> results)
|
private PagingResults<BlogPostInfo> createPagedResults(PagingRequest pagingReq, final CannedQueryResults<BlogPostInfo> results)
|
||||||
{
|
{
|
||||||
List<BlogPostInfo> nodeRefs = null;
|
return new PagingResults<BlogPostInfo>()
|
||||||
if (results.getPageCount() > 0)
|
|
||||||
{
|
{
|
||||||
nodeRefs = results.getPages().get(0);
|
@Override
|
||||||
|
public String getQueryExecutionId()
|
||||||
|
{
|
||||||
|
return results.getQueryExecutionId();
|
||||||
}
|
}
|
||||||
else
|
@Override
|
||||||
|
public List<BlogPostInfo> getPage()
|
||||||
{
|
{
|
||||||
nodeRefs = Collections.emptyList();
|
return results.getPage();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
// set total count
|
public boolean hasMoreItems()
|
||||||
Pair<Integer, Integer> totalCount = null;
|
|
||||||
if (pagingReq.getRequestTotalCountMax() > 0)
|
|
||||||
{
|
{
|
||||||
totalCount = results.getTotalResultCount();
|
return results.hasMoreItems();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
boolean hasMoreItems = results.hasMoreItems();
|
public Pair<Integer, Integer> getTotalResultCount()
|
||||||
|
{
|
||||||
return new PagingBlogPostInfoResultsImpl(nodeRefs, hasMoreItems, totalCount, results.getQueryExecutionId(), true);
|
return results.getTotalResultCount();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean permissionsApplied()
|
||||||
|
{
|
||||||
|
return results.permissionsApplied();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -31,6 +31,7 @@ import java.util.List;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.query.PagingRequest;
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.policy.BehaviourFilter;
|
import org.alfresco.repo.policy.BehaviourFilter;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.site.SiteModel;
|
import org.alfresco.repo.site.SiteModel;
|
||||||
|
@@ -29,6 +29,7 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.query.CannedQuery;
|
import org.alfresco.query.CannedQuery;
|
||||||
import org.alfresco.query.CannedQueryParameters;
|
import org.alfresco.query.CannedQueryParameters;
|
||||||
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
||||||
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions;
|
import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -125,7 +126,7 @@ public class DraftsAndPublishedBlogPostsCannedQuery extends AbstractCannedQueryP
|
|||||||
|
|
||||||
if (nextNodeIsAcceptable)
|
if (nextNodeIsAcceptable)
|
||||||
{
|
{
|
||||||
filteredNodeRefs.add(new BlogPostInfoImpl(nextBlogNode, rawNodeService.getProperties(nextBlogNode)));
|
filteredNodeRefs.add(new BlogPostInfo(nextBlogNode, (String)rawNodeService.getProperty(nextBlogNode, ContentModel.PROP_NAME)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@ import org.alfresco.query.CannedQueryParameters;
|
|||||||
import org.alfresco.query.CannedQuerySortDetails;
|
import org.alfresco.query.CannedQuerySortDetails;
|
||||||
import org.alfresco.query.PagingRequest;
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
||||||
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
@@ -29,6 +29,7 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.query.CannedQuery;
|
import org.alfresco.query.CannedQuery;
|
||||||
import org.alfresco.query.CannedQueryParameters;
|
import org.alfresco.query.CannedQueryParameters;
|
||||||
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
||||||
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions;
|
import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -134,7 +135,7 @@ public class GetBlogPostsCannedQuery extends AbstractCannedQueryPermissions<Blog
|
|||||||
// If all the above conditions are true...
|
// If all the above conditions are true...
|
||||||
if (nextNodeIsAcceptable)
|
if (nextNodeIsAcceptable)
|
||||||
{
|
{
|
||||||
filteredNodeRefs.add(new BlogPostInfoImpl(nextBlogNode, rawNodeService.getProperties(nextBlogNode)));
|
filteredNodeRefs.add(new BlogPostInfo(nextBlogNode, (String)rawNodeService.getProperty(nextBlogNode, ContentModel.PROP_NAME)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@ import org.alfresco.query.CannedQueryParameters;
|
|||||||
import org.alfresco.query.CannedQuerySortDetails;
|
import org.alfresco.query.CannedQuerySortDetails;
|
||||||
import org.alfresco.query.PagingRequest;
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
||||||
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
|
||||||
*
|
|
||||||
* This file is part of Alfresco
|
|
||||||
*
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.blog;
|
|
||||||
|
|
||||||
import org.alfresco.query.PagingResults;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
public interface PagingBlogPostInfoResults extends PagingResults<BlogPostInfo>
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
|
||||||
*
|
|
||||||
* This file is part of Alfresco
|
|
||||||
*
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.blog;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.alfresco.query.PermissionedResults;
|
|
||||||
import org.alfresco.util.Pair;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple results holder object for data relating to {@link BlogPostInfo blog-posts}, as
|
|
||||||
* returned by the {@link BlogService}
|
|
||||||
*
|
|
||||||
* @since 4.0
|
|
||||||
* @author Neil Mc Erlean.
|
|
||||||
*/
|
|
||||||
class PagingBlogPostInfoResultsImpl implements PagingBlogPostInfoResults, PermissionedResults
|
|
||||||
{
|
|
||||||
private List<BlogPostInfo> blogPosts;
|
|
||||||
|
|
||||||
private boolean hasMoreItems;
|
|
||||||
private Pair<Integer, Integer> totalResultCount;
|
|
||||||
private String queryExecutionId;
|
|
||||||
private boolean permissionsApplied;
|
|
||||||
|
|
||||||
public PagingBlogPostInfoResultsImpl(List<BlogPostInfo> nodeInfos, boolean hasMoreItems, Pair<Integer, Integer> totalResultCount, String queryExecutionId, boolean permissionsApplied)
|
|
||||||
{
|
|
||||||
this.blogPosts = nodeInfos;
|
|
||||||
this.hasMoreItems = hasMoreItems;
|
|
||||||
this.totalResultCount = totalResultCount;
|
|
||||||
this.queryExecutionId = queryExecutionId;
|
|
||||||
this.permissionsApplied = permissionsApplied;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BlogPostInfo> getPage()
|
|
||||||
{
|
|
||||||
return blogPosts;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasMoreItems()
|
|
||||||
{
|
|
||||||
return hasMoreItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Pair<Integer, Integer> getTotalResultCount()
|
|
||||||
{
|
|
||||||
return totalResultCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getQueryExecutionId()
|
|
||||||
{
|
|
||||||
return queryExecutionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean permissionsApplied()
|
|
||||||
{
|
|
||||||
return permissionsApplied;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -20,6 +20,7 @@ package org.alfresco.repo.blog;
|
|||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
@@ -1,102 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
|
||||||
*
|
|
||||||
* This file is part of Alfresco
|
|
||||||
*
|
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.blog.cannedqueries;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
|
||||||
import org.alfresco.repo.blog.BlogPostInfo;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple data object responsible for holding information relevant to blog post NodeRefs.
|
|
||||||
*
|
|
||||||
* @author Neil Mc Erlean
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
public class BlogPostInfoImpl implements BlogPostInfo
|
|
||||||
{
|
|
||||||
private NodeRef nodeRef;
|
|
||||||
private Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
|
|
||||||
|
|
||||||
BlogPostInfoImpl(NodeRef nodeRef, Map<QName, Serializable> properties)
|
|
||||||
{
|
|
||||||
this.nodeRef = nodeRef;
|
|
||||||
this.properties = properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see #getNodeRef()
|
|
||||||
* @see NodeRef#equals(Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (obj instanceof BlogPostInfoImpl == false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
BlogPostInfoImpl that = (BlogPostInfoImpl) obj;
|
|
||||||
return (this.getNodeRef().equals(that.getNodeRef()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see #getNodeRef()
|
|
||||||
* @see NodeRef#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return getNodeRef().hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder(80);
|
|
||||||
sb.append(BlogPostInfo.class.getSimpleName())
|
|
||||||
.append("[name=").append(getName())
|
|
||||||
.append(", nodeRef=").append(nodeRef);
|
|
||||||
sb.append("]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NodeRef getNodeRef()
|
|
||||||
{
|
|
||||||
return nodeRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return (String) properties.get(ContentModel.PROP_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -29,8 +29,8 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.query.CannedQuery;
|
import org.alfresco.query.CannedQuery;
|
||||||
import org.alfresco.query.CannedQueryParameters;
|
import org.alfresco.query.CannedQueryParameters;
|
||||||
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
||||||
import org.alfresco.repo.blog.BlogPostInfo;
|
|
||||||
import org.alfresco.repo.blog.BlogService;
|
import org.alfresco.repo.blog.BlogService;
|
||||||
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions;
|
import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -127,7 +127,7 @@ public class DraftsAndPublishedBlogPostsCannedQuery extends AbstractCannedQueryP
|
|||||||
|
|
||||||
if (nextNodeIsAcceptable)
|
if (nextNodeIsAcceptable)
|
||||||
{
|
{
|
||||||
filteredNodeRefs.add(new BlogPostInfoImpl(nextBlogNode, rawNodeService.getProperties(nextBlogNode)));
|
filteredNodeRefs.add(new BlogPostInfo(nextBlogNode, (String)rawNodeService.getProperty(nextBlogNode, ContentModel.PROP_NAME)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ import org.alfresco.query.CannedQueryParameters;
|
|||||||
import org.alfresco.query.CannedQuerySortDetails;
|
import org.alfresco.query.CannedQuerySortDetails;
|
||||||
import org.alfresco.query.PagingRequest;
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
||||||
import org.alfresco.repo.blog.BlogPostInfo;
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
@@ -29,8 +29,8 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.query.CannedQuery;
|
import org.alfresco.query.CannedQuery;
|
||||||
import org.alfresco.query.CannedQueryParameters;
|
import org.alfresco.query.CannedQueryParameters;
|
||||||
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
||||||
import org.alfresco.repo.blog.BlogPostInfo;
|
|
||||||
import org.alfresco.repo.blog.BlogService;
|
import org.alfresco.repo.blog.BlogService;
|
||||||
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions;
|
import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -136,7 +136,7 @@ public class GetBlogPostsCannedQuery extends AbstractCannedQueryPermissions<Blog
|
|||||||
// If all the above conditions are true...
|
// If all the above conditions are true...
|
||||||
if (nextNodeIsAcceptable)
|
if (nextNodeIsAcceptable)
|
||||||
{
|
{
|
||||||
filteredNodeRefs.add(new BlogPostInfoImpl(nextBlogNode, rawNodeService.getProperties(nextBlogNode)));
|
filteredNodeRefs.add(new BlogPostInfo(nextBlogNode, (String)rawNodeService.getProperty(nextBlogNode, ContentModel.PROP_NAME)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,8 +33,8 @@ import org.alfresco.query.CannedQueryParameters;
|
|||||||
import org.alfresco.query.CannedQuerySortDetails;
|
import org.alfresco.query.CannedQuerySortDetails;
|
||||||
import org.alfresco.query.PagingRequest;
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
import org.alfresco.query.CannedQuerySortDetails.SortOrder;
|
||||||
import org.alfresco.repo.blog.BlogPostInfo;
|
|
||||||
import org.alfresco.repo.blog.BlogService;
|
import org.alfresco.repo.blog.BlogService;
|
||||||
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
@@ -20,7 +20,7 @@ package org.alfresco.repo.blog.cannedqueries;
|
|||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import org.alfresco.repo.blog.BlogPostInfo;
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ import org.alfresco.cmis.CMISResultSet;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
import org.alfresco.query.PermissionedResults;
|
import org.alfresco.query.PermissionedResults;
|
||||||
import org.alfresco.repo.blog.BlogPostInfo;
|
import org.alfresco.repo.blog.BlogService.BlogPostInfo;
|
||||||
import org.alfresco.repo.search.SimpleResultSetMetaData;
|
import org.alfresco.repo.search.SimpleResultSetMetaData;
|
||||||
import org.alfresco.repo.search.impl.lucene.PagingLuceneResultSet;
|
import org.alfresco.repo.search.impl.lucene.PagingLuceneResultSet;
|
||||||
import org.alfresco.repo.search.impl.lucene.SolrJSONResultSet;
|
import org.alfresco.repo.search.impl.lucene.SolrJSONResultSet;
|
||||||
|
Reference in New Issue
Block a user