use of org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint in project dbeaver by serge-rider.
the class OracleForeignKeyConfigurator method configureObject.
@Override
public OracleTableForeignKey configureObject(DBRProgressMonitor monitor, Object table, OracleTableForeignKey foreignKey) {
return UITask.run(() -> {
EditForeignKeyPage editPage = new EditForeignKeyPage(OracleUIMessages.edit_oracle_foreign_key_manager_dialog_title, foreignKey, new DBSForeignKeyModifyRule[] { DBSForeignKeyModifyRule.NO_ACTION, DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT, DBSForeignKeyModifyRule.SET_NULL, DBSForeignKeyModifyRule.SET_DEFAULT });
editPage.setSupportsCustomName(true);
if (!editPage.edit()) {
return null;
}
foreignKey.setReferencedConstraint((OracleTableConstraint) editPage.getUniqueConstraint());
foreignKey.setName(editPage.getName());
foreignKey.setDeleteRule(editPage.getOnDeleteRule());
int colIndex = 1;
for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
foreignKey.addColumn(new OracleTableForeignKeyColumn(foreignKey, (OracleTableColumn) tableColumn.getOwnColumn(), colIndex++));
}
return foreignKey;
});
}
use of org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint in project dbeaver by dbeaver.
the class OracleForeignKeyConfigurator method configureObject.
@Override
public OracleTableForeignKey configureObject(DBRProgressMonitor monitor, Object table, OracleTableForeignKey foreignKey) {
return UITask.run(() -> {
EditForeignKeyPage editPage = new EditForeignKeyPage(OracleUIMessages.edit_oracle_foreign_key_manager_dialog_title, foreignKey, new DBSForeignKeyModifyRule[] { DBSForeignKeyModifyRule.NO_ACTION, DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT, DBSForeignKeyModifyRule.SET_NULL, DBSForeignKeyModifyRule.SET_DEFAULT });
editPage.setSupportsCustomName(true);
if (!editPage.edit()) {
return null;
}
foreignKey.setReferencedConstraint((OracleTableConstraint) editPage.getUniqueConstraint());
foreignKey.setName(editPage.getName());
foreignKey.setDeleteRule(editPage.getOnDeleteRule());
int colIndex = 1;
for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
foreignKey.addColumn(new OracleTableForeignKeyColumn(foreignKey, (OracleTableColumn) tableColumn.getOwnColumn(), colIndex++));
}
return foreignKey;
});
}
use of org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint 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;
});
}
use of org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint in project dbeaver by serge-rider.
the class OracleConstraintManager method addObjectCreateActions.
@Override
protected void addObjectCreateActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectCreateCommand command, Map<String, Object> options) {
OracleTableConstraint constraint = command.getObject();
boolean isView = constraint.getTable().isView();
String tableType = isView ? "VIEW" : "TABLE";
OracleTableBase table = constraint.getTable();
actions.add(new SQLDatabasePersistAction(ModelMessages.model_jdbc_create_new_constraint, "ALTER " + tableType + " " + table.getFullyQualifiedName(DBPEvaluationContext.DDL) + "\nADD " + getNestedDeclaration(monitor, table, command, options) + "\n" + (!isView && constraint.getStatus() == OracleObjectStatus.ENABLED ? "ENABLE" : "DISABLE") + (isView ? " NOVALIDATE" : "")));
}
use of org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint in project dbeaver by dbeaver.
the class OracleConstraintManager method addObjectCreateActions.
@Override
protected void addObjectCreateActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectCreateCommand command, Map<String, Object> options) {
OracleTableConstraint constraint = command.getObject();
boolean isView = constraint.getTable().isView();
String tableType = isView ? "VIEW" : "TABLE";
OracleTableBase table = constraint.getTable();
actions.add(new SQLDatabasePersistAction(ModelMessages.model_jdbc_create_new_constraint, "ALTER " + tableType + " " + table.getFullyQualifiedName(DBPEvaluationContext.DDL) + "\nADD " + getNestedDeclaration(monitor, table, command, options) + "\n" + (!isView && constraint.getStatus() == OracleObjectStatus.ENABLED ? "ENABLE" : "DISABLE") + (isView ? " NOVALIDATE" : "")));
}
Aggregations