/// <summary> /// Get/Set ObjKey by name (group name) /// </summary> /// <param name="okeyName">ObjKey name</param> /// <returns>FWObjKey object</returns> /// <remarks> /// If no ObjKey with the given name exists, a new ObjKey Object is created. /// </remarks> public FWObjKey this[string okeyName] { get { FWObjKey ret = null; string okeyNameLowerCase = okeyName.ToLower(); ObjKey[] arr = Items; int maxOkeyId = -1; foreach (ObjKey o in arr) { if (o.name.ToLower().Equals(okeyNameLowerCase)) { ret = new FWObjKey(o, GetDML(okeyName)); break; } maxOkeyId = Math.Max(maxOkeyId, o.id); } if (ret == null) { ObjKey okey = new ObjKey(); DocMaskLine dml = GetDML(okeyName); if (dml != null) { okey.id = dml.id; okey.name = dml.key; } else { okey.id = maxOkeyId + 1; okey.name = "INDEX" + okey.id; } Items = AddObjKey(arr, okey); } return(ret); } set { ObjKey okey = value.okey; okey.name = okeyName.ToUpper(); string okeyNameLowerCase = okeyName.ToLower(); bool found = false; ObjKey[] arr = Items; for (int i = 0; i < arr.Length; i++) { ObjKey o = arr[i]; if (o.name.ToLower().Equals(okeyNameLowerCase)) { arr[i] = okey; found = true; break; } } if (!found) { Items = AddObjKey(arr, okey); } } }
/// <summary> /// Get/Set ObjKey by ID /// </summary> /// <param name="okeyId">ObjKey ID</param> /// <returns>FWObjKey object</returns> /// <remarks> /// If no ObjKey with the given ID exists, a new ObjKey Object is created. /// </remarks> public FWObjKey this[int okeyId] { get { FWObjKey ret = null; ObjKey[] arr = Items; foreach (ObjKey o in arr) { if (o.id == okeyId) { ret = new FWObjKey(o, GetDML(okeyId)); break; } } if (ret == null) { ObjKey okey = new ObjKey(); okey.id = okeyId; DocMaskLine dml = GetDML(okeyId); okey.name = (dml != null) ? dml.key : ("INDEX" + okeyId); ret = new FWObjKey(okey, dml); Items = AddObjKey(arr, okey); } return(ret); } set { ObjKey okey = value.okey; okey.id = okeyId; bool found = false; ObjKey[] arr = Items; for (int i = 0; i < arr.Length; i++) { ObjKey o = arr[i]; if (o.id == okeyId) { arr[i] = okey; found = true; break; } } if (!found) { Items = AddObjKey(arr, okey); } } }
/// <summary> /// Get the DocMaskLine object for the given ID of the storage mask that was set in the constructor. /// </summary> /// <param name="okeyId">ObjKey ID</param> /// <returns>DocMaskLine object or null, if no line can be found</returns> private DocMaskLine GetDML(int okeyId) { DocMaskLine ret = null; if (_maskId != null && _maskId.Length != 0) { FWDocMask dm = null; if (Conn.MasterData.DocMasks.TryGetValue(_maskId, out dm)) { foreach (DocMaskLine dml in dm.Core.lines) { if (dml.id == okeyId) { ret = dml; break; } } } } return(ret); }
/// <summary> /// Get the DocMaskLine object for the given group name of the storage mask that was set in the constructor. /// </summary> /// <param name="okeyName">ObjKey name</param> /// <returns>DocMaskLine object or null, if no line can be found</returns> private DocMaskLine GetDML(string okeyName) { DocMaskLine ret = null; if (_maskId != null && _maskId.Length != 0) { FWDocMask dm = null; if (Conn.MasterData.DocMasks.TryGetValue(_maskId, out dm)) { string okeyNameLowerCase = okeyName.ToLower(); foreach (DocMaskLine dml in dm.Core.lines) { if (dml.key.ToLower().Equals(okeyNameLowerCase)) { ret = dml; break; } } } } return(ret); }
/// <summary> /// <see cref="VirtualListView.makeColumns()"/> /// </summary> /// <remarks> /// Create an additional column for each of the index groups used by the cached Sord objects. /// It merly looks on the currently available Sords in the cache and does not /// read all Sords from the IndexServer. /// </remarks> protected override void makeColumns() { if (objectsCacheValue == null) { return; } Dictionary <String, DocMaskLineUsage> mapDmlUsage = new Dictionary <String, DocMaskLineUsage>(); if (this.ShowObjKeyColumns) { for (int i = 0; i < objectsCacheValue.CountEstimated; i++) { FWSord sord = SordsCache[i]; if (!ShowDocuments && (sord is FWDocument)) { continue; } if (!ShowFolders && (sord is FWFolder)) { continue; } DocMask dm = Conn.MasterData.DocMasks[sord.MaskId].Core; for (int dmlIdx = 0; dmlIdx < dm.lines.Length; dmlIdx++) { DocMaskLine dml = dm.lines[dmlIdx]; String groupName = dml.key.ToLower(); DocMaskLineUsage u = null; if (!mapDmlUsage.TryGetValue(groupName, out u)) { u = new DocMaskLineUsage(); u.GroupName = groupName; u.lableNames = new List <String>(); u.lableNames.Add(dml.name); mapDmlUsage[groupName] = u; } u.usageCount++; u.minDmlId = Math.Min(u.minDmlId, dmlIdx); FWObjKeyValue okeyValue = sord.ObjKeys[dmlIdx].Value; if (okeyValue != null && !okeyValue.IsEmpty()) { u.valueCount++; } } } } List <DocMaskLineUsage> lstDmlUsages = new List <DocMaskLineUsage>(mapDmlUsage.Values); lstDmlUsages.Sort(new DocMaskLineUsageComparer()); List <ColumnHeaderEx> lstHeaders = new List <ColumnHeaderEx>(lstDmlUsages.Count + 11); ColumnHeaderName.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByName <FWSord>())); lstHeaders.Add(ColumnHeaderName); ColumnHeaderXDate.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByXDate <FWSord>())); lstHeaders.Add(ColumnHeaderXDate); ColumnHeaderIDate.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByIDate <FWSord>())); lstHeaders.Add(ColumnHeaderIDate); ColumnHeaderMaskName.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByMaskName <FWSord>(this.connVal))); lstHeaders.Add(ColumnHeaderMaskName); ColumnHeaderOwner.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByOwnerName <FWSord>())); lstHeaders.Add(ColumnHeaderOwner); ColumnHeaderVersion.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersion <FWSord>())); lstHeaders.Add(ColumnHeaderVersion); ColumnHeaderVersionDate.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersionDate <FWSord>())); lstHeaders.Add(ColumnHeaderVersionDate); ColumnHeaderVersionUser.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersionOwner <FWSord>())); lstHeaders.Add(ColumnHeaderVersionUser); ColumnHeaderFileSize.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersionFileSize <FWSord>())); lstHeaders.Add(ColumnHeaderFileSize); ColumnHeaderArcPath.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByArcPath <FWSord>())); lstHeaders.Add(ColumnHeaderArcPath); ColumnHeaderLockName.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByLockName <FWSord>())); lstHeaders.Add(ColumnHeaderLockName); if (this.ShowObjKeyColumns) { foreach (DocMaskLineUsage u in lstDmlUsages) { if (u.valueCount > 0) { ColumnHeaderEx h = new ColumnHeaderEx(); String hname = ""; for (int i = 0; i < u.lableNames.Count; i++) { if (i > 0) { hname += "/"; } hname += u.lableNames[i]; } h.Text = hname; h.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByObjKey <FWSord>(u.GroupName))); h.Name = hname; lstHeaders.Add(h); } } } this.Columns.Clear(); this.Columns.AddRange(lstHeaders.ToArray()); }
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 editInfo = ix.Ix.createSord(parentId, maskId, EditInfoC.mbAll); // Hint: Supply the constant EditInfoC.mbAll to get not only the Sord object data // but the storage mask data too. Logger.instance().log("prepared sord with GUID=" + editInfo.sord.guid); DocMask mask = editInfo.mask; Sord sord = editInfo.sord; // Set display name sord.name = "C# sord"; // Set some index attributes for (int i = 0; i < mask.lines.Length; i++) { DocMaskLine dml = mask.lines[i]; if (dml.name.Equals("From") || dml.key.Equals("ELOOUTL1")) // this line is just to make it work with all languages { sord.objKeys[i].data = new String[] { "*****@*****.**" }; } else if (dml.name.Equals("To") || dml.key.Equals("ELOOUTL2")) // this line is just to make it work with all languages { sord.objKeys[i].data = new String[] { "*****@*****.**" }; } } // CHECKIN int objId = ix.Ix.checkinSord(sord, SordC.mbAll, LockC.NO); Logger.instance().log("Created sord successfully, objId=" + objId); // CHECKOUT String strObjId = (String)Convert.ChangeType(objId, typeof(String)); editInfo = ix.Ix.checkoutSord(strObjId, EditInfoC.mbSord, LockC.NO); sord = editInfo.sord; Logger.instance().log("Checkout sord successfully, GUID=" + sord.guid); Logger.instance().log("name=" + sord.name); for (int i = 0; i < sord.objKeys.Length; i++) { ObjKey okey = sord.objKeys[i]; if (okey.data.Length != 0) { Logger.instance().log("okey, goup-name=" + okey.name + ", data=" + okey.data[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 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 SORD // createSord does not create the new Sord object inside the database. // The purpose of this function is to initialize a new Sord object and // inherit ACL values and replication sets from the parent or // storage mask. // 1. // Create a root folder based on keywording form "Basic entry". // Parent is the "imaginary" archive entry with object ID = 1. String parentId = "1"; String maskId = "0"; // same as "" or "0" EditInfo editInfo = ix.Ix.createSord(parentId, maskId, EditInfoC.mbSord); Logger.instance().log("1. created sord, GUID=" + editInfo.sord.guid); // 2. // Create a folder inside the "Chaos Folder". // Hint: Chaos objects can only be retrieved by search. // They are not visible in the archive hirarchie. parentId = null; // same as "" or "0" maskId = "EMail"; editInfo = ix.Ix.createSord(parentId, maskId, EditInfoC.mbAll); Logger.instance().log("2. created sord, GUID=" + editInfo.sord.guid); // for each DocMaskLine in "EMail" there is an ObjKey in Sord. Logger.instance().log("sord: #index-lines=" + editInfo.sord.objKeys.Length); Logger.instance().log("mask: #index-lines=" + editInfo.mask.lines.Length); for (int i = 0; i < editInfo.mask.lines.Length; i++) { DocMaskLine dml = editInfo.mask.lines[i]; ObjKey okey = editInfo.sord.objKeys[i]; Logger.instance().log("label=" + dml.name + ", group-name=" + okey.name + ", #values=" + okey.data.Length); } // 3. // Create a root folder based on keywording form "Basic entry". // Parent is the "imaginary" archive entry with object ID = 1. //String parentId = "Sord GUID or ID"; // [x] put in any GUID or ID of an existing archive entry //String maskId = "keywording form name or ID"; // [X] put in any name or ID of an existing document mask, e. g. "Structure element", "EMail" //EditInfo editInfo = ix.Ix.createSord(parentId, maskId, EditInfoC.mbSord); } 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="okey">ObjKey object</param> /// <param name="dml">Index value definition</param> public FWObjKey(ObjKey okey, DocMaskLine dml) { this.okey = okey; this.okeyData = new FWObjKeyData(okey); this.dml = dml; }