Skip to content

Commit

Permalink
Validate and do not save when checking imported Folder associations
Browse files Browse the repository at this point in the history
  • Loading branch information
adjl committed Mar 25, 2022
1 parent f00324c commit 7e38b42
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -644,17 +644,11 @@ class FolderService extends ContainerService<Folder> {
}

void checkImportedFolderAssociations(User importingUser, Folder folder) {
// Traverse breadth-first to avoid recursion
List<Folder> folders = [folder]
for (int i = 0; i < folders.size(); i++) {
folders[i].checkPath()
folders[i].createdBy = importingUser.emailAddress
if (!folders[i].id) save(folders[i], validate: false) // Skip validation to avoid error on null folderId/multiFacetAwareItemId
checkFacetsAfterImportingMultiFacetAware(folders[i])
folders[i].childFolders?.each {
if (!folders.contains(it)) folders << it
}
}
folder.checkPath()
folder.createdBy = importingUser.emailAddress
folder.validate()
checkFacetsAfterImportingMultiFacetAware(folder)
folder.childFolders?.each { checkImportedFolderAssociations(importingUser, it) }
log.debug('Folder associations checked')
}
}

0 comments on commit 7e38b42

Please sign in to comment.