Skip to content

Instantly share code, notes, and snippets.

@derms
Last active April 19, 2019 11:12
Show Gist options
  • Save derms/774f33b70edc1bc3aed5026cb893927e to your computer and use it in GitHub Desktop.
Save derms/774f33b70edc1bc3aed5026cb893927e to your computer and use it in GitHub Desktop.
MarkLogic - Multiple Delete Collections tasks
class CustomDeleteCollectionsTask extends com.marklogic.gradle.task.datamovement.DataMovementTask {
String[] collections
@org.gradle.api.tasks.TaskAction
void deleteCollections() {
project.ext.collections = (collections != null && collections.length > 0) ? collections.join(",") : null
runQueryBatcherJob(new com.marklogic.client.ext.datamovement.job.DeleteCollectionsJob())
}
}
task deleteFinalData(type: CustomDeleteCollectionsTask) {
client = hubConfig.newFinalClient()
collections = ["Document","Client"]
}
task deleteStagingData(type: CustomDeleteCollectionsTask) {
client = hubConfig.newStagingClient()
collections = ["input"]
}
task deleteAllData(dependsOn: [deleteStagingData,deleteFinalData])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment