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
profileIdIdentifier of the
Profilefor which the api calls should filter.nilif it should not be filtering byProfilecoreDataControllerFactoryFactory that is capable of returning a CoreDataController instance
foregroundQueueread queue, remember never to access the read NSManagedObjects properties/relations on any other queue (Default: DispatchQueue.main)
backgroundQueuewrite queue (Default: DispatchQueue(label: “erx-task-data-source-queue”, qos: .userInitiated))
-
Declaration
Swift
public convenience init( profileId: UUID?, coreDataControllerFactory: CoreDataControllerFactory ) -
Fetch the most recent
timestampof allCommunicationsDeclaration
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
profileFilters 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
profileprofile for which you want to have the count
-
Creates or updates the passes sequence of
ErxTaskCommunicationsDeclaration
Swift
public func save(communications: [ErxTask.Communication]) -> AnyPublisher<Bool, LocalStoreError>Parameters
communicationsArray of communications that should be stored
Return Value
trueif save operation was successful -
Updates a already existing DiGaInfo into the store
Declaration
Swift
public func update(diGaInfo: DiGaInfo) -> AnyPublisher<Bool, LocalStoreError>Parameters
diGaInfonew
DiGaInfothat should be savedReturn Value
A publisher that finishes with
trueon completion or fails with an error. -
Fetch the ErxChargeItem by its id when required by
SelfDeclaration
Swift
public func fetchChargeItem( by chargeItemID: ErxChargeItem.ID ) -> AnyPublisher<ErxSparseChargeItem?, LocalStoreError>Parameters
idthe ErxChargeItem ID
fullDetailif set to true, fetches all available information otherwise only a minimal version
Return Value
Publisher for the fetch request
-
Fetch the most recent
enteredDateof allChargeItemsDeclaration
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
ErxChargeItemsDeclaration
Swift
public func save(chargeItems: [ErxSparseChargeItem]) -> AnyPublisher<Bool, LocalStoreError>Parameters
chargeItemsArray of charge items that should be stored
Return Value
trueif save operation was successful -
Deletes a sequence of charge items from the store
Declaration
Swift
public func delete(chargeItems: [ErxSparseChargeItem]) -> AnyPublisher<Bool, LocalStoreError>Parameters
chargeItemsArray of charge items that should be deleted
Return Value
trueif 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
idthe ErxTask ID
accessCodeAccessCode, optional as required by implementing DataStore
Return Value
Publisher for the fetch request
-
Fetch the most recent
lastModifiedof allErxTasksDeclaration
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
ProfileDeclaration
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
tasksArray of
ErxTaskss that should be savedupdateProfileLastAuthenticatedtrueif the profile last authenticated should be updated,falseotherwise.Return Value
A publisher that finishes with
trueon 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.MedicationDispensesDeclaration
Swift
public func save(medicationDispenses: [ErxMedicationDispense]) -> AnyPublisher<Bool, LocalStoreError>Parameters
medicationDispensesArray of medication dispenses that should be stored
Return Value
trueif save operation was successful -
Initializes an instance of
ErxTaskCoreDataStorewith a failing CoreDataControllerDeclaration
Swift
public static let failing: DefaultErxTaskCoreDataStore
View on GitHub
DefaultErxTaskCoreDataStore Class Reference