コード例 #1
0
        ///       <summary>
        ///       The method creates a map of file name and a list of the pages that it contains
        ///       and saves it in the global constants.
        ///       </summary>
        public void createFilePageMap()
        {
            Dictionary <string, List <string> > filePageMap = new Dictionary <string, List <string> >();

            if (CurrentDCO.ObjectType() == Constants.Batch)
            {
                for (int i = 0; i < CurrentDCO.NumOfChildren(); i++)
                {
                    TDCOLib.IDCO childDCO = CurrentDCO.GetChild(i);
                    if (childDCO.ObjectType() == Constants.Page)
                    {
                        SmartNav.SetRRCurrentDCO(childDCO);
                        string        imageName = SmartNav.MetaWord(Constants.SMARTP_AT + "P.ScanSrcPath");
                        List <string> pages     = null;
                        if (filePageMap.ContainsKey(imageName))
                        {
                            pages = filePageMap[imageName];
                        }
                        else
                        {
                            pages = new List <string>();
                        }
                        pages.Add(childDCO.ID);
                        filePageMap[imageName] = pages;
                        ExportCore.WriteInfoLog(" file page map   " + imageName + " : " + childDCO.ID + "; size : " + pages.Count);
                    }
                }
                Globals.Instance.SetData(Constants.FILE_PAGE_MAP, filePageMap);
                SmartNav.SetRRCurrentDCO(CurrentDCO);
            }
            else
            {
                throw new SmartExportException("Unable to create File-Page map, since the associated level is not  Batch.");
            }
        }
コード例 #2
0
        ///       <summary>
        ///       The method returns the value corresponding to the DCO expression specified, from the current DCO.
        ///       <param name="DCOTree">DCO Expression in the format [DCO].[document_type].[page_type].[field_name]</param>
        ///       <returns>The value corresponding to the DCO expression specified, from the current DCO.</returns>
        ///       </summary>
        public virtual string getDCOValue(string DCOTree)
        {
            Stopwatch sw = Stopwatch.StartNew();

            string output = "";

            TDCOLib.IDCO currentIterationDCO = null;
            int          objectType          = CurrentDCO.ObjectType();

            //If the call is from ForEach, this will be having a currentIterationDCO object.
            if (!Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO).Equals(Constants.EMPTYSTRING))
            {
                currentIterationDCO = (TDCOLib.IDCO)Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO);
                objectType          = currentIterationDCO.ObjectType();
            }

            switch (objectType)
            {
            case Constants.Batch:
                string message = "Unable to find DCO reference at batch level due to ambiguity.";
                ExportCore.WriteLog(message);
                throw new SmartExportException(message);

            case Constants.Document:
                output = currentIterationDCO == null?getDCOValueForDocument(DCOTree) :
                             getDCOValueForDocument(currentIterationDCO, DCOTree);

                break;

            case Constants.Page:
                output = currentIterationDCO == null?getDCOValueForPage(DCOTree) :
                             getDCOValueForPage(DCOTree, currentIterationDCO.ID);

                break;

            case Constants.Field:
                output = currentIterationDCO == null?getDCOValueForField(DCOTree) :
                             getDCOValueForField(currentIterationDCO, DCOTree);

                break;
            }
            ExportCore.WriteDebugLog(" getDCOValue(" + DCOTree + ") completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();

            return(output);
        }
コード例 #3
0
        ///       <summary>
        ///       The method extracts the data present in the table.
        ///       <param name="tableNode">XML node that contains the specification of table
        ///       from which the data is to be extracted.</param>
        ///       </summary>
        public void FetchTable(XmlNode tableNode)
        {
            Stopwatch sw = Stopwatch.StartNew();

            setContext();

            if (DCO.ObjectType() == Constants.Field)
            {
                initializeTableObjectForField(tableNode);
            }
            else if (DCO.ObjectType() == Constants.Page)
            {
                initializeTableObjectForPage(tableNode);
            }
            else if (DCO.ObjectType() == Constants.Document)
            {
                initializeTableObjectForDocument(tableNode);
            }
            else if (DCO.ObjectType() == Constants.Batch && !projectHasDoc)
            {
                initializeTableObjectForBatch(tableNode);
            }
            else
            {
                throw new SmartExportException("Unable to fetch table.");
            }

            // iterate over rows
            //print rows
            if (tableDCOs.Count > 0)
            {
                foreach (IDCO table in tableDCOs)
                {
                    setTableLimits(tableNode, table);
                    processTableRows(table, tableNode);
                }
            }
            else
            {
                ExportCore.WriteDebugLog("Table not found");
            }

            ExportCore.WriteDebugLog(" FetchTable(" + tableNode + ") completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();
        }
コード例 #4
0
        ///       <summary>
        ///       Returns the document type.
        ///       <returns>The document type</returns>
        ///       </summary>
        public string getDocumentType()
        {
            Stopwatch sw = Stopwatch.StartNew();

            string docType = "";

            TDCOLib.IDCO currentIterationDCO = null;
            int          objectType          = CurrentDCO.ObjectType();

            //If the call is from ForEach, this will be having a currentIterationDCO object.
            if (!Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO).Equals(Constants.EMPTYSTRING))
            {
                currentIterationDCO = (TDCOLib.IDCO)Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO);
                objectType          = currentIterationDCO.ObjectType();
                //anything getter related to currentIterationDCO object must be added here or after null check ,
                //if not there is a risk of null pointer exception.
                ExportCore.WriteDebugLog(" Current iterating DCO: " + currentIterationDCO.Type);
            }

            if (Constants.Document == objectType)
            {
                docType = currentIterationDCO == null ? CurrentDCO.Type : currentIterationDCO.Type;
            }
            else if (Constants.Page == objectType)
            {
                docType = currentIterationDCO == null?CurrentDCO.Parent().Type : currentIterationDCO.Parent().Type;
            }
            else if (Constants.Field == objectType)
            {
                docType = currentIterationDCO == null?CurrentDCO.Parent().Parent().Type : currentIterationDCO.Parent().Parent().Type;
            }
            else
            {
                string message = "  Document Type can be determined at document/ page / field level only. " + CurrentDCO.ID
                                 + " is of type " + CurrentDCO.Type + ".";
                if (currentIterationDCO != null)
                {
                    message = "  Document Type can be determined at document/ page / field level only. " + currentIterationDCO.ID
                              + " is of type " + currentIterationDCO.Type + ".";
                }

                ExportCore.WriteErrorLog(message);
                throw new SmartExportException(message);
            }
            ExportCore.WriteDebugLog(" getDocumentType() completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();

            return(docType);
        }
コード例 #5
0
        ///       <summary>
        ///       Returns the page type.
        ///       <returns>The page type.</returns>
        ///       </summary>
        public string getPageType()
        {
            Stopwatch sw = Stopwatch.StartNew();

            ExportCore.WriteDebugLog("Inside getPageType().");

            string pageType = "";

            TDCOLib.IDCO currentIterationDCO = null;
            int          objectType          = CurrentDCO.ObjectType();

            //If the call is from ForEach, this will be having a currentIterationDCO object.
            if (!Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO).Equals(Constants.EMPTYSTRING))
            {
                currentIterationDCO = (TDCOLib.IDCO)Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO);
                objectType          = currentIterationDCO.ObjectType();
            }

            if (Constants.Page == objectType)
            {
                pageType = currentIterationDCO == null ? CurrentDCO.Type : currentIterationDCO.Type;
                ExportCore.WriteDebugLog("pageType is " + pageType);
            }
            else if (Constants.Field == objectType)
            {
                pageType = currentIterationDCO == null?CurrentDCO.Parent().Type : currentIterationDCO.Parent().Type;
            }
            else
            {
                string message = "  Page Type can be determined at   page / field level only. " + CurrentDCO.ID
                                 + " is of type " + CurrentDCO.Type + ".";
                if (currentIterationDCO != null)
                {
                    message = "  Page Type can be determined at   page / field level only. " + currentIterationDCO.ID
                              + " is of type " + currentIterationDCO.Type + ".";
                }
                ExportCore.WriteLog(message);
                throw new SmartExportException(message);
            }
            ExportCore.WriteDebugLog(" getPageType() completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();

            return(pageType);
        }
コード例 #6
0
        ///       <summary>
        ///       Returns the table type.
        ///       <returns>The table type</returns>
        ///       </summary>
        public string getTableType()
        {
            Stopwatch sw = Stopwatch.StartNew();

            string tableType = "";

            TDCOLib.IDCO DCO = CurrentDCO;
            if (!Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO).Equals(Constants.EMPTYSTRING))
            {
                DCO = (TDCOLib.IDCO)Globals.Instance.GetData(Constants.forLoopString.CURRENTITERATIONDCO);
            }
            int objectType = DCO.ObjectType();

            if (Constants.Field == objectType)
            {
                if (isObjectTable(DCO))
                {
                    tableType = DCO.Type;
                }
                else
                {
                    string message = CurrentDCO.ID + " is not a table. It is of type " + CurrentDCO.Type + ".";
                    ExportCore.WriteLog(message);
                }
            }
            else
            {
                string message = "  Table Type can be determined at   field level only. " + CurrentDCO.ID
                                 + " is of type " + CurrentDCO.Type + ".";

                ExportCore.WriteLog(message);
                throw new SmartExportException(message);
            }
            ExportCore.WriteDebugLog(" getTableType() completed in " + sw.ElapsedMilliseconds + " ms.");
            sw.Stop();

            return(tableType);
        }