Search in sources :

Example 1 with OracleTableConstraintColumn

use of org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraintColumn in project dbeaver by serge-rider.

the class OracleConstraintConfigurator method configureObject.

@Override
public OracleTableConstraint configureObject(DBRProgressMonitor monitor, Object parent, OracleTableConstraint constraint) {
    return UITask.run(() -> {
        EditConstraintPage editPage = new EditConstraintPage(OracleUIMessages.edit_oracle_constraint_manager_dialog_title, constraint, new DBSEntityConstraintType[] { DBSEntityConstraintType.PRIMARY_KEY, DBSEntityConstraintType.UNIQUE_KEY, DBSEntityConstraintType.CHECK });
        if (!editPage.edit()) {
            return null;
        }
        constraint.setName(editPage.getConstraintName());
        constraint.setConstraintType(editPage.getConstraintType());
        constraint.setSearchCondition(editPage.getConstraintExpression());
        int colIndex = 1;
        for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
            constraint.addColumn(new OracleTableConstraintColumn(constraint, (OracleTableColumn) tableColumn, colIndex++));
        }
        return constraint;
    });
}
Also used : DBSEntityAttribute(org.jkiss.dbeaver.model.struct.DBSEntityAttribute) OracleTableColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn) OracleTableConstraintColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraintColumn) EditConstraintPage(org.jkiss.dbeaver.ui.editors.object.struct.EditConstraintPage) OracleTableConstraint(org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint)

Aggregations

OracleTableColumn (org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn)1 OracleTableConstraint (org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint)1 OracleTableConstraintColumn (org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraintColumn)1 DBSEntityAttribute (org.jkiss.dbeaver.model.struct.DBSEntityAttribute)1 EditConstraintPage (org.jkiss.dbeaver.ui.editors.object.struct.EditConstraintPage)1