Class tqTypeA = select1.getLastClassDescriptor().getType(); if (tqTypeA.isAssignableFrom(typeA)) { && (tq.getEditableConstraints().size() == 1)) { Class typeB = tq.makePath(view.get(1)).getLastClassDescriptor() .getType(); TemplateQuery prevTq = retval.get(typeB); if (prevTq != null) { Class prevTypeA = prevTq.makePath(prevTq.getView().get(0)) .getLastClassDescriptor().getType(); if (prevTypeA.isAssignableFrom(tqTypeA)) {
Class tqTypeA = select1.getLastClassDescriptor().getType(); if (tqTypeA.isAssignableFrom(typeA)) { && (tq.getEditableConstraints().size() == 1)) { Class typeB = tq.makePath(view.get(1)).getLastClassDescriptor() .getType(); TemplateQuery prevTq = retval.get(typeB); if (prevTq != null) { Class prevTypeA = prevTq.makePath(prevTq.getView().get(0)) .getLastClassDescriptor().getType(); if (prevTypeA.isAssignableFrom(tqTypeA)) {
/** * Return the type of the last element in the path, regardless of whether it is an attribute * or a class. * @return the Class of the last element */ public Class<?> getEndType() { Class<?> retval = null; if (endFld != null && endFld.isAttribute()) { retval = Util.getClassFromString(((AttributeDescriptor) endFld).getType()); } else { retval = getLastClassDescriptor().getType(); } return retval; }
/** * Return the type of the last element in the path, regardless of whether it is an attribute * or a class. * @return the Class of the last element */ public Class<?> getEndType() { Class<?> retval = null; if (endFld != null && endFld.isAttribute()) { retval = Util.getClassFromString(((AttributeDescriptor) endFld).getType()); } else { retval = getLastClassDescriptor().getType(); } return retval; }
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++; } }
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 path = templateQuery.makePath(viewPath); if (path.getElementClassDescriptors().size() == 1 && path.getLastClassDescriptor().getUnqualifiedName().equals(rootClass)) { if (templateQuery.getEditableConstraints(viewPath).isEmpty()) { templateQuery.removeView(viewPath);
Path path = templateQuery.makePath(viewPath); if (path.getElementClassDescriptors().size() == 1 && path.getLastClassDescriptor().getUnqualifiedName().equals(rootClass)) { if (templateQuery.getEditableConstraints(viewPath).isEmpty()) { templateQuery.removeView(viewPath);
ClassDescriptor cld = path.getLastClassDescriptor(); if (!cld.getUnqualifiedName().equals(bag.getType()) && !allClasses.contains(cld.getUnqualifiedName())) {
ClassDescriptor cld = path.getLastClassDescriptor(); if (!cld.getUnqualifiedName().equals(bag.getType()) && !allClasses.contains(cld.getUnqualifiedName())) {
for (String viewElement : view) { Path path = pq.makePath(viewElement); if (path.getLastClassDescriptor().getType().equals(typeA)) { pq.removeView(viewElement); for (OrderElement orderBy : pq.getOrderBy()) {
for (String viewElement : view) { Path path = pq.makePath(viewElement); if (path.getLastClassDescriptor().getType().equals(typeA)) { pq.removeView(viewElement); for (OrderElement orderBy : pq.getOrderBy()) {
public void testGetLastClassDescriptor() throws Exception { Path path = new Path(model, "Department.manager.name"); assertEquals(model.getClassDescriptorByName("org.intermine.pathquery.model.testmodel.Manager"), path.getLastClassDescriptor()); }
@Override public Void visitRight(SubTable b) { System.out.printf(spacer + "%d %s\n", b.getRows().size(), b.getJoinPath()); System.out.println(spacer + " " + b.getColumns()); int c = 0; for (List<Either<ResultCell, SubTable>> row: b.getRows()) { System.out.printf(spacer + " %s %d\n", b.getJoinPath().getLastClassDescriptor().getUnqualifiedName(), c++); for (Either<ResultCell, SubTable> item: row) { item.accept(new IndentingPrinter(indent, depth + 1)); } } return null; }
lastCd = columnPath.getLastClassDescriptor().getName(); } else { lastCd = columnPath.getLastClassDescriptor().getName(); String fieldCDName = path.getLastClassDescriptor().getName(); String unqualifiedFieldCD = TypeUtil.unqualifiedName(fieldCDName); boolean isKeyField;
lastCd = columnPath.getLastClassDescriptor().getName(); } else { lastCd = columnPath.getLastClassDescriptor().getName(); String fieldCDName = path.getLastClassDescriptor().getName(); String unqualifiedFieldCD = TypeUtil.unqualifiedName(fieldCDName); boolean isKeyField;
@Override public Void visitRight(SubTable b) { puts(spacer + "%d %s", b.getRows().size(), b.getJoinPath()); puts(spacer + " " + b.getColumns()); int c = 0; for (List<Either<ResultCell, SubTable>> row: b.getRows()) { puts(spacer + " %s %d", b.getJoinPath().getLastClassDescriptor().getUnqualifiedName(), c++); for (Either<ResultCell, SubTable> item: row) { item.accept(new IndentingPrinter(indent, depth + 1)); } } return null; } }