From d2e39ec2a320a401a3d52a67e223da172e44fcd8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 27 Nov 2024 00:45:40 +0000 Subject: [PATCH] Auto-format code --- .../edu/sjsu/moth/generated/StatusEdit.java | 64 ++++++++++--------- .../moth/server/db/StatusEditCollection.java | 4 +- .../server/db/StatusHistoryRepository.java | 5 +- .../moth/server/service/StatusService.java | 4 +- 4 files changed, 40 insertions(+), 37 deletions(-) diff --git a/server/src/main/java/edu/sjsu/moth/generated/StatusEdit.java b/server/src/main/java/edu/sjsu/moth/generated/StatusEdit.java index 2eaeece..cb13b68 100644 --- a/server/src/main/java/edu/sjsu/moth/generated/StatusEdit.java +++ b/server/src/main/java/edu/sjsu/moth/generated/StatusEdit.java @@ -1,29 +1,20 @@ - // THIS FILE WAS GENERATED BY JSON2JAVA // IT HAS NOT BEEN CHANGED. (IF IT HAS REMOVE THIS LINE) // CHANGES MADE: // * NONE SO FAR - package edu.sjsu.moth.generated; import java.util.ArrayList; import java.util.List; + import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import edu.sjsu.moth.server.db.Account; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "content", - "spoiler_text", - "sensitive", - "created_at", - "account", - "media_attachments", - "emojis" -}) +@JsonPropertyOrder({ "content", "spoiler_text", "sensitive", "created_at", "account", "media_attachments", "emojis" }) public class StatusEdit { @JsonProperty("content") @@ -43,12 +34,12 @@ public class StatusEdit { /** * No args constructor for use in serialization - * */ public StatusEdit() { } - public StatusEdit(String content, String spoilerText, Boolean sensitive, String createdAt, Account account, List mediaAttachments, List emojis) { + public StatusEdit(String content, String spoilerText, Boolean sensitive, String createdAt, Account account, + List mediaAttachments, List emojis) { super(); this.content = content; this.spoilerText = spoilerText; @@ -62,37 +53,38 @@ public StatusEdit(String content, String spoilerText, Boolean sensitive, String @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append(StatusEdit.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append(StatusEdit.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))) + .append('['); sb.append("content"); sb.append('='); - sb.append(((this.content == null)?"":this.content)); + sb.append(((this.content == null) ? "" : this.content)); sb.append(','); sb.append("spoilerText"); sb.append('='); - sb.append(((this.spoilerText == null)?"":this.spoilerText)); + sb.append(((this.spoilerText == null) ? "" : this.spoilerText)); sb.append(','); sb.append("sensitive"); sb.append('='); - sb.append(((this.sensitive == null)?"":this.sensitive)); + sb.append(((this.sensitive == null) ? "" : this.sensitive)); sb.append(','); sb.append("createdAt"); sb.append('='); - sb.append(((this.createdAt == null)?"":this.createdAt)); + sb.append(((this.createdAt == null) ? "" : this.createdAt)); sb.append(','); sb.append("account"); sb.append('='); - sb.append(((this.account == null)?"":this.account)); + sb.append(((this.account == null) ? "" : this.account)); sb.append(','); sb.append("mediaAttachments"); sb.append('='); - sb.append(((this.mediaAttachments == null)?"":this.mediaAttachments)); + sb.append(((this.mediaAttachments == null) ? "" : this.mediaAttachments)); sb.append(','); sb.append("emojis"); sb.append('='); - sb.append(((this.emojis == null)?"":this.emojis)); + sb.append(((this.emojis == null) ? "" : this.emojis)); sb.append(','); - if (sb.charAt((sb.length()- 1)) == ',') { - sb.setCharAt((sb.length()- 1), ']'); + if (sb.charAt((sb.length() - 1)) == ',') { + sb.setCharAt((sb.length() - 1), ']'); } else { sb.append(']'); } @@ -102,13 +94,13 @@ public String toString() { @Override public int hashCode() { int result = 1; - result = ((result* 31)+((this.emojis == null)? 0 :this.emojis.hashCode())); - result = ((result* 31)+((this.createdAt == null)? 0 :this.createdAt.hashCode())); - result = ((result* 31)+((this.spoilerText == null)? 0 :this.spoilerText.hashCode())); - result = ((result* 31)+((this.mediaAttachments == null)? 0 :this.mediaAttachments.hashCode())); - result = ((result* 31)+((this.sensitive == null)? 0 :this.sensitive.hashCode())); - result = ((result* 31)+((this.content == null)? 0 :this.content.hashCode())); - result = ((result* 31)+((this.account == null)? 0 :this.account.hashCode())); + result = ((result * 31) + ((this.emojis == null) ? 0 : this.emojis.hashCode())); + result = ((result * 31) + ((this.createdAt == null) ? 0 : this.createdAt.hashCode())); + result = ((result * 31) + ((this.spoilerText == null) ? 0 : this.spoilerText.hashCode())); + result = ((result * 31) + ((this.mediaAttachments == null) ? 0 : this.mediaAttachments.hashCode())); + result = ((result * 31) + ((this.sensitive == null) ? 0 : this.sensitive.hashCode())); + result = ((result * 31) + ((this.content == null) ? 0 : this.content.hashCode())); + result = ((result * 31) + ((this.account == null) ? 0 : this.account.hashCode())); return result; } @@ -121,7 +113,17 @@ public boolean equals(Object other) { return false; } StatusEdit rhs = ((StatusEdit) other); - return ((((((((this.emojis == rhs.emojis)||((this.emojis!= null)&&this.emojis.equals(rhs.emojis)))&&((this.createdAt == rhs.createdAt)||((this.createdAt!= null)&&this.createdAt.equals(rhs.createdAt))))&&((this.spoilerText == rhs.spoilerText)||((this.spoilerText!= null)&&this.spoilerText.equals(rhs.spoilerText))))&&((this.mediaAttachments == rhs.mediaAttachments)||((this.mediaAttachments!= null)&&this.mediaAttachments.equals(rhs.mediaAttachments))))&&((this.sensitive == rhs.sensitive)||((this.sensitive!= null)&&this.sensitive.equals(rhs.sensitive))))&&((this.content == rhs.content)||((this.content!= null)&&this.content.equals(rhs.content))))&&((this.account == rhs.account)||((this.account!= null)&&this.account.equals(rhs.account)))); + return ((((((((this.emojis == rhs.emojis) || ((this.emojis != null) && this.emojis.equals(rhs.emojis))) && + ((this.createdAt == rhs.createdAt) || + ((this.createdAt != null) && this.createdAt.equals(rhs.createdAt)))) && + ((this.spoilerText == rhs.spoilerText) || + ((this.spoilerText != null) && this.spoilerText.equals(rhs.spoilerText)))) && + ((this.mediaAttachments == rhs.mediaAttachments) || + ((this.mediaAttachments != null) && this.mediaAttachments.equals(rhs.mediaAttachments)))) && + ((this.sensitive == rhs.sensitive) || + ((this.sensitive != null) && this.sensitive.equals(rhs.sensitive)))) && + ((this.content == rhs.content) || ((this.content != null) && this.content.equals(rhs.content)))) && + ((this.account == rhs.account) || ((this.account != null) && this.account.equals(rhs.account)))); } } diff --git a/server/src/main/java/edu/sjsu/moth/server/db/StatusEditCollection.java b/server/src/main/java/edu/sjsu/moth/server/db/StatusEditCollection.java index 5c02175..d67e826 100644 --- a/server/src/main/java/edu/sjsu/moth/server/db/StatusEditCollection.java +++ b/server/src/main/java/edu/sjsu/moth/server/db/StatusEditCollection.java @@ -30,7 +30,9 @@ public StatusEditCollection(String id, ArrayList collection) { } public StatusEditCollection addEdit(Status s) { - StatusEdit edit = new StatusEdit(s.content, s.spoilerText, s.sensitive, s.createdAt, s.account, s.mediaAttachments, s.emojis); + StatusEdit edit = + new StatusEdit(s.content, s.spoilerText, s.sensitive, s.createdAt, s.account, s.mediaAttachments, + s.emojis); collection.add(edit); return this; } diff --git a/server/src/main/java/edu/sjsu/moth/server/db/StatusHistoryRepository.java b/server/src/main/java/edu/sjsu/moth/server/db/StatusHistoryRepository.java index d2ac366..7dd1833 100644 --- a/server/src/main/java/edu/sjsu/moth/server/db/StatusHistoryRepository.java +++ b/server/src/main/java/edu/sjsu/moth/server/db/StatusHistoryRepository.java @@ -3,6 +3,5 @@ import org.springframework.data.mongodb.repository.ReactiveMongoRepository; import org.springframework.data.querydsl.ReactiveQuerydslPredicateExecutor; -public interface StatusHistoryRepository - extends ReactiveMongoRepository, ReactiveQuerydslPredicateExecutor { -} +public interface StatusHistoryRepository extends ReactiveMongoRepository, + ReactiveQuerydslPredicateExecutor {} diff --git a/server/src/main/java/edu/sjsu/moth/server/service/StatusService.java b/server/src/main/java/edu/sjsu/moth/server/service/StatusService.java index 1963e9d..4ecac4d 100644 --- a/server/src/main/java/edu/sjsu/moth/server/service/StatusService.java +++ b/server/src/main/java/edu/sjsu/moth/server/service/StatusService.java @@ -116,8 +116,8 @@ public Mono save(Status status) { })); } - return mono.then(statusRepository.save(status)) - .flatMap(s -> statusHistoryRepository.findById(s.id).defaultIfEmpty(new StatusEditCollection(s.id)) + return mono.then(statusRepository.save(status)).flatMap( + s -> statusHistoryRepository.findById(s.id).defaultIfEmpty(new StatusEditCollection(s.id)) .flatMap(sh -> statusHistoryRepository.save(sh.addEdit(s))).thenReturn(s)); }