コード例 #1
0
        /// <summary>
        /// Processes the message for production.
        /// </summary>
        /// <param name="productionDocuments">The production documents.</param>
        private void ProcessMessageForProduction(List <ProductionDocumentDetail> productionDocuments)
        {
            var documentConversionLogBeos = new List <DocumentConversionLogBeo>();

            if (productionDocuments == null || !productionDocuments.Any())
            {
                return;
            }
            var productionDocument = productionDocuments.FirstOrDefault();

            if (productionDocument != null && !String.IsNullOrEmpty(productionDocument.MatterId))
            {
                _matterId = Convert.ToInt64(productionDocument.MatterId);
            }
            var errorDocuments = new List <ProductionDocumentDetail>();

            foreach (var productionDocumentDetail in productionDocuments)
            {
                byte  conversionStatus = EVRedactItErrorCodes.Submitted;
                short reasonId         = EVRedactItErrorCodes.Na;
                try
                {
                    ProductionProfile profileBusinessEntity = productionDocumentDetail.Profile;
                    TiffImageColor    tiffImageColor;
                    string            hostId          = ServerConnectivity.GetHostIPAddress();
                    string            redactitPushUrl = CmgServiceConfigBO.GetServiceConfigurationsforConfig
                                                            (hostId, External.DataAccess.Constants.SystemConfigurationService, "QueueServerUrl");

                    string redactitTimeout = GetConfigurationValue("RedactItTimeout", NearNativeViewer);
                    string fileTypeKeyword = "pdf";
                    string thumbNailFormat = string.Empty;
                    string tiffBpp         = string.Empty;
                    string tiffMonochrome  = string.Empty;
                    string oneFilePerPage  = string.Empty;

                    //Append the push url
                    var uri = new StringBuilder(productionDocumentDetail.QueryString);

                    //Apply the 6.outputtype
                    if (profileBusinessEntity != null)
                    {
                        switch (profileBusinessEntity.ImageType)
                        {
                        case ImageType.Jpg:
                            fileTypeKeyword = Constants.PdfKeyword;
                            thumbNailFormat = Constants.JpgKeyword;
                            break;

                        case ImageType.Png:
                            fileTypeKeyword = Constants.PdfKeyword;
                            thumbNailFormat = Constants.PngKeyword;
                            break;

                        case ImageType.Tiff:
                            fileTypeKeyword = Constants.TiffKeyword;
                            tiffImageColor  = profileBusinessEntity.TiffImageColor;
                            if (tiffImageColor == TiffImageColor.One)     //monochrome
                            {
                                tiffMonochrome = Constants.TrueString;
                            }
                            else
                            {
                                tiffBpp = ((int)tiffImageColor).ToString();
                            }
                            if (profileBusinessEntity.IsOneImagePerPage)
                            {
                                oneFilePerPage = Constants.TrueString;
                            }
                            break;

                        default:
                            fileTypeKeyword = Constants.PdfKeyword;
                            if (profileBusinessEntity.IsOneImagePerPage)
                            {
                                oneFilePerPage = Constants.TrueString;
                            }
                            break;
                        }
                    }
                    uri.Append(Constants.QueryStringOutputFormatPrefix);
                    uri.Append(fileTypeKeyword);

                    uri.Append("&StepTimeout=");
                    uri.Append(redactitTimeout);

                    //Apply the 7.Redact It Job priority
                    uri.Append(PriorityQueryStringName);
                    //uri.Append(_nearNativeConversionPriority.ToString());
                    uri.Append(_conversionPriority);

                    //Apply the 8.thumbnails elements if reqd
                    if (!String.IsNullOrEmpty(thumbNailFormat))
                    {
                        uri.Append(Constants.QueryStringThumbFormatPrefix);
                        uri.Append(thumbNailFormat);
                        uri.Append(Constants.QueryStringThumbPagesPrefix);
                        uri.Append(Constants.ThumbPagesAll);
                        // a-All f-firstpageonly 1-Pagenumber
                        uri.Append(Constants.QueryStringThumbNamePrefix);
                        uri.Append((productionDocumentDetail.XdlThumbFileName == string.Empty
                                        ? Constants.ThumbDefaultPageName
                                        : productionDocumentDetail.XdlThumbFileName));
                        //this is mandatory if jpeg or png needed.
                        uri.Append(Constants.QueryStringThumbQualityPrefix);
                        uri.Append(Constants.ThumbQuality);      //1-100
                        uri.Append(Constants.QueryStringThumbSizesPrefix);
                        uri.Append(Constants.ThumbDefaultSizes); //1000,1000
                    }

                    //Apply 9. tiff colour if applicable
                    if (!String.IsNullOrEmpty(tiffBpp))
                    {
                        uri.Append(Constants.QueryStringTiffBppPrefix);
                        uri.Append(tiffBpp);
                        uri.Append(Constants.QueryStringTifDPI);
                    }

                    //Apply 10. tiff monochrome if applicable
                    if (!String.IsNullOrEmpty(tiffMonochrome))
                    {
                        uri.Append(Constants.QueryStringTiffMonochromePrefix);
                        uri.Append(tiffMonochrome);
                        uri.Append(Constants.QueryStringTifDPI);
                    }

                    //Apply 11. Check if one file per page is needed
                    if (!String.IsNullOrEmpty(oneFilePerPage))
                    {
                        uri.Append(Constants.QueryStringOneFilePerPagePrefix);
                        uri.Append(oneFilePerPage);
                    }

                    uri.Append(Constants.PublishBlankPagesQueryString);
                    uri.Append(CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.PublishBlankPages));

                    uri.Append(Constants.QueryStringScrubbedText);
                    uri.Append(productionDocumentDetail.GetText.ToString());


                    //TODO: Log the data

                    var    request   = WebRequest.Create(redactitPushUrl);
                    byte[] byteArray = Encoding.UTF8.GetBytes(uri.ToString());
                    request.Method        = "POST";
                    request.ContentType   = "application/x-www-form-urlencoded";
                    request.ContentLength = byteArray.Length;
                    using (var dataStream = request.GetRequestStream())
                    {
                        dataStream.Write(byteArray, 0, byteArray.Length);
                        using (var response = request.GetResponse())
                        {
                            string status = ((HttpWebResponse)response).StatusDescription.ToUpper().Trim();

                            if (!status.Equals(Constants.OkKeyword))
                            {
                                Tracer.Warning(
                                    " DCN = {0}, DocumentId = {1}, CollectionId = {2} and HeartBeatFile {3}\r\n",
                                    productionDocumentDetail.DCNNumber,
                                    productionDocumentDetail.DocumentId,
                                    productionDocumentDetail.DatasetCollectionId,
                                    productionDocumentDetail.HeartBeatFile);
                            }
                        }
                    }
                    productionDocumentDetail.ConversionEnqueueTime = DateTime.UtcNow;
                }
                catch (Exception ex)
                {
                    ex.AddUsrMsg("Production Imaging Worker: Unable to produce the document DCN: {0}",
                                 productionDocumentDetail.DCNNumber);
                    ex.Trace().Swallow();
                    conversionStatus = EVRedactItErrorCodes.Failed;
                    reasonId         = EVRedactItErrorCodes.FailedToSendFile;
                    productionDocument.ErrorMessage = string.Format("Document with DCN:{0} is {1}-{2}", productionDocumentDetail.DCNNumber, Constants.ProductionPreFailure, ex.Message);
                    errorDocuments.Add(productionDocument);
                }
                documentConversionLogBeos.Add(ConvertToDocumentConversionLogBeo(productionDocumentDetail,
                                                                                conversionStatus,
                                                                                reasonId));
            }
            ProductionLogHelper.SendProductionLogs(LogPipe, errorDocuments, PipelineId, WorkerId, Constants.ProductionImagingWokerRoleId);
            BulkUpdateProcessSetStatus(documentConversionLogBeos);
        }
コード例 #2
0
        /// <summary>
        /// Converts to profile data objects.
        /// </summary>
        /// <returns></returns>
        private static ProductionProfile ConvertToProfileDataObjects(ProductionDetailsBEO m_BootParameters)
        {
            var profile = new ProductionProfile
            {
                DatasetId                 = m_BootParameters.Profile.DatasetId,
                DpnPrefix                 = m_BootParameters.Profile.DpnPrefix,
                DpnStartingNumber         = m_BootParameters.Profile.DpnStartingNumber,
                HeaderFooterFontSelection = new ProductionSetHeaderFooterFont
                {
                    HeaderFooterColor    = m_BootParameters.Profile.HeaderFooterFontSelection != null ? m_BootParameters.Profile.HeaderFooterFontSelection.HeaderFooterColor : null,
                    HeaderFooterFont     = m_BootParameters.Profile.HeaderFooterFontSelection != null ? m_BootParameters.Profile.HeaderFooterFontSelection.HeaderFooterFont : null,
                    HeaderFooterFontSize = m_BootParameters.Profile.HeaderFooterFontSelection != null ? m_BootParameters.Profile.HeaderFooterFontSelection.HeaderFooterFontSize : null,
                    HeaderFooterHeight   = m_BootParameters.Profile.HeaderFooterFontSelection != null ? m_BootParameters.Profile.HeaderFooterFontSelection.HeaderFooterHeight : 0,
                    HeaderFooterStyle    = m_BootParameters.Profile.HeaderFooterFontSelection != null ? (FontStyles)m_BootParameters.Profile.HeaderFooterFontSelection.HeaderFooterStyle : FontStyles.Normal
                },
                ImageType                   = (ImageType)m_BootParameters.Profile.ImageType,
                IsBurnMarkups               = m_BootParameters.Profile.IsBurnMarkups,
                IsIncludeArrowsMarkup       = m_BootParameters.Profile.IsIncludeArrowsMarkup,
                IsIncludeBoxesMarkup        = m_BootParameters.Profile.IsIncludeBoxesMarkup,
                IsIncludeHighlightsMarkup   = m_BootParameters.Profile.IsIncludeHighlightsMarkup,
                IsIncludeLinesMarkup        = m_BootParameters.Profile.IsIncludeLinesMarkup,
                IsIncludeReasonsWithMarkup  = m_BootParameters.Profile.IsIncludeReasonsWithMarkup,
                IsIncludeRedactionsMarkup   = m_BootParameters.Profile.IsIncludeRedactionsMarkup,
                IsIncludeRubberStampMarkup  = m_BootParameters.Profile.IsIncludeRubberStampMarkup,
                IsIncludeTextBoxMarkup      = m_BootParameters.Profile.IsIncludeTextBoxMarkup,
                IsInsertPlaceHolderPage     = m_BootParameters.Profile.IsInsertPlaceHolderPage,
                IsOneImagePerPage           = m_BootParameters.Profile.IsOneImagePerPage,
                IsPrintDCNInPlaceHolderPage = m_BootParameters.Profile.IsPrintDCNInPlaceHolderPage,
                IsPrintDPNInPlaceHolderPage = m_BootParameters.Profile.IsPrintDPNInPlaceHolderPage,
                LeftFooter                  = new ProductionSetHeaderFooter
                {
                    DatasetFieldSelected    = m_BootParameters.Profile.LeftFooter.DatasetFieldSelected,
                    IsIncrementNeededInText = m_BootParameters.Profile.LeftFooter.IsIncrementNeededInText,
                    Option             = (HeaderFooterOptions)m_BootParameters.Profile.LeftFooter.Option,
                    TextPrefix         = m_BootParameters.Profile.LeftFooter.TextPrefix,
                    TextStartingNumber = m_BootParameters.Profile.LeftFooter.TextStartingNumber
                },
                LeftHeader = new ProductionSetHeaderFooter
                {
                    DatasetFieldSelected    = m_BootParameters.Profile.LeftHeader.DatasetFieldSelected,
                    IsIncrementNeededInText = m_BootParameters.Profile.LeftHeader.IsIncrementNeededInText,
                    Option             = (HeaderFooterOptions)m_BootParameters.Profile.LeftHeader.Option,
                    TextPrefix         = m_BootParameters.Profile.LeftHeader.TextPrefix,
                    TextStartingNumber = m_BootParameters.Profile.LeftHeader.TextStartingNumber
                },
                MiddleFooter = new ProductionSetHeaderFooter
                {
                    DatasetFieldSelected    = m_BootParameters.Profile.MiddleFooter.DatasetFieldSelected,
                    IsIncrementNeededInText = m_BootParameters.Profile.MiddleFooter.IsIncrementNeededInText,
                    Option             = (HeaderFooterOptions)m_BootParameters.Profile.MiddleFooter.Option,
                    TextPrefix         = m_BootParameters.Profile.MiddleFooter.TextPrefix,
                    TextStartingNumber = m_BootParameters.Profile.MiddleFooter.TextStartingNumber
                },
                MiddleHeader = new ProductionSetHeaderFooter
                {
                    DatasetFieldSelected    = m_BootParameters.Profile.MiddleHeader.DatasetFieldSelected,
                    IsIncrementNeededInText = m_BootParameters.Profile.MiddleHeader.IsIncrementNeededInText,
                    Option             = (HeaderFooterOptions)m_BootParameters.Profile.MiddleHeader.Option,
                    TextPrefix         = m_BootParameters.Profile.MiddleHeader.TextPrefix,
                    TextStartingNumber = m_BootParameters.Profile.MiddleHeader.TextStartingNumber
                },
                PrintDCNInPlaceHolderPrefferedText = m_BootParameters.Profile.PrintDCNInPlaceHolderPrefferedText,
                ProductionPrefix           = m_BootParameters.Profile.ProductionPrefix,
                ProductionSetNumberingType = (ProductionNumbering)m_BootParameters.Profile.ProductionSetNumberingType,
                ProductionStartingNumber   = m_BootParameters.Profile.ProductionStartingNumber,
                ProfileId   = m_BootParameters.Profile.ProfileId,
                ProfileName = m_BootParameters.Profile.ProfileName,
                RightFooter = new ProductionSetHeaderFooter
                {
                    DatasetFieldSelected    = m_BootParameters.Profile.RightFooter.DatasetFieldSelected,
                    IsIncrementNeededInText = m_BootParameters.Profile.RightFooter.IsIncrementNeededInText,
                    Option             = (HeaderFooterOptions)m_BootParameters.Profile.RightFooter.Option,
                    TextPrefix         = m_BootParameters.Profile.RightFooter.TextPrefix,
                    TextStartingNumber = m_BootParameters.Profile.RightFooter.TextStartingNumber
                },
                RightHeader = new ProductionSetHeaderFooter
                {
                    DatasetFieldSelected    = m_BootParameters.Profile.RightHeader.DatasetFieldSelected,
                    IsIncrementNeededInText = m_BootParameters.Profile.RightHeader.IsIncrementNeededInText,
                    Option             = (HeaderFooterOptions)m_BootParameters.Profile.RightHeader.Option,
                    TextPrefix         = m_BootParameters.Profile.RightHeader.TextPrefix,
                    TextStartingNumber = m_BootParameters.Profile.RightHeader.TextStartingNumber
                },
                TiffImageColor = (TiffImageColor)m_BootParameters.Profile.TiffImageColor
            };

            return(profile);
        }