SearchView { void resolveObjectLabel(Item item) { MetaModel model = MetaModelRepository.getInstance().find(item.getModel()); if (model == null) { return ; } HasSearchViewHandler hasHandler = model.getPlugin().getHandlerProvider(HasSearchViewHandler.class); if (hasHandler != null) { String label = hasHandler.createSearchViewHandler().getObjectLabel(item, locale); item.setLabel(label); } } SearchView(RemoteStorage storage);   SearchView(RemoteStorage storage, int maxLimit); void setLocale(Locale locale); List<Item> findQuery(String title, String label, String identifier, String owner, String model, Collection<String> hasOwners); List<Item> findQuery(Query q, String status); List<Item> findPhrase(String phrase); List<Item> find(String... pids); List<Item> find(boolean onlyActive, String... pids); List<Item> findDeleted(String... pids); List<Item> find(List<String> pids); List<Item> find(List<String> pids, boolean onlyActive); List<Item> findSortedChildren(String parentPid); List<Item> findChildren(String pid); List<Item> findChildrenHierarchy(String pid); List<Item> findLastCreated(int offset, String model, String user, String sort); List<Item> findLastCreated(int offset, String model, String user, String organization, String username, int limit, String sort); List<Item> findAlphabetical(int offset, String model, String user, String organization, String userName, int limit, String sort); List<Item> findLastModified(int offset, String model, String user, String organization, String username, int limit, String sort); List<Item> countModels(String model, String user, String organization, String username); List<Item> findAllObjects(); List<Item> findReferrers(String pid); List<Item> findByModel(String modelId); List<Item> findByModel(int offset, String modelId); List<Item> findByModel(int offset, String modelId, String orderBy); List<Item> findByModels(String modelId1, String modelId2); List<Item> findByModels(int offset, String modelId1, String modelId2); List<Item> findByModels(int offset, String modelId1, String modelId2, String orderBy); boolean isDeviceInUse(String deviceId);  }
@Test public void testResolveObjectLabel() { Assume.assumeTrue(System.getenv("TRAVIS") == null); Assume.assumeTrue(LocalDate.of(2018, 6, 28).isAfter(LocalDate.now())); SearchView instance = new SearchView(storage); Item item = new Item("pid"); item.setModel("model:page"); item.setLabel("1"); instance.resolveObjectLabel(item); assertEquals("1", item.getLabel()); item.setLabel("1, "); instance.resolveObjectLabel(item); assertEquals("1, ", item.getLabel()); item.setLabel("1, TitlePage"); instance.resolveObjectLabel(item); assertEquals("1, Title Page", item.getLabel()); item.setLabel("1, UnknownPageType"); instance.resolveObjectLabel(item); assertEquals("1, UnknownPageType", item.getLabel()); instance.setLocale(new Locale("cs")); item.setLabel("[1], 1, TitlePage"); instance.resolveObjectLabel(item); assertEquals("[1], 1, Titulní strana (TitlePage)", item.getLabel()); item.setModel("model:periodical"); item.setLabel("[1], 1, TitlePage"); instance.resolveObjectLabel(item); assertEquals("[1], 1, TitlePage", item.getLabel()); }