@Override public ObjEntity getSourceEntity() { return (ObjEntity) super.getSourceEntity(); }
public Object getParent() { return getSourceEntity(); }
@Override public DbEntity getSourceEntity() { return (DbEntity) super.getSourceEntity(); }
public Object getParent() { return getSourceEntity(); }
/** * Returns qualified name (entity name + relationship name) for a * relationship */ static String getQualifiedName(Relationship rel) { return rel.getSourceEntity().getName() + "." + rel.getName(); }
/** * Returns DbAttribute on on the left side of the join. */ public DbAttribute getSource() { if (sourceName == null) { return null; } Relationship r = getNonNullRelationship(); Entity entity = r.getSourceEntity(); if (entity == null) { return null; } return (DbAttribute) entity.getAttribute(sourceName); }
/** * Post (i.e. after creation on entity cell) process of the entity */ protected void postProcessEntity(Entity entity, DefaultGraphCell cell) { for (Relationship rel : entity.getRelationships()) { if (rel.getSourceEntity() != null && rel.getTargetEntity() != null) { DefaultEdge edge = createRelationshipCell(rel); if (edge != null) { createdObjects.add(edge); } } } }
/** * Returns guaranteed non-null MappingNamespace of this relationship. If it happens to * be null, and exception is thrown. This method is intended for internal use by * Relationship class. */ final MappingNamespace getNonNullNamespace() { Entity entity = getSourceEntity(); if (entity == null) { throw new CayenneRuntimeException("Relationship '%s' has no parent Entity.", getName()); } return entity.getNonNullNamespace(); }
/** * Returns guaranteed non-null MappingNamespace of this relationship. If it happens to * be null, and exception is thrown. This method is intended for internal use by * Relationship class. */ final MappingNamespace getNonNullNamespace() { Entity entity = getSourceEntity(); if (entity == null) { throw new CayenneRuntimeException("Relationship '" + getName() + "' has no parent Entity."); } return entity.getNonNullNamespace(); }
protected void updateRelationshipCell(Relationship rel) { if (rel.getSourceEntity() != null && rel.getTargetEntity() != null) { DefaultEdge edge = relCells.get(getQualifiedName(rel)); if (edge != null) { updateRelationshipLabels(edge, rel, rel.getReverseRelationship()); Map nested = new HashMap(); nested.put(edge, edge.getAttributes()); edit(nested); } else { insertRelationshipCell(rel); } } }
/** * Updates relationship labels for specified relationship edge. */ protected void updateRelationshipLabels(DefaultEdge edge, Relationship rel, Relationship reverse) { DefaultGraphCell sourceCell = entityCells.get(rel.getSourceEntity().getName()); DefaultGraphCell targetCell = entityCells.get(rel.getTargetEntity().getName()); edge.setSource(sourceCell != null ? sourceCell.getChildAt(0) : null); edge.setTarget(targetCell != null ? targetCell.getChildAt(0) : null); Object[] labels = { rel.getName() + " " + getRelationshipLabel(rel), reverse == null ? "" : reverse.getName() + " " + getRelationshipLabel(reverse) }; GraphConstants.setExtraLabels(edge.getAttributes(), labels); Point2D[] labelPositions = { new Point2D.Double(GraphConstants.PERMILLE * (0.1 + 0.2 * Math.random()), 10), new Point2D.Double(GraphConstants.PERMILLE * (0.9 - 0.2 * Math.random()), -10) }; GraphConstants.setExtraLabelPositions(edge.getAttributes(), labelPositions); }
/** * Constructor for RelationshipErrorMsg. * * @param result */ public RelationshipErrorMsg(ValidationFailure result) { super(result); Object object = result.getSource(); rel = (Relationship) object; entity = rel.getSourceEntity(); map = entity.getDataMap(); domain = (DataChannelDescriptor) Application .getInstance() .getProject() .getRootNode(); }
entity = ((Attribute) searchResultEntry.getObject()).getEntity(); } else { map = ((Relationship) searchResultEntry.getObject()).getSourceEntity().getDataMap(); entity = ((Relationship) searchResultEntry.getObject()).getSourceEntity();