Class AbstractCypherBasedMigration

java.lang.Object
ac.simons.neo4j.migrations.core.AbstractCypherBasedMigration
All Implemented Interfaces:
Migration

public abstract non-sealed class AbstractCypherBasedMigration extends Object implements Migration
This is a utility class for every Migration that wants to provide Cypher to Neo4j-Migrations (via an extension). For example this can be a format extension extracting Cypher from various text formats. This base class uses a CypherResource under the hood taking care of checksuming Cypher etc.
Since:
1.8.0
Author:
Michael J. Simons
Soundtrack
Koljah - Aber der Abgrund
  • Field Details

    • cypherResource

      protected final CypherResource cypherResource
      The underlying resource representing the content of this migration.
    • version

      protected final MigrationVersion version
      The version of this migration.
  • Constructor Details

    • AbstractCypherBasedMigration

      protected AbstractCypherBasedMigration(CypherResource cypherResource)
      Required to be called so that the cypherResource gets initialized proper
      Parameters:
      cypherResource - The resource to be dealt with
  • Method Details

    • getVersion

      public final MigrationVersion getVersion()
      Description copied from interface: Migration
      Returns the version.
      Specified by:
      getVersion in interface Migration
      Returns:
      the version
    • getOptionalDescription

      public Optional<String> getOptionalDescription()
      Description copied from interface: Migration
      Returns An optional description of this migration.
      Specified by:
      getOptionalDescription in interface Migration
      Returns:
      An optional description of this migration
    • getSource

      public String getSource()
      This can be overridden to provide a better identifier for this source (for example an anchor in an adoc file). The cypher resource itself must have an identifier that can be parsed into a MigrationVersion.
      Specified by:
      getSource in interface Migration
      Returns:
      An identifier for this migration.
    • getChecksum

      public final Optional<String> getChecksum()
      Description copied from interface: Migration
      Returns possible checksum of the migration.
      Specified by:
      getChecksum in interface Migration
      Returns:
      possible checksum of the migration
    • apply

      public final void apply(MigrationContext context) throws MigrationsException
      Description copied from interface: Migration
      Implement your migration code here.
      Specified by:
      apply in interface Migration
      Parameters:
      context - The migrations' context.
      Throws:
      MigrationsException - In case anything happens, wrap your exception or create a new one
    • isRepeatable

      public final boolean isRepeatable()
      Specified by:
      isRepeatable in interface Migration
      Returns:
      true if this migration can be safely repeated