Started aligning notification service entities with the database, code cleanup
This commit is contained in:
parent
7d38ab742d
commit
ca4a9db3f8
|
@ -11,7 +11,7 @@ public class Account {
|
||||||
|
|
||||||
public static class PrincipalInfo {
|
public static class PrincipalInfo {
|
||||||
|
|
||||||
public final static String _userId = "userId";
|
public static final String _userId = "userId";
|
||||||
public UUID userId;
|
public UUID userId;
|
||||||
|
|
||||||
public UUID getUserId() {
|
public UUID getUserId() {
|
||||||
|
@ -22,7 +22,7 @@ public class Account {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _subject = "subject";
|
public static final String _subject = "subject";
|
||||||
public UUID subject;
|
public UUID subject;
|
||||||
|
|
||||||
public UUID getSubject() {
|
public UUID getSubject() {
|
||||||
|
@ -33,7 +33,7 @@ public class Account {
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _name = "name";
|
public static final String _name = "name";
|
||||||
@LogSensitive
|
@LogSensitive
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class Account {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _scope = "scope";
|
public static final String _scope = "scope";
|
||||||
public List<String> scope;
|
public List<String> scope;
|
||||||
|
|
||||||
public List<String> getScope() {
|
public List<String> getScope() {
|
||||||
|
@ -56,7 +56,7 @@ public class Account {
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _client = "client";
|
public static final String _client = "client";
|
||||||
public String client;
|
public String client;
|
||||||
|
|
||||||
public String getClient() {
|
public String getClient() {
|
||||||
|
@ -67,7 +67,7 @@ public class Account {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _notBefore = "notBefore";
|
public static final String _notBefore = "notBefore";
|
||||||
public Instant notBefore;
|
public Instant notBefore;
|
||||||
|
|
||||||
public Instant getNotBefore() {
|
public Instant getNotBefore() {
|
||||||
|
@ -78,7 +78,7 @@ public class Account {
|
||||||
this.notBefore = notBefore;
|
this.notBefore = notBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _issuedAt = "issuedAt";
|
public static final String _issuedAt = "issuedAt";
|
||||||
public Instant issuedAt;
|
public Instant issuedAt;
|
||||||
|
|
||||||
public Instant getIssuedAt() {
|
public Instant getIssuedAt() {
|
||||||
|
@ -89,7 +89,7 @@ public class Account {
|
||||||
this.issuedAt = issuedAt;
|
this.issuedAt = issuedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _authenticatedAt = "authenticatedAt";
|
public static final String _authenticatedAt = "authenticatedAt";
|
||||||
public Instant authenticatedAt;
|
public Instant authenticatedAt;
|
||||||
|
|
||||||
public Instant getAuthenticatedAt() {
|
public Instant getAuthenticatedAt() {
|
||||||
|
@ -100,7 +100,7 @@ public class Account {
|
||||||
this.authenticatedAt = authenticatedAt;
|
this.authenticatedAt = authenticatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _expiresAt = "expiresAt";
|
public static final String _expiresAt = "expiresAt";
|
||||||
public Instant expiresAt;
|
public Instant expiresAt;
|
||||||
|
|
||||||
public Instant getExpiresAt() {
|
public Instant getExpiresAt() {
|
||||||
|
@ -111,7 +111,7 @@ public class Account {
|
||||||
this.expiresAt = expiresAt;
|
this.expiresAt = expiresAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _more = "more";
|
public static final String _more = "more";
|
||||||
@LogSensitive
|
@LogSensitive
|
||||||
public Map<String, List<String>> more;
|
public Map<String, List<String>> more;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class Account {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final static String _isAuthenticated = "isAuthenticated";
|
public static final String _isAuthenticated = "isAuthenticated";
|
||||||
private Boolean isAuthenticated;
|
private Boolean isAuthenticated;
|
||||||
|
|
||||||
public Boolean getIsAuthenticated() {
|
public Boolean getIsAuthenticated() {
|
||||||
|
@ -136,7 +136,7 @@ public class Account {
|
||||||
isAuthenticated = authenticated;
|
isAuthenticated = authenticated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _principal = "principal";
|
public static final String _principal = "principal";
|
||||||
private PrincipalInfo principal;
|
private PrincipalInfo principal;
|
||||||
|
|
||||||
public PrincipalInfo getPrincipal() {
|
public PrincipalInfo getPrincipal() {
|
||||||
|
@ -147,7 +147,7 @@ public class Account {
|
||||||
this.principal = principal;
|
this.principal = principal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String _permissions = "permissions";
|
public static final String _permissions = "permissions";
|
||||||
private List<String> permissions;
|
private List<String> permissions;
|
||||||
|
|
||||||
public List<String> getPermissions() {
|
public List<String> getPermissions() {
|
||||||
|
|
|
@ -4,11 +4,11 @@ import gr.cite.notification.common.enums.NotificationDataType;
|
||||||
|
|
||||||
public class FieldInfo {
|
public class FieldInfo {
|
||||||
private String key;
|
private String key;
|
||||||
public final static String _key = "key";
|
public static final String _key = "key";
|
||||||
private NotificationDataType type;
|
private NotificationDataType type;
|
||||||
public final static String _type = "type";
|
public static final String _type = "type";
|
||||||
private String value;
|
private String value;
|
||||||
public final static String _value = "value";
|
public static final String _value = "value";
|
||||||
|
|
||||||
public FieldInfo(String key, NotificationDataType type, String value) {
|
public FieldInfo(String key, NotificationDataType type, String value) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
|
|
|
@ -7,69 +7,80 @@ import gr.cite.notification.data.conventers.InAppNotificationPriorityConverter;
|
||||||
import gr.cite.notification.data.conventers.IsActiveConverter;
|
import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
import gr.cite.notification.data.conventers.NotificationInAppTrackingConverter;
|
import gr.cite.notification.data.conventers.NotificationInAppTrackingConverter;
|
||||||
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"ntf_InAppNotification\"")
|
@Table(name = "\"ntf_InAppNotification\"")
|
||||||
public class InAppNotificationEntity extends TenantScopedBaseEntity {
|
public class InAppNotificationEntity extends TenantScopedBaseEntity {
|
||||||
public static class Field {
|
|
||||||
public static final String _id = "id";
|
|
||||||
public static final String _userId = "userId";
|
|
||||||
public static final String _isActive = "isActive";
|
|
||||||
public static final String _type = "type";
|
|
||||||
public static final String _readTime = "readTime";
|
|
||||||
public static final String _trackingState = "trackingState";
|
|
||||||
public static final String _priority = "priority";
|
|
||||||
public static final String _subject = "subject";
|
|
||||||
public static final String _body = "body";
|
|
||||||
public static final String _extraData = "extraData";
|
|
||||||
public static final String _createdAt = "createdAt";
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "\"id\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"id\"", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "\"user\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"user\"", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID userId;
|
private UUID userId;
|
||||||
|
|
||||||
|
public static final String _userId = "userId";
|
||||||
|
|
||||||
@Column(name = "\"is_active\"", nullable = false)
|
@Column(name = "\"is_active\"", nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
|
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
@Column(name = "\"type\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"type\"", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID type;
|
private UUID type;
|
||||||
|
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
@Column(name = "\"read_time\"")
|
@Column(name = "\"read_time\"")
|
||||||
private Instant readTime;
|
private Instant readTime;
|
||||||
|
|
||||||
|
public static final String _readTime = "readTime";
|
||||||
|
|
||||||
@Column(name = "\"tracking_state\"", nullable = false)
|
@Column(name = "\"tracking_state\"", nullable = false)
|
||||||
@Convert(converter = NotificationInAppTrackingConverter.class)
|
@Convert(converter = NotificationInAppTrackingConverter.class)
|
||||||
private NotificationInAppTracking trackingState;
|
private NotificationInAppTracking trackingState;
|
||||||
|
|
||||||
|
public static final String _trackingState = "trackingState";
|
||||||
|
|
||||||
@Column(name = "\"priority\"", nullable = false)
|
@Column(name = "\"priority\"", nullable = false)
|
||||||
@Convert(converter = InAppNotificationPriorityConverter.class)
|
@Convert(converter = InAppNotificationPriorityConverter.class)
|
||||||
private InAppNotificationPriority priority;
|
private InAppNotificationPriority priority;
|
||||||
|
|
||||||
|
public static final String _priority = "priority";
|
||||||
|
|
||||||
@Column(name = "\"subject\"")
|
@Column(name = "\"subject\"")
|
||||||
private String subject;
|
private String subject;
|
||||||
|
|
||||||
|
public static final String _subject = "subject";
|
||||||
|
|
||||||
@Column(name = "\"body\"")
|
@Column(name = "\"body\"")
|
||||||
private String body;
|
private String body;
|
||||||
|
|
||||||
|
public static final String _body = "body";
|
||||||
|
|
||||||
@Column(name = "\"extra_data\"")
|
@Column(name = "\"extra_data\"")
|
||||||
private String extraData;
|
private String extraData;
|
||||||
|
|
||||||
|
public static final String _extraData = "extraData";
|
||||||
|
|
||||||
@Column(name = "\"created_at\"", nullable = false)
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
@Column(name = "\"updated_at\"", nullable = false)
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
@Version
|
@Version
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -165,4 +176,5 @@ public class InAppNotificationEntity extends TenantScopedBaseEntity {
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,44 +3,46 @@ package gr.cite.notification.data;
|
||||||
import gr.cite.notification.common.enums.IsActive;
|
import gr.cite.notification.common.enums.IsActive;
|
||||||
import gr.cite.notification.data.conventers.IsActiveConverter;
|
import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"Language\"")
|
@Table(name = "\"ntf_Language\"")
|
||||||
public class LanguageEntity extends TenantScopedBaseEntity {
|
public class LanguageEntity extends TenantScopedBaseEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
public static final String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "code", length = 20, nullable = false)
|
@Column(name = "code", length = 20, nullable = false)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
public static final String _code = "code";
|
public static final String _code = "code";
|
||||||
|
|
||||||
@Column(name = "payload")
|
@Column(name = "ordinal")
|
||||||
private String payload;
|
private Integer ordinal;
|
||||||
public static final String _payload = "payload";
|
|
||||||
|
public static final String _ordinal = "ordinal";
|
||||||
|
|
||||||
@Column(name = "\"created_at\"", nullable = false)
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
|
||||||
public static final String _createdAt = "createdAt";
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
@Column(name = "\"updated_at\"", nullable = false)
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "is_active", nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
public static final String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "ordinal")
|
public static final String _isActive = "isActive";
|
||||||
private Integer ordinal;
|
|
||||||
public static final String _ordinal = "ordinal";
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -58,12 +60,12 @@ public class LanguageEntity extends TenantScopedBaseEntity {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPayload() {
|
public Integer getOrdinal() {
|
||||||
return payload;
|
return ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPayload(String payload) {
|
public void setOrdinal(Integer ordinal) {
|
||||||
this.payload = payload;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
|
@ -89,12 +91,4 @@ public class LanguageEntity extends TenantScopedBaseEntity {
|
||||||
public void setIsActive(IsActive isActive) {
|
public void setIsActive(IsActive isActive) {
|
||||||
this.isActive = isActive;
|
this.isActive = isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrdinal(Integer ordinal) {
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ package gr.cite.notification.data;
|
||||||
import gr.cite.notification.common.enums.*;
|
import gr.cite.notification.common.enums.*;
|
||||||
import gr.cite.notification.data.conventers.*;
|
import gr.cite.notification.data.conventers.*;
|
||||||
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -12,81 +12,100 @@ import java.util.UUID;
|
||||||
@Table(name = "\"ntf_Notification\"")
|
@Table(name = "\"ntf_Notification\"")
|
||||||
public class NotificationEntity extends TenantScopedBaseEntity {
|
public class NotificationEntity extends TenantScopedBaseEntity {
|
||||||
|
|
||||||
public static class Field {
|
|
||||||
public final static String _id = "id";
|
|
||||||
public static final String _userId = "userId";
|
|
||||||
public static final String _type = "type";
|
|
||||||
public static final String _contactTypeHint = "contactTypeHint";
|
|
||||||
public static final String _contactHint = "contactHint";
|
|
||||||
public static final int _contactHintLength = 200;
|
|
||||||
public final static String _notifiedAt = "notifiedAt";
|
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
public final static String _data = "data";
|
|
||||||
public final static String _retryCount = "retryCount";
|
|
||||||
public final static String _notifyState = "notifyState";
|
|
||||||
public final static String _notifiedWith = "notifiedWith";
|
|
||||||
public final static String _tenantId = "tenantId";
|
|
||||||
public final static String _trackingState = "trackingState";
|
|
||||||
public final static String _trackingProcess = "trackingProcess";
|
|
||||||
public final static String _trackingData = "trackingData";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "\"user\"", columnDefinition = "uuid")
|
@Column(name = "\"user\"", columnDefinition = "uuid")
|
||||||
private UUID userId;
|
private UUID userId;
|
||||||
|
|
||||||
|
public static final String _userId = "userId";
|
||||||
|
|
||||||
|
@Column(name = "\"tenant\"", columnDefinition = "uuid")
|
||||||
|
private UUID tenantId;
|
||||||
|
|
||||||
|
public static final String _tenantId = "tenantId";
|
||||||
|
|
||||||
@Column(name = "\"type\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"type\"", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID type;
|
private UUID type;
|
||||||
|
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
@Column(name = "\"contact_type_hint\"")
|
@Column(name = "\"contact_type_hint\"")
|
||||||
@Convert(converter = NotificationContactTypeConverter.class)
|
@Convert(converter = NotificationContactTypeConverter.class)
|
||||||
private NotificationContactType contactTypeHint;
|
private NotificationContactType contactTypeHint;
|
||||||
|
|
||||||
@Column(name = "\"contact_hint\"")
|
public static final String _contactTypeHint = "contactTypeHint";
|
||||||
|
|
||||||
|
@Column(name = "\"contact_hint\"", length = _contactHintLength)
|
||||||
private String contactHint;
|
private String contactHint;
|
||||||
|
|
||||||
|
public static final String _contactHint = "contactHint";
|
||||||
|
|
||||||
|
public static final int _contactHintLength = 200;
|
||||||
|
|
||||||
@Column(name = "\"notify_state\"", nullable = false)
|
@Column(name = "\"notify_state\"", nullable = false)
|
||||||
@Convert(converter = NotificationNotifyStateConverter.class)
|
@Convert(converter = NotificationNotifyStateConverter.class)
|
||||||
private NotificationNotifyState notifyState;
|
private NotificationNotifyState notifyState;
|
||||||
|
|
||||||
|
public static final String _notifyState = "notifyState";
|
||||||
|
|
||||||
@Column(name = "\"notified_with\"")
|
@Column(name = "\"notified_with\"")
|
||||||
@Convert(converter = NotificationContactTypeConverter.class)
|
@Convert(converter = NotificationContactTypeConverter.class)
|
||||||
private NotificationContactType notifiedWith;
|
private NotificationContactType notifiedWith;
|
||||||
|
|
||||||
|
public static final String _notifiedWith = "notifiedWith";
|
||||||
|
|
||||||
@Column(name = "\"notified_at\"")
|
@Column(name = "\"notified_at\"")
|
||||||
private Instant notifiedAt;
|
private Instant notifiedAt;
|
||||||
|
|
||||||
|
public static final String _notifiedAt = "notifiedAt";
|
||||||
|
|
||||||
@Column(name = "\"data\"")
|
@Column(name = "\"data\"")
|
||||||
private String data;
|
private String data;
|
||||||
|
|
||||||
|
public static final String _data = "data";
|
||||||
|
|
||||||
@Column(name = "\"retry_count\"")
|
@Column(name = "\"retry_count\"")
|
||||||
private Integer retryCount;
|
private Integer retryCount;
|
||||||
|
|
||||||
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
public static final String _retryCount = "retryCount";
|
||||||
@Convert(converter = IsActiveConverter.class)
|
|
||||||
private IsActive isActive;
|
|
||||||
|
|
||||||
@Column(name = "\"created_at\"", nullable = false)
|
|
||||||
private Instant createdAt;
|
|
||||||
|
|
||||||
@Column(name = "\"updated_at\"", nullable = false)
|
|
||||||
private Instant updatedAt;
|
|
||||||
|
|
||||||
@Column(name = "\"tracking_state\"", nullable = false)
|
@Column(name = "\"tracking_state\"", nullable = false)
|
||||||
@Convert(converter = NotificationTrackingStateConverter.class)
|
@Convert(converter = NotificationTrackingStateConverter.class)
|
||||||
private NotificationTrackingState trackingState;
|
private NotificationTrackingState trackingState;
|
||||||
|
|
||||||
|
public static final String _trackingState = "trackingState";
|
||||||
|
|
||||||
@Column(name = "\"tracking_process\"", nullable = false)
|
@Column(name = "\"tracking_process\"", nullable = false)
|
||||||
@Convert(converter = NotificationTrackingProcessConverter.class)
|
@Convert(converter = NotificationTrackingProcessConverter.class)
|
||||||
private NotificationTrackingProcess trackingProcess;
|
private NotificationTrackingProcess trackingProcess;
|
||||||
|
|
||||||
|
public static final String _trackingProcess = "trackingProcess";
|
||||||
|
|
||||||
@Column(name = "\"tracking_data\"")
|
@Column(name = "\"tracking_data\"")
|
||||||
private String trackingData;
|
private String trackingData;
|
||||||
|
|
||||||
|
public static final String _trackingData = "trackingData";
|
||||||
|
|
||||||
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
|
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
||||||
|
@Convert(converter = IsActiveConverter.class)
|
||||||
|
private IsActive isActive;
|
||||||
|
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -103,6 +122,16 @@ public class NotificationEntity extends TenantScopedBaseEntity {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUID getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTenantId(UUID tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
public UUID getType() {
|
public UUID getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -127,14 +156,6 @@ public class NotificationEntity extends TenantScopedBaseEntity {
|
||||||
this.contactHint = contactHint;
|
this.contactHint = contactHint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationContactType getNotifiedWith() {
|
|
||||||
return notifiedWith;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNotifiedWith(NotificationContactType notifiedWith) {
|
|
||||||
this.notifiedWith = notifiedWith;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationNotifyState getNotifyState() {
|
public NotificationNotifyState getNotifyState() {
|
||||||
return notifyState;
|
return notifyState;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +164,14 @@ public class NotificationEntity extends TenantScopedBaseEntity {
|
||||||
this.notifyState = notifyState;
|
this.notifyState = notifyState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NotificationContactType getNotifiedWith() {
|
||||||
|
return notifiedWith;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotifiedWith(NotificationContactType notifiedWith) {
|
||||||
|
this.notifiedWith = notifiedWith;
|
||||||
|
}
|
||||||
|
|
||||||
public Instant getNotifiedAt() {
|
public Instant getNotifiedAt() {
|
||||||
return notifiedAt;
|
return notifiedAt;
|
||||||
}
|
}
|
||||||
|
@ -167,30 +196,6 @@ public class NotificationEntity extends TenantScopedBaseEntity {
|
||||||
this.retryCount = retryCount;
|
this.retryCount = retryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
|
||||||
return isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedAt(Instant createdAt) {
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getUpdatedAt() {
|
|
||||||
return updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
|
||||||
this.updatedAt = updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationTrackingState getTrackingState() {
|
public NotificationTrackingState getTrackingState() {
|
||||||
return trackingState;
|
return trackingState;
|
||||||
}
|
}
|
||||||
|
@ -214,4 +219,28 @@ public class NotificationEntity extends TenantScopedBaseEntity {
|
||||||
public void setTrackingData(String trackingData) {
|
public void setTrackingData(String trackingData) {
|
||||||
this.trackingData = trackingData;
|
this.trackingData = trackingData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Instant getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Instant createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package gr.cite.notification.data;
|
package gr.cite.notification.data;
|
||||||
|
|
||||||
import gr.cite.notification.common.enums.*;
|
import gr.cite.notification.common.enums.IsActive;
|
||||||
import gr.cite.notification.data.conventers.*;
|
import gr.cite.notification.common.enums.NotificationTemplateChannel;
|
||||||
|
import gr.cite.notification.common.enums.NotificationTemplateKind;
|
||||||
|
import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
|
import gr.cite.notification.data.conventers.NotificationTemplateChannelConverter;
|
||||||
|
import gr.cite.notification.data.conventers.NotificationTemplateKindConverter;
|
||||||
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -15,42 +19,51 @@ public class NotificationTemplateEntity extends TenantScopedBaseEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "\"channel\"", nullable = false)
|
@Column(name = "\"channel\"", nullable = false)
|
||||||
@Convert(converter = NotificationTemplateChannelConverter.class)
|
@Convert(converter = NotificationTemplateChannelConverter.class)
|
||||||
private NotificationTemplateChannel channel;
|
private NotificationTemplateChannel channel;
|
||||||
public final static String _channel = "channel";
|
|
||||||
|
public static final String _channel = "channel";
|
||||||
|
|
||||||
@Column(name = "\"notification_type\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"notification_type\"", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID notificationType;
|
private UUID notificationType;
|
||||||
public final static String _notificationType = "notificationType";
|
|
||||||
|
public static final String _notificationType = "notificationType";
|
||||||
|
|
||||||
@Column(name = "\"kind\"", nullable = false)
|
@Column(name = "\"kind\"", nullable = false)
|
||||||
@Convert(converter = NotificationTemplateKindConverter.class)
|
@Convert(converter = NotificationTemplateKindConverter.class)
|
||||||
private NotificationTemplateKind kind;
|
private NotificationTemplateKind kind;
|
||||||
public final static String _kind = "kind";
|
|
||||||
|
public static final String _kind = "kind";
|
||||||
|
|
||||||
@Column(name = "\"language\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"language\"", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID languageId;
|
private UUID languageId;
|
||||||
public final static String _languageId = "languageId";
|
|
||||||
|
public static final String _languageId = "languageId";
|
||||||
|
|
||||||
@Column(name = "\"value\"", nullable = false)
|
@Column(name = "\"value\"", nullable = false)
|
||||||
private String value;
|
private String value;
|
||||||
public final static String _value = "value";
|
|
||||||
|
public static final String _value = "value";
|
||||||
|
|
||||||
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
@Column(name = "\"is_active\"", nullable = false)
|
@Column(name = "\"is_active\"", nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "\"created_at\"", nullable = false)
|
public static final String _isActive = "isActive";
|
||||||
private Instant createdAt;
|
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
|
||||||
@Column(name = "\"updated_at\"", nullable = false)
|
|
||||||
private Instant updatedAt;
|
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -100,14 +113,6 @@ public class NotificationTemplateEntity extends TenantScopedBaseEntity {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
|
||||||
return isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
@ -123,4 +128,13 @@ public class NotificationTemplateEntity extends TenantScopedBaseEntity {
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,8 @@ import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
import gr.cite.notification.data.types.JsonSQLType;
|
import gr.cite.notification.data.types.JsonSQLType;
|
||||||
import gr.cite.queueinbox.entity.QueueInbox;
|
import gr.cite.queueinbox.entity.QueueInbox;
|
||||||
import gr.cite.queueinbox.entity.QueueInboxStatus;
|
import gr.cite.queueinbox.entity.QueueInboxStatus;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
import org.hibernate.usertype.UserType;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -16,62 +14,76 @@ import java.util.UUID;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"ntf_QueueInbox\"")
|
@Table(name = "\"ntf_QueueInbox\"")
|
||||||
public class QueueInboxEntity implements QueueInbox {
|
public class QueueInboxEntity implements QueueInbox {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "\"queue\"", nullable = false, length = 50)
|
@Column(name = "\"queue\"", nullable = false, length = 50)
|
||||||
private String queue;
|
private String queue;
|
||||||
public final static String _queue = "queue";
|
|
||||||
|
public static final String _queue = "queue";
|
||||||
|
|
||||||
@Column(name = "\"exchange\"", nullable = false, length = 50)
|
@Column(name = "\"exchange\"", nullable = false, length = 50)
|
||||||
private String exchange;
|
private String exchange;
|
||||||
public final static String _exchange = "exchange";
|
|
||||||
|
public static final String _exchange = "exchange";
|
||||||
|
|
||||||
@Column(name = "\"route\"", nullable = false, length = 50)
|
@Column(name = "\"route\"", nullable = false, length = 50)
|
||||||
private String route;
|
private String route;
|
||||||
public final static String _route = "route";
|
|
||||||
|
public static final String _route = "route";
|
||||||
|
|
||||||
@Column(name = "\"application_id\"", nullable = false, length = 100)
|
@Column(name = "\"application_id\"", nullable = false, length = 100)
|
||||||
private String applicationId;
|
private String applicationId;
|
||||||
public final static String _applicationId = "applicationId";
|
|
||||||
|
public static final String _applicationId = "applicationId";
|
||||||
|
|
||||||
@Column(name = "\"message_id\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"message_id\"", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID messageId;
|
private UUID messageId;
|
||||||
public final static String _messageId = "messageId";
|
|
||||||
|
public static final String _messageId = "messageId";
|
||||||
|
|
||||||
@Type(JsonSQLType.class)
|
@Type(JsonSQLType.class)
|
||||||
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
||||||
private String message;
|
private String message;
|
||||||
public final static String _message = "message";
|
|
||||||
|
|
||||||
@Column(name = "\"retry_count\"", nullable = true)
|
public static final String _message = "message";
|
||||||
|
|
||||||
|
@Column(name = "\"retry_count\"")
|
||||||
private Integer retryCount;
|
private Integer retryCount;
|
||||||
public final static String _retryCount = "retryCount";
|
|
||||||
|
|
||||||
@Column(name = "\"tenant\"", columnDefinition = "uuid", nullable = true)
|
public static final String _retryCount = "retryCount";
|
||||||
|
|
||||||
|
@Column(name = "\"tenant\"", columnDefinition = "uuid")
|
||||||
private UUID tenantId;
|
private UUID tenantId;
|
||||||
public final static String _tenantId = "tenantId";
|
|
||||||
|
|
||||||
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
public static final String _tenantId = "tenantId";
|
||||||
@Convert(converter = IsActiveConverter.class)
|
|
||||||
private IsActive isActive;
|
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "\"status\"", length = 50, nullable = false)
|
@Column(name = "\"status\"", length = 50, nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private QueueInboxStatus status;
|
private QueueInboxStatus status;
|
||||||
public final static String _status = "status";
|
|
||||||
|
public static final String _status = "status";
|
||||||
|
|
||||||
@Column(name = "\"created_at\"", nullable = false)
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
@Column(name = "\"updated_at\"", nullable = false)
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
@Version
|
@Version
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
|
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
||||||
|
@Convert(converter = IsActiveConverter.class)
|
||||||
|
private IsActive isActive;
|
||||||
|
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -81,6 +93,14 @@ public class QueueInboxEntity implements QueueInbox {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getQueue() {
|
||||||
|
return queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQueue(String queue) {
|
||||||
|
this.queue = queue;
|
||||||
|
}
|
||||||
|
|
||||||
public String getExchange() {
|
public String getExchange() {
|
||||||
return exchange;
|
return exchange;
|
||||||
}
|
}
|
||||||
|
@ -97,6 +117,14 @@ public class QueueInboxEntity implements QueueInbox {
|
||||||
this.route = route;
|
this.route = route;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getApplicationId() {
|
||||||
|
return applicationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationId(String applicationId) {
|
||||||
|
this.applicationId = applicationId;
|
||||||
|
}
|
||||||
|
|
||||||
public UUID getMessageId() {
|
public UUID getMessageId() {
|
||||||
return messageId;
|
return messageId;
|
||||||
}
|
}
|
||||||
|
@ -113,6 +141,15 @@ public class QueueInboxEntity implements QueueInbox {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getRetryCount() {
|
||||||
|
return retryCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRetryCount(Integer retryCount) {
|
||||||
|
this.retryCount = retryCount;
|
||||||
|
}
|
||||||
|
|
||||||
public UUID getTenantId() {
|
public UUID getTenantId() {
|
||||||
return tenantId;
|
return tenantId;
|
||||||
}
|
}
|
||||||
|
@ -121,14 +158,15 @@ public class QueueInboxEntity implements QueueInbox {
|
||||||
this.tenantId = tenantId;
|
this.tenantId = tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
public QueueInboxStatus getStatus() {
|
||||||
return isActive;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
public void setStatus(QueueInboxStatus status) {
|
||||||
this.isActive = isActive;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
@ -145,37 +183,12 @@ public class QueueInboxEntity implements QueueInbox {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQueue() {
|
public IsActive getIsActive() {
|
||||||
return queue;
|
return isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQueue(String queue) {
|
public void setIsActive(IsActive isActive) {
|
||||||
this.queue = queue;
|
this.isActive = isActive;
|
||||||
}
|
|
||||||
|
|
||||||
public String getApplicationId() {
|
|
||||||
return applicationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApplicationId(String applicationId) {
|
|
||||||
this.applicationId = applicationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer getRetryCount() {
|
|
||||||
return retryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRetryCount(Integer retryCount) {
|
|
||||||
this.retryCount = retryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QueueInboxStatus getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(QueueInboxStatus status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,77 +1,92 @@
|
||||||
package gr.cite.notification.data;
|
package gr.cite.notification.data;
|
||||||
|
|
||||||
|
|
||||||
import gr.cite.notification.common.enums.IsActive;
|
import gr.cite.notification.common.enums.IsActive;
|
||||||
import gr.cite.notification.data.conventers.IsActiveConverter;
|
import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
import gr.cite.queueoutbox.entity.QueueOutbox;
|
import gr.cite.queueoutbox.entity.QueueOutbox;
|
||||||
import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus;
|
import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"ntf_QueueOutbox\"")
|
@Table(name = "\"ntf_QueueOutbox\"")
|
||||||
public class QueueOutboxEntity implements QueueOutbox {
|
public class QueueOutboxEntity implements QueueOutbox {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "\"exchange\"", nullable = false, length = 50)
|
@Column(name = "\"exchange\"", nullable = false, length = 50)
|
||||||
private String exchange;
|
private String exchange;
|
||||||
public final static String _exchange = "exchange";
|
|
||||||
|
public static final String _exchange = "exchange";
|
||||||
|
|
||||||
@Column(name = "\"route\"", length = 50)
|
@Column(name = "\"route\"", length = 50)
|
||||||
private String route;
|
private String route;
|
||||||
public final static String _route = "route";
|
|
||||||
|
public static final String _route = "route";
|
||||||
|
|
||||||
@Column(name = "\"message_id\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"message_id\"", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID messageId;
|
private UUID messageId;
|
||||||
public final static String _messageId = "messageId";
|
|
||||||
|
public static final String _messageId = "messageId";
|
||||||
|
|
||||||
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
||||||
private String message;
|
private String message;
|
||||||
public final static String _message = "message";
|
|
||||||
|
public static final String _message = "message";
|
||||||
|
|
||||||
@Column(name = "\"notify_status\"", length = 20, nullable = false)
|
@Column(name = "\"notify_status\"", length = 20, nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private QueueOutboxNotifyStatus notifyStatus;
|
private QueueOutboxNotifyStatus notifyStatus;
|
||||||
public final static String _notifyStatus = "notifyStatus";
|
|
||||||
|
public static final String _notifyStatus = "notifyStatus";
|
||||||
|
|
||||||
@Column(name = "\"retry_count\"", nullable = false)
|
@Column(name = "\"retry_count\"", nullable = false)
|
||||||
private int retryCount;
|
private Integer retryCount;
|
||||||
public final static String _retryCount = "retryCount";
|
|
||||||
|
|
||||||
@Column(name = "\"published_at\"", nullable = true)
|
public static final String _retryCount = "retryCount";
|
||||||
|
|
||||||
|
@Column(name = "\"published_at\"")
|
||||||
private Instant publishedAt;
|
private Instant publishedAt;
|
||||||
public final static String _publishedAt = "publishedAt";
|
|
||||||
|
|
||||||
@Column(name = "\"confirmed_at\"", nullable = true)
|
public static final String _publishedAt = "publishedAt";
|
||||||
|
|
||||||
|
@Column(name = "\"confirmed_at\"")
|
||||||
private Instant confirmedAt;
|
private Instant confirmedAt;
|
||||||
public final static String _confirmedAt = "confirmedAt";
|
|
||||||
|
|
||||||
@Column(name = "\"tenant\"", columnDefinition = "uuid", nullable = true)
|
public static final String _confirmedAt = "confirmedAt";
|
||||||
|
|
||||||
|
@Column(name = "\"tenant\"", columnDefinition = "uuid")
|
||||||
private UUID tenantId;
|
private UUID tenantId;
|
||||||
public final static String _tenantId = "tenantId";
|
|
||||||
|
public static final String _tenantId = "tenantId";
|
||||||
|
|
||||||
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "\"created_at\"", nullable = false)
|
public static final String _isActive = "isActive";
|
||||||
private Instant createdAt;
|
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
|
||||||
@Column(name = "\"updated_at\"", nullable = false)
|
|
||||||
private Instant updatedAt;
|
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setId(UUID id) {
|
public void setId(UUID id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
@ -84,38 +99,47 @@ public class QueueOutboxEntity implements QueueOutbox {
|
||||||
this.exchange = exchange;
|
this.exchange = exchange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getRoute() {
|
public String getRoute() {
|
||||||
return route;
|
return route;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRoute(String route) {
|
public void setRoute(String route) {
|
||||||
this.route = route;
|
this.route = route;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public UUID getMessageId() {
|
public UUID getMessageId() {
|
||||||
return messageId;
|
return messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMessageId(UUID messageId) {
|
public void setMessageId(UUID messageId) {
|
||||||
this.messageId = messageId;
|
this.messageId = messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMessage(String message) {
|
public void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public QueueOutboxNotifyStatus getNotifyStatus() {
|
public QueueOutboxNotifyStatus getNotifyStatus() {
|
||||||
return notifyStatus;
|
return notifyStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setNotifyStatus(QueueOutboxNotifyStatus notifyStatus) {
|
public void setNotifyStatus(QueueOutboxNotifyStatus notifyStatus) {
|
||||||
this.notifyStatus = notifyStatus;
|
this.notifyStatus = notifyStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Integer getRetryCount() {
|
public Integer getRetryCount() {
|
||||||
return retryCount;
|
return retryCount;
|
||||||
}
|
}
|
||||||
|
@ -124,18 +148,22 @@ public class QueueOutboxEntity implements QueueOutbox {
|
||||||
this.retryCount = retryCount;
|
this.retryCount = retryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Instant getPublishedAt() {
|
public Instant getPublishedAt() {
|
||||||
return publishedAt;
|
return publishedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPublishedAt(Instant publishedAt) {
|
public void setPublishedAt(Instant publishedAt) {
|
||||||
this.publishedAt = publishedAt;
|
this.publishedAt = publishedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Instant getConfirmedAt() {
|
public Instant getConfirmedAt() {
|
||||||
return confirmedAt;
|
return confirmedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setConfirmedAt(Instant confirmedAt) {
|
public void setConfirmedAt(Instant confirmedAt) {
|
||||||
this.confirmedAt = confirmedAt;
|
this.confirmedAt = confirmedAt;
|
||||||
}
|
}
|
||||||
|
@ -148,18 +176,12 @@ public class QueueOutboxEntity implements QueueOutbox {
|
||||||
this.tenantId = tenantId;
|
this.tenantId = tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
@Override
|
||||||
return isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCreatedAt(Instant createdAt) {
|
public void setCreatedAt(Instant createdAt) {
|
||||||
this.createdAt = createdAt;
|
this.createdAt = createdAt;
|
||||||
}
|
}
|
||||||
|
@ -171,5 +193,13 @@ public class QueueOutboxEntity implements QueueOutbox {
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ import gr.cite.notification.common.enums.TenantConfigurationType;
|
||||||
import gr.cite.notification.data.conventers.IsActiveConverter;
|
import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
import gr.cite.notification.data.conventers.TenantConfigurationTypeConverter;
|
import gr.cite.notification.data.conventers.TenantConfigurationTypeConverter;
|
||||||
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -14,36 +14,43 @@ import java.util.UUID;
|
||||||
@Table(name = "\"ntf_TenantConfiguration\"")
|
@Table(name = "\"ntf_TenantConfiguration\"")
|
||||||
public class TenantConfigurationEntity extends TenantScopedBaseEntity {
|
public class TenantConfigurationEntity extends TenantScopedBaseEntity {
|
||||||
|
|
||||||
public static class Field {
|
|
||||||
public static final String ID = "id";
|
|
||||||
public static final String TENANT_ID = "tenantId";
|
|
||||||
public static final String TYPE = "type";
|
|
||||||
public static final String VALUE = "value";
|
|
||||||
public static final String IS_ACTIVE = "isActive";
|
|
||||||
public static final String CREATED_AT = "createdAt";
|
|
||||||
public static final String UPDATED_AT = "updatedAt";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "type", nullable = false)
|
@Column(name = "type", nullable = false)
|
||||||
@Convert(converter = TenantConfigurationTypeConverter.class)
|
@Convert(converter = TenantConfigurationTypeConverter.class)
|
||||||
private TenantConfigurationType type;
|
private TenantConfigurationType type;
|
||||||
|
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
@Column(name = "value", nullable = false)
|
@Column(name = "value", nullable = false)
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
public static final String _value = "value";
|
||||||
|
|
||||||
|
@Column(name = "\"tenant\"", columnDefinition = "uuid")
|
||||||
|
private UUID tenantId;
|
||||||
|
|
||||||
|
public static final String _tenantId = "tenantId";
|
||||||
|
|
||||||
|
@Column(name = "created_at", nullable = false)
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "updated_at", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "is_active", nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
public static final String _isActive = "isActive";
|
||||||
private Instant createdAt;
|
|
||||||
|
|
||||||
@Column(name = "updated_at", nullable = false)
|
|
||||||
private Instant updatedAt;
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -69,12 +76,14 @@ public class TenantConfigurationEntity extends TenantScopedBaseEntity {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
@Override
|
||||||
return isActive;
|
public UUID getTenantId() {
|
||||||
|
return tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
@Override
|
||||||
this.isActive = isActive;
|
public void setTenantId(UUID tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
|
@ -92,4 +101,13 @@ public class TenantConfigurationEntity extends TenantScopedBaseEntity {
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,47 +2,41 @@ package gr.cite.notification.data;
|
||||||
|
|
||||||
import gr.cite.notification.common.enums.IsActive;
|
import gr.cite.notification.common.enums.IsActive;
|
||||||
import gr.cite.notification.data.conventers.IsActiveConverter;
|
import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"Tenant\"")
|
@Table(name = "\"ntf_Tenant\"")
|
||||||
public class TenantEntity {
|
public class TenantEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "code", length = 200, nullable = false)
|
@Column(name = "code", length = 200, nullable = false)
|
||||||
private String code;
|
private String code;
|
||||||
public final static String _code = "code";
|
|
||||||
|
|
||||||
@Column(name = "name", length = 500, nullable = false)
|
public static final String _code = "code";
|
||||||
private String name;
|
|
||||||
public final static String _name = "name";
|
|
||||||
|
|
||||||
@Column(name = "description", nullable = false)
|
@Column(name = "created_at", nullable = false)
|
||||||
private String description;
|
private Instant createdAt;
|
||||||
public final static String _description = "description";
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "updated_at", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
@Column(name = "is_active", length = 20, nullable = false)
|
@Column(name = "is_active", length = 20, nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "config")
|
public static final String _isActive = "isActive";
|
||||||
private String config;
|
|
||||||
public final static String _config = "config";
|
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
|
||||||
private Instant createdAt;
|
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
|
||||||
@Column(name = "updated_at", nullable = false)
|
|
||||||
private Instant updatedAt;
|
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -60,38 +54,6 @@ public class TenantEntity {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
|
||||||
return isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConfig() {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConfig(String config) {
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
@ -107,4 +69,13 @@ public class TenantEntity {
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,35 +3,41 @@ package gr.cite.notification.data;
|
||||||
import gr.cite.notification.common.enums.IsActive;
|
import gr.cite.notification.common.enums.IsActive;
|
||||||
import gr.cite.notification.data.conventers.IsActiveConverter;
|
import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"TenantUser\"")
|
@Table(name = "\"TenantUser\"")
|
||||||
public class TenantUserEntity extends TenantScopedBaseEntity {
|
public class TenantUserEntity extends TenantScopedBaseEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "user", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "user", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID userId;
|
private UUID userId;
|
||||||
public final static String _userId = "userId";
|
|
||||||
|
public static final String _userId = "userId";
|
||||||
|
|
||||||
|
@Column(name = "created_at", nullable = false)
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "updated_at", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
@Column(name = "is_active", length = 100, nullable = false)
|
@Column(name = "is_active", length = 100, nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
public static final String _isActive = "isActive";
|
||||||
private Instant createdAt;
|
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
|
||||||
@Column(name = "updated_at", nullable = false)
|
|
||||||
private Instant updatedAt;
|
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -49,14 +55,6 @@ public class TenantUserEntity extends TenantScopedBaseEntity{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
|
||||||
return isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
@ -72,4 +70,12 @@ public class TenantUserEntity extends TenantScopedBaseEntity{
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ package gr.cite.notification.data;
|
||||||
import gr.cite.notification.common.enums.ContactInfoType;
|
import gr.cite.notification.common.enums.ContactInfoType;
|
||||||
import gr.cite.notification.data.conventers.ContactInfoTypeConverter;
|
import gr.cite.notification.data.conventers.ContactInfoTypeConverter;
|
||||||
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -15,30 +15,34 @@ public class UserContactInfoEntity extends TenantScopedBaseEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
public static final String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "\"user\"", nullable = false)
|
@Column(name = "\"user\"", nullable = false)
|
||||||
private UUID userId;
|
private UUID userId;
|
||||||
|
|
||||||
public static final String _userId = "userId";
|
public static final String _userId = "userId";
|
||||||
|
|
||||||
@Column(name = "\"ordinal\"", nullable = false)
|
@Column(name = "\"ordinal\"", nullable = false)
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
public static final String _ordinal = "ordinal";
|
|
||||||
|
|
||||||
|
public static final String _ordinal = "ordinal";
|
||||||
|
|
||||||
@Column(name = "type", length = 100, nullable = false)
|
@Column(name = "type", length = 100, nullable = false)
|
||||||
@Convert(converter = ContactInfoTypeConverter.class)
|
@Convert(converter = ContactInfoTypeConverter.class)
|
||||||
private ContactInfoType type;
|
private ContactInfoType type;
|
||||||
public final static String _type = "type";
|
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
@Column(name = "value", nullable = false)
|
@Column(name = "value", nullable = false)
|
||||||
private String value;
|
private String value;
|
||||||
public final static String _value = "value";
|
|
||||||
|
public static final String _value = "value";
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
@Column(name = "created_at", nullable = false)
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
public UUID getUserId() {
|
public UUID getUserId() {
|
||||||
return userId;
|
return userId;
|
||||||
|
|
|
@ -14,16 +14,16 @@ public class UserCredentialEntity extends TenantScopedBaseEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "\"user\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"user\"", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID userId;
|
private UUID userId;
|
||||||
public final static String _userId = "userId";
|
public static final String _userId = "userId";
|
||||||
|
|
||||||
@Column(name = "\"external_id\"", length = UserCredentialEntity._externalIdLength, nullable = false)
|
@Column(name = "\"external_id\"", length = UserCredentialEntity._externalIdLength, nullable = false)
|
||||||
private String externalId;
|
private String externalId;
|
||||||
public final static String _externalId = "externalId";
|
public static final String _externalId = "externalId";
|
||||||
public final static int _externalIdLength = 512;
|
public static final int _externalIdLength = 512;
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
@Column(name = "created_at", nullable = false)
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
|
|
@ -2,8 +2,8 @@ package gr.cite.notification.data;
|
||||||
|
|
||||||
import gr.cite.notification.common.enums.IsActive;
|
import gr.cite.notification.common.enums.IsActive;
|
||||||
import gr.cite.notification.data.conventers.IsActiveConverter;
|
import gr.cite.notification.data.conventers.IsActiveConverter;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -14,13 +14,20 @@ public class UserEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
|
||||||
|
|
||||||
@Column(name = "name", length = UserEntity._nameLength, nullable = true)
|
public static final String _id = "id";
|
||||||
|
|
||||||
|
@Column(name = "name", length = UserEntity._nameLength)
|
||||||
private String name = null;
|
private String name = null;
|
||||||
public final static String _name = "name";
|
|
||||||
public final static int _nameLength = 250;
|
|
||||||
|
|
||||||
|
public static final String _name = "name";
|
||||||
|
|
||||||
|
public static final int _nameLength = 250;
|
||||||
|
|
||||||
|
@Column(name = "additional_info")
|
||||||
|
private String additionalInfo;
|
||||||
|
|
||||||
|
public static final String _additionalInfo = "additionalInfo";
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
@Column(name = "created_at", nullable = false)
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
@ -35,11 +42,8 @@ public class UserEntity {
|
||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "is_active", nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
@Convert(converter = IsActiveConverter.class)
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
public static final String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "additional_info", nullable = true)
|
public static final String _isActive = "isActive";
|
||||||
private String additionalInfo;
|
|
||||||
public final static String _additionalInfo = "additionalInfo";
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -57,6 +61,14 @@ public class UserEntity {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAdditionalInfo() {
|
||||||
|
return additionalInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdditionalInfo(String additionalInfo) {
|
||||||
|
this.additionalInfo = additionalInfo;
|
||||||
|
}
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
@ -81,11 +93,4 @@ public class UserEntity {
|
||||||
this.isActive = isActive;
|
this.isActive = isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdditionalInfo() {
|
|
||||||
return additionalInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdditionalInfo(String additionalInfo) {
|
|
||||||
this.additionalInfo = additionalInfo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import gr.cite.notification.common.enums.NotificationContactType;
|
||||||
import gr.cite.notification.data.composite.CompositeUserNotificationPreferenceId;
|
import gr.cite.notification.data.composite.CompositeUserNotificationPreferenceId;
|
||||||
import gr.cite.notification.data.conventers.NotificationContactTypeConverter;
|
import gr.cite.notification.data.conventers.NotificationContactTypeConverter;
|
||||||
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
import gr.cite.notification.data.tenant.TenantScopedBaseEntity;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -14,33 +14,35 @@ import java.util.UUID;
|
||||||
@IdClass(CompositeUserNotificationPreferenceId.class)
|
@IdClass(CompositeUserNotificationPreferenceId.class)
|
||||||
public class UserNotificationPreferenceEntity extends TenantScopedBaseEntity {
|
public class UserNotificationPreferenceEntity extends TenantScopedBaseEntity {
|
||||||
|
|
||||||
public static class Field {
|
|
||||||
public static final String USER_ID = "userId";
|
|
||||||
public static final String TYPE = "type";
|
|
||||||
public static final String CHANNEL = "channel";
|
|
||||||
public static final String ORDINAL = "ordinal";
|
|
||||||
public static final String CREATED_AT = "createdAt";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "user", columnDefinition = "uuid", nullable = false)
|
@Column(name = "user", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID userId;
|
private UUID userId;
|
||||||
|
|
||||||
|
public static final String _userId = "userId";
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "type", columnDefinition = "uuid", nullable = false)
|
@Column(name = "type", columnDefinition = "uuid", nullable = false)
|
||||||
private UUID type;
|
private UUID type;
|
||||||
|
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "channel", nullable = false)
|
@Column(name = "channel", nullable = false)
|
||||||
@Convert(converter = NotificationContactTypeConverter.class)
|
@Convert(converter = NotificationContactTypeConverter.class)
|
||||||
private NotificationContactType channel;
|
private NotificationContactType channel;
|
||||||
|
|
||||||
|
public static final String _channel = "channel";
|
||||||
|
|
||||||
@Column(name = "ordinal", nullable = false)
|
@Column(name = "ordinal", nullable = false)
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
|
|
||||||
|
public static final String _ordinal = "ordinal";
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
@Column(name = "created_at", nullable = false)
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
public UUID getUserId() {
|
public UUID getUserId() {
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,28 +8,32 @@ import java.util.UUID;
|
||||||
public class Language {
|
public class Language {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
public static final String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
public static final String _code = "code";
|
public static final String _code = "code";
|
||||||
|
|
||||||
private String payload;
|
private Integer ordinal;
|
||||||
public static final String _payload = "payload";
|
|
||||||
|
public static final String _ordinal = "ordinal";
|
||||||
|
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
|
||||||
public static final String _createdAt = "createdAt";
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
|
|
||||||
public static final String _isActive = "isActive";
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
private Integer ordinal;
|
|
||||||
public static final String _ordinal = "ordinal";
|
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
public final static String _hash = "hash";
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -47,12 +51,12 @@ public class Language {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPayload() {
|
public Integer getOrdinal() {
|
||||||
return payload;
|
return ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPayload(String payload) {
|
public void setOrdinal(Integer ordinal) {
|
||||||
this.payload = payload;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
|
@ -79,14 +83,6 @@ public class Language {
|
||||||
this.isActive = isActive;
|
this.isActive = isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrdinal(Integer ordinal) {
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHash() {
|
public String getHash() {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,64 +1,83 @@
|
||||||
package gr.cite.notification.model;
|
package gr.cite.notification.model;
|
||||||
|
|
||||||
import gr.cite.notification.common.enums.*;
|
import gr.cite.notification.common.enums.*;
|
||||||
import gr.cite.notification.data.conventers.IsActiveConverter;
|
|
||||||
import gr.cite.notification.data.conventers.NotificationTrackingProcessConverter;
|
|
||||||
import gr.cite.notification.data.conventers.NotificationTrackingStateConverter;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Convert;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Notification {
|
public class Notification {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
private Tenant tenant;
|
private Tenant tenant;
|
||||||
public final static String _tenant = "tenant";
|
|
||||||
|
public static final String _tenant = "tenant";
|
||||||
|
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
public static final String _user = "user";
|
public static final String _user = "user";
|
||||||
|
|
||||||
private UUID type;
|
private UUID type;
|
||||||
|
|
||||||
public static final String _type = "type";
|
public static final String _type = "type";
|
||||||
|
|
||||||
private NotificationContactType contactTypeHint;
|
private NotificationContactType contactTypeHint;
|
||||||
|
|
||||||
public static final String _contactTypeHint = "contactTypeHint";
|
public static final String _contactTypeHint = "contactTypeHint";
|
||||||
|
|
||||||
private String contactHint;
|
private String contactHint;
|
||||||
|
|
||||||
public static final String _contactHint = "contactHint";
|
public static final String _contactHint = "contactHint";
|
||||||
|
|
||||||
private Instant notifiedAt;
|
private Instant notifiedAt;
|
||||||
public final static String _notifiedAt = "notifiedAt";
|
|
||||||
|
public static final String _notifiedAt = "notifiedAt";
|
||||||
|
|
||||||
|
private String data;
|
||||||
|
|
||||||
|
public static final String _data = "data";
|
||||||
|
|
||||||
private NotificationNotifyState notifyState;
|
private NotificationNotifyState notifyState;
|
||||||
public final static String _notifyState = "notifyState";
|
|
||||||
|
public static final String _notifyState = "notifyState";
|
||||||
|
|
||||||
private NotificationContactType notifiedWith;
|
private NotificationContactType notifiedWith;
|
||||||
public final static String _notifiedWith = "notifiedWith";
|
|
||||||
|
public static final String _notifiedWith = "notifiedWith";
|
||||||
|
|
||||||
private Integer retryCount;
|
private Integer retryCount;
|
||||||
public final static String _retryCount = "retryCount";
|
|
||||||
|
public static final String _retryCount = "retryCount";
|
||||||
|
|
||||||
private NotificationTrackingState trackingState;
|
private NotificationTrackingState trackingState;
|
||||||
public final static String _trackingState = "trackingState";
|
|
||||||
|
public static final String _trackingState = "trackingState";
|
||||||
|
|
||||||
private NotificationTrackingProcess trackingProcess;
|
private NotificationTrackingProcess trackingProcess;
|
||||||
public final static String _trackingProcess = "trackingProcess";
|
|
||||||
|
public static final String _trackingProcess = "trackingProcess";
|
||||||
|
|
||||||
|
private String trackingData;
|
||||||
|
|
||||||
|
public static final String _trackingData = "trackingData";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
public final static String _hash = "hash";
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -92,11 +111,11 @@ public class Notification {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public gr.cite.notification.common.enums.NotificationContactType getContactTypeHint() {
|
public NotificationContactType getContactTypeHint() {
|
||||||
return contactTypeHint;
|
return contactTypeHint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContactTypeHint(gr.cite.notification.common.enums.NotificationContactType contactTypeHint) {
|
public void setContactTypeHint(NotificationContactType contactTypeHint) {
|
||||||
this.contactTypeHint = contactTypeHint;
|
this.contactTypeHint = contactTypeHint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +135,14 @@ public class Notification {
|
||||||
this.notifiedAt = notifiedAt;
|
this.notifiedAt = notifiedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(String data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
public NotificationNotifyState getNotifyState() {
|
public NotificationNotifyState getNotifyState() {
|
||||||
return notifyState;
|
return notifyState;
|
||||||
}
|
}
|
||||||
|
@ -156,6 +183,14 @@ public class Notification {
|
||||||
this.trackingProcess = trackingProcess;
|
this.trackingProcess = trackingProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTrackingData() {
|
||||||
|
return trackingData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrackingData(String trackingData) {
|
||||||
|
this.trackingData = trackingData;
|
||||||
|
}
|
||||||
|
|
||||||
public String getHash() {
|
public String getHash() {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,37 +12,37 @@ import java.util.UUID;
|
||||||
public class NotificationTemplate {
|
public class NotificationTemplate {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
private NotificationTemplateChannel channel;
|
private NotificationTemplateChannel channel;
|
||||||
public final static String _channel = "channel";
|
public static final String _channel = "channel";
|
||||||
|
|
||||||
private UUID notificationType;
|
private UUID notificationType;
|
||||||
public final static String _notificationType = "notificationType";
|
public static final String _notificationType = "notificationType";
|
||||||
|
|
||||||
private NotificationTemplateKind kind;
|
private NotificationTemplateKind kind;
|
||||||
public final static String _kind = "kind";
|
public static final String _kind = "kind";
|
||||||
|
|
||||||
private Language language;
|
private Language language;
|
||||||
public final static String _language = "language";
|
public static final String _language = "language";
|
||||||
|
|
||||||
private NotificationTemplateValue value;
|
private NotificationTemplateValue value;
|
||||||
public final static String _value = "value";
|
public static final String _value = "value";
|
||||||
|
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
public final static String _isActive = "isActive";
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
public final static String _createdAt = "createdAt";
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
public final static String _updatedAt = "updatedAt";
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
private Tenant tenant;
|
private Tenant tenant;
|
||||||
public final static String _tenant = "tenant";
|
public static final String _tenant = "tenant";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
public final static String _hash = "hash";
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package gr.cite.notification.model;
|
package gr.cite.notification.model;
|
||||||
|
|
||||||
import gr.cite.notification.common.enums.IsActive;
|
import gr.cite.notification.common.enums.IsActive;
|
||||||
import gr.cite.notification.model.tenantconfig.TenantConfig;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -9,32 +8,29 @@ import java.util.UUID;
|
||||||
public class Tenant {
|
public class Tenant {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
public final static String _code = "code";
|
|
||||||
|
|
||||||
private String name;
|
public static final String _code = "code";
|
||||||
public final static String _name = "name";
|
|
||||||
|
|
||||||
private String description;
|
|
||||||
public final static String _description = "description";
|
|
||||||
|
|
||||||
private IsActive isActive;
|
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
private TenantConfig config;
|
|
||||||
public final static String _config = "config";
|
|
||||||
|
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
|
||||||
public final static String _hash = "hash";
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
|
private IsActive isActive;
|
||||||
|
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -51,38 +47,6 @@ public class Tenant {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
|
||||||
return isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TenantConfig getConfig() {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConfig(TenantConfig config) {
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public Instant getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
@ -99,6 +63,14 @@ public class Tenant {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
public String getHash() {
|
public String getHash() {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
@ -106,4 +78,5 @@ public class Tenant {
|
||||||
public void setHash(String hash) {
|
public void setHash(String hash) {
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,31 +11,50 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class TenantConfiguration {
|
public class TenantConfiguration {
|
||||||
|
|
||||||
public static class Field {
|
|
||||||
public static final String ID = "id";
|
|
||||||
public static final String TENANT_ID = "tenantId";
|
|
||||||
public static final String TYPE = "type";
|
|
||||||
public static final String VALUE = "value";
|
|
||||||
public static final String EMAIL_CLIENT_DATA = "emailClientData";
|
|
||||||
public static final String DEFAULT_USER_LOCALE_DATA = "defaultUserLocaleData";
|
|
||||||
public static final String NOTIFIER_LIST_DATA = "notifierListData";
|
|
||||||
public static final String IS_ACTIVE = "isActive";
|
|
||||||
public static final String CREATED_AT = "createdAt";
|
|
||||||
public static final String UPDATED_AT = "updatedAt";
|
|
||||||
public static final String HASH = "hash";
|
|
||||||
}
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
private UUID tenantId;
|
private UUID tenantId;
|
||||||
|
|
||||||
|
public static final String _tenantId = "tenantId";
|
||||||
|
|
||||||
private TenantConfigurationType type;
|
private TenantConfigurationType type;
|
||||||
|
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
public static final String _value = "value";
|
||||||
|
|
||||||
private EmailClientConfigurationDataContainer emailClientData;
|
private EmailClientConfigurationDataContainer emailClientData;
|
||||||
|
|
||||||
|
public static final String _emailClientData = "emailClientData";
|
||||||
|
|
||||||
private DefaultUserLocaleConfigurationDataContainer defaultUserLocaleData;
|
private DefaultUserLocaleConfigurationDataContainer defaultUserLocaleData;
|
||||||
|
|
||||||
|
public static final String _defaultUserLocaleData = "defaultUserLocaleData";
|
||||||
|
|
||||||
private NotifierListConfigurationDataContainer notifierListData;
|
private NotifierListConfigurationDataContainer notifierListData;
|
||||||
|
|
||||||
|
public static final String _notifierListData = "notifierListData";
|
||||||
|
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
|
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
private Instant createdAt;
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,10 @@ public class User {
|
||||||
|
|
||||||
public static final String _isActive = "isActive";
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
public final static String _hash = "hash";
|
public static final String _hash = "hash";
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
public final static String _tenantUsers = "tenantUsers";
|
public static final String _tenantUsers = "tenantUsers";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package gr.cite.notification.model.builder;
|
package gr.cite.notification.model.builder;
|
||||||
|
|
||||||
|
|
||||||
import gr.cite.notification.authorization.AuthorizationFlags;
|
import gr.cite.notification.authorization.AuthorizationFlags;
|
||||||
import gr.cite.notification.convention.ConventionService;
|
import gr.cite.notification.convention.ConventionService;
|
||||||
import gr.cite.notification.data.LanguageEntity;
|
import gr.cite.notification.data.LanguageEntity;
|
||||||
|
@ -20,6 +19,7 @@ import java.util.*;
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class LanguageBuilder extends BaseBuilder<Language, LanguageEntity> {
|
public class LanguageBuilder extends BaseBuilder<Language, LanguageEntity> {
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -43,14 +43,20 @@ public class LanguageBuilder extends BaseBuilder<Language, LanguageEntity>{
|
||||||
List<Language> models = new ArrayList<>();
|
List<Language> models = new ArrayList<>();
|
||||||
for (LanguageEntity d : data) {
|
for (LanguageEntity d : data) {
|
||||||
Language m = new Language();
|
Language m = new Language();
|
||||||
if (fields.hasField(this.asIndexer(Language._id))) m.setId(d.getId());
|
if (fields.hasField(this.asIndexer(Language._id)))
|
||||||
if (fields.hasField(this.asIndexer(Language._code))) m.setCode(d.getCode());
|
m.setId(d.getId());
|
||||||
if (fields.hasField(this.asIndexer(Language._payload))) m.setPayload(d.getPayload());
|
if (fields.hasField(this.asIndexer(Language._code)))
|
||||||
if (fields.hasField(this.asIndexer(Language._ordinal))) m.setOrdinal(d.getOrdinal());
|
m.setCode(d.getCode());
|
||||||
if (fields.hasField(this.asIndexer(Language._createdAt))) m.setCreatedAt(d.getCreatedAt());
|
if (fields.hasField(this.asIndexer(Language._ordinal)))
|
||||||
if (fields.hasField(this.asIndexer(Language._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
|
m.setOrdinal(d.getOrdinal());
|
||||||
if (fields.hasField(this.asIndexer(Language._isActive))) m.setIsActive(d.getIsActive());
|
if (fields.hasField(this.asIndexer(Language._createdAt)))
|
||||||
if (fields.hasField(this.asIndexer(Language._hash))) m.setHash(this.hashValue(d.getUpdatedAt()));
|
m.setCreatedAt(d.getCreatedAt());
|
||||||
|
if (fields.hasField(this.asIndexer(Language._updatedAt)))
|
||||||
|
m.setUpdatedAt(d.getUpdatedAt());
|
||||||
|
if (fields.hasField(this.asIndexer(Language._isActive)))
|
||||||
|
m.setIsActive(d.getIsActive());
|
||||||
|
if (fields.hasField(this.asIndexer(Language._hash)))
|
||||||
|
m.setHash(this.hashValue(d.getUpdatedAt()));
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
|
|
@ -2,11 +2,9 @@ package gr.cite.notification.model.builder;
|
||||||
|
|
||||||
import gr.cite.notification.authorization.AuthorizationFlags;
|
import gr.cite.notification.authorization.AuthorizationFlags;
|
||||||
import gr.cite.notification.common.XmlHandlingService;
|
import gr.cite.notification.common.XmlHandlingService;
|
||||||
import gr.cite.notification.common.types.tenant.TenantConfigEntity;
|
|
||||||
import gr.cite.notification.convention.ConventionService;
|
import gr.cite.notification.convention.ConventionService;
|
||||||
import gr.cite.notification.data.TenantEntity;
|
import gr.cite.notification.data.TenantEntity;
|
||||||
import gr.cite.notification.model.Tenant;
|
import gr.cite.notification.model.Tenant;
|
||||||
import gr.cite.notification.model.builder.tenantconfig.TenantConfigBuilder;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
@ -25,41 +23,44 @@ import java.util.*;
|
||||||
public class TenantBuilder extends BaseBuilder<Tenant, TenantEntity> {
|
public class TenantBuilder extends BaseBuilder<Tenant, TenantEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
private final XmlHandlingService xmlHandlingService;
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public TenantBuilder(ConventionService conventionService, BuilderFactory builderFactory, XmlHandlingService xmlHandlingService) {
|
public TenantBuilder(
|
||||||
|
ConventionService conventionService,
|
||||||
|
BuilderFactory builderFactory) {
|
||||||
super(conventionService, new LoggerService(LoggerFactory.getLogger(TenantBuilder.class)));
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(TenantBuilder.class)));
|
||||||
this.builderFactory = builderFactory;
|
this.builderFactory = builderFactory;
|
||||||
this.xmlHandlingService = xmlHandlingService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TenantBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
public TenantBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
this.authorize = values;
|
this.authorize = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tenant> build(FieldSet fields, List<TenantEntity> data) throws MyApplicationException {
|
public List<Tenant> build(FieldSet fields, List<TenantEntity> data) throws MyApplicationException {
|
||||||
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
this.logger.trace(new DataLogEntry("requested fields", fields));
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
if(fields == null || data == null || fields.isEmpty()) return new ArrayList<>();
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
FieldSet configFields = fields.extractPrefixed(this.asPrefix(Tenant._config));
|
|
||||||
|
|
||||||
List<Tenant> models = new ArrayList<>();
|
List<Tenant> models = new ArrayList<>();
|
||||||
for (TenantEntity d : data) {
|
for (TenantEntity d : data) {
|
||||||
Tenant m = new Tenant();
|
Tenant m = new Tenant();
|
||||||
if(fields.hasField(this.asIndexer(Tenant._id))) m.setId(d.getId());
|
if (fields.hasField(this.asIndexer(Tenant._id)))
|
||||||
if(fields.hasField(this.asIndexer(Tenant._code))) m.setCode(d.getCode());
|
m.setId(d.getId());
|
||||||
if(fields.hasField(this.asIndexer(Tenant._name))) m.setName(d.getName());
|
if (fields.hasField(this.asIndexer(Tenant._code)))
|
||||||
if(fields.hasField(this.asIndexer(Tenant._description))) m.setDescription(d.getDescription());
|
m.setCode(d.getCode());
|
||||||
if(fields.hasField(this.asIndexer(Tenant._isActive))) m.setIsActive(d.getIsActive());
|
if (fields.hasField(this.asIndexer(Tenant._isActive)))
|
||||||
if (!configFields.isEmpty() && d.getConfig() != null){
|
m.setIsActive(d.getIsActive());
|
||||||
TenantConfigEntity config = this.xmlHandlingService.fromXmlSafe(TenantConfigEntity.class, d.getConfig());
|
if (fields.hasField(this.asIndexer(Tenant._createdAt)))
|
||||||
m.setConfig(this.builderFactory.builder(TenantConfigBuilder.class).authorize(this.authorize).build(configFields, config));
|
m.setCreatedAt(d.getCreatedAt());
|
||||||
} if(fields.hasField(this.asIndexer(Tenant._createdAt))) m.setCreatedAt(d.getCreatedAt());
|
if (fields.hasField(this.asIndexer(Tenant._updatedAt)))
|
||||||
if(fields.hasField(this.asIndexer(Tenant._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
|
m.setUpdatedAt(d.getUpdatedAt());
|
||||||
if(fields.hasField(this.asIndexer(Tenant._hash))) m.setHash(this.hashValue(d.getUpdatedAt()));
|
if (fields.hasField(this.asIndexer(Tenant._hash)))
|
||||||
|
m.setHash(this.hashValue(d.getUpdatedAt()));
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
|
|
@ -3,13 +3,11 @@ package gr.cite.notification.model.builder;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import gr.cite.notification.authorization.AuthorizationFlags;
|
import gr.cite.notification.authorization.AuthorizationFlags;
|
||||||
import gr.cite.notification.common.enums.TenantConfigurationType;
|
|
||||||
import gr.cite.notification.common.types.tenantconfiguration.DefaultUserLocaleConfigurationDataContainer;
|
import gr.cite.notification.common.types.tenantconfiguration.DefaultUserLocaleConfigurationDataContainer;
|
||||||
import gr.cite.notification.common.types.tenantconfiguration.EmailClientConfigurationDataContainer;
|
import gr.cite.notification.common.types.tenantconfiguration.EmailClientConfigurationDataContainer;
|
||||||
import gr.cite.notification.common.types.tenantconfiguration.NotifierListConfigurationDataContainer;
|
import gr.cite.notification.common.types.tenantconfiguration.NotifierListConfigurationDataContainer;
|
||||||
import gr.cite.notification.convention.ConventionService;
|
import gr.cite.notification.convention.ConventionService;
|
||||||
import gr.cite.notification.data.TenantConfigurationEntity;
|
import gr.cite.notification.data.TenantConfigurationEntity;
|
||||||
import gr.cite.notification.model.Tenant;
|
|
||||||
import gr.cite.notification.model.TenantConfiguration;
|
import gr.cite.notification.model.TenantConfiguration;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
@ -47,11 +45,11 @@ public class TenantConfigurationBuilder extends BaseBuilder<TenantConfiguration,
|
||||||
List<TenantConfiguration> models = new ArrayList<>();
|
List<TenantConfiguration> models = new ArrayList<>();
|
||||||
for(TenantConfigurationEntity d : data){
|
for(TenantConfigurationEntity d : data){
|
||||||
TenantConfiguration m = new TenantConfiguration();
|
TenantConfiguration m = new TenantConfiguration();
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.ID))) m.setId(d.getId());
|
if(fields.hasField(this.asIndexer(TenantConfiguration._id))) m.setId(d.getId());
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.TENANT_ID))) m.setTenantId(d.getTenantId());
|
if(fields.hasField(this.asIndexer(TenantConfiguration._tenantId))) m.setTenantId(d.getTenantId());
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.TYPE))) m.setType(d.getType());
|
if(fields.hasField(this.asIndexer(TenantConfiguration._type))) m.setType(d.getType());
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.VALUE))) m.setValue(d.getValue());
|
if(fields.hasField(this.asIndexer(TenantConfiguration._value))) m.setValue(d.getValue());
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.DEFAULT_USER_LOCALE_DATA))) {
|
if(fields.hasField(this.asIndexer(TenantConfiguration._defaultUserLocaleData))) {
|
||||||
try {
|
try {
|
||||||
m.setDefaultUserLocaleData(mapper.readValue(d.getValue(), DefaultUserLocaleConfigurationDataContainer.class));
|
m.setDefaultUserLocaleData(mapper.readValue(d.getValue(), DefaultUserLocaleConfigurationDataContainer.class));
|
||||||
|
|
||||||
|
@ -59,78 +57,78 @@ public class TenantConfigurationBuilder extends BaseBuilder<TenantConfiguration,
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fields.extractPrefixed(this.asIndexer(TenantConfiguration.Field.DEFAULT_USER_LOCALE_DATA)).isEmpty()) {
|
if (!fields.extractPrefixed(this.asIndexer(TenantConfiguration._defaultUserLocaleData)).isEmpty()) {
|
||||||
try {
|
try {
|
||||||
DefaultUserLocaleConfigurationDataContainer container = mapper.readValue(d.getValue(), DefaultUserLocaleConfigurationDataContainer.class);
|
DefaultUserLocaleConfigurationDataContainer container = mapper.readValue(d.getValue(), DefaultUserLocaleConfigurationDataContainer.class);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
m.setDefaultUserLocaleData(new DefaultUserLocaleConfigurationDataContainer());
|
m.setDefaultUserLocaleData(new DefaultUserLocaleConfigurationDataContainer());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.DEFAULT_USER_LOCALE_DATA, DefaultUserLocaleConfigurationDataContainer.Field.LANGUAGE)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._defaultUserLocaleData, DefaultUserLocaleConfigurationDataContainer.Field.LANGUAGE)))
|
||||||
m.getDefaultUserLocaleData().setLanguage(container.getLanguage());
|
m.getDefaultUserLocaleData().setLanguage(container.getLanguage());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.DEFAULT_USER_LOCALE_DATA, DefaultUserLocaleConfigurationDataContainer.Field.TIME_ZONE)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._defaultUserLocaleData, DefaultUserLocaleConfigurationDataContainer.Field.TIME_ZONE)))
|
||||||
m.getDefaultUserLocaleData().setTimeZone(container.getTimeZone());
|
m.getDefaultUserLocaleData().setTimeZone(container.getTimeZone());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.DEFAULT_USER_LOCALE_DATA, DefaultUserLocaleConfigurationDataContainer.Field.CULTURE)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._defaultUserLocaleData, DefaultUserLocaleConfigurationDataContainer.Field.CULTURE)))
|
||||||
m.getDefaultUserLocaleData().setCulture(container.getCulture());
|
m.getDefaultUserLocaleData().setCulture(container.getCulture());
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA))) {
|
if(fields.hasField(this.asIndexer(TenantConfiguration._emailClientData))) {
|
||||||
try {
|
try {
|
||||||
m.setEmailClientData(mapper.readValue(d.getValue(), EmailClientConfigurationDataContainer.class));
|
m.setEmailClientData(mapper.readValue(d.getValue(), EmailClientConfigurationDataContainer.class));
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fields.extractPrefixed(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA)).isEmpty()) {
|
if (!fields.extractPrefixed(this.asIndexer(TenantConfiguration._emailClientData)).isEmpty()) {
|
||||||
try {
|
try {
|
||||||
EmailClientConfigurationDataContainer container = mapper.readValue(d.getValue(), EmailClientConfigurationDataContainer.class);
|
EmailClientConfigurationDataContainer container = mapper.readValue(d.getValue(), EmailClientConfigurationDataContainer.class);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
m.setEmailClientData(new EmailClientConfigurationDataContainer());
|
m.setEmailClientData(new EmailClientConfigurationDataContainer());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA, EmailClientConfigurationDataContainer.Field.ENABLE_SSL)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._emailClientData, EmailClientConfigurationDataContainer.Field.ENABLE_SSL)))
|
||||||
m.getEmailClientData().setEnableSSL(container.getEnableSSL());
|
m.getEmailClientData().setEnableSSL(container.getEnableSSL());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA, EmailClientConfigurationDataContainer.Field.REQUIRE_CREDENTIALS)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._emailClientData, EmailClientConfigurationDataContainer.Field.REQUIRE_CREDENTIALS)))
|
||||||
m.getEmailClientData().setRequireCredentials(container.getRequireCredentials());
|
m.getEmailClientData().setRequireCredentials(container.getRequireCredentials());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA, EmailClientConfigurationDataContainer.Field.HOST_SERVER)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._emailClientData, EmailClientConfigurationDataContainer.Field.HOST_SERVER)))
|
||||||
m.getEmailClientData().setHostServer(container.getHostServer());
|
m.getEmailClientData().setHostServer(container.getHostServer());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA, EmailClientConfigurationDataContainer.Field.HOST_PORT_NO)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._emailClientData, EmailClientConfigurationDataContainer.Field.HOST_PORT_NO)))
|
||||||
m.getEmailClientData().setHostPortNo(container.getHostPortNo());
|
m.getEmailClientData().setHostPortNo(container.getHostPortNo());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA, EmailClientConfigurationDataContainer.Field.CERTIFICATE_PATH)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._emailClientData, EmailClientConfigurationDataContainer.Field.CERTIFICATE_PATH)))
|
||||||
m.getEmailClientData().setCertificatePath(container.getCertificatePath());
|
m.getEmailClientData().setCertificatePath(container.getCertificatePath());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA, EmailClientConfigurationDataContainer.Field.EMAIL_ADDRESS)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._emailClientData, EmailClientConfigurationDataContainer.Field.EMAIL_ADDRESS)))
|
||||||
m.getEmailClientData().setEmailAddress(container.getEmailAddress());
|
m.getEmailClientData().setEmailAddress(container.getEmailAddress());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA, EmailClientConfigurationDataContainer.Field.EMAIL_USER_NAME)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._emailClientData, EmailClientConfigurationDataContainer.Field.EMAIL_USER_NAME)))
|
||||||
m.getEmailClientData().setEmailUserName(container.getEmailUserName());
|
m.getEmailClientData().setEmailUserName(container.getEmailUserName());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.EMAIL_CLIENT_DATA, EmailClientConfigurationDataContainer.Field.EMAIL_PASSWORD)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._emailClientData, EmailClientConfigurationDataContainer.Field.EMAIL_PASSWORD)))
|
||||||
m.getEmailClientData().setEmailPassword(container.getEmailPassword());
|
m.getEmailClientData().setEmailPassword(container.getEmailPassword());
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.NOTIFIER_LIST_DATA))) {
|
if(fields.hasField(this.asIndexer(TenantConfiguration._notifierListData))) {
|
||||||
try {
|
try {
|
||||||
m.setNotifierListData(mapper.readValue(d.getValue(), NotifierListConfigurationDataContainer.class));
|
m.setNotifierListData(mapper.readValue(d.getValue(), NotifierListConfigurationDataContainer.class));
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fields.extractPrefixed(this.asIndexer(TenantConfiguration.Field.NOTIFIER_LIST_DATA)).isEmpty()) {
|
if (!fields.extractPrefixed(this.asIndexer(TenantConfiguration._notifierListData)).isEmpty()) {
|
||||||
try {
|
try {
|
||||||
NotifierListConfigurationDataContainer container = mapper.readValue(d.getValue(), NotifierListConfigurationDataContainer.class);
|
NotifierListConfigurationDataContainer container = mapper.readValue(d.getValue(), NotifierListConfigurationDataContainer.class);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
m.setNotifierListData(new NotifierListConfigurationDataContainer());
|
m.setNotifierListData(new NotifierListConfigurationDataContainer());
|
||||||
if (fields.hasField(this.asIndexer(TenantConfiguration.Field.NOTIFIER_LIST_DATA, NotifierListConfigurationDataContainer.Field.NOTIFIERS)))
|
if (fields.hasField(this.asIndexer(TenantConfiguration._notifierListData, NotifierListConfigurationDataContainer.Field.NOTIFIERS)))
|
||||||
m.getNotifierListData().setNotifiers(container.getNotifiers());
|
m.getNotifierListData().setNotifiers(container.getNotifiers());
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.IS_ACTIVE))) m.setIsActive(d.getIsActive());
|
if(fields.hasField(this.asIndexer(TenantConfiguration._isActive))) m.setIsActive(d.getIsActive());
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.CREATED_AT))) m.setCreatedAt(d.getCreatedAt());
|
if(fields.hasField(this.asIndexer(TenantConfiguration._createdAt))) m.setCreatedAt(d.getCreatedAt());
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.UPDATED_AT))) m.setUpdatedAt(d.getUpdatedAt());
|
if(fields.hasField(this.asIndexer(TenantConfiguration._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.HASH))) m.setHash(this.hashValue(d.getUpdatedAt()));
|
if(fields.hasField(this.asIndexer(TenantConfiguration._hash))) m.setHash(this.hashValue(d.getUpdatedAt()));
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
this.logger.debug("build {} items",Optional.of(models).map(List::size).orElse(0));
|
this.logger.debug("build {} items",Optional.of(models).map(List::size).orElse(0));
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
package gr.cite.notification.model.builder;
|
package gr.cite.notification.model.builder;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import gr.cite.notification.authorization.AuthorizationFlags;
|
import gr.cite.notification.authorization.AuthorizationFlags;
|
||||||
import gr.cite.notification.common.types.tenantconfiguration.DefaultUserLocaleConfigurationDataContainer;
|
|
||||||
import gr.cite.notification.common.types.tenantconfiguration.EmailClientConfigurationDataContainer;
|
|
||||||
import gr.cite.notification.common.types.tenantconfiguration.NotifierListConfigurationDataContainer;
|
|
||||||
import gr.cite.notification.convention.ConventionService;
|
import gr.cite.notification.convention.ConventionService;
|
||||||
import gr.cite.notification.data.TenantConfigurationEntity;
|
|
||||||
import gr.cite.notification.data.UserNotificationPreferenceEntity;
|
import gr.cite.notification.data.UserNotificationPreferenceEntity;
|
||||||
import gr.cite.notification.model.TenantConfiguration;
|
import gr.cite.notification.model.TenantConfiguration;
|
||||||
import gr.cite.notification.model.UserNotificationPreference;
|
import gr.cite.notification.model.UserNotificationPreference;
|
||||||
|
@ -52,7 +47,7 @@ public class UserNotificationPreferenceBuilder extends BaseBuilder<UserNotificat
|
||||||
if(fields.hasField(this.asIndexer(UserNotificationPreference.Field.TYPE))) m.setType(d.getType());
|
if(fields.hasField(this.asIndexer(UserNotificationPreference.Field.TYPE))) m.setType(d.getType());
|
||||||
if(fields.hasField(this.asIndexer(UserNotificationPreference.Field.CHANNEL))) m.setChannel(d.getChannel());
|
if(fields.hasField(this.asIndexer(UserNotificationPreference.Field.CHANNEL))) m.setChannel(d.getChannel());
|
||||||
if(fields.hasField(this.asIndexer(UserNotificationPreference.Field.ORDINAL))) m.setOrdinal(d.getOrdinal());
|
if(fields.hasField(this.asIndexer(UserNotificationPreference.Field.ORDINAL))) m.setOrdinal(d.getOrdinal());
|
||||||
if(fields.hasField(this.asIndexer(TenantConfiguration.Field.CREATED_AT))) m.setCreatedAt(d.getCreatedAt());
|
if(fields.hasField(this.asIndexer(TenantConfiguration._createdAt))) m.setCreatedAt(d.getCreatedAt());
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
this.logger.debug("build {} items",Optional.of(models).map(List::size).orElse(0));
|
this.logger.debug("build {} items",Optional.of(models).map(List::size).orElse(0));
|
||||||
|
|
|
@ -8,13 +8,13 @@ import java.util.Map;
|
||||||
public class FieldOptions {
|
public class FieldOptions {
|
||||||
|
|
||||||
private List<String> mandatory;
|
private List<String> mandatory;
|
||||||
public final static String _mandatory = "mandatory";
|
public static final String _mandatory = "mandatory";
|
||||||
|
|
||||||
private List<FieldInfo> optional;
|
private List<FieldInfo> optional;
|
||||||
public final static String _optional = "optional";
|
public static final String _optional = "optional";
|
||||||
|
|
||||||
private Map<String, String> formatting;
|
private Map<String, String> formatting;
|
||||||
public final static String _formatting = "formatting";
|
public static final String _formatting = "formatting";
|
||||||
|
|
||||||
public List<String> getMandatory() {
|
public List<String> getMandatory() {
|
||||||
return mandatory;
|
return mandatory;
|
||||||
|
|
|
@ -7,31 +7,31 @@ import java.util.List;
|
||||||
public class NotificationTemplateValue {
|
public class NotificationTemplateValue {
|
||||||
|
|
||||||
private String subjectText;
|
private String subjectText;
|
||||||
public final static String _subjectText = "subjectText";
|
public static final String _subjectText = "subjectText";
|
||||||
private String subjectKey;
|
private String subjectKey;
|
||||||
public final static String _subjectKey = "subjectKey";
|
public static final String _subjectKey = "subjectKey";
|
||||||
private FieldOptions subjectFieldOptions;
|
private FieldOptions subjectFieldOptions;
|
||||||
public final static String _subjectFieldOptions = "subjectFieldOptions";
|
public static final String _subjectFieldOptions = "subjectFieldOptions";
|
||||||
private String bodyText;
|
private String bodyText;
|
||||||
public final static String _bodyText = "bodyText";
|
public static final String _bodyText = "bodyText";
|
||||||
private String bodyKey;
|
private String bodyKey;
|
||||||
public final static String _bodyKey = "bodyKey";
|
public static final String _bodyKey = "bodyKey";
|
||||||
private String priorityKey;
|
private String priorityKey;
|
||||||
public final static String _priorityKey = "priorityKey";
|
public static final String _priorityKey = "priorityKey";
|
||||||
private Boolean allowAttachments;
|
private Boolean allowAttachments;
|
||||||
public final static String _allowAttachments = "allowAttachments";
|
public static final String _allowAttachments = "allowAttachments";
|
||||||
private List<String> cc;
|
private List<String> cc;
|
||||||
public final static String _cc = "cc";
|
public static final String _cc = "cc";
|
||||||
private EmailOverrideMode ccMode;
|
private EmailOverrideMode ccMode;
|
||||||
public final static String _ccMode = "ccMode";
|
public static final String _ccMode = "ccMode";
|
||||||
private List<String> bcc;
|
private List<String> bcc;
|
||||||
public final static String _bcc = "bcc";
|
public static final String _bcc = "bcc";
|
||||||
private EmailOverrideMode bccMode;
|
private EmailOverrideMode bccMode;
|
||||||
public final static String _bccMode = "bccMode";
|
public static final String _bccMode = "bccMode";
|
||||||
private List<String> extraDataKeys;
|
private List<String> extraDataKeys;
|
||||||
public final static String _extraDataKeys = "extraDataKeys";
|
public static final String _extraDataKeys = "extraDataKeys";
|
||||||
private FieldOptions bodyFieldOptions;
|
private FieldOptions bodyFieldOptions;
|
||||||
public final static String _bodyFieldOptions = "bodyFieldOptions";
|
public static final String _bodyFieldOptions = "bodyFieldOptions";
|
||||||
|
|
||||||
public String getSubjectText() {
|
public String getSubjectText() {
|
||||||
return subjectText;
|
return subjectText;
|
||||||
|
|
|
@ -29,15 +29,15 @@ public class NotificationPersist {
|
||||||
public static final String _type = "type";
|
public static final String _type = "type";
|
||||||
public static final String _contactTypeHint = "contactTypeHint";
|
public static final String _contactTypeHint = "contactTypeHint";
|
||||||
public static final String _contactHint = "contactHint";
|
public static final String _contactHint = "contactHint";
|
||||||
public final static String _notifiedAt = "notifiedAt";
|
public static final String _notifiedAt = "notifiedAt";
|
||||||
public final static String _notifyState = "notifyState";
|
public static final String _notifyState = "notifyState";
|
||||||
public final static String _notifiedWith = "notifiedWith";
|
public static final String _notifiedWith = "notifiedWith";
|
||||||
public final static String _data = "data";
|
public static final String _data = "data";
|
||||||
public final static String _retryCount = "retryCount";
|
public static final String _retryCount = "retryCount";
|
||||||
public final static String _trackingState = "trackingState";
|
public static final String _trackingState = "trackingState";
|
||||||
public final static String _trackingProcess = "trackingProcess";
|
public static final String _trackingProcess = "trackingProcess";
|
||||||
public final static String _trackingData = "trackingData";
|
public static final String _trackingData = "trackingData";
|
||||||
public final static String _provenanceRef = "provenanceRef";
|
public static final String _provenanceRef = "provenanceRef";
|
||||||
public static final String _hash = "hash";
|
public static final String _hash = "hash";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ public class NotificationPersist {
|
||||||
.failOn(Field._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{Field._type}, LocaleContextHolder.getLocale())),
|
.failOn(Field._type).failWith(messageSource.getMessage("Validation_Required", new Object[]{Field._type}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> !this.isEmpty(item.getContactHint()))
|
.iff(() -> !this.isEmpty(item.getContactHint()))
|
||||||
.must(() -> this.lessEqualLength(item.getContactHint(), NotificationEntity.Field._contactHintLength))
|
.must(() -> this.lessEqualLength(item.getContactHint(), NotificationEntity._contactHintLength))
|
||||||
.failOn(Field._contactHint).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{Field._contactHint}, LocaleContextHolder.getLocale()))
|
.failOn(Field._contactHint).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{Field._contactHint}, LocaleContextHolder.getLocale()))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,10 @@ package gr.cite.notification.model.tenantconfig;
|
||||||
|
|
||||||
public class TenantConfig {
|
public class TenantConfig {
|
||||||
|
|
||||||
public final static String _deposit = "deposit";
|
public static final String _deposit = "deposit";
|
||||||
private TenantDepositConfig deposit;
|
private TenantDepositConfig deposit;
|
||||||
|
|
||||||
public final static String _fileTransformers = "fileTransformers";
|
public static final String _fileTransformers = "fileTransformers";
|
||||||
private TenantFileTransformersConfig fileTransformers;
|
private TenantFileTransformersConfig fileTransformers;
|
||||||
|
|
||||||
public TenantDepositConfig getDeposit() {
|
public TenantDepositConfig getDeposit() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class TenantDepositConfig {
|
public class TenantDepositConfig {
|
||||||
|
|
||||||
public final static String _sources = "sources";
|
public static final String _sources = "sources";
|
||||||
private List<TenantSource> sources;
|
private List<TenantSource> sources;
|
||||||
|
|
||||||
public List<TenantSource> getSources() {
|
public List<TenantSource> getSources() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class TenantFileTransformersConfig {
|
public class TenantFileTransformersConfig {
|
||||||
|
|
||||||
public final static String _sources = "sources";
|
public static final String _sources = "sources";
|
||||||
private List<TenantSource> sources;
|
private List<TenantSource> sources;
|
||||||
|
|
||||||
public List<TenantSource> getSources() {
|
public List<TenantSource> getSources() {
|
||||||
|
|
|
@ -5,22 +5,22 @@ import java.util.List;
|
||||||
|
|
||||||
public class TenantSource {
|
public class TenantSource {
|
||||||
|
|
||||||
public final static String _url = "url";
|
public static final String _url = "url";
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
public final static String _codes = "codes";
|
public static final String _codes = "codes";
|
||||||
private List<String> codes;
|
private List<String> codes;
|
||||||
|
|
||||||
public final static String _issuerUrl = "issuerUrl";
|
public static final String _issuerUrl = "issuerUrl";
|
||||||
private String issuerUrl;
|
private String issuerUrl;
|
||||||
|
|
||||||
public final static String _clientId = "clientId";
|
public static final String _clientId = "clientId";
|
||||||
private String clientId;
|
private String clientId;
|
||||||
|
|
||||||
public final static String _clientSecret = "clientSecret";
|
public static final String _clientSecret = "clientSecret";
|
||||||
private String clientSecret;
|
private String clientSecret;
|
||||||
|
|
||||||
public final static String _scope = "scope";
|
public static final String _scope = "scope";
|
||||||
private String scope;
|
private String scope;
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
|
|
|
@ -5,10 +5,10 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class PublicUser {
|
public class PublicUser {
|
||||||
|
|
||||||
public final static String _id = "id";
|
public static final String _id = "id";
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
public final static String _name = "name";
|
public static final String _name = "name";
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
|
|
@ -9,30 +9,41 @@ import gr.cite.notification.model.InAppNotification;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||||
public class InAppNotificationQuery extends QueryBase<InAppNotificationEntity> {
|
public class InAppNotificationQuery extends QueryBase<InAppNotificationEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
|
||||||
private List<UUID> excludeIds;
|
private List<UUID> excludeIds;
|
||||||
|
|
||||||
private List<UUID> userId;
|
private List<UUID> userId;
|
||||||
|
|
||||||
private List<UUID> type;
|
private List<UUID> type;
|
||||||
|
|
||||||
private Collection<IsActive> isActives;
|
private Collection<IsActive> isActives;
|
||||||
|
|
||||||
private List<UUID> tenantIds;
|
private List<UUID> tenantIds;
|
||||||
|
|
||||||
private List<NotificationInAppTracking> trackingState;
|
private List<NotificationInAppTracking> trackingState;
|
||||||
|
|
||||||
private Boolean isRead;
|
private Boolean isRead;
|
||||||
|
|
||||||
private Instant from;
|
private Instant from;
|
||||||
|
|
||||||
private Instant to;
|
private Instant to;
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
public InAppNotificationQuery like(String value) {
|
public InAppNotificationQuery like(String value) {
|
||||||
|
@ -164,23 +175,23 @@ public class InAppNotificationQuery extends QueryBase<InAppNotificationEntity> {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.ids != null) {
|
if (this.ids != null) {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._id).in(ids));
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._id).in(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(InAppNotificationEntity.Field._subject), this.like));
|
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(InAppNotificationEntity._subject), this.like));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.excludeIds != null) {
|
if (this.excludeIds != null) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.not(queryContext.Root.get(InAppNotificationEntity.Field._id).in(ids)));
|
predicates.add(queryContext.CriteriaBuilder.not(queryContext.Root.get(InAppNotificationEntity._id).in(ids)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.userId != null) {
|
if (this.userId != null) {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._userId).in(userId));
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._userId).in(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._isActive).in(isActives));
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._isActive).in(isActives));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tenantIds != null) {
|
if (this.tenantIds != null) {
|
||||||
|
@ -188,26 +199,26 @@ public class InAppNotificationQuery extends QueryBase<InAppNotificationEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type != null) {
|
if (this.type != null) {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._type).in(this.type));
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._type).in(this.type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.trackingState != null) {
|
if (this.trackingState != null) {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._trackingState).in(trackingState));
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._trackingState).in(trackingState));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRead != null) {
|
if (isRead != null) {
|
||||||
predicates.add(isRead ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(InAppNotificationEntity.Field._readTime)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(InAppNotificationEntity.Field._readTime)));
|
predicates.add(isRead ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(InAppNotificationEntity._readTime)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(InAppNotificationEntity._readTime)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from != null) {
|
if (from != null) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(InAppNotificationEntity.Field._createdAt), from));
|
predicates.add(queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(InAppNotificationEntity._createdAt), from));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.lessThanOrEqualTo(queryContext.Root.get(InAppNotificationEntity.Field._createdAt), from));
|
predicates.add(queryContext.CriteriaBuilder.lessThanOrEqualTo(queryContext.Root.get(InAppNotificationEntity._createdAt), from));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (predicates.size() > 0) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
} else {
|
} else {
|
||||||
|
@ -218,37 +229,52 @@ public class InAppNotificationQuery extends QueryBase<InAppNotificationEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
if (item.match(InAppNotification.Field.ID)) return InAppNotificationEntity.Field._id;
|
if (item.match(InAppNotification.Field.ID))
|
||||||
else if (item.match(InAppNotification.Field.CREATED_AT)) return InAppNotificationEntity.Field._createdAt;
|
return InAppNotificationEntity._id;
|
||||||
else if (item.match(InAppNotification.Field.USER)) return InAppNotificationEntity.Field._userId;
|
else if (item.match(InAppNotification.Field.CREATED_AT))
|
||||||
else if (item.match(InAppNotification.Field.IS_ACTIVE)) return InAppNotificationEntity.Field._isActive;
|
return InAppNotificationEntity._createdAt;
|
||||||
else if (item.match(InAppNotification.Field.READ_TIME)) return InAppNotificationEntity.Field._readTime;
|
else if (item.match(InAppNotification.Field.USER))
|
||||||
else if (item.match(InAppNotification.Field.TRACKING_STATE)) return InAppNotificationEntity.Field._trackingState;
|
return InAppNotificationEntity._userId;
|
||||||
else if (item.match(InAppNotification.Field.BODY)) return InAppNotificationEntity.Field._body;
|
else if (item.match(InAppNotification.Field.IS_ACTIVE))
|
||||||
else if (item.match(InAppNotification.Field.EXTRA_DATA)) return InAppNotificationEntity.Field._extraData;
|
return InAppNotificationEntity._isActive;
|
||||||
else if (item.match(InAppNotification.Field.PRIORITY)) return InAppNotificationEntity.Field._priority;
|
else if (item.match(InAppNotification.Field.READ_TIME))
|
||||||
else if (item.match(InAppNotification.Field.SUBJECT)) return InAppNotificationEntity.Field._subject;
|
return InAppNotificationEntity._readTime;
|
||||||
else if (item.match(InAppNotification.Field.TENANT)) return InAppNotificationEntity._tenantId;
|
else if (item.match(InAppNotification.Field.TRACKING_STATE))
|
||||||
else if (item.match(InAppNotification.Field.TYPE)) return InAppNotificationEntity.Field._type;
|
return InAppNotificationEntity._trackingState;
|
||||||
else if (item.match(InAppNotification.Field.UPDATED_AT)) return InAppNotificationEntity.Field._updatedAt;
|
else if (item.match(InAppNotification.Field.BODY))
|
||||||
else return null;
|
return InAppNotificationEntity._body;
|
||||||
|
else if (item.match(InAppNotification.Field.EXTRA_DATA))
|
||||||
|
return InAppNotificationEntity._extraData;
|
||||||
|
else if (item.match(InAppNotification.Field.PRIORITY))
|
||||||
|
return InAppNotificationEntity._priority;
|
||||||
|
else if (item.match(InAppNotification.Field.SUBJECT))
|
||||||
|
return InAppNotificationEntity._subject;
|
||||||
|
else if (item.match(InAppNotification.Field.TENANT))
|
||||||
|
return InAppNotificationEntity._tenantId;
|
||||||
|
else if (item.match(InAppNotification.Field.TYPE))
|
||||||
|
return InAppNotificationEntity._type;
|
||||||
|
else if (item.match(InAppNotification.Field.UPDATED_AT))
|
||||||
|
return InAppNotificationEntity._updatedAt;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected InAppNotificationEntity convert(Tuple tuple, Set<String> columns) {
|
protected InAppNotificationEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
InAppNotificationEntity item = new InAppNotificationEntity();
|
InAppNotificationEntity item = new InAppNotificationEntity();
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._id, UUID.class));
|
item.setId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._id, UUID.class));
|
||||||
item.setType(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._type, UUID.class));
|
item.setType(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._type, UUID.class));
|
||||||
item.setUserId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._userId, UUID.class));
|
item.setUserId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._userId, UUID.class));
|
||||||
item.setTenantId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._tenantId, UUID.class));
|
item.setTenantId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._tenantId, UUID.class));
|
||||||
item.setTrackingState(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._trackingState, NotificationInAppTracking.class));
|
item.setTrackingState(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._trackingState, NotificationInAppTracking.class));
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._createdAt, Instant.class));
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._createdAt, Instant.class));
|
||||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._updatedAt, Instant.class));
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._updatedAt, Instant.class));
|
||||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._isActive, IsActive.class));
|
item.setIsActive(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._isActive, IsActive.class));
|
||||||
item.setExtraData(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._extraData, String.class));
|
item.setExtraData(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._extraData, String.class));
|
||||||
item.setBody(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._body, String.class));
|
item.setBody(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._body, String.class));
|
||||||
item.setSubject(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._subject, String.class));
|
item.setSubject(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._subject, String.class));
|
||||||
item.setPriority(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._priority, InAppNotificationPriority.class));
|
item.setPriority(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._priority, InAppNotificationPriority.class));
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,13 @@ import gr.cite.notification.model.Language;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -160,7 +160,6 @@ public class LanguageQuery extends QueryBase<LanguageEntity> {
|
||||||
LanguageEntity item = new LanguageEntity();
|
LanguageEntity item = new LanguageEntity();
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, LanguageEntity._id, UUID.class));
|
item.setId(QueryBase.convertSafe(tuple, columns, LanguageEntity._id, UUID.class));
|
||||||
item.setCode(QueryBase.convertSafe(tuple, columns, LanguageEntity._code, String.class));
|
item.setCode(QueryBase.convertSafe(tuple, columns, LanguageEntity._code, String.class));
|
||||||
item.setPayload(QueryBase.convertSafe(tuple, columns, LanguageEntity._payload, String.class));
|
|
||||||
item.setOrdinal(QueryBase.convertSafe(tuple, columns, LanguageEntity._ordinal, Integer.class));
|
item.setOrdinal(QueryBase.convertSafe(tuple, columns, LanguageEntity._ordinal, Integer.class));
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, LanguageEntity._createdAt, Instant.class));
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, LanguageEntity._createdAt, Instant.class));
|
||||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, LanguageEntity._updatedAt, Instant.class));
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, LanguageEntity._updatedAt, Instant.class));
|
||||||
|
@ -170,15 +169,22 @@ public class LanguageQuery extends QueryBase<LanguageEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
if (item.match(Language._id)) return LanguageEntity._id;
|
if (item.match(Language._id))
|
||||||
else if (item.match(Language._code)) return LanguageEntity._code;
|
return LanguageEntity._id;
|
||||||
else if (item.match(Language._payload)) return LanguageEntity._payload;
|
else if (item.match(Language._code))
|
||||||
else if (item.match(Language._ordinal)) return LanguageEntity._ordinal;
|
return LanguageEntity._code;
|
||||||
else if (item.match(Language._createdAt)) return LanguageEntity._createdAt;
|
else if (item.match(Language._ordinal))
|
||||||
else if (item.match(Language._updatedAt)) return LanguageEntity._updatedAt;
|
return LanguageEntity._ordinal;
|
||||||
else if (item.match(Language._hash)) return LanguageEntity._updatedAt;
|
else if (item.match(Language._createdAt))
|
||||||
else if (item.match(Language._isActive)) return LanguageEntity._isActive;
|
return LanguageEntity._createdAt;
|
||||||
else return null;
|
else if (item.match(Language._updatedAt))
|
||||||
|
return LanguageEntity._updatedAt;
|
||||||
|
else if (item.match(Language._hash))
|
||||||
|
return LanguageEntity._updatedAt;
|
||||||
|
else if (item.match(Language._isActive))
|
||||||
|
return LanguageEntity._isActive;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,35 +8,47 @@ import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.Ordering;
|
import gr.cite.tools.data.query.Ordering;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||||
public class NotificationQuery extends QueryBase<NotificationEntity> {
|
public class NotificationQuery extends QueryBase<NotificationEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
|
||||||
private Collection<IsActive> isActives;
|
private Collection<IsActive> isActives;
|
||||||
|
|
||||||
private List<UUID> tenantIds;
|
private List<UUID> tenantIds;
|
||||||
|
|
||||||
private List<NotificationNotifyState> notifyState;
|
private List<NotificationNotifyState> notifyState;
|
||||||
|
|
||||||
private List<NotificationContactType> notifiedWith;
|
private List<NotificationContactType> notifiedWith;
|
||||||
|
|
||||||
private Boolean notifiedWithHasValue;
|
private Boolean notifiedWithHasValue;
|
||||||
|
|
||||||
private Boolean notifiedAtHasValue;
|
private Boolean notifiedAtHasValue;
|
||||||
|
|
||||||
private List<UUID> type;
|
private List<UUID> type;
|
||||||
|
|
||||||
private List<NotificationContactType> contactType;
|
private List<NotificationContactType> contactType;
|
||||||
|
|
||||||
private Integer retryThreshold;
|
private Integer retryThreshold;
|
||||||
|
|
||||||
private Instant createdAfter;
|
private Instant createdAfter;
|
||||||
|
|
||||||
private List<NotificationTrackingState> trackingState;
|
private List<NotificationTrackingState> trackingState;
|
||||||
|
|
||||||
private List<NotificationTrackingProcess> trackingProgress;
|
private List<NotificationTrackingProcess> trackingProgress;
|
||||||
|
|
||||||
private Collection<UUID> userIds;
|
private Collection<UUID> userIds;
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
public NotificationQuery ids(UUID value) {
|
public NotificationQuery ids(UUID value) {
|
||||||
|
@ -210,64 +222,64 @@ public class NotificationQuery extends QueryBase<NotificationEntity> {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.ids != null) {
|
if (this.ids != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._id).in(ids));
|
predicates.add(queryContext.Root.get(NotificationEntity._id).in(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._isActive).in(isActives));
|
predicates.add(queryContext.Root.get(NotificationEntity._isActive).in(isActives));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tenantIds != null) {
|
if (this.tenantIds != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._tenantId).in(tenantIds));
|
predicates.add(queryContext.Root.get(NotificationEntity._tenantId).in(tenantIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.notifyState != null) {
|
if (this.notifyState != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._notifyState).in(notifyState));
|
predicates.add(queryContext.Root.get(NotificationEntity._notifyState).in(notifyState));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.notifiedWith != null) {
|
if (this.notifiedWith != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._notifiedWith).in(notifiedWith));
|
predicates.add(queryContext.Root.get(NotificationEntity._notifiedWith).in(notifiedWith));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notifiedWithHasValue != null) {
|
if (notifiedWithHasValue != null) {
|
||||||
Predicate hasValuePredicate = notifiedWithHasValue ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(NotificationEntity.Field._notifiedWith)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(NotificationEntity.Field._notifiedWith));
|
Predicate hasValuePredicate = notifiedWithHasValue ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(NotificationEntity._notifiedWith)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(NotificationEntity._notifiedWith));
|
||||||
predicates.add(hasValuePredicate);
|
predicates.add(hasValuePredicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notifiedAtHasValue != null) {
|
if (notifiedAtHasValue != null) {
|
||||||
Predicate hasValuePredicate = notifiedAtHasValue ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(NotificationEntity.Field._notifiedAt)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(NotificationEntity.Field._notifiedAt));
|
Predicate hasValuePredicate = notifiedAtHasValue ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(NotificationEntity._notifiedAt)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(NotificationEntity._notifiedAt));
|
||||||
predicates.add(hasValuePredicate);
|
predicates.add(hasValuePredicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type != null) {
|
if (this.type != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._type).in(this.type));
|
predicates.add(queryContext.Root.get(NotificationEntity._type).in(this.type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.contactType != null) {
|
if (this.contactType != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._contactTypeHint).in(this.contactType));
|
predicates.add(queryContext.Root.get(NotificationEntity._contactTypeHint).in(this.contactType));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.retryThreshold != null) {
|
if (this.retryThreshold != null) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.le(queryContext.Root.get(NotificationEntity.Field._retryCount), this.retryThreshold));
|
predicates.add(queryContext.CriteriaBuilder.le(queryContext.Root.get(NotificationEntity._retryCount), this.retryThreshold));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.createdAfter != null) {
|
if (this.createdAfter != null) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.greaterThan(queryContext.Root.get(NotificationEntity.Field._createdAt), this.createdAfter));
|
predicates.add(queryContext.CriteriaBuilder.greaterThan(queryContext.Root.get(NotificationEntity._createdAt), this.createdAfter));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.trackingState != null) {
|
if (this.trackingState != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._trackingState).in(trackingState));
|
predicates.add(queryContext.Root.get(NotificationEntity._trackingState).in(trackingState));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.trackingProgress != null) {
|
if (this.trackingProgress != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._trackingProcess).in(trackingProgress));
|
predicates.add(queryContext.Root.get(NotificationEntity._trackingProcess).in(trackingProgress));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.userIds != null) {
|
if (this.userIds != null) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._userId).in(userIds));
|
predicates.add(queryContext.Root.get(NotificationEntity._userId).in(userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (predicates.size() > 0) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
} else {
|
} else {
|
||||||
|
@ -278,43 +290,63 @@ public class NotificationQuery extends QueryBase<NotificationEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
if (item.match(Notification._id)) return NotificationEntity.Field._id;
|
if (item.match(Notification._id))
|
||||||
else if (item.match(Notification._contactHint)) return NotificationEntity.Field._contactHint;
|
return NotificationEntity._id;
|
||||||
else if (item.match(Notification._createdAt)) return NotificationEntity.Field._createdAt;
|
else if (item.match(Notification._contactHint))
|
||||||
else if (item.match(Notification._isActive)) return NotificationEntity.Field._isActive;
|
return NotificationEntity._contactHint;
|
||||||
else if (item.match(Notification._contactTypeHint)) return NotificationEntity.Field._contactTypeHint;
|
else if (item.match(Notification._createdAt))
|
||||||
else if (item.match(Notification._updatedAt)) return NotificationEntity.Field._updatedAt;
|
return NotificationEntity._createdAt;
|
||||||
else if (item.match(Notification._notifiedAt)) return NotificationEntity.Field._notifiedAt;
|
else if (item.match(Notification._isActive))
|
||||||
else if (item.prefix(Notification._tenant)) return NotificationEntity.Field._tenantId;
|
return NotificationEntity._isActive;
|
||||||
else if (item.prefix(Notification._user)) return NotificationEntity.Field._userId;
|
else if (item.match(Notification._contactTypeHint))
|
||||||
else if (item.match(Notification._type)) return NotificationEntity.Field._type;
|
return NotificationEntity._contactTypeHint;
|
||||||
else if (item.match(Notification._notifyState)) return NotificationEntity.Field._notifyState;
|
else if (item.match(Notification._updatedAt))
|
||||||
else if (item.match(Notification._notifiedWith)) return NotificationEntity.Field._notifiedWith;
|
return NotificationEntity._updatedAt;
|
||||||
else if (item.match(Notification._trackingState)) return NotificationEntity.Field._trackingState;
|
else if (item.match(Notification._notifiedAt))
|
||||||
else if (item.match(Notification._trackingProcess)) return NotificationEntity.Field._trackingProcess;
|
return NotificationEntity._notifiedAt;
|
||||||
else if (item.match(Notification._retryCount)) return NotificationEntity.Field._retryCount;
|
else if (item.match(Notification._data))
|
||||||
|
return NotificationEntity._data;
|
||||||
|
else if (item.prefix(Notification._tenant))
|
||||||
|
return NotificationEntity._tenantId;
|
||||||
|
else if (item.prefix(Notification._user))
|
||||||
|
return NotificationEntity._userId;
|
||||||
|
else if (item.match(Notification._type))
|
||||||
|
return NotificationEntity._type;
|
||||||
|
else if (item.match(Notification._notifyState))
|
||||||
|
return NotificationEntity._notifyState;
|
||||||
|
else if (item.match(Notification._notifiedWith))
|
||||||
|
return NotificationEntity._notifiedWith;
|
||||||
|
else if (item.match(Notification._trackingState))
|
||||||
|
return NotificationEntity._trackingState;
|
||||||
|
else if (item.match(Notification._trackingProcess))
|
||||||
|
return NotificationEntity._trackingProcess;
|
||||||
|
else if (item.match(Notification._trackingData))
|
||||||
|
return NotificationEntity._trackingData;
|
||||||
|
else if (item.match(Notification._retryCount))
|
||||||
|
return NotificationEntity._retryCount;
|
||||||
|
|
||||||
else return null;
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NotificationEntity convert(Tuple tuple, Set<String> columns) {
|
protected NotificationEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
NotificationEntity item = new NotificationEntity();
|
NotificationEntity item = new NotificationEntity();
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._id, UUID.class));
|
item.setId(QueryBase.convertSafe(tuple, columns, NotificationEntity._id, UUID.class));
|
||||||
item.setContactHint(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._contactHint, String.class));
|
item.setContactHint(QueryBase.convertSafe(tuple, columns, NotificationEntity._contactHint, String.class));
|
||||||
item.setContactTypeHint(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._contactTypeHint, NotificationContactType.class));
|
item.setContactTypeHint(QueryBase.convertSafe(tuple, columns, NotificationEntity._contactTypeHint, NotificationContactType.class));
|
||||||
item.setNotifiedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._notifiedAt, Instant.class));
|
item.setNotifiedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity._notifiedAt, Instant.class));
|
||||||
item.setType(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._type, UUID.class));
|
item.setType(QueryBase.convertSafe(tuple, columns, NotificationEntity._type, UUID.class));
|
||||||
item.setUserId(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._userId, UUID.class));
|
item.setUserId(QueryBase.convertSafe(tuple, columns, NotificationEntity._userId, UUID.class));
|
||||||
item.setTenantId(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._tenantId, UUID.class));
|
item.setTenantId(QueryBase.convertSafe(tuple, columns, NotificationEntity._tenantId, UUID.class));
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._createdAt, Instant.class));
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity._createdAt, Instant.class));
|
||||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._updatedAt, Instant.class));
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity._updatedAt, Instant.class));
|
||||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._isActive, IsActive.class));
|
item.setIsActive(QueryBase.convertSafe(tuple, columns, NotificationEntity._isActive, IsActive.class));
|
||||||
item.setNotifyState(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._notifyState, NotificationNotifyState.class));
|
item.setNotifyState(QueryBase.convertSafe(tuple, columns, NotificationEntity._notifyState, NotificationNotifyState.class));
|
||||||
item.setNotifiedWith(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._notifiedWith, NotificationContactType.class));
|
item.setNotifiedWith(QueryBase.convertSafe(tuple, columns, NotificationEntity._notifiedWith, NotificationContactType.class));
|
||||||
item.setTrackingState(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._trackingState, NotificationTrackingState.class));
|
item.setTrackingState(QueryBase.convertSafe(tuple, columns, NotificationEntity._trackingState, NotificationTrackingState.class));
|
||||||
item.setTrackingProcess(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._trackingProcess, NotificationTrackingProcess.class));
|
item.setTrackingProcess(QueryBase.convertSafe(tuple, columns, NotificationEntity._trackingProcess, NotificationTrackingProcess.class));
|
||||||
item.setRetryCount(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._retryCount, Integer.class));
|
item.setRetryCount(QueryBase.convertSafe(tuple, columns, NotificationEntity._retryCount, Integer.class));
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,26 +3,27 @@ package gr.cite.notification.query;
|
||||||
import gr.cite.notification.common.enums.IsActive;
|
import gr.cite.notification.common.enums.IsActive;
|
||||||
import gr.cite.notification.common.enums.TenantConfigurationType;
|
import gr.cite.notification.common.enums.TenantConfigurationType;
|
||||||
import gr.cite.notification.data.TenantConfigurationEntity;
|
import gr.cite.notification.data.TenantConfigurationEntity;
|
||||||
import gr.cite.notification.data.TenantEntity;
|
|
||||||
import gr.cite.notification.model.TenantConfiguration;
|
import gr.cite.notification.model.TenantConfiguration;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||||
public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntity> {
|
public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntity> {
|
||||||
|
|
||||||
private List<UUID> ids;
|
private List<UUID> ids;
|
||||||
|
|
||||||
private List<IsActive> isActives;
|
private List<IsActive> isActives;
|
||||||
|
|
||||||
private List<TenantConfigurationType> type;
|
private List<TenantConfigurationType> type;
|
||||||
|
|
||||||
public TenantConfigurationQuery ids(UUID... ids) {
|
public TenantConfigurationQuery ids(UUID... ids) {
|
||||||
|
@ -55,7 +56,6 @@ public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntit
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isFalseQuery() {
|
protected Boolean isFalseQuery() {
|
||||||
return this.isEmpty(this.ids) || this.isEmpty(this.isActives);
|
return this.isEmpty(this.ids) || this.isEmpty(this.isActives);
|
||||||
|
@ -70,17 +70,18 @@ public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntit
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.ids != null) {
|
if (this.ids != null) {
|
||||||
predicates.add(queryContext.Root.get(TenantConfigurationEntity.Field.ID).in(ids));
|
predicates.add(queryContext.Root.get(TenantConfigurationEntity._id).in(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
predicates.add(queryContext.Root.get(TenantConfigurationEntity.Field.IS_ACTIVE).in(isActives));
|
predicates.add(queryContext.Root.get(TenantConfigurationEntity._isActive).in(isActives));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
predicates.add(queryContext.Root.get(TenantConfigurationEntity.Field.TYPE).in(type));
|
predicates.add(queryContext.Root.get(TenantConfigurationEntity._type).in(type));
|
||||||
}
|
}
|
||||||
if (predicates.size() > 0) {
|
|
||||||
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
} else {
|
} else {
|
||||||
|
@ -91,29 +92,40 @@ public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntit
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
if (item.match(TenantConfiguration.Field.ID)) return TenantConfigurationEntity.Field.ID;
|
if (item.match(TenantConfiguration._id))
|
||||||
else if (item.match(TenantConfiguration.Field.TENANT_ID)) return TenantConfigurationEntity.Field.TENANT_ID;
|
return TenantConfigurationEntity._id;
|
||||||
else if (item.match(TenantConfiguration.Field.CREATED_AT)) return TenantConfigurationEntity.Field.CREATED_AT;
|
else if (item.match(TenantConfiguration._tenantId))
|
||||||
else if (item.match(TenantConfiguration.Field.IS_ACTIVE)) return TenantConfigurationEntity.Field.IS_ACTIVE;
|
return TenantConfigurationEntity._tenantId;
|
||||||
else if (item.match(TenantConfiguration.Field.DEFAULT_USER_LOCALE_DATA)) return TenantConfiguration.Field.DEFAULT_USER_LOCALE_DATA;
|
else if (item.match(TenantConfiguration._defaultUserLocaleData))
|
||||||
else if (item.match(TenantConfiguration.Field.EMAIL_CLIENT_DATA)) return TenantConfiguration.Field.EMAIL_CLIENT_DATA;
|
return TenantConfiguration._defaultUserLocaleData;
|
||||||
else if (item.match(TenantConfiguration.Field.NOTIFIER_LIST_DATA)) return TenantConfiguration.Field.NOTIFIER_LIST_DATA;
|
else if (item.match(TenantConfiguration._emailClientData))
|
||||||
else if (item.match(TenantConfiguration.Field.TYPE)) return TenantConfigurationEntity.Field.TYPE;
|
return TenantConfiguration._emailClientData;
|
||||||
else if (item.match(TenantConfiguration.Field.UPDATED_AT)) return TenantConfigurationEntity.Field.UPDATED_AT;
|
else if (item.match(TenantConfiguration._notifierListData))
|
||||||
else if (item.match(TenantConfiguration.Field.VALUE)) return TenantConfigurationEntity.Field.VALUE;
|
return TenantConfiguration._notifierListData;
|
||||||
else return null;
|
else if (item.match(TenantConfiguration._type))
|
||||||
|
return TenantConfigurationEntity._type;
|
||||||
|
else if (item.match(TenantConfiguration._value))
|
||||||
|
return TenantConfigurationEntity._value;
|
||||||
|
else if (item.match(TenantConfiguration._createdAt))
|
||||||
|
return TenantConfigurationEntity._createdAt;
|
||||||
|
else if (item.match(TenantConfiguration._updatedAt))
|
||||||
|
return TenantConfigurationEntity._updatedAt;
|
||||||
|
else if (item.match(TenantConfiguration._isActive))
|
||||||
|
return TenantConfigurationEntity._isActive;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TenantConfigurationEntity convert(Tuple tuple, Set<String> columns) {
|
protected TenantConfigurationEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
TenantConfigurationEntity item = new TenantConfigurationEntity();
|
TenantConfigurationEntity item = new TenantConfigurationEntity();
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity.Field.ID, UUID.class));
|
item.setId(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity._id, UUID.class));
|
||||||
item.setValue(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity.Field.VALUE, String.class));
|
item.setValue(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity._value, String.class));
|
||||||
item.setType(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity.Field.TYPE, TenantConfigurationType.class));
|
item.setType(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity._type, TenantConfigurationType.class));
|
||||||
item.setTenantId(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity.Field.TENANT_ID, UUID.class));
|
item.setTenantId(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity._tenantId, UUID.class));
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity.Field.CREATED_AT, Instant.class));
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity._createdAt, Instant.class));
|
||||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity.Field.UPDATED_AT, Instant.class));
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity._updatedAt, Instant.class));
|
||||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity.Field.IS_ACTIVE, IsActive.class));
|
item.setIsActive(QueryBase.convertSafe(tuple, columns, TenantConfigurationEntity._isActive, IsActive.class));
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,23 +7,25 @@ import gr.cite.notification.model.Tenant;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class TenantQuery extends QueryBase<TenantEntity> {
|
public class TenantQuery extends QueryBase<TenantEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
|
||||||
private Collection<IsActive> isActives;
|
private Collection<IsActive> isActives;
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
public TenantQuery like(String value) {
|
public TenantQuery like(String value) {
|
||||||
|
@ -90,7 +92,7 @@ public class TenantQuery extends QueryBase<TenantEntity> {
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
predicates.add(queryContext.Root.get(TenantEntity._isActive).in(isActives));
|
predicates.add(queryContext.Root.get(TenantEntity._isActive).in(isActives));
|
||||||
}
|
}
|
||||||
if (predicates.size() > 0) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
} else {
|
} else {
|
||||||
|
@ -101,15 +103,18 @@ public class TenantQuery extends QueryBase<TenantEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
if (item.match(Tenant._id)) return TenantEntity._id;
|
if (item.match(Tenant._id))
|
||||||
else if (item.match(Tenant._code)) return TenantEntity._code;
|
return TenantEntity._id;
|
||||||
else if (item.match(Tenant._name)) return TenantEntity._name;
|
else if (item.match(Tenant._code))
|
||||||
else if (item.match(Tenant._description)) return TenantEntity._description;
|
return TenantEntity._code;
|
||||||
else if (item.prefix(Tenant._config)) return TenantEntity._config;
|
else if (item.match(Tenant._createdAt))
|
||||||
else if (item.match(Tenant._createdAt)) return TenantEntity._createdAt;
|
return TenantEntity._createdAt;
|
||||||
else if (item.match(Tenant._updatedAt)) return TenantEntity._updatedAt;
|
else if (item.match(Tenant._updatedAt))
|
||||||
else if (item.match(Tenant._isActive)) return TenantEntity._isActive;
|
return TenantEntity._updatedAt;
|
||||||
else return null;
|
else if (item.match(Tenant._isActive))
|
||||||
|
return TenantEntity._isActive;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -117,11 +122,10 @@ public class TenantQuery extends QueryBase<TenantEntity> {
|
||||||
TenantEntity item = new TenantEntity();
|
TenantEntity item = new TenantEntity();
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, TenantEntity._id, UUID.class));
|
item.setId(QueryBase.convertSafe(tuple, columns, TenantEntity._id, UUID.class));
|
||||||
item.setCode(QueryBase.convertSafe(tuple, columns, TenantEntity._code, String.class));
|
item.setCode(QueryBase.convertSafe(tuple, columns, TenantEntity._code, String.class));
|
||||||
item.setName(QueryBase.convertSafe(tuple, columns, TenantEntity._name, String.class));
|
|
||||||
item.setConfig(QueryBase.convertSafe(tuple, columns, TenantEntity._config, String.class));
|
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, TenantEntity._createdAt, Instant.class));
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, TenantEntity._createdAt, Instant.class));
|
||||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, TenantEntity._updatedAt, Instant.class));
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, TenantEntity._updatedAt, Instant.class));
|
||||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, TenantEntity._isActive, IsActive.class));
|
item.setIsActive(QueryBase.convertSafe(tuple, columns, TenantEntity._isActive, IsActive.class));
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,12 @@ import gr.cite.notification.model.UserContactInfo;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.context.annotation.RequestScope;
|
|
||||||
|
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import jakarta.persistence.criteria.Subquery;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.annotation.RequestScope;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -28,17 +27,25 @@ import java.util.*;
|
||||||
public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
|
||||||
private Collection<UUID> userIds;
|
private Collection<UUID> userIds;
|
||||||
|
|
||||||
private Collection<UUID> excludedUserIds;
|
private Collection<UUID> excludedUserIds;
|
||||||
|
|
||||||
private Collection<UUID> tenantIds;
|
private Collection<UUID> tenantIds;
|
||||||
|
|
||||||
private Collection<IsActive> isActives;
|
private Collection<IsActive> isActives;
|
||||||
|
|
||||||
private Collection<ContactInfoType> type;
|
private Collection<ContactInfoType> type;
|
||||||
|
|
||||||
private Collection<String> values;
|
private Collection<String> values;
|
||||||
|
|
||||||
private UserQuery userQuery;
|
private UserQuery userQuery;
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
private final UserScope userScope;
|
private final UserScope userScope;
|
||||||
|
|
||||||
private final AuthorizationService authService;
|
private final AuthorizationService authService;
|
||||||
|
|
||||||
public UserContactInfoQuery(
|
public UserContactInfoQuery(
|
||||||
|
@ -177,16 +184,19 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <X, Y> Predicate applyAuthZ(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyAuthZ(QueryContext<X, Y> queryContext) {
|
||||||
if (this.authorize.contains(AuthorizationFlags.None)) return null;
|
if (this.authorize.contains(AuthorizationFlags.None))
|
||||||
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUserContactInfo)) return null;
|
return null;
|
||||||
|
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUserContactInfo))
|
||||||
|
return null;
|
||||||
UUID ownerId = null;
|
UUID ownerId = null;
|
||||||
if (this.authorize.contains(AuthorizationFlags.Owner)) ownerId = this.userScope.getUserIdSafe();
|
if (this.authorize.contains(AuthorizationFlags.Owner))
|
||||||
|
ownerId = this.userScope.getUserIdSafe();
|
||||||
|
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (ownerId != null) {
|
if (ownerId != null) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.equal(queryContext.Root.get(UserContactInfoEntity._userId), ownerId));
|
predicates.add(queryContext.CriteriaBuilder.equal(queryContext.Root.get(UserContactInfoEntity._userId), ownerId));
|
||||||
}
|
}
|
||||||
if (predicates.size() > 0) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
} else {
|
} else {
|
||||||
|
@ -199,7 +209,8 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.userIds != null) {
|
if (this.userIds != null) {
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId));
|
||||||
for (UUID item : this.userIds) inClause.value(item);
|
for (UUID item : this.userIds)
|
||||||
|
inClause.value(item);
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.excludedUserIds != null) {
|
if (this.excludedUserIds != null) {
|
||||||
|
@ -210,12 +221,14 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
||||||
}
|
}
|
||||||
if (this.tenantIds != null) {
|
if (this.tenantIds != null) {
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._tenantId));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._tenantId));
|
||||||
for (UUID item : this.tenantIds) inClause.value(item);
|
for (UUID item : this.tenantIds)
|
||||||
|
inClause.value(item);
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.type != null) {
|
if (this.type != null) {
|
||||||
CriteriaBuilder.In<ContactInfoType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._type));
|
CriteriaBuilder.In<ContactInfoType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._type));
|
||||||
for (ContactInfoType item : this.type) inClause.value(item);
|
for (ContactInfoType item : this.type)
|
||||||
|
inClause.value(item);
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.values != null) {
|
if (this.values != null) {
|
||||||
|
@ -239,14 +252,24 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
if (item.match(UserContactInfo._id)) return UserContactInfoEntity._id;
|
if (item.match(UserContactInfo._id))
|
||||||
else if (item.prefix(UserContactInfo._tenant)) return UserContactInfoEntity._tenantId;
|
return UserContactInfoEntity._id;
|
||||||
else if (item.match(UserContactInfo._type)) return UserContactInfoEntity._type;
|
else if (item.prefix(UserContactInfo._tenant))
|
||||||
else if (item.match(UserContactInfo._value)) return UserContactInfoEntity._value;
|
return UserContactInfoEntity._tenantId;
|
||||||
else if (item.match(UserContactInfo._createdAt)) return UserContactInfoEntity._createdAt;
|
else if (item.match(UserContactInfo._type))
|
||||||
else if (item.match(UserContactInfo._user, User._id)) return UserContactInfoEntity._userId;
|
return UserContactInfoEntity._type;
|
||||||
else if (item.prefix(UserContactInfo._user)) return UserContactInfoEntity._userId;
|
else if (item.match(UserContactInfo._value))
|
||||||
else return null;
|
return UserContactInfoEntity._value;
|
||||||
|
else if (item.match(UserContactInfo._ordinal))
|
||||||
|
return UserContactInfoEntity._ordinal;
|
||||||
|
else if (item.match(UserContactInfo._createdAt))
|
||||||
|
return UserContactInfoEntity._createdAt;
|
||||||
|
else if (item.match(UserContactInfo._user, User._id))
|
||||||
|
return UserContactInfoEntity._userId;
|
||||||
|
else if (item.prefix(UserContactInfo._user))
|
||||||
|
return UserContactInfoEntity._userId;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -255,6 +278,7 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._id, UUID.class));
|
item.setId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._id, UUID.class));
|
||||||
item.setType(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._type, ContactInfoType.class));
|
item.setType(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._type, ContactInfoType.class));
|
||||||
item.setValue(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._value, String.class));
|
item.setValue(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._value, String.class));
|
||||||
|
item.setOrdinal(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._ordinal, Integer.class));
|
||||||
item.setUserId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._userId, UUID.class));
|
item.setUserId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._userId, UUID.class));
|
||||||
item.setTenantId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._tenantId, UUID.class));
|
item.setTenantId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._tenantId, UUID.class));
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._createdAt, Instant.class));
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._createdAt, Instant.class));
|
||||||
|
|
|
@ -66,18 +66,18 @@ public class UserNotificationPreferenceQuery extends QueryBase<UserNotificationP
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.userId != null) {
|
if (this.userId != null) {
|
||||||
predicates.add(queryContext.Root.get(UserNotificationPreferenceEntity.Field.USER_ID).in(this.userId));
|
predicates.add(queryContext.Root.get(UserNotificationPreferenceEntity._userId).in(this.userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type != null) {
|
if (this.type != null) {
|
||||||
predicates.add(queryContext.Root.get(UserNotificationPreferenceEntity.Field.TYPE).in(this.type));
|
predicates.add(queryContext.Root.get(UserNotificationPreferenceEntity._type).in(this.type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.channel != null) {
|
if (this.channel != null) {
|
||||||
predicates.add(queryContext.Root.get(UserNotificationPreferenceEntity.Field.CHANNEL).in(this.channel));
|
predicates.add(queryContext.Root.get(UserNotificationPreferenceEntity._channel).in(this.channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (predicates.size() > 0) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
} else {
|
} else {
|
||||||
|
@ -88,24 +88,24 @@ public class UserNotificationPreferenceQuery extends QueryBase<UserNotificationP
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
if (item.match(UserNotificationPreference.Field.USER_ID)) return UserNotificationPreferenceEntity.Field.USER_ID;
|
if (item.match(UserNotificationPreference.Field.USER_ID)) return UserNotificationPreferenceEntity.Field._userId;
|
||||||
else if (item.match(UserNotificationPreference.Field.TENANT_ID)) return UserNotificationPreferenceEntity._tenantId;
|
else if (item.match(UserNotificationPreference.Field.TENANT_ID)) return UserNotificationPreferenceEntity._tenantId;
|
||||||
else if (item.match(UserNotificationPreference.Field.TYPE)) return UserNotificationPreferenceEntity.Field.TYPE;
|
else if (item.match(UserNotificationPreference.Field.TYPE)) return UserNotificationPreferenceEntity.Field._type;
|
||||||
else if (item.match(UserNotificationPreference.Field.CHANNEL)) return UserNotificationPreferenceEntity.Field.CHANNEL;
|
else if (item.match(UserNotificationPreference.Field.CHANNEL)) return UserNotificationPreferenceEntity.Field._channel;
|
||||||
else if (item.match(UserNotificationPreference.Field.ORDINAL)) return UserNotificationPreferenceEntity.Field.ORDINAL;
|
else if (item.match(UserNotificationPreference.Field.ORDINAL)) return UserNotificationPreferenceEntity.Field._ordinal;
|
||||||
else if (item.match(UserNotificationPreference.Field.CREATED_AT)) return UserNotificationPreferenceEntity.Field.CREATED_AT;
|
else if (item.match(UserNotificationPreference.Field.CREATED_AT)) return UserNotificationPreferenceEntity.Field._createdAt;
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected UserNotificationPreferenceEntity convert(Tuple tuple, Set<String> columns) {
|
protected UserNotificationPreferenceEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
UserNotificationPreferenceEntity item = new UserNotificationPreferenceEntity();
|
UserNotificationPreferenceEntity item = new UserNotificationPreferenceEntity();
|
||||||
item.setUserId(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field.USER_ID, UUID.class));
|
item.setUserId(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field._userId, UUID.class));
|
||||||
item.setChannel(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field.CHANNEL, NotificationContactType.class));
|
item.setChannel(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field._channel, NotificationContactType.class));
|
||||||
item.setType(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field.TYPE, UUID.class));
|
item.setType(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field._type, UUID.class));
|
||||||
item.setTenantId(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity._tenantId, UUID.class));
|
item.setTenantId(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity._tenantId, UUID.class));
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field.CREATED_AT, Instant.class));
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field._createdAt, Instant.class));
|
||||||
item.setOrdinal(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field.ORDINAL, Integer.class));
|
item.setOrdinal(QueryBase.convertSafe(tuple, columns, UserNotificationPreferenceEntity.Field._ordinal, Integer.class));
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,25 +12,29 @@ import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyForbiddenException;
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import jakarta.persistence.Query;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.context.annotation.RequestScope;
|
import org.springframework.web.context.annotation.RequestScope;
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Query;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequestScope
|
@RequestScope
|
||||||
public class InAppNotificationServiceImpl implements InAppNotificationService {
|
public class InAppNotificationServiceImpl implements InAppNotificationService {
|
||||||
|
|
||||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(InAppNotificationServiceImpl.class));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(InAppNotificationServiceImpl.class));
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
|
||||||
private final TenantScopedEntityManager entityManager;
|
private final TenantScopedEntityManager entityManager;
|
||||||
|
|
||||||
private final AuthorizationService authService;
|
private final AuthorizationService authService;
|
||||||
|
|
||||||
private final DeleterFactory deleterFactory;
|
private final DeleterFactory deleterFactory;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -41,13 +45,11 @@ public class InAppNotificationServiceImpl implements InAppNotificationService{
|
||||||
this.deleterFactory = deleterFactory;
|
this.deleterFactory = deleterFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markAsRead(UUID id)
|
public void markAsRead(UUID id) {
|
||||||
{
|
|
||||||
this.markAsRead(List.of(id));
|
this.markAsRead(List.of(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markAsRead(List<UUID> ids)
|
public void markAsRead(List<UUID> ids) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
logger.debug(new DataLogEntry("marking as read in-app notifications", ids));
|
logger.debug(new DataLogEntry("marking as read in-app notifications", ids));
|
||||||
|
|
||||||
|
@ -71,8 +73,8 @@ public class InAppNotificationServiceImpl implements InAppNotificationService{
|
||||||
public void markAsReadAllUserNotification(UUID userId) {
|
public void markAsReadAllUserNotification(UUID userId) {
|
||||||
String entity = InAppNotificationEntity.class.getSimpleName();
|
String entity = InAppNotificationEntity.class.getSimpleName();
|
||||||
|
|
||||||
String sqlQuery = "UPDATE " + entity + " as e SET "+ InAppNotificationEntity.Field._trackingState +" = :trackingState, "+ InAppNotificationEntity.Field._updatedAt + "= :updatedAt, " + InAppNotificationEntity.Field._readTime + " = :readTime " +
|
String sqlQuery = "UPDATE " + entity + " as e SET " + InAppNotificationEntity._trackingState + " = :trackingState, " + InAppNotificationEntity._updatedAt + "= :updatedAt, " + InAppNotificationEntity._readTime + " = :readTime " +
|
||||||
"WHERE e." + InAppNotificationEntity.Field._trackingState + " = :trackingStateCondition AND e."+ InAppNotificationEntity.Field._userId + " = :userId";
|
"WHERE e." + InAppNotificationEntity._trackingState + " = :trackingStateCondition AND e." + InAppNotificationEntity._userId + " = :userId";
|
||||||
|
|
||||||
Query query = this.entityManager.createQuery(sqlQuery)
|
Query query = this.entityManager.createQuery(sqlQuery)
|
||||||
.setParameter("trackingState", NotificationInAppTracking.DELIVERED)
|
.setParameter("trackingState", NotificationInAppTracking.DELIVERED)
|
||||||
|
@ -84,9 +86,8 @@ public class InAppNotificationServiceImpl implements InAppNotificationService{
|
||||||
int updateCount = query.executeUpdate();
|
int updateCount = query.executeUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
logger.debug("deleting inapp notification: {}", id);
|
logger.debug("deleting in-app notification: {}", id);
|
||||||
this.authService.authorizeForce(Permission.DeleteInAppNotification);
|
this.authService.authorizeForce(Permission.DeleteInAppNotification);
|
||||||
this.deleterFactory.deleter(InAppNotificationDeleter.class).deleteAndSaveByIds(List.of(id));
|
this.deleterFactory.deleter(InAppNotificationDeleter.class).deleteAndSaveByIds(List.of(id));
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class NotificationSchedulingServiceImpl implements NotificationScheduling
|
||||||
.notifyState(NotificationNotifyState.PENDING, NotificationNotifyState.ERROR)
|
.notifyState(NotificationNotifyState.PENDING, NotificationNotifyState.ERROR)
|
||||||
.retryThreshold(Math.toIntExact(this.properties.getTask().getProcessor().getOptions().getRetryThreshold()))
|
.retryThreshold(Math.toIntExact(this.properties.getTask().getProcessor().getOptions().getRetryThreshold()))
|
||||||
.createdAfter(lastCandidateNotificationCreationTimestamp)
|
.createdAfter(lastCandidateNotificationCreationTimestamp)
|
||||||
.ordering(new Ordering().addAscending(NotificationEntity.Field._createdAt));
|
.ordering(new Ordering().addAscending(NotificationEntity._createdAt));
|
||||||
candidates = notificationQuery.first();
|
candidates = notificationQuery.first();
|
||||||
if (candidates != null) {
|
if (candidates != null) {
|
||||||
NotificationNotifyState previousState = candidates.getNotifyState();
|
NotificationNotifyState previousState = candidates.getNotifyState();
|
||||||
|
|
|
@ -40,7 +40,6 @@ import java.time.Instant;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@RequestScope
|
@RequestScope
|
||||||
|
@ -176,7 +175,7 @@ public class TenantConfigurationServiceImpl implements TenantConfigurationServic
|
||||||
|
|
||||||
//this._eventBroker.EmitTenantConfigurationTouched(this._scope.Tenant, type);
|
//this._eventBroker.EmitTenantConfigurationTouched(this._scope.Tenant, type);
|
||||||
|
|
||||||
TenantConfiguration persisted = this.builderFactory.builder(TenantConfigurationBuilder.class).build(fieldSet.merge(new BaseFieldSet(TenantConfiguration.Field.ID, TenantConfiguration.Field.HASH)), data);
|
TenantConfiguration persisted = this.builderFactory.builder(TenantConfigurationBuilder.class).build(fieldSet.merge(new BaseFieldSet(TenantConfiguration._id, TenantConfiguration._hash)), data);
|
||||||
return persisted;
|
return persisted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +205,7 @@ public class TenantConfigurationServiceImpl implements TenantConfigurationServic
|
||||||
Boolean isUpdate = this.conventionService.isValidGuid(modelId);
|
Boolean isUpdate = this.conventionService.isValidGuid(modelId);
|
||||||
|
|
||||||
TenantConfigurationQuery tenantConfigurationQuery = applicationContext.getBean(TenantConfigurationQuery.class);
|
TenantConfigurationQuery tenantConfigurationQuery = applicationContext.getBean(TenantConfigurationQuery.class);
|
||||||
List<UUID> existingConfigIds = tenantConfigurationQuery.isActive(IsActive.Active).type(type).collectAs(new BaseFieldSet(TenantConfigurationEntity.Field.ID)).stream().map(TenantConfigurationEntity::getId).collect(Collectors.toList());
|
List<UUID> existingConfigIds = tenantConfigurationQuery.isActive(IsActive.Active).type(type).collectAs(new BaseFieldSet(TenantConfigurationEntity._id)).stream().map(TenantConfigurationEntity::getId).toList();
|
||||||
TenantConfigurationEntity data = null;
|
TenantConfigurationEntity data = null;
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
if (!existingConfigIds.contains(modelId)) throw new MyValidationException(this.errors.getSingleTenantConfigurationPerTypeSupported().getCode(), this.errors.getSingleTenantConfigurationPerTypeSupported().getMessage());
|
if (!existingConfigIds.contains(modelId)) throw new MyValidationException(this.errors.getSingleTenantConfigurationPerTypeSupported().getCode(), this.errors.getSingleTenantConfigurationPerTypeSupported().getMessage());
|
||||||
|
@ -237,7 +236,7 @@ public class TenantConfigurationServiceImpl implements TenantConfigurationServic
|
||||||
|
|
||||||
//this._eventBroker.EmitTenantConfigurationTouched(this._scope.Tenant, type);
|
//this._eventBroker.EmitTenantConfigurationTouched(this._scope.Tenant, type);
|
||||||
|
|
||||||
TenantConfiguration persisted = this.builderFactory.builder(TenantConfigurationBuilder.class).build(fieldSet.merge(new BaseFieldSet(TenantConfiguration.Field.ID, TenantConfiguration.Field.HASH)), data);
|
TenantConfiguration persisted = this.builderFactory.builder(TenantConfigurationBuilder.class).build(fieldSet.merge(new BaseFieldSet(TenantConfiguration._id, TenantConfiguration._hash)), data);
|
||||||
return persisted;
|
return persisted;
|
||||||
//return null;
|
//return null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue