Exemplo n.º 1
0
        /// <summary>
        /// Dumps the node information of the workflow to Logger object.
        /// </summary>
        /// <param name="ix">IndexServer connection</param>
        /// <param name="CONST">IndexServer constants</param>
        /// <param name="ci">Client information (ticket)</param>
        /// <param name="flowId">Workflow ID</param>
        /// <param name="testUserId">ID of user which started the test.</param>
        /// <param name="wfUserIds">IDs of users which receive the workflow.</param>
        private void dumpWFNodes(IXConnection ix,
                                 IXServicePortC CONST,
                                 int flowId, int testUserId, String[] wfUserIds)
        {
            // add current user to userIds
            String[] userIds = new String[wfUserIds.Length + 1];
            userIds[0] = Convert.ToString(testUserId);
            for (int i = 0; i < wfUserIds.Length; i++)
            {
                userIds[i + 1] = wfUserIds[i];
            }

            // collect nodes
            WFCollectNode[] nodes = ix.Ix.collectWorkFlowNodes("" + flowId,
                                                               WFTypeC.ACTIVE, null, WFNodeC.TYPE_NOTHING, null,
                                                               null, null, userIds, false, false);

            // dump
            Logger.instance().log("Workflow Nodes, #nodes=" + nodes.Length);
            for (int i = 0; i < nodes.Length; i++)
            {
                Logger.instance().log("  " +
                                      (nodes[i].active ? "*" : " ") +
                                      "nodes[" + i + "]: id=" + nodes[i].nodeId +
                                      ", name=" + nodes[i].nodeName +
                                      ", userId=" + nodes[i].userId +
                                      ", inUseDate=" + nodes[i].inUseDateIso);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checkin workflow scripts.
        /// </summary>
        /// <param name="ix">IndexServer connection</param>
        /// <param name="CONST">IndexServer constants</param>
        /// <param name="ci">Client information (ticket)</param>
        /// <param name="scriptNames">Array of script names</param>
        private void internalCheckinScripts(IXConnection ix,
                                            IXServicePortC CONST,
                                            String[] scriptNames)
        {
            Logger.instance().log("internalCheckinScripts(");

            ConfigFile[] currentScripts = ix.Ix.checkoutConfigFiles(
                new String[] { myServerScriptDir + "/*" }, ConfigFileC.mbNoFileData, LockC.NO);

            Logger.instance().log("read script files...");
            ConfigFile[] ixScripts = new ConfigFile[scriptNames.Length];
            for (int i = 0; i < ixScripts.Length; i++)
            {
                ixScripts[i]      = new ConfigFile();
                ixScripts[i].name = scriptNames[i];
                ixScripts[i].dir  = myServerScriptDir;

                String     fileName = "..\\..\\" + ixScripts[i].name;
                FileStream fstrm    = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                ixScripts[i].fileData      = new FileData();
                ixScripts[i].fileData.data = new byte[(int)fstrm.Length];
                fstrm.Read(ixScripts[i].fileData.data, 0, (int)fstrm.Length);
                fstrm.Close();
            }
            Logger.instance().log("read script files OK");

            Logger.instance().log("checkin...");
            ix.Ix.checkinConfigFiles(ixScripts, LockC.NO);
            Logger.instance().log("checkin OK");

            currentScripts = ix.Ix.checkoutConfigFiles(
                new String[] { myServerScriptDir + "/*" }, ConfigFileC.mbNoFileData, LockC.NO);

            Logger.instance().log(")internalCheckinScripts");
        }
Exemplo n.º 3
0
        private void internalFindBooks(IXConnection ix,
                                       IXServicePortC CONST, String parentId,
                                       String author, String price)
        {
            Logger.instance().log("find author=" + author + ", price=" + price);

            // select names only
            SordZ mbName = new SordZ();

            mbName.bset = SordC.mbName;

            // find
            FindInfo findInfo = internalMakeFindInfo(parentId, author, price);

            Sord[] sords    = ix.Ix.findFirstSords(findInfo, 1000, mbName).sords;
            String nameList = "";

            for (int i = 0; i < sords.Length; i++)
            {
                if (i != 0)
                {
                    nameList += ",";
                }
                nameList += sords[i].name;
            }
            Logger.instance().log("find OK, sords=" + nameList);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Create users with given names if they do not already exist.
        /// </summary>
        /// <param name="ix">IndexServer connection</param>
        /// <param name="CONST">IndexServer constants</param>
        /// <param name="ci">Client information (ticket)</param>
        /// <param name="userNames">Names of users to create</param>
        /// <returns>User IDs as String array</returns>
        private String[] internalCreateSomeUsers(IXConnection ix,
                                                 IXServicePortC CONST, String[] userNames)
        {
            String[] uids = new String[userNames.Length];

            // Try to create users
            UserInfo[] users = new UserInfo[userNames.Length];
            try
            {
                for (int i = 0; i < userNames.Length; i++)
                {
                    users[i]      = ix.Ix.createUser("0");
                    users[i].name = userNames[i];
                    users[i].pwd  = "elo";
                }
                ix.Ix.checkinUsers(users, CheckinUsersC.WRITE_PASSWORD, LockC.NO);
            }
            catch (Exception e)
            {
                Logger.instance().log("exception=" + e);
                throw e;
            }

            // checkout users to get their IDs
            users = ix.Ix.checkoutUsers(userNames, CheckoutUsersC.BY_IDS, LockC.NO);
            for (int i = 0; i < users.Length; i++)
            {
                uids[i] = Convert.ToString(users[i].id);
                Logger.instance().log("uids[" + i + "]=" + uids[i]);
            }

            return(uids);
        }
Exemplo n.º 5
0
 private void dumpSordTypes(SordType[] sordTypes)
 {
     for (int i = 0; i < sordTypes.Length; i++)
     {
         Logger.instance().log("sordTypes[" + i + "], id=" + sordTypes[i].id + ", name=" + sordTypes[i].name);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// This function shows how to checkout a document using encryption functionality of
        /// It does not set the ix.Ix.cryptDocuments session option. It assigns "&crypt=true"
        /// to the URL to direct IndexServer to decrypt the document.
        /// Using this method does not require an extra call to DM. But the file size and file extension
        /// in the DocVersion object comes from the encrypted document (ETF-file) rather the
        /// original document.
        /// </summary>
        /// <param name="ix"></param>
        /// <param name="CONST"></param>
        /// <param name="ci"></param>
        /// <param name="objId"></param>
        private void checkoutDocDecryptedUsingUrlExt(IXConnection ix, IXServicePortC CONST, string objId)
        {
            // Tell IndexServer not to encrypt/decrypt.
            setSessionOptionEncrypt(ix, false);

            // Provide external password of encryption set.
            string encrPwd = ix.EncryptPassword(encryptionPassword);

            ix.Ix.provideCryptPassword("" + encryptionSet, encrPwd);

            EditInfo ed = ix.Ix.checkoutDoc(objId, null, EditInfoC.mbSordDoc, LockC.NO);

            Logger.instance().log("encrypted.ext=" + ed.document.docs[0].ext);
            Logger.instance().log("encrypted.size=" + ed.document.docs[0].size);
            String tempName2 = internalMakeTempFileName(".tmp");

            // append the special parameter to the URL
            String urlDecr = ed.document.docs[0].url + "&crypt=true";

            Logger.instance().log("prepared download URL=" + urlDecr);

            // -------------------------------------------------------------------------------
            // The URL to download the document should be a HTTPS URL in production environments!
            // IndexServer configuration option "ixUrlBase" might be helpful here.
            // -------------------------------------------------------------------------------

            ix.Download(urlDecr, tempName2);

            // Show document in notepad:
            System.Diagnostics.Process.Start("notepad.exe", tempName2);
            System.Threading.Thread.Sleep(3000);

            System.IO.File.Delete(tempName2);
        }
Exemplo n.º 7
0
        public void run()
        {
            lockKey = "mykey";

            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Get the current archive key
                int keyIdBeforeLock = ix.Ix.lockArchive(null);
                Logger.instance().log("key before lock=" + keyIdBeforeLock);

                // LOCK
                int keyIdBeforeLock2 = ix.Ix.lockArchive(lockKey);

                // Get the current archive key
                int keyIdAfterLock = ix.Ix.lockArchive(null);
                Logger.instance().log("key after lock=" + keyIdAfterLock);

                // UNLOCK
                int keyIdBeforeUnlock = ix.Ix.lockArchive("0");
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 8
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Create a root folder based on keywording form "Email".
                // Parent is the "imaginary" archive entry with object ID = 1.
                String   parentId = "1";
                String   maskId   = "email";
                EditInfo ed       = ix.Ix.createSord(parentId, maskId, EditInfoC.mbAll);
                ed.sord.name = "New Sord";

                ViewAndEditSordDlg dlg = new ViewAndEditSordDlg();
                dlg.init(ix, ed);
                dlg.ShowDialog(null);

                // CHECKIN
                int objId = ix.Ix.checkinSord(dlg.getSord(), SordC.mbAll, LockC.NO);
                Logger.instance().log("Created sord successfully, objId=" + objId);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 9
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);

                Logger.instance().log("Version=" + connFact.Version);
                Logger.instance().log("ImplVersion=" + ix.ImplVersion);
                Logger.instance().log("InterfaceVersion=" + ix.InterfaceVersion);
                Logger.instance().log("ClientVersion=" + ix.ClientVersion);

                LoginResult loginResult = ix.LoginResult;

                // If successfully logged on, you can find the ticket here:
                // loginResult.clientInfo.ticket.
                Logger.instance().log("login successfully, ticket=" + loginResult.clientInfo.ticket);
                Logger.instance().log("ticket lifetime seconds=" + loginResult.ticketLifetime);
                Logger.instance().log("user ID=" + loginResult.user.id);

                // Otherwise an exception was thrown in ix.Ix.login() and you will not
                // reach this lines.

                // Use in subsequent calls always the returned ClientInfo object (contains ticket).
                // ci = ix.Login.ci


                ix.Ix.checkoutWorkflowTemplate("6439", "", WFDiagramC.mbAll, LockC.NO);
                FindWorkflowInfo findInfo = new FindWorkflowInfo();
                findInfo.type = WFTypeC.TEMPLATE;
                FindResult findResult = ix.Ix.findFirstWorkflows(findInfo, 100, WFDiagramC.mbLean);
                Logger.instance().log("wfs=" + findResult.workflows);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    ix.Dispose();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 10
0
 private void dumpUserNames(String indent, IXServicePortC CONST, UserName[] uns)
 {
     for (int i = 0; i < uns.Length; i++)
     {
         String type = (uns[i].type == UserInfoC.TYPE_GROUP) ? "group" : "user";
         Logger.instance().log(indent + type + ": name=" + uns[i].name + ", id=" + uns[i].id);
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// This function shows how to checkin a document using encryption functionality of
        /// </summary>
        /// <param name="ix"></param>
        /// <param name="CONST"></param>
        /// <param name="ci"></param>
        /// <returns></returns>
        private string checkinDocEncrypted(IXConnection ix, IXServicePortC CONST)
        {
            // Tell IndexServer to encrypt/decrypt.
            setSessionOptionEncrypt(ix, true);

            // Provide external password of encryption set.
            // This password must be encrpyted for security reasons.
            // Administrators should not know it!
            string encrPwd = ix.EncryptPassword(encryptionPassword);

            ix.Ix.provideCryptPassword("" + encryptionSet, encrPwd);

            // Create document
            EditInfo ed = ix.Ix.createDoc("1", "0", null, EditInfoC.mbSordDoc);

            ed.sord.name = "C# example CheckinOutDocEncrypted";
            ed.sord.details.encryptionSet = encryptionSet;

            // Create file for document version
            String testFile = internalCreateTestFile("CheckinDocEncrypted example file", "txt");

            // Supply the extension of the document
            ed.document.docs                  = new DocVersion[1];
            ed.document.docs[0]               = new DocVersion();
            ed.document.docs[0].ext           = ix.GetFileExt(testFile);
            ed.document.docs[0].pathId        = ed.sord.path;
            ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;

            // CheckinDocBegin: let IndexServer generate an URL to upload the document
            // This URL addresses always the IndexServer and not the Document Manager.
            ed.document = ix.Ix.checkinDocBegin(ed.document);

            // -------------------------------------------------------------------------------
            // The URL to upload the document should be a HTTPS URL in production environments!
            // IndexServer configuration option "ixUrlBase" might be helpful here.
            // -------------------------------------------------------------------------------

            Logger.instance().log("prepared upload URL=" + ed.document.docs[0].url + ", doc-guid=" + ed.document.docs[0].guid);

            // Upload document version.
            // IndexServer encrypts the document.
            ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, testFile);
            Logger.instance().log("upload document version succeeded");

            // CheckinDocEnd: uploadResult contains the document information from ELODM.
            // Pass this information to
            ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);
            Logger.instance().log("inserted document:");
            Logger.instance().log("  objId=" + ed.document.objId);
            Logger.instance().log("  docId=" + ed.document.docs[0].id);
            Logger.instance().log("  doc-guid=" + ed.document.docs[0].guid);
            Logger.instance().log("  URL=" + ed.document.docs[0].url);

            System.IO.File.Delete(testFile);

            return(ed.document.objId);
        }
Exemplo n.º 12
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // Create a document
                EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc);
                ed.sord.name     = "document with sticky notes";
                ed.document      = new Document();
                ed.document.docs = new DocVersion[1] {
                    new DocVersion()
                };
                ed.document.docs[0].ext           = "tif";
                ed.document.docs[0].pathId        = ed.sord.path;
                ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF");
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);

                Note[] notes = new Note[3];

                // Create a normal sticky note
                notes[0]      = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_NORMAL, null);
                notes[0].desc = "This is a normal sticky note";

                // Create a personal note
                notes[1]      = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_PERSONAL, null);
                notes[1].desc = "This is a personal note";

                // Create a stamp note
                notes[2]      = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_STAMP, null);
                notes[2].desc = "This is a stamp note";

                int[] noteIds = ix.Ix.checkinNotes(null, notes, NoteC.mbAll, LockC.NO);
                Logger.instance().log("noteIds=" + noteIds);
            }
            finally
            {
                ix.Logout();
            }
        }
Exemplo n.º 13
0
		private Sord internalCreateEmail(IXConnection ix,  
			IXServicePortC CONST, String parentId, String name, String from, String to) 
		{
			Sord d1 = ix.Ix.createDoc(parentId, "Email", null, EditInfoC.mbSord).sord;
			d1.name = name;
			d1.objKeys[0].data = new String[] {from};
			d1.objKeys[1].data = new String[] {to};
			d1.id = ix.Ix.checkinSord(d1, SordC.mbAll, LockC.NO);
			Logger.instance().log("name=" + name + ", from=" + from + ", to=" + to);
			return d1;
		}
Exemplo n.º 14
0
        private void logTimeValues(String actionName, double dt, int n)
        {
            double ns100 = 1000L * 1000L * 10;

            dt /= ns100;
            double secondsPerAction = dt / (double)n;
            double actionsPerSecond = 1.0 / secondsPerAction;

            Logger.instance().log("action=" + actionName + ": dt=" + dt);
            Logger.instance().log("  secondsPerAction=" + secondsPerAction);
            Logger.instance().log("  actionsPerSecond=" + actionsPerSecond);
        }
Exemplo n.º 15
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login ...");
                ClientInfo ci = new ClientInfo();
                ci.timeZone = "GMT+01:00"; // "Europe/Berlin";
                ix          = connFact.CreateSso(ci, Environment.MachineName);
                LoginResult loginResult = ix.LoginResult;

                // If successfully logged on, you can find the ticket here:
                // loginResult.clientInfo.ticket.
                Logger.instance().log("login successfully, ticket=" + loginResult.clientInfo.ticket);
                Logger.instance().log("ticket lifetime seconds=" + loginResult.ticketLifetime);
                Logger.instance().log("user ID=" + loginResult.user.id);

                // Otherwise an exception was thrown in ix.Ix.login() and you will not
                // reach this lines.

                // Use in subsequent calls always the returned ClientInfo object (contains ticket).
                // ci = ix.Login.ci
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 16
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  conn     = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                conn     = connFact.Create(userName, userPwd, "myComputer", null);
                Logger.instance().log("login OK");

                Logger.instance().log("Check whether OCR is available...");
                bool avail = checkOcrAvail(conn);
                Logger.instance().log("OCR is available=" + avail);

                if (avail)
                {
                    String fileName = "..\\..\\sample.tif";

                    Logger.instance().log("Recognize file synchronously");
                    String text = recognizeFileSync(conn, fileName);
                    Logger.instance().log("text=" + text.Substring(0, 100) + "...");

                    // Recognize rectangle.
                    // Rectangle units are given in per thousand of document width resp. height.
                    Logger.instance().log("Recognize rect ");
                    int pmLeft = 50, pmTop = 100, pmRight = 200, pmBottom = 1000;
                    text = recognizeRect(conn, fileName, pmLeft, pmTop, pmRight, pmBottom);
                    Logger.instance().log("text=" + text.Substring(0, 100) + "...");

                    // Return character positions
                    Logger.instance().log("Recognize file return character positions");
                    recognizeFileCharPos(conn, fileName);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                if (conn != null)
                {
                    Logger.instance().log("IX logout...");
                    conn.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 17
0
        public Form1()
        {
            //
            // Erforderlich für die Windows Form-Designerunterstützung
            //
            InitializeComponent();

            //
            // TODO: Fügen Sie den Konstruktorcode nach dem Aufruf von InitializeComponent hinzu
            //

            Logger.instance().init(rtxLog);
        }
Exemplo n.º 18
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                FindInfo findInfo = new FindInfo();
                findInfo.findDirect                  = new FindDirect();
                findInfo.findDirect.query            = "buch sord.type:[254 TO 255]";
                findInfo.findDirect.searchInFulltext = true;
                findInfo.findDirect.searchInIndex    = true;
                findInfo.findDirect.searchInMemo     = true;
                findInfo.findDirect.searchInSordName = true;

                FindResult findResult = ix.Ix.findFirstSords(findInfo, 100, SordC.mbAll);
                for (int i = 0; i < findResult.sords.Length; i++)
                {
                    Logger.instance().log(findResult.sords[i].name + "," + findResult.sords[i].type);
                }

                ix.Ix.findClose(findResult.searchId);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 19
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  conn     = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                conn     = connFact.Create(userName, userPwd, "myComputer", null);
                Logger.instance().log("login OK");

                Logger.instance().log("Check whether OCR is available...");
                bool avail = checkOcrAvail(conn);
                Logger.instance().log("OCR is available=" + avail);

                if (avail)
                {
                    Logger.instance().log("Query languages:");
                    OcrInfo ocrInfo = new OcrInfo();
                    ocrInfo.queryLanguages = new OcrInfoQueryLanguages();

                    // Extenal language names should be returned in this language
                    ocrInfo.messagesLanguage = OcrInfoC.MESSAGES_LANGUAGE_GERMAN;

                    OcrResult ocrResult = conn.Ix.processOcr(ocrInfo);
                    for (int i = 0; i < ocrResult.queryLanguages.externalLangs.Length; i++)
                    {
                        Logger.instance().log("external=" + ocrResult.queryLanguages.externalLangs[i]);
                        Logger.instance().log("internal=" + ocrResult.queryLanguages.internalLangs[i]);
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                if (conn != null)
                {
                    Logger.instance().log("IX logout...");
                    conn.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 20
0
 private void dumpKeyword(Keyword kw, String indent)
 {
     Logger.instance().log(indent + "kw.id=" + kw.id);
     Logger.instance().log(indent + " text=" + kw.text);
     Logger.instance().log(indent + " add=" + kw.add);
     Logger.instance().log(indent + " enabled=" + kw.enabled);
     Logger.instance().log(indent + " raw=" + kw.raw);
     Logger.instance().log(indent + " hasChildren=" + (kw.children != null) + ", #children=" + ((kw.children != null) ? kw.children.Length : 0));
     if (kw.children != null)
     {
         for (int i = 0; i < kw.children.Length; i++)
         {
             dumpKeyword(kw.children[i], indent + "  ");
         }
     }
 }
Exemplo n.º 21
0
        private Sord internalCreateBook(IXConnection ix,
                                        IXServicePortC CONST, String parentId, String name, String author, String price)
        {
            Sord d1 = ix.Ix.createDoc(parentId, "0", null, EditInfoC.mbSord).sord;

            d1.name            = name;
            d1.objKeys         = new ObjKey[2];
            d1.objKeys[0]      = new ObjKey();
            d1.objKeys[0].id   = 0;
            d1.objKeys[0].name = "AUTHOR";
            d1.objKeys[0].data = new String[] { author };
            d1.objKeys[1]      = new ObjKey();
            d1.objKeys[1].id   = 1;
            d1.objKeys[1].name = "PRICE";
            d1.objKeys[1].data = new String[] { price };
            d1.id = ix.Ix.checkinSord(d1, SordC.mbAll, LockC.NO);
            Logger.instance().log("name=" + name + ", author=" + author);
            return(d1);
        }
Exemplo n.º 22
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                SelectKeywordDlg dlg = new SelectKeywordDlg(ix);
                dlg.ShowDialog();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 23
0
		private void internalFindEmailsFromTo(IXConnection ix, 
			IXServicePortC CONST, String parentId, String from, String to)
		{
			Logger.instance().log("find from=" + from + ", to=" + to + "...");

			// select names only
			SordZ mbName = new SordZ();
			mbName.bset = SordC.mbName;

			// find
			FindInfo findInfo = internalMakeFindInfo(parentId, from, to);
			Sord[] sords = ix.Ix.findFirstSords(findInfo, 1000, mbName).sords;
			String nameList = "";
			for (int i = 0; i < sords.Length; i++) 
			{
				if (i != 0) nameList += ",";
				nameList += sords[i].name;
			}
			Logger.instance().log("find OK, sords=" + nameList);
		}
Exemplo n.º 24
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  conn     = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                conn     = connFact.Create(userName, userPwd, "myComputer", null);
                Logger.instance().log("login OK");

                Logger.instance().log("Check whether OCR is available...");
                bool avail = checkOcrAvail(conn);
                Logger.instance().log("OCR is available=" + avail);

                if (avail)
                {
                    String fileName = "..\\..\\sample.tif";

                    Logger.instance().log("Recognize file asynchronously");
                    String text = recognizeFileAsync(conn, fileName, 30);
                    Logger.instance().log("text=" + text.Substring(0, 100) + "...");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                if (conn != null)
                {
                    Logger.instance().log("IX logout...");
                    conn.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 25
0
        private void internalDumpLinks(IXConnection ix, IXServicePortC CONST,
                                       String guid)
        {
            // Checkout sord to get the new links
            Sord sord = ix.Ix.checkoutSord(guid, EditInfoC.mbSord, LockC.NO).sord;

            Logger.instance().log("links of " + sord.name + " {");
            for (int i = 0; i < sord.linksGoOut.Length; i++)
            {
                Sord linkToSord = ix.Ix.checkoutSord(sord.linksGoOut[i].id,
                                                     EditInfoC.mbSordLean, LockC.NO).sord;

                Logger.instance().log("    ->" + linkToSord.name);                 // + ", guid=" + sord.linksGoOut[i].id + ", linkId=" + sord.linksGoOut[i].linkId);
            }
            for (int i = 0; i < sord.linksComeIn.Length; i++)
            {
                Sord linkFromSord = ix.Ix.checkoutSord(sord.linksComeIn[i].id,
                                                       EditInfoC.mbSordLean, LockC.NO).sord;

                Logger.instance().log("    <-" + linkFromSord.name);                 // + ", guid=" + sord.linksComeIn[i].id + ", linkId=" + sord.linksComeIn[i].linkId);
            }
            Logger.instance().log("}");
        }
Exemplo n.º 26
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix1      = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login connections...");
                ix1 = connFact.Create(userName, userPwd, "myComputer-conn1", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                EventBusWatchFolderEventsDlg dlg = new EventBusWatchFolderEventsDlg(ix1);
                dlg.ShowDialog();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix1 != null)
                {
                    Logger.instance().log("IX logout...");
                    ix1.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// This function calls cookKeyword to evaluate the resulting keyword text with substituted
        /// placeholders and concatinated upper nodes.
        /// </summary>
        /// <param name="ix"></param>
        /// <param name="ci"></param>
        /// <param name="kw"></param>
        /// <returns></returns>
        private String selectKeyword(IXConnection ix, Keyword kw)
        {
            String keywordText = "";

            // cookKeyword throws an exception, if the keyword is not enabled
            if (kw.enabled)
            {
                // cookKeyword need only be called for raw keywords
                if (kw.raw)
                {
                    keywordText = ix.Ix.cookKeyword(kw.id);
                }
                else
                {
                    keywordText = kw.text;
                }
                Logger.instance().log("cooked keyword: id=" + kw.id + ", raw-text=" + kw.text + ", cooked-text=" + keywordText);
            }
            else
            {
                Logger.instance().log("cannot select disabled keyword: id=" + kw.id);
            }
            return(keywordText);
        }
Exemplo n.º 28
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // lock key data
                // This is optional since checkinKeys and
                // deleteKeys check the lock too.
                Logger.instance().log("lock key data...");
                ix.Ix.checkoutKeys(null, LockC.YES);
                Logger.instance().log("lock key data OK");

                // create key
                // - be aware to set KeyInfo.id = -1 to create a new key!
                Logger.instance().log("create key...");
                KeyInfo ki = new KeyInfo();
                ki.id   = -1;
                ki.name = "C# Example Key";
                ki.id   = ix.Ix.checkinKeys(new KeyInfo[] { ki }, LockC.NO)[0];
                Logger.instance().log("create key OK, name=" + ki.name + ", id=" + ki.id);

                // delete key and unlock
                Logger.instance().log("delete key...");
                ix.Ix.deleteKeys(new String[] { ki.name }, LockC.YES);
                Logger.instance().log("delete key OK");
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 29
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Example for initializing an encryption set with a new internal password.
                // If you uncomment this lines, aready encrypted documents of this encryption set
                // cannot be decrypted anymore since the internal key is lost!
                // Logger.instance().log("init encryption set ...");
                //initializeNewEncryptionSet(ix, CONST, 13, "CS-TEST", encryptionPassword);
                // Logger.instance().log("init encryption set OK");

                // checkin example document and encrypt it
                string objId = checkinDocEncrypted(ix, CONST);

                // checkout example document
                checkoutDocDecryptedUsingSessionOption(ix, CONST, objId);

                // checkout example document
                checkoutDocDecryptedUsingUrlExt(ix, CONST, objId);

                bool cleanUp = true;
                if (cleanUp)
                {
                    // Delete Document
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, objId, LockC.NO, null);
                    ix.Ix.deleteSord(null, objId, LockC.NO, delOpts);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemplo n.º 30
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // Create a document
                EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc);
                ed.sord.name     = "document with annotations";
                ed.document      = new Document();
                ed.document.docs = new DocVersion[1] {
                    new DocVersion()
                };
                ed.document.docs[0].ext           = "tif";
                ed.document.docs[0].pathId        = ed.sord.path;
                ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF");
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);

                List <Note> notes = new List <Note>();

                // -------------------------------------------------------
                // Do not use the member Note.desc for annotations because
                // it contains position and formatting information.
                // -------------------------------------------------------

                // Text on a opaque rectangle
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_NOTE_WITHFONT, null);
                    note.noteText.text = "This is an annotation with font=" + note.noteText.fontInfo.faceName;

                    note.color = NetColorToEloColor(System.Drawing.Color.RosyBrown);
                    note.noteText.fontInfo.height *= 2;
                    note.noteText.fontInfo.bold    = true;
                    note.noteText.fontInfo.italic  = true;
                    note.noteText.fontInfo.RGB     = NetColorToEloColor(System.Drawing.Color.SkyBlue);

                    note.XPos   = 100;
                    note.YPos   = 200;
                    note.width  = 1000;
                    note.height = 500;

                    notes.Add(note);
                }

                // Horizontal line
                if (true)
                {
                    Note      note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_HORIZONTAL_LINE, null);
                    PointInfo p1   = new PointInfo();
                    p1.x = 100;
                    p1.y = 750;
                    PointInfo p2 = new PointInfo();
                    p2.x = p1.x + 900;
                    p2.y = p1.y;
                    note.noteFreehand.points = new PointInfo[] { p1, p2 };

                    note.noteFreehand.width = 20; // Pen width

                    note.color = NetColorToEloColor(System.Drawing.Color.Violet);

                    notes.Add(note);
                }

                // Freehand line (this example draws a circle)
                if (true)
                {
                    Note             note   = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_FREEHAND, null);
                    List <PointInfo> points = new List <PointInfo>();
                    for (int i = 0; i < 360; i += 5)
                    {
                        double    alpha = 2 * Math.PI * (double)i / 360.0;
                        PointInfo p     = new PointInfo();
                        p.x = 200 + (int)(Math.Sin(alpha) * 100);
                        p.y = 900 + (int)(Math.Cos(alpha) * 100);
                        points.Add(p);
                    }
                    note.noteFreehand.points = points.ToArray();

                    note.noteFreehand.width = 50; // Pen width

                    note.color = NetColorToEloColor(System.Drawing.Color.Tomato);

                    notes.Add(note);
                }

                // Draws a half-transparent rectangle
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_MARKER, null);
                    note.XPos   = 400;
                    note.YPos   = 800;
                    note.width  = 300;
                    note.height = 200;
                    note.color  = NetColorToEloColor(System.Drawing.Color.YellowGreen);

                    notes.Add(note);
                }

                // Draws a filled (opaque) rectangle
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_FILLEDRECTANGLE, null);
                    note.XPos   = 800;
                    note.YPos   = 800;
                    note.width  = 300;
                    note.height = 200;
                    note.color  = NetColorToEloColor(System.Drawing.Color.YellowGreen);

                    notes.Add(note);
                }

                // Draws a strikeout line
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_STRIKEOUT, null);

                    PointInfo p1 = new PointInfo();
                    p1.x = 100;
                    p1.y = 1100;
                    PointInfo p2 = new PointInfo();
                    p2.x = p1.x + 900;
                    p2.y = p1.y;
                    note.noteFreehand.points = new PointInfo[] { p1, p2 };

                    note.noteFreehand.width          = 100;
                    note.noteFreehand.strikeoutWidth = 20;
                    note.noteFreehand.strikeoutColor = NetColorToEloColor(System.Drawing.Color.Red);

                    note.color = NetColorToEloColor(System.Drawing.Color.Yellow);

                    notes.Add(note);
                }


                int[] noteIds = ix.Ix.checkinNotes(null, notes.ToArray(), NoteC.mbAll, LockC.NO);
                Logger.instance().log("noteIds=" + noteIds);
            }
            finally
            {
                ix.Logout();
            }
        }