use of org.jkiss.dbeaver.model.virtual.DBVEntity in project dbeaver by serge-rider.
the class ResultSetModel method updateColorMapping.
public void updateColorMapping(boolean reset) {
colorMapping.clear();
DBSDataContainer dataContainer = getDataContainer();
if (dataContainer == null) {
return;
}
DBVEntity virtualEntity = DBVUtils.getVirtualEntity(dataContainer, false);
if (virtualEntity == null) {
return;
}
{
List<DBVColorOverride> coList = virtualEntity.getColorOverrides();
if (!CommonUtils.isEmpty(coList)) {
for (DBVColorOverride co : coList) {
DBDAttributeBinding binding = DBUtils.findObject(attributes, co.getAttributeName());
if (binding != null) {
List<AttributeColorSettings> cmList = colorMapping.computeIfAbsent(binding, k -> new ArrayList<>());
cmList.add(new AttributeColorSettings(co));
} else {
log.debug("Attribute '" + co.getAttributeName() + "' not found in bindings. Skip colors.");
}
}
}
}
if (reset) {
updateRowColors(true, curRows);
}
}
use of org.jkiss.dbeaver.model.virtual.DBVEntity 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;
}
Aggregations