예제 #1
0
        private void UpdateIndexer(IndexerResource indexerResource)
        {
            var indexer = _indexerService.Get(indexerResource.Id);

            indexer.InjectFrom(indexerResource);
            indexer.Settings = SchemaDeserializer.DeserializeSchema(indexer.Settings, indexerResource.Fields);

            ValidateIndexer(indexer);

            _indexerService.Update(indexer);
        }
예제 #2
0
        private Notification ConvertToNotification(NotificationResource notificationResource)
        {
            var notification = _notificationService.Schema()
                               .SingleOrDefault(i =>
                                                i.Implementation.Equals(notificationResource.Implementation,
                                                                        StringComparison.InvariantCultureIgnoreCase));

            if (notification == null)
            {
                throw new BadRequestException("Invalid Notification Implementation");
            }

            notification.InjectFrom(notificationResource);
            notification.Settings = SchemaDeserializer.DeserializeSchema(notification.Settings, notificationResource.Fields);

            return(notification);
        }
예제 #3
0
        private Indexer GetIndexer(IndexerResource indexerResource)
        {
            var indexer = _indexerService.Schema()
                          .SingleOrDefault(i =>
                                           i.Implementation.Equals(indexerResource.Implementation,
                                                                   StringComparison.InvariantCultureIgnoreCase));

            if (indexer == null)
            {
                throw new BadRequestException("Invalid Indexer Implementation");
            }

            indexer.InjectFrom(indexerResource);
            indexer.Settings = SchemaDeserializer.DeserializeSchema(indexer.Settings, indexerResource.Fields);

            ValidateIndexer(indexer);

            return(indexer);
        }