Skip to content

Commit

Permalink
refactor: fix pmd warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sitepark-veltrup committed Jun 21, 2023
1 parent 7209a79 commit 9417f29
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 35 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.10.1</version>
<version>3.14.2</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static class Builder {

private EntityBulkOperation finalizer;

private Builder() {
protected Builder() {
}

/**
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static class Builder {

private Consumer<Entity> consumer;

private Builder() {
protected Builder() {
}

public Builder key(BulkOperationKey key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ public class FilterDeserializer extends UniquePropertyPolymorphicDeserializer<Fi

public FilterDeserializer() {
super(Filter.class);
this.register("id", Id.class);
this.register("idList", IdList.class);
this.register("parent", Parent.class);
this.register("parentList", ParentList.class);
this.register("root", Root.class);
this.register("rootList", RootList.class);
this.register("anchor", Anchor.class);
this.register("anchorList", AnchorList.class);
this.register("and", And.class);
this.register("or", Or.class);
this.register("not", Not.class);
super.register("id", Id.class);
super.register("idList", IdList.class);
super.register("parent", Parent.class);
super.register("parentList", ParentList.class);
super.register("root", Root.class);
super.register("rootList", RootList.class);
super.register("anchor", Anchor.class);
super.register("anchorList", AnchorList.class);
super.register("and", And.class);
super.register("or", Or.class);
super.register("not", Not.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public static class Builder extends Query.Builder<Builder> {

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public static class Builder extends Query.Builder<Builder> {

private final List<Long> rootList = new ArrayList<>();

private Builder() { }
protected Builder() { }

private Builder(SubTreeQuery curserBasedQuery) {
protected Builder(SubTreeQuery curserBasedQuery) {
super(curserBasedQuery);
this.rootList.addAll(curserBasedQuery.rootList);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public static Builder builder() {
@JsonPOJOBuilder(withPrefix = "", buildMethodName = "build")
public static class Builder extends OrderCriteria.Builder<Builder> {

private Builder() {
protected Builder() {
super();
}

private Builder(Name name) {
protected Builder(Name name) {
super(name);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ public static class Builder {

private final List<OrderCriteria> 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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Builder toBuilder() {
return new Builder(this);
}

public static class Builder {
public static final class Builder {

private final List<Long> rootList = new ArrayList<>();

Expand Down

0 comments on commit 9417f29

Please sign in to comment.