Improved handling of required entities in ImExporters.
parent
72ee9fe032
commit
cbca30d705
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@librecms/ccm-cms",
|
||||
"version": "7.0.0-SNAPSHOT.2022-10-31T082859",
|
||||
"version": "7.0.0-SNAPSHOT.2022-11-07T181703",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@librecms/ccm-cms",
|
||||
"version": "7.0.0-SNAPSHOT.2022-10-31T082859",
|
||||
"version": "7.0.0-SNAPSHOT.2022-11-07T181703",
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@tiptap/core": "^2.0.0-beta.127",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@librecms/ccm-cms",
|
||||
"version": "7.0.0-SNAPSHOT.2022-10-31T082859",
|
||||
"version": "7.0.0-SNAPSHOT.2022-11-07T181703",
|
||||
"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",
|
||||
|
|
|
|||
|
|
@ -18,14 +18,17 @@
|
|||
*/
|
||||
package org.librecms.contentsection;
|
||||
|
||||
import org.libreccm.categorization.CategorizationImExporter;
|
||||
import org.libreccm.categorization.Category;
|
||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.security.PermissionImExporter;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
|
|
@ -40,16 +43,28 @@ public abstract class AbstractContentItemImExporter<T extends ContentItem>
|
|||
@Inject
|
||||
private ContentItemRepository itemRepository;
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
||||
entities.add(Category.class);
|
||||
entities.add(ContentSection.class);
|
||||
entities.add(ContentType.class);
|
||||
@Inject
|
||||
private CategorizationImExporter categorizationImExporter;
|
||||
|
||||
return entities;
|
||||
@Inject
|
||||
private PermissionImExporter permissionImExporter;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
Category.class,
|
||||
ContentSection.class,
|
||||
ContentType.class
|
||||
)
|
||||
);
|
||||
categorizationImExporter.addRequiredEntities(Set.of(getEntityClass()));
|
||||
permissionImExporter.addRequiredEntities(Set.of(getEntityClass()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void saveImportedEntity(final T entity) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.librecms.lifecycle.LifecycleDefinition;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -45,19 +46,22 @@ public class ContentSectionImExporter
|
|||
@Inject
|
||||
private ContentSectionRepository sectionRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public Class<ContentSection> getEntityClass() {
|
||||
return ContentSection.class;
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
Category.class,
|
||||
ResourceType.class,
|
||||
LifecycleDefinition.class,
|
||||
Workflow.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Set.of(
|
||||
Category.class,
|
||||
ResourceType.class,
|
||||
LifecycleDefinition.class,
|
||||
Workflow.class
|
||||
);
|
||||
public Class<ContentSection> getEntityClass() {
|
||||
return ContentSection.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import org.libreccm.imexport.Processes;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -41,16 +42,19 @@ public class ContentTypeImExporter
|
|||
@Inject
|
||||
private ContentTypeRepository contentTypeRepo;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public Class<ContentType> getEntityClass() {
|
||||
return ContentType.class;
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
ContentSection.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Set.of(
|
||||
ContentSection.class
|
||||
);
|
||||
public Class<ContentType> getEntityClass() {
|
||||
return ContentType.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.util.Objects;
|
|||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -43,18 +44,21 @@ public class FolderImExporter extends AbstractEntityImExporter<Folder> {
|
|||
@Inject
|
||||
private FolderRepository folderRepo;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public Class<Folder> getEntityClass() {
|
||||
return Folder.class;
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
ContentSection.class,
|
||||
Category.class,
|
||||
Domain.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Set.of(
|
||||
ContentSection.class,
|
||||
Category.class,
|
||||
Domain.class
|
||||
);
|
||||
public Class<Folder> getEntityClass() {
|
||||
return Folder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import org.libreccm.imexport.Processes;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
@ -40,16 +41,19 @@ public class LifecycleDefinitionImExporter
|
|||
@Inject
|
||||
private LifecycleDefinitionRepository lifecycleDefRepo;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public Class<LifecycleDefinition> getEntityClass() {
|
||||
return LifecycleDefinition.class;
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
PhaseDefinition.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Set.of(
|
||||
PhaseDefinition.class
|
||||
);
|
||||
public Class<LifecycleDefinition> getEntityClass() {
|
||||
return LifecycleDefinition.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ import org.libreccm.imexport.AbstractEntityImExporter;
|
|||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.imexport.Processes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -41,17 +41,20 @@ public class LifecycleImExporter extends AbstractEntityImExporter<Lifecycle> {
|
|||
@Inject
|
||||
private LifecycleRepository lifecycleRepo;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public Class<Lifecycle> getEntityClass() {
|
||||
return Lifecycle.class;
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
LifecycleDefinition.class,
|
||||
Phase.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Set.of(
|
||||
LifecycleDefinition.class,
|
||||
Phase.class
|
||||
);
|
||||
public Class<Lifecycle> getEntityClass() {
|
||||
return Lifecycle.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
@ -41,14 +42,15 @@ public class PhaseDefinitionImExporter
|
|||
@Inject
|
||||
private PhaseDefinititionRepository phaseDefinitionRepo;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public Class<PhaseDefinition> getEntityClass() {
|
||||
return PhaseDefinition.class;
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
public Class<PhaseDefinition> getEntityClass() {
|
||||
return PhaseDefinition.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
@ -41,14 +42,15 @@ public class PhaseImExporter
|
|||
@Inject
|
||||
private PhaseRepository phaseRepo;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public Class<Phase> getEntityClass() {
|
||||
return Phase.class;
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
public Class<Phase> getEntityClass() {
|
||||
return Phase.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -69,4 +71,5 @@ public class PhaseImExporter
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,19 +19,16 @@
|
|||
package org.libreccm.categorization;
|
||||
|
||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.imexport.Processes;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.enterprise.inject.Instance;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
|
|
@ -47,26 +44,21 @@ public class CategorizationImExporter
|
|||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
@Inject
|
||||
private Instance<CategorizationImExporterDependenciesProvider> dependenciesProviders;
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
Category.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Categorization> getEntityClass() {
|
||||
return Categorization.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
||||
entities.add(Category.class);
|
||||
|
||||
dependenciesProviders.forEach(
|
||||
provider -> entities.addAll(provider.getCategorizableEntities())
|
||||
);
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void saveImportedEntity(final Categorization entity) {
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.categorization;
|
||||
|
||||
import org.libreccm.imexport.Exportable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public interface CategorizationImExporterDependenciesProvider {
|
||||
|
||||
Set<Class<Exportable>> getCategorizableEntities();
|
||||
|
||||
}
|
||||
|
|
@ -26,11 +26,11 @@ import java.util.Objects;
|
|||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* Exporter/Importer for {@link Category} entities.
|
||||
*
|
||||
|
|
@ -44,15 +44,18 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
|
|||
private CategoryRepository categoryRepository;
|
||||
|
||||
@Override
|
||||
public Class<Category> getEntityClass() {
|
||||
return Category.class;
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
Domain.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Set.of(
|
||||
Domain.class
|
||||
);
|
||||
public Class<Category> getEntityClass() {
|
||||
return Category.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -64,19 +67,19 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
|
|||
|
||||
final Category category;
|
||||
if (result.isPresent()) {
|
||||
category = result.get();
|
||||
category.setAbstractCategory(entity.isAbstractCategory());
|
||||
category.setCategoryOrder(entity.getCategoryOrder());
|
||||
category.setDescription(entity.getDescription());
|
||||
category.setDisplayName(entity.getDisplayName());
|
||||
category.setEnabled(entity.isEnabled());
|
||||
category.setName(entity.getName());
|
||||
category.setObjects(entity.getObjects());
|
||||
category.setParentCategory(entity.getParentCategory());
|
||||
category.setSubCategories(entity.getSubCategories());
|
||||
category.setTitle(entity.getTitle());
|
||||
category.setUniqueId(entity.getUniqueId());
|
||||
category.setVisible(entity.isVisible());
|
||||
category = result.get();
|
||||
category.setAbstractCategory(entity.isAbstractCategory());
|
||||
category.setCategoryOrder(entity.getCategoryOrder());
|
||||
category.setDescription(entity.getDescription());
|
||||
category.setDisplayName(entity.getDisplayName());
|
||||
category.setEnabled(entity.isEnabled());
|
||||
category.setName(entity.getName());
|
||||
category.setObjects(entity.getObjects());
|
||||
category.setParentCategory(entity.getParentCategory());
|
||||
category.setSubCategories(entity.getSubCategories());
|
||||
category.setTitle(entity.getTitle());
|
||||
category.setUniqueId(entity.getUniqueId());
|
||||
category.setVisible(entity.isVisible());
|
||||
} else {
|
||||
category = entity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
@ -41,6 +42,12 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
|
|||
@Inject
|
||||
private DomainRepository domainRepository;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Domain> getEntityClass() {
|
||||
|
||||
|
|
@ -53,12 +60,6 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
|
|||
domainRepository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Domain reloadEntity(final Domain entity) {
|
||||
return domainRepository
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.util.HashSet;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
|
|
@ -47,6 +48,17 @@ public class DomainOwnershipImExporter
|
|||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
CcmApplication.class,
|
||||
Domain.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DomainOwnership> getEntityClass() {
|
||||
return DomainOwnership.class;
|
||||
|
|
@ -58,15 +70,6 @@ public class DomainOwnershipImExporter
|
|||
entityManager.persist(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
final Set<Class<? extends Exportable>> classes = new HashSet<>();
|
||||
classes.add(CcmApplication.class);
|
||||
classes.add(Domain.class);
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DomainOwnership reloadEntity(final DomainOwnership entity) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
@ -34,11 +35,17 @@ import javax.inject.Inject;
|
|||
*/
|
||||
@Processes(ResourceType.class)
|
||||
public class ResourceTypeImExporter
|
||||
extends AbstractEntityImExporter<ResourceType>{
|
||||
extends AbstractEntityImExporter<ResourceType> {
|
||||
|
||||
@Inject
|
||||
private ResourceTypeRepository repository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ResourceType> getEntityClass() {
|
||||
return ResourceType.class;
|
||||
|
|
@ -49,11 +56,6 @@ public class ResourceTypeImExporter
|
|||
repository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceType reloadEntity(final ResourceType entity) {
|
||||
return repository
|
||||
|
|
@ -71,6 +73,4 @@ public class ResourceTypeImExporter
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
|
|
@ -42,12 +45,35 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
|||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
/**
|
||||
* A set of entities which should be processed before this implementation is
|
||||
* used. We can't use an annotation for this because we can't access the
|
||||
* annotations in a portable way in the rest of the code because CDI
|
||||
* containers usually create a {@link java.lang.reflect.Proxy} class and
|
||||
* there is no portable way to unproxy a class.
|
||||
*
|
||||
* The required entities for implementation of
|
||||
* {@code AbstractEntityImExporter} should be added in the implementation of
|
||||
* this class using {@link #addRequiredEntities(java.util.Set)}. Other
|
||||
* implementations of {@code AbstractEntityImExporter} may also add themself
|
||||
* to the list of required entities of another implementation of
|
||||
* {@code AbstractEnitityImExporter}. For this, {@link #getEntityClass()}
|
||||
* should be used, to add the concrete implementation.
|
||||
*/
|
||||
private final Set<Class<? extends Exportable>> requiredEntities;
|
||||
|
||||
public AbstractEntityImExporter() {
|
||||
objectMapper = new ObjectMapper()
|
||||
.registerModule(new JavaTimeModule());
|
||||
|
||||
requiredEntities = new HashSet<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract init method. Implementations MUST be annotated with
|
||||
* {@link PostConstruct}. Th
|
||||
*/
|
||||
protected abstract void init();
|
||||
|
||||
/**
|
||||
* Returns the Entity class which is handled by the implementation. This
|
||||
* should be the same values than the class in the {@link Proceesses}
|
||||
|
|
@ -71,10 +97,24 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
|||
*
|
||||
* @return A {@link Set} of exportable entity classes which should be
|
||||
* processed before the entities which are processed by this
|
||||
* implementation. If the implementation has no dependencies an
|
||||
* empty {@link Set} should be returned.
|
||||
* implementation.
|
||||
*/
|
||||
protected abstract Set<Class<? extends Exportable>> getRequiredEntities();
|
||||
public final Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.unmodifiableSet(requiredEntities);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add entities that have be processed before this implementation is used.
|
||||
* This method should only be called by the implementation of the
|
||||
* {@link #init()} method.
|
||||
*
|
||||
* @param requiredEntities The additional required entities.
|
||||
*/
|
||||
public final void addRequiredEntities(
|
||||
final Set<Class<? extends Exportable>> requiredEntities
|
||||
) {
|
||||
this.requiredEntities.addAll(requiredEntities);
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public T importEntity(final String data) throws ImportExpection {
|
||||
|
|
@ -119,7 +159,7 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
|||
|
||||
/**
|
||||
* Reloads the entity to export. Entities become detacted for several
|
||||
* reasons before they are passed to the null null null {@link #exportEntity(org.libreccm.imexport.Exportable) method. The
|
||||
* reasons before they are passed to the null null null null null null null {@link #exportEntity(org.libreccm.imexport.Exportable) method. The
|
||||
* implementation of this should reload the passed entity.
|
||||
*
|
||||
* @param entity The entity to reload.
|
||||
|
|
|
|||
|
|
@ -231,48 +231,6 @@ public class ImportExport {
|
|||
final List<EntityImExporterTreeNode> orderedNodes = treeManager
|
||||
.orderImExporters(tree);
|
||||
|
||||
// Put the node for Categorizations to the end of the list
|
||||
final EntityImExporterTreeNode categorizationsNode = orderedNodes
|
||||
.stream()
|
||||
.filter(
|
||||
node -> node.getEntityImExporter().getEntityClass().equals(
|
||||
Categorization.class
|
||||
)
|
||||
)
|
||||
.findAny()
|
||||
.orElseThrow(
|
||||
() -> new UnexpectedErrorException(
|
||||
String.format(
|
||||
"There should be an ImExporter in the tree for "
|
||||
+ "%s, but it is not.",
|
||||
Categorization.class.getName()
|
||||
)
|
||||
)
|
||||
);
|
||||
orderedNodes.remove(categorizationsNode);
|
||||
orderedNodes.add(categorizationsNode);
|
||||
|
||||
// Put the node for Permissions to the end of the list.
|
||||
final EntityImExporterTreeNode permissionsNode = orderedNodes
|
||||
.stream()
|
||||
.filter(
|
||||
node -> node.getEntityImExporter().getEntityClass().equals(
|
||||
Permission.class
|
||||
)
|
||||
)
|
||||
.findAny()
|
||||
.orElseThrow(
|
||||
() -> new UnexpectedErrorException(
|
||||
String.format(
|
||||
"There should be an ImExporter in the tree for "
|
||||
+ "%s, but it is not.",
|
||||
Permission.class.getName()
|
||||
)
|
||||
)
|
||||
);
|
||||
orderedNodes.remove(permissionsNode);
|
||||
orderedNodes.add(permissionsNode);
|
||||
|
||||
final ImportManifest manifest = createImportManifest(importName);
|
||||
|
||||
final List<EntityImExporterTreeNode> importers = orderedNodes
|
||||
|
|
@ -562,6 +520,7 @@ public class ImportExport {
|
|||
public Class<? extends Exportable> value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
|
|
@ -46,6 +47,12 @@ public class GroupImExporter extends AbstractEntityImExporter<Group> {
|
|||
@Inject
|
||||
private GroupRepository groupRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Group> getEntityClass() {
|
||||
return Group.class;
|
||||
|
|
@ -58,11 +65,6 @@ public class GroupImExporter extends AbstractEntityImExporter<Group> {
|
|||
entityManager.persist(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Group reloadEntity(final Group entity) {
|
||||
return groupRepository
|
||||
|
|
|
|||
|
|
@ -19,13 +19,12 @@
|
|||
package org.libreccm.security;
|
||||
|
||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.imexport.Processes;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.NoResultException;
|
||||
|
|
@ -44,18 +43,20 @@ public class GroupMembershipImExporter
|
|||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public Class<GroupMembership> getEntityClass() {
|
||||
return GroupMembership.class;
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
User.class,
|
||||
Group.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
||||
entities.add(User.class);
|
||||
entities.add(Group.class);
|
||||
|
||||
return entities;
|
||||
public Class<GroupMembership> getEntityClass() {
|
||||
return GroupMembership.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import org.libreccm.core.CcmObject;
|
||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.imexport.Processes;
|
||||
|
|
@ -26,6 +25,7 @@ import org.libreccm.imexport.Processes;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
@ -41,6 +41,16 @@ public class PermissionImExporter extends AbstractEntityImExporter<Permission> {
|
|||
@Inject
|
||||
private PermissionRepository permissionRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
Role.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Permission> getEntityClass() {
|
||||
return Permission.class;
|
||||
|
|
@ -51,13 +61,6 @@ public class PermissionImExporter extends AbstractEntityImExporter<Permission> {
|
|||
permissionRepository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Set.of(
|
||||
Role.class
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Permission reloadEntity(final Permission entity) {
|
||||
return permissionRepository
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.Dependent;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
|
|
@ -53,6 +54,12 @@ public class RoleImExporter extends AbstractEntityImExporter<Role> {
|
|||
@Inject
|
||||
private RoleRepository roleRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Role> getEntityClass() {
|
||||
return Role.class;
|
||||
|
|
@ -82,11 +89,6 @@ public class RoleImExporter extends AbstractEntityImExporter<Role> {
|
|||
roleRepository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Role reloadEntity(final Role entity) {
|
||||
return roleRepository
|
||||
|
|
|
|||
|
|
@ -23,17 +23,13 @@ import org.libreccm.imexport.Exportable;
|
|||
import org.libreccm.imexport.Processes;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
|
|
@ -48,6 +44,18 @@ public class RoleMembershipImExporter
|
|||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
User.class,
|
||||
Group.class,
|
||||
Role.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<RoleMembership> getEntityClass() {
|
||||
return RoleMembership.class;
|
||||
|
|
@ -56,36 +64,6 @@ public class RoleMembershipImExporter
|
|||
@Override
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void saveImportedEntity(final RoleMembership entity) {
|
||||
// final CriteriaBuilder criteriaBuilder = entityManager
|
||||
// .getCriteriaBuilder();
|
||||
// final CriteriaQuery<RoleMembership> criteriaQuery = criteriaBuilder
|
||||
// .createQuery(RoleMembership.class);
|
||||
// final Root<RoleMembership> from = criteriaQuery.from(
|
||||
// RoleMembership.class
|
||||
// );
|
||||
// criteriaQuery.where(
|
||||
// criteriaBuilder.equal(
|
||||
// from.get("role"),
|
||||
// entity.getRole()
|
||||
// )
|
||||
// );
|
||||
// criteriaQuery.where(
|
||||
// criteriaBuilder.equal(
|
||||
// from.get("member"),
|
||||
// entity.getMember()
|
||||
// )
|
||||
// );
|
||||
// final TypedQuery<RoleMembership> query = entityManager.createQuery(
|
||||
// criteriaQuery
|
||||
// );
|
||||
// final List<RoleMembership> results = query.getResultList();
|
||||
// if (results.isEmpty()) {
|
||||
// final RoleMembership membership = new RoleMembership();
|
||||
// membership.setUuid(entity.getUuid());
|
||||
// membership.setMember(entity.getMember());
|
||||
// membership.setRole(entity.getRole());
|
||||
// entityManager.persist(membership);
|
||||
// }
|
||||
|
||||
if (entity.getMembershipId() == 0) {
|
||||
entityManager.persist(entity);
|
||||
|
|
@ -94,16 +72,6 @@ public class RoleMembershipImExporter
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
final Set<Class<? extends Exportable>> classes = new HashSet<>();
|
||||
classes.add(User.class);
|
||||
classes.add(Group.class);
|
||||
classes.add(Role.class);
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoleMembership reloadEntity(final RoleMembership entity) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
|
|
@ -46,6 +47,12 @@ public class UserImExporter extends AbstractEntityImExporter<User> {
|
|||
@Inject
|
||||
private UserRepository userRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<User> getEntityClass() {
|
||||
return User.class;
|
||||
|
|
@ -60,11 +67,6 @@ public class UserImExporter extends AbstractEntityImExporter<User> {
|
|||
entityManager.persist(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected User reloadEntity(final User entity) {
|
||||
return userRepository
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -43,6 +44,12 @@ public class ApplicationImExporter
|
|||
@Inject
|
||||
private ApplicationRepository applicationRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<CcmApplication> getEntityClass() {
|
||||
return CcmApplication.class;
|
||||
|
|
@ -54,11 +61,6 @@ public class ApplicationImExporter
|
|||
applicationRepository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CcmApplication reloadEntity(final CcmApplication entity) {
|
||||
return applicationRepository
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ import org.libreccm.imexport.AbstractEntityImExporter;
|
|||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.imexport.Processes;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -45,17 +45,20 @@ public class AssignableTaskImExporter
|
|||
@Inject
|
||||
private AssignableTaskRepository assignableTaskRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public Class<AssignableTask> getEntityClass() {
|
||||
return AssignableTask.class;
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
TaskComment.class,
|
||||
Workflow.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Set.of(
|
||||
TaskComment.class,
|
||||
Workflow.class
|
||||
);
|
||||
public Class<AssignableTask> getEntityClass() {
|
||||
return AssignableTask.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.HashSet;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
|
|
@ -46,6 +47,16 @@ public class TaskAssignmentImExporter
|
|||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
AssignableTask.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<TaskAssignment> getEntityClass() {
|
||||
return TaskAssignment.class;
|
||||
|
|
@ -58,14 +69,6 @@ public class TaskAssignmentImExporter
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
final Set<Class<? extends Exportable>> classes = new HashSet<>();
|
||||
classes.add(AssignableTask.class);
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TaskAssignment reloadEntity(final TaskAssignment entity) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -43,6 +44,12 @@ public class TaskCommentImExporter extends AbstractEntityImExporter<TaskComment>
|
|||
@Inject
|
||||
private TaskCommentRepository taskCommentRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<TaskComment> getEntityClass() {
|
||||
return TaskComment.class;
|
||||
|
|
@ -54,11 +61,6 @@ public class TaskCommentImExporter extends AbstractEntityImExporter<TaskComment>
|
|||
taskCommentRepository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TaskComment reloadEntity(final TaskComment entity) {
|
||||
return taskCommentRepository
|
||||
|
|
@ -73,5 +75,4 @@ public class TaskCommentImExporter extends AbstractEntityImExporter<TaskComment>
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.HashSet;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
|
|
@ -46,6 +47,16 @@ public class TaskDependencyImExporter
|
|||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
addRequiredEntities(
|
||||
Set.of(
|
||||
AssignableTask.class
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<TaskDependency> getEntityClass() {
|
||||
return TaskDependency.class;
|
||||
|
|
@ -54,18 +65,9 @@ public class TaskDependencyImExporter
|
|||
@Override
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void saveImportedEntity(final TaskDependency entity) {
|
||||
// entityManager.persist(entity);
|
||||
entityManager.merge(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
final Set<Class<? extends Exportable>> classes = new HashSet<>();
|
||||
classes.add(AssignableTask.class);
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TaskDependency reloadEntity(final TaskDependency entity) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -42,6 +43,12 @@ public class WorkflowImExporter extends AbstractEntityImExporter<Workflow> {
|
|||
@Inject
|
||||
private WorkflowRepository workflowRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Workflow> getEntityClass() {
|
||||
|
||||
|
|
@ -54,11 +61,6 @@ public class WorkflowImExporter extends AbstractEntityImExporter<Workflow> {
|
|||
workflowRepository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Workflow reloadEntity(final Workflow entity) {
|
||||
return workflowRepository
|
||||
|
|
|
|||
|
|
@ -19,13 +19,11 @@
|
|||
package org.libreccm.docrepo;
|
||||
|
||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.imexport.Processes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -45,6 +43,12 @@ public class BlobObjectImExporter extends AbstractEntityImExporter<BlobObject> {
|
|||
@Inject
|
||||
private BlobObjectRepository blobObjectRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<BlobObject> getEntityClass() {
|
||||
return BlobObject.class;
|
||||
|
|
@ -57,11 +61,6 @@ public class BlobObjectImExporter extends AbstractEntityImExporter<BlobObject> {
|
|||
blobObjectRepository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlobObject reloadEntity(final BlobObject entity) {
|
||||
return blobObjectRepository
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -45,6 +46,12 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
|
|||
@Inject
|
||||
private FileRepository fileRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<File> getEntityClass() {
|
||||
return File.class;
|
||||
|
|
@ -56,11 +63,6 @@ public class FileImExporter extends AbstractEntityImExporter<File> {
|
|||
fileRepository.save(portableObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File reloadEntity(final File entity) {
|
||||
return fileRepository
|
||||
|
|
|
|||
|
|
@ -18,13 +18,11 @@
|
|||
*/
|
||||
package org.libreccm.docrepo;
|
||||
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.imexport.Processes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -43,6 +41,12 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
|||
@Inject
|
||||
private FolderRepository folderRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Folder> getEntityClass() {
|
||||
return Folder.class;
|
||||
|
|
@ -54,11 +58,6 @@ public class FolderImExporter extends AbstractResourceImExporter<Folder> {
|
|||
folderRepository.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Folder reloadEntity(final Folder entity) {
|
||||
return folderRepository
|
||||
|
|
|
|||
|
|
@ -19,13 +19,11 @@
|
|||
package org.libreccm.docrepo;
|
||||
|
||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.imexport.Processes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
@ -40,6 +38,12 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
|
|||
@Inject
|
||||
private RepositoryRepository repositoryRepository;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
protected void init() {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Repository> getEntityClass() {
|
||||
return Repository.class;
|
||||
|
|
@ -50,11 +54,6 @@ public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
|
|||
repositoryRepository.save(portableObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Repository reloadEntity(final Repository entity) {
|
||||
return repositoryRepository
|
||||
|
|
|
|||
Loading…
Reference in New Issue