public void UpdateTagsIn(JournalPage journalPage)
 {
     _databaseMediator.ExecuteCommand(new UpdateJournalPageTags {
         JournalPage = journalPage
     });
     _eventPublisher.PublishEvent(new JournalPageUpdatedEvent(journalPage));
 }
Beispiel #2
0
        public override void Execute(UpdateJournalPage payload)
        {
            var journalPage = payload.JournalPage;

            journalPage.RunUpdate();

            Db.JournalPages.Update(journalPage.Id, new
            {
                journalPage.Title,
                journalPage.OriginId,
                journalPage.Description,
                journalPage.FullText,
                journalPage.UpdatedAt,
                journalPage.UpdatedBy,
                journalPage.ParentId,
            });

            _databaseMediator.ExecuteCommand(new UpdateJournalPageTags {
                JournalPage = journalPage
            });

            if (!journalPage.IsLoaded)
            {
                return;
            }

            _databaseMediator.ExecuteCommand(new UpdateItemContent {
                ItemWithContent = journalPage
            });
        }
Beispiel #3
0
 private void deleteJournalPage(JournalPage journalPage)
 {
     _databaseMediator.ExecuteCommand(new DeleteJournalPage {
         JournalPage = journalPage
     });
     journal.Remove(journalPage);
     _eventPublisher.PublishEvent(new JournalPageDeletedEvent(journalPage));
 }
Beispiel #4
0
        public override void Execute(DeleteJournalPage payload)
        {
            var journalPage = payload.JournalPage;

            journalPage.RelatedItems.Each(delete);
            Db.JournalPages.Delete(journalPage.Id);
            _databaseMediator.ExecuteCommand(new DeleteItemContent {
                ItemWithContent = journalPage
            });
        }
Beispiel #5
0
        public override void Execute(CreateJournalPage payload)
        {
            var journalPage = payload.JournalPage;

            journalPage.RunUpdate();

            if (!journalPage.IsTransient)
            {
                throw new CannotCreateNewItemForPersitedEntity(journalPage.Id);
            }

            _databaseMediator.ExecuteCommand(new AddItemContent {
                ItemWithContent = journalPage
            });

            journalPage.Id          = _idGenerator.NewId();
            journalPage.UniqueIndex = _databaseMediator.ExecuteQuery(new NextAvailableJournalPageIndex());

            Db.JournalPages.Insert(new
            {
                journalPage.Id,
                journalPage.OriginId,
                journalPage.UniqueIndex,
                journalPage.Title,
                journalPage.Description,
                journalPage.CreatedAt,
                journalPage.CreatedBy,
                journalPage.UpdatedAt,
                journalPage.UpdatedBy,
                journalPage.FullText,
                ContentId = journalPage.Content.Id
            });
        }
Beispiel #6
0
        private void createDefaultDiagram(Core.Journal.Journal journal)
        {
            var journalDiagram = _diagramFactory.CreateDefault();

            journal.AddDiagram(journalDiagram);
            _databaseMediator.ExecuteCommand(new CreateJournalDiagram {
                Diagram = journalDiagram
            });
        }
Beispiel #7
0
        public override void Execute(DeleteRelatedItemFromJournalPage payload)
        {
            var relatedItem = payload.RelatedItem;

            Db.RelatedItems.Delete(relatedItem.Id);
            _databaseMediator.ExecuteCommand(new DeleteItemContent {
                ItemWithContent = relatedItem
            });
        }
        public override void Execute(AddRelatedPageToJournalPage payload)
        {
            var journalPage = payload.JournalPage;
            var relatedItem = payload.RelatedItem;

            if (!relatedItem.IsTransient)
            {
                throw new CannotCreateNewItemForPersitedEntity(relatedItem.Id);
            }

            relatedItem.Id = _idGenerator.NewId();

            _databaseMediator.ExecuteCommand(new AddItemContent {
                ItemWithContent = relatedItem
            });

            Db.RelatedItems.Insert(new
            {
                relatedItem.Id,
                JournalPageId = journalPage.Id,
                relatedItem.ItemType,
                relatedItem.Name,
                relatedItem.CreatedAt,
                relatedItem.Description,
                relatedItem.OriginId,
                relatedItem.Version,
                relatedItem.IconName,
                relatedItem.FullPath,
                relatedItem.Discriminator,
                ContentId = relatedItem.Content.Id
            });

            _databaseMediator.ExecuteCommand(new UpdateJournalPage {
                JournalPage = journalPage
            });
        }