use of org.jkiss.dbeaver.erd.model.ERDElement in project dbeaver by serge-rider.
the class AssociationReconnectTargetCommand method canExecute.
/**
* Makes sure that foreign key doesn't reconnect to itself or try to create
* a relationship which already exists
*/
@Override
public boolean canExecute() {
boolean returnVal = true;
ERDElement foreignKeyEntity = relationship.getSourceEntity();
if (foreignKeyEntity.equals(targetEntity)) {
returnVal = false;
} else {
List<ERDAssociation> relationships = targetEntity.getReferences();
for (ERDAssociation relationship : relationships) {
if (relationship.getSourceEntity().equals(sourceEntity) && relationship.getTargetEntity().equals(targetEntity)) {
returnVal = false;
break;
}
}
}
return returnVal;
}
use of org.jkiss.dbeaver.erd.model.ERDElement in project dbeaver by dbeaver.
the class AssociationReconnectTargetCommand method canExecute.
/**
* Makes sure that foreign key doesn't reconnect to itself or try to create
* a relationship which already exists
*/
@Override
public boolean canExecute() {
boolean returnVal = true;
ERDElement foreignKeyEntity = relationship.getSourceEntity();
if (foreignKeyEntity.equals(targetEntity)) {
returnVal = false;
} else {
List<ERDAssociation> relationships = targetEntity.getReferences();
for (ERDAssociation relationship : relationships) {
if (relationship.getSourceEntity().equals(sourceEntity) && relationship.getTargetEntity().equals(targetEntity)) {
returnVal = false;
break;
}
}
}
return returnVal;
}
use of org.jkiss.dbeaver.erd.model.ERDElement in project dbeaver by dbeaver.
the class AssociationReconnectSourceCommand method canExecute.
/**
* Makes sure that primary key doesn't reconnect to itself or try to create
* a relationship which already exists
*/
@Override
public boolean canExecute() {
boolean returnVal = true;
ERDElement primaryEntity = association.getTargetEntity();
// cannot connect to itself
if (primaryEntity.equals(sourceEntity)) {
returnVal = false;
} else {
List<ERDAssociation> relationships = sourceEntity.getAssociations();
for (ERDAssociation relationship : relationships) {
if (relationship.getTargetEntity().equals(targetEntity) && relationship.getSourceEntity().equals(sourceEntity)) {
returnVal = false;
break;
}
}
}
return returnVal;
}
use of org.jkiss.dbeaver.erd.model.ERDElement in project dbeaver by serge-rider.
the class AssociationReconnectSourceCommand method canExecute.
/**
* Makes sure that primary key doesn't reconnect to itself or try to create
* a relationship which already exists
*/
@Override
public boolean canExecute() {
boolean returnVal = true;
ERDElement primaryEntity = association.getTargetEntity();
// cannot connect to itself
if (primaryEntity.equals(sourceEntity)) {
returnVal = false;
} else {
List<ERDAssociation> relationships = sourceEntity.getAssociations();
for (ERDAssociation relationship : relationships) {
if (relationship.getTargetEntity().equals(targetEntity) && relationship.getSourceEntity().equals(sourceEntity)) {
returnVal = false;
break;
}
}
}
return returnVal;
}
Aggregations