Skip to content
Snippets Groups Projects
Commit bb5a7c25 authored by Eirik Steira's avatar Eirik Steira
Browse files

Fix recursive tostrings in models

parent b7bc52be
No related branches found
No related tags found
2 merge requests!165Weekly merge to Master,!113Fix recursive tostrings in models
Pipeline #78843 passed
......@@ -78,7 +78,6 @@ public class GeoLocation {
public String toString() {
return "GeoLocation{" +
"geoLocationId=" + geoLocationId +
", metadata=" + metadata +
", latitude='" + latitude + '\'' +
", longitude='" + longitude + '\'' +
'}';
......
......@@ -57,7 +57,6 @@ public class Histogram {
public String toString() {
return "Histogram{" +
"histogramId=" + histogramId +
", metadata=" + metadata +
", data='" + data + '\'' +
'}';
}
......
......@@ -156,11 +156,18 @@ public class Image {
.collect(Collectors.toList())
.toString();
String formattedAlbums = "";
if (albums != null)
formattedAlbums = albums.stream()
.map(Album::getId)
.collect(Collectors.toList())
.toString();
return "Image{" +
"id=" + id +
", albums=" + albums +
", albums=" + formattedAlbums +
", tags=" + formattedTags +
", user=" + user +
", user=" + user.getUsername() +
", metadata=" + metadata +
", path='" + path + '\'' +
", uploadedAt=" + uploadedAt +
......
......@@ -72,7 +72,6 @@ public class Metadata {
public String toString() {
return "Metadata{" +
"metadataId=" + metadataId +
", image=" + image +
", geolocation=" + geolocation +
", histogram=" + histogram +
'}';
......
......@@ -192,8 +192,6 @@ public class User {
", birthDate=" + birthDate +
", isAdmin=" + isAdmin +
", isActive=" + isActive +
", albums=" + albums +
", images=" + images +
'}';
}
}
......@@ -39,6 +39,9 @@ public class TagRepository extends AbstractRepository<Tag, Long> {
* @return the tag if found, else the newly created one.
*/
public Tag findOrCreate(Tag tag) {
if (tag.getName().isBlank())
return null;
Tag foundTag;
try {
foundTag = entityManager.createNamedQuery(FIND_TAG_BY_NAME, Tag.class)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment