@Override public ModelInfo[] getModelList(String providerId, String groupId, String match) { ModelInfo modelInfo = createModelInfo(); if (providerId != null && !providerId.equals(PROVIDER_ID)) { return new ModelInfo[0]; } if (groupId != null && !groupId.equals(modelInfo.getGroupId())) { return new ModelInfo[0]; } String str = (match == null) ? null : match.toLowerCase(); if (str == null || modelInfo.getId().contains(str) || modelInfo.getName().contains(str) || modelInfo.getDescription().contains(str)) { return new ModelInfo[] {modelInfo}; } return new ModelInfo[0]; }
private Model createModel() { // only one model for this... ModelInfo info = createModelInfo(); Model model = new Model(); Element elements[] = new Element[3]; HashMap<String, String> elementCapabilities = new HashMap<String, String>(); elementCapabilities.put(Element.CAPABILITY_CAN_SEARCH, "false"); elementCapabilities.put(Element.CAPABILITY_CAN_SORT, "false"); Element groupElement = new Element(); groupElement.setElementType(FieldType.DIMENSION.name()); groupElement.setHorizontalAlignment(Alignment.LEFT.name()); groupElement.setId("element1"); groupElement.setName("Element 1"); groupElement.setDescription("Description 1"); groupElement.setDataType(Types.TYPE_STRING.toString()); groupElement.setCapabilities(elementCapabilities); groupElement.setIsQueryElement(false); elements[0] = groupElement; Element element1 = new Element(); element1.setElementType(FieldType.DIMENSION.name()); element1.setHorizontalAlignment(Alignment.LEFT.name()); element1.setId("element1"); element1.setName("Element 1"); element1.setDataType(Types.TYPE_STRING.toString()); element1.setCapabilities(elementCapabilities); element1.setIsQueryElement(true); elements[1] = element1; elementCapabilities.put(Element.CAPABILITY_CAN_FILTER, "false"); Element element2 = new Element(); element2.setElementType(FieldType.FACT.name()); element2.setHorizontalAlignment(Alignment.RIGHT.name()); element2.setId("element2"); element2.setName("Element 2"); element2.setDataType(Types.TYPE_NUMERIC.toString()); element2.setFormatMask("#,###.00"); element2.setCapabilities(elementCapabilities); element2.setIsQueryElement(true); element2.setAvailableAggregations(new String[] {"SUM", "MIN"}); element2.setDefaultAggregation("SUM"); element2.setHiddenForUser(false); element2.setParentId("element1"); elements[2] = element2; model.setElements(elements); model.setGroupId(info.getGroupId()); model.setDescription(info.getDescription()); model.setModelId(info.getModelId()); model.setName(info.getName()); model.setProvider(provider); HashMap<String, String> capabilities = new HashMap<String, String>(); capabilities.put("across-axis", "true"); capabilities.put("across-axis-customizable", "true"); capabilities.put("down-axis", "false"); capabilities.put("down-axis-customizable", "false"); capabilities.put("filter-axis", "false"); capabilities.put("filter-axis-customizable", "false"); capabilities.put("sortable", "false"); model.setCapabilities(capabilities); return model; }