use of org.jkiss.dbeaver.ext.postgresql.model.PostgreTableConstraintColumn in project dbeaver by serge-rider.
the class PostgreConstraintConfigurator method configureObject.
@Override
public PostgreTableConstraint configureObject(DBRProgressMonitor monitor, Object parent, PostgreTableConstraint constraint) {
return UITask.run(() -> {
EditConstraintPage editPage = new EditConstraintPage(PostgreMessages.edit_constraint_page_add_constraint, constraint, new DBSEntityConstraintType[] { DBSEntityConstraintType.PRIMARY_KEY, DBSEntityConstraintType.UNIQUE_KEY, DBSEntityConstraintType.CHECK });
if (!editPage.edit()) {
return null;
}
constraint.setName(editPage.getConstraintName());
constraint.setConstraintType(editPage.getConstraintType());
if (constraint.getConstraintType().isCustom()) {
constraint.setSource(editPage.getConstraintExpression());
} else {
int colIndex = 1;
for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
constraint.addColumn(new PostgreTableConstraintColumn(constraint, (PostgreAttribute) tableColumn, colIndex++));
}
}
return constraint;
});
}
use of org.jkiss.dbeaver.ext.postgresql.model.PostgreTableConstraintColumn in project dbeaver by dbeaver.
the class PostgreConstraintConfigurator method configureObject.
@Override
public PostgreTableConstraint configureObject(DBRProgressMonitor monitor, Object parent, PostgreTableConstraint constraint) {
return UITask.run(() -> {
EditConstraintPage editPage = new EditConstraintPage(PostgreMessages.edit_constraint_page_add_constraint, constraint, new DBSEntityConstraintType[] { DBSEntityConstraintType.PRIMARY_KEY, DBSEntityConstraintType.UNIQUE_KEY, DBSEntityConstraintType.CHECK });
if (!editPage.edit()) {
return null;
}
constraint.setName(editPage.getConstraintName());
constraint.setConstraintType(editPage.getConstraintType());
if (constraint.getConstraintType().isCustom()) {
constraint.setSource(editPage.getConstraintExpression());
} else {
int colIndex = 1;
for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
constraint.addColumn(new PostgreTableConstraintColumn(constraint, (PostgreAttribute) tableColumn, colIndex++));
}
}
return constraint;
});
}
Aggregations