public void AddComponent(UnsafeMatchingArchetypePtrList archetypeList, EntityQueryFilter filter, ComponentType componentType) { if (!m_IsMainThread) { throw new InvalidOperationException("Must be called from the main thread"); } EntityComponentStore->AssertCanAddComponent(archetypeList, componentType); using (var chunks = ChunkIterationUtility.CreateArchetypeChunkArray(archetypeList, Allocator.TempJob, ref filter, DependencyManager)) { if (chunks.Length == 0) { return; } EntityComponentStore->AssertCanAddComponent(chunks, componentType); BeforeStructuralChange(); var archetypeChanges = EntityComponentStore->BeginArchetypeChangeTracking(); //@TODO the fast path for a chunk that contains a single entity is only possible if the chunk doesn't have a Locked Entity Order //but we should still be allowed to add zero sized components to chunks with a Locked Entity Order, even ones that only contain a single entity EntityComponentStore->AddComponentWithValidation(archetypeList, filter, componentType, DependencyManager); EntityComponentStore->EndArchetypeChangeTracking(archetypeChanges, EntityQueryManager); ManagedComponentStore.Playback(ref EntityComponentStore->ManagedChangesTracker); } }
public void EqualityWithoutChildrenTest() { EntityQueryFilter entityQueryFilter1 = new EntityQueryFilter(EntityQueryFilterType.LEAF); entityQueryFilter1.FieldName = "charge.transaction.id"; entityQueryFilter1.Operator = CriteriaOperator.EQUALS; entityQueryFilter1.Value = "transaction.value"; EntityQueryFilter entityQueryFilter2 = new EntityQueryFilter(EntityQueryFilterType.LEAF); entityQueryFilter2.FieldName = "charge.transaction.id"; entityQueryFilter2.Operator = CriteriaOperator.EQUALS; entityQueryFilter2.Value = "transaction.value"; EntityQueryFilter andFilter = new EntityQueryFilter(EntityQueryFilterType.AND) { Children = new List <EntityQueryFilter> { entityQueryFilter1, entityQueryFilter2 } }; Assert.DoesNotThrow(() => andFilter.Equals(entityQueryFilter1)); }
/// <summary> /// Count Counts the number of items in the database as restricted by the given filter. /// </summary> /// <exception cref="Customweb.Wallee.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="spaceId"></param> /// <param name="filter">The filter which restricts the entities which are used to calculate the count. (optional)</param> /// <returns>Task of ApiResponse (long?)</returns> public async System.Threading.Tasks.Task<ApiResponse<long?>> CountAsyncWithHttpInfo (long? spaceId, EntityQueryFilter filter = null) { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new ApiException(400, "Missing required parameter 'spaceId' when calling SubscriptionMetricUsageService->Count"); } var localVarPath = "/subscription-metric-usage/count"; var localVarPathParams = new Dictionary<String, String>(); var localVarQueryParams = new Dictionary<String, String>(); var localVarHeaderParams = new Dictionary<String, String>(); var localVarFormParams = new Dictionary<String, String>(); var localVarFileParams = new Dictionary<String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json;charset=utf-8" }; String localVarHttpContentType = ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json;charset=utf-8" }; String localVarHttpHeaderAccept = ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (spaceId != null) localVarQueryParams.Add("spaceId", ApiClient.ParameterToString(spaceId)); // query parameter if (filter != null && filter.GetType() != typeof(byte[])) { localVarPostBody = ApiClient.Serialize(filter); // http body (model) parameter } else { localVarPostBody = filter; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("Count", localVarResponse); if (exception != null) throw exception; } return new ApiResponse<long?>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (long?) ApiClient.Deserialize(localVarResponse, typeof(long?))); }
/// <summary> /// Count Counts the number of items in the database as restricted by the given filter. /// </summary> /// <exception cref="TrustPayments.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="filter">The filter which restricts the entities which are used to calculate the count. (optional)</param> /// <returns>ApiResponse of long?</returns> public ApiResponse <long?> CountWithHttpInfo(EntityQueryFilter filter = null) { var localVarPath = "/space/count"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json;charset=utf-8" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json;charset=utf-8" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (filter != null && filter.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(filter); // http body (model) parameter } else { localVarPostBody = filter; // byte array } this.Configuration.ApiClient.ResetTimeout(); // make the HTTP request IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("Count", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <long?>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (long?)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(long?)))); }
public void RemoveComponent(UnsafeMatchingArchetypePtrList archetypeList, EntityQueryFilter filter, ComponentType componentType) { if (!m_IsMainThread) { throw new InvalidOperationException("Must be called from the main thread"); } using (var chunks = ChunkIterationUtility.CreateArchetypeChunkArray(archetypeList, Allocator.TempJob, ref filter, EntityManager.DependencyManager)) { RemoveComponent(chunks, componentType); } }
public void CountTest() { EntityQueryFilter EntityQueryFilter = new EntityQueryFilter(EntityQueryFilterType.LEAF) { FieldName = "id", Value = this.Transaction.Id, Operator = CriteriaOperator.EQUALS }; var response = this.TransactionService.Count(this.SpaceId, EntityQueryFilter); Assert.IsInstanceOf <long?>(response, "response is long?"); }
public void UpdateTransactionLineItemsTest() { EntityQueryFilter entityQueryFilter = new EntityQueryFilter(EntityQueryFilterType.LEAF) { FieldName = "id", Value = this.Transaction.Id, Operator = CriteriaOperator.EQUALS }; EntityQuery entityQuery = new EntityQuery { Filter = entityQueryFilter }; var response = this.TransactionService.Search(this.SpaceId, entityQuery); Assert.IsInstanceOf <List <Transaction> >(response, "response is List<Transaction>"); }
public void AddComponent(UnsafeMatchingArchetypePtrList archetypeList, EntityQueryFilter filter, ComponentType componentType) { if (!m_IsMainThread) { throw new InvalidOperationException("Must be called from the main thread"); } EntityComponentStore->AssertCanAddComponent(archetypeList, componentType); using (var chunks = ChunkIterationUtility.CreateArchetypeChunkArray(archetypeList, Allocator.TempJob, ref filter, EntityManager.DependencyManager)) { if (chunks.Length == 0) { return; } EntityComponentStore->AssertCanAddComponent(chunks, componentType); EntityManager.BeforeStructuralChange(); var archetypeChanges = EntityComponentStore->BeginArchetypeChangeTracking(); //@TODO the fast path for a chunk that contains a single entity is only possible if the chunk doesn't have a Locked Entity Order //but we should still be allowed to add zero sized components to chunks with a Locked Entity Order, even ones that only contain a single entity /* * if ((chunks.Length == 1) && (chunks[0].Count == 1)) * { * var entityPtr = (Entity*) chunks[0].m_Chunk->Buffer; * StructuralChange.AddComponentEntity(EntityComponentStore, entityPtr, componentType.TypeIndex); * } * else * { */ StructuralChange.AddComponentChunks(EntityComponentStore, (ArchetypeChunk *)NativeArrayUnsafeUtility.GetUnsafePtr(chunks), chunks.Length, componentType.TypeIndex); /* * } */ var changedArchetypes = EntityComponentStore->EndArchetypeChangeTracking(archetypeChanges); EntityQueryManager.AddAdditionalArchetypes(changedArchetypes); ManagedComponentStore.Playback(ref EntityComponentStore->ManagedChangesTracker); } }
public void SearchTest() { try{ Transaction transaction = this.TransactionService.Create(this.SpaceId, this.GetTransactionPayload()); EntityQueryFilter entityQueryFilter = new EntityQueryFilter(EntityQueryFilterType.LEAF); entityQueryFilter.FieldName = "charge.transaction.id"; entityQueryFilter.Value = transaction.Id; entityQueryFilter.Operator = CriteriaOperator.EQUALS; EntityQuery entityQuery = new EntityQuery(); entityQuery.Filter = entityQueryFilter; var response = this.ChargeAttemptService.Search(this.SpaceId, entityQuery); Assert.IsInstanceOf <List <ChargeAttempt> > (response, "response is List<ChargeAttempt>"); } catch (TrustPayments.Client.ApiException e) { Console.WriteLine("IOException source: {0}", e.Message); } }
public void DestroyEntity(UnsafeMatchingArchetypePtrList archetypeList, EntityQueryFilter filter) { if (!m_IsMainThread) { throw new InvalidOperationException("Must be called from the main thread"); } Profiler.BeginSample("DestroyEntity(EntityQuery entityQueryFilter)"); Profiler.BeginSample("GetAllMatchingChunks"); using (var chunks = ChunkIterationUtility.CreateArchetypeChunkArray(archetypeList, Allocator.TempJob, ref filter, DependencyManager)) { Profiler.EndSample(); if (chunks.Length != 0) { BeforeStructuralChange(); Profiler.BeginSample("EditorOnlyChecks"); EntityComponentStore->AssertCanDestroy(chunks); EntityComponentStore->AssertWillDestroyAllInLinkedEntityGroup(chunks, EntityManager.GetArchetypeChunkBufferType <LinkedEntityGroup>(false)); Profiler.EndSample(); // #todo @macton DestroyEntities should support IJobChunk. But internal writes need to be handled. Profiler.BeginSample("DeleteChunks"); new DestroyChunks { EntityComponentStore = EntityComponentStore, Chunks = chunks }.Run(); Profiler.EndSample(); Profiler.BeginSample("Managed Playback"); PlaybackManagedChanges(); Profiler.EndSample(); } } Profiler.EndSample(); }
/// <summary> /// Count Counts the number of items in the database as restricted by the given filter. /// </summary> /// <exception cref="Customweb.Wallee.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="spaceId"></param> /// <param name="filter">The filter which restricts the entities which are used to calculate the count. (optional)</param> /// <returns>Task of long?</returns> public async System.Threading.Tasks.Task <long?> CountAsync(long?spaceId, EntityQueryFilter filter = null) { ApiResponse <long?> localVarResponse = await CountAsyncWithHttpInfo(spaceId, filter); return(localVarResponse.Data); }
/// <summary> /// Count Counts the number of items in the database as restricted by the given filter. /// </summary> /// <exception cref="Customweb.Wallee.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="spaceId"></param> /// <param name="filter">The filter which restricts the entities which are used to calculate the count. (optional)</param> /// <returns>long?</returns> public long?Count(long?spaceId, EntityQueryFilter filter = null) { ApiResponse <long?> localVarResponse = CountWithHttpInfo(spaceId, filter); return(localVarResponse.Data); }
/// <summary> /// EntityManager.BeforeStructuralChange must be called before invoking this. /// ManagedComponentStore.Playback must be called after invoking this. /// ManagedComponentStore.RemoveReference() must be called after Playback for each newSharedComponentDataIndex added /// EntityQueryManager.AddAdditionalArchetypes must be called after invoking this. /// Invoking this must be wrapped in ArchetypeChangeTracking. /// </summary> /// <param name="archetypeList"></param> /// <param name="filter"></param> /// <param name="typeIndex"></param> /// <param name="hashCode"></param> /// <param name="componentData"></param> /// <exception cref="InvalidOperationException"></exception> public void AddSharedComponentDataBoxedDefaultMustBeNullDuringStructuralChange(UnsafeMatchingArchetypePtrList archetypeList, EntityQueryFilter filter, int typeIndex, int hashCode, object componentData, UnsafeList *managedReferenceIndexRemovalCount) { if (!m_IsMainThread) { throw new InvalidOperationException("Must be called from the main thread"); } ComponentType componentType = ComponentType.FromTypeIndex(typeIndex); using (var chunks = ChunkIterationUtility.CreateArchetypeChunkArray(archetypeList, Allocator.TempJob, ref filter, DependencyManager)) { if (chunks.Length == 0) { return; } var newSharedComponentDataIndex = 0; if (componentData != null) // null means default { newSharedComponentDataIndex = ManagedComponentStore.InsertSharedComponentAssumeNonDefault(typeIndex, hashCode, componentData); } AddSharedComponentDataDuringStructuralChange(chunks, newSharedComponentDataIndex, componentType); managedReferenceIndexRemovalCount->Add(newSharedComponentDataIndex); } }
/// <summary> /// EntityManager.BeforeStructuralChange must be called before invoking this. /// ManagedComponentStore.Playback must be called after invoking this. /// EntityQueryManager.AddAdditionalArchetypes must be called after invoking this. /// Invoking this must be wrapped in ArchetypeChangeTracking. /// </summary> /// <param name="archetypeList"></param> /// <param name="filter"></param> /// <param name="componentType"></param> /// <exception cref="InvalidOperationException"></exception> public void RemoveComponentDuringStructuralChange(UnsafeMatchingArchetypePtrList archetypeList, EntityQueryFilter filter, ComponentType componentType) { if (!m_IsMainThread) { throw new InvalidOperationException("Must be called from the main thread"); } using (var chunks = ChunkIterationUtility.CreateArchetypeChunkArray(archetypeList, Allocator.TempJob, ref filter, DependencyManager)) { StructuralChange.RemoveComponentChunks(EntityComponentStore, (ArchetypeChunk *)NativeArrayUnsafeUtility.GetUnsafePtr(chunks), chunks.Length, componentType.TypeIndex); } }
public void Init() { EntityQueryFilter = new EntityQueryFilter(EntityQueryFilterType.LEAF); }
/// <summary> /// Count Counts the number of items in the database as restricted by the given filter. /// </summary> /// <exception cref="Wallee.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="spaceId"></param> /// <param name="filter">The filter which restricts the entities which are used to calculate the count. (optional)</param> /// <returns>ApiResponse of long?</returns> public ApiResponse <long?> CountWithHttpInfo(long?spaceId, EntityQueryFilter filter = null) { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new ApiException(400, "Missing required parameter 'spaceId' when calling ChargeFlowLevelPaymentLinkService->Count"); } var localVarPath = "/charge-flow-level-payment-link/count"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json;charset=utf-8" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json;charset=utf-8" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (spaceId != null) { localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "spaceId", spaceId)); // query parameter } if (filter != null && filter.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(filter); // http body (model) parameter } else { localVarPostBody = filter; // byte array } this.Configuration.ApiClient.ResetTimeout(); // make the HTTP request IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("Count", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <long?>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (long?)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(long?)))); }