Skip to content

Commit

Permalink
Change EntityDataWriterImpl to use groovy CompileStatic, without this…
Browse files Browse the repository at this point in the history
… a compile error was missed in the changes for PR #625, fix small issues from this
  • Loading branch information
jonesde committed Nov 29, 2023
1 parent e6135fa commit b4287f1
Showing 1 changed file with 11 additions and 4 deletions.
Expand Up @@ -14,6 +14,7 @@
package org.moqui.impl.entity

import groovy.json.JsonBuilder
import groovy.transform.CompileStatic
import org.moqui.entity.EntityValue
import org.moqui.util.ObjectUtilities

Expand All @@ -35,6 +36,7 @@ import java.time.format.DateTimeFormatter
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream

@CompileStatic
class EntityDataWriterImpl implements EntityDataWriter {
private final static Logger logger = LoggerFactory.getLogger(EntityDataWriterImpl.class)

Expand Down Expand Up @@ -284,7 +286,13 @@ class EntityDataWriterImpl implements EntityDataWriter {
int writer(Writer writer) {
if (dependentLevels > 0) efi.createAllAutoReverseManyRelationships()

LinkedHashSet<String> activeEntityNames = skipEntityNames.size() > 0 ? entityNames - skipEntityNames : entityNames
LinkedHashSet<String> activeEntityNames
if (skipEntityNames.size() == 0) {
activeEntityNames = entityNames
} else {
activeEntityNames = new LinkedHashSet<>(entityNames)
activeEntityNames.removeAll(skipEntityNames)
}
EntityDefinition singleEd = null
if (activeEntityNames.size() == 1) singleEd = efi.getEntityDefinition(activeEntityNames.first())

Expand All @@ -300,13 +308,12 @@ class EntityDataWriterImpl implements EntityDataWriter {
for (String en in activeEntityNames) {
EntityDefinition ed = efi.getEntityDefinition(en)
boolean useMaster = masterName != null && masterName.length() > 0 && ed.getMasterDefinition(masterName) != null
EntityFind ef = makeEntityFind(en)
ef.iterator().withCloseable ({
try (EntityListIterator eli = makeEntityFind(en).iterator()) {
EntityValue ev
while ((ev = eli.next()) != null) {
valuesWritten+= writeValue(ev, writer, useMaster)
}
});
}
}

endFile(writer)
Expand Down

0 comments on commit b4287f1

Please sign in to comment.