diff --git a/pom.xml b/pom.xml index 1aeeb8e..cffeae6 100644 --- a/pom.xml +++ b/pom.xml @@ -142,7 +142,7 @@ nl.jqno.equalsverifier equalsverifier - 3.10.1 + 3.14.2 test diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/databind/DatabindModule.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/databind/DatabindModule.java index 8868172..da5f6f9 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/databind/DatabindModule.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/databind/DatabindModule.java @@ -9,6 +9,6 @@ public class DatabindModule extends SimpleModule { private static final long serialVersionUID = 1L; public DatabindModule() { - this.addDeserializer(Filter.class, new FilterDeserializer()); + super.addDeserializer(Filter.class, new FilterDeserializer()); } } diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/Entity.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/Entity.java index 4c0019c..015455e 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/Entity.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/Entity.java @@ -75,7 +75,6 @@ public final int hashCode() { int hash = Long.hashCode(this.id); hash = (this.anchor != null) ? 31 * hash + this.anchor.hashCode() : hash; hash = (this.name != null) ? 31 * hash + this.name.hashCode() : hash; - hash = (this.anchor != null) ? 31 * hash + this.anchor.hashCode() : hash; hash = 31 * hash + Long.hashCode(this.version); hash = 31 * hash + Long.hashCode(this.parent); hash = 31 * hash + Boolean.hashCode(this.isGroup); diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityBulkExecution.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityBulkExecution.java index b2b14c1..b04e1e7 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityBulkExecution.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityBulkExecution.java @@ -47,7 +47,7 @@ public static class Builder { private EntityBulkOperation finalizer; - private Builder() { + protected Builder() { } /** @@ -63,6 +63,7 @@ public Builder topic(String... topic) { return this; } + @SuppressWarnings("PMD.UseArraysAsList") public Builder operation(EntityBulkOperation... operations) { assert operations != null; for (EntityBulkOperation operation : operations) { diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityBulkOperation.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityBulkOperation.java index 7dba422..d5d22f8 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityBulkOperation.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityBulkOperation.java @@ -46,7 +46,7 @@ public static class Builder { private Consumer consumer; - private Builder() { + protected Builder() { } public Builder key(BulkOperationKey key) { diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityLock.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityLock.java index 6761965..e1b66c3 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityLock.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityLock.java @@ -61,10 +61,10 @@ public static class Builder { private long lastAccess; private long ttl; - private Builder() { + protected Builder() { } - private Builder(EntityLock entityLock) { + protected Builder(EntityLock entityLock) { this.entity = entityLock.entity; this.user = entityLock.user; this.created = entityLock.created; diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityTree.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityTree.java index df5cee4..8661937 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityTree.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/EntityTree.java @@ -145,9 +145,9 @@ private void toString(int indent, Long parent, java.lang.StringBuilder indentPre this.toString(indent, child, indentPrefix, b); } } else { - b.append(indentPrefix.toString()); - b.append(this.index.get(parent)); - b.append('\n'); + b.append(indentPrefix.toString()) + .append(this.index.get(parent)) + .append('\n'); if (this.hasChildren(parent)) { for (int i = 0; i < indent; i++) { diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/HistoryEntry.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/HistoryEntry.java index 572484a..6f4ad53 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/HistoryEntry.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/HistoryEntry.java @@ -62,7 +62,7 @@ public Builder toBuilder() { return new Builder(this); } - public static class Builder { + public static final class Builder { private long entity; private String initiator; diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/RecycleBinItem.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/RecycleBinItem.java index ea8e2ce..a6280f9 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/RecycleBinItem.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/RecycleBinItem.java @@ -42,7 +42,7 @@ public Builder toBuilder() { return new Builder(this); } - public static class Builder { + public static final class Builder { private long id; private long parent; diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/RecycleBinItemFilter.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/RecycleBinItemFilter.java index 93f6ff7..70920e3 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/RecycleBinItemFilter.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/RecycleBinItemFilter.java @@ -35,7 +35,7 @@ public Builder toBuilder() { return new Builder(this); } - public static class Builder { + public static final class Builder { private LocalDateTime from; private LocalDateTime to; diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/filter/FilterDeserializer.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/filter/FilterDeserializer.java index 1933511..bdc1785 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/filter/FilterDeserializer.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/filter/FilterDeserializer.java @@ -8,16 +8,16 @@ public class FilterDeserializer extends UniquePropertyPolymorphicDeserializer { private String after; - private Builder() { } + protected Builder() { } - private Builder(CursorBasedQuery curserBasedQuery) { + protected Builder(CursorBasedQuery curserBasedQuery) { super(curserBasedQuery); this.first = curserBasedQuery.first; this.after = curserBasedQuery.after; diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/query/QueryOptions.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/query/QueryOptions.java index 6217195..d3e0b89 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/query/QueryOptions.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/query/QueryOptions.java @@ -24,10 +24,10 @@ public static class Builder { private boolean showHidden; - private Builder() { + protected Builder() { } - private Builder(QueryOptions queryOptions) { + protected Builder(QueryOptions queryOptions) { this.showHidden = queryOptions.showHidden; } diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/query/SubTreeQuery.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/query/SubTreeQuery.java index 33b6d28..7f433ce 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/query/SubTreeQuery.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/query/SubTreeQuery.java @@ -35,9 +35,9 @@ public static class Builder extends Query.Builder { private final List rootList = new ArrayList<>(); - private Builder() { } + protected Builder() { } - private Builder(SubTreeQuery curserBasedQuery) { + protected Builder(SubTreeQuery curserBasedQuery) { super(curserBasedQuery); this.rootList.addAll(curserBasedQuery.rootList); } diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/sort/Name.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/sort/Name.java index 9592934..6202156 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/sort/Name.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/sort/Name.java @@ -21,11 +21,11 @@ public static Builder builder() { @JsonPOJOBuilder(withPrefix = "", buildMethodName = "build") public static class Builder extends OrderCriteria.Builder { - private Builder() { + protected Builder() { super(); } - private Builder(Name name) { + protected Builder(Name name) { super(name); } diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/sort/OrderBy.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/sort/OrderBy.java index bfb2c8f..609f520 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/sort/OrderBy.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/entity/sort/OrderBy.java @@ -36,15 +36,17 @@ public static class Builder { private final List sort = new ArrayList<>(); - private Builder() { } + protected Builder() { } - private Builder(OrderBy and) { + protected Builder(OrderBy and) { this.sort.addAll(and.sort); } + @SuppressWarnings("PMD.UseArraysAsList") public Builder sort(OrderCriteria... sortCriteriaList) { assert sortCriteriaList != null; for (OrderCriteria sortCriteria : sortCriteriaList) { + assert sortCriteria != null : "sortCriteria is null"; this.sort.add(sortCriteria); } return this; diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/domain/exception/AnchorAlreadyExists.java b/src/main/java/com/sitepark/ies/contentrepository/core/domain/exception/AnchorAlreadyExists.java index f45629b..5357b73 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/domain/exception/AnchorAlreadyExists.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/domain/exception/AnchorAlreadyExists.java @@ -1,5 +1,32 @@ package com.sitepark.ies.contentrepository.core.domain.exception; +import com.sitepark.ies.contentrepository.core.domain.entity.Anchor; + public class AnchorAlreadyExists extends ContentRepositoryException { + private static final long serialVersionUID = 1L; + + private final Anchor anchor; + + private final long owner; + + public AnchorAlreadyExists(Anchor anchor, long owner) { + super(); + this.anchor = anchor; + this.owner = owner; + } + + public Anchor getAnchor() { + return this.anchor; + } + + public long getOwner() { + return this.owner; + } + + @Override + public String getMessage() { + return "Anchor " + this.anchor + " already exists for entity " + this.owner; + } + } diff --git a/src/main/java/com/sitepark/ies/contentrepository/core/usecase/BulkPurgeInput.java b/src/main/java/com/sitepark/ies/contentrepository/core/usecase/BulkPurgeInput.java index 386eb05..a3b4ce0 100644 --- a/src/main/java/com/sitepark/ies/contentrepository/core/usecase/BulkPurgeInput.java +++ b/src/main/java/com/sitepark/ies/contentrepository/core/usecase/BulkPurgeInput.java @@ -44,7 +44,7 @@ public Builder toBuilder() { return new Builder(this); } - public static class Builder { + public static final class Builder { private final List rootList = new ArrayList<>();