use of org.opennms.netmgt.dao.support.GenericIndexResourceType in project opennms by OpenNMS.
the class ThresholdController method addStandardEditingBits.
private void addStandardEditingBits(ModelAndView modelAndView) {
Map<String, String> dsTypes = new LinkedHashMap<String, String>();
dsTypes.put("node", "Node");
// "interface" is a wrong word
dsTypes.put("if", "Interface");
Collection<OnmsResourceType> resourceTypes = m_resourceDao.getResourceTypes();
Multimap<String, String> genericDsTypes = TreeMultimap.create();
for (OnmsResourceType resourceType : resourceTypes) {
if (resourceType instanceof GenericIndexResourceType) // Put these in by label to sort them, we'll get them out in a moment
{
genericDsTypes.put(resourceType.getLabel(), resourceType.getName());
}
}
// Now get the resource types out of the TreeMultimap
for (String rtLabel : genericDsTypes.keys()) {
Collection<String> rtNames = genericDsTypes.get(rtLabel);
for (String rtName : rtNames) {
if (rtNames.size() > 1) {
dsTypes.put(rtName, rtLabel + " [" + rtName + "]");
} else {
dsTypes.put(rtName, rtLabel);
}
}
}
// Finally, set the sorted resource types into the model
modelAndView.addObject("dsTypes", dsTypes);
Collection<String> thresholdTypes = new ArrayList<String>();
for (final ThresholdType tt : ThresholdType.values()) {
thresholdTypes.add(tt.getEnumName());
}
modelAndView.addObject("thresholdTypes", thresholdTypes);
Collection<String> filterOperators = new ArrayList<String>();
for (final FilterOperator fo : FilterOperator.values()) {
filterOperators.add(fo.getEnumName());
}
modelAndView.addObject("filterOperators", filterOperators);
modelAndView.addObject("saveButtonTitle", SAVE_BUTTON_TITLE);
modelAndView.addObject("cancelButtonTitle", CANCEL_BUTTON_TITLE);
modelAndView.addObject("addFilterButtonTitle", ADDFILTER_BUTTON_TITLE);
modelAndView.addObject("editButtonTitle", EDIT_BUTTON_TITLE);
modelAndView.addObject("deleteButtonTitle", DELETE_BUTTON_TITLE);
modelAndView.addObject("updateButtonTitle", UPDATE_BUTTON_TITLE);
modelAndView.addObject("moveUpButtonTitle", MOVEUP_BUTTON_TITLE);
modelAndView.addObject("moveDownButtonTitle", MOVEDOWN_BUTTON_TITLE);
}
Aggregations