use of org.motechproject.mds.web.comparator.TypeDisplayNameComparator in project motech by motech.
the class AvailableController method getTypes.
@RequestMapping(value = "/available/types", method = RequestMethod.GET)
@ResponseBody
public SelectResult<TypeDto> getTypes(SelectData data) {
List<TypeDto> list = typeService.getAllTypes();
// The Long and Date types are available for DDEs exclusively
list.remove(typeService.findType(Long.class));
list.remove(typeService.findType(Date.class));
list.remove(typeService.findType(Relationship.class));
// The DateTime and LocalDate types from Joda are available for DDEs exclusively
list.remove(typeService.findType(DateTime.class));
list.remove(typeService.findType(org.joda.time.LocalDate.class));
// TextArea type is available only from UI
list.add(textAreaUIType());
CollectionUtils.filter(list, new TypeMatcher(data.getTerm(), messageSource));
Collections.sort(list, new TypeDisplayNameComparator(messageSource));
return new SelectResult<>(data, list);
}
Aggregations