View Javadoc
1   /*
2    * Copyright (C) 2023 B3Partners B.V.
3    *
4    * SPDX-License-Identifier: MIT
5    */
6   package org.tailormap.api.persistence;
7   
8   import com.fasterxml.jackson.databind.JsonNode;
9   import jakarta.persistence.Column;
10  import jakarta.persistence.Entity;
11  import jakarta.persistence.EntityListeners;
12  import jakarta.persistence.Id;
13  import jakarta.persistence.Version;
14  import org.hibernate.annotations.JdbcTypeCode;
15  import org.hibernate.type.SqlTypes;
16  import org.springframework.data.jpa.domain.support.AuditingEntityListener;
17  import org.tailormap.api.persistence.listener.EntityEventPublisher;
18  
19  @Entity
20  @EntityListeners({EntityEventPublisher.class, AuditingEntityListener.class})
21  public class Configuration extends AuditMetadata {
22    public static final String DEFAULT_APP = "default-app";
23  
24    public static final String DEFAULT_BASE_APP = "default-base-app";
25  
26    public static final String HOME_PAGE = "home-page";
27  
28    public static final String PORTAL_MENU = "portal-menu";
29  
30    @Id
31    private String key;
32  
33    @Version
34    private Long version;
35  
36    @Column(columnDefinition = "text")
37    private String value;
38  
39    @JdbcTypeCode(SqlTypes.JSON)
40    @Column(columnDefinition = "jsonb")
41    private JsonNode jsonValue;
42  
43    private boolean availableForViewer;
44  
45    // <editor-fold desc="getters and setters">
46    public String getKey() {
47      return key;
48    }
49  
50    public void setKey(String key) {
51      this.key = key;
52    }
53  
54    public Long getVersion() {
55      return version;
56    }
57  
58    public Configuration setVersion(Long version) {
59      this.version = version;
60      return this;
61    }
62  
63    public String getValue() {
64      return value;
65    }
66  
67    public void setValue(String value) {
68      this.value = value;
69    }
70  
71    public JsonNode getJsonValue() {
72      return jsonValue;
73    }
74  
75    public void setJsonValue(JsonNode jsonValue) {
76      this.jsonValue = jsonValue;
77    }
78  
79    public boolean isAvailableForViewer() {
80      return availableForViewer;
81    }
82  
83    public void setAvailableForViewer(boolean availableForViewer) {
84      this.availableForViewer = availableForViewer;
85    }
86    // </editor-fold>
87  }