You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "fjtirado (via GitHub)" <gi...@apache.org> on 2025/02/24 16:48:22 UTC

[PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

fjtirado opened a new pull request, #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196

   Fix https://github.com/apache/incubator-kie-kogito-apps/issues/2175


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#issuecomment-2687410054

   > @fjtirado nice addition! Would it be possible to have it for jobs too?
   
   Sure, I have opened https://github.com/apache/incubator-kie-kogito-apps/issues/2197 to do that. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1970477168


##########
data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java:
##########
@@ -195,4 +191,21 @@ private List<Predicate> getRecursivePredicate(AttributeFilter<?> filter, Root<E>
                 .collect(toList());
     }
 
+    @Override
+    public long count() {
+        CriteriaBuilder builder = repository.getEntityManager().getCriteriaBuilder();
+        CriteriaQuery<Long> criteriaQuery = builder.createQuery(Long.class);
+        Root<E> root = criteriaQuery.from(entityClass);
+        criteriaQuery.select(builder.count(root));
+        addWhere(builder, criteriaQuery, root);
+        return repository.getEntityManager().createQuery(criteriaQuery).getSingleResult();
+    }
+
+    private <V> void addWhere(CriteriaBuilder builder, CriteriaQuery<V> criteriaQuery, Root<E> root) {
+        if (filters != null && !filters.isEmpty()) {
+            List<Predicate> predicates = getPredicates(builder, root);
+            criteriaQuery.where(predicates.toArray(new Predicate[] {}));

Review Comment:
   I do not change the original code, but actually, it should be predicates.toArray(new Predicate[predicates.size()])



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1971389238


##########
data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java:
##########
@@ -195,4 +191,21 @@ private List<Predicate> getRecursivePredicate(AttributeFilter<?> filter, Root<E>
                 .collect(toList());
     }
 
+    @Override
+    public long count() {
+        CriteriaBuilder builder = repository.getEntityManager().getCriteriaBuilder();
+        CriteriaQuery<Long> criteriaQuery = builder.createQuery(Long.class);
+        Root<E> root = criteriaQuery.from(entityClass);
+        criteriaQuery.select(builder.count(root));
+        addWhere(builder, criteriaQuery, root);
+        return repository.getEntityManager().createQuery(criteriaQuery).getSingleResult();

Review Comment:
   Added a new test that proof that getSingleResult return 0 if there are not items, so nothing to change here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan commented on PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#issuecomment-2687187282

   @fjtirado nice addition? Would it be possible to have it for jobs too?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "kie-ci3 (via GitHub)" <gi...@apache.org>.
kie-ci3 commented on PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#issuecomment-2684973718

   
   **PR job** `#15` was: **UNSTABLE**
   Possible explanation: This should be test failures
   
   
   <details>
   <summary><b>Reproducer</b></summary>
   
   
   
   build-chain build full_downstream  -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-apps -u https://github.com/apache/incubator-kie-kogito-apps/pull/2196 --skipParallelCheckout
   
   NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution
   
   </details>
   
   
   Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-apps-pr/job/PR-2196/15/display/redirect
   
   **Test results:**
   - PASSED: 1826
   - FAILED: 1
   
   Those are the test failures: 
   <details>
   <summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-apps-pr/job/PR-2196/15/testReport/org.kie.kogito.jobs.embedded/EmbeddedJobsServiceTest/testJobService/">org.kie.kogito.jobs.embedded.EmbeddedJobsServiceTest.testJobService</a></summary>
   java.util.ConcurrentModificationException<br/>	at java.base/java.util.ArrayList.forEach(ArrayList.java:1513)<br/>	at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092)<br/>	at org.kie.kogito.jobs.embedded.EmbeddedJobsServiceTest.testJobService(EmbeddedJobsServiceTest.java:99)<br/>	at java.base/java.lang.reflect.Method.invoke(Method.java:568)<br/>	at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:973)<br/>	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestMethod(QuarkusTestExtension.java:823)<br/>	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)<br/>	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)<br/>
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1968141664


##########
data-index/data-index-graphql/src/main/resources/basic.schema.graphqls:
##########
@@ -69,7 +69,6 @@ input ProcessDefinitionArgument {
     serviceUrl: StringArgument
     description: StringArgument
     type: StringArgument
-    metadata: JSON

Review Comment:
   Here we are preventing json properties to appear int he contextual graphql help in case the datastore does not support it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1971387869


##########
data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java:
##########
@@ -195,4 +191,21 @@ private List<Predicate> getRecursivePredicate(AttributeFilter<?> filter, Root<E>
                 .collect(toList());
     }
 
+    @Override
+    public long count() {
+        CriteriaBuilder builder = repository.getEntityManager().getCriteriaBuilder();
+        CriteriaQuery<Long> criteriaQuery = builder.createQuery(Long.class);
+        Root<E> root = criteriaQuery.from(entityClass);
+        criteriaQuery.select(builder.count(root));
+        addWhere(builder, criteriaQuery, root);
+        return repository.getEntityManager().createQuery(criteriaQuery).getSingleResult();
+    }
+
+    private <V> void addWhere(CriteriaBuilder builder, CriteriaQuery<V> criteriaQuery, Root<E> root) {
+        if (filters != null && !filters.isEmpty()) {
+            List<Predicate> predicates = getPredicates(builder, root);
+            criteriaQuery.where(predicates.toArray(new Predicate[] {}));

Review Comment:
   In fact, there it not need to collect items to List, they can be collected to array directly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1970495439


##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java:
##########
@@ -205,10 +228,22 @@ protected <K, T> List<T> executeAdvancedQueryForCache(StorageFetcher<K, T> cache
                 query.offset(offset);
             }
         }
-
         return query.execute();
     }
 
+    protected <K, T> long executeCount(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        return setupQuery(cache, env).count();
+    }
+
+    private <K, T> Query<T> setupQuery(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        Objects.requireNonNull(cache, "Cache not found");
+        String inputTypeName = ((GraphQLNamedType) env.getFieldDefinition().getArgument("where").getType()).getName();
+        Query<T> query = cache.query();
+        Map<String, Object> where = env.getArgument("where");
+        query.filter(GraphQLQueryParserRegistry.get().getParser(inputTypeName).apply(where));

Review Comment:
   I think the query object cannot be reused between different request. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1970477168


##########
data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java:
##########
@@ -195,4 +191,21 @@ private List<Predicate> getRecursivePredicate(AttributeFilter<?> filter, Root<E>
                 .collect(toList());
     }
 
+    @Override
+    public long count() {
+        CriteriaBuilder builder = repository.getEntityManager().getCriteriaBuilder();
+        CriteriaQuery<Long> criteriaQuery = builder.createQuery(Long.class);
+        Root<E> root = criteriaQuery.from(entityClass);
+        criteriaQuery.select(builder.count(root));
+        addWhere(builder, criteriaQuery, root);
+        return repository.getEntityManager().createQuery(criteriaQuery).getSingleResult();
+    }
+
+    private <V> void addWhere(CriteriaBuilder builder, CriteriaQuery<V> criteriaQuery, Root<E> root) {
+        if (filters != null && !filters.isEmpty()) {
+            List<Predicate> predicates = getPredicates(builder, root);
+            criteriaQuery.where(predicates.toArray(new Predicate[] {}));

Review Comment:
   I do not change the original code, but actually, it should predicates.toArray(new Predicate[predicates.size()])



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1970479176


##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java:
##########
@@ -205,10 +228,22 @@ protected <K, T> List<T> executeAdvancedQueryForCache(StorageFetcher<K, T> cache
                 query.offset(offset);
             }
         }
-
         return query.execute();
     }
 
+    protected <K, T> long executeCount(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        return setupQuery(cache, env).count();
+    }
+
+    private <K, T> Query<T> setupQuery(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        Objects.requireNonNull(cache, "Cache not found");

Review Comment:
    I did not change the original code, just moved it (so it appears in the review)  Env is never going to be null, so there is not need   to check it (I cannot think of an scenario where cache is null, but since the code was already there and was unrelated with the PR, I prefer to not change that, just in case)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1970495439


##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java:
##########
@@ -205,10 +228,22 @@ protected <K, T> List<T> executeAdvancedQueryForCache(StorageFetcher<K, T> cache
                 query.offset(offset);
             }
         }
-
         return query.execute();
     }
 
+    protected <K, T> long executeCount(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        return setupQuery(cache, env).count();
+    }
+
+    private <K, T> Query<T> setupQuery(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        Objects.requireNonNull(cache, "Cache not found");
+        String inputTypeName = ((GraphQLNamedType) env.getFieldDefinition().getArgument("where").getType()).getName();
+        Query<T> query = cache.query();
+        Map<String, Object> where = env.getArgument("where");
+        query.filter(GraphQLQueryParserRegistry.get().getParser(inputTypeName).apply(where));

Review Comment:
   I think the query object cannot be cached. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado merged PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "gmunozfe (via GitHub)" <gi...@apache.org>.
gmunozfe commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1970135789


##########
data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java:
##########
@@ -195,4 +191,21 @@ private List<Predicate> getRecursivePredicate(AttributeFilter<?> filter, Root<E>
                 .collect(toList());
     }
 
+    @Override
+    public long count() {
+        CriteriaBuilder builder = repository.getEntityManager().getCriteriaBuilder();
+        CriteriaQuery<Long> criteriaQuery = builder.createQuery(Long.class);
+        Root<E> root = criteriaQuery.from(entityClass);
+        criteriaQuery.select(builder.count(root));
+        addWhere(builder, criteriaQuery, root);
+        return repository.getEntityManager().createQuery(criteriaQuery).getSingleResult();

Review Comment:
   `getSingleResult` could return null. In that case, it would be better to return 0L, wdyt?



##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java:
##########
@@ -205,10 +228,22 @@ protected <K, T> List<T> executeAdvancedQueryForCache(StorageFetcher<K, T> cache
                 query.offset(offset);
             }
         }
-
         return query.execute();
     }
 
+    protected <K, T> long executeCount(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        return setupQuery(cache, env).count();
+    }
+
+    private <K, T> Query<T> setupQuery(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        Objects.requireNonNull(cache, "Cache not found");

Review Comment:
   Shouldn't we require that `env` is not null as well?
   `Objects.requireNonNull(env, "DataFetchingEnvironment cannot be null");`



##########
data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java:
##########
@@ -195,4 +191,21 @@ private List<Predicate> getRecursivePredicate(AttributeFilter<?> filter, Root<E>
                 .collect(toList());
     }
 
+    @Override
+    public long count() {
+        CriteriaBuilder builder = repository.getEntityManager().getCriteriaBuilder();
+        CriteriaQuery<Long> criteriaQuery = builder.createQuery(Long.class);
+        Root<E> root = criteriaQuery.from(entityClass);
+        criteriaQuery.select(builder.count(root));
+        addWhere(builder, criteriaQuery, root);
+        return repository.getEntityManager().createQuery(criteriaQuery).getSingleResult();
+    }
+
+    private <V> void addWhere(CriteriaBuilder builder, CriteriaQuery<V> criteriaQuery, Root<E> root) {
+        if (filters != null && !filters.isEmpty()) {
+            List<Predicate> predicates = getPredicates(builder, root);
+            criteriaQuery.where(predicates.toArray(new Predicate[] {}));

Review Comment:
   you can also use `criteriaQuery.where(predicates.toArray(Predicate[]::new));`
   but it's up to you, no big difference at all



##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java:
##########
@@ -205,10 +228,22 @@ protected <K, T> List<T> executeAdvancedQueryForCache(StorageFetcher<K, T> cache
                 query.offset(offset);
             }
         }
-
         return query.execute();
     }
 
+    protected <K, T> long executeCount(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        return setupQuery(cache, env).count();
+    }
+
+    private <K, T> Query<T> setupQuery(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        Objects.requireNonNull(cache, "Cache not found");
+        String inputTypeName = ((GraphQLNamedType) env.getFieldDefinition().getArgument("where").getType()).getName();
+        Query<T> query = cache.query();
+        Map<String, Object> where = env.getArgument("where");
+        query.filter(GraphQLQueryParserRegistry.get().getParser(inputTypeName).apply(where));

Review Comment:
   I'm wondering if we could make any performance optimization for same cache and env, but probably it's out of the scope of this feature and can be handle later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1970479176


##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java:
##########
@@ -205,10 +228,22 @@ protected <K, T> List<T> executeAdvancedQueryForCache(StorageFetcher<K, T> cache
                 query.offset(offset);
             }
         }
-
         return query.execute();
     }
 
+    protected <K, T> long executeCount(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        return setupQuery(cache, env).count();
+    }
+
+    private <K, T> Query<T> setupQuery(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        Objects.requireNonNull(cache, "Cache not found");

Review Comment:
   Same, I did not change the original code, just moved it (so it appears in the review)  Env is never going to be null, so there is not need   to check it (I cannot think of an scenario where cache is null, but since the code was already there and was unrelated with the PR, I prefer to not change that, just in case)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [Fix #2175]Adding count process intance and count user task queries [incubator-kie-kogito-apps]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #2196:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1971387358


##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java:
##########
@@ -205,10 +228,22 @@ protected <K, T> List<T> executeAdvancedQueryForCache(StorageFetcher<K, T> cache
                 query.offset(offset);
             }
         }
-
         return query.execute();
     }
 
+    protected <K, T> long executeCount(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        return setupQuery(cache, env).count();
+    }
+
+    private <K, T> Query<T> setupQuery(StorageFetcher<K, T> cache, DataFetchingEnvironment env) {
+        Objects.requireNonNull(cache, "Cache not found");

Review Comment:
   After taking another view, I decided to change the original code to not check for nulls that are not going to be null outside test contest and check for nulls that might actually be there (although they apparently not in current scenarios)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org