/// <summary> /// Get information about taxa with a protection level /// that is higher than public. /// </summary> /// <param name="includeSubTaxa">If true, all sub taxa are included in the result.</param> /// <param name="taxonInformationType">Type of taxa information to get.</param> /// <returns>Information about protected taxa.</returns> public static TaxonList GetProtectedTaxa(Boolean includeSubTaxa, TaxonInformationType taxonInformationType) { Factor factor; List <WebTaxon> webTaxa; SpeciesFactCondition speciesFactCondition; SpeciesFactFieldCondition speciesFactFieldCondition; SpeciesProtectionLevelEnum protectionLevel; WebDataQuery webDataQuery; // Create data query. speciesFactCondition = new SpeciesFactCondition(); factor = FactorManager.GetFactor(FactorId.ProtectionLevel); speciesFactCondition.Factors.Add(factor); for (protectionLevel = SpeciesProtectionLevelEnum.Protected1; protectionLevel <= SpeciesProtectionLevelEnum.MaxProtected; protectionLevel++) { speciesFactFieldCondition = new SpeciesFactFieldCondition(); speciesFactFieldCondition.FactorField = factor.FactorDataType.Field1; speciesFactFieldCondition.SetValue((Int32)protectionLevel); speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); } // Get data from web service. webDataQuery = GetDataQuery(speciesFactCondition); webTaxa = WebServiceClient.GetTaxaByQuery(webDataQuery, taxonInformationType); return(GetTaxa(webTaxa)); }
/// <summary> /// Get information about a taxon. /// </summary> /// <param name="taxonId">Taxon to get information about.</param> /// <param name="taxonInformationType">Type of taxon information to get.</param> /// <returns>Taxon information.</returns> public static Taxon GetTaxon(Int32 taxonId, TaxonInformationType taxonInformationType) { Taxon taxon; WebTaxon webTaxon; if (taxonId == (Int32)TaxonId.Dummy) { // Check if data is cached. lock (_unknownTaxon) { taxon = (Taxon)(_unknownTaxon[taxonInformationType]); } if (taxon.IsNull()) { // Get data from web service. webTaxon = WebServiceClient.GetTaxon(taxonId, taxonInformationType); taxon = GetTaxon(webTaxon); // Add data to cache. lock (_unknownTaxon) { _unknownTaxon.Add(taxonInformationType, taxon); } } } else { // Get data from web service. webTaxon = WebServiceClient.GetTaxon(taxonId, taxonInformationType); taxon = GetTaxon(webTaxon); } return(taxon); }
/// <summary> /// Update taxa in all TaxonNames. /// This procedure does not add any new functionality. /// It is only used to improve performance. /// DEPRECATED /// Not used any more. /// Taxon information is sent together with /// TaxonName information in the dynamic data fields. /// </summary> /// <param name='taxonInformationType'>How much information about taxa that should be retrieved.</param> public void UpdateTaxa(TaxonInformationType taxonInformationType) { /* * // * List<Int32> taxonIds; * TaxonList taxa; * * if (this.Count > 0) * { * taxonIds = new List<Int32>(); * foreach (TaxonName taxonName in this) * { * if (!taxonIds.Contains(taxonName.TaxonId)) * { * taxonIds.Add(taxonName.TaxonId); * } * } * taxa = TaxonManager.GetTaxa(taxonIds, taxonInformationType); * foreach (Taxon taxon in taxa) * { * foreach (TaxonName taxonName in this) * { * if (taxon.Id == taxonName.TaxonId) * { * taxonName.Taxon = taxon; * } * } * } * } */ }
/// <summary> /// Get all taxa utelizing a certain host taxon and any of its child taxa. /// The method is restricted to factors of type substrate. /// </summary> /// <param name="hostTaxonId">Id of host taxon.</param> /// <param name="taxonInformationType">Type of host taxon information to get.</param> /// <returns>List of host taxa.</returns> public static TaxonList GetTaxaByHostTaxonId(Int32 hostTaxonId, TaxonInformationType taxonInformationType) { List <WebTaxon> webTaxa; // Get data from web service. webTaxa = WebServiceClient.GetTaxaByHostTaxonId(hostTaxonId, taxonInformationType); return(GetTaxa(webTaxa)); }
/// <summary> /// Create a TaxonSearchCriteria instance. /// </summary> public TaxonSearchCriteria() { _restrictReturnToScope = WebService.TaxonSearchScope.NoScope; _restrictReturnToTaxonTypeIds = null; _restrictReturnToSwedishSpecies = false; _restrictSearchToSwedishSpecies = false; _restrictSearchToTaxonIds = null; _restrictSearchToTaxonTypeIds = null; _taxonInformationType = TaxonInformationType.Basic; _taxonNameSearchString = null; }
/// <summary> /// Get information about taxa. /// </summary> /// <param name="taxonIds">Ids for taxa to get information about.</param> /// <param name="taxonInformationType">Type of taxon information to get.</param> /// <returns>Taxa information.</returns> public static TaxonList GetTaxa(List <Int32> taxonIds, TaxonInformationType taxonInformationType) { List <WebTaxon> webTaxa; // Check arguments. taxonIds.CheckNotEmpty("taxonIds"); // Get data from web service. webTaxa = WebServiceClient.GetTaxaById(taxonIds, taxonInformationType); return(GetTaxa(webTaxa)); }
/// <summary> /// Get all child taxa. /// Parent taxa are also included in the result. /// </summary> /// <param name="parentTaxonGuids">GUIDs for parent taxa.</param> /// <param name="taxonInformationType">Type of taxon information to get.</param> /// <returns>All child taxa.</returns> private TaxonList GetChildTaxa(List <String> parentTaxonGuids, TaxonInformationType taxonInformationType) { List <Int32> parentTaxonIds; parentTaxonIds = new List <Int32>(); foreach (String parentTaxonGuid in parentTaxonGuids) { // TODO: This assumption about taxon GUIDs may // change in the future. parentTaxonIds.Add(Int32.Parse(parentTaxonGuid)); } return(GetChildTaxa(parentTaxonIds, taxonInformationType)); }
/// <summary> /// Get taxa information about taxa that matches the data query. /// </summary> /// <param name="dataQuery">The data query.</param> /// <param name="taxonInformationType">Type of taxa information to get.</param> /// <returns>Taxa information.</returns> public static TaxonList GetTaxaByQuery(IDataQuery dataQuery, TaxonInformationType taxonInformationType) { List <WebTaxon> webTaxa; WebDataQuery webDataQuery; // Check arguments. dataQuery.CheckNotNull("dataQuery"); // Get data from web service. webDataQuery = GetDataQuery(dataQuery); webTaxa = WebServiceClient.GetTaxaByQuery(webDataQuery, taxonInformationType); return(GetTaxa(webTaxa)); }
/// <summary> /// Create a Taxon instance. /// </summary> /// <param name='id'>Id for taxon type.</param> /// <param name='taxonTypeId'>Id for type of taxon.</param> /// <param name='sortOrder'>Sort order among taxa.</param> /// <param name="taxonInformationType">Type of taxon information in this object.</param> /// <param name="scientificName">Scientific name for this taxon.</param> /// <param name="author">Author of the scientific name for this taxon.</param> /// <param name="commonName">Common name for this taxon.</param> public Taxon(Int32 id, Int32 taxonTypeId, Int32 sortOrder, TaxonInformationType taxonInformationType, String scientificName, String author, String commonName) : base(id, sortOrder) { _taxonType = TaxonManager.GetTaxonType(taxonTypeId); _taxonInformationType = taxonInformationType; _scientificName = scientificName; _author = author; _commonName = commonName; _taxonNames = null; }
/// <summary> /// Get taxa information about taxa that matches the search criteria. /// </summary> /// <param name="organismGroupId">Organism group id.</param> /// <param name="endangeredListId">Endangered list id.</param> /// <param name="redlistCategoryId">Redlist category id.</param> /// <param name="taxonInformationType">Type of taxa information to get.</param> /// <returns>Taxa information.</returns> public static TaxonList GetTaxaByOrganismOrRedlist(Int32?organismGroupId, Int32?endangeredListId, Int32?redlistCategoryId, TaxonInformationType taxonInformationType) { List <WebTaxon> webTaxa; // Get data from web service. webTaxa = WebServiceClient.GetTaxaByOrganismOrRedlist(organismGroupId.HasValue, organismGroupId.GetValueOrDefault(), endangeredListId.HasValue, endangeredListId.GetValueOrDefault(), redlistCategoryId.HasValue, redlistCategoryId.GetValueOrDefault(), taxonInformationType); return(GetTaxa(webTaxa)); }
/// <summary> /// Get all child taxa. /// Parent taxa are also included in the result. /// </summary> /// <param name="parentTaxonIds">Ids for parent taxa.</param> /// <param name="taxonInformationType">Type of taxon information to get.</param> /// <returns>All child taxa.</returns> public TaxonList GetChildTaxa(List <Int32> parentTaxonIds, TaxonInformationType taxonInformationType) { TaxonList childTaxa; TaxonTreeNodeList taxonTrees; TaxonTreeSearchCriteria taxonTreeSearchCriteria; taxonTreeSearchCriteria = new TaxonTreeSearchCriteria(); taxonTreeSearchCriteria.RestrictSearchToTaxonIds = parentTaxonIds; taxonTreeSearchCriteria.TaxonInformationType = taxonInformationType; taxonTrees = ArtDatabanken.Data.ArtDatabankenService.TaxonManager.GetTaxonTreesBySearchCriteria( taxonTreeSearchCriteria); childTaxa = new TaxonList(true); if (taxonTrees.IsNotEmpty()) { foreach (TaxonTreeNode taxonTree in taxonTrees) { GetChildTaxa(taxonTree, childTaxa); } } return(childTaxa); }
/// <summary> /// Create a Taxon instance. /// </summary> /// <param name='id'>Id for taxon type.</param> /// <param name='taxonTypeId'>Id for type of taxon.</param> /// <param name='sortOrder'>Sort order among taxa.</param> /// <param name="taxonInformationType">Type of taxon information in this object.</param> /// <param name="scientificName">Scientific name for this taxon.</param> /// <param name="author">Author of the scientific name for this taxon.</param> /// <param name="commonName">Common name for this taxon.</param> /// <param name="phylumName">Phylum name for this taxon.</param> /// <param name="className">Class name for this taxon.</param> /// <param name="orderName">Order name for this taxon.</param> /// <param name="familyName">Family name for this taxon.</param> public TaxonPrintObs(Int32 id, Int32 taxonTypeId, Int32 sortOrder, TaxonInformationType taxonInformationType, String scientificName, String author, String commonName, String phylumName, String className, String orderName, String familyName) : base(id, taxonTypeId, sortOrder, taxonInformationType, scientificName, author, commonName) { _phylumName = phylumName; _className = className; _orderName = orderName; _familyName = familyName; }
/// <summary> /// Create a TaxonTreeSearchCriteria instance. /// </summary> public TaxonTreeSearchCriteria() { _restrictSearchToTaxonIds = null; _restrictSearchToTaxonTypeIds = null; _taxonInformationType = TaxonInformationType.Basic; }