public static void StartAppManager(KonfigurationIx ixConf) { try { IXConnFactory connFact = new IXConnFactory(ixConf.ixUrl, "Start AppManager", "1.0"); IXConnection ixConn = connFact.Create(ixConf.user, ixConf.pwd, null, null); string ticket = ixConn.LoginResult.clientInfo.ticket; string ixUrl = ixConn.EndpointUrl; string appManagerUrl = ixUrl.Replace("ix-", "wf-"); appManagerUrl = appManagerUrl.Replace("/ix", "/apps/app"); appManagerUrl = appManagerUrl + "/elo.webapps.AppManager"; appManagerUrl = appManagerUrl + "/?lang=de"; appManagerUrl = appManagerUrl + "&ticket=" + ticket; appManagerUrl = appManagerUrl + "&timezone=Europe%2FBerlin"; Http.OpenUrl(appManagerUrl); } catch (byps.BException e) { if (e.Source != null) { MessageBox.Show("Falsche Verbindungsdaten zu ELO \n" + e.Message, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk); Debug.WriteLine("byps.BException message: {0}", e.Message); } } catch (System.Net.WebException e) { if (e.Source != null) { MessageBox.Show("Indexserver-Verbindung ungültig \n User: "******"\n IxUrl: " + ixConf.ixUrl, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk); Debug.WriteLine("System.Net.WebException message: {0}", e.Message); } } }
public void init(IXConnection ix, EditInfo ed) { this.ix = ix; this.ed = ed; this.CONST = ix.CONST; for (int i = 0; i < ed.sordTypes.Length; i++) { bool hasValidIcon = false; if (ed.sordTypes[i].icon != null) { try { System.IO.Stream strm = new System.IO.MemoryStream(ed.sordTypes[i].icon.data); System.Drawing.Image img = Image.FromStream(strm); imageListSordTypes.Images.Add(img); hasValidIcon = true; } catch (Exception) { } } if (!hasValidIcon) { System.Drawing.Image img = Image.FromFile("..\\..\\App.ico"); imageListSordTypes.Images.Add(img); } cbSordType.Items.Add(ed.sordTypes[i].name); } }
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); }
static void Main(string[] args) { string[] files; DataAccess da = new DataAccess(); IXConnFactory connFact = new IXConnFactory("http://SERVER-SQL:8080/ix-Projekte_und_Fibu/ix", "", "1.0"); conn = connFact.Create("Faermann", "Faermann", "EDV-Faermann-8", null); string[] directs = getDirectory(da); string parentId = setParentId(da); foreach (string direct in directs) { if (!isItemExist(nameItem(direct), parentId, false)) { createFolder(nameItem(direct), parentId); } files = Directory.GetFiles(direct); foreach (string file in files) { if (!isItemExist(nameItem(file), parentId, true)) { createDocument(file, String.Format("{0}/{1}", parentId, nameItem(direct))); } } } }
// Helper function to find the subentries of an object private String internalFindSordIdsInParent(IXConnection ix, String parentId) { IXServicePortC CONST = ix.CONST; FindInfo findInfo = new FindInfo(); findInfo.findChildren = new EloixClient.IndexServer.FindChildren(); findInfo.findChildren.parentId = parentId; FindResult findResult = ix.Ix.findFirstSords(findInfo, 100, SordC.mbOnlyId); if (findResult.ids == null) { return(""); } if (findResult.searchId != null) { ix.Ix.findClose(findResult.searchId); } String strList = ""; for (int i = 0; i < findResult.ids.Length; i++) { if (i != 0) { strList += ","; } strList += findResult.ids[i]; } return(strList); }
public static SortedDictionary <string, bool> GetActionDefs(IXConnection ixConn, List <string> jsTexts, string package) { String parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/" + package + "/Action definitions"; if (package.Equals("")) { parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/_global/Action definitions"; } List <Sord> sordActionDefInfo = RepoUtils.FindChildren(parentId, ixConn, true); SortedDictionary <string, bool> dicActionDefs = new SortedDictionary <string, bool>(); foreach (Sord s in sordActionDefInfo) { string actionDef = s.name; string[] rf = actionDef.Split('.'); actionDef = rf[rf.Length - 1]; actionDef = "actions." + actionDef; if (!dicActionDefs.ContainsKey(actionDef)) { bool match = Unittests.Match(ixConn, actionDef, package, jsTexts); dicActionDefs.Add(actionDef, match); } } ; return(dicActionDefs); }
public static void StartExportElo(string profilename, KonfigurationIx ixConf) { try { IXConnFactory connFact = new IXConnFactory(ixConf.ixUrl, "StartExportElo", "1.0"); IXConnection conn = connFact.Create(ixConf.user, ixConf.pwd, null, null); string winPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ExportElo\\" + profilename; if (!Directory.Exists(winPath)) { Directory.CreateDirectory(winPath); } FindChildren(conn, ixConf.arcPath, winPath, ixConf.exportReferences, ixConf.maskName); Debug.WriteLine("ticket=" + conn.LoginResult.clientInfo.ticket); conn.Logout(); } catch (byps.BException e) { if (e.Source != null) { MessageBox.Show("Falsche Verbindungsdaten zu ELO \n" + e.Message, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk); Debug.WriteLine("byps.BException message: {0}", e.Message); } } catch (System.Net.WebException e) { if (e.Source != null) { MessageBox.Show("Indexserver-Verbindung ungültig \n User: "******"\n IxUrl: " + ixConf.ixUrl, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk); Debug.WriteLine("System.Net.WebException message: {0}", e.Message); } } }
private void incrSordCounter(IXConnection conn, int objId) { SordZ sordZ = new SordZ(SordC.mbObjKeys); Sord sord = null; try { sord = readSord(conn, objId, sordZ); foreach (ObjKey okey in sord.objKeys) { if (okey.name == "COUNTER") { int current = Convert.ToInt32(okey.data[0]); okey.data = new String[] { Convert.ToString(current + 1) }; break; } } } catch (Exception e) { Console.WriteLine("Cannot increment Sord counter, sord.id=" + objId + ", error=" + e); } finally { if (sord != null) { writeSord(conn, sord, sordZ); } } }
/// <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); }
/// <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"); }
static void Main(string[] args) { // Defaultwerte string arcPath = "ARCPATH[1]:/Administration/Business Solutions"; string winPath = "E:/Temp/sol"; string ixUrl = "http://srvpdevbs01vm:8010/ix-invoice/ix"; string user = "******"; string pwd = "elo"; string exportref = "false"; string maskname = "ELOScripts"; var cmdLineOptions = new ExportSol.CommandLineOptions(); if (CommandLine.Parser.Default.ParseArguments(args, cmdLineOptions)) { Debug.WriteLine("arcpath: {0}", cmdLineOptions.arcpath); Debug.WriteLine("winpath: {0}", cmdLineOptions.winpath); Debug.WriteLine("ixurl: {0}", cmdLineOptions.ixurl); Debug.WriteLine("user: {0}", cmdLineOptions.user); Debug.WriteLine("pwd: {0}", cmdLineOptions.pwd); Debug.WriteLine("exportref: {0}", cmdLineOptions.exportref); Debug.WriteLine("maskname: {0}", cmdLineOptions.maskname); arcPath = cmdLineOptions.arcpath; winPath = cmdLineOptions.winpath; ixUrl = cmdLineOptions.ixurl; user = cmdLineOptions.user; pwd = cmdLineOptions.pwd; exportref = cmdLineOptions.exportref; maskname = cmdLineOptions.maskname; } else { Debug.WriteLine("cmdLineOptions not avaible"); } try { IXConnFactory connFact = new IXConnFactory(ixUrl, "ExportSol", "1.0"); IXConnection conn = connFact.Create(user, pwd, null, null); bool exportreferences = exportref.Equals("true") ? true : false; FindChildren(conn, arcPath, winPath, exportreferences, maskname); Console.WriteLine("ticket=" + conn.LoginResult.clientInfo.ticket); conn.Logout(); } catch (byps.BException e) { if (e.Source != null) { Console.WriteLine("byps.BException message: {0}", e.Message); Debug.WriteLine("byps.BException message: {0}", e.Message); } } catch (System.Net.WebException e) { if (e.Source != null) { Console.WriteLine("System.Net.WebException message: {0}", e.Message); Debug.WriteLine("System.Net.WebException message: {0}", e.Message); } } }
/// <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); }
/// <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); } }
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"); } } }
public static void StartAdminConsole(KonfigurationIx ixConf) { try { IXConnFactory connFact = new IXConnFactory(ixConf.ixUrl, "Start AdminConsole", "1.0"); IXConnection ixConn = connFact.Create(ixConf.user, ixConf.pwd, null, null); string ticket = ixConn.LoginResult.clientInfo.ticket; string ixUrl = ixConn.EndpointUrl; string[] adminConsole = ixUrl.Split('/'); string adminConsoleUrl = adminConsole[0] + "//" + adminConsole[2] + "/AdminConsole"; adminConsoleUrl = adminConsoleUrl + "/?lang=de"; adminConsoleUrl = adminConsoleUrl + "&ticket=" + ticket; adminConsoleUrl = adminConsoleUrl + "&timezone=Europe%2FBerlin"; Http.OpenUrl(adminConsoleUrl); } catch (byps.BException e) { if (e.Source != null) { MessageBox.Show("Falsche Verbindungsdaten zu ELO \n" + e.Message, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk); Debug.WriteLine("byps.BException message: {0}", e.Message); } } catch (System.Net.WebException e) { if (e.Source != null) { MessageBox.Show("Indexserver-Verbindung ungültig \n User: "******"\n IxUrl: " + ixConf.ixUrl, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk); Debug.WriteLine("System.Net.WebException message: {0}", e.Message); } } }
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"); } } }
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"); } } }
/// <summary> /// Constructor. /// </summary> /// <param name="config">ELOFS configuration</param> /// <param name="arcName">Archive name</param> /// <param name="innerConn">IXConnection object</param> public FSConnection(FSConfig config, string arcName, IXConnection innerConn) : base(innerConn) { this.configVal = config; this.arcNameVal = arcName; base.contentInterfaceVal = new Content.FSContentInterface(); base.contentInterfaceVal.Init(this, arcName, innerConn.ConnProperties); }
public static List <Sord> FindChildren(String objId, IXConnection ixConn, bool references) { Console.WriteLine("FindChildren: objId " + objId, " ixConn " + ixConn); try { ixConn.Ix.checkoutSord(objId, SordC.mbAll, LockC.NO); } catch (Exception) { return(new List <Sord>()); } List <Sord> children = new List <Sord>(); FindInfo findInfo = new FindInfo(); FindChildren findChildren = new FindChildren(); FindByType findByType = new FindByType(); FindByIndex findByIndex = new FindByIndex(); Boolean includeReferences = references; SordZ sordZ = SordC.mbAll; Boolean recursive = true; int level = 3; ObjKey[] objKeys = new ObjKey[] { }; findChildren.parentId = objId; findChildren.mainParent = !includeReferences; findChildren.endLevel = (recursive) ? level : 1; findInfo.findChildren = findChildren; findInfo.findByIndex = findByIndex; FindResult findResult = new FindResult(); try { int idx = 0; findResult = ixConn.Ix.findFirstSords(findInfo, 1000, sordZ); while (true) { for (int i = 0; i < findResult.sords.Length; i++) { children.Add(findResult.sords[i]); } if (!findResult.moreResults) { break; } idx += findResult.sords.Length; findResult = ixConn.Ix.findNextSords(findResult.searchId, idx, 1000, sordZ); } } finally { if (findResult != null) { ixConn.Ix.findClose(findResult.searchId); } } return(children); }
/// <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); }
/// <summary> /// Creates a Sord object. /// </summary> /// <param name="ix">IndexServer connection</param> /// <param name="CONST">IndexServer constants</param> /// <param name="ci">Client information (ticket)</param> /// <returns>Sord GUID</returns> private String internalCreateDocument(IXConnection ix, IXServicePortC CONST) { Sord sord = ix.Ix.createSord("1", null, EditInfoC.mbSord).sord; sord.name = "C# Workflow example " + DateTime.Now; int objId = ix.Ix.checkinSord(sord, SordC.mbAll, LockC.NO); return(Convert.ToString(objId)); }
public static SortedDictionary <string, bool> GetRules(IXConnection ixConn, List <string> jsTexts, string package) { String parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/" + package + "/ELOas Base/Direct"; if (package.Equals("")) { parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/ELOas Base/Direct"; } List <Sord> sordRuleInfo = RepoUtils.FindChildren(parentId, ixConn, true); SortedDictionary <string, bool> dicRules = new SortedDictionary <string, bool>(); foreach (Sord s in sordRuleInfo) { string objId = s.id + ""; EditInfo editInfo = ixConn.Ix.checkoutDoc(objId, null, EditInfoC.mbSordDoc, LockC.NO); if (editInfo.document.docs.Length > 0) { DocVersion dv = editInfo.document.docs[0]; string url = dv.url; Stream inputStream = ixConn.Download(url, 0, -1); string xmlText = new StreamReader(inputStream, Encoding.UTF8).ReadToEnd(); try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlText); string rulesetname = ""; foreach (XmlNode nameNode in doc.SelectNodes("ruleset/base/name")) { foreach (XmlNode subNode in nameNode.ChildNodes) { switch (subNode.Name) { case "#text": rulesetname = subNode.InnerText; break; } } } if (!dicRules.ContainsKey(rulesetname)) { bool match = Unittests.Match(ixConn, rulesetname, package, jsTexts); dicRules.Add(rulesetname, match); } } catch (XmlException e) { Debug.WriteLine("Exception: {0}", e.Message); } } } ; return(dicRules); }
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(); } }
/// <summary> /// Constructor. Normally, the constructor is called from FWConnFactory. /// </summary> /// <param name="innerConn">Inner connection</param> public FWConnection(IXConnection innerConn) { internalConnection = innerConn; contentInterfaceVal = new Content.FWContentInterface(); sessionInterfaceVal = new Session.FWSessionInterface(this, internalConnection.ConnProperties); workflowInterfaceVal = new Workflow.FWWorkflowInterface(this, internalConnection.ConnProperties); masterDataInterfaceVal = new MasterData.FWMasterDataInterface(this, internalConnection.ConnProperties); arcSord = internalConnection.Ix.checkoutSord("1", EditInfoC.mbSordLean, LockC.NO).sord; contentInterfaceVal.Init(this, arcSord.name, internalConnection.ConnProperties); }
/// <summary> /// Delets the example 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 internalDeleteScripts(IXConnection ix, IXServicePortC CONST, String[] scriptNames) { String[] scriptPaths = new String[scriptNames.Length]; for (int i = 0; i < scriptNames.Length; i++) { scriptPaths[i] = myServerScriptDir + "\\" + scriptNames[i]; } ix.Ix.deleteConfigFiles(scriptPaths, LockC.NO); }
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; }
private String recognizeFileAsync(IXConnection conn, String fileName, int timeoutSeconds) { // Open an event bus private to the session ticket and add a listener. // OCR results are send over this bus. EventBusApi.Bus eventBus = conn.EventBusApi.OpenEventBusChannel(conn.LoginResult.clientInfo.ticket); eventBus.AddListener(EventBusC.EVENT_OCR_RESULT); // Add a handler function for events. conn.EventBusApi.EventBusHandler += new EventBusApi.ProcessEventBusEvents(EventBusApi_EventBusHandler); OcrInfo ocrInfo = new OcrInfo(); ocrInfo.recognizeFile = new OcrInfoRecognizeFile(); ocrInfo.recognizeFile.imageData = new FileData(); ocrInfo.recognizeFile.imageData.data = File.ReadAllBytes(fileName); ocrInfo.recognizeFile.imageData.contentType = ".TIF"; ocrInfo.recognizeFile.recognizeLangs = new String[] { "English" }; ocrInfo.recognizeFile.timeoutSeconds = timeoutSeconds; ocrInfo.recognizeFile.outputFormat = OcrInfoC.TEXT; ocrInfo.recognizeFile.pageNo = -1; // All pages // Set this properties for asynchronous processing: // Event bus that receives the result ocrInfo.busId = eventBus.Id; // ID for the request, unique for all open OCR requests on ocrInfo.busId ocrInfo.eventId = 123; // Process OCR conn.Ix.processOcr(ocrInfo); // Wait for result lock (syncObject) { long t1 = DateTime.Now.Ticks / 10000; int dt = timeoutSeconds * 1000; while (result == null) { Monitor.Wait(syncObject, dt); long t2 = DateTime.Now.Ticks / 10000; dt -= (int)(t2 - t1); if (dt <= 0) { throw new Exception("Timeout"); } t1 = t2; } } String text = result.recognizeFile.text; return(text); }
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"); } } }
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"); } } }
/// <summary> /// This function tells IndexServer to encrypt or decrypt documents that are /// assigned to an encryption set. /// </summary> /// <param name="ix"></param> /// <param name="ci"></param> /// <param name="encr"></param> private void setSessionOptionEncrypt(IXConnection ix, bool encr) { SessionOptions sopts = new SessionOptions(); sopts.options = new KeyValue[2]; sopts.options[0] = new KeyValue(); sopts.options[0].key = SessionOptionsC.ENCRYPT_DOCUMENTS; sopts.options[0].value = "" + encr; sopts.options[1] = new KeyValue(); sopts.options[1].key = SessionOptionsC.DECRYPT_DOCUMENTS; sopts.options[1].value = "" + encr; ix.Ix.setSessionOptions(sopts); }
static void Main(string[] args) { string[] files; DataAccess da = new DataAccess(); IXConnFactory connFact = new IXConnFactory("http://SERVER-SQL:8080/ix-Projekte_und_Fibu/ix", "", "1.0"); conn = connFact.Create("Faermann", "Faermann", "EDV-Faermann-8", null); string[] directs = getDirectory(da); string parentId = setParentId(da); foreach (string direct in directs) { if (!isItemExist(nameItem(direct), parentId, false)) createFolder(nameItem(direct), parentId); files = Directory.GetFiles(direct); foreach (string file in files) { if (!isItemExist(nameItem(file), parentId,true)) createDocument(file, String.Format("{0}/{1}", parentId, nameItem(direct))); } } }