Skip to content

Commit

Permalink
- Add rules to export of CatalogueItems (resolves #419)
Browse files Browse the repository at this point in the history
- Fix MultiFacetAware ID error on import of Folder with Metadata
  • Loading branch information
joe-crawford committed Jun 29, 2023
1 parent 75302d5 commit c54fbc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions mdm-core/grails-app/views/catalogueItem/_export.gson
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ json {
if (export.classifiers) classifiers tmpl.'/classifier/export'(export.classifiers)
if (export.metadata) metadata g.render(export.metadata)
if (export.annotations) annotations tmpl.'/annotation/export'(export.annotations)
if (export.rules) rules tmpl.'/rule/export'(export.rules)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import uk.ac.ox.softeng.maurodatamapper.core.facet.Rule
import uk.ac.ox.softeng.maurodatamapper.core.facet.RuleService
import uk.ac.ox.softeng.maurodatamapper.core.facet.SemanticLink
import uk.ac.ox.softeng.maurodatamapper.core.facet.SemanticLinkService
import uk.ac.ox.softeng.maurodatamapper.core.facet.rule.RuleRepresentation
import uk.ac.ox.softeng.maurodatamapper.core.model.facet.MultiFacetAware
import uk.ac.ox.softeng.maurodatamapper.core.rest.transport.model.CopyInformation
import uk.ac.ox.softeng.maurodatamapper.core.traits.domain.MultiFacetItemAware
Expand Down Expand Up @@ -127,31 +128,36 @@ trait MultiFacetAwareService<K extends MultiFacetAware> {
K checkFacetsAfterImportingMultiFacetAware(K multiFacetAware) {
if (multiFacetAware.metadata) {
multiFacetAware.metadata.each {
it.multiFacetAwareItemId = multiFacetAware.id
it.multiFacetAwareItem = multiFacetAware
it.createdBy = it.createdBy ?: multiFacetAware.createdBy
}
}
if (multiFacetAware.rules) {
multiFacetAware.rules.each {
it.multiFacetAwareItemId = multiFacetAware.id
it.multiFacetAwareItem = multiFacetAware
it.createdBy = it.createdBy ?: multiFacetAware.createdBy
if (it.ruleRepresentations) {
it.ruleRepresentations.each {RuleRepresentation representation ->
representation.createdBy = representation.createdBy ?: it.createdBy ?: multiFacetAware.createdBy
}
}
}
}
if (multiFacetAware.annotations) {
multiFacetAware.annotations.each {
it.multiFacetAwareItemId = multiFacetAware.id
it.multiFacetAwareItem = multiFacetAware
it.createdBy = it.createdBy ?: multiFacetAware.createdBy
}
}
if (multiFacetAware.semanticLinks) {
multiFacetAware.semanticLinks.each {
it.multiFacetAwareItemId = multiFacetAware.id
it.multiFacetAwareItem = multiFacetAware
it.createdBy = it.createdBy ?: multiFacetAware.createdBy
}
}
if (multiFacetAware.referenceFiles) {
multiFacetAware.referenceFiles.each {
it.multiFacetAwareItemId = multiFacetAware.id
it.multiFacetAwareItem = multiFacetAware
it.createdBy = it.createdBy ?: multiFacetAware.createdBy
}
}
Expand Down

0 comments on commit c54fbc8

Please sign in to comment.