use of org.jkiss.dbeaver.model.struct.DBSDataManipulator in project dbeaver by serge-rider.
the class ResultSetModel method isAttributeReadOnly.
public boolean isAttributeReadOnly(@NotNull DBDAttributeBinding attribute) {
if (!isSingleSource()) {
return true;
}
if (attribute.getMetaAttribute().isReadOnly()) {
return true;
}
DBDRowIdentifier rowIdentifier = attribute.getRowIdentifier();
if (rowIdentifier == null || !(rowIdentifier.getEntity() instanceof DBSDataManipulator)) {
return true;
}
DBSDataManipulator dataContainer = (DBSDataManipulator) rowIdentifier.getEntity();
return (dataContainer.getSupportedFeatures() & DBSDataManipulator.DATA_UPDATE) == 0;
}
use of org.jkiss.dbeaver.model.struct.DBSDataManipulator in project dbeaver by dbeaver.
the class MockDataGenerateTool method execute.
public void execute(IWorkbenchWindow window, IWorkbenchPart activePart, Collection<DBSObject> objects) throws DBException {
ArrayList<DBSDataManipulator> dbObjects = new ArrayList<>();
for (DBSObject obj : objects) {
dbObjects.add((DBSDataManipulator) obj);
}
MockDataExecuteWizard wizard = new MockDataExecuteWizard(mockDataSettings, dbObjects, MockDataMessages.tools_mockdata_wizard_page_name);
ToolWizardDialog dialog = new ToolWizardDialog(window, wizard) {
@Override
protected void finishPressed() {
if (validateProperties(getCurrentPage())) {
return;
}
if (mockDataSettings.isRemoveOldData()) {
if (!UIUtils.confirmAction(getShell(), MockDataMessages.tools_mockdata_wizard_title, MockDataMessages.tools_mockdata_confirm_delete_old_data_message)) {
return;
}
}
super.finishPressed();
}
@Override
protected void nextPressed() {
IWizardPage currentPage = getCurrentPage();
if (currentPage instanceof MockDataWizardPageSettings) {
if (validateProperties(currentPage)) {
return;
}
}
super.nextPressed();
}
/**
* Returns TRUE if invalid
*/
private boolean validateProperties(IWizardPage currentPage) {
if (currentPage instanceof MockDataWizardPageSettings) {
if (!((MockDataWizardPageSettings) currentPage).validateProperties()) {
this.setErrorMessage("All numeric properties should be positive.");
return true;
}
}
return false;
}
@Override
protected Point getInitialSize() {
return new Point(850, 550);
}
};
dialog.open();
}
use of org.jkiss.dbeaver.model.struct.DBSDataManipulator in project dbeaver by dbeaver.
the class ResultSetModel method isAttributeReadOnly.
public boolean isAttributeReadOnly(@NotNull DBDAttributeBinding attribute) {
if (!isSingleSource()) {
return true;
}
if (attribute.getMetaAttribute().isReadOnly()) {
return true;
}
DBDRowIdentifier rowIdentifier = attribute.getRowIdentifier();
if (rowIdentifier == null || !(rowIdentifier.getEntity() instanceof DBSDataManipulator)) {
return true;
}
DBSDataManipulator dataContainer = (DBSDataManipulator) rowIdentifier.getEntity();
return (dataContainer.getSupportedFeatures() & DBSDataManipulator.DATA_UPDATE) == 0;
}
use of org.jkiss.dbeaver.model.struct.DBSDataManipulator in project dbeaver by dbeaver.
the class DatabaseProducerPageInputObjects method chooseEntity.
protected boolean chooseEntity(DataTransferPipe pipe) {
DataTransferSettings settings = getWizard().getSettings();
final DBNModel navigatorModel = DBWorkbench.getPlatform().getNavigatorModel();
final DBNNode rootNode = DBWorkbench.getPlatform().getWorkspace().getProjects().size() == 1 ? navigatorModel.getRoot().getProjectNode(DBWorkbench.getPlatform().getWorkspace().getActiveProject()) : navigatorModel.getRoot();
boolean chooseConsumer = settings.isConsumerOptional();
DBNNode node = DBWorkbench.getPlatformUI().selectObject(UIUtils.getActiveWorkbenchShell(), chooseConsumer ? NLS.bind(DTUIMessages.database_producer_page_input_objects_node_select_target, pipe.getProducer().getDatabaseObject().getName()) : NLS.bind(DTUIMessages.database_producer_page_input_objects_node_select_source, pipe.getConsumer().getObjectName()), rootNode, lastSelection, new Class[] { DBSObjectContainer.class, DBSDataContainer.class }, new Class[] { chooseConsumer ? DBSDataManipulator.class : DBSDataContainer.class }, null);
if (node instanceof DBNDatabaseNode) {
lastSelection = (DBNDatabaseNode) node;
DBSObject object = ((DBNDatabaseNode) node).getObject();
if (chooseConsumer) {
if (object instanceof DBSDataManipulator) {
pipe.setConsumer(new DatabaseTransferConsumer((DBSDataManipulator) object));
}
} else {
if (object instanceof DBSDataContainer) {
pipe.setProducer(new DatabaseTransferProducer((DBSDataContainer) object));
}
}
return true;
}
return false;
}
use of org.jkiss.dbeaver.model.struct.DBSDataManipulator in project dbeaver by dbeaver.
the class DatabaseProducerPageInputObjects method autoAssignMappings.
private void autoAssignMappings(List<DBSObject> containerObjects) {
boolean chooseConsumer = getWizard().getSettings().isConsumerOptional();
for (TableItem item : mappingTable.getItems()) {
DataTransferPipe pipe = (DataTransferPipe) item.getData();
if ((chooseConsumer && (pipe.getConsumer() == null || pipe.getConsumer().getDatabaseObject() == null)) || (!chooseConsumer && (pipe.getProducer() == null || pipe.getProducer().getDatabaseObject() == null))) {
DBSObject objectToMap = chooseConsumer ? pipe.getProducer().getDatabaseObject() : pipe.getConsumer().getDatabaseObject();
if (objectToMap == null) {
continue;
}
DBSObject object = DBUtils.findObject(containerObjects, objectToMap.getName());
if (object != null) {
if (chooseConsumer) {
if (object instanceof DBSDataManipulator) {
pipe.setConsumer(new DatabaseTransferConsumer((DBSDataManipulator) object));
}
} else {
if (object instanceof DBSDataContainer) {
pipe.setProducer(new DatabaseTransferProducer((DBSDataContainer) object));
}
}
updateItemData(item, pipe);
}
}
}
updatePageCompletion();
}
Aggregations