All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.akquinet.jbosscc.guttenbase.hints.TableOrderHint Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package de.akquinet.jbosscc.guttenbase.hints;

import de.akquinet.jbosscc.guttenbase.mapping.TableOrderComparatorFactory;
import de.akquinet.jbosscc.guttenbase.meta.DatabaseMetaData;
import de.akquinet.jbosscc.guttenbase.meta.TableMetaData;
import de.akquinet.jbosscc.guttenbase.repository.ConnectorRepository;
import de.akquinet.jbosscc.guttenbase.tools.AbstractTableCopyTool;
import de.akquinet.jbosscc.guttenbase.tools.CheckEqualTableDataTool;
import de.akquinet.jbosscc.guttenbase.tools.schema.comparison.SchemaComparatorTool;
import java.sql.SQLException;
import java.util.Comparator;
import java.util.List;

/**
 * Determine order of tables during copying/comparison.
 * 

* © 2012-2020 akquinet tech@spree *

* * * Hint is used by {@link SchemaComparatorTool} to determine table order * Hint is used by {@link AbstractTableCopyTool} to determine table order * Hint is used by {@link CheckEqualTableDataTool} to determine table order * @author M. Dahm */ @SuppressWarnings("deprecation") public abstract class TableOrderHint implements ConnectorHint { @Override public Class getConnectorHintType() { return TableOrderComparatorFactory.class; } /** * Helper method */ public static List getSortedTables(final ConnectorRepository connectorRepository, final String connectorId) throws SQLException { final DatabaseMetaData databaseMetaData = connectorRepository.getDatabaseMetaData(connectorId); final Comparator comparator = connectorRepository .getConnectorHint(connectorId, TableOrderComparatorFactory.class).getValue().createComparator(); final List tables = databaseMetaData.getTableMetaData(); tables.sort(comparator); return tables; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy