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 String
Deprecated.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.final String
This can be overridden to provide a better identifier for this source (for example an anchor in an adoc file).final MigrationVersion
-
Field Details
-
cypherResource
The underlying resource representing the content of this migration. -
description
Deprecated.since 1.9.0, seegetOptionalDescription()
-
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
- Specified by:
getVersion
in interfaceMigration
- Returns:
- The version.
-
getDescription
- Specified by:
getDescription
in interfaceMigration
- Returns:
- Some description.
-
getOptionalDescription
- 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
- 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
-
getOptionalDescription()