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
FieldsModifier and TypeFieldDescriptionprotected final CypherResourceThe underlying resource representing the content of this migration.protected final StringDeprecated.protected final MigrationVersionThe version of this migration. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCypherBasedMigration(CypherResource cypherResource) Required to be called so that thecypherResourcegets initialized proper -
Method Summary
Modifier and TypeMethodDescriptionfinal voidapply(MigrationContext context) Implement your migration code here.final StringThis 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 thecypherResourcegets initialized proper- Parameters:
cypherResource- The resource to be dealt with
-
-
Method Details
-
getVersion
- Specified by:
getVersionin interfaceMigration- Returns:
- The version.
-
getDescription
- Specified by:
getDescriptionin interfaceMigration- Returns:
- Some description.
-
getOptionalDescription
- Specified by:
getOptionalDescriptionin 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 resourceitself must have an identifier that can be parsed into aMigrationVersion. -
getChecksum
- Specified by:
getChecksumin interfaceMigration- Returns:
- Possible checksum of the migration.
-
apply
Description copied from interface:MigrationImplement your migration code here.- Specified by:
applyin interfaceMigration- Parameters:
context- The migrations' context.- Throws:
MigrationsException- In case anything happens, wrap your exception or create a new one
-
getOptionalDescription()