}
}
// Connects last selected DbRelationship in the path to the
// last DbEntity, creating a dummy relationship if needed.
private void connectEnds() {
Relationship last = null;
int size = dbRelationships.size();
if (size > 0) {
last = dbRelationships.get(size - 1);
}
Entity target = getEndEntity();
if (target != null && (last == null || last.getTargetEntity() != target)) {
// try to connect automatically, if we can't use dummy connector
Entity source = (last == null) ? getStartEntity() : last.getTargetEntity();
if (source != null) {
Relationship anyConnector = source != null ? source
.getAnyRelationship(target) : null;
if (anyConnector != null) {
dbRelationships.add((DbRelationship) anyConnector);
}