List of usage examples for org.springframework.beans.support PropertyComparator sort
public static void sort(Object[] source, SortDefinition sortDefinition) throws BeansException
From source file:com.jklas.sample.petclinic.Owner.java
public List getPets() { List sortedPets = new ArrayList(getPetsInternal()); PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedPets); }
From source file:com.jklas.sample.petclinic.Vet.java
public List getSpecialties() { List sortedSpecs = new ArrayList(getSpecialtiesInternal()); PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedSpecs); }
From source file:com.petclinic.entity.postgres.Vet.java
@XmlElement public List<Specialty> getSpecialties() { List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal()); PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedSpecs); }
From source file:com.branded.holdings.qpc.model.Vet.java
@XmlElement public List<Specialty> getSpecialties() { List<Specialty> sortedSpecs = new ArrayList<Specialty>(getSpecialtiesInternal()); PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedSpecs); }
From source file:com.jklas.sample.petclinic.Pet.java
public List getVisits() { List sortedVisits = new ArrayList(getVisitsInternal()); PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false)); return Collections.unmodifiableList(sortedVisits); }
From source file:com.branded.holdings.qpc.model.Owner.java
public List<Pet> getPets() { List<Pet> sortedPets = new ArrayList<Pet>(getPetsInternal()); PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedPets); }
From source file:com.branded.holdings.qpc.model.Pet.java
public List<Visit> getVisits() { List<Visit> sortedVisits = new ArrayList<Visit>(getVisitsInternal()); PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false)); return Collections.unmodifiableList(sortedVisits); }
From source file:org.springframework.samples.petclinic.model.Owner.java
public List<Pet> getMutableSortPets() { List<Pet> sortedPets = new ArrayList<Pet>(getPetsInternal()); PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedPets); }
From source file:org.abstracthorizon.proximity.webapp.controllers.RepositoryController.java
/** * Repository list./*from ww w. j a v a 2s . c om*/ * * @param request the request * @param response the response * * @return the model and view * * @throws Exception the exception */ public ModelAndView repositoryList(HttpServletRequest request, HttpServletResponse response) throws Exception { String requestURI = request.getRequestURI() .substring(request.getContextPath().length() + request.getServletPath().length()); if (requestURI.length() == 0) { requestURI = "/"; } logger.debug("Got repository request on URI " + requestURI); String orderBy = request.getParameter("orderBy") == null ? "name" : request.getParameter("orderBy"); String targetRepository = request.getParameter("repositoryId"); String targetGroup = request.getParameter("repositoryGroupId"); Item item = null; ProximityRequest pRequest = new ProximityRequest(); pRequest.setPath(requestURI); pRequest.setTargetedReposId(targetRepository); pRequest.setTargetedReposGroupId(targetGroup); pRequest.setGrantee(null); pRequest.getAttributes().put(ProximityRequest.REQUEST_REMOTE_ADDRESS, request.getRemoteAddr()); // issue #42, collect header information Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String headerName = (String) headerNames.nextElement(); pRequest.getAttributes().put("http." + headerName.toLowerCase(), request.getHeader(headerName)); } try { logger.debug("Got request for " + targetRepository + " repository on URI: " + requestURI); item = proximity.retrieveItem(pRequest); logger.debug("Got response " + item.getProperties().getPath()); if (item.getProperties().isDirectory()) { List items = null; items = proximity.listItems(pRequest); PropertyComparator.sort(items, new MutableSortDefinition(orderBy, true, true)); Map result = new HashMap(); result.put("items", items); result.put("orderBy", orderBy); result.put("requestUri", requestURI); result.put("requestPathList", explodeUriToList(requestURI)); return new ModelAndView("repository/repositoryList", result); } else { // TODO: check for If-Modified-Since? // response.setContentType("application/octet-stream"); response.setContentType( getWebApplicationContext().getServletContext().getMimeType(item.getProperties().getName())); response.setContentLength((int) item.getProperties().getSize()); response.setDateHeader("Last-Modified", item.getProperties().getLastModified().getTime()); InputStream is = item.getStream(); OutputStream os = response.getOutputStream(); IOUtils.copy(is, os); is.close(); return null; } } catch (ItemNotFoundException ex) { logger.info("Item not found on URI " + requestURI); response.sendError(HttpServletResponse.SC_NOT_FOUND); return null; } catch (AccessDeniedException ex) { logger.info("Access forbidden to " + requestURI + " for " + request.getRemoteAddr(), ex); response.sendError(HttpServletResponse.SC_FORBIDDEN); return null; } }