private String parseInternal() { OrderBy<?> orderBy = query.getOrderBy(); if (orderBy == null){ return null; } StringBuilder sb = new StringBuilder(); List<Property> properties = orderBy.getProperties(); if (properties.isEmpty()){ // order by clause removed by filterMany() return null; } for (int i = 0; i < properties.size(); i++) { if (i > 0){ sb.append(", "); } Property p = properties.get(i); String expression = parseProperty(p); sb.append(expression); } return sb.toString(); }
private String parseInternal() { OrderBy<?> orderBy = query.getOrderBy(); if (orderBy == null) { return null; } StringBuilder sb = new StringBuilder(); List<Property> properties = orderBy.getProperties(); if (properties.isEmpty()) { // order by clause removed by filterMany() return null; } for (int i = 0; i < properties.size(); i++) { if (i > 0) { sb.append(", "); } Property p = properties.get(i); String expression = parseProperty(p); sb.append(expression); } return sb.toString(); }
private String parseInternal() { OrderBy<?> orderBy = query.getOrderBy(); if (orderBy == null){ return null; } StringBuilder sb = new StringBuilder(); List<Property> properties = orderBy.getProperties(); if (properties.isEmpty()){ // order by clause removed by filterMany() return null; } for (int i = 0; i < properties.size(); i++) { if (i > 0){ sb.append(", "); } Property p = properties.get(i); String expression = parseProperty(p); sb.append(expression); } return sb.toString(); }
public List<OrmQueryProperties> removeQueryJoins() { List<OrmQueryProperties> queryJoins = detail.removeSecondaryQueries(); if (queryJoins != null){ if (orderBy != null){ // remove any orderBy properties that relate to // paths of the secondary queries for (int i = 0; i < queryJoins.size(); i++) { OrmQueryProperties joinPath = queryJoins.get(i); // loop through the orderBy properties and // move any ones related to the query join List<Property> properties = orderBy.getProperties(); Iterator<Property> it = properties.iterator(); while (it.hasNext()) { OrderBy.Property property = it.next(); if (property.getProperty().startsWith(joinPath.getPath())){ // remove this orderBy segment and // add it to the secondary join it.remove(); joinPath.addSecJoinOrderProperty(property); } } } } } return queryJoins; }
private List<OrmQueryProperties> removeQueryJoins() { List<OrmQueryProperties> queryJoins = detail.removeSecondaryQueries(); if (queryJoins != null) { if (orderBy != null) { // remove any orderBy properties that relate to // paths of the secondary queries for (OrmQueryProperties joinPath : queryJoins) { // loop through the orderBy properties and // move any ones related to the query join List<Property> properties = orderBy.getProperties(); Iterator<Property> it = properties.iterator(); while (it.hasNext()) { Property property = it.next(); if (property.getProperty().startsWith(joinPath.getPath())) { // remove this orderBy segment and // add it to the secondary join it.remove(); joinPath.addSecJoinOrderProperty(property); } } } } } return queryJoins; }
public List<OrmQueryProperties> removeQueryJoins() { List<OrmQueryProperties> queryJoins = detail.removeSecondaryQueries(); if (queryJoins != null){ if (orderBy != null){ // remove any orderBy properties that relate to // paths of the secondary queries for (int i = 0; i < queryJoins.size(); i++) { OrmQueryProperties joinPath = queryJoins.get(i); // loop through the orderBy properties and // move any ones related to the query join List<Property> properties = orderBy.getProperties(); Iterator<Property> it = properties.iterator(); while (it.hasNext()) { OrderBy.Property property = it.next(); if (property.getProperty().startsWith(joinPath.getPath())){ // remove this orderBy segment and // add it to the secondary join it.remove(); joinPath.addSecJoinOrderProperty(property); } } } } } return queryJoins; }
/** * Define the select and joins for this query. */ @SuppressWarnings("unchecked") public void configureBeanQuery(SpiQuery<?> query) { if (trimmedProperties != null && trimmedProperties.length() > 0) { query.select(trimmedProperties); if (filterMany != null){ query.setFilterMany(path, filterMany); } } if (secondaryChildren != null) { int trimPath = path.length() + 1; for (int i = 0; i < secondaryChildren.size(); i++) { OrmQueryProperties p = secondaryChildren.get(i); String path = p.getPath(); path = path.substring(trimPath); query.fetch(path, p.getProperties(), p.getFetchConfig()); query.setFilterMany(path, p.getFilterManyTrimPath(trimPath)); } } if (orderBy != null){ List<Property> orderByProps = orderBy.getProperties(); for (int i = 0; i < orderByProps.size(); i++) { orderByProps.get(i).trim(path); } query.setOrder(orderBy); } }
/** * Define the select and joins for this query. */ @SuppressWarnings("unchecked") public void configureBeanQuery(SpiQuery<?> query) { if (trimmedProperties != null && trimmedProperties.length() > 0) { query.select(trimmedProperties); if (filterMany != null){ query.setFilterMany(path, filterMany); } } if (secondaryChildren != null) { int trimPath = path.length() + 1; for (int i = 0; i < secondaryChildren.size(); i++) { OrmQueryProperties p = secondaryChildren.get(i); String path = p.getPath(); path = path.substring(trimPath); query.fetch(path, p.getProperties(), p.getFetchConfig()); query.setFilterMany(path, p.getFilterManyTrimPath(trimPath)); } } if (orderBy != null){ List<Property> orderByProps = orderBy.getProperties(); for (int i = 0; i < orderByProps.size(); i++) { orderByProps.get(i).trim(path); } query.setOrder(orderBy); } }
/** * Validate all the expression properties/paths given the bean descriptor. */ @Override public Set<String> validate(BeanType<T> desc) { SpiExpressionValidation validation = new SpiExpressionValidation(desc); if (whereExpressions != null) { whereExpressions.validate(validation); } if (havingExpressions != null) { havingExpressions.validate(validation); } if (orderBy != null) { for (Property property : orderBy.getProperties()) { validation.validate(property.getProperty()); } } return validation.getUnknownProperties(); }