List of usage examples for javax.xml.registry FindQualifier SORT_BY_DATE_ASC
String SORT_BY_DATE_ASC
To view the source code for javax.xml.registry FindQualifier SORT_BY_DATE_ASC.
Click Source Link
From source file:it.cnr.icar.eric.client.xml.registry.BusinessQueryManagerImpl.java
/** * Adds an "ORDER BY" clause based on specified parameters * * @param query Query to which to append clause * @param findQualifiers UDDI find qualifiers to apply * @throws JAXRException if an error occurs * @return Possibly-modified query//from www. java 2 s.com */ private Query addOrderBy(Query query, Collection<?> findQualifiers) throws JAXRException { String q = query.toString(); StringBuffer qs = new StringBuffer(q); if (findQualifiers != null && checkOrderBy) { boolean caseInsensitiveSort = false; if (findQualifiers.contains(CASE_INSENSITIVE_SORT)) { caseInsensitiveSort = true; } int sortByName = SORT_NONE; if (findQualifiers.contains(FindQualifier.SORT_BY_NAME_ASC)) { sortByName = SORT_ASC; } else if (findQualifiers.contains(FindQualifier.SORT_BY_NAME_DESC)) { sortByName = SORT_DESC; } StringBuffer orderBy = new StringBuffer(""); if (sortByName != SORT_NONE) { if (caseInsensitiveSort) { orderBy.append(" ORDER BY UPPER('n.value')"); } else { orderBy.append(" ORDER BY n.value"); } if (sortByName == SORT_ASC) { orderBy.append(" ASC"); } else { orderBy.append(" DESC"); } } int sortByDate = SORT_NONE; if (findQualifiers.contains(FindQualifier.SORT_BY_DATE_ASC)) { sortByDate = SORT_ASC; } else if (findQualifiers.contains(FindQualifier.SORT_BY_DATE_DESC)) { sortByDate = SORT_DESC; } if (sortByDate != SORT_NONE) { //TODO: Need to handle sort by date which is harder as it involves getting AuditTrail. if (orderBy.length() > 0) { //orderBy += ", "; } } qs.append(orderBy); } return dqm.createQuery(Query.QUERY_TYPE_SQL, qs.toString()); }