ALF-9321 (RINF 11): CQ permissions

- minor: push down common method lookup code

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28640 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2011-06-28 08:03:21 +00:00
parent 97f676b895
commit bde2b2e293
13 changed files with 45 additions and 132 deletions

View File

@@ -18,12 +18,10 @@
*/
package org.alfresco.repo.blog;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.query.AbstractCannedQueryFactory;
import org.alfresco.query.CannedQuery;
@@ -88,27 +86,12 @@ public class DraftsAndPublishedBlogPostsCannedQueryFactory extends AbstractCanne
@Override
public CannedQuery<BlogPostInfo> getCannedQuery(CannedQueryParameters parameters)
{
Method method = null;
for (Method m : methodService.getClass().getMethods())
{
// note: currently matches first found
if (m.getName().equals(methodName))
{
method = m;
break;
}
}
if (method == null)
{
throw new AlfrescoRuntimeException("Method not found: "+methodName);
}
// if not passed in (TODO or not in future cache) then generate a new query execution id
String queryExecutionId = (parameters.getQueryExecutionId() == null ? super.getQueryExecutionId(parameters) : parameters.getQueryExecutionId());
final DraftsAndPublishedBlogPostsCannedQuery cq = new DraftsAndPublishedBlogPostsCannedQuery(rawNodeService, taggingService,
methodSecurityInterceptor, method, parameters, queryExecutionId);
methodSecurityInterceptor, methodService, methodName,
parameters, queryExecutionId);
return (CannedQuery<BlogPostInfo>) cq;
}