AdocContent.java (2871B)
1 package com.wimdupont.personalweb.model.dao; 2 3 import com.wimdupont.personalweb.model.AdocContentType; 4 import com.wimdupont.personalweb.model.dao.projection.AdocContentMeta; 5 import jakarta.persistence.Entity; 6 import jakarta.persistence.EnumType; 7 import jakarta.persistence.Enumerated; 8 import jakarta.persistence.Id; 9 10 import java.time.LocalDateTime; 11 12 @Entity 13 public class AdocContent extends Auditable implements AdocContentMeta { 14 15 @Id 16 private String path; 17 private String contentSha256; 18 private String htmlText; 19 @Enumerated(EnumType.STRING) 20 private AdocContentType contentType; 21 private LocalDateTime committedDate; 22 23 @Override 24 public String getPath() { 25 return path; 26 } 27 28 public void setPath(String path) { 29 this.path = path; 30 } 31 32 public String getContentSha256() { 33 return contentSha256; 34 } 35 36 public void setContentSha256(String contentSha256) { 37 this.contentSha256 = contentSha256; 38 } 39 40 public String getHtmlText() { 41 return htmlText; 42 } 43 44 public void setHtmlText(String htmlText) { 45 this.htmlText = htmlText; 46 } 47 48 @Override 49 public AdocContentType getContentType() { 50 return contentType; 51 } 52 53 public void setContentType(AdocContentType contentType) { 54 this.contentType = contentType; 55 } 56 57 @Override 58 public LocalDateTime getCommittedDate() { 59 return committedDate; 60 } 61 62 public void setCommittedDate(LocalDateTime committedDate) { 63 this.committedDate = committedDate; 64 } 65 66 protected AdocContent() { 67 } 68 69 private AdocContent(Builder builder) { 70 path = builder.path; 71 contentSha256 = builder.contentSha256; 72 htmlText = builder.htmlText; 73 contentType = builder.contentType; 74 committedDate = builder.committedDate; 75 } 76 77 public static final class Builder { 78 private String path; 79 private String contentSha256; 80 private String htmlText; 81 private AdocContentType contentType; 82 private LocalDateTime committedDate; 83 84 private Builder() { 85 } 86 87 public static Builder newBuilder() { 88 return new Builder(); 89 } 90 91 public Builder path(String val) { 92 path = val; 93 return this; 94 } 95 96 public Builder contentSha256(String val) { 97 contentSha256 = val; 98 return this; 99 } 100 101 public Builder htmlText(String val) { 102 htmlText = val; 103 return this; 104 } 105 106 public Builder contentType(AdocContentType val) { 107 contentType = val; 108 return this; 109 } 110 111 public Builder committedDate(LocalDateTime val) { 112 committedDate = val; 113 return this; 114 } 115 116 public AdocContent build() { 117 return new AdocContent(this); 118 } 119 } 120 }