/// <summary> /// POBox factory method that constructs a POBox object for the specified user in the specified domain. /// </summary> /// <param name="storeObject">The Store object that the POBox belongs to.</param> /// <param name="domainId">The ID of the domain that the POBox belongs to.</param> /// <param name="userId">The ID of the user that the POBox belongs to.</param> /// <returns></returns> public static POBox FindPOBox(Store storeObject, string domainId, string userId) { POBox poBox = null; // Build the name of the POBox. string name = "POBox:" + domainId + ":" + userId; // Search for the POBox. ICSEnumerator listEnum = storeObject.GetCollectionsByName(name).GetEnumerator() as ICSEnumerator; // There should only be one value returned... if (listEnum.MoveNext()) { ShallowNode shallowNode = (ShallowNode)listEnum.Current; if (listEnum.MoveNext()) { // TODO: multiple values were returned ... throw an exception. } poBox = new POBox(storeObject, shallowNode); } listEnum.Dispose(); return(poBox); }
/// <summary> /// Returns whether this DirNode object contains children. /// </summary> /// <param name="collection">Collection object that this object belongs to.</param> /// <returns>True if DirNode object contains children, otherwise false is returned.</returns> public bool HasChildren(Collection collection) { ICSList results = collection.Search(PropertyTags.Parent, new Relationship(collection.ID, id)); ICSEnumerator e = results.GetEnumerator() as ICSEnumerator; bool hasChildren = e.MoveNext(); e.Dispose(); return(hasChildren); }
/// <summary> /// Gets the specified Member object. /// </summary> /// <param name="userID">User ID of the member to find.</param> /// <returns>The Member object represented by the specified user guid.</returns> public Member GetMember(string userID) { ICSList list = collection.Search(PropertyTags.Ace, userID, SearchOp.Begins); ICSEnumerator e = list.GetEnumerator() as ICSEnumerator; Member member = e.MoveNext() ? new Member(collection, e.Current as ShallowNode) : null; e.Dispose(); return(member); }
/// <summary> /// Initializes an instance of an object. /// </summary> /// <param name="domainID">Identifier for the domain that is being searched.</param> /// <param name="enumerator">Search iterator.</param> /// <param name="totalRecords">The total number of records contained in the search.</param> public SearchState(string domainID, ICSEnumerator enumerator, int totalRecords) { this.domainID = domainID; this.enumerator = enumerator; this.totalRecords = totalRecords; lock ( searchTable ) { searchTable.Add(contextHandle, this); } }
/// <summary> /// Continues the search for domain members from the current record location. /// </summary> /// <param name="searchContext">Domain provider specific search context returned by FindFirstDomainMembers method.</param> /// <param name="count">Maximum number of member objects to return.</param> /// <param name="memberList">Receives an array object that contains the domain Member objects.</param> /// <returns>True if there are more domain members. Otherwise false is returned.</returns> public bool FindNextDomainMembers(ref string searchContext, int count, out Member[] memberList) { bool moreEntries = false; // Initialize the outputs. memberList = null; // See if there is a valid search context. SearchState searchState = SearchState.GetSearchState(searchContext); if (searchState != null) { // See if entries are to be returned. if (count > 0) { // Get the domain being searched. Domain domain = store.GetDomain(searchState.DomainID); if (domain != null) { // Allocate a list to hold the member objects. ArrayList tempList = new ArrayList(count); ICSEnumerator enumerator = searchState.Enumerator; while ((count > 0) && enumerator.MoveNext()) { // The enumeration returns ShallowNode objects. ShallowNode sn = enumerator.Current as ShallowNode; if (sn.Type == NodeTypes.MemberType) { tempList.Add(new Member(domain, sn)); --count; } } if (tempList.Count > 0) { memberList = tempList.ToArray(typeof(Member)) as Member[]; searchState.CurrentRecord += memberList.Length; searchState.LastCount = memberList.Length; moreEntries = (count == 0) ? true : false; } } } else { if (searchState.CurrentRecord < searchState.TotalRecords) { moreEntries = true; } } } return(moreEntries); }
/// <summary> /// write the response back /// </summary> public void Send() { ctx.Response.Write("<channel>"); ctx.Response.Write("<title>"); ctx.Response.Write(collection.Name); ctx.Response.Write("</title>"); /* * if (slog.Link != "") * { * ctx.Response.Write("<link>"); * ctx.Response.Write( slog.Link ); * ctx.Response.Write("</link>"); * } */ ctx.Response.Write("<language>"); ctx.Response.Write("en-us"); ctx.Response.Write("</language>"); ctx.Response.Write("<copyright>"); ctx.Response.Write("(c) Novell, Inc."); ctx.Response.Write("</copyright>"); ctx.Response.Write("<managingEditor>"); Domain domain = store.GetDomain(store.DefaultDomain); if (collection.Owner.FN != null && collection.Owner.FN != "") { ctx.Response.Write(collection.Owner.FN); } else { ctx.Response.Write(collection.Owner.Name); } ctx.Response.Write("</managingEditor>"); ctx.Response.Write("<webmaster>"); //member = domain.GetMemberByID( domain.Owner ); if (domain.Owner.FN != null && domain.Owner.FN != "") { ctx.Response.Write(domain.Owner.FN); } else { ctx.Response.Write(domain.Owner.Name); } ctx.Response.Write("</webmaster>"); try { Simias.Storage.Property descProp = collection.Properties.GetSingleProperty("Description"); if (descProp != null) { ctx.Response.Write("<description>" + descProp.Value.ToString() + "</description>"); } else { ctx.Response.Write("<description>" + collection.Type.ToString() + "</description>"); } } catch {} ctx.Response.Write( String.Format( "<link>{0}{1}:{2}{3}{4}?feed={5}</link>", ctx.Request.IsSecureConnection ? "https://" : "http://", ctx.Request.Url.Host, ctx.Request.Url.Port.ToString(), ctx.Request.ApplicationPath, (publicAccess == true) ? "/pubrss.ashx" : "/rss.ashx", HttpUtility.UrlEncode(collection.Name))); Simias.Storage.Property colProp = collection.Properties.GetSingleProperty(Simias.RssFeed.Util.LastModified); DateTime latest = (colProp != null) ? (DateTime)colProp.Value : collection.CreationTime; /* * ICSList nodes = collection.Search( Simias.RssFeed.Util.LastModified, dt, SearchOp.Greater ); * ICSEnumerator nodesEnum = null; * if ( nodes.Count > 0 ) * { * nodesEnum = nodes.GetEnumerator() as ICSEnumerator; * if ( nodesEnum != null && * nodesEnum.SetCursor( IndexOrigin.SET, nodesEnum.Count - 1 ) == true ) * { * nodesEnum.MoveNext(); * * try * { * ShallowNode sn = nodesEnum.Current as ShallowNode; * log.Debug( "sn: " + sn.Name ); * * Item item = new Item( collection, sn ); * if ( item.Published > latest ) * { * latest = item.Published; * } * } * catch( Exception e ) * { * log.Debug( e.Message ); * } * } * } */ Simias.RssFeed.Util.SendPublishDate(ctx, latest); ctx.Response.Write("<lastBuildDate>"); ctx.Response.Write(Util.GetRfc822Date(latest)); ctx.Response.Write("</lastBuildDate>"); ctx.Response.Write("<generator>"); ctx.Response.Write("Simias"); ctx.Response.Write("</generator>"); /* * ctx.Response.Write("<cloud>"); * ctx.Response.Write( node.Cloud ); * ctx.Response.Write("</cloud>"); */ ctx.Response.Write("<ttl>"); ctx.Response.Write(Simias.RssFeed.Util.DefaultTtl.ToString()); ctx.Response.Write("</ttl>"); ctx.Response.Write("<rating>"); ctx.Response.Write(Simias.RssFeed.Util.DefaultRating); ctx.Response.Write("</rating>"); if (strict == false) { ctx.Response.Write("<authorID>" + collection.Owner.UserID + "</authorID>"); ctx.Response.Write("<type>" + collection.Type.ToString() + "</type>"); ctx.Response.Write("<id>" + collection.ID + "</id>"); } if (items == true) { ICSList nodes = collection.Search( Simias.RssFeed.Util.LastModified, new DateTime(1992, 1, 1, 0, 0, 0), SearchOp.Greater); if (nodes != null && nodes.Count > 0) { ICSEnumerator nodesEnum = nodes.GetEnumerator() as ICSEnumerator; int count = nodesEnum.Count; while (count-- > 0) { if (nodesEnum.SetCursor(IndexOrigin.SET, count) == true) { nodesEnum.MoveNext(); ShallowNode sn = nodesEnum.Current as ShallowNode; Item item = null; if (this.types.Count == 0) { if (sn.Type == "FileNode") { item = new Item(collection, sn, publicAccess); } } else { foreach (string ctype in this.types) { if (ctype == sn.Type) { item = new Item(collection, sn, publicAccess); break; } } } if (item != null) { item.Strict = this.strict; item.Enclosures = this.enclosures; item.Send(ctx); } } } } } ctx.Response.Write("</channel>"); }
/// <summary> /// Constructor for the object. /// </summary> public ICSList() { this.valueList = new ArrayList(); this.iEnumerator = null; }
/// <summary> /// Constructor for the object. /// </summary> /// <param name="list">ArrayList that contains objects.</param> public ICSList(ArrayList list) { this.valueList = list; this.iEnumerator = null; }
/// <summary> /// Constructor for the object. /// </summary> /// <param name="icsEnumerator">Enumerator that contains objects.</param> public ICSList(ICSEnumerator icsEnumerator) { this.valueList = null; this.iEnumerator = icsEnumerator; }