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; }
private RemoteScriptingResults handleShirtSizeUpdate( IWContext iwc, String sourceName, String distanceIdString) { IWResourceBundle iwrb = getResourceBundle(iwc); if (distanceIdString != null) { Integer distanceID = Integer.valueOf(distanceIdString); RunBusiness runBiz = getRunBiz(iwc); try { Vector ids = new Vector(); Vector names = new Vector(); String shirtSizeMetadata = null; if (distanceID.intValue() != -1) { Group runDistance = runBiz.getRunGroupByGroupId(distanceID); shirtSizeMetadata = runDistance.getMetaData(PARAMETER_SHIRT_SIZES_PER_RUN); } List shirtSizes = null; if (shirtSizeMetadata != null) { shirtSizes = ListUtil.convertCommaSeparatedStringToList(shirtSizeMetadata); Iterator shirtIt = shirtSizes.iterator(); // ShirtSizeHome shirtSizeHome = (ShirtSizeHome) IDOLookup.getHome(ShirtSize.class); if (shirtIt.hasNext()) { ids.add("-1"); names.add( iwrb.getLocalizedString( "run_distance_dd.select_shirt_size", "Select shirt size...")); } while (shirtIt.hasNext()) { String shirtSizeKey = (String) shirtIt.next(); // ShirtSize shirtSize = shirtSizeHome.findByPrimaryKey(shirtSizeKey); // String s = iwrb.getLocalizedString(shirtSize.getName(),shirtSize.getName()); ids.add(shirtSizeKey); names.add(iwrb.getLocalizedString("shirt_size." + shirtSizeKey, shirtSizeKey)); } if (shirtSizes.isEmpty()) { ids.add("-1"); names.add(iwrb.getLocalizedString("unavailable", "Unavailable")); } } else { ids.add("-1"); names.add(iwrb.getLocalizedString("unavailable", "Unavailable")); } RemoteScriptingResults rsr = new RemoteScriptingResults(RemoteScriptHandler.getLayerName(sourceName, "id"), ids); rsr.addLayer(RemoteScriptHandler.getLayerName(sourceName, "name"), names); return rsr; } catch (Exception e) { e.printStackTrace(); } } return null; }