Skip to content
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

MC-9714 Import Folders as JSON (no Models) #297

Draft
wants to merge 17 commits into
base: develop
Choose a base branch
from
Draft

Conversation

adjl
Copy link
Contributor

@adjl adjl commented Mar 21, 2022

No description provided.

@adjl adjl requested a review from olliefreeman March 21, 2022 15:13
Copy link
Contributor

@olliefreeman olliefreeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully the review helps

As before please examine uk.ac.ox.softeng.maurodatamapper.datamodel.item.DataClassService#checkImportedDataClassAssociations(uk.ac.ox.softeng.maurodatamapper.security.User, uk.ac.ox.softeng.maurodatamapper.datamodel.DataModel, uk.ac.ox.softeng.maurodatamapper.datamodel.item.DataClass, boolean) and follow what it does and how it recurses in the child dataclasses .. the same needs to happen for folders... you do not need to do fullSortOfChildren

@@ -183,7 +183,7 @@ class FolderService extends ContainerService<Folder> {
(folder as GormEntity).save(saveArgs)
sessionFactory.currentSession.flush()
} else {
(folder as GormEntity).save(args)
(folder as GormEntity).save(saveArgs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary change as the args are the same, the only reason for the save args is to allow removal of the flush arg whilst keeping args immutable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do NOT save here, the reason for your error is because your save is triggering a downstream save of the children, you also havent called validate which means the beforeValidate method will not have run which will also mean certain required fields wont have been populated. all we are doing is checking the associations are correct NOT to save. If you look at the other methods which do checking associations we do not save. During importing (as with most other endpoints) the only time save is called is from the controller AFTER everything ahs been saved and validated.

Please use an each closure, its cleaner.

also you need to call recurse this call into each of its child folders and their child folder etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got rid of saving. However, FolderJsonImporterServiceSpec.FI06 - FI08 start failing because multiFacetAwareItemId is now null.

E.g., for metadata:

2022-03-25 14:08:41,955 [est worker] ERROR u.a.o.s.maurodatamapper.util.GormUtils   : Errors validating domain: Folder
Errors validating domain: Folder
2022-03-25 14:08:41,970 [est worker] ERROR u.a.o.s.maurodatamapper.util.GormUtils   : Property [multiFacetAwareItemId] of class [class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata] cannot be null
Property [multiFacetAwareItemId] of class [class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata] cannot be null
2022-03-25 14:08:41,971 [est worker] ERROR u.a.o.s.maurodatamapper.util.GormUtils   : Property [multiFacetAwareItemId] of class [class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata] cannot be null
Property [multiFacetAwareItemId] of class [class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata] cannot be null
2022-03-25 14:08:41,971 [est worker] ERROR u.a.o.s.maurodatamapper.util.GormUtils   : Property [multiFacetAwareItemId] of class [class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata] cannot be null
Property [multiFacetAwareItemId] of class [class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata] cannot be null
2022-03-25 14:08:41,980 [est worker] WARN  u.a.o.s.m.test.MdmSpecification          : --- FolderJsonImporterServiceSpec --- FI06 : test import Folder with metadata >>> 166 ms ---

Domain object is not valid. Has 3 errors:
- Field error in object 'uk.ac.ox.softeng.maurodatamapper.core.container.Folder' on field 'metadata[0].multiFacetAwareItemId': rejected value [null]; codes [uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata[0].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata[0].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.java.util.UUID,metadata.multiFacetAwareItemId.validator.error,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata[0].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata[0].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,metadata.multiFacetAwareItemId.default.null.message,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,default.null.message.metadata[0].multiFacetAwareItemId,default.null.message.metadata.multiFacetAwareItemId,default.null.message.multiFacetAwareItemId,default.null.message.java.util.UUID,default.null.message]; arguments [multiFacetAwareItemId,class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata,null]; default message [Property [{0}] of class [{1}] with value [{2}] does not pass custom validation]
- Field error in object 'uk.ac.ox.softeng.maurodatamapper.core.container.Folder' on field 'metadata[1].multiFacetAwareItemId': rejected value [null]; codes [uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata[1].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata[1].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.java.util.UUID,metadata.multiFacetAwareItemId.validator.error,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata[1].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata[1].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,metadata.multiFacetAwareItemId.default.null.message,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,default.null.message.metadata[1].multiFacetAwareItemId,default.null.message.metadata.multiFacetAwareItemId,default.null.message.multiFacetAwareItemId,default.null.message.java.util.UUID,default.null.message]; arguments [multiFacetAwareItemId,class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata,null]; default message [Property [{0}] of class [{1}] with value [{2}] does not pass custom validation]
- Field error in object 'uk.ac.ox.softeng.maurodatamapper.core.container.Folder' on field 'metadata[2].multiFacetAwareItemId': rejected value [null]; codes [uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata[2].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata[2].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.java.util.UUID,metadata.multiFacetAwareItemId.validator.error,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata[2].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata[2].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,metadata.multiFacetAwareItemId.default.null.message,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,default.null.message.metadata[2].multiFacetAwareItemId,default.null.message.metadata.multiFacetAwareItemId,default.null.message.multiFacetAwareItemId,default.null.message.java.util.UUID,default.null.message]; arguments [multiFacetAwareItemId,class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata,null]; default message [Property [{0}] of class [{1}] with value [{2}] does not pass custom validation]

org.spockframework.util.InternalSpockError: Domain object is not valid. Has 3 errors:
- Field error in object 'uk.ac.ox.softeng.maurodatamapper.core.container.Folder' on field 'metadata[0].multiFacetAwareItemId': rejected value [null]; codes [uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata[0].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata[0].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.java.util.UUID,metadata.multiFacetAwareItemId.validator.error,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata[0].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata[0].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,metadata.multiFacetAwareItemId.default.null.message,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[0].multiFacetAwareItemId,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,default.null.message.metadata[0].multiFacetAwareItemId,default.null.message.metadata.multiFacetAwareItemId,default.null.message.multiFacetAwareItemId,default.null.message.java.util.UUID,default.null.message]; arguments [multiFacetAwareItemId,class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata,null]; default message [Property [{0}] of class [{1}] with value [{2}] does not pass custom validation]
- Field error in object 'uk.ac.ox.softeng.maurodatamapper.core.container.Folder' on field 'metadata[1].multiFacetAwareItemId': rejected value [null]; codes [uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata[1].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata[1].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.java.util.UUID,metadata.multiFacetAwareItemId.validator.error,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata[1].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata[1].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,metadata.multiFacetAwareItemId.default.null.message,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[1].multiFacetAwareItemId,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,default.null.message.metadata[1].multiFacetAwareItemId,default.null.message.metadata.multiFacetAwareItemId,default.null.message.multiFacetAwareItemId,default.null.message.java.util.UUID,default.null.message]; arguments [multiFacetAwareItemId,class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata,null]; default message [Property [{0}] of class [{1}] with value [{2}] does not pass custom validation]
- Field error in object 'uk.ac.ox.softeng.maurodatamapper.core.container.Folder' on field 'metadata[2].multiFacetAwareItemId': rejected value [null]; codes [uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata[2].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.validator.error,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata[2].multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.multiFacetAwareItemId,metadata.multiFacetAwareItemId.validator.error.java.util.UUID,metadata.multiFacetAwareItemId.validator.error,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata[2].multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata.multiFacetAwareItemId.default.null.message,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata[2].multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.metadata.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.multiFacetAwareItemId,metadata.multiFacetAwareItemId.default.null.message.java.util.UUID,metadata.multiFacetAwareItemId.default.null.message,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata[2].multiFacetAwareItemId,default.null.message.uk.ac.ox.softeng.maurodatamapper.core.container.Folder.metadata.multiFacetAwareItemId,default.null.message.metadata[2].multiFacetAwareItemId,default.null.message.metadata.multiFacetAwareItemId,default.null.message.multiFacetAwareItemId,default.null.message.java.util.UUID,default.null.message]; arguments [multiFacetAwareItemId,class uk.ac.ox.softeng.maurodatamapper.core.facet.Metadata,null]; default message [Property [{0}] of class [{1}] with value [{2}] does not pass custom validation]

This is why I thought to save here, to generate the multiFacetAware.ids needed when checking facets. What is the proper thing to do here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to add, FolderJsonImporterServiceSpec.FI09 also starts to fail with the following:

object references an unsaved transient instance - save the transient instance before flushing: uk.ac.ox.softeng.maurodatamapper.core.container.Folder; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: uk.ac.ox.softeng.maurodatamapper.core.container.Folder
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: uk.ac.ox.softeng.maurodatamapper.core.container.Folder; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: uk.ac.ox.softeng.maurodatamapper.core.container.Folder
	at app//org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:237)
	at app//org.grails.orm.hibernate.GrailsHibernateTemplate.convertHibernateAccessException(GrailsHibernateTemplate.java:717)
	at app//org.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:301)
	at app//org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:241)
	at app//org.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:120)
	at app//org.grails.orm.hibernate.AbstractHibernateGormValidationApi.validate(AbstractHibernateGormValidationApi.groovy:78)
	at app//org.grails.orm.hibernate.AbstractHibernateGormValidationApi.validate(AbstractHibernateGormValidationApi.groovy:51)
	at app//org.grails.orm.hibernate.AbstractHibernateGormValidationApi.validate(AbstractHibernateGormValidationApi.groovy:50)
	at app//org.grails.datastore.gorm.GormValidateable$Trait$Helper.validate(GormValidateable.groovy:97)
	at app//uk.ac.ox.softeng.maurodatamapper.core.container.FolderService.$tt__checkImportedFolderAssociations(FolderService.groovy:649)
	at uk.ac.ox.softeng.maurodatamapper.core.container.FolderService.checkImportedFolderAssociations_closure48(FolderService.groovy)
	at app//groovy.lang.Closure.call(Closure.java:412)
	at app//groovy.lang.Closure.call(Closure.java:428)
	at app//grails.gorm.transactions.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:94)
	at app//org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
	at app//grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:91)
	at app//uk.ac.ox.softeng.maurodatamapper.core.container.provider.importer.DataBindFolderImporterProviderService.bindMapToFolder(DataBindFolderImporterProviderService.groovy:64)
	at app//uk.ac.ox.softeng.maurodatamapper.core.container.provider.importer.FolderJsonImporterService.importFolder(FolderJsonImporterService.groovy:53)
	at app//uk.ac.ox.softeng.maurodatamapper.core.container.provider.importer.DataBindFolderImporterProviderService.importDomain(DataBindFolderImporterProviderService.groovy:47)
	at app//uk.ac.ox.softeng.maurodatamapper.core.container.test.provider.BaseFolderImporterServiceSpec.importFolder(BaseFolderImporterServiceSpec.groovy:86)
	at app//uk.ac.ox.softeng.maurodatamapper.core.container.test.provider.BaseFolderImporterServiceSpec.importFolder(BaseFolderImporterServiceSpec.groovy:96)
	at app//uk.ac.ox.softeng.maurodatamapper.core.container.provider.importer.FolderJsonImporterServiceSpec.$tt__$spock_feature_3_7(FolderJsonImporterServiceSpec.groovy:132)
	at uk.ac.ox.softeng.maurodatamapper.core.container.provider.importer.FolderJsonImporterServiceSpec.FI09 : test import Folder with child Folders_closure10(FolderJsonImporterServiceSpec.groovy)

class FolderImporterProviderServiceParameters implements ImporterProviderServiceParameters {
@ImportParameterConfig(
displayName = 'Parent Folder',
description = 'The parent folder into which the Model/s should be imported.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix description please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

description = 'The parent folder into which the Model/s should be imported.',
order = 0,
group = @ImportGroupConfig(
name = 'Model',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix name please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@adjl adjl force-pushed the feature/mc-9714 branch from 9ad71b6 to 8fb106e Compare March 25, 2022 14:21
@adjl adjl changed the title Import Folders as JSON (no Models) MC-9714 Import Folders as JSON (no Models) Mar 25, 2022
@adjl adjl force-pushed the feature/mc-9714 branch from 8fb106e to 7e38b42 Compare March 25, 2022 16:17
@adjl adjl force-pushed the feature/mc-9714 branch from 7e38b42 to 757260a Compare April 13, 2022 14:05
@@ -128,18 +128,21 @@ trait MultiFacetAwareService<K extends MultiFacetAware> {
if (multiFacetAware.metadata) {
multiFacetAware.metadata.each {
it.multiFacetAwareItemId = multiFacetAware.id
Copy link
Contributor Author

@adjl adjl Apr 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: multiFacetAwareItemId cannot be null. How do you ensure that an object has an ID without saving?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants