Search in sources :

Example 1 with PatternParam

use of org.apache.cayenne.dbsync.reverse.dbimport.PatternParam 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 PatternParam

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

the class AddPatternParamAction method addPatternParamToIncludeTable.

private void addPatternParamToIncludeTable(Class paramClass, Object selectedObject, String name, DbImportTreeNode node) {
    IncludeTable includeTable = (IncludeTable) selectedObject;
    PatternParam element = null;
    if (paramClass == IncludeColumn.class) {
        element = new IncludeColumn(name);
        includeTable.addIncludeColumn((IncludeColumn) element);
    } else if (paramClass == ExcludeColumn.class) {
        element = new ExcludeColumn(name);
        includeTable.addExcludeColumn((ExcludeColumn) element);
    }
    node.add(new DbImportTreeNode(element));
}
Also used : PatternParam(org.apache.cayenne.dbsync.reverse.dbimport.PatternParam) DbImportTreeNode(org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode) IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) ExcludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn) IncludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn)

Example 3 with PatternParam

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

the class AddPatternParamAction method addPatternParamToContainer.

private void addPatternParamToContainer(Class paramClass, Object selectedObject, String name, DbImportTreeNode node) {
    FilterContainer container = (FilterContainer) selectedObject;
    PatternParam element = null;
    if (paramClass == ExcludeTable.class) {
        element = new ExcludeTable(name);
        container.addExcludeTable((ExcludeTable) element);
    } else if (paramClass == IncludeColumn.class) {
        element = new IncludeColumn(name);
        container.addIncludeColumn((IncludeColumn) element);
    } else if (paramClass == ExcludeColumn.class) {
        element = new ExcludeColumn(name);
        container.addExcludeColumn((ExcludeColumn) element);
    } else if (paramClass == IncludeProcedure.class) {
        element = new IncludeProcedure(name);
        container.addIncludeProcedure((IncludeProcedure) element);
    } else if (paramClass == ExcludeProcedure.class) {
        element = new ExcludeProcedure(name);
        container.addExcludeProcedure((ExcludeProcedure) element);
    }
    node.add(new DbImportTreeNode(element));
}
Also used : PatternParam(org.apache.cayenne.dbsync.reverse.dbimport.PatternParam) DbImportTreeNode(org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode) FilterContainer(org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer) ExcludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn) ExcludeProcedure(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeProcedure) IncludeColumn(org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn) IncludeProcedure(org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure) ExcludeTable(org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable)

Aggregations

PatternParam (org.apache.cayenne.dbsync.reverse.dbimport.PatternParam)3 ExcludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn)2 FilterContainer (org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer)2 IncludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn)2 DbImportTreeNode (org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode)2 ExcludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeProcedure)1 ExcludeTable (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable)1 IncludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure)1 IncludeTable (org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable)1 ReverseEngineering (org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering)1