UADHierarchyDisplay { public List<Object> search( Class<?> parentContainerClass, Serializable parentContainerId, long userId, long[] groupIds, String keywords, String orderByField, String orderByType, int start, int end) throws Exception { Objects.requireNonNull(parentContainerClass); Objects.requireNonNull(parentContainerId); List<Object> searchResults = new ArrayList<>(); List<Object> allUserItems = new ArrayList<>(); for (UADDisplay<?> uadDisplay : _uadDisplays) { allUserItems.addAll( uadDisplay.search( userId, groupIds, keywords, orderByField, orderByType, QueryUtil.ALL_POS, QueryUtil.ALL_POS)); } for (UADDisplay<?> containerUADDisplay : _uadHierarchyDeclaration.getContainerUADDisplays()) { searchResults.addAll( getContainerDisplays( containerUADDisplay, parentContainerClass, parentContainerId, allUserItems)); } for (UADDisplay<Object> noncontainerUADDisplay : (UADDisplay<Object>[]) _uadHierarchyDeclaration.getNoncontainerUADDisplays()) { Class<Object> typeClass = noncontainerUADDisplay.getTypeClass(); for (Object userItem : allUserItems) { if ((userItem != null) && typeClass.isAssignableFrom(userItem.getClass()) && parentContainerId.equals( noncontainerUADDisplay.getParentContainerId( userItem))) { searchResults.add(userItem); } } } return ListUtil.subList(searchResults, start, end); } UADHierarchyDisplay(
		UADHierarchyDeclaration uadHierarchyDeclaration); void addPortletBreadcrumbEntries(
			HttpServletRequest httpServletRequest,
			RenderResponse renderResponse, Locale locale); long countAll(long userId); String[] getColumnFieldNames(); Map<Class<?>, List<Serializable>> getContainerItemPKsMap(
		Class<?> parentContainerClass, Serializable parentContainerId,
		long userId); String getEditURL(
			LiferayPortletRequest liferayPortletRequest,
			LiferayPortletResponse liferayPortletResponse, T object); String getEntitiesTypeLabel(Locale locale); Map<String, Object> getFieldValues(T object, Locale locale); Class<?> getFirstContainerTypeClass(); String getParentContainerURL(
			ActionRequest actionRequest,
			LiferayPortletResponse liferayPortletResponse); Serializable getPrimaryKey(T object); String[] getSortingFieldNames(); Class<?> getTypeClass(T object); Class<?>[] getTypeClasses(); UADDisplay<?>[] getUADDisplays(); String getViewURL(
			LiferayPortletRequest liferayPortletRequest,
			LiferayPortletResponse liferayPortletResponse,
			String applicationKey, T object, long selectedUserId); boolean isInTrash(T object); boolean isUserOwned(T object, long userId); List<Object> search(
			Class<?> parentContainerClass, Serializable parentContainerId,
			long userId, long[] groupIds, String keywords, String orderByField,
			String orderByType, int start, int end); long searchCount(long userId, long[] groupIds, String keywords); T unwrap(Object object);  }
@Test public void testSearch() throws Exception { for (DummyContainer dummyContainer : _dummyContainerService.getEntities()) { List<Object> items = _uadHierarchyDisplay.search( DummyContainer.class, dummyContainer.getId(), _USER_ID, null, "", "name", "asc", QueryUtil.ALL_POS, QueryUtil.ALL_POS); Assert.assertEquals( items.toString(), (int)_userFolderAndItemCountMap.get(dummyContainer.getId()), items.size()); } }