Skip to content

Commit

Permalink
#384 Codacy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jemacineiras committed Nov 20, 2023
1 parent f5a3d52 commit adf99bc
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/main/java/com/sngular/kloadgen/processor/SchemaProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@ private Object processNestedComplexTypes(final SchemaProcessorPOJO pojo, final S
}
return returnObject;
}
/* private void makeNonEmptyFieldValueMappingRequiered(final FieldValueMapping fieldValueMapping){
if ()
}
*/

private void makeFieldValueMappingRequiredAndNotNullable(final FieldValueMapping fieldValueMapping) {
makeFieldValueMappingRequired(fieldValueMapping);
final List<String> temporalFieldValueList = fieldValueMapping.getFieldValuesList();
Expand All @@ -172,27 +169,27 @@ private ArrayDeque<FieldValueMapping> calculateFieldsToProcess() {

ArrayDeque<FieldValueMapping> fieldToProcess;
final ArrayDeque<FieldValueMapping> initialFieldExpMappingsQueue = new ArrayDeque<>(fieldExprMappings);
fieldToProcess = new ArrayDeque<>(ListUtils.select(fieldExprMappings, fieldValueMapping -> shouldProcessField(fieldValueMapping, initialFieldExpMappingsQueue)));
fieldToProcess = new ArrayDeque<>(ListUtils.select(fieldExprMappings, fieldValueMapping -> shouldProcessField(fieldValueMapping, initialFieldExpMappingsQueue)));

if (fieldToProcess.isEmpty())
fieldToProcess = new ArrayDeque<>(ListUtils.select(fieldExprMappings, this::shouldProcessFieldIfIsNonRequiered));

if(fieldToProcess.isEmpty()) {
while (initialFieldExpMappingsQueue.size()>1){
if (fieldToProcess.isEmpty()) {
fieldToProcess = new ArrayDeque<>(ListUtils.select(fieldExprMappings, this::shouldProcessFieldIfIsNonRequired));
}
if (fieldToProcess.isEmpty()) {
while (initialFieldExpMappingsQueue.size() > 1) {
initialFieldExpMappingsQueue.removeFirst();
}
fieldToProcess = new ArrayDeque<>(initialFieldExpMappingsQueue);
}
return fieldToProcess;
}

private boolean shouldProcessFieldIfIsNonRequiered(final FieldValueMapping fieldValueMapping/*, final ArrayDeque<FieldValueMapping> initialFieldExpMappingsQueue*/){
private boolean shouldProcessFieldIfIsNonRequired(final FieldValueMapping fieldValueMapping/*, final ArrayDeque<FieldValueMapping> initialFieldExpMappingsQueue*/) {
boolean shouldProcess = false;
//final String[] fields = fieldValueMapping.getFieldName().split("\\.");
if (fieldValueMapping.getFieldValuesList().isEmpty()) {
fieldValueMapping.getFieldValuesList().remove("null");
} else {
shouldProcess=true;
shouldProcess = true;
}
return shouldProcess;
}
Expand Down

0 comments on commit adf99bc

Please sign in to comment.