name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
morf_DatabaseMetaDataProvider_readTableName_rdh
/** * Retrieves table name from a result set. * * @param tableResultSet * Result set to be read. * @return Name of the table. * @throws SQLException * Upon errors. */ protected RealName readTableName(ResultSet tableResultSet) throws SQLException { String tableName = tableResultSet.getString(TABLE_NAME);...
3.26
morf_DatabaseMetaDataProvider_getTable_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#getTable(java.lang.String) */ @Overridepublic Table getTable(String tableName) { return tableCache.getUnchecked(named(tableName));}
3.26
morf_DatabaseMetaDataProvider_getDbName_rdh
/** * The name as retrieved by the JDBC driver. * * @return name as expected in the database */ public String getDbName() { return getAName(); }
3.26
morf_DatabaseMetaDataProvider_setAdditionalColumnMetadata_rdh
/** * Sets additional column information. * * @param tableName * Name of the table. * @param column * Column builder to set to. * @param columnResultSet * Result set to be read. * @return Resulting column builder. * @throws SQLException * Upon errors. */ @SuppressWarnings("unused") protected ColumnB...
3.26
morf_DatabaseMetaDataProvider_tableNames_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#tableNames() */ @Override public Collection<String> tableNames() { return tableNames.get().values().stream().map(RealName::getRealName).collect(Collectors.toList()); }
3.26
morf_DatabaseMetaDataProvider_tableTypesForTables_rdh
/** * Types for {@link DatabaseMetaData#getTables(String, String, String, String[])} * used by {@link #loadAllTableNames()}. * * @return Array of relevant JDBC types. */ protected String[] tableTypesForTables() { return new String[]{ "TABLE" }; }
3.26
morf_DatabaseMetaDataProvider_getRealName_rdh
/** * The user-friendly camel-case name of the object, * often derived by looking at the comment of that object, * or in schema descriptions. * * @return user-friendly camel-case name */ public String getRealName() { return realName; }
3.26
morf_DatabaseMetaDataProvider_createColumnsFrom_rdh
/** * Creates a list of table columns from given columns and map of primary key columns. * Also reorders the primary key columns between themselves to reflect the order of columns within the primary key. * * @param originalColumns * Collection of table columns to work with. * @param primaryKey * Map of respe...
3.26
morf_DatabaseMetaDataProvider_setColumnAutonumbered_rdh
/** * Sets column being autonumbered from a result set. * * @param tableName * Name of the table. * @param column * Column builder to set to. * @param columnResultSet * Result set to be read. * @return Resulting column builder. * @throws SQLException * Upon errors. */ @SuppressWarnings("unused") pro...
3.26
morf_DatabaseMetaDataProvider_loadTableColumns_rdh
/** * Loads the columns for the given table name. * * @param tableName * Name of the table. * @param primaryKey * Map of respective positions by column names. * @return List of table columns. */ protected List<Column> loadTableColumns(RealName tableName, Map<AName, Integer> primaryKey) { final Collecti...
3.26
morf_DatabaseMetaDataProvider_loadTableIndexes_rdh
/** * Loads the indexes for the given table name, except for the primary key index. * * @param tableName * Name of the table. * @return List of table indexes. */ protected List<Index> loadTableIndexes(RealName tableName) { final Map<RealName, ImmutableList.Builder<RealName>> indexColumns = new HashMap<>(); ...
3.26
morf_DatabaseMetaDataProvider_tableTypesForViews_rdh
/** * Types for {@link DatabaseMetaData#getTables(String, String, String, String[])} * used by {@link #loadAllViewNames()}. * * @return Array of relevant JDBC types. */ protected String[] tableTypesForViews() { return new String[]{ "VIEW" }; }
3.26
morf_DatabaseMetaDataProvider_isEmptyDatabase_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#isEmptyDatabase() */ @Override public boolean isEmptyDatabase() { return tableNames.get().isEmpty(); }
3.26
morf_DatabaseMetaDataProvider_dataTypeFromSqlType_rdh
/** * Converts a given SQL data type to a {@link DataType}. * * @param typeCode * JDBC data type. * @param typeName * JDBC type name. * @param width ...
3.26
morf_DatabaseMetaDataProvider_setColumnNullability_rdh
/** * Sets column nullability from a result set. * * @param tableName * Name of the table. * @param column * Column builder to set to. * @param columnResultSet * ...
3.26
morf_DatabaseMetaDataProvider_isIgnoredTable_rdh
/** * Identify whether or not the specified table should be ignored in the metadata. This is * typically used to filter temporary tables. * * @param tableName * The table which we are accessing. * @return <var>true</var> if the table should be ignored, false otherwise. */ protected boolean isIgnoredTable(@Supp...
3.26
morf_DatabaseMetaDataProvider_readViewName_rdh
/** * Retrieves view name from a result set. * * @param viewResultSet * Result set to be read. * @return Name of the view. * @throws SQLException * Upon errors. */ protected RealName readViewName(ResultSet viewResultSet) throws SQLException { String viewName = viewResultSet.getString(TABLE_NAME); re...
3.26
morf_DatabaseMetaDataProvider_readColumnName_rdh
/** * Retrieves column name from a result set. * * @param columnResultSet * Result set to be read. * @return Name of the column. * @throws SQLException * Upon errors. */ protected RealName readColumnName(ResultSet columnResultSet) throws SQLException { String columnName = columnResultSet.getString(COLUM...
3.26
morf_DatabaseMetaDataProvider_loadAllColumns_rdh
/** * Creates a map of maps of all table columns, * first indexed by their case-agnostic table names, * and then indexed by their case-agnostic column names. * * @return Map of table columns by table names and column names. */ protected Map<AName, Map<AName, ColumnBuilder>> loadAllColumns() { final Map<AName,...
3.26
morf_DatabaseMetaDataProvider_m0_rdh
/** * Identify whether or not the table is one owned by the system, or owned by * our application. The default implementation assumes that all tables we can * access in the schema are under our control. * * @param tableName * The table which we are accessing. * @return <var>true</var> if the table is owned by ...
3.26
morf_DatabaseMetaDataProvider_viewExists_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#viewExists(java.lang.String) */ @Override public boolean viewExists(String viewName) { return viewNames.get().containsKey(named(viewName)); }
3.26
morf_DatabaseMetaDataProvider_readIndexName_rdh
/** * Retrieves index name from a result set. * * @param indexResultSet * Result set to be read. * @return Name of the index. * @throws SQLException * Upon errors. */ protected RealName readIndexName(ResultSet indexResultSet) throws SQLException { String indexName = indexResultSet.getString(INDEX_NAME)...
3.26
morf_DatabaseMetaDataProvider_isIgnoredView_rdh
/** * Identify whether or not the specified view should be ignored in the metadata. This is * typically used to filter temporary tables. * * @param viewName * The view which we are accessing. * @return <var>true</var> if the table should be ignored, false otherwise. */ protected boolean isIgnoredView(@Suppress...
3.26
morf_DatabaseMetaDataProvider_isPrimaryKeyIndex_rdh
/** * Identify whether this is the primary key for this table. * * @param indexName * Name of the index. * @return true for primary key, false otherwise. */ protected boolean isPrimaryKeyIndex(RealName indexName) {return "PRIMARY".equals(indexName.getDbName()); }
3.26
morf_DatabaseMetaDataProvider_createIndexFrom_rdh
/** * Creates an index from given info. * * @param indexName * The name of the index. * @param isUnique * Whether to mark this index as unique. * @param columnNames * The column names for the index. * @return An {@link IndexBuilder} for the index. */ protected static Index createIndexFrom(RealName index...
3.26
morf_DatabaseMetaDataProvider_isSystemView_rdh
/** * Identify whether or not the view is one owned by the system, or owned by * our application. The default implementation assumes that all views we can * access in the schema are under our control. * * @param viewName * The view which we are accessing. * @return <var>true</var> if the view is owned by the s...
3.26
morf_DatabaseMetaDataProvider_loadAllTableNames_rdh
/** * Creates a map of all table names, * indexed by their case-agnostic names. * * @return Map of real table names. */ protected Map<AName, RealName> loadAllTableNames() { final ImmutableMap.Builder<AName, RealName> tableNameMappings = ImmutableMap.builder(); try { final DatabaseMetaData v1 = c...
3.26
morf_DatabaseMetaDataProvider_getView_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#getView(java.lang.String) */ @Overridepublic View getView(String viewName) { return viewCache.getUnchecked(named(viewName)); }
3.26
morf_IndexNameDecorator_columnNames_rdh
/** * * @see org.alfasoftware.morf.metadata.Index#columnNames() */ @Override public List<String> columnNames() { return index.columnNames(); }
3.26
morf_IndexNameDecorator_isUnique_rdh
/** * * @see org.alfasoftware.morf.metadata.Index#isUnique() */ @Override public boolean isUnique() { return index.isUnique(); }
3.26
morf_MergeStatementBuilder_getSelectStatement_rdh
/** * Gets the select statement that selects the values to merge * into the table. * * @return the select statement. */ SelectStatement getSelectStatement() { return selectStatement; }
3.26
morf_MergeStatementBuilder_getTable_rdh
/** * Gets the table to merge the data into. * * @return the table. */ TableReference getTable() { return table; }
3.26
morf_MergeStatementBuilder_getIfUpdating_rdh
/** * Gets the list of expressions to be used when updating existing records. * * @return the expressions for updating */ Iterable<AliasedField> getIfUpdating() { return ifUpdating; }
3.26
morf_MergeStatementBuilder_set_rdh
/** * Adds a merge expression to be used when updating existing records. * * @param updateExpression * the merge expressions, aliased as target field name. * @return this, for method chaining. */ public UpdateValuesOverrider set(AliasedFieldBuilder updateExpression) { expressions.add(updateExpression.build(...
3.26
morf_MergeStatementBuilder_getTableUniqueKey_rdh
/** * Gets a list of the fields used as the key upon which to match. * * @return the table unique key. */ List<AliasedField> getTableUniqueKey() { return tableUniqueKey; }
3.26
morf_MergeStatementBuilder_ifUpdating_rdh
/** * Specifies the merge expressions to be used when updating existing records. * * <pre> * merge() * .into(tableRef("BalanceAccumulator")) * .tableUniqueKey(field("id")) * .from(select() * .fields(literal(17).as("id")) * .fields(literal(123.45).as("lastAmount")) * .fields...
3.26
morf_MergeStatementBuilder_tableUniqueKey_rdh
/** * <p> * Specifies the fields which make up a unique index or primary key on the * target table. * </p> * <p> * These <em>must</em> fully match a unique index or primary key, otherwise * this statement will fail on MySQL. Note also potential issues around having * two unique indexes or a primary key and uni...
3.26
morf_MergeStatementBuilder_into_rdh
/** * Merges into a specific table. * * <blockquote><pre> * merge().into(new TableReference("agreement"));</pre></blockquote> * * @param intoTable * the table to merge into. * @return this, for method chaining. */ public MergeStatementBuilder into(TableReference intoTable) { this.table = intoTable;ret...
3.26
morf_MergeStatementBuilder_existing_rdh
/** * For updating existing records, references the existing field value, i.e. the value before merge. * To reference the new value being merged, use {@link #input(String)}. * * @param name * Name of the referenced field. * @return Reference to the existing field value. */ public AliasedField existing(String n...
3.26
morf_MergeStatementBuilder_from_rdh
/** * Specifies the select statement to use as a source of the data. * * @param statement * the source statement. * @return this, for method chaining. */ public MergeStatementBuilder from(SelectStatement statement) { if (statement.getOrderBys().size() != 0) { throw new IllegalArgumentException("ORDE...
3.26
morf_MergeStatementBuilder_input_rdh
/** * For updating existing records, references the new field value being merged, i.e. the value provided by the select. * To reference the existing value being replaced, use {@link #existing(String)}. * * @param name * Name of the referenced field. * @return Reference to the new field value being merged. */ p...
3.26
morf_GraphBasedUpgradeBuilder_prepareGraph_rdh
/** * Build execution graph. * * @param nodes * to be inserted into the graph * @return root node of the graph */ private GraphBasedUpgradeNode prepareGraph(List<GraphBasedUpgradeNode> nodes) { GraphBasedUpgradeNode root = new GraphBasedUpgradeNode("root", 0, new HashSet<>(), new HashSet<>(), false); ...
3.26
morf_GraphBasedUpgradeBuilder_produceNodes_rdh
/** * Maps instances of {@link UpgradeStep} to instances of {@link GraphBasedUpgradeNode}. * * @param upgradeSteps * to be mapped * @param mapper * to be used * @return list of {@link GraphBasedUpgradeNode} instances */ private List<GraphBasedUpgradeNode> produceNodes(List<UpgradeStep> upgradeSteps, Upgrade...
3.26
morf_GraphBasedUpgradeBuilder_addEdge_rdh
/** * Adds graph's edge. * * @param parent * node which fulfills a dependency * @param child * node with a dependency */ private void addEdge(GraphBasedUpgradeNode parent, GraphBasedUpgradeNode child) { parent.getChildren().add(child); child.getParents().add(parent); }
3.26
morf_GraphBasedUpgradeBuilder_prepareGraphBasedUpgrade_rdh
/** * Builds {@link GraphBasedUpgrade} instance. * * @return ready to execute {@link GraphBasedUpgrade} instance */ public GraphBasedUpgrade prepareGraphBasedUpgrade(List<String> initialisationSql) { UpgradeStepToUpgradeNode mapper = new UpgradeStepToUpgradeNode(schemaChangeSequence.getUpgradeTableResolution())...
3.26
morf_GraphBasedUpgradeBuilder_analyzeDependency_rdh
/** * Checks dependencies of current node and previously processed node to * establish if an edge should be added. * * @param processed * previously processed node * @param node * current node * @param remainingReads * read-level dependencies which haven't been reflected in the graph so far * @param rem...
3.26
morf_GraphBasedUpgradeBuilder_logGraph_rdh
/** * Traverses graph and logs it. * * @param node * the first node of the graph (or part of the graph) to be logged */ void logGraph(GraphBasedUpgradeNode node) { traverseAndLog(node, new HashSet<>()); }
3.26
morf_GraphBasedUpgradeBuilder_apply_rdh
/** * Builds a new {@link GraphBasedUpgradeNode} instance based on * {@link UpgradeStep} instance and augmented by information contained in the * {@link UpgradeTableResolution}. * * @see java.util.function.Function#apply(java.lang.Object) */ @Override public GraphBasedUpgradeNode apply(UpgradeStep upg) { St...
3.26
morf_GraphBasedUpgradeBuilder_handleExclusiveExecutionNode_rdh
/** * Handle nodes without defined dependencies or with explicit exclusive * execution requirement. * * @param processedNodes * previously processed node * @param node * current node * @param root * of the graph */ private void handleExclusiveExecutionNode(List<GraphBasedUpgradeNode> processedNodes, G...
3.26
morf_GraphBasedUpgradeBuilder_handleStandardNode_rdh
/** * Insert standard node (node with dependencies which doesn't require exclusive * execution) into the graph. * * @param processedNodes * nodes processed so far * @param node * to be inserted * @param root * of the graph */ private void handleStandardNode(List<GraphBasedUpgradeNode> processedNodes, G...
3.26
morf_GraphBasedUpgradeBuilder_traverseAndLog_rdh
/** * Recurrence method logging the nodes. * * @param node * to be logged * @param visited * set of already logged nodes which should not be logged again */ private void traverseAndLog(GraphBasedUpgradeNode node, Set<GraphBasedUpgradeNode> visited) { if (!visited.contains(node)) { LOG.debug(node....
3.26
morf_GraphBasedUpgradeBuilder_create_rdh
/** * Creates new {@link GraphBasedUpgradeBuilder}. * * @param sourceSchema * source schema * @param targetSchema * target schema * @param connectionResources * connection resources to be used * @param exclusiveExecutionSteps * names of the upgrade step classes which should * be executed in an excl...
3.26
morf_ValueConverters_booleanValue_rdh
/** * Always returns true or false in line with the contract of {@link Boolean#valueOf(String)}. */ @Override public Boolean booleanValue(T value) { return Boolean.valueOf(value.toString()); }
3.26
morf_ValueConverters_bigDecimalValue_rdh
/** * Naive implementation which requires a string conversion. Subtypes define more efficient implementations. */ @Override public BigDecimal bigDecimalValue(T value) { return new BigDecimal(value.toString()); }
3.26
morf_DataSetProducerBuilderImpl_close_rdh
/** * * @see org.alfasoftware.morf.dataset.DataSetProducer#close() */ @Override public void close() { // Nothing to do }
3.26
morf_DataSetProducerBuilderImpl_open_rdh
/** * * @see org.alfasoftware.morf.dataset.DataSetProducer#open() */ @Override public void open() { // Nothing to do }
3.26
morf_DataSetProducerBuilderImpl_getSchema_rdh
/** * * @see org.alfasoftware.morf.dataset.DataSetProducer#getSchema() */ @Override public Schema getSchema() { return schema; }
3.26
morf_DataSetProducerBuilderImpl_records_rdh
/** * * @see org.alfasoftware.morf.dataset.DataSetProducer#records(java.lang.String) */ @Override public List<Record> records(String tableName) { List<Record> records = recordMap.get(tableName.toUpperCase()); if (records == null) { throw new IllegalStateException(("No record data has been provided...
3.26
morf_DataSetProducerBuilderImpl_isTableEmpty_rdh
/** * * @see org.alfasoftware.morf.dataset.DataSetProducer#isTableEmpty(java.lang.String) */ @Override public boolean isTableEmpty(String tableName) {return records(tableName).isEmpty(); }
3.26
morf_DataSetProducerBuilderImpl_table_rdh
/** * * @see org.alfasoftware.morf.metadata.DataSetUtils.DataSetProducerBuilder#table(java.lang.String, java.util.List) */ @Override public DataSetProducerBuilder table(String tableName, Record... records) { table(tableName, Arrays.asList(records)); return this; }
3.26
morf_SchemaChangeSequence_changeColumn_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#changeColumn(java.lang.String, org.alfasoftware.morf.metadata.Column, org.alfasoftware.morf.metadata.Column) */ @Override public void changeColumn(String tableName, Column fromDefinition, Column toDefinition) { ChangeColumn changeColumn = new ChangeColumn(t...
3.26
morf_SchemaChangeSequence_removeTable_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#removeTable(org.alfasoftware.morf.metadata.Table) */ @Override public void removeTable(Table table) { RemoveTable removeTable = new RemoveTable(table); visitor.visit(removeTable); schemaAndDataChangeVisitor.visit(removeTable); }
3.26
morf_SchemaChangeSequence_addColumn_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#addColumn(java.lang.String, org.alfasoftware.morf.metadata.Column) */ @Override public void addColumn(String tableName, Column definition, FieldLiteral defaultValue) { // create a new Column with the default and add this first ColumnBuilder temporaryD...
3.26
morf_SchemaChangeSequence_applyToSchema_rdh
/** * Applies the changes to the given schema. * * @param initialSchema * The schema to apply changes to. * @return the resulting schema after applying changes in this sequence */ public Schema applyToSchema(Schema i...
3.26
morf_SchemaChangeSequence_addTableFrom_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#addTableFrom(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.sql.SelectStatement) */ @Override public void addTableFrom(Table table, SelectStatement select) { // track added tables... tableAdditions.add(table.getName()); AddTable addTabl...
3.26
morf_SchemaChangeSequence_renameTable_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#renameTable(java.lang.String, java.lang.String) */ @Override public void renameTable(String fromTableName, String toTableName) { tableAdditions.add(toTableName); RenameTable renameTable = new RenameTable(fromTableName, toTableName); visitor.visit(re...
3.26
morf_SchemaChangeSequence_visit_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChangeVisitor#visit(org.alfasoftware.morf.upgrade.AddTableFrom) */ @Override public void visit(AddTableFrom addTableFrom) { changes.add(addTableFrom); }
3.26
morf_SchemaChangeSequence_removeColumns_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#removeColumns(java.lang.String, org.alfasoftware.morf.metadata.Column[]) */ @Override public void removeColumns(String tableName, Column... definitions) { // simple redirect for now, but a future optimisation could re-implement this to be more efficient...
3.26
morf_SchemaChangeSequence_tableAdditions_rdh
/** * * @return The set of all table which are added by this sequence. */ public Set<String> tableAdditions() { return tableAdditions; }
3.26
morf_SchemaChangeSequence_removeColumn_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#removeColumn(java.lang.String, org.alfasoftware.morf.metadata.Column) */ @Override public void removeColumn(String tableName, Column definition) { RemoveColumn v17 = new RemoveColumn(tableName, definition); visitor.visit(v17); schemaAndDataC...
3.26
morf_SchemaChangeSequence_changePrimaryKeyColumns_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#changePrimaryKeyColumns(java.lang.String, java.util.List, java.util.List) */ @Override public void changePrimaryKeyColumns(String tableName, List<String> oldPrimaryKeyColumns, List<String> newPrimaryKeyColumns) { ChangePrimaryKeyColumns changePrimaryKeyColu...
3.26
morf_SchemaChangeSequence_addTable_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#addTable(org.alfasoftware.morf.metadata.Table) */ @Override public void addTable(Table definition) { // track added tables... tableAdditions.add(definition.getName()); AddTable addTable = new AddTable(definition); visitor.visit(addTable);schemaA...
3.26
morf_SchemaChangeSequence_removeIndex_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#removeIndex(java.lang.String, org.alfasoftware.morf.metadata.Index) */ @Override public void removeIndex(String tableName, Index index) { RemoveIndex removeIndex = new RemoveIndex(tableName, index); visitor.visit(removeIndex); schemaAndDataChangeV...
3.26
morf_SchemaChangeSequence_changeIndex_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#changeIndex(java.lang.String, org.alfasoftware.morf.metadata.Index, org.alfasoftware.morf.metadata.Index) */ @Override public void changeIndex(String tableName, Index fromIndex, Index toIndex) { ChangeIndex changeIndex = new ChangeIndex(tableName, fromIndex...
3.26
morf_SchemaChangeSequence_getChanges_rdh
/** * * @return the changes */ public List<SchemaChange> getChanges() { return changes; }
3.26
morf_SchemaChangeSequence_getUpgradeTableResolution_rdh
/** * * @return {@link UpgradeTableResolution} for this upgrade */ public UpgradeTableResolution getUpgradeTableResolution() { return upgradeTableResolution; }
3.26
morf_SchemaChangeSequence_renameIndex_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#renameIndex(java.lang.String, java.lang.String, java.lang.String) */ @Override public void renameIndex(String tableName, String fromIndexName, String toIndexName) {RenameIndex removeIndex = new RenameIndex(tableName, fromIndexName, toIndexName); visitor.vi...
3.26
morf_SchemaChangeSequence_executeStatement_rdh
/** * * @see org.alfasoftware.morf.upgrade.DataEditor#executeStatement(org.alfasoftware.morf.sql.Statement) */ @Overridepublic void executeStatement(Statement statement) {visitor.visit(new ExecuteStatement(statement)); statement.accept(schemaAndDataChangeVisitor); }
3.26
morf_SchemaChangeSequence_applyTo_rdh
/** * * @param visitor * The schema change visitor against which to write the changes. */ public void applyTo(SchemaChangeVisitor visitor) { for (UpgradeStepWithChanges v10 : allChanges) { try { visitor.startStep(v10.getUpgradeClass()); for (SchemaChange change : v10.ge...
3.26
morf_SchemaChangeSequence_applyInReverseToSchema_rdh
/** * Applies the change reversals to the given schema. * * @param initialSchema * The schema to apply changes to. * @return the resulting schema after applying reverse changes in this sequence */ public Schema applyInReverseToSchema(Schema initialSchema) { Schema currentSchema = initialSchema; // we ne...
3.26
morf_SchemaChangeSequence_addIndex_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#addIndex(java.lang.String, org.alfasoftware.morf.metadata.Index) */ @Override public void addIndex(String tableName, Index index) { AddIndex addIndex = new AddIndex(tableName, index); visitor.visit(addIndex); schemaAndDataChangeVisitor.visit(addInde...
3.26
morf_SchemaChangeSequence_m0_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaEditor#analyseTable(String) */ @Override public void m0(String tableName) { AnalyseTable analyseTable = new AnalyseTable(tableName); visitor.visit(analyseTable); schemaAndDataChangeVisitor.visit(analyseTable); }
3.26
morf_SchemaChangeSequence_getUpgradeSteps_rdh
/** * * @return the upgradeSteps */ public List<UpgradeStep> getUpgradeSteps() { return ImmutableList.copyOf(upgradeSteps); }
3.26
morf_DatabaseType_parseJdbcUrl_rdh
/** * Extracts the database connection details from a JDBC URL. * * <p>Finds the first available {@link DatabaseType} with a matching protocol, * then uses that to parse out the connection details.</p> * * <p>If there are multiple matches for the protocol, {@link IllegalStateException...
3.26
morf_DatabaseType_findByProductName_rdh
/** * Returns the first available database type matching the JDBC product * name. * * <p>Returns empty if no matching database type is found. If there are * multiple matches for the product name, {@link IllegalStateException} * will be thrown.</p> *...
3.26
morf_DatabaseType_reclassifyException_rdh
/** * Reclassifies driver-specific exceptions to standard driver agnostic exceptions, such as those * extending {@link java.sql.SQLException}. This can allow callers to extract error codes from * exceptions which are otherwise opaque. * * @param e * the exception to reclassify. * @return The original exception...
3.26
morf_DatabaseType_findByIdentifier_rdh
/** * Returns the registered database type by its identifier. * * <p>It can be assumed that performance of this method will be <code>O(1)</code> so is * suitable for repeated calling in performance code. There should be * few reasons for caching the response.</p> ...
3.26
morf_DatabaseSchemaManager_tableCache_rdh
/** * Returns the cached set of tables in the database. */ private Map<String, Table> tableCache(ProducerCache producerCache) { if (!tablesLoaded.get()) { cacheTables(producerCache.get().getSchema().tables());} return tables.get(); }
3.26
morf_DatabaseSchemaManager_dropTableIfPresent_rdh
/** * Drop the specified tables from the schema if they are present. * * @param producerCache * database dataset producer cache * @param tableName * table name to drop * @return sql statements */ public Collection<String> dropTableIfPresent(ProducerCache producerCache, String tableName) {Table v12 = getTab...
3.26
morf_DatabaseSchemaManager_dropTablesIfPresent_rdh
/** * Drop the specified tables from the schema if they are present. * * @param tablesToDrop * The tables to delete if they are present in the database. */ public void dropTablesIfPresent(Set<String> tablesToDrop) { ProducerCache producerCache = new ProducerCache(); try { Collection<String> sql = Lists.newLinked...
3.26
morf_DatabaseSchemaManager_viewCache_rdh
/** * Returns the cached set of views in the database. */ private Map<String, View> viewCache(ProducerCache producerCache) { if (!viewsLoaded.get()) { cacheViews(producerCache.get().getSchema().views()); } return views.get(); }
3.26
morf_DatabaseSchemaManager_dropAllTables_rdh
/** * Drop all tables so that the schema is empty. */ public void dropAllTables() { ProducerCache producerCache = new ProducerCache(); try { Schema databaseSchema = producerCache.get().getSchema(); ImmutableList<Table> tablesToDrop = ImmutableList.copyOf(databaseSchema.tables()); List<String> script = Li...
3.26
morf_DatabaseSchemaManager_deployTable_rdh
/** * Deploys the specified table to the database. * * @param table * the table to deploy */ private Collection<String> deployTable(Table table) { if (log.isDebugEnabled()) log.debug(("Deploying table [" + table.getName()) + "]"); String upperCase = table.getName().toUpperCase();tables.get().put(upperCase, Sch...
3.26
morf_DatabaseSchemaManager_truncateTable_rdh
/** * Truncates the specified table. * * @param table * the table to truncate. */ private Collection<String> truncateTable(Table table) { if (log.isDebugEnabled()) log.debug(("Truncating table [" + table.getName()) + "]"); // use delete-all rather than truncate, because at least on Oracle this is a lot faster...
3.26
morf_DatabaseSchemaManager_invalidateCache_rdh
/** * Invalidate the cache of database tables. Use when the schema has changed underneath this schema manager. */ public final void invalidateCache() { if (log.isDebugEnabled()) { StackTraceElement stack = new Throwable().getStackTrace()[1]; log.debug((((("Cache invalidated at " + stack.getClassName()) + ".") + sta...
3.26
morf_DatabaseSchemaManager_mutateToSupportSchema_rdh
/** * Mutates the current database schema so that it supports the one requested. * * <p>When this method returns, it guarantees that all the tables in {code schema} are * present in the database and also empty.</p> * * <p>Note it does not guarantee that no other tables exist.</p> * * @param schema * The sche...
3.26
morf_DatabaseSchemaManager_ensureTableExists_rdh
/** * Ensure that a specific table is present in the DB. * * @return Any SQL required to adjust the DB to include this table. */ private Collection<? extends String> ensureTableExists(Table requiredTable, TruncationBehavior truncationBehavior, ProducerCache producerCache) { boolean v29; boolean deployRequired; bool...
3.26
morf_DatabaseSchemaManager_dropViewIfExists_rdh
/** * Removes the specified view from the database, if it exists. Otherwise * do nothing. To allow for JDBC implem,entations that do not support * conditional dropping of views, this will trap and ignore * * @param view * the view to drop */ private Collection<String> dropViewIfExists(View view) { if (log.i...
3.26
morf_DatabaseSchemaManager_ensureTablesExist_rdh
/** * Ensure that every table in the schema is present in the DB. */ private Collection<String> ensureTablesExist(Schema schema, TruncationBehavior truncationBehavior, ProducerCache producerCache) { Collection<String> sql = Lists.newLinkedList(); for (Table requiredTable : schema.tables()) { sql.addAll(ensureTableExi...
3.26
morf_DatabaseSchemaManager_deployView_rdh
/** * Deploys the specified view to the database. * * @param view * the view to deploy */ private Collection<String> deployView(View view) { if (log.isDebugEnabled()) log.debug(("Deploying view [" + view.getName()) + "]"); views.get().put(view.getName().toUpperCase(), SchemaUtils.copy(view)); viewsDeployedByT...
3.26