GopikaReghunath commented on code in PR #2328:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/2328#discussion_r3241244605


##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/query/GraphQLQueryMapper.java:
##########
@@ -229,6 +236,161 @@ private Function<Object, Stream<AttributeFilter<?>>> 
mapSubEntityArgument(String
         });
     }
 
+    private Function<Object, Stream<AttributeFilter<?>>> 
mapArrayArgument(String attribute, GraphQLInputObjectType arrayArgType) {
+        return argument -> {
+            Map<String, Object> argMap = (Map<String, Object>) argument;
+
+            // Get the element type from the "contains" field
+            GraphQLInputType containsFieldType = 
arrayArgType.getField("contains") != null ? 
arrayArgType.getField("contains").getType() : null;
+
+            if (containsFieldType == null) {
+                LOGGER.warn("Array argument type {} does not have a 'contains' 
field", arrayArgType.getName());
+                return Stream.empty();
+            }
+
+            // Unwrap the element type and get the parser for it
+            GraphQLType unwrappedType = unwrapNonNull(containsFieldType);
+            if (!(unwrappedType instanceof GraphQLInputObjectType)) {
+                LOGGER.warn("Contains field type is not an input object type: 
{}", simplePrint(unwrappedType));
+                return Stream.empty();
+            }
+
+            GraphQLInputObjectType elementType = (GraphQLInputObjectType) 
unwrappedType;
+            GraphQLQueryParser elementParser = new 
GraphQLQueryMapper().apply(elementType);
+
+            // Separate array operations from backward-compatible fields
+            Map<String, Object> backwardCompatFields = new 
java.util.HashMap<>();
+            List<Stream<AttributeFilter<?>>> arrayOpStreams = new 
java.util.ArrayList<>();
+
+            for (Map.Entry<String, Object> entry : argMap.entrySet()) {
+                String operation = entry.getKey();
+                Object value = entry.getValue();

Review Comment:
   done



##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/query/GraphQLInputObjectTypeMapper.java:
##########
@@ -108,7 +112,20 @@ private GraphQLInputType 
getInputTypeByField(GraphQLFieldDefinition field) {
                 return getInputObjectType("BooleanArgument");
             case "DateTime":
                 return getInputObjectType("DateArgument");
+            case "StringArray":
+                return getInputObjectType("StringArrayArgument");
             default:
+                // For array fields, try to use ArrayArgument type first
+                if (isArray) {
+                    String arrayTypeName = name + "ArrayArgument";

Review Comment:
   done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to