Esempio n. 1
0
        public void t11_TargetDocumentId()
        {
            // Create xml document
            XmlDocument data = createDataPool().RootNode.InnerXmlNode.OwnerDocument;

            // We use a dedicated SIEE_Adapter for this test.  We must first register it in the FactoryManager.
            SIEEFactory factory = new Test_SIEEFactory();

            SIEEFactoryManager.Add(factory);

            // We use a default SIEE_Adapter_Settings object and set the Schema
            EECWriterSettings adapterSettings = createWriterSettings(new SIEEFieldlist());

            SIEEWriterExport adapterExport = new SIEEWriterExport();

            adapterExport.Configure(adapterSettings);

            Test_SIEEExport.ExportFunc = (settings, doc, name, fieldlist) =>
            {
                doc.TargetDocumentId = "4711";
            };

            DataPool pool = new DataPool(adapterExport.transform(data, null));

            Assert.AreEqual("4711", pool.RootNode.Documents[0].Annotations["TargetDocumentId"].Value);
            Assert.AreEqual("SIEE_Adapter", pool.RootNode.Documents[0].Annotations["TargetType"].Value);
        }
Esempio n. 2
0
        private void Main_Load(object sender, EventArgs e)
        {
            string basePath = AppDomain.CurrentDomain.BaseDirectory;

            if (!Directory.Exists(basePath))
            {
                return;
            }

            string targetTraceFile = Path.Combine(TraceManager.RootPath, "CaptureCenter.traceconfig");

            TraceConfigurator.ConfigureAndWatch(new FileInfo(targetTraceFile));

#if ProcessSuite
            SIEEFactoryManager.Add(new ProcessSuiteFactory());
#endif
#if CMIS
            SIEEFactoryManager.Add(new CMISFactory());
#endif
#if SQL
            SIEEFactoryManager.Add(new SqlEEFactory());
#endif
#if EDOCS
            SIEEFactoryManager.Add(new eDocsFactory());
#endif
#if HELLO_WORLD
            SIEEFactoryManager.Add(new HelloWorldFactory());
#endif
#if SPO
            SIEEFactoryManager.Add(new SPOFactory());
#endif
#if AX
            SIEEFactoryManager.Add(new AXFactory());
#endif
#if xECM
            SIEEFactoryManager.Add(new xECMFactory());
#endif
            foreach (string ext in SIEEFactoryManager.GetKeysFromTypeName())
            {
                string name = ext.Split('.').Last();
                cbox_extensionSelector.Items.Add(name);
                factoryNameMap[name] = ext;
            }
            cbox_extensionSelector.Text = Properties.Settings.Default.CurrentExtension;

            if (Properties.Settings.Default.MainSize.Width != 0)
            {
                Size = Properties.Settings.Default.MainSize;
            }

            if (Properties.Settings.Default.MaintRichTextFont != null)
            {
                richTextBox_settings.Font = Properties.Settings.Default.MaintRichTextFont;
            }

            richTextBox_settings.ForeColor = Properties.Settings.Default.MainRichTextColor;

            setDefaults();
        }
 protected void Initialize(SIEEFactory f)
 {
     factory = f;
     SIEEFactoryManager.Add(factory);
     settings = new EECWriterSettings();
     settings.SetFactory(factory);
     description = f.CreateDescription();
 }
Esempio n. 4
0
        public void t09_SIEEAnnotation()
        {
            // Create a data pool
            DataPool pool = createDataPool();

            pool.RootNode.Documents[0].Fields["field1"].Value = "field1value";

            // Create an xml document from the data pool
            XmlDocument data;

            data = pool.RootNode.InnerXmlNode.OwnerDocument;

            // We use a dedicated SIEE_Adapter for this test.  We must first register it in the FactoryManager.
            SIEEFactory factory = new Test_SIEEFactory();

            SIEEFactoryManager.Add(factory);

            // We use a default SIEE_Adapter_Settings object and set the Schema
            EECWriterSettings adapterSettings = createWriterSettings(new SIEEFieldlist()
            {
                { new SIEEField()
                  {
                      Name = "field1", ExternalId = ""
                  } },
                { new SIEEField()
                  {
                      Name = "field2", ExternalId = ""
                  } },
            });

            SIEEWriterExport adapterExport = new SIEEWriterExport();

            adapterExport.Configure(adapterSettings);

            Test_SIEEExport.ExportFunc = (settings, doc, name, fieldlist) =>
            {
                int val = 0;
                if (doc.SIEEAnnotation != null)
                {
                    val = int.Parse(doc.SIEEAnnotation);
                }
                if (val <= 3)
                {
                    doc.NewSIEEAnnotation = (val + 1).ToString();
                }
                throw new Exception("Some exception");
            };
            int count = 1;

            pool = new DataPool(adapterExport.transform(data, null));
            t09_testAnnotation(pool, count++);
            pool = new DataPool(adapterExport.transform(pool.RootNode.InnerXmlNode.OwnerDocument, null));
            t09_testAnnotation(pool, count++);
            pool = new DataPool(adapterExport.transform(pool.RootNode.InnerXmlNode.OwnerDocument, null));
            t09_testAnnotation(pool, count);
            pool = new DataPool(adapterExport.transform(pool.RootNode.InnerXmlNode.OwnerDocument, null));
            t09_testAnnotation(pool, count);
        }
Esempio n. 5
0
        private void cbox_extensionSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            string ext = cbox_extensionSelector.SelectedItem.ToString();

            loadExportExtention(SIEEFactoryManager.GetFromSettingsTypename(factoryNameMap[ext]));
        }
Esempio n. 6
0
 public SIEEBaseTest()
 {
     SIEEMessageBox.Suppress = true;
     // Initialize Factory manager with test export extension
     SIEEFactoryManager.Add(new Test_SIEEFactory());
 }
        public override XmlDocument transform(XmlDocument data, IParameters parameters)
        {
            // The SIEEBatch is created from the schema as defined in the setting object. It contains all
            // fields regardless of whether they have been mapped to OCC fields.
            SIEEFieldlist schema = (SIEEFieldlist)SIEESerializer.StringToObject(writerSettings.SerializedSchema);

            // This class has no initialization by which the factory could be set beforehand. We therefore
            // load the factory from the SIEE_FactoryManager. (This was the only reason to invent the
            // SIEE_FactoryManager in the first place.

            SIEEFactory factory = SIEEFactoryManager.GetFromSettingsTypename(writerSettings.SettingsTypename);

            writerSettings.SetFactory(factory);

            // Create the SIEE objects wee need
            SIEEExport      myExport    = factory.CreateExport();
            SIEEDescription description = factory.CreateDescription();

            DataPool  pool          = new DataPool(data);
            SIEEBatch batch         = new SIEEBatch();
            int       maxRetryCount = description.NumberOfRetries;
            string    batchId       = pool.RootNode.Fields["cc_BatchId"].Value;
            string    profile       = pool.RootNode.Fields["cc_ProfileName"].Value;

            SIEEExport.Trace.WriteInfo("Start exporting batch " + batchId);

            ExportStateParams exportStateParams = null;
            Dictionary <SIEEDocument, Document> siee2dataPool    = new Dictionary <SIEEDocument, Document>();
            Dictionary <SIEEDocument, int>      annotationNumber = new Dictionary <SIEEDocument, int>();

            for (int i = 0; i < pool.RootNode.Documents.Count; i++)
            {
                Document     document     = pool.RootNode.Documents[i];
                SIEEDocument sieeDocument = documentToFieldlist(new SIEEFieldlist(schema), document, batchId, profile);
                sieeDocument.DocumentId    = String.Format("{0:D4}", i);
                sieeDocument.DocumentClass = document.Name;

                sieeDocument.SIEEAnnotation = sieeDocument.NewSIEEAnnotation = null;
                int anNo = findAnnotation(document);
                annotationNumber[sieeDocument] = anNo;
                if (anNo != 0)
                {
                    sieeDocument.SIEEAnnotation = document.Annotations[annotationName(anNo - 1)].Value;
                }

                exportStateParams = DataPoolWorkflowStateExtensions.GetExportStateParams(document);
                // Process only documents with state "ToBeProcessed" (not yet exported documents or documents whose export failed).
                if (exportStateParams.state == ExportState.ToBeProcessed)
                {
                    siee2dataPool[sieeDocument] = document;
                    batch.Add(sieeDocument);
                }
            }

            try
            {
                SIEESettings settings = writerSettings.GetEmbeddedSettings();
                myExport.ExportBatch(settings, batch);
            }
            catch (Exception e)
            {
                SIEEExport.Trace.WriteError("SIEEWriterExport: Batch " + batchId + " failed", e);
                throw;
            }

            foreach (SIEEDocument doc in batch)
            {
                Document occDocument = siee2dataPool[doc];
                int      anNo        = annotationNumber[doc];
                if (doc.NewSIEEAnnotation != null)
                {
                    occDocument.Annotations.Add(new Annotation(pool, annotationName(anNo), doc.NewSIEEAnnotation));
                }

                exportStateParams = DataPoolWorkflowStateExtensions.GetExportStateParams(occDocument);

                if (doc.Succeeded)
                {
                    occDocument.Annotations.Add(new Annotation(pool, "TargetDocumentId", doc.TargetDocumentId));
                    occDocument.Annotations.Add(new Annotation(pool, "TargetType", description.TypeName));
                    exportStateParams.state = ExportState.Succeeded;
                }
                else
                {
                    exportStateParams.message = "Export failed: " + doc.ErrorMsg;
                    if (doc.NonRecoverableError)
                    {
                        throw new Exception("Fatal export error: " + doc.ErrorMsg);
                    }
                }

                // Set delay time for start of retry
                if (exportStateParams.repetitionCount == 0)
                {
                    exportStateParams.delaySeconds = description.StartTimeForRetry;
                }

                DataPoolWorkflowStateExtensions.HandleExportStateParams(occDocument, maxRetryCount, exportStateParams);
            }
            SIEEExport.Trace.WriteInfo("Done exporting batch " + batchId);
            return(data);
        }