/** * Required for jsp * @return a String version of the Path */ public String getNoConstraintsString() { return toStringNoConstraints(); }
/** * Required for jsp * @return a String version of the Path */ public String getNoConstraintsString() { return toStringNoConstraints(); }
/** * Adds all the parts of a Path to a Set. Call this with only a non-attribute Path. * * @param validMainPaths a Set of Strings to add to * @param path a Path object */ private static void addValidPaths(Set<String> validMainPaths, Path path) { Path pathToAdd = path; while (!pathToAdd.isRootPath()) { validMainPaths.add(pathToAdd.toStringNoConstraints()); pathToAdd = pathToAdd.getPrefix(); } validMainPaths.add(pathToAdd.toStringNoConstraints()); }
/** * Adds all the parts of a Path to a Set. Call this with only a non-attribute Path. * * @param validMainPaths a Set of Strings to add to * @param path a Path object */ private static void addValidPaths(Set<String> validMainPaths, Path path) { Path pathToAdd = path; while (!pathToAdd.isRootPath()) { validMainPaths.add(pathToAdd.toStringNoConstraints()); pathToAdd = pathToAdd.getPrefix(); } validMainPaths.add(pathToAdd.toStringNoConstraints()); }
/** * Compare paths by number elements they contain, shortest paths come first. If the number of * elements is the same sort by text length of paths. * {@inheritDoc} */ @Override public int compare(Path arg0, Path arg1) { if (arg0 == null || arg1 == null) { throw new RuntimeException("Paths must not be null"); } int length0 = arg0.getElements().size(); int length1 = arg1.getElements().size(); if (length0 < length1) { return -1; } if (length0 > length1) { return 1; } return arg0.toStringNoConstraints().compareTo( arg1.toStringNoConstraints()); } }
/** * Compare paths by number elements they contain, shortest paths come first. If the number of * elements is the same sort by text length of paths. * {@inheritDoc} */ @Override public int compare(Path arg0, Path arg1) { if (arg0 == null || arg1 == null) { throw new RuntimeException("Paths must not be null"); } int length0 = arg0.getElements().size(); int length1 = arg1.getElements().size(); if (length0 < length1) { return -1; } if (length0 > length1) { return 1; } return arg0.toStringNoConstraints().compareTo( arg1.toStringNoConstraints()); } }
/** * Constructor that takes a Path object. The human readable name for getName() will be * generated from the path. * * @param path a Path object * @param index the number of the column * @param type the type of the column (ClassDescriptor or Class) */ public Column(Path path, int index, Class type) { this.path = path; this.name = path.toStringNoConstraints().replaceAll("[:.](?!\\s)", " > "); this.index = index; this.type = type; setColumnId(path.toString().substring(0, path.toString().lastIndexOf(".")) + "_" + TypeUtil.unqualifiedName(type.getName())); }
/** * Constructor that takes a Path object. The human readable name for getName() will be * generated from the path. * * @param path a Path object * @param index the number of the column * @param type the type of the column (ClassDescriptor or Class) */ public Column(Path path, int index, Class type) { this.path = path; this.name = path.toStringNoConstraints().replaceAll("[:.](?!\\s)", " > "); this.index = index; this.type = type; setColumnId(path.toString().substring(0, path.toString().lastIndexOf(".")) + "_" + TypeUtil.unqualifiedName(type.getName())); }
p.getElements().set(index, renamedFields.get(key)); pathUpdated = p.toStringNoConstraints(); isUpdated = true;
p.getElements().set(index, renamedFields.get(key)); pathUpdated = p.toStringNoConstraints(); isUpdated = true;
public void testToStringNoConstraints() throws Exception { Map<String, String> constraintMap = new HashMap<String, String>(); constraintMap.put("Department.manager", "CEO"); constraintMap.put("Department.manager.company.departments.employees", "Manager"); String stringPath = "Department.manager.company.departments.employees.age"; Path path = new Path(model, stringPath, constraintMap); assertEquals("Department.manager.company.departments.employees.age", path.toStringNoConstraints()); }
Set<String> toAdd = new HashSet<String>(); while (!(groups.containsKey(groupPath.getNoConstraintsString()))) { toAdd.add(groupPath.toStringNoConstraints()); if (groupPath.isRootPath()) { break;
Set<String> toAdd = new HashSet<String>(); while (!(groups.containsKey(groupPath.getNoConstraintsString()))) { toAdd.add(groupPath.toStringNoConstraints()); if (groupPath.isRootPath()) { break;
Path parent = path.getPrefix(); QuerySelectable selectableForPath = pathToQueryNode.get( parent.toStringNoConstraints()); if (selectableForPath instanceof QueryCollectionPathExpression) { selectableForPath = ((QueryCollectionPathExpression) selectableForPath)
private void addColumnsInternal(List<Path> paths) { List<String> types = new ArrayList<String>(); int i = columns.size(); for (Path columnPath : paths) { String type = TypeUtil.unqualifiedName(columnPath.getLastClassDescriptor() .getName()); Class typeCls = columnPath.getLastClassDescriptor().getType(); String columnDescription = pathQuery.getGeneratedPathDescription(columnPath. toStringNoConstraints()); Column column; if (columnDescription.equals(columnPath.toStringNoConstraints())) { column = new Column(columnPath, i, typeCls); } else { column = new Column(columnPath, columnDescription, i, typeCls); } if (!types.contains(column.getColumnId())) { String fieldName = columnPath.getEndFieldDescriptor().getName(); boolean isKeyField = ClassKeyHelper.isKeyField(classKeys, type, fieldName); if (isKeyField) { column.setSelectable(true); types.add(column.getColumnId()); } } columns.add(column); i++; } }
Path parent = path.getPrefix(); QuerySelectable selectableForPath = pathToQueryNode.get( parent.toStringNoConstraints()); if (selectableForPath instanceof QueryCollectionPathExpression) { selectableForPath = ((QueryCollectionPathExpression) selectableForPath)
if (tqTypeA.isAssignableFrom(typeA)) { if ((tq.getEditableConstraints(select1.toStringNoConstraints()).size() == 1) && (tq.getEditableConstraints().size() == 1)) {
private void addColumnsInternal(List<Path> paths) { List<String> types = new ArrayList<String>(); int i = columns.size(); for (Path columnPath : paths) { String type = TypeUtil.unqualifiedName(columnPath.getLastClassDescriptor() .getName()); Class typeCls = columnPath.getLastClassDescriptor().getType(); String columnDescription = pathQuery.getGeneratedPathDescription(columnPath. toStringNoConstraints()); Column column; if (columnDescription.equals(columnPath.toStringNoConstraints())) { column = new Column(columnPath, i, typeCls); } else { column = new Column(columnPath, columnDescription, i, typeCls); } if (!types.contains(column.getColumnId())) { String fieldName = columnPath.getEndFieldDescriptor().getName(); boolean isKeyField = ClassKeyHelper.isKeyField(classKeys, type, fieldName); if (isKeyField) { column.setSelectable(true); types.add(column.getColumnId()); } } columns.add(column); i++; } }
if (tqTypeA.isAssignableFrom(typeA)) { if ((tq.getEditableConstraints(select1.toStringNoConstraints()).size() == 1) && (tq.getEditableConstraints().size() == 1)) {
continue; if (!validMainPaths.contains(path.getPrefix().toStringNoConstraints())) { problems.add("Order by element for path " + orderPath.getOrderPath() + " is not relevant to the query");