Fixed some bugs in importers and in the Categorization step

deploy_packages_to_gitea
Jens Pelzetter 2023-03-21 17:58:42 +01:00
parent 1701551fbc
commit 3463bb7f4d
6 changed files with 29 additions and 24 deletions

View File

@ -1,12 +1,12 @@
{
"name": "@librecms/ccm-cms",
"version": "7.0.0-SNAPSHOT.2023-03-20T173612",
"version": "7.0.0-SNAPSHOT.2023-03-21T165148",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@librecms/ccm-cms",
"version": "7.0.0-SNAPSHOT.2023-03-20T173612",
"version": "7.0.0-SNAPSHOT.2023-03-21T165148",
"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-20T173612",
"version": "7.0.0-SNAPSHOT.2023-03-21T165148",
"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

@ -359,6 +359,13 @@ public class CategorizationStep extends AbstractMvcAuthoringStep {
.map(this::buildCategorizationTreeNode)
.collect(Collectors.toList())
);
node.setSubCategoryAssigned(
node
.getSubCategories()
.stream()
.map(subNode -> subNode.isAssigned() || subNode.isSubCategoryAssigned())
.reduce(false, (value1, value2) -> value1 || value2)
);
// node.setSubCategoryAssigned(
// isSubCategoryAssigned(category)
//// category

View File

@ -71,11 +71,11 @@ public class CategorizationTreeNode {
*/
private boolean assigned;
// /**
// * Is any subcategory of the category represented by this node assigned to
// * the current content item?
// */
// private boolean subCategoryAssigned;
/**
* Is any subcategory of the category represented by this node assigned to
* the current content item?
*/
private boolean subCategoryAssigned;
/**
* Nodes for the subcategories of the category represented by this node.
@ -139,16 +139,16 @@ public class CategorizationTreeNode {
}
public boolean isSubCategoryAssigned() {
// return subCategoryAssigned;
return subCategories
.stream()
.map(CategorizationTreeNode::isAssigned)
.reduce(false, (value1, value2) -> value1 || value2);
return subCategoryAssigned;
// return subCategories
// .stream()
// .map(CategorizationTreeNode::isAssigned)
// .reduce(false, (value1, value2) -> value1 || value2);
}
// public void setSubCategoryAssigned(final boolean subCategoryAssigned) {
// this.subCategoryAssigned = subCategoryAssigned;
// }
public void setSubCategoryAssigned(final boolean subCategoryAssigned) {
this.subCategoryAssigned = subCategoryAssigned;
}
public List<CategorizationTreeNode> getSubCategories() {
return Collections.unmodifiableList(subCategories);

View File

@ -24,7 +24,6 @@ import org.libreccm.imexport.Processes;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
@ -48,11 +47,11 @@ public class CategoryImExporter extends AbstractEntityImExporter<Category> {
@Override
@PostConstruct
protected void init() {
addRequiredEntities(
Set.of(
Domain.class
)
);
// addRequiredEntities(
// Set.of(
// Domain.class
// )
// );
}
@Override

View File

@ -24,7 +24,6 @@ import org.libreccm.imexport.Processes;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
@ -48,7 +47,7 @@ public class DomainImExporter extends AbstractEntityImExporter<Domain> {
@Override
@PostConstruct
protected void init() {
//Nothing
addRequiredEntities(Set.of(Category.class));
}
@Override