using System; using System.Collections.Generic; using Orchard.ContentManagement; using Orchard.Taxonomies.Models; namespace Orchard.Taxonomies.Services { public interface ITaxonomyService : IDependency { /// /// Returns all the content items. /// /// The content items. IEnumerable GetTaxonomies(); /// /// Loads the published version of content item by its id. /// /// The id of the to load. /// The with the specified id or null if no published version of this id exists. TaxonomyPart GetTaxonomy(int id); /// /// Loads the published version of content item by its name. /// /// The name of the to load. /// The with the specified id or null if no published version of this name exists. TaxonomyPart GetTaxonomyByName(string name); /// /// Creates a new Content Type for the terms of a /// /// The taxonomy to create a term content type for. void CreateTermContentType(TaxonomyPart taxonomy); /// /// Deletes a content item from the database. /// /// The taxonomy to delete. /// It will also remove all its terms and delete their content type. void DeleteTaxonomy(TaxonomyPart taxonomy); IContentQuery GetTaxonomiesQuery(); IEnumerable GetTerms(int taxonomyId); IEnumerable GetRootTerms(int taxonomyId); int GetTermsCount(int taxonomyId); TermPart GetTerm(int id); TermPart GetTermByName(int taxonomyId, string name); void DeleteTerm(TermPart termPart); void MoveTerm(TaxonomyPart taxonomy, TermPart term, TermPart parentTerm); void ProcessPath(TermPart term); IContentQuery GetTermsQuery(int taxonomyId); string GenerateTermTypeName(string taxonomyName); /// /// Creates a new content item in memory. /// /// You still need to assign the Name propery and create the content item in the database. /// The content item the new term is associated to. /// A new instance of TermPart NewTerm(TaxonomyPart taxonomy); /// /// Creates a new content item in memory. /// /// You still need to assign the Name propery and create the content item in the database. /// The content item the new term is associated to. /// The instance this term is a child of. This can be a of the same taxonomy or the taxonomy itself. /// A new instance of TermPart NewTerm(TaxonomyPart taxonomy, IContent parent); IEnumerable GetTermsForContentItem(int contentItemId, string field = null, VersionOptions versionOptions = null); void UpdateTerms(ContentItem contentItem, IEnumerable terms, string field); IEnumerable GetParents(TermPart term); IEnumerable GetChildren(TermPart term); IEnumerable GetChildren(TermPart term, bool includeParent); IEnumerable GetContentItems(TermPart term, int skip = 0, int count = 0, string fieldName = null); long GetContentItemsCount(TermPart term, string fieldName = null); IContentQuery GetContentItemsQuery(TermPart term, string fieldName = null); /// /// Organizes a list of objects into a hierarchy. /// /// The objects to orgnanize in a hierarchy. The objects need to be sorted. /// The action to perform when a node is added as a child, or null if nothing needs to be done. void CreateHierarchy(IEnumerable terms, Action append); } }