mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-22 15:12:38 +00:00
Merged 5.0.N (5.0.4) to 5.1.N (5.1.1)
123098 rmunteanu: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4)
122976 tvalkevych: MNT-15783: Merged V4.2.4 (4.2.4.20) to V4.2-BUG-FIX (4.2.7)
113807 adragoi: Merged DEV to V4.2.4 (4.2.4.16)
113780: MNT-12240 : Loading of available Tags is slow at 'Edit Properties' -> 'Select Tags' dialog.
- limited query results sin webscript
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@123152 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,6 +22,7 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -138,6 +139,23 @@ public final class Classification extends BaseScopableProcessorExtension
|
|||||||
return Context.getCurrentContext().newArray(getScope(), cats);
|
return Context.getCurrentContext().newArray(getScope(), cats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get ordered, filtered and paged root categories in a classification.
|
||||||
|
*
|
||||||
|
* @param aspect
|
||||||
|
* @param filter
|
||||||
|
* @param maxItems
|
||||||
|
* @param skipCount (offset)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Scriptable getRootCategories(String aspect, String filter, int maxItems, int skipCount)
|
||||||
|
{
|
||||||
|
PagingRequest pagingRequest = new PagingRequest(skipCount, maxItems);
|
||||||
|
List<ChildAssociationRef> rootCategories = services.getCategoryService().getRootCategories(storeRef, createQName(aspect), pagingRequest, true, filter).getPage();
|
||||||
|
Object[] cats = buildCategoryNodes(rootCategories);
|
||||||
|
return Context.getCurrentContext().newArray(getScope(), cats);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the category usage count.
|
* Get the category usage count.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -370,6 +370,11 @@ public class LuceneCategoryServiceImpl implements CategoryService
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PagingResults<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, PagingRequest pagingRequest, boolean sortByName)
|
public PagingResults<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, PagingRequest pagingRequest, boolean sortByName)
|
||||||
|
{
|
||||||
|
return getRootCategories(storeRef, aspectName, pagingRequest, sortByName, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagingResults<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, PagingRequest pagingRequest, boolean sortByName, String filter)
|
||||||
{
|
{
|
||||||
final List<ChildAssociationRef> assocs = new LinkedList<ChildAssociationRef>();
|
final List<ChildAssociationRef> assocs = new LinkedList<ChildAssociationRef>();
|
||||||
Set<NodeRef> nodeRefs = getClassificationNodes(storeRef, aspectName);
|
Set<NodeRef> nodeRefs = getClassificationNodes(storeRef, aspectName);
|
||||||
@@ -382,7 +387,7 @@ public class LuceneCategoryServiceImpl implements CategoryService
|
|||||||
|
|
||||||
OUTER: for(NodeRef nodeRef : nodeRefs)
|
OUTER: for(NodeRef nodeRef : nodeRefs)
|
||||||
{
|
{
|
||||||
Collection<ChildAssociationRef> children = getChildren(nodeRef, Mode.SUB_CATEGORIES, Depth.IMMEDIATE, sortByName, null);
|
Collection<ChildAssociationRef> children = getChildren(nodeRef, Mode.SUB_CATEGORIES, Depth.IMMEDIATE, sortByName, filter);
|
||||||
for(ChildAssociationRef child : children)
|
for(ChildAssociationRef child : children)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
|
|||||||
@@ -116,6 +116,19 @@ public interface CategoryService
|
|||||||
*/
|
*/
|
||||||
@Auditable(parameters = {"storeRef", "aspectName", "pagingRequest", "sortByName"})
|
@Auditable(parameters = {"storeRef", "aspectName", "pagingRequest", "sortByName"})
|
||||||
PagingResults<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, PagingRequest pagingRequest, boolean sortByName);
|
PagingResults<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, PagingRequest pagingRequest, boolean sortByName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a paged list of the root categories for an aspect/classification
|
||||||
|
*
|
||||||
|
* @param storeRef
|
||||||
|
* @param aspectName
|
||||||
|
* @param pagingRequest
|
||||||
|
* @param sortByName
|
||||||
|
* @param filter
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Auditable(parameters = {"storeRef", "aspectName", "pagingRequest", "sortByName", "filter"})
|
||||||
|
PagingResults<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, PagingRequest pagingRequest, boolean sortByName, String filter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the root categories for an aspect/classification with names that start with filter
|
* Get the root categories for an aspect/classification with names that start with filter
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import javax.transaction.UserTransaction;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||||
import org.alfresco.repo.dictionary.IndexTokenisationMode;
|
import org.alfresco.repo.dictionary.IndexTokenisationMode;
|
||||||
import org.alfresco.repo.dictionary.M2Aspect;
|
import org.alfresco.repo.dictionary.M2Aspect;
|
||||||
@@ -782,6 +783,22 @@ public class ADMLuceneCategoryTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
tx.rollback();
|
tx.rollback();
|
||||||
|
|
||||||
|
tx = transactionService.getUserTransaction();
|
||||||
|
tx.begin();
|
||||||
|
for ( int i=0; i<=5; i++)
|
||||||
|
{
|
||||||
|
categoryService.createRootCategory(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), "FirstTestCategory" + i);
|
||||||
|
categoryService.createRootCategory(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), "SecondTestCategory" + i);
|
||||||
|
}
|
||||||
|
tx.commit();
|
||||||
|
tx = transactionService.getUserTransaction();
|
||||||
|
tx.begin();
|
||||||
|
PagingRequest pagingRequest = new PagingRequest(10);
|
||||||
|
assertEquals(10,categoryService.getRootCategories(rootNodeRef.getStoreRef(),QName.createQName(TEST_NAMESPACE, "assetClass"), pagingRequest, true, null).getPage().size());
|
||||||
|
assertEquals(6,categoryService.getRootCategories(rootNodeRef.getStoreRef(),QName.createQName(TEST_NAMESPACE, "assetClass"), pagingRequest, true, "FirstTestCategory").getPage().size());
|
||||||
|
assertEquals(6,categoryService.getRootCategories(rootNodeRef.getStoreRef(),QName.createQName(TEST_NAMESPACE, "assetClass"), pagingRequest, true, "SecondTestCategory").getPage().size());
|
||||||
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user