From 4c220879db2f5186e677857182507ae4c9e1d102 Mon Sep 17 00:00:00 2001 From: eikek Date: Sun, 13 Mar 2022 15:05:29 +0100 Subject: [PATCH] Reformat code --- .../scala/docspell/backend/BackendApp.scala | 2 + .../scala/docspell/backend/JobFactory.scala | 1 + .../scala/docspell/backend/msg/Topics.scala | 1 + .../docspell/backend/ops/OCollective.scala | 6 +- .../backend/ops/OFileRepository.scala | 2 + .../docspell/backend/ops/OFulltext.scala | 1 + .../scala/docspell/backend/ops/OItem.scala | 2 + .../scala/docspell/backend/ops/OJob.scala | 1 + .../scala/docspell/backend/ops/OJoex.scala | 1 + .../scala/docspell/backend/ops/OUpload.scala | 1 + .../docspell/backend/ops/OUserTask.scala | 2 + .../src/main/scala/docspell/joex/Config.scala | 2 +- .../scala/docspell/joex/JoexAppImpl.scala | 191 ++------------ .../main/scala/docspell/joex/JoexTasks.scala | 248 ++++++++++++++++++ .../joex/emptytrash/EmptyTrashTask.scala | 6 +- .../docspell/joex/filecopy/FileCopyTask.scala | 6 +- .../filecopy/FileIntegrityCheckTask.scala | 2 + .../scala/docspell/joex/fts/FtsWork.scala | 3 +- .../docspell/joex/fts/MigrationTask.scala | 1 + .../scala/docspell/joex/fts/ReIndexTask.scala | 1 + .../docspell/joex/hk/CheckNodesTask.scala | 4 +- .../docspell/joex/hk/CleanupInvitesTask.scala | 1 + .../joex/hk/CleanupRememberMeTask.scala | 1 + .../docspell/joex/hk/HouseKeepingTask.scala | 6 +- .../docspell/joex/hk/IntegrityCheckTask.scala | 1 + .../joex/learn/LearnClassifierTask.scala | 3 +- .../joex/learn/LearnItemEntities.scala | 1 + .../scala/docspell/joex/learn/LearnTags.scala | 1 + .../joex/notify/PeriodicDueItemsTask.scala | 5 +- .../joex/notify/PeriodicQueryTask.scala | 5 +- .../joex/pagecount/AllPageCountTask.scala | 3 +- .../joex/pagecount/MakePageCountTask.scala | 1 + .../joex/pdfconv/ConvertAllPdfTask.scala | 3 +- .../docspell/joex/pdfconv/PdfConvTask.scala | 2 + .../joex/preview/AllPreviewsTask.scala | 3 +- .../joex/preview/MakePreviewTask.scala | 1 + .../joex/process/AttachmentPageCount.scala | 1 + .../joex/process/AttachmentPreview.scala | 1 + .../docspell/joex/process/ConvertPdf.scala | 1 + .../docspell/joex/process/CreateItem.scala | 1 + .../joex/process/CrossCheckProposals.scala | 3 +- .../joex/process/DuplicateCheck.scala | 2 + .../docspell/joex/process/EvalProposals.scala | 2 + .../joex/process/ExtractArchive.scala | 2 + .../docspell/joex/process/FindProposal.scala | 2 + .../docspell/joex/process/ItemHandler.scala | 1 + .../docspell/joex/process/LinkProposal.scala | 1 + .../docspell/joex/process/ProcessItem.scala | 1 + .../docspell/joex/process/ReProcessItem.scala | 1 + .../docspell/joex/process/SaveProposals.scala | 3 +- .../docspell/joex/process/TextAnalysis.scala | 1 + .../joex/process/TextExtraction.scala | 1 + .../joex/scanmailbox/ScanMailboxTask.scala | 6 +- .../joex/updatecheck/UpdateCheckTask.scala | 2 + .../docspell/restserver/RestAppImpl.scala | 2 + .../docspell/restserver/Subscriptions.scala | 1 + .../routes/NotifyDueItemsRoutes.scala | 2 + .../routes/PeriodicQueryRoutes.scala | 2 + .../restserver/routes/ScanMailboxRoutes.scala | 2 + .../main/scala/docspell/scheduler/Job.scala | 8 + .../scala/docspell/scheduler/JobStore.scala | 6 + .../docspell/scheduler/JobStoreModule.scala | 6 + .../docspell/scheduler/SchedulerModule.scala | 6 + .../docspell/scheduler/msg/CancelJob.scala | 1 + .../docspell/scheduler/msg/JobSubmitted.scala | 1 + .../docspell/scheduler/msg/JobsNotify.scala | 6 + .../scheduler/msg/PeriodicTaskNotify.scala | 6 + .../scheduler/usertask/UserTask.scala | 3 +- .../scheduler/usertask/UserTaskStore.scala | 4 +- .../scheduler/CountingSchemeSpec.scala | 1 + .../docspell/scheduler/impl/ContextImpl.scala | 8 +- .../docspell/scheduler/impl/JobQueue.scala | 1 + .../scheduler/impl/JobStoreImpl.scala | 7 +- .../impl/JobStoreModuleBuilder.scala | 6 + .../docspell/scheduler/impl/LogSink.scala | 3 +- .../impl/PeriodicSchedulerBuilder.scala | 9 +- .../impl/PeriodicSchedulerImpl.scala | 2 + .../scheduler/impl/PeriodicTaskStore.scala | 1 + .../docspell/scheduler/impl/QUserTask.scala | 16 +- .../docspell/scheduler/impl/QueueLogger.scala | 11 +- .../scheduler/impl/SchedulerBuilder.scala | 3 +- .../scheduler/impl/SchedulerImpl.scala | 8 +- .../impl/SchedulerModuleBuilder.scala | 14 +- .../scheduler/impl/UserTaskStoreImpl.scala | 16 +- .../store/records/RPeriodicTask.scala | 2 + 85 files changed, 492 insertions(+), 225 deletions(-) create mode 100644 modules/joex/src/main/scala/docspell/joex/JoexTasks.scala diff --git a/modules/backend/src/main/scala/docspell/backend/BackendApp.scala b/modules/backend/src/main/scala/docspell/backend/BackendApp.scala index ebe361ac..5d5dc532 100644 --- a/modules/backend/src/main/scala/docspell/backend/BackendApp.scala +++ b/modules/backend/src/main/scala/docspell/backend/BackendApp.scala @@ -7,6 +7,7 @@ package docspell.backend import cats.effect._ + import docspell.backend.auth.Login import docspell.backend.fulltext.CreateIndex import docspell.backend.ops._ @@ -17,6 +18,7 @@ import docspell.pubsub.api.PubSubT import docspell.scheduler.JobStoreModule import docspell.store.Store import docspell.totp.Totp + import emil.Emil trait BackendApp[F[_]] { diff --git a/modules/backend/src/main/scala/docspell/backend/JobFactory.scala b/modules/backend/src/main/scala/docspell/backend/JobFactory.scala index d18356fa..9a79f104 100644 --- a/modules/backend/src/main/scala/docspell/backend/JobFactory.scala +++ b/modules/backend/src/main/scala/docspell/backend/JobFactory.scala @@ -8,6 +8,7 @@ package docspell.backend import cats.effect._ import cats.implicits._ + import docspell.backend.MailAddressCodec import docspell.common._ import docspell.notification.api.PeriodicQueryArgs diff --git a/modules/backend/src/main/scala/docspell/backend/msg/Topics.scala b/modules/backend/src/main/scala/docspell/backend/msg/Topics.scala index 3a887097..63d8c401 100644 --- a/modules/backend/src/main/scala/docspell/backend/msg/Topics.scala +++ b/modules/backend/src/main/scala/docspell/backend/msg/Topics.scala @@ -7,6 +7,7 @@ package docspell.backend.msg import cats.data.NonEmptyList + import docspell.pubsub.api.TypedTopic import docspell.scheduler.msg._ diff --git a/modules/backend/src/main/scala/docspell/backend/ops/OCollective.scala b/modules/backend/src/main/scala/docspell/backend/ops/OCollective.scala index 09f66ef4..e59ddb9a 100644 --- a/modules/backend/src/main/scala/docspell/backend/ops/OCollective.scala +++ b/modules/backend/src/main/scala/docspell/backend/ops/OCollective.scala @@ -9,17 +9,19 @@ package docspell.backend.ops import cats.effect.{Async, Resource} import cats.implicits._ import fs2.Stream + import docspell.backend.JobFactory import docspell.backend.PasswordCrypt import docspell.backend.ops.OCollective._ import docspell.common._ +import docspell.scheduler.JobStore +import docspell.scheduler.usertask.{UserTask, UserTaskScope, UserTaskStore} import docspell.store.UpdateResult import docspell.store.queries.{QCollective, QUser} import docspell.store.records._ import docspell.store.{AddResult, Store} + import com.github.eikek.calev._ -import docspell.scheduler.JobStore -import docspell.scheduler.usertask.{UserTask, UserTaskScope, UserTaskStore} trait OCollective[F[_]] { diff --git a/modules/backend/src/main/scala/docspell/backend/ops/OFileRepository.scala b/modules/backend/src/main/scala/docspell/backend/ops/OFileRepository.scala index b46c075f..0e2d9cdb 100644 --- a/modules/backend/src/main/scala/docspell/backend/ops/OFileRepository.scala +++ b/modules/backend/src/main/scala/docspell/backend/ops/OFileRepository.scala @@ -9,11 +9,13 @@ package docspell.backend.ops import cats.data.OptionT import cats.effect._ import cats.implicits._ + import docspell.backend.JobFactory import docspell.backend.ops.OFileRepository.IntegrityResult import docspell.common._ import docspell.scheduler.{Job, JobStore} import docspell.store.Store + import scodec.bits.ByteVector trait OFileRepository[F[_]] { diff --git a/modules/backend/src/main/scala/docspell/backend/ops/OFulltext.scala b/modules/backend/src/main/scala/docspell/backend/ops/OFulltext.scala index 8fcdb9cd..39452ea5 100644 --- a/modules/backend/src/main/scala/docspell/backend/ops/OFulltext.scala +++ b/modules/backend/src/main/scala/docspell/backend/ops/OFulltext.scala @@ -10,6 +10,7 @@ import cats.data.NonEmptyList import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.backend.JobFactory import docspell.backend.ops.OItemSearch._ import docspell.common._ diff --git a/modules/backend/src/main/scala/docspell/backend/ops/OItem.scala b/modules/backend/src/main/scala/docspell/backend/ops/OItem.scala index 3a8b08ea..04643348 100644 --- a/modules/backend/src/main/scala/docspell/backend/ops/OItem.scala +++ b/modules/backend/src/main/scala/docspell/backend/ops/OItem.scala @@ -9,6 +9,7 @@ package docspell.backend.ops import cats.data.{NonEmptyList => Nel, OptionT} import cats.effect.{Async, Resource} import cats.implicits._ + import docspell.backend.AttachedEvent import docspell.backend.JobFactory import docspell.backend.fulltext.CreateIndex @@ -21,6 +22,7 @@ import docspell.scheduler.JobStore import docspell.store.queries.{QAttachment, QItem, QMoveAttachment} import docspell.store.records._ import docspell.store.{AddResult, Store, UpdateResult} + import doobie.implicits._ trait OItem[F[_]] { diff --git a/modules/backend/src/main/scala/docspell/backend/ops/OJob.scala b/modules/backend/src/main/scala/docspell/backend/ops/OJob.scala index ad1cc8c8..e0c14552 100644 --- a/modules/backend/src/main/scala/docspell/backend/ops/OJob.scala +++ b/modules/backend/src/main/scala/docspell/backend/ops/OJob.scala @@ -9,6 +9,7 @@ package docspell.backend.ops import cats.data.OptionT import cats.effect._ import cats.implicits._ + import docspell.backend.ops.OJob.{CollectiveQueueState, JobCancelResult} import docspell.common._ import docspell.pubsub.api.PubSubT diff --git a/modules/backend/src/main/scala/docspell/backend/ops/OJoex.scala b/modules/backend/src/main/scala/docspell/backend/ops/OJoex.scala index f82285d9..9f83d46c 100644 --- a/modules/backend/src/main/scala/docspell/backend/ops/OJoex.scala +++ b/modules/backend/src/main/scala/docspell/backend/ops/OJoex.scala @@ -9,6 +9,7 @@ package docspell.backend.ops import cats.Applicative import cats.effect._ import cats.implicits._ + import docspell.common.Ident import docspell.pubsub.api.PubSubT import docspell.scheduler.msg.{CancelJob, JobsNotify, PeriodicTaskNotify} diff --git a/modules/backend/src/main/scala/docspell/backend/ops/OUpload.scala b/modules/backend/src/main/scala/docspell/backend/ops/OUpload.scala index 674aa5a4..ca523cf8 100644 --- a/modules/backend/src/main/scala/docspell/backend/ops/OUpload.scala +++ b/modules/backend/src/main/scala/docspell/backend/ops/OUpload.scala @@ -11,6 +11,7 @@ import cats.data.{EitherT, OptionT} import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.backend.JobFactory import docspell.common._ import docspell.scheduler.{Job, JobStore} diff --git a/modules/backend/src/main/scala/docspell/backend/ops/OUserTask.scala b/modules/backend/src/main/scala/docspell/backend/ops/OUserTask.scala index f1171bd7..7fc80b7d 100644 --- a/modules/backend/src/main/scala/docspell/backend/ops/OUserTask.scala +++ b/modules/backend/src/main/scala/docspell/backend/ops/OUserTask.scala @@ -10,11 +10,13 @@ import cats.data.{NonEmptyList, OptionT} import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.common._ import docspell.notification.api.{ChannelRef, PeriodicDueItemsArgs, PeriodicQueryArgs} import docspell.scheduler.usertask.{UserTask, UserTaskScope, UserTaskStore} import docspell.store.Store import docspell.store.records.RNotificationChannel + import io.circe.Encoder trait OUserTask[F[_]] { diff --git a/modules/joex/src/main/scala/docspell/joex/Config.scala b/modules/joex/src/main/scala/docspell/joex/Config.scala index 0d0945d6..3418a56d 100644 --- a/modules/joex/src/main/scala/docspell/joex/Config.scala +++ b/modules/joex/src/main/scala/docspell/joex/Config.scala @@ -19,10 +19,10 @@ import docspell.ftssolr.SolrConfig import docspell.joex.analysis.RegexNerFile import docspell.joex.hk.HouseKeepingConfig import docspell.joex.routes.InternalHeader -import docspell.scheduler.{PeriodicSchedulerConfig, SchedulerConfig} import docspell.joex.updatecheck.UpdateCheckConfig import docspell.logging.LogConfig import docspell.pubsub.naive.PubSubConfig +import docspell.scheduler.{PeriodicSchedulerConfig, SchedulerConfig} import docspell.store.JdbcConfig case class Config( diff --git a/modules/joex/src/main/scala/docspell/joex/JoexAppImpl.scala b/modules/joex/src/main/scala/docspell/joex/JoexAppImpl.scala index df0f53f0..5d8b6a40 100644 --- a/modules/joex/src/main/scala/docspell/joex/JoexAppImpl.scala +++ b/modules/joex/src/main/scala/docspell/joex/JoexAppImpl.scala @@ -9,36 +9,25 @@ package docspell.joex import cats.effect._ import cats.implicits._ import fs2.concurrent.SignallingRef -import docspell.analysis.TextAnalyser + import docspell.backend.MailAddressCodec -import docspell.backend.fulltext.CreateIndex import docspell.backend.ops._ import docspell.common._ -import docspell.ftsclient.FtsClient -import docspell.ftssolr.SolrFtsClient -import docspell.joex.analysis.RegexNerFile import docspell.joex.emptytrash._ -import docspell.joex.filecopy.{FileCopyTask, FileIntegrityCheckTask} -import docspell.joex.fts.{MigrationTask, ReIndexTask} +import docspell.joex.fts.MigrationTask import docspell.joex.hk._ -import docspell.joex.learn.LearnClassifierTask -import docspell.joex.notify._ import docspell.joex.pagecount._ -import docspell.joex.pdfconv.ConvertAllPdfTask -import docspell.joex.pdfconv.PdfConvTask import docspell.joex.preview._ -import docspell.joex.process.ItemHandler -import docspell.joex.process.ReProcessItem -import docspell.joex.scanmailbox._ -import docspell.scheduler._ -import docspell.scheduler.impl.{JobStoreModuleBuilder, SchedulerModuleBuilder} import docspell.joex.updatecheck._ import docspell.notification.api.NotificationModule import docspell.notification.impl.NotificationModuleImpl import docspell.pubsub.api.{PubSub, PubSubT} +import docspell.scheduler._ +import docspell.scheduler.impl.{JobStoreModuleBuilder, SchedulerModuleBuilder} import docspell.scheduler.usertask.{UserTaskScope, UserTaskStore} import docspell.store.Store import docspell.store.records.{REmptyTrashSetting, RJobLog} + import emil.javamail._ import org.http4s.client.Client @@ -129,165 +118,21 @@ object JoexAppImpl extends MailAddressCodec { .withEventSink(notificationMod) .build - joex <- OJoex(pubSubT) - upload <- OUpload(store, jobStoreModule.jobs, joex) - fts <- createFtsClient(cfg)(httpClient) - createIndex <- CreateIndex.resource(fts, store) - itemOps <- OItem(store, fts, createIndex, jobStoreModule.jobs, joex) - itemSearchOps <- OItemSearch(store) - analyser <- TextAnalyser.create[F](cfg.textAnalysis.textAnalysisConfig) - regexNer <- RegexNerFile(cfg.textAnalysis.regexNerFileConfig, store) - updateCheck <- UpdateCheck.resource(httpClient) - notification <- ONotification(store, notificationMod) - fileRepo <- OFileRepository(store, jobStoreModule.jobs, joex) + tasks <- JoexTasks.resource( + cfg, + jobStoreModule, + httpClient, + pubSubT, + notificationMod, + javaEmil + ) schedulerModule <- SchedulerModuleBuilder(jobStoreModule) .withSchedulerConfig(cfg.scheduler) .withPeriodicSchedulerConfig(cfg.periodicScheduler) - .withTaskRegistry(JobTaskRegistry - .empty[F] - .withTask( - JobTask.json( - ProcessItemArgs.taskName, - ItemHandler.newItem[F](cfg,store, itemOps, fts, analyser, regexNer), - ItemHandler.onCancel[F](store) - ) - ) - .withTask( - JobTask.json( - ReProcessItemArgs.taskName, - ReProcessItem[F](cfg, fts, itemOps, analyser, regexNer, store), - ReProcessItem.onCancel[F] - ) - ) - .withTask( - JobTask.json( - ScanMailboxArgs.taskName, - ScanMailboxTask[F](cfg.userTasks.scanMailbox, store, javaEmil, upload, joex), - ScanMailboxTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - MigrationTask.taskName, - MigrationTask[F](cfg.fullTextSearch, store, fts, createIndex), - MigrationTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - ReIndexTask.taskName, - ReIndexTask[F](cfg.fullTextSearch, store, fts, createIndex), - ReIndexTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - HouseKeepingTask.taskName, - HouseKeepingTask[F](cfg, store, fileRepo), - HouseKeepingTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - PdfConvTask.taskName, - PdfConvTask[F](cfg, store), - PdfConvTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - ConvertAllPdfArgs.taskName, - ConvertAllPdfTask[F](jobStoreModule.jobs, joex, store), - ConvertAllPdfTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - LearnClassifierArgs.taskName, - LearnClassifierTask[F](cfg.textAnalysis, store, analyser), - LearnClassifierTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - MakePreviewArgs.taskName, - MakePreviewTask[F](cfg.extraction.preview, store), - MakePreviewTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - AllPreviewsArgs.taskName, - AllPreviewsTask[F](jobStoreModule.jobs, joex, store), - AllPreviewsTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - MakePageCountArgs.taskName, - MakePageCountTask[F](store), - MakePageCountTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - AllPageCountTask.taskName, - AllPageCountTask[F](store, jobStoreModule.jobs, joex), - AllPageCountTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - EmptyTrashArgs.taskName, - EmptyTrashTask[F](itemOps, itemSearchOps), - EmptyTrashTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - UpdateCheckTask.taskName, - UpdateCheckTask[F]( - cfg.updateCheck, - cfg.sendMail, - store, - javaEmil, - updateCheck, - ThisVersion.default - ), - UpdateCheckTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - PeriodicQueryTask.taskName, - PeriodicQueryTask[F](store, notification), - PeriodicQueryTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - PeriodicDueItemsTask.taskName, - PeriodicDueItemsTask[F](store, notification), - PeriodicDueItemsTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - FileCopyTaskArgs.taskName, - FileCopyTask[F](cfg, store), - FileCopyTask.onCancel[F] - ) - ) - .withTask( - JobTask.json( - FileIntegrityCheckArgs.taskName, - FileIntegrityCheckTask[F](fileRepo, store), - FileIntegrityCheckTask.onCancel[F] - ) - ) - ) + .withTaskRegistry(tasks.get) .resource + app = new JoexAppImpl( cfg, store, @@ -301,10 +146,4 @@ object JoexAppImpl extends MailAddressCodec { appR <- Resource.make(app.init.map(_ => app))(_.initShutdown) } yield appR - private def createFtsClient[F[_]: Async]( - cfg: Config - )(client: Client[F]): Resource[F, FtsClient[F]] = - if (cfg.fullTextSearch.enabled) SolrFtsClient(cfg.fullTextSearch.solr, client) - else Resource.pure[F, FtsClient[F]](FtsClient.none[F]) - } diff --git a/modules/joex/src/main/scala/docspell/joex/JoexTasks.scala b/modules/joex/src/main/scala/docspell/joex/JoexTasks.scala new file mode 100644 index 00000000..8d2f0a1f --- /dev/null +++ b/modules/joex/src/main/scala/docspell/joex/JoexTasks.scala @@ -0,0 +1,248 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +package docspell.joex + +import cats.effect.{Async, Resource} + +import docspell.analysis.TextAnalyser +import docspell.backend.fulltext.CreateIndex +import docspell.backend.ops._ +import docspell.common._ +import docspell.ftsclient.FtsClient +import docspell.ftssolr.SolrFtsClient +import docspell.joex.analysis.RegexNerFile +import docspell.joex.emptytrash.EmptyTrashTask +import docspell.joex.filecopy.{FileCopyTask, FileIntegrityCheckTask} +import docspell.joex.fts.{MigrationTask, ReIndexTask} +import docspell.joex.hk.HouseKeepingTask +import docspell.joex.learn.LearnClassifierTask +import docspell.joex.notify.{PeriodicDueItemsTask, PeriodicQueryTask} +import docspell.joex.pagecount.{AllPageCountTask, MakePageCountTask} +import docspell.joex.pdfconv.{ConvertAllPdfTask, PdfConvTask} +import docspell.joex.preview.{AllPreviewsTask, MakePreviewTask} +import docspell.joex.process.{ItemHandler, ReProcessItem} +import docspell.joex.scanmailbox.ScanMailboxTask +import docspell.joex.updatecheck.{ThisVersion, UpdateCheck, UpdateCheckTask} +import docspell.notification.api.NotificationModule +import docspell.pubsub.api.PubSubT +import docspell.scheduler.impl.JobStoreModuleBuilder +import docspell.scheduler.{JobStoreModule, JobTask, JobTaskRegistry} +import docspell.store.Store + +import emil.Emil +import org.http4s.client.Client + +final class JoexTasks[F[_]: Async]( + cfg: Config, + store: Store[F], + itemOps: OItem[F], + fts: FtsClient[F], + analyser: TextAnalyser[F], + regexNer: RegexNerFile[F], + updateCheck: UpdateCheck[F], + notification: ONotification[F], + fileRepo: OFileRepository[F], + javaEmil: Emil[F], + jobStoreModule: JobStoreModule[F], + upload: OUpload[F], + createIndex: CreateIndex[F], + joex: OJoex[F], + itemSearch: OItemSearch[F] +) { + + def get: JobTaskRegistry[F] = + JobTaskRegistry + .empty[F] + .withTask( + JobTask.json( + ProcessItemArgs.taskName, + ItemHandler.newItem[F](cfg, store, itemOps, fts, analyser, regexNer), + ItemHandler.onCancel[F](store) + ) + ) + .withTask( + JobTask.json( + ReProcessItemArgs.taskName, + ReProcessItem[F](cfg, fts, itemOps, analyser, regexNer, store), + ReProcessItem.onCancel[F] + ) + ) + .withTask( + JobTask.json( + ScanMailboxArgs.taskName, + ScanMailboxTask[F](cfg.userTasks.scanMailbox, store, javaEmil, upload, joex), + ScanMailboxTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + MigrationTask.taskName, + MigrationTask[F](cfg.fullTextSearch, store, fts, createIndex), + MigrationTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + ReIndexTask.taskName, + ReIndexTask[F](cfg.fullTextSearch, store, fts, createIndex), + ReIndexTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + HouseKeepingTask.taskName, + HouseKeepingTask[F](cfg, store, fileRepo), + HouseKeepingTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + PdfConvTask.taskName, + PdfConvTask[F](cfg, store), + PdfConvTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + ConvertAllPdfArgs.taskName, + ConvertAllPdfTask[F](jobStoreModule.jobs, joex, store), + ConvertAllPdfTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + LearnClassifierArgs.taskName, + LearnClassifierTask[F](cfg.textAnalysis, store, analyser), + LearnClassifierTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + MakePreviewArgs.taskName, + MakePreviewTask[F](cfg.extraction.preview, store), + MakePreviewTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + AllPreviewsArgs.taskName, + AllPreviewsTask[F](jobStoreModule.jobs, joex, store), + AllPreviewsTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + MakePageCountArgs.taskName, + MakePageCountTask[F](store), + MakePageCountTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + AllPageCountTask.taskName, + AllPageCountTask[F](store, jobStoreModule.jobs, joex), + AllPageCountTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + EmptyTrashArgs.taskName, + EmptyTrashTask[F](itemOps, itemSearch), + EmptyTrashTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + UpdateCheckTask.taskName, + UpdateCheckTask[F]( + cfg.updateCheck, + cfg.sendMail, + store, + javaEmil, + updateCheck, + ThisVersion.default + ), + UpdateCheckTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + PeriodicQueryTask.taskName, + PeriodicQueryTask[F](store, notification), + PeriodicQueryTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + PeriodicDueItemsTask.taskName, + PeriodicDueItemsTask[F](store, notification), + PeriodicDueItemsTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + FileCopyTaskArgs.taskName, + FileCopyTask[F](cfg, store), + FileCopyTask.onCancel[F] + ) + ) + .withTask( + JobTask.json( + FileIntegrityCheckArgs.taskName, + FileIntegrityCheckTask[F](fileRepo, store), + FileIntegrityCheckTask.onCancel[F] + ) + ) +} + +object JoexTasks { + + def resource[F[_]: Async]( + cfg: Config, + jobStoreModule: JobStoreModuleBuilder.Module[F], + httpClient: Client[F], + pubSub: PubSubT[F], + notificationModule: NotificationModule[F], + emailService: Emil[F] + ): Resource[F, JoexTasks[F]] = + for { + joex <- OJoex(pubSub) + store = jobStoreModule.store + upload <- OUpload(store, jobStoreModule.jobs, joex) + fts <- createFtsClient(cfg)(httpClient) + createIndex <- CreateIndex.resource(fts, store) + itemOps <- OItem(store, fts, createIndex, jobStoreModule.jobs, joex) + itemSearchOps <- OItemSearch(store) + analyser <- TextAnalyser.create[F](cfg.textAnalysis.textAnalysisConfig) + regexNer <- RegexNerFile(cfg.textAnalysis.regexNerFileConfig, store) + updateCheck <- UpdateCheck.resource(httpClient) + notification <- ONotification(store, notificationModule) + fileRepo <- OFileRepository(store, jobStoreModule.jobs, joex) + } yield new JoexTasks[F]( + cfg, + store, + itemOps, + fts, + analyser, + regexNer, + updateCheck, + notification, + fileRepo, + emailService, + jobStoreModule, + upload, + createIndex, + joex, + itemSearchOps + ) + + private def createFtsClient[F[_]: Async]( + cfg: Config + )(client: Client[F]): Resource[F, FtsClient[F]] = + if (cfg.fullTextSearch.enabled) SolrFtsClient(cfg.fullTextSearch.solr, client) + else Resource.pure[F, FtsClient[F]](FtsClient.none[F]) +} diff --git a/modules/joex/src/main/scala/docspell/joex/emptytrash/EmptyTrashTask.scala b/modules/joex/src/main/scala/docspell/joex/emptytrash/EmptyTrashTask.scala index 04cfc337..3d50a0ca 100644 --- a/modules/joex/src/main/scala/docspell/joex/emptytrash/EmptyTrashTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/emptytrash/EmptyTrashTask.scala @@ -9,12 +9,14 @@ package docspell.joex.emptytrash import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.backend.ops.{OItem, OItemSearch} import docspell.common._ import docspell.scheduler._ -import docspell.store.records.RItem -import com.github.eikek.calev.CalEvent import docspell.scheduler.usertask.UserTask +import docspell.store.records.RItem + +import com.github.eikek.calev.CalEvent object EmptyTrashTask { type Args = EmptyTrashArgs diff --git a/modules/joex/src/main/scala/docspell/joex/filecopy/FileCopyTask.scala b/modules/joex/src/main/scala/docspell/joex/filecopy/FileCopyTask.scala index 8c89a157..630857fd 100644 --- a/modules/joex/src/main/scala/docspell/joex/filecopy/FileCopyTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/filecopy/FileCopyTask.scala @@ -9,15 +9,17 @@ package docspell.joex.filecopy import cats.data.NonEmptyList import cats.effect._ import cats.implicits._ + import docspell.common.FileCopyTaskArgs.Selection import docspell.common.{FileCopyTaskArgs, Ident} import docspell.joex.Config -import docspell.scheduler.{JobTaskResultEncoder, Task} import docspell.logging.Logger +import docspell.scheduler.{JobTaskResultEncoder, Task} +import docspell.store.Store import docspell.store.file.{BinnyUtils, FileRepository, FileRepositoryConfig} + import binny.CopyTool.Counter import binny.{BinaryId, BinaryStore, CopyTool} -import docspell.store.Store import io.circe.generic.semiauto.deriveCodec import io.circe.{Codec, Decoder, Encoder} diff --git a/modules/joex/src/main/scala/docspell/joex/filecopy/FileIntegrityCheckTask.scala b/modules/joex/src/main/scala/docspell/joex/filecopy/FileIntegrityCheckTask.scala index 1d407453..4c1b1751 100644 --- a/modules/joex/src/main/scala/docspell/joex/filecopy/FileIntegrityCheckTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/filecopy/FileIntegrityCheckTask.scala @@ -9,12 +9,14 @@ package docspell.joex.filecopy import cats.Monoid import cats.effect._ import cats.implicits._ + import docspell.backend.ops.OFileRepository import docspell.backend.ops.OFileRepository.IntegrityResult import docspell.common.{FileIntegrityCheckArgs, FileKey} import docspell.scheduler.{JobTaskResultEncoder, Task} import docspell.store.Store import docspell.store.records.RFileMeta + import io.circe.Encoder import io.circe.generic.semiauto.deriveEncoder diff --git a/modules/joex/src/main/scala/docspell/joex/fts/FtsWork.scala b/modules/joex/src/main/scala/docspell/joex/fts/FtsWork.scala index 8379098f..3f5ed2a6 100644 --- a/modules/joex/src/main/scala/docspell/joex/fts/FtsWork.scala +++ b/modules/joex/src/main/scala/docspell/joex/fts/FtsWork.scala @@ -9,12 +9,13 @@ package docspell.joex.fts import cats._ import cats.data.{Kleisli, NonEmptyList} import cats.implicits._ + import docspell.backend.fulltext.CreateIndex import docspell.common._ import docspell.ftsclient._ import docspell.joex.Config -import docspell.scheduler.Context import docspell.logging.Logger +import docspell.scheduler.Context import docspell.store.Store object FtsWork { diff --git a/modules/joex/src/main/scala/docspell/joex/fts/MigrationTask.scala b/modules/joex/src/main/scala/docspell/joex/fts/MigrationTask.scala index 6430b332..ddb44a21 100644 --- a/modules/joex/src/main/scala/docspell/joex/fts/MigrationTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/fts/MigrationTask.scala @@ -8,6 +8,7 @@ package docspell.joex.fts import cats.effect._ import cats.implicits._ + import docspell.backend.fulltext.CreateIndex import docspell.common._ import docspell.ftsclient._ diff --git a/modules/joex/src/main/scala/docspell/joex/fts/ReIndexTask.scala b/modules/joex/src/main/scala/docspell/joex/fts/ReIndexTask.scala index ca1dd228..b457d2fb 100644 --- a/modules/joex/src/main/scala/docspell/joex/fts/ReIndexTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/fts/ReIndexTask.scala @@ -8,6 +8,7 @@ package docspell.joex.fts import cats.effect._ import cats.implicits._ + import docspell.backend.fulltext.CreateIndex import docspell.common._ import docspell.ftsclient._ diff --git a/modules/joex/src/main/scala/docspell/joex/hk/CheckNodesTask.scala b/modules/joex/src/main/scala/docspell/joex/hk/CheckNodesTask.scala index 1d202b52..68256465 100644 --- a/modules/joex/src/main/scala/docspell/joex/hk/CheckNodesTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/hk/CheckNodesTask.scala @@ -8,11 +8,13 @@ package docspell.joex.hk import cats.effect._ import cats.implicits._ + import docspell.common._ -import docspell.scheduler.Task import docspell.logging.Logger +import docspell.scheduler.Task import docspell.store.Store import docspell.store.records._ + import org.http4s.blaze.client.BlazeClientBuilder import org.http4s.client.Client diff --git a/modules/joex/src/main/scala/docspell/joex/hk/CleanupInvitesTask.scala b/modules/joex/src/main/scala/docspell/joex/hk/CleanupInvitesTask.scala index 2dbed981..864a73d7 100644 --- a/modules/joex/src/main/scala/docspell/joex/hk/CleanupInvitesTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/hk/CleanupInvitesTask.scala @@ -8,6 +8,7 @@ package docspell.joex.hk import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.scheduler.Task import docspell.store.Store diff --git a/modules/joex/src/main/scala/docspell/joex/hk/CleanupRememberMeTask.scala b/modules/joex/src/main/scala/docspell/joex/hk/CleanupRememberMeTask.scala index b3d909ab..574abfc7 100644 --- a/modules/joex/src/main/scala/docspell/joex/hk/CleanupRememberMeTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/hk/CleanupRememberMeTask.scala @@ -8,6 +8,7 @@ package docspell.joex.hk import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.scheduler.Task import docspell.store.Store diff --git a/modules/joex/src/main/scala/docspell/joex/hk/HouseKeepingTask.scala b/modules/joex/src/main/scala/docspell/joex/hk/HouseKeepingTask.scala index 5e87ce17..0da26529 100644 --- a/modules/joex/src/main/scala/docspell/joex/hk/HouseKeepingTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/hk/HouseKeepingTask.scala @@ -8,14 +8,16 @@ package docspell.joex.hk import cats.effect._ import cats.implicits._ + import docspell.backend.ops.OFileRepository import docspell.common._ import docspell.joex.Config import docspell.joex.filecopy.FileIntegrityCheckTask -import docspell.scheduler.{JobTaskResultEncoder, Task} -import com.github.eikek.calev._ import docspell.scheduler.usertask.UserTask +import docspell.scheduler.{JobTaskResultEncoder, Task} import docspell.store.Store + +import com.github.eikek.calev._ import io.circe.Encoder import io.circe.generic.semiauto.deriveEncoder diff --git a/modules/joex/src/main/scala/docspell/joex/hk/IntegrityCheckTask.scala b/modules/joex/src/main/scala/docspell/joex/hk/IntegrityCheckTask.scala index 06fca014..90a3a073 100644 --- a/modules/joex/src/main/scala/docspell/joex/hk/IntegrityCheckTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/hk/IntegrityCheckTask.scala @@ -8,6 +8,7 @@ package docspell.joex.hk import cats.effect._ import cats.implicits._ + import docspell.backend.ops.OFileRepository import docspell.common._ import docspell.joex.filecopy.FileIntegrityCheckTask diff --git a/modules/joex/src/main/scala/docspell/joex/learn/LearnClassifierTask.scala b/modules/joex/src/main/scala/docspell/joex/learn/LearnClassifierTask.scala index ce49077f..0de696c9 100644 --- a/modules/joex/src/main/scala/docspell/joex/learn/LearnClassifierTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/learn/LearnClassifierTask.scala @@ -9,12 +9,13 @@ package docspell.joex.learn import cats.data.OptionT import cats.effect._ import cats.implicits._ + import docspell.analysis.TextAnalyser import docspell.backend.ops.OCollective import docspell.common._ import docspell.joex.Config -import docspell.scheduler._ import docspell.logging.Logger +import docspell.scheduler._ import docspell.store.Store import docspell.store.records.{RClassifierModel, RClassifierSetting} diff --git a/modules/joex/src/main/scala/docspell/joex/learn/LearnItemEntities.scala b/modules/joex/src/main/scala/docspell/joex/learn/LearnItemEntities.scala index 7d59afef..19048abd 100644 --- a/modules/joex/src/main/scala/docspell/joex/learn/LearnItemEntities.scala +++ b/modules/joex/src/main/scala/docspell/joex/learn/LearnItemEntities.scala @@ -10,6 +10,7 @@ import cats.data.Kleisli import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.analysis.TextAnalyser import docspell.analysis.classifier.TextClassifier.Data import docspell.common._ diff --git a/modules/joex/src/main/scala/docspell/joex/learn/LearnTags.scala b/modules/joex/src/main/scala/docspell/joex/learn/LearnTags.scala index 54eb5a88..e80fe83c 100644 --- a/modules/joex/src/main/scala/docspell/joex/learn/LearnTags.scala +++ b/modules/joex/src/main/scala/docspell/joex/learn/LearnTags.scala @@ -9,6 +9,7 @@ package docspell.joex.learn import cats.data.Kleisli import cats.effect._ import cats.implicits._ + import docspell.analysis.TextAnalyser import docspell.common._ import docspell.scheduler._ diff --git a/modules/joex/src/main/scala/docspell/joex/notify/PeriodicDueItemsTask.scala b/modules/joex/src/main/scala/docspell/joex/notify/PeriodicDueItemsTask.scala index 1969a1aa..94db119b 100644 --- a/modules/joex/src/main/scala/docspell/joex/notify/PeriodicDueItemsTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/notify/PeriodicDueItemsTask.scala @@ -9,16 +9,17 @@ package docspell.joex.notify import cats.data.NonEmptyList import cats.effect._ import cats.implicits._ + import docspell.backend.ops.ONotification import docspell.common._ -import docspell.scheduler.Context -import docspell.scheduler.Task import docspell.notification.api.EventContext import docspell.notification.api.NotificationChannel import docspell.notification.api.PeriodicDueItemsArgs import docspell.query.Date import docspell.query.ItemQuery._ import docspell.query.ItemQueryDsl._ +import docspell.scheduler.Context +import docspell.scheduler.Task import docspell.store.Store import docspell.store.qb.Batch import docspell.store.queries.ListItem diff --git a/modules/joex/src/main/scala/docspell/joex/notify/PeriodicQueryTask.scala b/modules/joex/src/main/scala/docspell/joex/notify/PeriodicQueryTask.scala index 3b08edca..af1242cd 100644 --- a/modules/joex/src/main/scala/docspell/joex/notify/PeriodicQueryTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/notify/PeriodicQueryTask.scala @@ -10,10 +10,9 @@ import cats.data.OptionT import cats.data.{NonEmptyList => Nel} import cats.effect._ import cats.implicits._ + import docspell.backend.ops.ONotification import docspell.common._ -import docspell.scheduler.Context -import docspell.scheduler.Task import docspell.notification.api.EventContext import docspell.notification.api.NotificationChannel import docspell.notification.api.PeriodicQueryArgs @@ -21,6 +20,8 @@ import docspell.query.ItemQuery import docspell.query.ItemQuery.Expr import docspell.query.ItemQuery.Expr.AndExpr import docspell.query.ItemQueryParser +import docspell.scheduler.Context +import docspell.scheduler.Task import docspell.store.Store import docspell.store.qb.Batch import docspell.store.queries.ListItem diff --git a/modules/joex/src/main/scala/docspell/joex/pagecount/AllPageCountTask.scala b/modules/joex/src/main/scala/docspell/joex/pagecount/AllPageCountTask.scala index 6ff6b578..f6f91346 100644 --- a/modules/joex/src/main/scala/docspell/joex/pagecount/AllPageCountTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/pagecount/AllPageCountTask.scala @@ -9,10 +9,11 @@ package docspell.joex.pagecount import cats.effect._ import cats.implicits._ import fs2.{Chunk, Stream} + import docspell.backend.JobFactory import docspell.backend.ops.OJoex import docspell.common._ -import docspell.scheduler.{Context, Job, JobStore, Task} +import docspell.scheduler._ import docspell.store.Store import docspell.store.records.RAttachment diff --git a/modules/joex/src/main/scala/docspell/joex/pagecount/MakePageCountTask.scala b/modules/joex/src/main/scala/docspell/joex/pagecount/MakePageCountTask.scala index bcb5fd77..2769ac00 100644 --- a/modules/joex/src/main/scala/docspell/joex/pagecount/MakePageCountTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/pagecount/MakePageCountTask.scala @@ -8,6 +8,7 @@ package docspell.joex.pagecount import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.joex.process.AttachmentPageCount import docspell.scheduler.Context diff --git a/modules/joex/src/main/scala/docspell/joex/pdfconv/ConvertAllPdfTask.scala b/modules/joex/src/main/scala/docspell/joex/pdfconv/ConvertAllPdfTask.scala index 47b66323..84d3687d 100644 --- a/modules/joex/src/main/scala/docspell/joex/pdfconv/ConvertAllPdfTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/pdfconv/ConvertAllPdfTask.scala @@ -9,9 +9,10 @@ package docspell.joex.pdfconv import cats.effect._ import cats.implicits._ import fs2.{Chunk, Stream} + import docspell.backend.ops.OJoex import docspell.common._ -import docspell.scheduler.{Context, Job, JobStore, Task} +import docspell.scheduler._ import docspell.store.Store import docspell.store.records.RAttachment diff --git a/modules/joex/src/main/scala/docspell/joex/pdfconv/PdfConvTask.scala b/modules/joex/src/main/scala/docspell/joex/pdfconv/PdfConvTask.scala index 7bf6fd5c..a1ce38fb 100644 --- a/modules/joex/src/main/scala/docspell/joex/pdfconv/PdfConvTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/pdfconv/PdfConvTask.scala @@ -11,6 +11,7 @@ import cats.data.OptionT import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.common._ import docspell.convert.ConversionResult import docspell.convert.extern.OcrMyPdf @@ -18,6 +19,7 @@ import docspell.joex.Config import docspell.scheduler.{Context, Task} import docspell.store.Store import docspell.store.records._ + import io.circe.generic.semiauto._ import io.circe.{Decoder, Encoder} diff --git a/modules/joex/src/main/scala/docspell/joex/preview/AllPreviewsTask.scala b/modules/joex/src/main/scala/docspell/joex/preview/AllPreviewsTask.scala index dcf66d56..b0988305 100644 --- a/modules/joex/src/main/scala/docspell/joex/preview/AllPreviewsTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/preview/AllPreviewsTask.scala @@ -9,11 +9,12 @@ package docspell.joex.preview import cats.effect._ import cats.implicits._ import fs2.{Chunk, Stream} + import docspell.backend.JobFactory import docspell.backend.ops.OJoex import docspell.common.MakePreviewArgs.StoreMode import docspell.common._ -import docspell.scheduler.{Context, Job, JobStore, Task} +import docspell.scheduler._ import docspell.store.Store import docspell.store.records.RAttachment diff --git a/modules/joex/src/main/scala/docspell/joex/preview/MakePreviewTask.scala b/modules/joex/src/main/scala/docspell/joex/preview/MakePreviewTask.scala index afd541ea..ce807205 100644 --- a/modules/joex/src/main/scala/docspell/joex/preview/MakePreviewTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/preview/MakePreviewTask.scala @@ -8,6 +8,7 @@ package docspell.joex.preview import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.extract.pdfbox.PdfboxPreview import docspell.extract.pdfbox.PreviewConfig diff --git a/modules/joex/src/main/scala/docspell/joex/process/AttachmentPageCount.scala b/modules/joex/src/main/scala/docspell/joex/process/AttachmentPageCount.scala index 1e216897..7c2880aa 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/AttachmentPageCount.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/AttachmentPageCount.scala @@ -11,6 +11,7 @@ import cats.data.OptionT import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.common._ import docspell.extract.pdfbox.PdfMetaData import docspell.extract.pdfbox.PdfboxExtract diff --git a/modules/joex/src/main/scala/docspell/joex/process/AttachmentPreview.scala b/modules/joex/src/main/scala/docspell/joex/process/AttachmentPreview.scala index db7c5f14..31c1e007 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/AttachmentPreview.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/AttachmentPreview.scala @@ -11,6 +11,7 @@ import cats.data.OptionT import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.common._ import docspell.extract.pdfbox.PdfboxPreview import docspell.extract.pdfbox.PreviewConfig diff --git a/modules/joex/src/main/scala/docspell/joex/process/ConvertPdf.scala b/modules/joex/src/main/scala/docspell/joex/process/ConvertPdf.scala index 1d4b9196..648d6b29 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/ConvertPdf.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/ConvertPdf.scala @@ -11,6 +11,7 @@ import cats.data.{Kleisli, OptionT} import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.common._ import docspell.convert.ConversionResult.Handler import docspell.convert.SanitizeHtml diff --git a/modules/joex/src/main/scala/docspell/joex/process/CreateItem.scala b/modules/joex/src/main/scala/docspell/joex/process/CreateItem.scala index 7bd299bb..b5ae352b 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/CreateItem.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/CreateItem.scala @@ -11,6 +11,7 @@ import cats.data.OptionT import cats.effect.Sync import cats.implicits._ import fs2.Stream + import docspell.common._ import docspell.scheduler.{Context, Task} import docspell.store.Store diff --git a/modules/joex/src/main/scala/docspell/joex/process/CrossCheckProposals.scala b/modules/joex/src/main/scala/docspell/joex/process/CrossCheckProposals.scala index 74066434..58f24854 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/CrossCheckProposals.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/CrossCheckProposals.scala @@ -10,9 +10,10 @@ import cats.data.NonEmptyList import cats.data.OptionT import cats.effect.Sync import cats.implicits._ + import docspell.common._ -import docspell.scheduler.Task import docspell.logging.Logger +import docspell.scheduler.Task import docspell.store.Store /** After candidates have been determined, the set is reduced by doing some cross checks. diff --git a/modules/joex/src/main/scala/docspell/joex/process/DuplicateCheck.scala b/modules/joex/src/main/scala/docspell/joex/process/DuplicateCheck.scala index 44b01592..ed0035b3 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/DuplicateCheck.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/DuplicateCheck.scala @@ -8,12 +8,14 @@ package docspell.joex.process import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.scheduler.{Context, Task} import docspell.store.Store import docspell.store.queries.QItem import docspell.store.records.RFileMeta import docspell.store.records.RJob + import doobie._ object DuplicateCheck { diff --git a/modules/joex/src/main/scala/docspell/joex/process/EvalProposals.scala b/modules/joex/src/main/scala/docspell/joex/process/EvalProposals.scala index 327c0d08..521aeb5b 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/EvalProposals.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/EvalProposals.scala @@ -7,8 +7,10 @@ package docspell.joex.process import java.time.{LocalDate, Period} + import cats.effect.Sync import cats.implicits._ + import docspell.common._ import docspell.scheduler.Task import docspell.store.Store diff --git a/modules/joex/src/main/scala/docspell/joex/process/ExtractArchive.scala b/modules/joex/src/main/scala/docspell/joex/process/ExtractArchive.scala index c4b02630..5e2d86b0 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/ExtractArchive.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/ExtractArchive.scala @@ -14,12 +14,14 @@ import cats.implicits._ import cats.kernel.Monoid import cats.kernel.Order import fs2.Stream + import docspell.common._ import docspell.files.Zip import docspell.joex.mail._ import docspell.scheduler._ import docspell.store.Store import docspell.store.records._ + import emil.Mail /** Goes through all attachments and extracts archive files, like zip files. The process diff --git a/modules/joex/src/main/scala/docspell/joex/process/FindProposal.scala b/modules/joex/src/main/scala/docspell/joex/process/FindProposal.scala index 80beb187..b5cf948a 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/FindProposal.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/FindProposal.scala @@ -7,9 +7,11 @@ package docspell.joex.process import java.time.ZoneId + import cats.effect.Sync import cats.implicits._ import cats.{Applicative, FlatMap} + import docspell.analysis.contact._ import docspell.common.MetaProposal.Candidate import docspell.common._ diff --git a/modules/joex/src/main/scala/docspell/joex/process/ItemHandler.scala b/modules/joex/src/main/scala/docspell/joex/process/ItemHandler.scala index 3122da9f..8d59a969 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/ItemHandler.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/ItemHandler.scala @@ -10,6 +10,7 @@ import cats.data.OptionT import cats.effect._ import cats.implicits._ import fs2.Stream + import docspell.analysis.TextAnalyser import docspell.backend.ops.OItem import docspell.common.{ItemState, ProcessItemArgs} diff --git a/modules/joex/src/main/scala/docspell/joex/process/LinkProposal.scala b/modules/joex/src/main/scala/docspell/joex/process/LinkProposal.scala index 71598b64..a656c230 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/LinkProposal.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/LinkProposal.scala @@ -9,6 +9,7 @@ package docspell.joex.process import cats.data.NonEmptyList import cats.effect.Sync import cats.implicits._ + import docspell.common._ import docspell.scheduler.{Context, Task} import docspell.store.Store diff --git a/modules/joex/src/main/scala/docspell/joex/process/ProcessItem.scala b/modules/joex/src/main/scala/docspell/joex/process/ProcessItem.scala index 819be5c7..6087b37f 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/ProcessItem.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/ProcessItem.scala @@ -8,6 +8,7 @@ package docspell.joex.process import cats.effect._ import cats.implicits._ + import docspell.analysis.TextAnalyser import docspell.backend.ops.OItem import docspell.common.ProcessItemArgs diff --git a/modules/joex/src/main/scala/docspell/joex/process/ReProcessItem.scala b/modules/joex/src/main/scala/docspell/joex/process/ReProcessItem.scala index cc840710..1863d2ef 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/ReProcessItem.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/ReProcessItem.scala @@ -9,6 +9,7 @@ package docspell.joex.process import cats.data.OptionT import cats.effect._ import cats.implicits._ + import docspell.analysis.TextAnalyser import docspell.backend.ops.OItem import docspell.common._ diff --git a/modules/joex/src/main/scala/docspell/joex/process/SaveProposals.scala b/modules/joex/src/main/scala/docspell/joex/process/SaveProposals.scala index fdb0c7a7..fc17a54f 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/SaveProposals.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/SaveProposals.scala @@ -8,10 +8,11 @@ package docspell.joex.process import cats.effect.Sync import cats.implicits._ + import docspell.common._ import docspell.scheduler.{Context, Task} -import docspell.store.{AddResult, Store} import docspell.store.records._ +import docspell.store.{AddResult, Store} /** Saves the proposals in the database */ object SaveProposals { diff --git a/modules/joex/src/main/scala/docspell/joex/process/TextAnalysis.scala b/modules/joex/src/main/scala/docspell/joex/process/TextAnalysis.scala index 774040dd..3a8ab6aa 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/TextAnalysis.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/TextAnalysis.scala @@ -9,6 +9,7 @@ package docspell.joex.process import cats.Traverse import cats.effect._ import cats.implicits._ + import docspell.analysis.classifier.TextClassifier import docspell.analysis.{NlpSettings, TextAnalyser} import docspell.common.MetaProposal.Candidate diff --git a/modules/joex/src/main/scala/docspell/joex/process/TextExtraction.scala b/modules/joex/src/main/scala/docspell/joex/process/TextExtraction.scala index 757ee54f..ee6b8939 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/TextExtraction.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/TextExtraction.scala @@ -9,6 +9,7 @@ package docspell.joex.process import cats.data.OptionT import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.extract.{ExtractConfig, ExtractResult, Extraction} import docspell.ftsclient.{FtsClient, TextData} diff --git a/modules/joex/src/main/scala/docspell/joex/scanmailbox/ScanMailboxTask.scala b/modules/joex/src/main/scala/docspell/joex/scanmailbox/ScanMailboxTask.scala index 5a91003b..039dee08 100644 --- a/modules/joex/src/main/scala/docspell/joex/scanmailbox/ScanMailboxTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/scanmailbox/ScanMailboxTask.scala @@ -12,15 +12,17 @@ import cats.data.OptionT import cats.effect._ import cats.implicits._ import fs2._ + import docspell.backend.ops.{OJoex, OUpload} import docspell.common._ import docspell.joex.Config -import docspell.scheduler.{Context, Task} import docspell.logging.Logger +import docspell.scheduler.{Context, Task} +import docspell.store.Store import docspell.store.queries.QOrganization import docspell.store.records._ + import _root_.io.circe.syntax._ -import docspell.store.Store import emil.SearchQuery.{All, ReceivedDate} import emil.javamail.syntax._ import emil.{MimeType => _, _} diff --git a/modules/joex/src/main/scala/docspell/joex/updatecheck/UpdateCheckTask.scala b/modules/joex/src/main/scala/docspell/joex/updatecheck/UpdateCheckTask.scala index 128bc76b..39dfbbbc 100644 --- a/modules/joex/src/main/scala/docspell/joex/updatecheck/UpdateCheckTask.scala +++ b/modules/joex/src/main/scala/docspell/joex/updatecheck/UpdateCheckTask.scala @@ -9,11 +9,13 @@ package docspell.joex.updatecheck import cats.data.OptionT import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.scheduler.Task import docspell.scheduler.usertask.UserTask import docspell.store.Store import docspell.store.records.RUserEmail + import emil._ object UpdateCheckTask { diff --git a/modules/restserver/src/main/scala/docspell/restserver/RestAppImpl.scala b/modules/restserver/src/main/scala/docspell/restserver/RestAppImpl.scala index 0ff2957b..6b0f87b8 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/RestAppImpl.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/RestAppImpl.scala @@ -9,6 +9,7 @@ package docspell.restserver import cats.effect._ import fs2.Stream import fs2.concurrent.Topic + import docspell.backend.BackendApp import docspell.backend.auth.{AuthToken, ShareToken} import docspell.ftsclient.FtsClient @@ -24,6 +25,7 @@ import docspell.restserver.webapp.{TemplateRoutes, Templates, WebjarRoutes} import docspell.restserver.ws.{OutputEvent, WebSocketRoutes} import docspell.scheduler.impl.JobStoreModuleBuilder import docspell.store.Store + import emil.javamail.JavaMailEmil import org.http4s.HttpRoutes import org.http4s.client.Client diff --git a/modules/restserver/src/main/scala/docspell/restserver/Subscriptions.scala b/modules/restserver/src/main/scala/docspell/restserver/Subscriptions.scala index e1cafa20..8ffa7045 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/Subscriptions.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/Subscriptions.scala @@ -9,6 +9,7 @@ package docspell.restserver import cats.effect.Async import fs2.Stream import fs2.concurrent.Topic + import docspell.pubsub.api.PubSubT import docspell.restserver.ws.OutputEvent import docspell.scheduler.msg.{JobDone, JobSubmitted} diff --git a/modules/restserver/src/main/scala/docspell/restserver/routes/NotifyDueItemsRoutes.scala b/modules/restserver/src/main/scala/docspell/restserver/routes/NotifyDueItemsRoutes.scala index 04248885..dc180ba0 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/routes/NotifyDueItemsRoutes.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/routes/NotifyDueItemsRoutes.scala @@ -9,6 +9,7 @@ package docspell.restserver.routes import cats.data.OptionT import cats.effect._ import cats.implicits._ + import docspell.backend.BackendApp import docspell.backend.MailAddressCodec import docspell.backend.auth.AuthToken @@ -19,6 +20,7 @@ import docspell.restserver.Config import docspell.restserver.conv.{Conversions, NonEmptyListSupport} import docspell.restserver.http4s.ClientRequestInfo import docspell.scheduler.usertask._ + import org.http4s._ import org.http4s.circe.CirceEntityDecoder._ import org.http4s.circe.CirceEntityEncoder._ diff --git a/modules/restserver/src/main/scala/docspell/restserver/routes/PeriodicQueryRoutes.scala b/modules/restserver/src/main/scala/docspell/restserver/routes/PeriodicQueryRoutes.scala index f0866e76..0a300130 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/routes/PeriodicQueryRoutes.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/routes/PeriodicQueryRoutes.scala @@ -9,6 +9,7 @@ package docspell.restserver.routes import cats.data.{NonEmptyList, OptionT} import cats.effect._ import cats.implicits._ + import docspell.backend.BackendApp import docspell.backend.MailAddressCodec import docspell.backend.auth.AuthToken @@ -20,6 +21,7 @@ import docspell.restserver.Config import docspell.restserver.conv.{Conversions, NonEmptyListSupport} import docspell.restserver.http4s.ClientRequestInfo import docspell.scheduler.usertask._ + import org.http4s._ import org.http4s.circe.CirceEntityDecoder._ import org.http4s.circe.CirceEntityEncoder._ diff --git a/modules/restserver/src/main/scala/docspell/restserver/routes/ScanMailboxRoutes.scala b/modules/restserver/src/main/scala/docspell/restserver/routes/ScanMailboxRoutes.scala index 430baae4..df271180 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/routes/ScanMailboxRoutes.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/routes/ScanMailboxRoutes.scala @@ -9,12 +9,14 @@ package docspell.restserver.routes import cats.data.OptionT import cats.effect._ import cats.implicits._ + import docspell.backend.BackendApp import docspell.backend.auth.AuthToken import docspell.common._ import docspell.restapi.model._ import docspell.restserver.conv.Conversions import docspell.scheduler.usertask._ + import org.http4s._ import org.http4s.circe.CirceEntityDecoder._ import org.http4s.circe.CirceEntityEncoder._ diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/Job.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/Job.scala index 9dc08b5c..a6f4fc82 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/Job.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/Job.scala @@ -1,8 +1,16 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler import cats.effect.Sync import cats.syntax.functor._ + import docspell.common._ + import io.circe.Encoder final case class Job[A]( diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/JobStore.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/JobStore.scala index 8ca887f9..de9eee9d 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/JobStore.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/JobStore.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler trait JobStore[F[_]] { diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/JobStoreModule.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/JobStoreModule.scala index 2d170127..729bf645 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/JobStoreModule.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/JobStoreModule.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler import docspell.scheduler.usertask.UserTaskStore diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/SchedulerModule.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/SchedulerModule.scala index d422f200..a8e5f53e 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/SchedulerModule.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/SchedulerModule.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler trait SchedulerModule[F[_]] { diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/CancelJob.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/CancelJob.scala index 3ec0c891..1c9bae36 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/CancelJob.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/CancelJob.scala @@ -8,6 +8,7 @@ package docspell.scheduler.msg import docspell.common._ import docspell.pubsub.api.{Topic, TypedTopic} + import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} import io.circe.{Decoder, Encoder} diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/JobSubmitted.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/JobSubmitted.scala index c6ef40b2..c798b9d7 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/JobSubmitted.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/JobSubmitted.scala @@ -8,6 +8,7 @@ package docspell.scheduler.msg import docspell.common._ import docspell.pubsub.api.{Topic, TypedTopic} + import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} import io.circe.{Decoder, Encoder} diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/JobsNotify.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/JobsNotify.scala index 8bc9fc8d..1f4331d2 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/JobsNotify.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/JobsNotify.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.msg import docspell.pubsub.api.{Topic, TypedTopic} diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/PeriodicTaskNotify.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/PeriodicTaskNotify.scala index d8f5157e..2ff4e055 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/PeriodicTaskNotify.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/msg/PeriodicTaskNotify.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.msg import docspell.pubsub.api.{Topic, TypedTopic} diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/usertask/UserTask.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/usertask/UserTask.scala index f700da5c..b799a20c 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/usertask/UserTask.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/usertask/UserTask.scala @@ -6,8 +6,9 @@ package docspell.scheduler.usertask -import com.github.eikek.calev.CalEvent import docspell.common._ + +import com.github.eikek.calev.CalEvent import io.circe.Encoder final case class UserTask[A]( diff --git a/modules/scheduler/api/src/main/scala/docspell/scheduler/usertask/UserTaskStore.scala b/modules/scheduler/api/src/main/scala/docspell/scheduler/usertask/UserTaskStore.scala index 2a3dcf0e..8d8b594d 100644 --- a/modules/scheduler/api/src/main/scala/docspell/scheduler/usertask/UserTaskStore.scala +++ b/modules/scheduler/api/src/main/scala/docspell/scheduler/usertask/UserTaskStore.scala @@ -7,8 +7,10 @@ package docspell.scheduler.usertask import cats.data.OptionT -import docspell.common._ import fs2.Stream + +import docspell.common._ + import io.circe._ /** User tasks are `RPeriodicTask`s that can be managed by the user. The user can change diff --git a/modules/scheduler/api/src/test/scala/docspell/scheduler/CountingSchemeSpec.scala b/modules/scheduler/api/src/test/scala/docspell/scheduler/CountingSchemeSpec.scala index 1339d220..e396127e 100644 --- a/modules/scheduler/api/src/test/scala/docspell/scheduler/CountingSchemeSpec.scala +++ b/modules/scheduler/api/src/test/scala/docspell/scheduler/CountingSchemeSpec.scala @@ -7,6 +7,7 @@ package docspell.scheduler import docspell.common.Priority + import munit._ class CountingSchemeSpec extends FunSuite { diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/ContextImpl.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/ContextImpl.scala index 69d2b34b..d801a169 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/ContextImpl.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/ContextImpl.scala @@ -1,8 +1,14 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.impl import cats._ -import cats.syntax.all._ import cats.effect._ +import cats.syntax.all._ import docspell.common._ import docspell.logging.Logger diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobQueue.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobQueue.scala index 0c190723..5317b7dc 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobQueue.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobQueue.scala @@ -8,6 +8,7 @@ package docspell.scheduler.impl import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.store.Store import docspell.store.queries.QJob diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobStoreImpl.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobStoreImpl.scala index f2507301..38b0b067 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobStoreImpl.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobStoreImpl.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.impl import cats.effect.Sync @@ -5,7 +11,6 @@ import cats.syntax.all._ import docspell.common.Timestamp import docspell.scheduler._ - import docspell.store.Store import docspell.store.records.RJob diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobStoreModuleBuilder.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobStoreModuleBuilder.scala index e5762935..0cab5e30 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobStoreModuleBuilder.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/JobStoreModuleBuilder.scala @@ -1,3 +1,9 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.impl import cats.effect.Async diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/LogSink.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/LogSink.scala index 8094b90e..c59b45ce 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/LogSink.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/LogSink.scala @@ -8,12 +8,13 @@ package docspell.scheduler.impl import cats.effect._ import cats.implicits._ +import fs2.Pipe + import docspell.common._ import docspell.logging import docspell.scheduler.LogEvent import docspell.store.Store import docspell.store.records.RJobLog -import fs2.Pipe trait LogSink[F[_]] { diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicSchedulerBuilder.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicSchedulerBuilder.scala index a3566f13..0933105e 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicSchedulerBuilder.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicSchedulerBuilder.scala @@ -1,9 +1,16 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.impl import cats.effect._ +import fs2.concurrent.SignallingRef + import docspell.pubsub.api.PubSubT import docspell.scheduler._ -import fs2.concurrent.SignallingRef object PeriodicSchedulerBuilder { diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicSchedulerImpl.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicSchedulerImpl.scala index 43d89324..2e7ac515 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicSchedulerImpl.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicSchedulerImpl.scala @@ -10,12 +10,14 @@ import cats.effect._ import cats.implicits._ import fs2._ import fs2.concurrent.SignallingRef + import docspell.common._ import docspell.pubsub.api.PubSubT import docspell.scheduler._ import docspell.scheduler.impl.PeriodicSchedulerImpl.State import docspell.scheduler.msg.{JobsNotify, PeriodicTaskNotify} import docspell.store.records.RPeriodicTask + import eu.timepit.fs2cron.calev.CalevScheduler final class PeriodicSchedulerImpl[F[_]: Async]( diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicTaskStore.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicTaskStore.scala index 1f1ecb52..bd922cb2 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicTaskStore.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/PeriodicTaskStore.scala @@ -8,6 +8,7 @@ package docspell.scheduler.impl import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.scheduler.{Job, JobStore} import docspell.store.queries.QPeriodicTask diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/QUserTask.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/QUserTask.scala index a1ea1632..058ed421 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/QUserTask.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/QUserTask.scala @@ -1,16 +1,24 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.impl import cats.effect.Sync import cats.syntax.all._ -import com.github.eikek.calev.CalEvent -import docspell.common.{AccountId, Ident, Priority, Timestamp} +import fs2.Stream + +import docspell.common._ import docspell.scheduler.usertask.{UserTask, UserTaskScope} import docspell.store.qb.DML import docspell.store.qb.DSL._ import docspell.store.records.RPeriodicTask -import fs2.Stream -import io.circe.{Decoder, Encoder} + +import com.github.eikek.calev.CalEvent import doobie._ +import io.circe.{Decoder, Encoder} object QUserTask { private val RT = RPeriodicTask.T diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/QueueLogger.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/QueueLogger.scala index 08a176ec..8a4a0824 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/QueueLogger.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/QueueLogger.scala @@ -1,13 +1,20 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.impl -import cats.syntax.all._ import cats.effect.std.Queue import cats.effect.{Async, Sync} +import cats.syntax.all._ +import fs2.Stream + import docspell.common.{Ident, LogLevel} import docspell.logging import docspell.logging.{Level, Logger} import docspell.scheduler.LogEvent -import fs2.Stream object QueueLogger { diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerBuilder.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerBuilder.scala index e2cf3286..6a6e0c2a 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerBuilder.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerBuilder.scala @@ -10,9 +10,10 @@ import cats.effect._ import cats.effect.std.Semaphore import cats.implicits._ import fs2.concurrent.SignallingRef -import docspell.scheduler._ + import docspell.notification.api.EventSink import docspell.pubsub.api.PubSubT +import docspell.scheduler._ import docspell.store.Store case class SchedulerBuilder[F[_]: Async]( diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerImpl.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerImpl.scala index 0f063599..955a3b59 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerImpl.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerImpl.scala @@ -12,16 +12,18 @@ import cats.effect.std.Semaphore import cats.implicits._ import fs2.Stream import fs2.concurrent.SignallingRef -import docspell.scheduler.msg.{CancelJob, JobDone, JobsNotify} + import docspell.common._ -import docspell.scheduler._ -import docspell.scheduler.impl.SchedulerImpl._ import docspell.notification.api.Event import docspell.notification.api.EventSink import docspell.pubsub.api.PubSubT +import docspell.scheduler._ +import docspell.scheduler.impl.SchedulerImpl._ +import docspell.scheduler.msg.{CancelJob, JobDone, JobsNotify} import docspell.store.Store import docspell.store.queries.QJob import docspell.store.records.RJob + import io.circe.Json final class SchedulerImpl[F[_]: Async]( diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerModuleBuilder.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerModuleBuilder.scala index 09e6c6a1..e8d68d77 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerModuleBuilder.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/SchedulerModuleBuilder.scala @@ -1,13 +1,15 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.impl import cats.effect._ + import docspell.common.Ident -import docspell.scheduler.{ - JobTaskRegistry, - PeriodicSchedulerConfig, - SchedulerConfig, - SchedulerModule -} +import docspell.scheduler._ case class SchedulerModuleBuilder[F[_]: Async] private ( periodicSchedulerConfig: PeriodicSchedulerConfig, diff --git a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/UserTaskStoreImpl.scala b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/UserTaskStoreImpl.scala index 2f90617e..21d14b75 100644 --- a/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/UserTaskStoreImpl.scala +++ b/modules/scheduler/impl/src/main/scala/docspell/scheduler/impl/UserTaskStoreImpl.scala @@ -1,15 +1,23 @@ +/* + * Copyright 2020 Eike K. & Contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + package docspell.scheduler.impl -import cats.effect._ -import docspell.scheduler.usertask.UserTaskStore import cats.data.OptionT +import cats.effect._ import cats.implicits._ +import fs2.Stream + import docspell.common._ +import docspell.scheduler.impl.QUserTask.UserTaskCodec +import docspell.scheduler.usertask.UserTaskStore import docspell.scheduler.usertask._ import docspell.store.{AddResult, Store} -import fs2.Stream + import io.circe._ -import QUserTask.UserTaskCodec final class UserTaskStoreImpl[F[_]: Sync]( store: Store[F], diff --git a/modules/store/src/main/scala/docspell/store/records/RPeriodicTask.scala b/modules/store/src/main/scala/docspell/store/records/RPeriodicTask.scala index 2f298dff..5be5ca08 100644 --- a/modules/store/src/main/scala/docspell/store/records/RPeriodicTask.scala +++ b/modules/store/src/main/scala/docspell/store/records/RPeriodicTask.scala @@ -9,9 +9,11 @@ package docspell.store.records import cats.data.NonEmptyList import cats.effect._ import cats.implicits._ + import docspell.common._ import docspell.store.qb.DSL._ import docspell.store.qb._ + import com.github.eikek.calev.CalEvent import doobie._ import doobie.implicits._