private boolean visitRelationship(ArcProperty arc) { DbRelationship dbRel = arc.getRelationship().getDbRelationships().get(0); for (DbAttribute attribute : dbRel.getSourceAttributes()) { String target = attribute.getName(); appendColumn(targetSource, target, prefix + target); } return true; } });
Iterator columns = relationship.getSourceAttributes().iterator(); DbAttribute column = (DbAttribute) columns.next(); sqlBuffer.append(column.getName());
/** * @return true if objRelationship includes given dbRelationship */ private boolean objRelationshipHasDbRelationship(ObjRelationship objRelationship, DbRelationship dbRelationship) { for(DbRelationship relationship : objRelationship.getDbRelationships()) { if(relationship.getSourceEntityName().equals(dbRelationship.getSourceEntityName()) && relationship.getTargetEntityName().equals(dbRelationship.getTargetEntityName()) && isSameAttributes(relationship.getSourceAttributes(), dbRelationship.getSourceAttributes()) && isSameAttributes(relationship.getTargetAttributes(), dbRelationship.getTargetAttributes())) { return true; } } return false; }
private void addFlattenedRelationship(ObjectNameGenerator nameGenerator, ObjEntity srcEntity, ObjEntity dstEntity, DbRelationship rel1, DbRelationship rel2) { if (rel1.getSourceAttributes().isEmpty() && rel2.getTargetAttributes().isEmpty()) { LOG.warn("Wrong call ManyToManyCandidateEntity.addFlattenedRelationship(... , " + srcEntity.getName() + ", " + dstEntity.getName() + ", ...)"); return; } ObjRelationship newRelationship = new ObjRelationship(); newRelationship.setName(NameBuilder .builder(newRelationship, srcEntity) .baseName(nameGenerator.relationshipName(rel1, rel2)) .name()); newRelationship.setSourceEntity(srcEntity); newRelationship.setTargetEntityName(dstEntity); newRelationship.addDbRelationship(rel1); newRelationship.addDbRelationship(rel2); srcEntity.addRelationship(newRelationship); }
ObjRelationship rel = (ObjRelationship) relationships.next(); DbRelationship dbRel = (DbRelationship) rel.getDbRelationships().get(0); Iterator dbAttributes = dbRel.getSourceAttributes().iterator();
list.add(getAdapter().createUniqueConstraint( (DbEntity) rel.getSourceEntity(), rel.getSourceAttributes()));
rel.getSourceAttributes()); if (unique != null) { list.add(unique);