DefaultErxTaskCoreDataStore

public class DefaultErxTaskCoreDataStore : ErxTaskCoreDataStore

Store for fetching, creating, updating or deleting ErxTasks and it‘s underlying types. Access to most entities is tied to the given profileId. [REQ:BSI-eRp-ePA:O.Source_2#3] CoreDataStore adapter for ErxTasks

  • Initialize an ErxTask Core Data Store

    Declaration

    Swift

    public init(
        profileId: UUID?,
        coreDataControllerFactory: CoreDataControllerFactory,
        foregroundQueue: AnySchedulerOf<DispatchQueue>,
        backgroundQueue: AnySchedulerOf<DispatchQueue>,
        dateProvider: @escaping () -> Date
    )

    Parameters

    profileId

    Identifier of the Profile for which the api calls should filter. nil if it should not be filtering by Profile

    coreDataControllerFactory

    Factory that is capable of returning a CoreDataController instance

    foregroundQueue

    read queue, remember never to access the read NSManagedObjects properties/relations on any other queue (Default: DispatchQueue.main)

    backgroundQueue

    write queue (Default: DispatchQueue(label: “erx-task-data-source-queue”, qos: .userInitiated))

  • Declaration

    Swift

    public convenience init(
        profileId: UUID?,
        coreDataControllerFactory: CoreDataControllerFactory
    )
  • Fetch the most recent timestamp of all Communications

    Declaration

    Swift

    public func fetchLatestTimestampForCommunications() -> AnyPublisher<String?, LocalStoreError>
  • List all communications for the given profile contained in the store

    Declaration

    Swift

    public func listAllCommunications(
        for profile: ErxTask.Communication.Profile
    ) -> AnyPublisher<[ErxTask.Communication], LocalStoreError>

    Parameters

    profile

    Filters for the passed Profile type

    Return Value

    array of the fetched communications or error

  • Returns all unread communications for the given profile

    Declaration

    Swift

    public func allUnreadCommunications(
        for profile: ErxTask.Communication.Profile
    ) -> AnyPublisher<[ErxTask.Communication], LocalStoreError>

    Parameters

    profile

    profile for which you want to have the count

  • Creates or updates the passes sequence of ErxTaskCommunications

    Declaration

    Swift

    public func save(communications: [ErxTask.Communication]) -> AnyPublisher<Bool, LocalStoreError>

    Parameters

    communications

    Array of communications that should be stored

    Return Value

    true if save operation was successful

  • Fetch the ErxChargeItem by its id when required by Self

    Declaration

    Swift

    public func fetchChargeItem(
        by chargeItemID: ErxChargeItem.ID
    ) -> AnyPublisher<ErxSparseChargeItem?, LocalStoreError>

    Parameters

    id

    the ErxChargeItem ID

    fullDetail

    if set to true, fetches all available information otherwise only a minimal version

    Return Value

    Publisher for the fetch request

  • Fetch the most recent enteredDate of all ChargeItems

    Declaration

    Swift

    public func fetchLatestTimestampForChargeItems() -> AnyPublisher<String?, LocalStoreError>
  • List all charge items with the given local contained in the store

    Declaration

    Swift

    public func listAllChargeItems(
    ) -> AnyPublisher<[ErxSparseChargeItem], LocalStoreError>

    Return Value

    Array of the fetched charge items or error

  • Creates or updates the passed sequence of ErxChargeItems

    Declaration

    Swift

    public func save(chargeItems: [ErxSparseChargeItem]) -> AnyPublisher<Bool, LocalStoreError>

    Parameters

    chargeItems

    Array of charge items that should be stored

    Return Value

    true if save operation was successful

  • Deletes a sequence of charge items from the store

    Declaration

    Swift

    public func delete(chargeItems: [ErxSparseChargeItem]) -> AnyPublisher<Bool, LocalStoreError>

    Parameters

    chargeItems

    Array of charge items that should be deleted

    Return Value

    true if delete operation was successful

  • Fetch the entire database (incl. other profiles) for an ErxTask by its id and accessCode

    Declaration

    Swift

    public func fetchTask(by taskID: ErxTask.ID, accessCode: String?) -> AnyPublisher<ErxTask?, LocalStoreError>

    Parameters

    id

    the ErxTask ID

    accessCode

    AccessCode, optional as required by implementing DataStore

    Return Value

    Publisher for the fetch request

  • Fetch the most recent lastModified of all ErxTasks

    Declaration

    Swift

    public func fetchLatestLastModifiedForErxTasks() -> AnyPublisher<String?, LocalStoreError>
  • List all tasks contained in the store

    Declaration

    Swift

    public func listAllTasks() -> AnyPublisher<[ErxTask], LocalStoreError>
  • List all tasks without relationship to a Profile

    Declaration

    Swift

    public func listAllTasksWithoutProfile() -> AnyPublisher<[ErxTask], LocalStoreError>
  • Creates or updates a sequence of tasks into the store

    Declaration

    Swift

    public func save(tasks: [ErxTask], updateProfileLastAuthenticated: Bool) -> AnyPublisher<Bool, LocalStoreError>

    Parameters

    tasks

    Array of ErxTaskss that should be saved

    updateProfileLastAuthenticated

    true if the profile last authenticated should be updated, false otherwise.

    Return Value

    A publisher that finishes with true on completion or fails with an error.

  • Deletes a sequence of tasks from the store

    Declaration

    Swift

    public func delete(tasks: [ErxTask]) -> AnyPublisher<Bool, LocalStoreError>
  • List all medication dispenses contained in the store

    Declaration

    Swift

    public func listAllMedicationDispenses() -> AnyPublisher<[ErxMedicationDispense], LocalStoreError>
  • Creates or updates the passed sequence of ErxTask.MedicationDispenses

    Declaration

    Swift

    public func save(medicationDispenses: [ErxMedicationDispense]) -> AnyPublisher<Bool, LocalStoreError>

    Parameters

    medicationDispenses

    Array of medication dispenses that should be stored

    Return Value

    true if save operation was successful

  • Initializes an instance of ErxTaskCoreDataStorewith a failing CoreDataController

    Declaration

    Swift

    public static let failing: DefaultErxTaskCoreDataStore