Class DocumentProcessor
Inherited Members
Namespace: LemonEdge.API.Core.Processors
Assembly: LemonEdge.API.dll
Syntax
[ServerTask("Save Document", "E272734E-EEDC-4C9A-8F54-0832F522D904", typeof(DocumentSaveParameter), CanOnlyRunOnServer = false, Description = "Saves document binary data")]
public class DocumentProcessor : IBaseDataSetProcessorWithDBSave, IBaseDataSetProcessor, IProcessor, IDisposable
Constructors
DocumentProcessor(IEntityUpdater, IReadOnlyCache, UserInfo, IDocumentStorageServiceFactory)
Declaration
public DocumentProcessor(IEntityUpdater updater, IReadOnlyCache cache, UserInfo user, IDocumentStorageServiceFactory factory)
Parameters
Type | Name | Description |
---|---|---|
IEntityUpdater | updater | |
IReadOnlyCache | cache | |
UserInfo | user | |
IDocumentStorageServiceFactory | factory |
Properties
Cache
A local cache for performance
Declaration
public IReadOnlyCache Cache { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCache |
IgnoreEvents
Indicates the processor should ignore changes to any items within the processor
Normally used when the processor responds to an event and wants to prevent any other responses while it finishes processing that change
Declaration
public bool IgnoreEvents { get; set; }
Property Value
Type | Description |
---|---|
bool |
Loaded
Flag to indicate if the processor has been fully loaded
Declaration
public bool Loaded { get; }
Property Value
Type | Description |
---|---|
bool |
Order
If we have multiple save processors working, this indicates the order in which they will be processed with relation to each other
Declaration
public short Order { get; }
Property Value
Type | Description |
---|---|
short |
Reporter
A reporter to provide feedback to a log, or client depending on the context the process is running under
Declaration
public BusyProgressReporter Reporter { get; set; }
Property Value
Type | Description |
---|---|
BusyProgressReporter |
SaveProcessed
Indicates the ProcessOnDBSave has already been run. This is set by the system during save, and prevents recursive calls.
It is also released by the system on save completion/failure
Declaration
public bool SaveProcessed { get; set; }
Property Value
Type | Description |
---|---|
bool |
Updater
A context to ensure the process can query, load and modify all LemonEdge data
Declaration
public IEntityUpdater Updater { get; }
Property Value
Type | Description |
---|---|
IEntityUpdater |
User
The current logged in user the process is running under
Declaration
public UserInfo User { get; }
Property Value
Type | Description |
---|---|
UserInfo |
Methods
AddToDataSetToProcess(IBaseEntity, EntityOperation)
If a modified item belongs in the processor (IsChangedItemPartOfDataSet(IBaseEntity)), this adds the item to the processor if it already isn't a member of it
Declaration
public void AddToDataSetToProcess(IBaseEntity item, EntityOperation operationType)
Parameters
Type | Name | Description |
---|---|---|
IBaseEntity | item | The item to add to the processor |
EntityOperation | operationType | The type of operation that modified the item. Useful as deleted items can often be treated differently in a processor. |
Dispose()
Declaration
public void Dispose()
IsChangedItemPartOfDataSet(IBaseEntity)
This function returns true if the specified modified item belongs in this processor.
Non modified items will just automatically be loaded by the processor anyway, this is more to keep track of items as they are changed and should be added to the processor without having to reload
Declaration
public bool IsChangedItemPartOfDataSet(IBaseEntity item)
Parameters
Type | Name | Description |
---|---|---|
IBaseEntity | item | The item to check if it belongs in this processor |
Returns
Type | Description |
---|---|
bool | True if the specified item belongs in this processor |
Load()
A thread safe implementation to load all required data for the processor
Once completed Loaded should return true.
Declaration
public Task Load()
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the load operation |
ProcessOnDBSave()
Will only run when connected to the database directly.
i.e. in the web service or in a client connected to the db service, not in a client connected to the web service.
For the client connected to the webservice, as part of the webservices save routine it will call this.Declaration
public Task ProcessOnDBSave()
Returns
Type | Description |
---|---|
Task |