Search in sources :

Example 1 with FilterContainer

use of org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer in project cayenne by apache.

the class EditNodeAction method performAction.

@Override
public void performAction(ActionEvent e) {
    if (tree.isEditing()) {
        return;
    }
    if (e != null) {
        if (tree.getSelectionPath() != null) {
            tree.startEditingAtPath(tree.getSelectionPath());
        }
    }
    if (actionName == null) {
        return;
    }
    if (tree.getSelectionPath() != null) {
        selectedElement = tree.getSelectedNode();
        parentElement = (DbImportTreeNode) selectedElement.getParent();
        if (parentElement != null) {
            Object selectedObject = selectedElement.getUserObject();
            ReverseEngineering reverseEngineeringOldCopy = new ReverseEngineering(tree.getReverseEngineering());
            if (!Util.isEmptyString(actionName)) {
                if (selectedObject instanceof FilterContainer) {
                    ((FilterContainer) selectedObject).setName(actionName);
                } else if (selectedObject instanceof PatternParam) {
                    ((PatternParam) selectedObject).setPattern(actionName);
                }
                updateModel(true);
                selectedElement = null;
            }
            if (!actionName.equals(EMPTY_NAME)) {
                putReverseEngineeringToUndoManager(reverseEngineeringOldCopy);
            }
        }
    }
}
Also used : PatternParam(org.apache.cayenne.dbsync.reverse.dbimport.PatternParam) ReverseEngineering(org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering) FilterContainer(org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer)

Example 2 with FilterContainer

use of org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer in project cayenne by apache.

the class SchemaTableNode method getContainers.

@Override
List<FilterContainer> getContainers(ReverseEngineering config) {
    List<FilterContainer> containers = new ArrayList<>();
    if (getParent() != null && getParent().getParent() != null) {
        Catalog catalog = getParent().getParent().getCatalog(config);
        if (catalog != null) {
            containers.add(getParent().getSchema(catalog));
            containers.add(catalog);
        }
        containers.add(getParent().getSchema(config));
    }
    containers.add(config);
    return containers;
}
Also used : FilterContainer(org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer) ArrayList(java.util.ArrayList) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog)

Example 3 with FilterContainer

use of org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer in project cayenne by apache.

the class TableNode method getStatus.

@Override
public Status getStatus(ReverseEngineering config) {
    T parent = getParent();
    if (parent != null) {
        Status parentStatus = parent.getStatus(config);
        if (parentStatus != Status.INCLUDE) {
            return parentStatus;
        }
    }
    List<IncludeTable> includeTables = new ArrayList<>();
    List<ExcludeTable> excludeTables = new ArrayList<>();
    for (FilterContainer container : getContainers(config)) {
        if (container == null) {
            continue;
        }
        includeTables.addAll(container.getIncludeTables());
        excludeTables.addAll(container.getExcludeTables());
    }
    return includesTable(includeTables, excludeTables);
}
Also used : IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) FilterContainer(org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer) ArrayList(java.util.ArrayList) ExcludeTable(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable)

Example 4 with FilterContainer

use of org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer in project cayenne by apache.

the class SchemaProcedureNode method getContainers.

@Override
List<FilterContainer> getContainers(ReverseEngineering config) {
    List<FilterContainer> containers = new ArrayList<>();
    if (getParent() != null && getParent().getParent() != null) {
        Catalog catalog = getParent().getParent().getCatalog(config);
        if (catalog != null) {
            containers.add(getParent().getSchema(catalog));
            containers.add(catalog);
        }
        containers.add(getParent().getSchema(config));
    }
    containers.add(config);
    return containers;
}
Also used : FilterContainer(org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer) ArrayList(java.util.ArrayList) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog)

Example 5 with FilterContainer

use of org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer in project cayenne by apache.

the class ProcedureNode method getStatus.

@Override
public Status getStatus(ReverseEngineering config) {
    Status parentStatus = getParent().getStatus(config);
    if (parentStatus != Status.INCLUDE) {
        return parentStatus;
    }
    List<IncludeProcedure> includeProcedures = new ArrayList<>();
    List<ExcludeProcedure> excludeProcedures = new ArrayList<>();
    for (FilterContainer container : getContainers(config)) {
        if (container == null) {
            continue;
        }
        includeProcedures.addAll(container.getIncludeProcedures());
        excludeProcedures.addAll(container.getExcludeProcedures());
    }
    return includesProcedure(includeProcedures, excludeProcedures);
}
Also used : FilterContainer(org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer) ArrayList(java.util.ArrayList) ExcludeProcedure(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeProcedure) IncludeProcedure(org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure)

Aggregations

FilterContainer (org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer)11 ArrayList (java.util.ArrayList)6 IncludeTable (org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable)6 ReverseEngineering (org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering)4 Catalog (org.apache.cayenne.dbsync.reverse.dbimport.Catalog)3 ExcludeTable (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable)3 IncludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn)3 PatternParam (org.apache.cayenne.dbsync.reverse.dbimport.PatternParam)3 DbImportTreeNode (org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode)3 ExcludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn)2 ExcludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeProcedure)2 IncludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure)2 Collection (java.util.Collection)1 Collections (java.util.Collections)1 BiFunction (java.util.function.BiFunction)1 JTree (javax.swing.JTree)1 TreeExpansionEvent (javax.swing.event.TreeExpansionEvent)1 TreeExpansionListener (javax.swing.event.TreeExpansionListener)1 TreeNode (javax.swing.tree.TreeNode)1 TreePath (javax.swing.tree.TreePath)1