mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Reformat with scalafmt 3.0.0
This commit is contained in:
@ -9,12 +9,11 @@ package docspell.common
|
||||
import io.circe.generic.semiauto._
|
||||
import io.circe.{Decoder, Encoder}
|
||||
|
||||
/** Arguments for the `AllPreviewsTask` that submits tasks to
|
||||
* generates a preview image for attachments.
|
||||
/** Arguments for the `AllPreviewsTask` that submits tasks to generates a preview image
|
||||
* for attachments.
|
||||
*
|
||||
* It can replace the current preview image or only generate one, if
|
||||
* it is missing. If no collective is specified, it considers all
|
||||
* attachments.
|
||||
* It can replace the current preview image or only generate one, if it is missing. If no
|
||||
* collective is specified, it considers all attachments.
|
||||
*/
|
||||
case class AllPreviewsArgs(
|
||||
collective: Option[Ident],
|
||||
|
@ -15,17 +15,15 @@ object CollectiveState {
|
||||
/** A normal active collective */
|
||||
case object Active extends CollectiveState
|
||||
|
||||
/** A collective may be readonly in cases it is implicitly closed
|
||||
* (e.g. no payment). Users can still see there data and
|
||||
* download, but have no write access.
|
||||
/** A collective may be readonly in cases it is implicitly closed (e.g. no payment).
|
||||
* Users can still see there data and download, but have no write access.
|
||||
*/
|
||||
case object ReadOnly extends CollectiveState
|
||||
|
||||
/** A collective that has been explicitely closed. */
|
||||
case object Closed extends CollectiveState
|
||||
|
||||
/** A collective blocked by a super user, usually some emergency
|
||||
* action.
|
||||
/** A collective blocked by a super user, usually some emergency action.
|
||||
*/
|
||||
case object Blocked extends CollectiveState
|
||||
|
||||
|
@ -9,14 +9,12 @@ package docspell.common
|
||||
import io.circe._
|
||||
import io.circe.generic.semiauto._
|
||||
|
||||
/** Arguments for the task that finds all pdf files that have not been
|
||||
* converted and submits for each a job that will convert the file
|
||||
* using ocrmypdf.
|
||||
/** Arguments for the task that finds all pdf files that have not been converted and
|
||||
* submits for each a job that will convert the file using ocrmypdf.
|
||||
*
|
||||
* If the `collective` argument is present, then this task and the
|
||||
* ones that are submitted by this task run in the realm of the
|
||||
* collective (and only their files are considered). If it is empty,
|
||||
* it is a system task and all files are considered.
|
||||
* If the `collective` argument is present, then this task and the ones that are
|
||||
* submitted by this task run in the realm of the collective (and only their files are
|
||||
* considered). If it is empty, it is a system task and all files are considered.
|
||||
*/
|
||||
case class ConvertAllPdfArgs(collective: Option[Ident])
|
||||
|
||||
|
@ -14,8 +14,8 @@ import io.circe.generic.semiauto._
|
||||
|
||||
/** Arguments to the empty-trash task.
|
||||
*
|
||||
* This task is run periodically to really delete all soft-deleted
|
||||
* items. These are items with state `ItemState.Deleted`.
|
||||
* This task is run periodically to really delete all soft-deleted items. These are items
|
||||
* with state `ItemState.Deleted`.
|
||||
*/
|
||||
case class EmptyTrashArgs(
|
||||
collective: Ident,
|
||||
|
@ -14,8 +14,8 @@ case class FileName private (name: String) {
|
||||
case n => (name.take(n), Some(name.drop(n + 1)))
|
||||
}
|
||||
|
||||
/** Returns the name part without the extension. If there is no
|
||||
* extension, it is the same as fullname.
|
||||
/** Returns the name part without the extension. If there is no extension, it is the
|
||||
* same as fullname.
|
||||
*/
|
||||
def baseName: String =
|
||||
base
|
||||
@ -27,20 +27,20 @@ case class FileName private (name: String) {
|
||||
def fullName: String =
|
||||
name
|
||||
|
||||
/** Creates a new name where part is spliced into the name before the
|
||||
* extension, separated by separator.
|
||||
/** Creates a new name where part is spliced into the name before the extension,
|
||||
* separated by separator.
|
||||
*/
|
||||
def withPart(part: String, sep: Char): FileName =
|
||||
if (part.isEmpty()) this
|
||||
else
|
||||
ext
|
||||
.map(e => new FileName(s"${base}${sep}${part}.${e}"))
|
||||
.getOrElse(new FileName(s"${base}${sep}${part}"))
|
||||
.map(e => new FileName(s"$base$sep$part.$e"))
|
||||
.getOrElse(new FileName(s"$base$sep$part"))
|
||||
|
||||
/** Create a new name using the given extension. */
|
||||
def withExtension(newExt: String): FileName =
|
||||
if (newExt.isEmpty()) new FileName(base)
|
||||
else new FileName(s"${base}.${newExt}")
|
||||
else new FileName(s"$base.$newExt")
|
||||
|
||||
}
|
||||
object FileName {
|
||||
|
@ -16,14 +16,11 @@ trait Glob {
|
||||
/** Matches the input string against this glob. */
|
||||
def matches(caseSensitive: Boolean)(in: String): Boolean
|
||||
|
||||
/** If this glob consists of multiple segments, it is the same as
|
||||
* `matches`. If it is only a single segment, it is matched against
|
||||
* the last segment of the input string that is assumed to be a
|
||||
* pathname separated by slash.
|
||||
/** If this glob consists of multiple segments, it is the same as `matches`. If it is
|
||||
* only a single segment, it is matched against the last segment of the input string
|
||||
* that is assumed to be a pathname separated by slash.
|
||||
*
|
||||
* Example:
|
||||
* test.* <> "/a/b/test.txt" => true
|
||||
* /test.* <> "/a/b/test.txt" => false
|
||||
* Example: test.* <> "/a/b/test.txt" => true /test.* <> "/a/b/test.txt" => false
|
||||
*/
|
||||
def matchFilenameOrPath(in: String): Boolean
|
||||
|
||||
|
@ -20,8 +20,7 @@ object JobState {
|
||||
/** Waiting for being executed. */
|
||||
case object Waiting extends JobState {}
|
||||
|
||||
/** A scheduler has picked up this job and will pass it to the next
|
||||
* free slot.
|
||||
/** A scheduler has picked up this job and will pass it to the next free slot.
|
||||
*/
|
||||
case object Scheduled extends JobState {}
|
||||
|
||||
|
@ -13,9 +13,9 @@ import io.circe.generic.semiauto._
|
||||
|
||||
/** Arguments to the classify-item task.
|
||||
*
|
||||
* This task is run periodically and learns from existing documents
|
||||
* to create a model for predicting tags of new documents. The user
|
||||
* must give a tag category as a subset of possible tags..
|
||||
* This task is run periodically and learns from existing documents to create a model for
|
||||
* predicting tags of new documents. The user must give a tag category as a subset of
|
||||
* possible tags..
|
||||
*/
|
||||
case class LearnClassifierArgs(
|
||||
collective: Ident
|
||||
|
@ -9,9 +9,8 @@ package docspell.common
|
||||
import io.circe.generic.semiauto._
|
||||
import io.circe.{Decoder, Encoder}
|
||||
|
||||
/** Arguments for the `MakePageCountTask` that reads the number of
|
||||
* pages for an attachment and stores it into the meta data of the
|
||||
* attachment.
|
||||
/** Arguments for the `MakePageCountTask` that reads the number of pages for an attachment
|
||||
* and stores it into the meta data of the attachment.
|
||||
*/
|
||||
case class MakePageCountArgs(
|
||||
attachment: Ident
|
||||
|
@ -9,11 +9,9 @@ package docspell.common
|
||||
import io.circe.generic.semiauto._
|
||||
import io.circe.{Decoder, Encoder}
|
||||
|
||||
/** Arguments for the `MakePreviewTask` that generates a preview image
|
||||
* for an attachment.
|
||||
/** Arguments for the `MakePreviewTask` that generates a preview image for an attachment.
|
||||
*
|
||||
* It can replace the current preview image or only generate one, if
|
||||
* it is missing.
|
||||
* It can replace the current preview image or only generate one, if it is missing.
|
||||
*/
|
||||
case class MakePreviewArgs(
|
||||
attachment: Ident,
|
||||
|
@ -20,14 +20,12 @@ import io.circe.generic.semiauto._
|
||||
|
||||
/** A proposed meta data to an item.
|
||||
*
|
||||
* There is only one value for each proposal type. The list of
|
||||
* candidates is meant to be ordered from the best match to the
|
||||
* lowest match.
|
||||
* There is only one value for each proposal type. The list of candidates is meant to be
|
||||
* ordered from the best match to the lowest match.
|
||||
*
|
||||
* The candidate is already "resolved" against the database and
|
||||
* contains a valid record (with its ID and a human readable name).
|
||||
* Additionally it carries a set of "labels" (which may be empty)
|
||||
* that are the source of this candidate.
|
||||
* The candidate is already "resolved" against the database and contains a valid record
|
||||
* (with its ID and a human readable name). Additionally it carries a set of "labels"
|
||||
* (which may be empty) that are the source of this candidate.
|
||||
*/
|
||||
case class MetaProposal(proposalType: MetaProposalType, values: NonEmptyList[Candidate]) {
|
||||
|
||||
@ -96,8 +94,8 @@ object MetaProposal {
|
||||
}
|
||||
}
|
||||
|
||||
/** Merges candidates with same `IdRef` values and concatenates their
|
||||
* respective labels. The candidate order is preserved.
|
||||
/** Merges candidates with same `IdRef` values and concatenates their respective labels.
|
||||
* The candidate order is preserved.
|
||||
*/
|
||||
def flatten(s: NonEmptyList[Candidate]): NonEmptyList[Candidate] = {
|
||||
def mergeInto(
|
||||
|
@ -91,13 +91,12 @@ object MetaProposalList {
|
||||
.getOrElse(empty)
|
||||
|
||||
def fromMap(m: Map[MetaProposalType, MetaProposal]): MetaProposalList =
|
||||
new MetaProposalList(m.toList.map({ case (k, v) => v.copy(proposalType = k) }))
|
||||
new MetaProposalList(m.toList.map { case (k, v) => v.copy(proposalType = k) })
|
||||
|
||||
/** Flattens the given list of meta-proposals into a single list,
|
||||
* where each meta-proposal type exists at most once. Candidates to
|
||||
* equal proposal-types are merged together. The candidate's order
|
||||
* is preserved and candidates of proposals are appended as given
|
||||
* by the order of the given `seq'.
|
||||
/** Flattens the given list of meta-proposals into a single list, where each
|
||||
* meta-proposal type exists at most once. Candidates to equal proposal-types are
|
||||
* merged together. The candidate's order is preserved and candidates of proposals are
|
||||
* appended as given by the order of the given `seq'.
|
||||
*/
|
||||
def flatten(ml: Seq[MetaProposalList]): MetaProposalList =
|
||||
flatten0(
|
||||
|
@ -13,11 +13,10 @@ import io.circe.generic.semiauto._
|
||||
|
||||
/** Arguments to the notification task.
|
||||
*
|
||||
* This tasks queries items with a due date and informs the user via
|
||||
* mail.
|
||||
* This tasks queries items with a due date and informs the user via mail.
|
||||
*
|
||||
* If the structure changes, there must be some database migration to
|
||||
* update or remove the json data of the corresponding task.
|
||||
* If the structure changes, there must be some database migration to update or remove
|
||||
* the json data of the corresponding task.
|
||||
*/
|
||||
case class NotifyDueItemsArgs(
|
||||
account: AccountId,
|
||||
|
@ -14,11 +14,11 @@ import io.circe.generic.semiauto._
|
||||
|
||||
/** Arguments to the process-item task.
|
||||
*
|
||||
* This task is run for each new file to create a new item from it or
|
||||
* to add this file as an attachment to an existing item.
|
||||
* This task is run for each new file to create a new item from it or to add this file as
|
||||
* an attachment to an existing item.
|
||||
*
|
||||
* If the `itemId' is set to some value, the item is tried to load to
|
||||
* ammend with the given files. Otherwise a new item is created.
|
||||
* If the `itemId' is set to some value, the item is tried to load to ammend with the
|
||||
* given files. Otherwise a new item is created.
|
||||
*
|
||||
* It is also re-used by the 'ReProcessItem' task.
|
||||
*/
|
||||
|
@ -11,10 +11,9 @@ import io.circe.{Decoder, Encoder}
|
||||
|
||||
/** Arguments when re-processing an item.
|
||||
*
|
||||
* The `itemId` must exist and point to some item. If the attachment
|
||||
* list is non-empty, only those attachments are re-processed. They
|
||||
* must belong to the given item. If the list is empty, then all
|
||||
* attachments are re-processed.
|
||||
* The `itemId` must exist and point to some item. If the attachment list is non-empty,
|
||||
* only those attachments are re-processed. They must belong to the given item. If the
|
||||
* list is empty, then all attachments are re-processed.
|
||||
*/
|
||||
case class ReProcessItemArgs(itemId: Ident, attachments: List[Ident])
|
||||
|
||||
|
@ -13,11 +13,10 @@ import io.circe.generic.semiauto._
|
||||
|
||||
/** Arguments to the poll-mailbox task.
|
||||
*
|
||||
* This tasks queries user mailboxes and pushes found mails into
|
||||
* docspell for processing.
|
||||
* This tasks queries user mailboxes and pushes found mails into docspell for processing.
|
||||
*
|
||||
* If the structure changes, there must be some database migration to
|
||||
* update or remove the json data of the corresponding task.
|
||||
* If the structure changes, there must be some database migration to update or remove
|
||||
* the json data of the corresponding task.
|
||||
*/
|
||||
case class ScanMailboxArgs(
|
||||
// the docspell user account
|
||||
|
Reference in New Issue
Block a user