use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class PrintTablesBiFunction method apply.
@Override
public Void apply(FilterContainer filterContainer, DbImportTreeNode root) {
DbImportModel model = (DbImportModel) dbImportTree.getModel();
boolean isTransferable = dbImportTree.isTransferable();
if (root.getChildCount() != 0) {
root.removeAllChildren();
}
Collection<IncludeTable> includeTables = filterContainer.getIncludeTables();
for (IncludeTable includeTable : includeTables) {
DbImportTreeNode node = !isTransferable ? new DbImportTreeNode(includeTable) : new TransferableNode(includeTable);
if (isTransferable && includeTable.getIncludeColumns().isEmpty() && includeTable.getExcludeColumns().isEmpty()) {
dbImportTree.printParams(Collections.singletonList(new IncludeColumn("Loading...")), node);
}
root.add(node);
dbImportTree.packColumns(includeTable, node);
}
model.reload(root);
return null;
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class ColumnNode method getStatus.
@Override
public Status getStatus(ReverseEngineering config) {
Status parentStatus = getParent().getStatus(config);
if (parentStatus != Status.INCLUDE) {
return parentStatus;
}
List<FilterContainer> containers = getParent().getContainers(config);
List<IncludeColumn> includeColumns = new ArrayList<>();
List<ExcludeColumn> excludeColumns = new ArrayList<>();
for (FilterContainer container : containers) {
if (container == null) {
continue;
}
IncludeTable table = getParent().getIncludeTable(container.getIncludeTables());
if (table != null) {
includeColumns.addAll(table.getIncludeColumns());
excludeColumns.addAll(table.getExcludeColumns());
}
includeColumns.addAll(container.getIncludeColumns());
excludeColumns.addAll(container.getExcludeColumns());
}
return includesColumn(includeColumns, excludeColumns);
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class DbImportTree method printIncludeTables.
private void printIncludeTables(Collection<IncludeTable> collection, DbImportTreeNode parent) {
for (IncludeTable includeTable : collection) {
DbImportTreeNode node = !isTransferable ? new DbImportTreeNode(includeTable) : new TransferableNode(includeTable);
if (!node.getSimpleNodeName().equals("")) {
if (isTransferable && includeTable.getIncludeColumns().isEmpty() && includeTable.getExcludeColumns().isEmpty()) {
printParams(Collections.singletonList(new IncludeColumn("Loading...")), node);
}
printParams(includeTable.getIncludeColumns(), node);
printParams(includeTable.getExcludeColumns(), node);
parent.add(node);
}
}
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class AddIncludeTableAction method performAction.
@Override
public void performAction(ActionEvent e) {
ReverseEngineering reverseEngineeringOldCopy = prepareElements();
if (reverseEngineeringIsEmpty()) {
tree.getRootNode().removeAllChildren();
}
IncludeTable newTable = new IncludeTable(name);
if (canBeInserted(selectedElement)) {
((FilterContainer) selectedElement.getUserObject()).addIncludeTable(newTable);
selectedElement.add(new DbImportTreeNode(newTable));
updateSelected = true;
} else {
if (parentElement == null) {
parentElement = tree.getRootNode();
}
((FilterContainer) parentElement.getUserObject()).addIncludeTable(newTable);
parentElement.add(new DbImportTreeNode(newTable));
updateSelected = false;
}
completeInserting(reverseEngineeringOldCopy);
}
use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class AddPatternParamAction method performAction.
@Override
public void performAction(ActionEvent e) {
ReverseEngineering reverseEngineeringOldCopy = prepareElements();
Object selectedObject;
if (reverseEngineeringIsEmpty()) {
tree.getRootNode().removeAllChildren();
}
if (canBeInserted(selectedElement)) {
selectedObject = selectedElement.getUserObject();
if (selectedObject instanceof FilterContainer) {
addPatternParamToContainer(paramClass, selectedObject, name, selectedElement);
} else if (selectedObject instanceof IncludeTable) {
addPatternParamToIncludeTable(paramClass, selectedObject, name, selectedElement);
}
updateSelected = true;
} else {
if (parentElement == null) {
parentElement = tree.getRootNode();
}
selectedObject = parentElement.getUserObject();
if (selectedObject instanceof FilterContainer) {
addPatternParamToContainer(paramClass, selectedObject, name, parentElement);
} else if (selectedObject instanceof IncludeTable) {
addPatternParamToIncludeTable(paramClass, selectedObject, name, parentElement);
}
updateSelected = false;
}
completeInserting(reverseEngineeringOldCopy);
}
Aggregations