public static ForEachLambdaJobDescription WithEntityQueryOptions(this ForEachLambdaJobDescription description, EntityQueryOptions options) => description;
public static LambdaJobChunkDescription WithEntityQueryOptions(this LambdaJobChunkDescription description, EntityQueryOptions options) => description;
// postEditing: Is the entity param from the response of wbeditentity API call? internal void LoadFromContract(Contracts.Entity entity, EntityQueryOptions options, bool isPostEditing) { var extensionData = entity.ExtensionData ?? emptyExtensionData; var id = entity.Id; Debug.Assert(id != null); if ((options & EntityQueryOptions.SupressRedirects) != EntityQueryOptions.SupressRedirects && Id != null && Id != id) { // The page has been overwritten, or deleted. //logger.LogWarning("Detected change of page id for [[{Title}]]: {Id1} -> {Id2}.", Title, Id, id); } var serializable = extensionData.ContainsKey("missing") ? null : SerializableEntity.Load(entity); Id = id; Exists = serializable != null; Type = EntityType.Unknown; PageId = -1; NamespaceId = -1; Title = null; LastModified = DateTime.MinValue; LastRevisionId = 0; Labels = null; Aliases = null; Descriptions = null; SiteLinks = null; QueryOptions = options; if (serializable == null) { return; } serializable = SerializableEntity.Load(entity); Type = serializable.Type; DataType = serializable.DataType; if ((options & EntityQueryOptions.FetchInfo) == EntityQueryOptions.FetchInfo) { if (!isPostEditing) { // wbeditentity response does not have these properties. PageId = (int)extensionData["pageid"]; NamespaceId = (int)extensionData["ns"]; Title = (string)extensionData["title"]; LastModified = (DateTime)extensionData["modified"]; } LastRevisionId = (int)extensionData["lastrevid"]; } if ((options & EntityQueryOptions.FetchLabels) == EntityQueryOptions.FetchLabels) { Labels = serializable.Labels; if (Labels.Count == 0) { Labels = emptyStringDict; } else { Labels.IsReadOnly = true; } } if ((options & EntityQueryOptions.FetchAliases) == EntityQueryOptions.FetchAliases) { Aliases = serializable.Aliases; if (Aliases.Count == 0) { Aliases = emptyStringsDict; } else { Aliases.IsReadOnly = true; } } if ((options & EntityQueryOptions.FetchDescriptions) == EntityQueryOptions.FetchDescriptions) { Descriptions = serializable.Descriptions; if (Descriptions.Count == 0) { Descriptions = emptyStringDict; } else { Descriptions.IsReadOnly = true; } } if ((options & EntityQueryOptions.FetchSiteLinks) == EntityQueryOptions.FetchSiteLinks) { SiteLinks = serializable.SiteLinks; if (SiteLinks.Count == 0) { SiteLinks = emptySiteLinks; } else { SiteLinks.IsReadOnly = true; } } if ((options & EntityQueryOptions.FetchClaims) == EntityQueryOptions.FetchClaims) { Claims = serializable.Claims; if (Claims.Count == 0) { Claims = emptyClaims; } else { Claims.IsReadOnly = true; } } }
static bool TestMatchingArchetypeAll(Archetype *archetype, int *allTypes, int allCount, EntityQueryOptions options) { var componentTypes = archetype->Types; var componentTypesCount = archetype->TypesCount; var foundCount = 0; var disabledTypeIndex = TypeManager.GetTypeIndex <Disabled>(); var prefabTypeIndex = TypeManager.GetTypeIndex <Prefab>(); var chunkHeaderTypeIndex = TypeManager.GetTypeIndex <ChunkHeader>(); var includeInactive = (options & EntityQueryOptions.IncludeDisabled) != 0; var includePrefab = (options & EntityQueryOptions.IncludePrefab) != 0; var includeChunkHeader = false; for (var i = 0; i < componentTypesCount; i++) { var componentTypeIndex = componentTypes[i].TypeIndex; for (var j = 0; j < allCount; j++) { var allTypeIndex = allTypes[j]; if (allTypeIndex == disabledTypeIndex) { includeInactive = true; } if (allTypeIndex == prefabTypeIndex) { includePrefab = true; } if (allTypeIndex == chunkHeaderTypeIndex) { includeChunkHeader = true; } if (componentTypeIndex == allTypeIndex) { foundCount++; } } } if (archetype->Disabled && (!includeInactive)) { return(false); } if (archetype->Prefab && (!includePrefab)) { return(false); } if (archetype->HasChunkHeader && (!includeChunkHeader)) { return(false); } return(foundCount == allCount); }
/// <summary> /// Refreshes the entity information from Wikibase site. /// </summary> /// <param name="options">The options, including choosing the fields to fetch</param> /// <param name="languages"> /// Filter down the internationalized values to the specified one or more language codes. /// Set to <c>null</c> for all available languages. /// </param> /// <param name="cancellationToken">The token used to cancel the operation.</param> /// <seealso cref="EntityExtensions.RefreshAsync(IEnumerable{Entity},EntityQueryOptions,ICollection{string},CancellationToken)"/> public Task RefreshAsync(EntityQueryOptions options, ICollection <string> languages, CancellationToken cancellationToken) { return(WikibaseRequestHelper.RefreshEntitiesAsync(new[] { this }, options, languages, cancellationToken)); }
internal void LoadFromJson(JToken jentity, EntityQueryOptions options, bool isPostEditing) { var contract = jentity.ToObject <Contracts.Entity>(Utility.WikiJsonSerializer); LoadFromContract(contract, options, isPostEditing); }
/// <inheritdoc cref="RefreshAsync(EntityQueryOptions,ICollection{string},CancellationToken)"/> /// <seealso cref="EntityExtensions.RefreshAsync(IEnumerable{Entity},EntityQueryOptions)"/> public Task RefreshAsync(EntityQueryOptions options) { return(RefreshAsync(options, null, CancellationToken.None)); }
/// <inheritdoc cref="RefreshAsync(EntityQueryOptions,ICollection{string},CancellationToken)"/> /// <seealso cref="EntityExtensions.RefreshAsync(IEnumerable{Entity},EntityQueryOptions,ICollection{string})"/> public Task RefreshAsync(EntityQueryOptions options, ICollection <string> languages) { return(RefreshAsync(options, languages, CancellationToken.None)); }
private static IDictionary <string, object> BuildQueryOptions(string languages, EntityQueryOptions options) { var propValue = options & EntityQueryOptions.FetchAllProperties; string props; if (propValue == EntityQueryOptions.None) { props = ""; } else { lock (propdict) { if (!propdict.TryGetValue(propValue, out props)) { props = null; if ((propValue & EntityQueryOptions.FetchInfo) == EntityQueryOptions.FetchInfo) { props += "|info"; } if ((propValue & EntityQueryOptions.FetchLabels) == EntityQueryOptions.FetchLabels) { props += "|labels"; } if ((propValue & EntityQueryOptions.FetchAliases) == EntityQueryOptions.FetchAliases) { props += "|aliases"; } if ((propValue & EntityQueryOptions.FetchDescriptions) == EntityQueryOptions.FetchDescriptions) { props += "|descriptions"; } if ((propValue & EntityQueryOptions.FetchSiteLinks) == EntityQueryOptions.FetchSiteLinks) { props += "|sitelinks"; } if ((propValue & EntityQueryOptions.FetchSiteLinksUrl) == EntityQueryOptions.FetchSiteLinksUrl) { props += "|sitelinks/urls"; } if ((propValue & EntityQueryOptions.FetchClaims) == EntityQueryOptions.FetchClaims) { props += "|claims"; } Debug.Assert(props != null); props = props.Substring(1); propdict.Add(propValue, props); } } } return(new Dictionary <string, object> { { "redirects", (options & EntityQueryOptions.SupressRedirects) == EntityQueryOptions.SupressRedirects ? "no" : "yes" }, { "languages", languages }, { "props", props }, }); }
/// <summary> /// Asynchronously fetch information for a sequence of entities. /// </summary> /// <param name="entities">A sequence of entities to be refreshed.</param> /// <param name="options">Provides options when performing the query.</param> /// <param name="languages"> /// Filter down the internationalized values to the specified one or more language codes. /// Set to <c>null</c> to fetch for all available languages. /// </param> /// <param name="cancellationToken">The token used to cancel the operation.</param> /// <seealso cref="Entity.RefreshAsync()"/> public static Task RefreshAsync(this IEnumerable <Entity> entities, EntityQueryOptions options, ICollection <string> languages, CancellationToken cancellationToken) { return(WikibaseRequestHelper.RefreshEntitiesAsync(entities, options, languages, cancellationToken)); }
/// <inheritdoc cref="RefreshAsync(IEnumerable{Entity},EntityQueryOptions,ICollection{string},CancellationToken)"/> public static Task RefreshAsync(this IEnumerable <Entity> entities, EntityQueryOptions options, ICollection <string> languages) { return(RefreshAsync(entities, options, languages, CancellationToken.None)); }
/// <inheritdoc cref="RefreshAsync(IEnumerable{Entity},EntityQueryOptions,ICollection{string},CancellationToken)"/> public static Task RefreshAsync(this IEnumerable <Entity> entities, EntityQueryOptions options) { return(RefreshAsync(entities, options, null, CancellationToken.None)); }
private static IDictionary <string, object> BuildQueryOptions(string languages, EntityQueryOptions options) { var propValue = options & EntityQueryOptions.FetchAllProperties; string props; if (propValue == EntityQueryOptions.None) { props = ""; } else { lock (propdict) { if (!propdict.TryGetValue(propValue, out props)) { props = null; if ((propValue & EntityQueryOptions.FetchInfo) == EntityQueryOptions.FetchInfo) { props += "|info"; } if ((propValue & EntityQueryOptions.FetchLabels) == EntityQueryOptions.FetchLabels) { props += "|labels"; } if ((propValue & EntityQueryOptions.FetchAliases) == EntityQueryOptions.FetchAliases) { props += "|aliases"; } if ((propValue & EntityQueryOptions.FetchDescriptions) == EntityQueryOptions.FetchDescriptions) { props += "|descriptions"; } if ((propValue & EntityQueryOptions.FetchSiteLinks) == EntityQueryOptions.FetchSiteLinks) { props += "|sitelinks"; } if ((propValue & EntityQueryOptions.FetchSiteLinksUrl) == EntityQueryOptions.FetchSiteLinksUrl) { props += "|sitelinks/urls"; } if ((propValue & EntityQueryOptions.FetchClaims) == EntityQueryOptions.FetchClaims) { props += "|claims"; } Debug.Assert(props != null); props = props[1..];