/// <summary> /// Delete handle put the handle in the recycle bin /// </summary> /// <param name="e"></param> public void On(DocumentDeleted e) { var documentReadModel = _documentWriter.FindOneById(e.Handle); var data = new Dictionary <String, Object>(); String fileName = ""; Dictionary <String, object> customData = null; if (documentReadModel != null) { if (documentReadModel.FileName != null) { fileName = documentReadModel.FileName.FileName + "." + documentReadModel.FileName.Extension; } customData = documentReadModel.CustomData; } var documentDescriptorReadModel = _documentsDescriptorReader.AllUnsorted .SingleOrDefault(dd => dd.Id == e.DocumentDescriptorId); String blobId = null; if (documentDescriptorReadModel != null && documentDescriptorReadModel.Formats.ContainsKey(new DocumentFormat("original"))) { var originalFormat = documentDescriptorReadModel.Formats[new DocumentFormat("original")]; blobId = originalFormat.BlobId; } _recycleBin.Delete(e.AggregateId, "Jarvis", e.CommitStamp, new { Handle = e.Handle, FileName = fileName, CustomData = customData, DocumentDescriptorId = e.DocumentDescriptorId, OriginalBlobId = blobId, }); }
public void On(DocumentDeleted e) { _streamReadModelCollection.Insert(e, new StreamReadModel() { Id = GetNewId(), Handle = e.Handle, EventType = HandleStreamEventTypes.DocumentDeleted }); }
private async Task HandleAsync(DocumentDeleted @event, CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { _logger.LogInformation($"{nameof(DocumentProjectionManager)}.{nameof(HandleAsync)} was cancelled before execution"); cancellationToken.ThrowIfCancellationRequested(); } await Task.WhenAll(_projectionWriters.Select(pw => pw.RemoveAsync(@event.Subject, cancellationToken))); }
public void verify_handle_deleted() { CreateSut(); var evt = new DocumentDeleted(new DocumentHandle("rev_1"), new DocumentDescriptorId(1)); _sut.Handle(evt, false); Assert.That(rmStream, Has.Count.EqualTo(1)); Assert.That(rmStream[0].EventType, Is.EqualTo(HandleStreamEventTypes.DocumentDeleted)); Assert.That(rmStream[0].Handle, Is.EqualTo("rev_1")); }
void IHandle <DocumentDeleted> .Handle(DocumentDeleted message) { var doc = ActiveItem as EditDocumentViewModel; if (doc != null && doc.Id == message.DocumentId) { //TODO: this is an arbitrary choice, we should actually go back using the history ActiveItem = AvailableItems.OrderBy(x => x.Metadata.Index).Skip(3).Select(x => x.Value).First(); doc.TryClose(); } }
public void Handle(DocumentDeleted message) { var doc = ActiveItem as EditDocumentViewModel; if (doc != null && doc.Id == message.DocumentId) { //TODO: this is an arbitrary choice, we should actually go back using the history ActiveItem = Items[3]; doc.TryClose(); } }
public void Handle(DocumentDeleted message) { var doc = ActiveItem as EditDocumentViewModel; if (doc != null && doc.Id == message.DocumentId) { //TODO: this is an arbitrary choice, we should actually go back using the history ActiveItem = screens.Skip(3).Select(x => x.Value).First(); doc.TryClose(); } }
public void On(DocumentDeleted e) { if (IsReplay) { return; } _commandBus.Send(new DeleteDocumentDescriptor(e.DocumentDescriptorId, e.Handle) .WithDiagnosticTriggeredByInfo(e, "Handle deleted") ); _handleMapper.DeleteHandle(e.Handle); }
public void On(DocumentDeleted e) { _writer.Delete(e.Handle, e.CheckpointToken); _documentDeletedWrapper.Insert(e, new DocumentDeletedReadModel() { Id = e.Handle + "+" + e.DocumentDescriptorId + "+" + e.CheckpointToken, DeletionDate = e.CommitStamp, Handle = e.Handle, DocumentDescriptorId = e.DocumentDescriptorId }, false); }
/// <summary> /// Delete a document /// </summary> /// <param name="document">The document to delete</param> public void DeleteDocument(IDocumentObject document) { if (_documents.ContainsKey(document.Name.ToLower())) { _documents.Remove(document.Name.ToLower()); _documentsModified = true; if (DocumentDeleted != null) { DocumentDeleted.Invoke(this, new DocumentEventArgs(document)); } } }
private async Task HandleAsync(DocumentDeleted @event, CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { _logger.LogInformation($"{nameof(DocumentProjectionManager)}.{nameof(HandleAsync)} was cancelled before execution"); cancellationToken.ThrowIfCancellationRequested(); } await Task.WhenAll(_projectionWriters.Select(pw => pw.UpdateAsync(@event.User, userDocuments => { var documents = userDocuments.Documents.ToList(); documents.RemoveAll(d => d.DocumentId == @event.Subject); userDocuments.Documents = documents; }, cancellationToken))); }
private async Task HandleAsync(DocumentDeleted @event, CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { _logger.LogInformation($"{nameof(DocumentProjectionManager)}.{nameof(HandleAsync)} was cancelled before execution"); cancellationToken.ThrowIfCancellationRequested(); } await Task.WhenAll(_projectionWriters.Select(pw => pw.UpdateAsync(@event.Subject, audit => { var events = audit.Events.ToList(); events.Add(new AuditEvent { Id = Subject.New(), TimeStamp = @event.Timestamp, User = @event.User, Message = "Document removed" }); audit.Events = events; }, cancellationToken))); }
void When(DocumentDeleted e) { MarkAsDeleted(); }
public void Handle(DocumentDeleted @event) { _state.Deleted = true; Version = @event.Version; }
public void Apply(DocumentDeleted @event) { AggregateDataStructure.DateDeleted = @event.Timstamp; }