public List<String> getCategoriesByURI(String URI, IWContext iwc) { List<String> categories = new ArrayList<String>(); BuilderService bservice = null; String property = null; try { bservice = BuilderServiceFactory.getBuilderService(iwc); } catch (RemoteException e) { e.printStackTrace(); } String pageKey = bservice.getExistingPageKeyByURI(CoreConstants.SLASH + URI); List<String> moduleId = bservice.getModuleId(pageKey, ArticleListViewer.class.getName()); if (moduleId != null) { for (int i = 0; i < moduleId.size(); i++) { property = bservice.getProperty(pageKey, moduleId.get(i), "categories"); if (property != null) { if (property.indexOf(",") != -1) { Collection<String> strings = ListUtil.convertCommaSeparatedStringToList(property); for (String string : strings) { categories.add(string); } } else { categories.add(property); } } else { // Article list viewer without property - displaying all pages categories = null; } } } return categories; }
public List<String> getArticlesByURI(String URI, IWContext iwc) { List<String> articles = new ArrayList<String>(); BuilderService bservice = null; try { bservice = BuilderServiceFactory.getBuilderService(iwc); } catch (RemoteException e) { e.printStackTrace(); } String pageKey = bservice.getExistingPageKeyByURI(CoreConstants.SLASH + URI); List<String> moduleId = bservice.getModuleId(pageKey, ArticleItemViewer.class.getName()); if (moduleId != null) { for (int i = 0; i < moduleId.size(); i++) { String articleURI = bservice.getProperty(pageKey, moduleId.get(i), "resourcePath"); articleURI = articleURI.substring(0, articleURI.length()); articles.add(CoreConstants.WEBDAV_SERVLET_URI + articleURI); } } return articles; }