use of org.jkiss.dbeaver.ext.postgresql.model.PostgreAttribute in project dbeaver by serge-rider.
the class PostgreEnumValueManager method getEnumValues.
@Override
protected List<String> getEnumValues(IValueController valueController) {
final PostgreAttribute attribute = (PostgreAttribute) valueController.getValueType();
if (attribute.getDataType() == null) {
return null;
}
final Object[] values = attribute.getDataType().getEnumValues();
if (values == null) {
return null;
}
List<String> strValues = new ArrayList<>(values.length);
for (Object value : values) {
strValues.add(DBValueFormatting.getDefaultValueDisplayString(value, DBDDisplayFormat.UI));
}
return strValues;
}
use of org.jkiss.dbeaver.ext.postgresql.model.PostgreAttribute 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.PostgreAttribute in project dbeaver by dbeaver.
the class PostgreEnumValueManager method getEnumValues.
@Override
protected List<String> getEnumValues(IValueController valueController) {
final PostgreAttribute attribute = (PostgreAttribute) valueController.getValueType();
if (attribute.getDataType() == null) {
return null;
}
final Object[] values = attribute.getDataType().getEnumValues();
if (values == null) {
return null;
}
List<String> strValues = new ArrayList<>(values.length);
for (Object value : values) {
strValues.add(DBValueFormatting.getDefaultValueDisplayString(value, DBDDisplayFormat.UI));
}
return strValues;
}
use of org.jkiss.dbeaver.ext.postgresql.model.PostgreAttribute 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