Package ac.simons.neo4j.migrations.core
Class AbstractCypherBasedMigration
java.lang.Object
ac.simons.neo4j.migrations.core.AbstractCypherBasedMigration
- All Implemented Interfaces:
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 Summary
Modifier and TypeFieldDescriptionprotected final CypherResource
The underlying resource representing the content of this migration.protected final MigrationVersion
The version of this migration. -
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractCypherBasedMigration
(CypherResource cypherResource) Required to be called so that thecypherResource
gets initialized proper -
Method Summary
Modifier and TypeMethodDescriptionfinal void
apply
(MigrationContext context) Implement your migration code here.Returns possible checksum of the migration.Returns An optional description of this migration.This can be overridden to provide a better identifier for this source (for example an anchor in an adoc file).final MigrationVersion
Returns the version.final boolean
-
Field Details
-
cypherResource
The underlying resource representing the content of this migration. -
version
The version of this migration.
-
-
Constructor Details
-
AbstractCypherBasedMigration
Required to be called so that thecypherResource
gets initialized proper- Parameters:
cypherResource
- The resource to be dealt with
-
-
Method Details
-
getVersion
Description copied from interface:Migration
Returns the version.- Specified by:
getVersion
in interfaceMigration
- Returns:
- the version
-
getOptionalDescription
Description copied from interface:Migration
Returns An optional description of this migration.- Specified by:
getOptionalDescription
in interfaceMigration
- Returns:
- An optional description of this migration
-
getSource
This can be overridden to provide a better identifier for this source (for example an anchor in an adoc file). Thecypher resource
itself must have an identifier that can be parsed into aMigrationVersion
. -
getChecksum
Description copied from interface:Migration
Returns possible checksum of the migration.- Specified by:
getChecksum
in interfaceMigration
- Returns:
- possible checksum of the migration
-
apply
Description copied from interface:Migration
Implement your migration code here.- Specified by:
apply
in interfaceMigration
- 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 interfaceMigration
- Returns:
- true if this migration can be safely repeated
-