diff --git a/ccm-cms/package-lock.json b/ccm-cms/package-lock.json index 346105c78..a9dd1a8e3 100644 --- a/ccm-cms/package-lock.json +++ b/ccm-cms/package-lock.json @@ -1,12 +1,12 @@ { "name": "@librecms/ccm-cms", - "version": "7.0.0-SNAPSHOT.2023-03-13T190250", + "version": "7.0.0-SNAPSHOT.2023-03-20T173612", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@librecms/ccm-cms", - "version": "7.0.0-SNAPSHOT.2023-03-13T190250", + "version": "7.0.0-SNAPSHOT.2023-03-20T173612", "license": "LGPL-3.0-or-later", "dependencies": { "@tiptap/core": "^2.0.0-beta.127", diff --git a/ccm-cms/package.json b/ccm-cms/package.json index 896c0c58c..03b3ecc07 100644 --- a/ccm-cms/package.json +++ b/ccm-cms/package.json @@ -1,6 +1,6 @@ { "name": "@librecms/ccm-cms", - "version": "7.0.0-SNAPSHOT.2023-03-13T190250", + "version": "7.0.0-SNAPSHOT.2023-03-20T173612", "description": "JavaScript stuff for ccm-cms", "main": "target/generated-resources/assets/@content-sections/cms-admin.js", "types": "target/generated-resources/assets/@content-sections/cms-admin.d.ts", diff --git a/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionImExporter.java b/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionImExporter.java index 757ce2d6d..668e9a348 100644 --- a/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionImExporter.java +++ b/ccm-cms/src/main/java/org/librecms/contentsection/ContentSectionImExporter.java @@ -19,6 +19,8 @@ package org.librecms.contentsection; import org.libreccm.categorization.Category; +import org.libreccm.categorization.DomainOwnership; +import org.libreccm.categorization.DomainOwnershipImExporter; import org.libreccm.core.ResourceType; import org.libreccm.imexport.AbstractEntityImExporter; import org.libreccm.imexport.Processes; @@ -31,6 +33,7 @@ import java.util.Set; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; +import javax.enterprise.inject.Any; import javax.inject.Inject; /** @@ -42,6 +45,11 @@ import javax.inject.Inject; public class ContentSectionImExporter extends AbstractEntityImExporter { + @Inject + @Any + @Processes(DomainOwnership.class) + private DomainOwnershipImExporter domainOwnershipImExporter; + @Inject private ContentSectionRepository sectionRepository; @@ -57,13 +65,17 @@ public class ContentSectionImExporter Workflow.class ) ); + + domainOwnershipImExporter.addRequiredEntities( + Set.of(ContentSection.class) + ); } @Override public Class getEntityClass() { return ContentSection.class; } - + @Override protected Optional findExistingEntity(final String uuid) { return sectionRepository.findByUuid(uuid); @@ -73,7 +85,7 @@ public class ContentSectionImExporter protected void saveImportedEntity(final ContentSection entity) { sectionRepository.save(entity); } - + @Override protected void updateExistingEntity( final ContentSection existingEntity, final ContentSection importedEntity @@ -84,34 +96,34 @@ public class ContentSectionImExporter )) { existingEntity.setDisplayName(importedEntity.getDisplayName()); } - + if (!Objects.equals( existingEntity.getTitle(), importedEntity.getTitle() )) { syncLocalizedStrings( - importedEntity.getTitle(), + importedEntity.getTitle(), existingEntity.getTitle() ); } - + if (!Objects.equals( existingEntity.getDescription(), importedEntity.getDescription() )) { syncLocalizedStrings( - importedEntity.getDescription(), + importedEntity.getDescription(), existingEntity.getDescription() ); } - + if (!Objects.equals( existingEntity.getCreated(), importedEntity.getCreated() )) { existingEntity.setCreated(importedEntity.getCreated()); } - + if (!Objects.equals( existingEntity.getApplicationType(), importedEntity.getApplicationType() @@ -120,14 +132,14 @@ public class ContentSectionImExporter importedEntity.getApplicationType() ); } - + if (!Objects.equals( existingEntity.getPrimaryUrl(), importedEntity.getPrimaryUrl() )) { existingEntity.setPrimaryUrl(importedEntity.getPrimaryUrl()); } - + sectionRepository.save(existingEntity); } diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/RepositoryImExporter.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/RepositoryImExporter.java index e7eb3e1ea..3c6b54701 100644 --- a/ccm-docrepo/src/main/java/org/libreccm/docrepo/RepositoryImExporter.java +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/RepositoryImExporter.java @@ -18,11 +18,13 @@ */ package org.libreccm.docrepo; +import org.libreccm.categorization.DomainOwnershipImExporter; import org.libreccm.imexport.AbstractEntityImExporter; import org.libreccm.imexport.Processes; import java.util.Objects; import java.util.Optional; +import java.util.Set; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; @@ -35,6 +37,9 @@ import javax.inject.Inject; @RequestScoped @Processes(Repository.class) public class RepositoryImExporter extends AbstractEntityImExporter { + + @Inject + private DomainOwnershipImExporter domainOwnershipImExporter; @Inject private RepositoryRepository repositoryRepository; @@ -42,7 +47,7 @@ public class RepositoryImExporter extends AbstractEntityImExporter { @PostConstruct @Override protected void init() { - // Nothing + domainOwnershipImExporter.addRequiredEntities(Set.of(Repository.class)); } @Override