protected override bool CanStart()
{
IList<Model.WorkQueue> relatedItems = FindRelatedWorkQueueItems(WorkQueueItem,
new[]
{
WorkQueueTypeEnum.StudyProcess,
WorkQueueTypeEnum.ReconcileStudy,
WorkQueueTypeEnum.WebEditStudy,
WorkQueueTypeEnum.ReprocessStudy,
WorkQueueTypeEnum.ReconcilePostProcess,
WorkQueueTypeEnum.ReconcileCleanup,
WorkQueueTypeEnum.ProcessDuplicate
}, null);
TimeSpan delay;
if (relatedItems == null || relatedItems.Count == 0)
{
// Don't compress lossy if the study needs to be reconciled.
// It's time wasting if we go ahead with the compression because later on
// users will have to restore the study in order to reconcile the images in SIQ.
if (CompressTransferSyntax.LossyCompressed && StorageLocation.IsReconcileRequired)
{
Platform.Log(LogLevel.Info,
"Study {0} cannot be compressed to lossy at this time because of pending reconciliation. Reinserting into FilesystemQueue",
StorageLocation.StudyInstanceUid);
delay = TimeSpan.FromMinutes(60);
ReinsertFilesystemQueue(delay);
PostProcessing(WorkQueueItem, WorkQueueProcessorStatus.Complete, WorkQueueProcessorDatabaseUpdate.ResetQueueState);
return false;
}
return true;
}
Platform.Log(LogLevel.Info,
"Compression entry for study {0} has existing WorkQueue entry, reinserting into FilesystemQueue",
StorageLocation.StudyInstanceUid);
delay = TimeSpan.FromMinutes(60);
ReinsertFilesystemQueue(delay);
PostProcessing(WorkQueueItem, WorkQueueProcessorStatus.Complete, WorkQueueProcessorDatabaseUpdate.ResetQueueState);
return false;
}