-
Notifications
You must be signed in to change notification settings - Fork 7
[NAE-2261] SEARCH Node - fetch cases from mongo #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/7.0.0-rev10
Are you sure you want to change the base?
Changes from all commits
7fbe3f8
86272f6
9befc60
b7d12ff
3eb1459
bc581fa
c028008
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |||||||||||||||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||||||||||||||||
| import lombok.Data; | ||||||||||||||||
| import lombok.EqualsAndHashCode; | ||||||||||||||||
| import lombok.NonNull; | ||||||||||||||||
| import lombok.ToString; | ||||||||||||||||
|
Comment on lines
4
to
7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Remove unused import.
import lombok.Data;
import lombok.EqualsAndHashCode;
-import lombok.NonNull;
import lombok.ToString;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
|
|
||||||||||||||||
| import java.io.Serial; | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,8 +51,6 @@ public abstract class ElasticCase implements Serializable { | |
|
|
||
| private String authorUsername; | ||
|
|
||
| private List<ImmediateField> immediateData; | ||
|
|
||
| private Map<String, DataField> dataSet; | ||
|
|
||
| private Set<String> taskIds; | ||
|
|
@@ -81,6 +79,8 @@ public abstract class ElasticCase implements Serializable { | |
|
|
||
| private Map<String, String> tags; | ||
|
|
||
| private NodeInfo nodeInfo; | ||
|
|
||
|
Comment on lines
+82
to
+83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find where nodeInfo is set/used
echo "=== Searching for nodeInfo usage patterns ==="
rg -n 'nodeInfo' --type=java -C2Repository: netgrif/application-engine Length of output: 760 🏁 Script executed: #!/bin/bash
# Find where NodeInfo is instantiated
echo "=== Searching for NodeInfo instantiation ==="
rg -n 'new NodeInfo\(' --type=java -C3Repository: netgrif/application-engine Length of output: 114 🏁 Script executed: #!/bin/bash
# Search for setNodeInfo method calls
echo "=== Searching for setNodeInfo calls ==="
rg -n 'setNodeInfo' --type=java -C2Repository: netgrif/application-engine Length of output: 109 🏁 Script executed: #!/bin/bash
# Find NodeInfo class definition
echo "=== Searching for NodeInfo class definition ==="
rg -n 'class NodeInfo|interface NodeInfo' --type=java -C3Repository: netgrif/application-engine Length of output: 1019 🏁 Script executed: #!/bin/bash
# Check ElasticCase for getter/setter methods related to nodeInfo
echo "=== Searching for nodeInfo getter/setter in ElasticCase ==="
rg -n 'getNodeInfo|setNodeInfo|nodeInfo' nae-object-library/src/main/java/com/netgrif/application/engine/objects/elastic/domain/ElasticCase.java -C1Repository: netgrif/application-engine Length of output: 171 🏁 Script executed: #!/bin/bash
# Search for any assignment to nodeInfo field
echo "=== Searching for nodeInfo field assignments ==="
rg -n 'this\.nodeInfo\s*=' --type=java -C2Repository: netgrif/application-engine Length of output: 118 🏁 Script executed: #!/bin/bash
# Look at the complete ElasticCase file around the nodeInfo field and constructor
echo "=== ElasticCase constructor and nodeInfo field context ==="
cat -n nae-object-library/src/main/java/com/netgrif/application/engine/objects/elastic/domain/ElasticCase.java | sed -n '78,140p'Repository: netgrif/application-engine Length of output: 4641 Initialize The 🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Kovy95 shouldnt be it at least updated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| public ElasticCase(Case useCase) { | ||
| id = useCase.getStringId(); | ||
| lastModified = Timestamp.valueOf(useCase.getLastModified()).getTime(); | ||
|
|
@@ -108,7 +108,6 @@ public ElasticCase(Case useCase) { | |
| users = deepCopy(useCase.getUsers()); | ||
| userRefs = deepCopy(useCase.getUserRefs()); | ||
| dataSet = new HashMap<>(); | ||
| immediateData = useCase.getImmediateData() == null ? Collections.emptyList() : useCase.getImmediateData().stream().map(ImmediateField::new).collect(Collectors.toList()); | ||
| } | ||
|
|
||
| public void update(ElasticCase useCase) { | ||
|
|
@@ -133,9 +132,6 @@ public void update(ElasticCase useCase) { | |
| dataSet = useCase.getDataSet() == null ? new HashMap<>() : useCase.getDataSet().entrySet().stream() | ||
| .filter(entry -> entry.getValue() != null) | ||
| .collect(Collectors.toMap(Map.Entry::getKey, entry -> CopyConstructorUtil.copy(entry.getValue().getClass(), entry.getValue()))); | ||
| immediateData = useCase.getImmediateData() == null ? new ArrayList<>() : useCase.getImmediateData().stream() | ||
| .map(field -> new ImmediateField(field.getStringId(), new I18nString(field.getName()), field.getType())) | ||
| .collect(Collectors.toList()); | ||
| } | ||
|
|
||
| private static Map<String, Map<String, Boolean>> deepCopy(Map<String, Map<String, Boolean>> map) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
| @Data | ||
| @NoArgsConstructor | ||
| @EqualsAndHashCode(callSuper = true) | ||
| public abstract class I18nField extends TextField { | ||
| public abstract class I18nField extends DataField { | ||
|
|
||
| public String[] keyValue; | ||
|
|
||
|
|
@@ -26,16 +26,15 @@ public I18nField(I18nField field) { | |
| } | ||
|
|
||
| public I18nField(Set<String> keys, Set<String> values, Map<String, String> translations) { | ||
| super(new String[0]); | ||
| super(values.toArray(new String[0])); | ||
| this.keyValue = keys.toArray(new String[0]); | ||
| this.textValue = values.toArray(new String[0]); | ||
| this.translations = translations; | ||
| } | ||
|
|
||
| @Override | ||
| public Object getValue() { | ||
| if (textValue != null && textValue.length > 0) { | ||
| return new I18nString(textValue[0], translations); | ||
| if (fulltextValue != null && fulltextValue.length > 0) { | ||
| return new I18nString(fulltextValue[0], translations); | ||
| } | ||
|
Comment on lines
35
to
38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's read the I18nField.java file to see its full structure
find . -type f -name "I18nField.java" | head -5Repository: netgrif/application-engine Length of output: 402 🏁 Script executed: # Search for fulltextValue usage across the codebase to understand the pattern
rg -n "fulltextValue" --type java | head -30Repository: netgrif/application-engine Length of output: 2581 🏁 Script executed: # Let's specifically look at CaseField.java since the learning mentions it has a related pattern
find . -type f -name "CaseField.java" | head -3Repository: netgrif/application-engine Length of output: 402 🏁 Script executed: # Read the I18nField.java file in elastic domain
cat -n ./nae-object-library/src/main/java/com/netgrif/application/engine/objects/elastic/domain/I18nField.javaRepository: netgrif/application-engine Length of output: 1606 🏁 Script executed: # Read the CaseField.java file to understand the separate field pattern
cat -n ./nae-object-library/src/main/java/com/netgrif/application/engine/objects/elastic/domain/CaseField.javaRepository: netgrif/application-engine Length of output: 1133 🏁 Script executed: # Check how I18nField is populated/instantiated
rg -n "new I18nField|I18nField(" -A 5 --type java | head -50Repository: netgrif/application-engine Length of output: 168 🏁 Script executed: # Fix regex syntax to search for I18nField instantiation
rg "I18nField\(" -A 3 --type java | head -50Repository: netgrif/application-engine Length of output: 6140 🏁 Script executed: # Find concrete implementations/subclasses of I18nField
rg "extends I18nField|class.*I18nField" --type javaRepository: netgrif/application-engine Length of output: 783 🏁 Script executed: # Search for tests related to I18nField
find . -type f -name "*I18nField*Test*.java" -o -name "*Test*I18nField*.java"Repository: netgrif/application-engine Length of output: 52 🏁 Script executed: # Check DataField to see how it handles single vs multi-value
cat -n ./nae-object-library/src/main/java/com/netgrif/application/engine/objects/elastic/domain/DataField.javaRepository: netgrif/application-engine Length of output: 1267 🏁 Script executed: # Check if I18nField has abstract methods that might clarify intent
cat -n ./nae-object-library/src/main/java/com/netgrif/application/engine/objects/elastic/domain/I18nField.javaRepository: netgrif/application-engine Length of output: 1606 🏁 Script executed: # Search for concrete implementations of the elastic I18nField
rg "class.*extends.*I18nField" -A 3 --type java | grep -A 3 "elastic"Repository: netgrif/application-engine Length of output: 685 🏁 Script executed: # Check how I18nField is actually used in the codebase (elastic domain variant)
rg "I18nField\(.*Set" --type java -A 2 | head -20Repository: netgrif/application-engine Length of output: 1058 🏁 Script executed: # Look for actual tests of the elastic domain module
find ./nae-object-library -type f -name "*Test*.java" | xargs grep -l "I18nField" 2>/dev/null | head -5Repository: netgrif/application-engine Length of output: 52 Address cardinality mismatch between constructor design and The constructor accepts 🤖 Prompt for AI Agents |
||
| return null; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| package com.netgrif.application.engine.objects.elastic.domain; | ||
|
|
||
| import com.netgrif.application.engine.objects.petrinet.domain.I18nString; | ||
| import lombok.Data; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.NoArgsConstructor; | ||
|
|
@@ -11,34 +10,22 @@ | |
| @Data | ||
| @NoArgsConstructor | ||
| @EqualsAndHashCode(callSuper = true) | ||
| public abstract class MapField extends TextField { | ||
| public abstract class MapField extends DataField { | ||
|
|
||
| public String[] keyValue; | ||
| public Map<String, I18nString> keyValueTranslations; | ||
|
|
||
| public MapField(MapField field) { | ||
| super(field); | ||
| this.keyValue = field.keyValue == null ? null : Arrays.copyOf(field.keyValue, field.keyValue.length); | ||
| this.keyValueTranslations = field.keyValueTranslations == null ? null | ||
| : field.keyValueTranslations.entrySet().stream() | ||
| .collect(Collectors.toMap(Map.Entry::getKey, entry -> new I18nString(entry.getValue()))); | ||
| public MapField(Map.Entry<String, Collection<String>> valuePair) { | ||
| this(List.of(valuePair)); | ||
| } | ||
|
|
||
| public MapField(Map.Entry<String, I18nString> valueTranslationPair) { | ||
| this(List.of(valueTranslationPair)); | ||
| } | ||
|
|
||
| public MapField(List<Map.Entry<String, I18nString>> valueTranslationPairs) { | ||
| public MapField(List<Map.Entry<String, Collection<String>>> valuePairs) { | ||
| super(new String[0]); | ||
| this.keyValue = new String[valueTranslationPairs.size()]; | ||
| this.keyValue = new String[valuePairs.size()]; | ||
| List<String> values = new ArrayList<>(); | ||
| this.keyValueTranslations = new HashMap<>(); | ||
| for (int i = 0; i < valueTranslationPairs.size(); i++) { | ||
| this.keyValue[i] = valueTranslationPairs.get(i).getKey(); | ||
| values.addAll(I18nStringUtils.collectTranslations(valueTranslationPairs.get(i).getValue())); | ||
| this.keyValueTranslations.put(valueTranslationPairs.get(i).getKey(), valueTranslationPairs.get(i).getValue()); | ||
| for (int i = 0; i < valuePairs.size(); i++) { | ||
| keyValue[i] = valuePairs.get(i).getKey(); | ||
| values.addAll(valuePairs.get(i).getValue()); | ||
|
Comment on lines
+21
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Null-safe aggregation of entry values to prevent NPEs.
🔧 Proposed fix for (int i = 0; i < valuePairs.size(); i++) {
keyValue[i] = valuePairs.get(i).getKey();
- values.addAll(valuePairs.get(i).getValue());
+ Collection<String> entryValues = valuePairs.get(i).getValue();
+ if (entryValues != null) {
+ values.addAll(entryValues);
+ }
}🤖 Prompt for AI Agents |
||
| } | ||
| this.textValue = values.toArray(new String[0]); | ||
| this.fulltextValue = values.toArray(new String[0]); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.netgrif.application.engine.objects.elastic.domain; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.io.Serial; | ||
| import java.io.Serializable; | ||
|
|
||
| @Data | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| public class NodeInfo implements Serializable { | ||
|
|
||
| @Serial | ||
| private static final long serialVersionUID = 7454569786379865L; | ||
|
|
||
| private String nodeHost; | ||
| private int nodePort; | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 2089
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 292
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 240
🏁 Script executed:
# Read the I18nStringUtils file to see the collectTranslations implementation cat -n nae-object-library/src/main/java/com/netgrif/application/engine/objects/elastic/domain/I18nStringUtils.javaRepository: netgrif/application-engine
Length of output: 786
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 1830
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 240
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 52
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 1025
🏁 Script executed:
Repository: netgrif/application-engine
Length of output: 1771
🏁 Script executed:
# Check the git history of this specific method to understand its evolution git log --oneline -n 20 -- application-engine/src/main/java/com/netgrif/application/engine/elastic/service/ElasticCaseMappingService.javaRepository: netgrif/application-engine
Length of output: 150
Inconsistent error handling: missing options keys are silently converted to empty translations.
The code at line 98 does not validate that all keys from
mapValuesexist in theoptionsmap. WhileI18nStringUtils.collectTranslations(null)handles null gracefully by returning an empty list, this pattern is inconsistent with the error handling established elsewhere in this class. Other methods (e.g., lines 163, 180, 194) log errors when encountering data inconsistencies. Consider either adding validation to ensure all keys are present in the options map, or logging a warning whenoptions.get(key)returns null to make data issues visible during debugging.🤖 Prompt for AI Agents