protected IResultCache <FWSord> GetChildren(bool inclFolders, bool inclDocs) { IResultCache <FWSord> myObjects = null; IResultCache <FWSord> mySords = sordsValue; if (inclFolders && inclDocs) { myObjects = mySords; } else { myObjects = inclFolders ? foldersValue : documentsValue; if (myObjects == null) { myObjects = FilterObjects(mySords, inclFolders, inclDocs); } } if (myObjects == null) { if (this.Id >= 1) { myObjects = ClassFactory.NewFindChildrenCache <FWSord>(this, inclFolders, inclDocs); } else { // new folder does not have children myObjects = new FWResultCacheList <FWSord>(); } } return(myObjects); }
/// <summary> /// Set all elements invalid. /// </summary> /// <remarks> /// The elements are read from the server in the next /// call to a member. /// </remarks> public void Invalidate() { if (lifetimeSeconds != int.MaxValue) { resultCache = null; map = null; } }
/// <summary> /// Construcor /// </summary> /// <param name="ifc">Master data interface object</param> /// <param name="subList">List of either only users or groups.</param> protected FWUserNamesCache(FWMasterDataInterface ifc, FWResultCacheList <UserName> subList) : base(ifc) { this.ifc = ifc; this.resultCache = subList; // never update this cache this.lifetimeSeconds = int.MaxValue; this.bestBefore = long.MaxValue; }
/// <summary> /// Reads the user names form the IndexServer if nessesary. /// </summary> protected void ensureCache() { if (resultCache == null || DateTime.Now.Ticks > bestBefore) { resultCache = new FWResultCacheList <UserName>(); map = new Dictionary <object, UserName>(resultCache.List.Count); UserName[] userNames = ifc.Conn.Ix.getUserNames(null, CheckoutUsersC.ALL_USERS_AND_GROUPS); foreach (UserName un in userNames) { try { resultCache.List.Add(un); map.Add(un.id, un); map.Add(un.name, un); //mapByName.Add(un.guid, un); } catch { } } bestBefore = DateTime.Now.Ticks + (10L * 1000L * 1000L * (long)lifetimeSeconds); } }
protected IResultCache <FWSord> FilterObjects(IResultCache <FWSord> mySords, bool inclFolders, bool inclDocs) { IResultCache <FWSord> ret = null; if (mySords != null) { List <FWSord> myList = new List <FWSord>(mySords.CountEstimated); foreach (FWSord s in mySords) { if ( (inclDocs && (s is FWDocument)) || (inclFolders && (s is FWFolder)) ) { myList.Add(s); } } ret = new FWResultCacheList <FWSord>(myList); } return(ret); }
/// <summary> /// Construcor /// </summary> /// <param name="ifc">Master data interface object</param> /// <param name="subList">List of either only users or groups.</param> protected FWDocMasks(FWMasterDataInterface ifc, FWResultCacheList <FWDocMask> subList) : base(ifc) { this.resultCache = subList; }