Fixed dependencies for DomainOwnership import

deploy_packages_to_gitea
Jens Pelzetter 2023-03-20 18:58:54 +01:00
parent cee7b5536b
commit 1701551fbc
4 changed files with 31 additions and 14 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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<ContentSection> {
@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<ContentSection> getEntityClass() {
return ContentSection.class;
}
@Override
protected Optional<ContentSection> 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);
}

View File

@ -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<Repository> {
@Inject
private DomainOwnershipImExporter domainOwnershipImExporter;
@Inject
private RepositoryRepository repositoryRepository;
@ -42,7 +47,7 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
@PostConstruct
@Override
protected void init() {
// Nothing
domainOwnershipImExporter.addRequiredEntities(Set.of(Repository.class));
}
@Override