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