/// <summary>From data container to baseline distributing saved requests list.</summary> /// <param name="baselineDistributingSavedRequestsContainer">The baseline distributing saved /// requests container.</param> /// <param name="requestContextFactory">The request context factory.</param> /// <returns>List of requests created from data container data.</returns> internal static List<Core.Data.IRequestContext> fromDataContainerToBaselineDistributingSavedRequestsList(DataContainer baselineDistributingSavedRequestsContainer, RequestMgt.IRequestContextFactory requestContextFactory) { List<Core.Data.IRequestContext> baselineDistributingSavedRequestsList = new List<Core.Data.IRequestContext>(); baselineDistributingSavedRequestsContainer.restart(); while (baselineDistributingSavedRequestsContainer.read()) { string elementId = string.Empty; Guid requestId = Guid.Empty; Core.Data.FileTransferMode transferMode = PIS.Ground.Core.Data.FileTransferMode.AnyBandwidth; bool fileCompression = false, isIncremental = false; DateTime transferDate = DateTime.MinValue; DateTime transferExpirationDate = DateTime.MaxValue; sbyte priority = 0; string baselineVersion = string.Empty; DateTime baselineActivationDate = DateTime.MinValue; DateTime baselineExpirationDate = DateTime.MaxValue; for (int i = 0; i < baselineDistributingSavedRequestsContainer.fieldCount(); i++) { switch (baselineDistributingSavedRequestsContainer.getName(i)) { case "ElementID": elementId = baselineDistributingSavedRequestsContainer.getValue(i); break; case "RequestID": requestId = new Guid(baselineDistributingSavedRequestsContainer.getValue(i)); break; case "TransferMode": transferMode = (Core.Data.FileTransferMode)Enum.Parse(typeof(Core.Data.FileTransferMode), baselineDistributingSavedRequestsContainer.getValue(i)); break; case "FileCompression": fileCompression = bool.Parse(baselineDistributingSavedRequestsContainer.getValue(i)); break; case "TransferDate": DateTime.TryParse(baselineDistributingSavedRequestsContainer.getValue(i), out transferDate); break; case "TransferExpirationDate": DateTime.TryParse(baselineDistributingSavedRequestsContainer.getValue(i), out transferExpirationDate); break; case "Priority": priority = sbyte.Parse(baselineDistributingSavedRequestsContainer.getValue(i)); break; case "Incremental": isIncremental = bool.Parse(baselineDistributingSavedRequestsContainer.getValue(i)); break; case "BaselineVersion": baselineVersion = baselineDistributingSavedRequestsContainer.getValue(i); break; case "BaselineActivationDate": DateTime.TryParse(baselineDistributingSavedRequestsContainer.getValue(i), out baselineActivationDate); break; case "BaselineExpirationDate": DateTime.TryParse(baselineDistributingSavedRequestsContainer.getValue(i), out baselineExpirationDate); break; default: break; } } baselineDistributingSavedRequestsList.Add( requestContextFactory.CreateBaselineDistributingRequestContext( elementId, requestId, transferMode, fileCompression, isIncremental, transferDate, transferExpirationDate, priority, baselineVersion, baselineActivationDate, baselineExpirationDate ) ); } return baselineDistributingSavedRequestsList; }
/// <summary>Creates baseline distributing request context.</summary> /// <param name="elementId">Identifier for the element.</param> /// <param name="requestId">Identifier for the request.</param> /// <param name="transferMode">The transfer mode.</param> /// <param name="fileCompression">True if file compression is used.</param> /// <param name="isIncremental">True if this request is incremental.</param> /// <param name="transferDate">Date of the transfer.</param> /// <param name="transferExpirationDate">Date of the transfer expiration.</param> /// <param name="priority">The priority.</param> /// <param name="baselineVersion">The baseline version.</param> /// <param name="baselineActivationDate">Date of the baseline activation.</param> /// <param name="baselineExpirationDate">Date of the baseline expiration.</param> /// <returns>The new baseline distributing request context.</returns> public IRequestContext CreateBaselineDistributingRequestContext(string elementId, Guid requestId, Core.Data.FileTransferMode transferMode, bool fileCompression, bool isIncremental, DateTime transferDate, DateTime transferExpirationDate, sbyte priority, string baselineVersion, DateTime baselineActivationDate, DateTime baselineExpirationDate) { BaselineDistributionAttributes distributionAttributes = new BaselineDistributionAttributes(); distributionAttributes.fileCompression = fileCompression; distributionAttributes.priority = priority; distributionAttributes.transferDate = transferDate; distributionAttributes.transferExpirationDate = transferExpirationDate; distributionAttributes.TransferMode = transferMode; BaselineDistributingRequestContext requestContext = new BaselineDistributingRequestContext(null, elementId, requestId, Guid.Empty, distributionAttributes, isIncremental, baselineVersion, baselineActivationDate, baselineExpirationDate); IRequestContextProcessor requestProcessor = new BaselineDistributingRequestContextProcessor(_remoteDataStoreFactory, _t2gManager, _baselineStatusUpdater); requestContext.RequestProcessor = requestProcessor; return(requestContext); }