Search in sources :

Example 1 with DBVEntityForeignKeyColumn

use of org.jkiss.dbeaver.model.virtual.DBVEntityForeignKeyColumn in project dbeaver by serge-rider.

the class DBDAttributeBinding method findVirtualReferrers.

protected List<DBSEntityReferrer> findVirtualReferrers() {
    DBSDataContainer dataContainer = getDataContainer();
    if (dataContainer instanceof DBSEntity) {
        DBSEntity attrEntity = (DBSEntity) dataContainer;
        DBVEntity vEntity = DBVUtils.getVirtualEntity(attrEntity, false);
        if (vEntity != null) {
            List<DBVEntityForeignKey> foreignKeys = vEntity.getForeignKeys();
            if (!CommonUtils.isEmpty(foreignKeys)) {
                List<DBSEntityReferrer> referrers = null;
                for (DBVEntityForeignKey vfk : foreignKeys) {
                    for (DBVEntityForeignKeyColumn vfkc : vfk.getAttributes()) {
                        if (CommonUtils.equalObjects(vfkc.getAttributeName(), getFullyQualifiedName(DBPEvaluationContext.DML))) {
                            if (referrers == null) {
                                referrers = new ArrayList<>();
                            }
                            referrers.add(vfk);
                        }
                    }
                }
                return referrers;
            }
        }
    }
    return null;
}
Also used : DBVEntityForeignKeyColumn(org.jkiss.dbeaver.model.virtual.DBVEntityForeignKeyColumn) DBVEntityForeignKey(org.jkiss.dbeaver.model.virtual.DBVEntityForeignKey) DBVEntity(org.jkiss.dbeaver.model.virtual.DBVEntity)

Aggregations

DBVEntity (org.jkiss.dbeaver.model.virtual.DBVEntity)1 DBVEntityForeignKey (org.jkiss.dbeaver.model.virtual.DBVEntityForeignKey)1 DBVEntityForeignKeyColumn (org.jkiss.dbeaver.model.virtual.DBVEntityForeignKeyColumn)1