예제 #1
0
 public MnchController(IMediator mediator, IManifestRepository manifestRepository,
                       IManifestService manifestService, IMnchService mnchService)
 {
     _mediator        = mediator;
     _manifestService = manifestService;
     _mnchService     = mnchService;
 }
예제 #2
0
 public HtsController(IMediator mediator, IManifestRepository manifestRepository, IHtsClientRepository htsClientRepository, IManifestService manifestService, IHtsService htsService)
 {
     _mediator            = mediator;
     _htsClientRepository = htsClientRepository;
     _manifestService     = manifestService;
     _htsService          = htsService;
 }
예제 #3
0
 public CbsController(IMediator mediator, IManifestRepository manifestRepository, IMasterPatientIndexRepository masterPatientIndexRepository, IManifestService manifestService, IMpiService mpiService)
 {
     _mediator = mediator;
     _masterPatientIndexRepository = masterPatientIndexRepository;
     _manifestService = manifestService;
     _mpiService      = mpiService;
 }
예제 #4
0
 public ManifestService(IManifestRepository manifestRepository,
                        IDailyRepository dailyRepository,
                        IUnitOfWork unitOfWork)
 {
     _manifestRepository = manifestRepository;
     _dailyRepository    = dailyRepository;
     _unitOfWork         = unitOfWork;
 }
 public ResourceController(
     IManifestRepository repository,
     ICheckPermissions checker,
     IGrantPermissions granter, IServiceConfiguration serviceConfiguration)
 {
     _repository           = repository;
     _checker              = checker;
     _granter              = granter;
     _serviceConfiguration = serviceConfiguration;
 }
        public ManifestService(IOptions <AppSettings> appOptions, ILogger <ManifestService> logger, IManifestRepository manifestRepository)
        {
            _appSettings        = appOptions.Value;
            _logger             = logger;
            _manifestRepository = manifestRepository;

            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                _manifestSemaphore = new Semaphore(10, 10);
            }
        }
예제 #7
0
 public MachineConfigurator(ISystemInitializer systemInitializer,
                            IManifestRepository manifestRepository,
                            IAppInstaller appInstaller,
                            IDownloadAppInstaller downloadAppInstaller,
                            IAppConfigurator appConfigurator,
                            IConsoleLogger consoleLogger)
 {
     this.systemInitializer    = systemInitializer;
     this.manifestRepository   = manifestRepository;
     this.appInstaller         = appInstaller;
     this.downloadAppInstaller = downloadAppInstaller;
     this.appConfigurator      = appConfigurator;
     this.consoleLogger        = consoleLogger;
 }
예제 #8
0
        public ManifestService(IUnitOfWork unitOfWork, IMapper mapper, ApplicationContext appContext, IDataProvider <Manifest> manifestDataProvider, IManifestRepository manifestRepository, IDataProvider <Booking> bookingDataProvider, IShipmentBookingRepository shipmentBookingRepository, IContainerRepository containerRepository, IDataProvider <Container> containerDataProvider, IOrderDetailRepository orderDetailRepository, IDataProvider <OrderDetail> orderDetailDataProvider) : base(unitOfWork, mapper, appContext)
        {
            this._manifestDataProvider = manifestDataProvider;
            this._manifestRepository   = manifestRepository;

            this._shipmentBookingDataProvider = bookingDataProvider;
            this._shipmentBookingRepository   = shipmentBookingRepository;

            this._containerRepository   = containerRepository;
            this._containerDataProvider = containerDataProvider;

            this._orderDetailRepository   = orderDetailRepository;
            this._orderDetailDataProvider = orderDetailDataProvider;
        }
예제 #9
0
        public VesselDepartureService(IUnitOfWork unitOfWork, IMapper mapper, ApplicationContext appContext,
                                      IDataProvider <Manifest> manifestDataProvider, IManifestRepository manifestRepository,
                                      IDataProvider <ArriveOfDespatch> arriveOfDespatchDataProvider, IArriveOfDespatchRepository arriveOfDespatchRepository,
                                      IDataProvider <Booking> bookingDataProvider, IShipmentBookingRepository shipmentBookingRepository, IContainerRepository containerRepository,
                                      IDataProvider <Container> containerDataProvider) : base(unitOfWork, mapper, appContext)
        {
            this._manifestDataProvider = manifestDataProvider;
            this._manifestRepository   = manifestRepository;

            this._shipmentBookingDataProvider = bookingDataProvider;
            this._shipmentBookingRepository   = shipmentBookingRepository;

            this._containerRepository   = containerRepository;
            this._containerDataProvider = containerDataProvider;

            this._arriveOfDespatchDataProvider = arriveOfDespatchDataProvider;
            this._arriveOfDespatchRepository   = arriveOfDespatchRepository;

            pageSize = 50;
        }
        public virtual void Setup()
        {
            MockSiteSettings  = new Mock <ISiteSettings>();
            MockSiteConnector = new Mock <ISiteConnector>();
            MockFormMapper    = new Mock <IFormMapper>();
            MockLogger        = new Mock <ILog>();

            _siteManifests = new ServiceConfiguration();


            HttpsTestsite = $"{SupportServiceIdentity.SupportEmployerAccount}|https://testsite/";

            TestSiteManifest = new EmployerAccountSiteManifest();

            _siteManifests.Add(TestSiteManifest);


            TestSites = HttpsTestsite;

            MockSiteSettings.SetupGet(x => x.BaseUrls)
            .Returns(TestSites);

            TestSiteUri = TestSites.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                          .Where(x => !string.IsNullOrWhiteSpace(x))
                          .Select(x => x.Split(new [] { '|' }, StringSplitOptions.RemoveEmptyEntries))
                          .Select(x => new Uri(x[1])).First();

            TestSiteUri = new Uri($"{TestSiteUri}api/manifest");

            MockSiteConnector.Setup(x => x.Download <SiteManifest>(TestSiteUri)).ReturnsAsync(TestSiteManifest);

            Unit = new ApplicationServices.Services.ManifestRepository(
                MockSiteSettings.Object,
                MockSiteConnector.Object,
                MockFormMapper.Object,
                MockLogger.Object, _siteManifests);
        }
예제 #11
0
        /// <summary>
        /// Handles the publish job, including deleting excluded items from publish manifest
        /// </summary>
        public override async Task <PublishResult> Handle(Guid jobId, IDataStore sourceDataStore, IEnumerable <IDataStore> targetConnections, IDataStore relationshipDataStore, DateTime started, PublishOptions publishOptions)
        {
            CancellationTokenSource errorSource = CancellationTokenSource.CreateLinkedTokenSource(this._appLifetime.ApplicationStopping);

            if (sourceDataStore == null)
            {
                return(PublishResult.Failed(string.Format("No source connection was found with identifier '{0}'.", (object)publishOptions.Source), (Exception)null));
            }
            if (!publishOptions.Targets.Any <string>())
            {
                return(PublishResult.Failed("No target connections were specified.", (Exception)null));
            }
            if (!targetConnections.Any <IDataStore>())
            {
                return(PublishResult.Failed(string.Format("No target connections were found with identifiers '{0}'.", (object)string.Join(",", publishOptions.Targets)), (Exception)null));
            }
            if (targetConnections.Count <IDataStore>() != publishOptions.Targets.Count <string>())
            {
                this._logger.LogWarning(string.Format("Not all targets specified for the job are registered in the Publishing Service. Targets [{0}] are not registered.", (object)string.Join(", ", publishOptions.Targets.Except <string>(targetConnections.Select <IDataStore, string>((Func <IDataStore, string>)(c => c.Name)), (IEqualityComparer <string>)StringComparer.InvariantCultureIgnoreCase))));
            }

            this._sourceName = sourceDataStore.Name;

            IItemNodeRepository sourceItemNodeRepository = this._itemNodeRepositoryFactory.Create(sourceDataStore);

            sourceItemNodeRepository.InitialiseNodeFilterParameters(publishOptions.Languages.ToArray <string>(), this._requiredPublishFieldsResolver.PublishingFieldsIds).Wait();
            IDataStore dataStore = this.DataStoreFactory.ServiceStore();

            IItemIndexRepository         targetIndexRepository         = this._targetIndexRepositoryFactory.Create(dataStore);
            IItemRelationshipRepository  sourceItemRelationshipRepo    = this._itemRelationshipRepoFactory.Create(relationshipDataStore);
            ITemplateGraphRepository     sourceTemplateGraphRepository = this._templateGraphRepositoryFactory.Create(sourceDataStore);
            IWorkflowStateRepository     workflowRepository            = this._workflowRepositoryFactory.Create(sourceDataStore);
            ITestableContentRepository   testableContentRepository     = this._testableContentRepositoryFactory.Create(sourceDataStore);
            IManifestRepository          manifestRepository            = this._manifestRepositoryFactory.Create(dataStore);
            IPublishExclusionsRepository publishExclusionsRepository   = this._publishExclusionsRepositoryFactory.Create(sourceDataStore);
            ITemplateGraph          templateGraph          = this.CreateTemplateGraph(publishOptions, sourceTemplateGraphRepository, sourceItemNodeRepository);
            IPublishCandidateSource publishCandidateSource = this.CreatePublishCandidateSource(publishOptions, sourceItemNodeRepository, sourceItemRelationshipRepo, templateGraph, workflowRepository, this._requiredPublishFieldsResolver);
            IPublishValidator       publishValidator       = this.CreatePublishValidator(started, publishOptions, publishCandidateSource);

            string stage = string.Empty;

            try
            {
                if (this._logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug) || this._logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Trace))
                {
                    this._logger.LogDebug("Executing Publish : \nHandler: {HandlerName}, \nSource: {SourceIdentifier}, \nTargets: {TargetIdentifiers}, \nStart Item: {Id}, \nLanguages: {Languages}, \nProcess Descendants: {Descendants}, \nProcess Related Items: {Related}, \nMetadata: {@Metadata}", (object)this.GetType().Name, (object)publishOptions.Source, (object)publishOptions.Targets, (object)publishOptions.ItemId, (object)publishOptions.Languages, (object)publishOptions.Descendants, (object)publishOptions.RelatedItems, (object)publishOptions.Metadata);
                }
                else
                {
                    this._logger.LogInformation("Executing Publish : \nSource: {SourceIdentifier}, \nTargets: {TargetIdentifiers}, \nStart Item: {Id}, \nLanguages: {Languages}, \nProcess Descendants: {Descendants}, \nProcess Related Items: {Related}\n", (object)publishOptions.Source, (object)publishOptions.Targets, (object)publishOptions.ItemId, (object)publishOptions.Languages, (object)publishOptions.Descendants, (object)publishOptions.RelatedItems);
                }
                stage = "Initializing the manifest calculation system (source)";
                this._logger.LogTrace(stage);
                errorSource.Token.ThrowIfCancellationRequested();

                ISourceObservable <CandidateValidationContext>        publishSourceStream = this.CreatePublishSourceStream(started, publishOptions, publishCandidateSource, publishValidator, this._publisherOpsService, errorSource);
                Dictionary <Guid, IObservable <ICandidateOperation> > targetOpsStreams    = new Dictionary <Guid, IObservable <ICandidateOperation> >();
                foreach (IDataStore targetConnection in targetConnections)
                {
                    errorSource.Token.ThrowIfCancellationRequested();
                    Guid id = targetConnection.Connection.Id;
                    stage = "Initializing the manifest calculation system (target: {TargetId})";
                    this._logger.LogTrace(stage, (object)id);
                    IItemIndexService targetIndex                      = this.CreateTargetIndex(targetConnection, targetIndexRepository, id);
                    IMediaRepository  targetMediaRepository            = this._mediaRepositoryFactory.Create(targetConnection);
                    IObservable <ICandidateOperation> operationsStream = this.CreateTargetOperationsStream(started, publishCandidateSource, publishValidator, publishOptions, (IObservable <CandidateValidationContext>)publishSourceStream, targetIndex, testableContentRepository, targetMediaRepository, this._requiredPublishFieldsResolver, errorSource, id);
                    targetOpsStreams.Add(id, operationsStream);
                }

                stage = "Initializing the manifest builder";
                this._logger.LogTrace(stage);
                IManifestSink sink = this.CreateManifestSink(targetOpsStreams, manifestRepository, errorSource);

                stage = "Starting the manifest calculation for all the targets";
                this._logger.LogInformation(stage);
                errorSource.Token.ThrowIfCancellationRequested();
                await publishSourceStream.Pump().ConfigureAwait(false);

                errorSource.Token.ThrowIfCancellationRequested();
                ManifestStatus[] manifestStatusArray = await sink.Complete().ConfigureAwait(false);

                errorSource.Token.ThrowIfCancellationRequested();
                sink = (IManifestSink)null;

                //Delete excluded items from manifest - BEGIN
                stage = "Deleting publish excluded items from the manifest (Target: {0}, Manifest: {1})";
                foreach (ManifestStatus manifestStatus in manifestStatusArray)
                {
                    this._logger.LogInformation(stage, manifestStatus.TargetId, manifestStatus.ManifestId);
                    await publishExclusionsRepository.DeleteExcludedItemsFromPublishManifest(manifestStatus.ManifestId, manifestStatus.TargetId, publishOptions.GetPublishType());
                }
                //Delete excluded items from manifest - END

                stage = "Starting to promote the manifests to all the targets";
                this._logger.LogInformation(stage);
                this._attachManifests.Send(new PublishJobAttachManifestsEvent.Args(jobId, ((IEnumerable <ManifestStatus>)manifestStatusArray).Select <ManifestStatus, Guid>((Func <ManifestStatus, Guid>)(m => m.ManifestId)).ToArray <Guid>()), this.GetType().Name).Wait(errorSource.Token);
                TargetPromoteContext[] promotionContexts = ((IEnumerable <ManifestStatus>)manifestStatusArray).Select <ManifestStatus, TargetPromoteContext>((Func <ManifestStatus, TargetPromoteContext>)(m => new TargetPromoteContext(targetConnections.First <IDataStore>((Func <IDataStore, bool>)(c => c.Connection.Id == m.TargetId)), m, !publishOptions.GetClearAllCaches()))).ToArray <TargetPromoteContext>();
                errorSource.Token.ThrowIfCancellationRequested();

                IManifestOperationResult[] manifestOperationResultArray =
                    await this._promoterCoordinator.PromoteAll(sourceDataStore,
                                                               relationshipDataStore,
                                                               (IEnumerable <TargetPromoteContext>) promotionContexts,
                                                               this.CreateExecutionStrategy(manifestRepository, errorSource.Token))
                    .ConfigureAwait(false);

                IManifestOperationResult[] array2 = ((IEnumerable <IManifestOperationResult>)manifestOperationResultArray).Where <IManifestOperationResult>((Func <IManifestOperationResult, bool>)(r => r.Operation.Status == TaskStatus.Faulted)).ToArray <IManifestOperationResult>();
                if (((IEnumerable <IManifestOperationResult>)array2).Any <IManifestOperationResult>())
                {
                    throw new AggregateException(string.Format("One or more targets were not succesfully promoted.  The failed target(s) are: {0}.\n See inner exceptions for details.", (object)string.Join("\n", ((IEnumerable <IManifestOperationResult>)array2).Select <IManifestOperationResult, string>((Func <IManifestOperationResult, string>)(r => string.Format("Manifest={0} Target={1}", (object)r.ManifestId, (object)r.DataStore.Connection.Id))))), (IEnumerable <Exception>)((IEnumerable <IManifestOperationResult>)array2).Select <IManifestOperationResult, AggregateException>((Func <IManifestOperationResult, AggregateException>)(r => r.Operation.Exception)));
                }
                Func <IManifestOperationResult, bool> func = (Func <IManifestOperationResult, bool>)(r => r.Operation.IsCanceled);
                if (((IEnumerable <IManifestOperationResult>)manifestOperationResultArray).Any <IManifestOperationResult>(func))
                {
                    errorSource.Cancel();
                }
                errorSource.Token.ThrowIfCancellationRequested();
                return(PublishResult.Complete("OK"));
            }
            catch (OperationCanceledException ex)
            {
                this._logger.LogWarning("Publish job received a cancellation token during stage: {stage}.", (object)stage);
                return(!this._appLifetime.ApplicationStopping.IsCancellationRequested ? PublishResult.Cancelled(string.Format("Job cancelled. Message: {0}", (object)ex.Message)) : PublishResult.Cancelled("Job cancelled. Service is shutting down."));
            }
            catch (Exception ex)
            {
                this._logger.LogError(new EventId(), ex, "There was an error performing the publish during stage: {Stage}", (object)stage);
                return(PublishResult.Failed(string.Format("There was an error performing the publish during stage: {0}.", (object)stage), ex));
            }
        }
예제 #12
0
 public ManifestService(IManifestRepository manifestRepository, ILiveSyncService liveSyncService, IMasterFacilityRepository masterFacilityRepository)
 {
     _manifestRepository       = manifestRepository;
     _liveSyncService          = liveSyncService;
     _masterFacilityRepository = masterFacilityRepository;
 }
예제 #13
0
 public HandshakeController(IManifestRepository manifestRepository, ILiveSyncService liveSyncService)
 {
     _manifestRepository = manifestRepository;
     _liveSyncService    = liveSyncService;
 }
예제 #14
0
 public void Setup()
 {
     _manifestRepository = _serviceProvider.GetService <IManifestRepository>();
 }
예제 #15
0
 public UnitOfWork(AppDbContext context)
 {
     _context  = context;
     Manifests = new ManifestRepository(_context);
 }
예제 #16
0
 public ManifestController(IManifestRepository repo)
 {
     this.repo = repo;
 }
예제 #17
0
 public ManifestService(IManifestRepository manifestRepository)
 {
     _manifestRepository = manifestRepository;
 }
예제 #18
0
 public SaveManifestHandler(IMediator mediator, IManifestRepository repository)
 {
     _mediator   = mediator;
     _repository = repository;
 }
예제 #19
0
 public ServicesHub(OrderSubmitClient client, IConfiguration configuration, IManifestRepository repository)
 {
     _client        = client;
     _configuration = configuration;
     _repository    = repository;
 }