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,166 +14,181 @@ 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
|
|
||||||
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
|
||||||
private UUID id;
|
|
||||||
public final static String _id = "id";
|
|
||||||
|
|
||||||
@Column(name = "\"queue\"", nullable = false, length = 50)
|
@Id
|
||||||
private String queue;
|
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
public final static String _queue = "queue";
|
private UUID id;
|
||||||
|
|
||||||
@Column(name = "\"exchange\"", nullable = false, length = 50)
|
public static final String _id = "id";
|
||||||
private String exchange;
|
|
||||||
public final static String _exchange = "exchange";
|
|
||||||
|
|
||||||
@Column(name = "\"route\"", nullable = false, length = 50)
|
@Column(name = "\"queue\"", nullable = false, length = 50)
|
||||||
private String route;
|
private String queue;
|
||||||
public final static String _route = "route";
|
|
||||||
|
|
||||||
@Column(name = "\"application_id\"", nullable = false, length = 100)
|
public static final String _queue = "queue";
|
||||||
private String applicationId;
|
|
||||||
public final static String _applicationId = "applicationId";
|
|
||||||
|
|
||||||
@Column(name = "\"message_id\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"exchange\"", nullable = false, length = 50)
|
||||||
private UUID messageId;
|
private String exchange;
|
||||||
public final static String _messageId = "messageId";
|
|
||||||
|
|
||||||
@Type(JsonSQLType.class)
|
public static final String _exchange = "exchange";
|
||||||
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
|
||||||
private String message;
|
|
||||||
public final static String _message = "message";
|
|
||||||
|
|
||||||
@Column(name = "\"retry_count\"", nullable = true)
|
@Column(name = "\"route\"", nullable = false, length = 50)
|
||||||
private Integer retryCount;
|
private String route;
|
||||||
public final static String _retryCount = "retryCount";
|
|
||||||
|
|
||||||
@Column(name = "\"tenant\"", columnDefinition = "uuid", nullable = true)
|
public static final String _route = "route";
|
||||||
private UUID tenantId;
|
|
||||||
public final static String _tenantId = "tenantId";
|
|
||||||
|
|
||||||
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
@Column(name = "\"application_id\"", nullable = false, length = 100)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
private String applicationId;
|
||||||
private IsActive isActive;
|
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "\"status\"", length = 50, nullable = false)
|
public static final String _applicationId = "applicationId";
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private QueueInboxStatus status;
|
|
||||||
public final static String _status = "status";
|
|
||||||
|
|
||||||
@Column(name = "\"created_at\"", nullable = false)
|
@Column(name = "\"message_id\"", columnDefinition = "uuid", nullable = false)
|
||||||
private Instant createdAt;
|
private UUID messageId;
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
|
||||||
@Column(name = "\"updated_at\"", nullable = false)
|
public static final String _messageId = "messageId";
|
||||||
@Version
|
|
||||||
private Instant updatedAt;
|
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
|
||||||
public UUID getId() {
|
@Type(JsonSQLType.class)
|
||||||
return id;
|
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
||||||
}
|
private String message;
|
||||||
|
|
||||||
public void setId(UUID id) {
|
public static final String _message = "message";
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExchange() {
|
@Column(name = "\"retry_count\"")
|
||||||
return exchange;
|
private Integer retryCount;
|
||||||
}
|
|
||||||
|
|
||||||
public void setExchange(String exchange) {
|
public static final String _retryCount = "retryCount";
|
||||||
this.exchange = exchange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRoute() {
|
@Column(name = "\"tenant\"", columnDefinition = "uuid")
|
||||||
return route;
|
private UUID tenantId;
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoute(String route) {
|
public static final String _tenantId = "tenantId";
|
||||||
this.route = route;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getMessageId() {
|
@Column(name = "\"status\"", length = 50, nullable = false)
|
||||||
return messageId;
|
@Enumerated(EnumType.STRING)
|
||||||
}
|
private QueueInboxStatus status;
|
||||||
|
|
||||||
public void setMessageId(UUID messageId) {
|
public static final String _status = "status";
|
||||||
this.messageId = messageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
return message;
|
private Instant createdAt;
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
public static final String _createdAt = "createdAt";
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getTenantId() {
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
return tenantId;
|
@Version
|
||||||
}
|
private Instant updatedAt;
|
||||||
|
|
||||||
public void setTenantId(UUID tenantId) {
|
public static final String _updatedAt = "updatedAt";
|
||||||
this.tenantId = tenantId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
||||||
return isActive;
|
@Convert(converter = IsActiveConverter.class)
|
||||||
}
|
private IsActive isActive;
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
public static final String _isActive = "isActive";
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public UUID getId() {
|
||||||
return createdAt;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedAt(Instant createdAt) {
|
public void setId(UUID id) {
|
||||||
this.createdAt = createdAt;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getUpdatedAt() {
|
public String getQueue() {
|
||||||
return updatedAt;
|
return queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setQueue(String queue) {
|
||||||
this.updatedAt = updatedAt;
|
this.queue = queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQueue() {
|
public String getExchange() {
|
||||||
return queue;
|
return exchange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQueue(String queue) {
|
public void setExchange(String exchange) {
|
||||||
this.queue = queue;
|
this.exchange = exchange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApplicationId() {
|
public String getRoute() {
|
||||||
return applicationId;
|
return route;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApplicationId(String applicationId) {
|
public void setRoute(String route) {
|
||||||
this.applicationId = applicationId;
|
this.route = route;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public String getApplicationId() {
|
||||||
public Integer getRetryCount() {
|
return applicationId;
|
||||||
return retryCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void setRetryCount(Integer retryCount) {
|
public void setApplicationId(String applicationId) {
|
||||||
this.retryCount = retryCount;
|
this.applicationId = applicationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueueInboxStatus getStatus() {
|
public UUID getMessageId() {
|
||||||
return status;
|
return messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(QueueInboxStatus status) {
|
public void setMessageId(UUID messageId) {
|
||||||
this.status = status;
|
this.messageId = messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getRetryCount() {
|
||||||
|
return retryCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRetryCount(Integer retryCount) {
|
||||||
|
this.retryCount = retryCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenantId(UUID tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QueueInboxStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(QueueInboxStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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,175 +1,205 @@
|
||||||
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
|
|
||||||
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
|
||||||
private UUID id;
|
|
||||||
public final static String _id = "id";
|
|
||||||
|
|
||||||
@Column(name = "\"exchange\"", nullable = false, length = 50)
|
@Id
|
||||||
private String exchange;
|
@Column(name = "\"id\"", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
public final static String _exchange = "exchange";
|
private UUID id;
|
||||||
|
|
||||||
@Column(name = "\"route\"", length = 50)
|
public static final String _id = "id";
|
||||||
private String route;
|
|
||||||
public final static String _route = "route";
|
|
||||||
|
|
||||||
@Column(name = "\"message_id\"", columnDefinition = "uuid", nullable = false)
|
@Column(name = "\"exchange\"", nullable = false, length = 50)
|
||||||
private UUID messageId;
|
private String exchange;
|
||||||
public final static String _messageId = "messageId";
|
|
||||||
|
|
||||||
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
public static final String _exchange = "exchange";
|
||||||
private String message;
|
|
||||||
public final static String _message = "message";
|
|
||||||
|
|
||||||
@Column(name = "\"notify_status\"", length = 20, nullable = false)
|
@Column(name = "\"route\"", length = 50)
|
||||||
@Enumerated(EnumType.STRING)
|
private String route;
|
||||||
private QueueOutboxNotifyStatus notifyStatus;
|
|
||||||
public final static String _notifyStatus = "notifyStatus";
|
|
||||||
|
|
||||||
@Column(name = "\"retry_count\"", nullable = false)
|
public static final String _route = "route";
|
||||||
private int retryCount;
|
|
||||||
public final static String _retryCount = "retryCount";
|
|
||||||
|
|
||||||
@Column(name = "\"published_at\"", nullable = true)
|
@Column(name = "\"message_id\"", columnDefinition = "uuid", nullable = false)
|
||||||
private Instant publishedAt;
|
private UUID messageId;
|
||||||
public final static String _publishedAt = "publishedAt";
|
|
||||||
|
|
||||||
@Column(name = "\"confirmed_at\"", nullable = true)
|
public static final String _messageId = "messageId";
|
||||||
private Instant confirmedAt;
|
|
||||||
public final static String _confirmedAt = "confirmedAt";
|
|
||||||
|
|
||||||
@Column(name = "\"tenant\"", columnDefinition = "uuid", nullable = true)
|
@Column(name = "\"message\"", columnDefinition = "json", nullable = false)
|
||||||
private UUID tenantId;
|
private String message;
|
||||||
public final static String _tenantId = "tenantId";
|
|
||||||
|
|
||||||
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
public static final String _message = "message";
|
||||||
@Convert(converter = IsActiveConverter.class)
|
|
||||||
private IsActive isActive;
|
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "\"created_at\"", nullable = false)
|
@Column(name = "\"notify_status\"", length = 20, nullable = false)
|
||||||
private Instant createdAt;
|
@Enumerated(EnumType.STRING)
|
||||||
public final static String _createdAt = "createdAt";
|
private QueueOutboxNotifyStatus notifyStatus;
|
||||||
|
|
||||||
@Column(name = "\"updated_at\"", nullable = false)
|
public static final String _notifyStatus = "notifyStatus";
|
||||||
private Instant updatedAt;
|
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
|
||||||
public UUID getId() {
|
@Column(name = "\"retry_count\"", nullable = false)
|
||||||
return id;
|
private Integer retryCount;
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(UUID id) {
|
public static final String _retryCount = "retryCount";
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExchange() {
|
@Column(name = "\"published_at\"")
|
||||||
return exchange;
|
private Instant publishedAt;
|
||||||
}
|
|
||||||
|
|
||||||
public void setExchange(String exchange) {
|
public static final String _publishedAt = "publishedAt";
|
||||||
this.exchange = exchange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRoute() {
|
@Column(name = "\"confirmed_at\"")
|
||||||
return route;
|
private Instant confirmedAt;
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoute(String route) {
|
public static final String _confirmedAt = "confirmedAt";
|
||||||
this.route = route;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getMessageId() {
|
@Column(name = "\"tenant\"", columnDefinition = "uuid")
|
||||||
return messageId;
|
private UUID tenantId;
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageId(UUID messageId) {
|
public static final String _tenantId = "tenantId";
|
||||||
this.messageId = messageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
return message;
|
private Instant createdAt;
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
public static final String _createdAt = "createdAt";
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QueueOutboxNotifyStatus getNotifyStatus() {
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
return notifyStatus;
|
private Instant updatedAt;
|
||||||
}
|
|
||||||
|
|
||||||
public void setNotifyStatus(QueueOutboxNotifyStatus notifyStatus) {
|
public static final String _updatedAt = "updatedAt";
|
||||||
this.notifyStatus = notifyStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getRetryCount() {
|
@Column(name = "\"is_active\"", length = 20, nullable = false)
|
||||||
return retryCount;
|
@Convert(converter = IsActiveConverter.class)
|
||||||
}
|
private IsActive isActive;
|
||||||
|
|
||||||
public void setRetryCount(Integer retryCount) {
|
public static final String _isActive = "isActive";
|
||||||
this.retryCount = retryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getPublishedAt() {
|
@Override
|
||||||
return publishedAt;
|
public UUID getId() {
|
||||||
}
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPublishedAt(Instant publishedAt) {
|
@Override
|
||||||
this.publishedAt = publishedAt;
|
public void setId(UUID id) {
|
||||||
}
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public Instant getConfirmedAt() {
|
public String getExchange() {
|
||||||
return confirmedAt;
|
return exchange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfirmedAt(Instant confirmedAt) {
|
public void setExchange(String exchange) {
|
||||||
this.confirmedAt = confirmedAt;
|
this.exchange = exchange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getTenantId() {
|
@Override
|
||||||
return tenantId;
|
public String getRoute() {
|
||||||
}
|
return route;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTenantId(UUID tenantId) {
|
@Override
|
||||||
this.tenantId = tenantId;
|
public void setRoute(String route) {
|
||||||
}
|
this.route = route;
|
||||||
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
@Override
|
||||||
return isActive;
|
public UUID getMessageId() {
|
||||||
}
|
return messageId;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
@Override
|
||||||
this.isActive = isActive;
|
public void setMessageId(UUID messageId) {
|
||||||
}
|
this.messageId = messageId;
|
||||||
|
}
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
@Override
|
||||||
return createdAt;
|
public String getMessage() {
|
||||||
}
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCreatedAt(Instant createdAt) {
|
@Override
|
||||||
this.createdAt = createdAt;
|
public void setMessage(String message) {
|
||||||
}
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
public Instant getUpdatedAt() {
|
@Override
|
||||||
return updatedAt;
|
public QueueOutboxNotifyStatus getNotifyStatus() {
|
||||||
}
|
return notifyStatus;
|
||||||
|
}
|
||||||
|
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
@Override
|
||||||
this.updatedAt = updatedAt;
|
public void setNotifyStatus(QueueOutboxNotifyStatus notifyStatus) {
|
||||||
}
|
this.notifyStatus = notifyStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getRetryCount() {
|
||||||
|
return retryCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRetryCount(Integer retryCount) {
|
||||||
|
this.retryCount = retryCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Instant getPublishedAt() {
|
||||||
|
return publishedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPublishedAt(Instant publishedAt) {
|
||||||
|
this.publishedAt = publishedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Instant getConfirmedAt() {
|
||||||
|
return confirmedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConfirmedAt(Instant confirmedAt) {
|
||||||
|
this.confirmedAt = confirmedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenantId(UUID tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Instant getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,109 +2,80 @@ 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
|
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
|
||||||
private UUID id;
|
|
||||||
public final static String _id = "id";
|
|
||||||
|
|
||||||
@Column(name = "code", length = 200, nullable = false)
|
@Id
|
||||||
private String code;
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
public final static String _code = "code";
|
private UUID id;
|
||||||
|
|
||||||
@Column(name = "name", length = 500, nullable = false)
|
public static final String _id = "id";
|
||||||
private String name;
|
|
||||||
public final static String _name = "name";
|
|
||||||
|
|
||||||
@Column(name = "description", nullable = false)
|
@Column(name = "code", length = 200, nullable = false)
|
||||||
private String description;
|
private String code;
|
||||||
public final static String _description = "description";
|
|
||||||
|
|
||||||
@Column(name = "is_active", length = 20, nullable = false)
|
public static final String _code = "code";
|
||||||
@Convert(converter = IsActiveConverter.class)
|
|
||||||
private IsActive isActive;
|
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "config")
|
@Column(name = "created_at", nullable = false)
|
||||||
private String config;
|
private Instant createdAt;
|
||||||
public final static String _config = "config";
|
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
public static final String _createdAt = "createdAt";
|
||||||
private Instant createdAt;
|
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
|
||||||
@Column(name = "updated_at", nullable = false)
|
@Column(name = "updated_at", nullable = false)
|
||||||
private Instant updatedAt;
|
private Instant updatedAt;
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
|
||||||
public UUID getId() {
|
public static final String _updatedAt = "updatedAt";
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(UUID id) {
|
@Column(name = "is_active", length = 20, nullable = false)
|
||||||
this.id = id;
|
@Convert(converter = IsActiveConverter.class)
|
||||||
}
|
private IsActive isActive;
|
||||||
|
|
||||||
public String getCode() {
|
public static final String _isActive = "isActive";
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(String code) {
|
public UUID getId() {
|
||||||
this.code = code;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public void setId(UUID id) {
|
||||||
return name;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public String getCode() {
|
||||||
this.name = name;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public void setCode(String code) {
|
||||||
return description;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public Instant getCreatedAt() {
|
||||||
this.description = description;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
public void setCreatedAt(Instant createdAt) {
|
||||||
return isActive;
|
this.createdAt = createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
public Instant getUpdatedAt() {
|
||||||
this.isActive = isActive;
|
return updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConfig() {
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
return config;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfig(String config) {
|
public IsActive getIsActive() {
|
||||||
this.config = config;
|
return isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public void setIsActive(IsActive isActive) {
|
||||||
return createdAt;
|
this.isActive = isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedAt(Instant createdAt) {
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getUpdatedAt() {
|
|
||||||
return updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
|
||||||
this.updatedAt = updatedAt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,73 +3,79 @@ 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
|
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
|
||||||
private UUID id;
|
|
||||||
public final static String _id = "id";
|
|
||||||
|
|
||||||
@Column(name = "user", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Id
|
||||||
private UUID userId;
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
public final static String _userId = "userId";
|
private UUID id;
|
||||||
|
|
||||||
@Column(name = "is_active", length = 100, nullable = false)
|
public static final String _id = "id";
|
||||||
@Convert(converter = IsActiveConverter.class)
|
|
||||||
private IsActive isActive;
|
|
||||||
public final static String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
@Column(name = "user", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private Instant createdAt;
|
private UUID userId;
|
||||||
public final static String _createdAt = "createdAt";
|
|
||||||
|
|
||||||
@Column(name = "updated_at", nullable = false)
|
public static final String _userId = "userId";
|
||||||
private Instant updatedAt;
|
|
||||||
public final static String _updatedAt = "updatedAt";
|
|
||||||
|
|
||||||
public UUID getId() {
|
@Column(name = "created_at", nullable = false)
|
||||||
return id;
|
private Instant createdAt;
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(UUID id) {
|
public static final String _createdAt = "createdAt";
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUserId() {
|
@Column(name = "updated_at", nullable = false)
|
||||||
return userId;
|
private Instant updatedAt;
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(UUID userId) {
|
public static final String _updatedAt = "updatedAt";
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
@Column(name = "is_active", length = 100, nullable = false)
|
||||||
return isActive;
|
@Convert(converter = IsActiveConverter.class)
|
||||||
}
|
private IsActive isActive;
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
public static final String _isActive = "isActive";
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public UUID getId() {
|
||||||
return createdAt;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedAt(Instant createdAt) {
|
public void setId(UUID id) {
|
||||||
this.createdAt = createdAt;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getUpdatedAt() {
|
public UUID getUserId() {
|
||||||
return updatedAt;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setUserId(UUID userId) {
|
||||||
this.updatedAt = updatedAt;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -11,81 +11,86 @@ import java.util.UUID;
|
||||||
@Table(name = "\"User\"")
|
@Table(name = "\"User\"")
|
||||||
public class UserEntity {
|
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";
|
||||||
private String name = null;
|
|
||||||
public final static String _name = "name";
|
|
||||||
public final static int _nameLength = 250;
|
|
||||||
|
|
||||||
|
@Column(name = "name", length = UserEntity._nameLength)
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
@Column(name = "created_at", nullable = false)
|
public static final String _name = "name";
|
||||||
private Instant createdAt;
|
|
||||||
|
|
||||||
public static final String _createdAt = "createdAt";
|
public static final int _nameLength = 250;
|
||||||
|
|
||||||
@Column(name = "updated_at", nullable = false)
|
@Column(name = "additional_info")
|
||||||
private Instant updatedAt;
|
private String additionalInfo;
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
public static final String _additionalInfo = "additionalInfo";
|
||||||
|
|
||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "created_at", nullable = false)
|
||||||
@Convert(converter = IsActiveConverter.class)
|
private Instant createdAt;
|
||||||
private IsActive isActive;
|
|
||||||
public static final String _isActive = "isActive";
|
|
||||||
|
|
||||||
@Column(name = "additional_info", nullable = true)
|
public static final String _createdAt = "createdAt";
|
||||||
private String additionalInfo;
|
|
||||||
public final static String _additionalInfo = "additionalInfo";
|
|
||||||
|
|
||||||
public UUID getId() {
|
@Column(name = "updated_at", nullable = false)
|
||||||
return id;
|
private Instant updatedAt;
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(UUID id) {
|
public static final String _updatedAt = "updatedAt";
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
@Column(name = "is_active", nullable = false)
|
||||||
return name;
|
@Convert(converter = IsActiveConverter.class)
|
||||||
}
|
private IsActive isActive;
|
||||||
|
|
||||||
public void setName(String name) {
|
public static final String _isActive = "isActive";
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCreatedAt() {
|
public UUID getId() {
|
||||||
return createdAt;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedAt(Instant createdAt) {
|
public void setId(UUID id) {
|
||||||
this.createdAt = createdAt;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getUpdatedAt() {
|
public String getName() {
|
||||||
return updatedAt;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setName(String name) {
|
||||||
this.updatedAt = updatedAt;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
public String getAdditionalInfo() {
|
||||||
return isActive;
|
return additionalInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
public void setAdditionalInfo(String additionalInfo) {
|
||||||
this.isActive = isActive;
|
this.additionalInfo = additionalInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdditionalInfo() {
|
public Instant getCreatedAt() {
|
||||||
return additionalInfo;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -19,7 +18,8 @@ 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,44 +23,47 @@ 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<>();
|
||||||
|
for (TenantEntity d : data) {
|
||||||
List<Tenant> models = new ArrayList<>();
|
|
||||||
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));
|
||||||
return models;
|
return models;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,246 +9,272 @@ 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 Collection<UUID> ids;
|
|
||||||
private List<UUID> excludeIds;
|
|
||||||
private List<UUID> userId;
|
|
||||||
private List<UUID> type;
|
|
||||||
private Collection<IsActive> isActives;
|
|
||||||
private List<UUID> tenantIds;
|
|
||||||
private List<NotificationInAppTracking> trackingState;
|
|
||||||
private Boolean isRead;
|
|
||||||
private Instant from;
|
|
||||||
private Instant to;
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
|
||||||
|
|
||||||
public InAppNotificationQuery like(String value) {
|
private String like;
|
||||||
this.like = value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery ids(UUID value) {
|
private Collection<UUID> ids;
|
||||||
this.ids = List.of(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery ids(UUID... value) {
|
private List<UUID> excludeIds;
|
||||||
this.ids = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery ids(Collection<UUID> values) {
|
private List<UUID> userId;
|
||||||
this.ids = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery excludeIds(UUID... value) {
|
private List<UUID> type;
|
||||||
this.excludeIds = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery excludeIds(List<UUID> values) {
|
private Collection<IsActive> isActives;
|
||||||
this.excludeIds = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery userId(UUID... value) {
|
private List<UUID> tenantIds;
|
||||||
this.userId = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery userId(List<UUID> values) {
|
private List<NotificationInAppTracking> trackingState;
|
||||||
this.userId = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery type(UUID... value) {
|
private Boolean isRead;
|
||||||
this.type = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery type(List<UUID> values) {
|
private Instant from;
|
||||||
this.type = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery isActive(IsActive value) {
|
private Instant to;
|
||||||
this.isActives = List.of(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery isActive(IsActive... value) {
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
this.isActives = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InAppNotificationQuery Tenants(List<UUID> value) {
|
public InAppNotificationQuery like(String value) {
|
||||||
this.tenantIds = value;
|
this.like = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppNotificationQuery Tenants(UUID... value) {
|
public InAppNotificationQuery ids(UUID value) {
|
||||||
this.tenantIds = Arrays.asList(value);
|
this.ids = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppNotificationQuery isActive(Collection<IsActive> values) {
|
public InAppNotificationQuery ids(UUID... value) {
|
||||||
this.isActives = values;
|
this.ids = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppNotificationQuery trackingState(List<NotificationInAppTracking> values) {
|
public InAppNotificationQuery ids(Collection<UUID> values) {
|
||||||
this.trackingState = values;
|
this.ids = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppNotificationQuery trackingState(NotificationInAppTracking... value) {
|
public InAppNotificationQuery excludeIds(UUID... value) {
|
||||||
this.trackingState = List.of(value);
|
this.excludeIds = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppNotificationQuery isRead(Boolean isRead) {
|
public InAppNotificationQuery excludeIds(List<UUID> values) {
|
||||||
this.isRead = isRead;
|
this.excludeIds = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppNotificationQuery isRead() {
|
public InAppNotificationQuery userId(UUID... value) {
|
||||||
this.isRead = true;
|
this.userId = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppNotificationQuery from(Instant from) {
|
public InAppNotificationQuery userId(List<UUID> values) {
|
||||||
this.from = from;
|
this.userId = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppNotificationQuery to(Instant to) {
|
public InAppNotificationQuery type(UUID... value) {
|
||||||
this.to = to;
|
this.type = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppNotificationQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public InAppNotificationQuery type(List<UUID> values) {
|
||||||
this.authorize = values;
|
this.type = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public InAppNotificationQuery isActive(IsActive value) {
|
||||||
protected Boolean isFalseQuery() {
|
this.isActives = List.of(value);
|
||||||
return this.isNullOrEmpty(this.ids)
|
return this;
|
||||||
&& this.isNullOrEmpty(this.isActives)
|
}
|
||||||
&& this.isNullOrEmpty(this.type)
|
|
||||||
&& this.isNullOrEmpty(this.excludeIds)
|
|
||||||
&& this.isNullOrEmpty(this.userId)
|
|
||||||
&& this.isNullOrEmpty(this.trackingState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public InAppNotificationQuery isActive(IsActive... value) {
|
||||||
protected Class<InAppNotificationEntity> entityClass() {
|
this.isActives = Arrays.asList(value);
|
||||||
return InAppNotificationEntity.class;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public InAppNotificationQuery Tenants(List<UUID> value) {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
this.tenantIds = value;
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
return this;
|
||||||
if (this.ids != null) {
|
}
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._id).in(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
public InAppNotificationQuery Tenants(UUID... value) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(InAppNotificationEntity.Field._subject), this.like));
|
this.tenantIds = Arrays.asList(value);
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.excludeIds != null) {
|
public InAppNotificationQuery isActive(Collection<IsActive> values) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.not(queryContext.Root.get(InAppNotificationEntity.Field._id).in(ids)));
|
this.isActives = values;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.userId != null) {
|
public InAppNotificationQuery trackingState(List<NotificationInAppTracking> values) {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._userId).in(userId));
|
this.trackingState = values;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isActives != null) {
|
public InAppNotificationQuery trackingState(NotificationInAppTracking... value) {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._isActive).in(isActives));
|
this.trackingState = List.of(value);
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.tenantIds != null) {
|
public InAppNotificationQuery isRead(Boolean isRead) {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity._tenantId).in(tenantIds));
|
this.isRead = isRead;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.type != null) {
|
public InAppNotificationQuery isRead() {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._type).in(this.type));
|
this.isRead = true;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.trackingState != null) {
|
public InAppNotificationQuery from(Instant from) {
|
||||||
predicates.add(queryContext.Root.get(InAppNotificationEntity.Field._trackingState).in(trackingState));
|
this.from = from;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (isRead != null) {
|
public InAppNotificationQuery to(Instant to) {
|
||||||
predicates.add(isRead ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(InAppNotificationEntity.Field._readTime)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(InAppNotificationEntity.Field._readTime)));
|
this.to = to;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (from != null) {
|
public InAppNotificationQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(InAppNotificationEntity.Field._createdAt), from));
|
this.authorize = values;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (to != null) {
|
@Override
|
||||||
predicates.add(queryContext.CriteriaBuilder.lessThanOrEqualTo(queryContext.Root.get(InAppNotificationEntity.Field._createdAt), from));
|
protected Boolean isFalseQuery() {
|
||||||
}
|
return this.isNullOrEmpty(this.ids)
|
||||||
|
&& this.isNullOrEmpty(this.isActives)
|
||||||
|
&& this.isNullOrEmpty(this.type)
|
||||||
|
&& this.isNullOrEmpty(this.excludeIds)
|
||||||
|
&& this.isNullOrEmpty(this.userId)
|
||||||
|
&& this.isNullOrEmpty(this.trackingState);
|
||||||
|
}
|
||||||
|
|
||||||
if (predicates.size() > 0) {
|
@Override
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
protected Class<InAppNotificationEntity> entityClass() {
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
return InAppNotificationEntity.class;
|
||||||
} else {
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
if (this.ids != null) {
|
||||||
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._id).in(ids));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(InAppNotificationEntity._subject), this.like));
|
||||||
if (item.match(InAppNotification.Field.ID)) return InAppNotificationEntity.Field._id;
|
}
|
||||||
else if (item.match(InAppNotification.Field.CREATED_AT)) return InAppNotificationEntity.Field._createdAt;
|
|
||||||
else if (item.match(InAppNotification.Field.USER)) return InAppNotificationEntity.Field._userId;
|
if (this.excludeIds != null) {
|
||||||
else if (item.match(InAppNotification.Field.IS_ACTIVE)) return InAppNotificationEntity.Field._isActive;
|
predicates.add(queryContext.CriteriaBuilder.not(queryContext.Root.get(InAppNotificationEntity._id).in(ids)));
|
||||||
else if (item.match(InAppNotification.Field.READ_TIME)) return InAppNotificationEntity.Field._readTime;
|
}
|
||||||
else if (item.match(InAppNotification.Field.TRACKING_STATE)) return InAppNotificationEntity.Field._trackingState;
|
|
||||||
else if (item.match(InAppNotification.Field.BODY)) return InAppNotificationEntity.Field._body;
|
if (this.userId != null) {
|
||||||
else if (item.match(InAppNotification.Field.EXTRA_DATA)) return InAppNotificationEntity.Field._extraData;
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._userId).in(userId));
|
||||||
else if (item.match(InAppNotification.Field.PRIORITY)) return InAppNotificationEntity.Field._priority;
|
}
|
||||||
else if (item.match(InAppNotification.Field.SUBJECT)) return InAppNotificationEntity.Field._subject;
|
|
||||||
else if (item.match(InAppNotification.Field.TENANT)) return InAppNotificationEntity._tenantId;
|
if (this.isActives != null) {
|
||||||
else if (item.match(InAppNotification.Field.TYPE)) return InAppNotificationEntity.Field._type;
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._isActive).in(isActives));
|
||||||
else if (item.match(InAppNotification.Field.UPDATED_AT)) return InAppNotificationEntity.Field._updatedAt;
|
}
|
||||||
else return null;
|
|
||||||
}
|
if (this.tenantIds != null) {
|
||||||
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._tenantId).in(tenantIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.type != null) {
|
||||||
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._type).in(this.type));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.trackingState != null) {
|
||||||
|
predicates.add(queryContext.Root.get(InAppNotificationEntity._trackingState).in(trackingState));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRead != null) {
|
||||||
|
predicates.add(isRead ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(InAppNotificationEntity._readTime)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(InAppNotificationEntity._readTime)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (from != null) {
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(InAppNotificationEntity._createdAt), from));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to != null) {
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.lessThanOrEqualTo(queryContext.Root.get(InAppNotificationEntity._createdAt), from));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!predicates.isEmpty()) {
|
||||||
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
|
if (item.match(InAppNotification.Field.ID))
|
||||||
|
return InAppNotificationEntity._id;
|
||||||
|
else if (item.match(InAppNotification.Field.CREATED_AT))
|
||||||
|
return InAppNotificationEntity._createdAt;
|
||||||
|
else if (item.match(InAppNotification.Field.USER))
|
||||||
|
return InAppNotificationEntity._userId;
|
||||||
|
else if (item.match(InAppNotification.Field.IS_ACTIVE))
|
||||||
|
return InAppNotificationEntity._isActive;
|
||||||
|
else if (item.match(InAppNotification.Field.READ_TIME))
|
||||||
|
return InAppNotificationEntity._readTime;
|
||||||
|
else if (item.match(InAppNotification.Field.TRACKING_STATE))
|
||||||
|
return InAppNotificationEntity._trackingState;
|
||||||
|
else if (item.match(InAppNotification.Field.BODY))
|
||||||
|
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
|
||||||
|
protected InAppNotificationEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
|
InAppNotificationEntity item = new InAppNotificationEntity();
|
||||||
|
item.setId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._id, UUID.class));
|
||||||
|
item.setType(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._type, UUID.class));
|
||||||
|
item.setUserId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._userId, UUID.class));
|
||||||
|
item.setTenantId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._tenantId, UUID.class));
|
||||||
|
item.setTrackingState(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._trackingState, NotificationInAppTracking.class));
|
||||||
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._createdAt, Instant.class));
|
||||||
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._updatedAt, Instant.class));
|
||||||
|
item.setIsActive(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._isActive, IsActive.class));
|
||||||
|
item.setExtraData(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._extraData, String.class));
|
||||||
|
item.setBody(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._body, String.class));
|
||||||
|
item.setSubject(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._subject, String.class));
|
||||||
|
item.setPriority(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._priority, InAppNotificationPriority.class));
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected InAppNotificationEntity convert(Tuple tuple, Set<String> columns) {
|
|
||||||
InAppNotificationEntity item = new InAppNotificationEntity();
|
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._id, UUID.class));
|
|
||||||
item.setType(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._type, UUID.class));
|
|
||||||
item.setUserId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._userId, UUID.class));
|
|
||||||
item.setTenantId(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity._tenantId, UUID.class));
|
|
||||||
item.setTrackingState(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._trackingState, NotificationInAppTracking.class));
|
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._createdAt, Instant.class));
|
|
||||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._updatedAt, Instant.class));
|
|
||||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._isActive, IsActive.class));
|
|
||||||
item.setExtraData(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._extraData, String.class));
|
|
||||||
item.setBody(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._body, String.class));
|
|
||||||
item.setSubject(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._subject, String.class));
|
|
||||||
item.setPriority(QueryBase.convertSafe(tuple, columns, InAppNotificationEntity.Field._priority, InAppNotificationPriority.class));
|
|
||||||
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,314 +8,346 @@ 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<IsActive> isActives;
|
|
||||||
private List<UUID> tenantIds;
|
|
||||||
private List<NotificationNotifyState> notifyState;
|
|
||||||
private List<NotificationContactType> notifiedWith;
|
|
||||||
private Boolean notifiedWithHasValue;
|
|
||||||
private Boolean notifiedAtHasValue;
|
|
||||||
private List<UUID> type;
|
|
||||||
private List<NotificationContactType> contactType;
|
|
||||||
private Integer retryThreshold;
|
|
||||||
private Instant createdAfter;
|
|
||||||
private List<NotificationTrackingState> trackingState;
|
|
||||||
|
|
||||||
private List<NotificationTrackingProcess> trackingProgress;
|
private Collection<UUID> ids;
|
||||||
|
|
||||||
private Collection<UUID> userIds;
|
private Collection<IsActive> isActives;
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
|
||||||
|
|
||||||
public NotificationQuery ids(UUID value) {
|
private List<UUID> tenantIds;
|
||||||
this.ids = List.of(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery ids(UUID... value) {
|
private List<NotificationNotifyState> notifyState;
|
||||||
this.ids = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery ids(Collection<UUID> values) {
|
private List<NotificationContactType> notifiedWith;
|
||||||
this.ids = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery isActive(IsActive value) {
|
private Boolean notifiedWithHasValue;
|
||||||
this.isActives = List.of(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery isActive(IsActive... value) {
|
private Boolean notifiedAtHasValue;
|
||||||
this.isActives = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery Tenants(List<UUID> value) {
|
private List<UUID> type;
|
||||||
this.tenantIds = value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery Tenants(UUID... value) {
|
private List<NotificationContactType> contactType;
|
||||||
this.tenantIds = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery isActive(Collection<IsActive> values) {
|
private Integer retryThreshold;
|
||||||
this.isActives = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery notifyState(NotificationNotifyState... notifyState) {
|
private Instant createdAfter;
|
||||||
this.notifyState = List.of(notifyState);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery notifyState(List<NotificationNotifyState> notifyState) {
|
private List<NotificationTrackingState> trackingState;
|
||||||
this.notifyState = notifyState;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery notifiedWith(NotificationContactType... notifiedWith) {
|
private List<NotificationTrackingProcess> trackingProgress;
|
||||||
this.notifiedWith = List.of(notifiedWith);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery notifiedWith(List<NotificationContactType> notifiedWith) {
|
private Collection<UUID> userIds;
|
||||||
this.notifiedWith = notifiedWith;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery notifiedWithHasValue(Boolean notifiedWithHasValue) {
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
this.notifiedWithHasValue = notifiedWithHasValue;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationQuery notifiedWithHasValue() {
|
public NotificationQuery ids(UUID value) {
|
||||||
this.notifiedWithHasValue = true;
|
this.ids = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery notifiedAtHasValue(Boolean notifiedAtHasValue) {
|
public NotificationQuery ids(UUID... value) {
|
||||||
this.notifiedAtHasValue = notifiedAtHasValue;
|
this.ids = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery notifiedAtHasValue() {
|
public NotificationQuery ids(Collection<UUID> values) {
|
||||||
this.notifiedAtHasValue = true;
|
this.ids = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery type(UUID... type) {
|
public NotificationQuery isActive(IsActive value) {
|
||||||
this.type = List.of(type);
|
this.isActives = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery type(List<UUID> type) {
|
public NotificationQuery isActive(IsActive... value) {
|
||||||
this.type = type;
|
this.isActives = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery contactType(NotificationContactType... contactType) {
|
public NotificationQuery Tenants(List<UUID> value) {
|
||||||
this.contactType = List.of(contactType);
|
this.tenantIds = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery contactType(List<NotificationContactType> contactType) {
|
public NotificationQuery Tenants(UUID... value) {
|
||||||
this.contactType = contactType;
|
this.tenantIds = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery retryThreshold(Integer retryThreshold) {
|
public NotificationQuery isActive(Collection<IsActive> values) {
|
||||||
this.retryThreshold = retryThreshold;
|
this.isActives = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery createdAfter(Instant createdAfter) {
|
public NotificationQuery notifyState(NotificationNotifyState... notifyState) {
|
||||||
this.createdAfter = createdAfter;
|
this.notifyState = List.of(notifyState);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public NotificationQuery notifyState(List<NotificationNotifyState> notifyState) {
|
||||||
this.authorize = values;
|
this.notifyState = notifyState;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery trackingState(NotificationTrackingState... trackingState) {
|
public NotificationQuery notifiedWith(NotificationContactType... notifiedWith) {
|
||||||
this.trackingState = List.of(trackingState);
|
this.notifiedWith = List.of(notifiedWith);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery trackingState(List<NotificationTrackingState> trackingState) {
|
public NotificationQuery notifiedWith(List<NotificationContactType> notifiedWith) {
|
||||||
this.trackingState = trackingState;
|
this.notifiedWith = notifiedWith;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery trackingProgress(NotificationTrackingProcess... trackingProgress) {
|
public NotificationQuery notifiedWithHasValue(Boolean notifiedWithHasValue) {
|
||||||
this.trackingProgress = List.of(trackingProgress);
|
this.notifiedWithHasValue = notifiedWithHasValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery trackingProgress(List<NotificationTrackingProcess> trackingProgress) {
|
public NotificationQuery notifiedWithHasValue() {
|
||||||
this.trackingProgress = trackingProgress;
|
this.notifiedWithHasValue = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery userIds(UUID value) {
|
public NotificationQuery notifiedAtHasValue(Boolean notifiedAtHasValue) {
|
||||||
this.userIds = List.of(value);
|
this.notifiedAtHasValue = notifiedAtHasValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery userIds(UUID... value) {
|
public NotificationQuery notifiedAtHasValue() {
|
||||||
this.userIds = Arrays.asList(value);
|
this.notifiedAtHasValue = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery userIds(Collection<UUID> values) {
|
public NotificationQuery type(UUID... type) {
|
||||||
this.userIds = values;
|
this.type = List.of(type);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationQuery ordering(Ordering ordering) {
|
public NotificationQuery type(List<UUID> type) {
|
||||||
this.setOrder(ordering);
|
this.type = type;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public NotificationQuery contactType(NotificationContactType... contactType) {
|
||||||
protected Boolean isFalseQuery() {
|
this.contactType = List.of(contactType);
|
||||||
return this.isNullOrEmpty(this.ids)
|
return this;
|
||||||
&& this.isNullOrEmpty(this.isActives)
|
}
|
||||||
&& this.isNullOrEmpty(this.notifyState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public NotificationQuery contactType(List<NotificationContactType> contactType) {
|
||||||
protected Class<NotificationEntity> entityClass() {
|
this.contactType = contactType;
|
||||||
return NotificationEntity.class;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public NotificationQuery retryThreshold(Integer retryThreshold) {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
this.retryThreshold = retryThreshold;
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
return this;
|
||||||
if (this.ids != null) {
|
}
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._id).in(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isActives != null) {
|
public NotificationQuery createdAfter(Instant createdAfter) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._isActive).in(isActives));
|
this.createdAfter = createdAfter;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.tenantIds != null) {
|
public NotificationQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._tenantId).in(tenantIds));
|
this.authorize = values;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.notifyState != null) {
|
public NotificationQuery trackingState(NotificationTrackingState... trackingState) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._notifyState).in(notifyState));
|
this.trackingState = List.of(trackingState);
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.notifiedWith != null) {
|
public NotificationQuery trackingState(List<NotificationTrackingState> trackingState) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._notifiedWith).in(notifiedWith));
|
this.trackingState = trackingState;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (notifiedWithHasValue != null) {
|
public NotificationQuery trackingProgress(NotificationTrackingProcess... trackingProgress) {
|
||||||
Predicate hasValuePredicate = notifiedWithHasValue ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(NotificationEntity.Field._notifiedWith)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(NotificationEntity.Field._notifiedWith));
|
this.trackingProgress = List.of(trackingProgress);
|
||||||
predicates.add(hasValuePredicate);
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notifiedAtHasValue != null) {
|
public NotificationQuery trackingProgress(List<NotificationTrackingProcess> trackingProgress) {
|
||||||
Predicate hasValuePredicate = notifiedAtHasValue ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(NotificationEntity.Field._notifiedAt)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(NotificationEntity.Field._notifiedAt));
|
this.trackingProgress = trackingProgress;
|
||||||
predicates.add(hasValuePredicate);
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type != null) {
|
public NotificationQuery userIds(UUID value) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._type).in(this.type));
|
this.userIds = List.of(value);
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.contactType != null) {
|
public NotificationQuery userIds(UUID... value) {
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._contactTypeHint).in(this.contactType));
|
this.userIds = Arrays.asList(value);
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.retryThreshold != null) {
|
public NotificationQuery userIds(Collection<UUID> values) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.le(queryContext.Root.get(NotificationEntity.Field._retryCount), this.retryThreshold));
|
this.userIds = values;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.createdAfter != null) {
|
public NotificationQuery ordering(Ordering ordering) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.greaterThan(queryContext.Root.get(NotificationEntity.Field._createdAt), this.createdAfter));
|
this.setOrder(ordering);
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.trackingState != null) {
|
@Override
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._trackingState).in(trackingState));
|
protected Boolean isFalseQuery() {
|
||||||
}
|
return this.isNullOrEmpty(this.ids)
|
||||||
|
&& this.isNullOrEmpty(this.isActives)
|
||||||
|
&& this.isNullOrEmpty(this.notifyState);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.trackingProgress != null) {
|
@Override
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._trackingProcess).in(trackingProgress));
|
protected Class<NotificationEntity> entityClass() {
|
||||||
}
|
return NotificationEntity.class;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.userIds != null) {
|
@Override
|
||||||
predicates.add(queryContext.Root.get(NotificationEntity.Field._userId).in(userIds));
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
}
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
if (this.ids != null) {
|
||||||
|
predicates.add(queryContext.Root.get(NotificationEntity._id).in(ids));
|
||||||
|
}
|
||||||
|
|
||||||
if (predicates.size() > 0) {
|
if (this.isActives != null) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
predicates.add(queryContext.Root.get(NotificationEntity._isActive).in(isActives));
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
}
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
if (this.tenantIds != null) {
|
||||||
|
predicates.add(queryContext.Root.get(NotificationEntity._tenantId).in(tenantIds));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (this.notifyState != null) {
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
predicates.add(queryContext.Root.get(NotificationEntity._notifyState).in(notifyState));
|
||||||
if (item.match(Notification._id)) return NotificationEntity.Field._id;
|
}
|
||||||
else if (item.match(Notification._contactHint)) return NotificationEntity.Field._contactHint;
|
|
||||||
else if (item.match(Notification._createdAt)) return NotificationEntity.Field._createdAt;
|
|
||||||
else if (item.match(Notification._isActive)) return NotificationEntity.Field._isActive;
|
|
||||||
else if (item.match(Notification._contactTypeHint)) return NotificationEntity.Field._contactTypeHint;
|
|
||||||
else if (item.match(Notification._updatedAt)) return NotificationEntity.Field._updatedAt;
|
|
||||||
else if (item.match(Notification._notifiedAt)) return NotificationEntity.Field._notifiedAt;
|
|
||||||
else if (item.prefix(Notification._tenant)) return NotificationEntity.Field._tenantId;
|
|
||||||
else if (item.prefix(Notification._user)) return NotificationEntity.Field._userId;
|
|
||||||
else if (item.match(Notification._type)) return NotificationEntity.Field._type;
|
|
||||||
else if (item.match(Notification._notifyState)) return NotificationEntity.Field._notifyState;
|
|
||||||
else if (item.match(Notification._notifiedWith)) return NotificationEntity.Field._notifiedWith;
|
|
||||||
else if (item.match(Notification._trackingState)) return NotificationEntity.Field._trackingState;
|
|
||||||
else if (item.match(Notification._trackingProcess)) return NotificationEntity.Field._trackingProcess;
|
|
||||||
else if (item.match(Notification._retryCount)) return NotificationEntity.Field._retryCount;
|
|
||||||
|
|
||||||
else return null;
|
if (this.notifiedWith != null) {
|
||||||
}
|
predicates.add(queryContext.Root.get(NotificationEntity._notifiedWith).in(notifiedWith));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (notifiedWithHasValue != null) {
|
||||||
protected NotificationEntity convert(Tuple tuple, Set<String> columns) {
|
Predicate hasValuePredicate = notifiedWithHasValue ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(NotificationEntity._notifiedWith)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(NotificationEntity._notifiedWith));
|
||||||
NotificationEntity item = new NotificationEntity();
|
predicates.add(hasValuePredicate);
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._id, UUID.class));
|
}
|
||||||
item.setContactHint(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._contactHint, String.class));
|
|
||||||
item.setContactTypeHint(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._contactTypeHint, NotificationContactType.class));
|
|
||||||
item.setNotifiedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._notifiedAt, Instant.class));
|
|
||||||
item.setType(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._type, UUID.class));
|
|
||||||
item.setUserId(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._userId, UUID.class));
|
|
||||||
item.setTenantId(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._tenantId, UUID.class));
|
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._createdAt, Instant.class));
|
|
||||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._updatedAt, Instant.class));
|
|
||||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._isActive, IsActive.class));
|
|
||||||
item.setNotifyState(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._notifyState, NotificationNotifyState.class));
|
|
||||||
item.setNotifiedWith(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._notifiedWith, NotificationContactType.class));
|
|
||||||
item.setTrackingState(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._trackingState, NotificationTrackingState.class));
|
|
||||||
item.setTrackingProcess(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._trackingProcess, NotificationTrackingProcess.class));
|
|
||||||
item.setRetryCount(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._retryCount, Integer.class));
|
|
||||||
|
|
||||||
return item;
|
if (notifiedAtHasValue != null) {
|
||||||
}
|
Predicate hasValuePredicate = notifiedAtHasValue ? queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(NotificationEntity._notifiedAt)) : queryContext.CriteriaBuilder.isNull(queryContext.Root.get(NotificationEntity._notifiedAt));
|
||||||
|
predicates.add(hasValuePredicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.type != null) {
|
||||||
|
predicates.add(queryContext.Root.get(NotificationEntity._type).in(this.type));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.contactType != null) {
|
||||||
|
predicates.add(queryContext.Root.get(NotificationEntity._contactTypeHint).in(this.contactType));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.retryThreshold != null) {
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.le(queryContext.Root.get(NotificationEntity._retryCount), this.retryThreshold));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.createdAfter != null) {
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.greaterThan(queryContext.Root.get(NotificationEntity._createdAt), this.createdAfter));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.trackingState != null) {
|
||||||
|
predicates.add(queryContext.Root.get(NotificationEntity._trackingState).in(trackingState));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.trackingProgress != null) {
|
||||||
|
predicates.add(queryContext.Root.get(NotificationEntity._trackingProcess).in(trackingProgress));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.userIds != null) {
|
||||||
|
predicates.add(queryContext.Root.get(NotificationEntity._userId).in(userIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!predicates.isEmpty()) {
|
||||||
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
|
if (item.match(Notification._id))
|
||||||
|
return NotificationEntity._id;
|
||||||
|
else if (item.match(Notification._contactHint))
|
||||||
|
return NotificationEntity._contactHint;
|
||||||
|
else if (item.match(Notification._createdAt))
|
||||||
|
return NotificationEntity._createdAt;
|
||||||
|
else if (item.match(Notification._isActive))
|
||||||
|
return NotificationEntity._isActive;
|
||||||
|
else if (item.match(Notification._contactTypeHint))
|
||||||
|
return NotificationEntity._contactTypeHint;
|
||||||
|
else if (item.match(Notification._updatedAt))
|
||||||
|
return NotificationEntity._updatedAt;
|
||||||
|
else if (item.match(Notification._notifiedAt))
|
||||||
|
return NotificationEntity._notifiedAt;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected NotificationEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
|
NotificationEntity item = new NotificationEntity();
|
||||||
|
item.setId(QueryBase.convertSafe(tuple, columns, NotificationEntity._id, UUID.class));
|
||||||
|
item.setContactHint(QueryBase.convertSafe(tuple, columns, NotificationEntity._contactHint, String.class));
|
||||||
|
item.setContactTypeHint(QueryBase.convertSafe(tuple, columns, NotificationEntity._contactTypeHint, NotificationContactType.class));
|
||||||
|
item.setNotifiedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity._notifiedAt, Instant.class));
|
||||||
|
item.setType(QueryBase.convertSafe(tuple, columns, NotificationEntity._type, UUID.class));
|
||||||
|
item.setUserId(QueryBase.convertSafe(tuple, columns, NotificationEntity._userId, UUID.class));
|
||||||
|
item.setTenantId(QueryBase.convertSafe(tuple, columns, NotificationEntity._tenantId, UUID.class));
|
||||||
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity._createdAt, Instant.class));
|
||||||
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity._updatedAt, Instant.class));
|
||||||
|
item.setIsActive(QueryBase.convertSafe(tuple, columns, NotificationEntity._isActive, IsActive.class));
|
||||||
|
item.setNotifyState(QueryBase.convertSafe(tuple, columns, NotificationEntity._notifyState, NotificationNotifyState.class));
|
||||||
|
item.setNotifiedWith(QueryBase.convertSafe(tuple, columns, NotificationEntity._notifiedWith, NotificationContactType.class));
|
||||||
|
item.setTrackingState(QueryBase.convertSafe(tuple, columns, NotificationEntity._trackingState, NotificationTrackingState.class));
|
||||||
|
item.setTrackingProcess(QueryBase.convertSafe(tuple, columns, NotificationEntity._trackingProcess, NotificationTrackingProcess.class));
|
||||||
|
item.setRetryCount(QueryBase.convertSafe(tuple, columns, NotificationEntity._retryCount, Integer.class));
|
||||||
|
|
||||||
|
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,121 +7,125 @@ 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<IsActive> isActives;
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
|
||||||
|
|
||||||
public TenantQuery like(String value) {
|
private Collection<UUID> ids;
|
||||||
this.like = value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TenantQuery ids(UUID value) {
|
private Collection<IsActive> isActives;
|
||||||
this.ids = List.of(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TenantQuery ids(UUID... value) {
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
this.ids = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TenantQuery ids(Collection<UUID> values) {
|
public TenantQuery like(String value) {
|
||||||
this.ids = values;
|
this.like = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TenantQuery isActive(IsActive value) {
|
public TenantQuery ids(UUID value) {
|
||||||
this.isActives = List.of(value);
|
this.ids = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TenantQuery isActive(IsActive... value) {
|
public TenantQuery ids(UUID... value) {
|
||||||
this.isActives = Arrays.asList(value);
|
this.ids = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TenantQuery isActive(Collection<IsActive> values) {
|
public TenantQuery ids(Collection<UUID> values) {
|
||||||
this.isActives = values;
|
this.ids = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TenantQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public TenantQuery isActive(IsActive value) {
|
||||||
this.authorize = values;
|
this.isActives = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public TenantQuery isActive(IsActive... value) {
|
||||||
protected Boolean isFalseQuery() {
|
this.isActives = Arrays.asList(value);
|
||||||
return this.isEmpty(this.ids) || this.isEmpty(this.isActives);
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public TenantQuery isActive(Collection<IsActive> values) {
|
||||||
protected Class<TenantEntity> entityClass() {
|
this.isActives = values;
|
||||||
return TenantEntity.class;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public TenantQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
this.authorize = values;
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
return this;
|
||||||
if (this.ids != null) {
|
}
|
||||||
predicates.add(queryContext.Root.get(TenantEntity._id).in(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
@Override
|
||||||
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(TenantEntity._isActive), this.like));
|
protected Boolean isFalseQuery() {
|
||||||
}
|
return this.isEmpty(this.ids) || this.isEmpty(this.isActives);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isActives != null) {
|
@Override
|
||||||
predicates.add(queryContext.Root.get(TenantEntity._isActive).in(isActives));
|
protected Class<TenantEntity> entityClass() {
|
||||||
}
|
return TenantEntity.class;
|
||||||
if (predicates.size() > 0) {
|
}
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
if (this.ids != null) {
|
||||||
|
predicates.add(queryContext.Root.get(TenantEntity._id).in(ids));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(TenantEntity._isActive), this.like));
|
||||||
if (item.match(Tenant._id)) return TenantEntity._id;
|
}
|
||||||
else if (item.match(Tenant._code)) return TenantEntity._code;
|
|
||||||
else if (item.match(Tenant._name)) return TenantEntity._name;
|
if (this.isActives != null) {
|
||||||
else if (item.match(Tenant._description)) return TenantEntity._description;
|
predicates.add(queryContext.Root.get(TenantEntity._isActive).in(isActives));
|
||||||
else if (item.prefix(Tenant._config)) return TenantEntity._config;
|
}
|
||||||
else if (item.match(Tenant._createdAt)) return TenantEntity._createdAt;
|
if (!predicates.isEmpty()) {
|
||||||
else if (item.match(Tenant._updatedAt)) return TenantEntity._updatedAt;
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
else if (item.match(Tenant._isActive)) return TenantEntity._isActive;
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
else return null;
|
} else {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
|
if (item.match(Tenant._id))
|
||||||
|
return TenantEntity._id;
|
||||||
|
else if (item.match(Tenant._code))
|
||||||
|
return TenantEntity._code;
|
||||||
|
else if (item.match(Tenant._createdAt))
|
||||||
|
return TenantEntity._createdAt;
|
||||||
|
else if (item.match(Tenant._updatedAt))
|
||||||
|
return TenantEntity._updatedAt;
|
||||||
|
else if (item.match(Tenant._isActive))
|
||||||
|
return TenantEntity._isActive;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TenantEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
|
TenantEntity item = new TenantEntity();
|
||||||
|
item.setId(QueryBase.convertSafe(tuple, columns, TenantEntity._id, UUID.class));
|
||||||
|
item.setCode(QueryBase.convertSafe(tuple, columns, TenantEntity._code, String.class));
|
||||||
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, TenantEntity._createdAt, Instant.class));
|
||||||
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, TenantEntity._updatedAt, Instant.class));
|
||||||
|
item.setIsActive(QueryBase.convertSafe(tuple, columns, TenantEntity._isActive, IsActive.class));
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TenantEntity convert(Tuple tuple, Set<String> columns) {
|
|
||||||
TenantEntity item = new TenantEntity();
|
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, TenantEntity._id, UUID.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.setUpdatedAt(QueryBase.convertSafe(tuple, columns, TenantEntity._updatedAt, Instant.class));
|
|
||||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, TenantEntity._isActive, IsActive.class));
|
|
||||||
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.*;
|
||||||
|
|
||||||
|
@ -27,238 +26,263 @@ import java.util.*;
|
||||||
@RequestScope
|
@RequestScope
|
||||||
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> excludedUserIds;
|
|
||||||
private Collection<UUID> tenantIds;
|
|
||||||
private Collection<IsActive> isActives;
|
|
||||||
private Collection<ContactInfoType> type;
|
|
||||||
private Collection<String> values;
|
|
||||||
private UserQuery userQuery;
|
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private Collection<UUID> userIds;
|
||||||
|
|
||||||
private final UserScope userScope;
|
private Collection<UUID> excludedUserIds;
|
||||||
private final AuthorizationService authService;
|
|
||||||
|
|
||||||
public UserContactInfoQuery(
|
private Collection<UUID> tenantIds;
|
||||||
UserScope userScope,
|
|
||||||
AuthorizationService authService
|
|
||||||
) {
|
|
||||||
this.userScope = userScope;
|
|
||||||
this.authService = authService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserContactInfoQuery ids(UUID value) {
|
private Collection<IsActive> isActives;
|
||||||
this.ids = List.of(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserContactInfoQuery ids(UUID... value) {
|
private Collection<ContactInfoType> type;
|
||||||
this.ids = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserContactInfoQuery ids(Collection<UUID> values) {
|
private Collection<String> values;
|
||||||
this.ids = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserContactInfoQuery userIds(UUID value) {
|
private UserQuery userQuery;
|
||||||
this.userIds = List.of(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserContactInfoQuery userIds(UUID... value) {
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
this.userIds = Arrays.asList(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserContactInfoQuery userIds(Collection<UUID> values) {
|
private final UserScope userScope;
|
||||||
this.userIds = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserContactInfoQuery excludedUserIds(Collection<UUID> values) {
|
private final AuthorizationService authService;
|
||||||
this.excludedUserIds = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserContactInfoQuery excludedUserIds(UUID value) {
|
public UserContactInfoQuery(
|
||||||
this.excludedUserIds = List.of(value);
|
UserScope userScope,
|
||||||
return this;
|
AuthorizationService authService
|
||||||
}
|
) {
|
||||||
|
this.userScope = userScope;
|
||||||
|
this.authService = authService;
|
||||||
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery excludedUserIds(UUID... value) {
|
public UserContactInfoQuery ids(UUID value) {
|
||||||
this.excludedUserIds = Arrays.asList(value);
|
this.ids = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery tenantIds(UUID value) {
|
public UserContactInfoQuery ids(UUID... value) {
|
||||||
this.tenantIds = List.of(value);
|
this.ids = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery tenantIds(UUID... value) {
|
public UserContactInfoQuery ids(Collection<UUID> values) {
|
||||||
this.tenantIds = Arrays.asList(value);
|
this.ids = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery tenantIds(Collection<UUID> values) {
|
public UserContactInfoQuery userIds(UUID value) {
|
||||||
this.tenantIds = values;
|
this.userIds = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery isActive(IsActive value) {
|
public UserContactInfoQuery userIds(UUID... value) {
|
||||||
this.isActives = List.of(value);
|
this.userIds = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery isActive(IsActive... value) {
|
public UserContactInfoQuery userIds(Collection<UUID> values) {
|
||||||
this.isActives = Arrays.asList(value);
|
this.userIds = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery isActive(Collection<IsActive> values) {
|
public UserContactInfoQuery excludedUserIds(Collection<UUID> values) {
|
||||||
this.isActives = values;
|
this.excludedUserIds = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery type(ContactInfoType value) {
|
public UserContactInfoQuery excludedUserIds(UUID value) {
|
||||||
this.type = List.of(value);
|
this.excludedUserIds = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery type(ContactInfoType... value) {
|
public UserContactInfoQuery excludedUserIds(UUID... value) {
|
||||||
this.type = Arrays.asList(value);
|
this.excludedUserIds = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery type(Collection<ContactInfoType> values) {
|
public UserContactInfoQuery tenantIds(UUID value) {
|
||||||
this.type = values;
|
this.tenantIds = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery values(String value) {
|
public UserContactInfoQuery tenantIds(UUID... value) {
|
||||||
this.values = List.of(value);
|
this.tenantIds = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery values(String... value) {
|
public UserContactInfoQuery tenantIds(Collection<UUID> values) {
|
||||||
this.values = Arrays.asList(value);
|
this.tenantIds = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery values(Collection<String> values) {
|
public UserContactInfoQuery isActive(IsActive value) {
|
||||||
this.values = values;
|
this.isActives = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery userSubQuery(UserQuery subQuery) {
|
public UserContactInfoQuery isActive(IsActive... value) {
|
||||||
this.userQuery = subQuery;
|
this.isActives = Arrays.asList(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public UserContactInfoQuery isActive(Collection<IsActive> values) {
|
||||||
this.authorize = values;
|
this.isActives = values;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public UserContactInfoQuery type(ContactInfoType value) {
|
||||||
protected Boolean isFalseQuery() {
|
this.type = List.of(value);
|
||||||
return this.isEmpty(this.userIds) || this.isEmpty(this.excludedUserIds) || this.isEmpty(this.tenantIds) || this.isEmpty(this.isActives)
|
return this;
|
||||||
|| this.isEmpty(this.type) || this.isEmpty(this.excludedUserIds) || this.isFalseQuery(this.userQuery);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public UserContactInfoQuery type(ContactInfoType... value) {
|
||||||
protected Class<UserContactInfoEntity> entityClass() {
|
this.type = Arrays.asList(value);
|
||||||
return UserContactInfoEntity.class;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public UserContactInfoQuery type(Collection<ContactInfoType> values) {
|
||||||
protected <X, Y> Predicate applyAuthZ(QueryContext<X, Y> queryContext) {
|
this.type = values;
|
||||||
if (this.authorize.contains(AuthorizationFlags.None)) return null;
|
return this;
|
||||||
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUserContactInfo)) return null;
|
}
|
||||||
UUID ownerId = null;
|
|
||||||
if (this.authorize.contains(AuthorizationFlags.Owner)) ownerId = this.userScope.getUserIdSafe();
|
|
||||||
|
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
public UserContactInfoQuery values(String value) {
|
||||||
if (ownerId != null) {
|
this.values = List.of(value);
|
||||||
predicates.add(queryContext.CriteriaBuilder.equal(queryContext.Root.get(UserContactInfoEntity._userId), ownerId));
|
return this;
|
||||||
}
|
}
|
||||||
if (predicates.size() > 0) {
|
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
|
||||||
} else {
|
|
||||||
return queryContext.CriteriaBuilder.or(); //Creates a false query
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public UserContactInfoQuery values(String... value) {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
this.values = Arrays.asList(value);
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
return this;
|
||||||
if (this.userIds != null) {
|
}
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId));
|
|
||||||
for (UUID item : this.userIds) inClause.value(item);
|
|
||||||
predicates.add(inClause);
|
|
||||||
}
|
|
||||||
if (this.excludedUserIds != null) {
|
|
||||||
CriteriaBuilder.In<UUID> notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId));
|
|
||||||
for (UUID item : this.excludedUserIds)
|
|
||||||
notInClause.value(item);
|
|
||||||
predicates.add(notInClause.not());
|
|
||||||
}
|
|
||||||
if (this.tenantIds != null) {
|
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._tenantId));
|
|
||||||
for (UUID item : this.tenantIds) inClause.value(item);
|
|
||||||
predicates.add(inClause);
|
|
||||||
}
|
|
||||||
if (this.type != null) {
|
|
||||||
CriteriaBuilder.In<ContactInfoType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._type));
|
|
||||||
for (ContactInfoType item : this.type) inClause.value(item);
|
|
||||||
predicates.add(inClause);
|
|
||||||
}
|
|
||||||
if (this.values != null) {
|
|
||||||
CriteriaBuilder.In<String> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._value));
|
|
||||||
for (String item : this.values)
|
|
||||||
inClause.value(item);
|
|
||||||
predicates.add(inClause);
|
|
||||||
}
|
|
||||||
if (this.userQuery != null) {
|
|
||||||
QueryContext<UserEntity, UUID> subQuery = this.applySubQuery(this.userQuery, queryContext, UUID.class, root -> root.get(UserContactInfoEntity._userId));
|
|
||||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId)).value(subQuery.Query));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!predicates.isEmpty()) {
|
public UserContactInfoQuery values(Collection<String> values) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
this.values = values;
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
return this;
|
||||||
} else {
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public UserContactInfoQuery userSubQuery(UserQuery subQuery) {
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
this.userQuery = subQuery;
|
||||||
if (item.match(UserContactInfo._id)) return UserContactInfoEntity._id;
|
return this;
|
||||||
else if (item.prefix(UserContactInfo._tenant)) return UserContactInfoEntity._tenantId;
|
}
|
||||||
else if (item.match(UserContactInfo._type)) return UserContactInfoEntity._type;
|
|
||||||
else if (item.match(UserContactInfo._value)) return UserContactInfoEntity._value;
|
|
||||||
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
|
public UserContactInfoQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
protected UserContactInfoEntity convert(Tuple tuple, Set<String> columns) {
|
this.authorize = values;
|
||||||
UserContactInfoEntity item = new UserContactInfoEntity();
|
return this;
|
||||||
item.setId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._id, UUID.class));
|
}
|
||||||
item.setType(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._type, ContactInfoType.class));
|
|
||||||
item.setValue(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._value, String.class));
|
@Override
|
||||||
item.setUserId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._userId, UUID.class));
|
protected Boolean isFalseQuery() {
|
||||||
item.setTenantId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._tenantId, UUID.class));
|
return this.isEmpty(this.userIds) || this.isEmpty(this.excludedUserIds) || this.isEmpty(this.tenantIds) || this.isEmpty(this.isActives)
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._createdAt, Instant.class));
|
|| this.isEmpty(this.type) || this.isEmpty(this.excludedUserIds) || this.isFalseQuery(this.userQuery);
|
||||||
return item;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
protected Class<UserContactInfoEntity> entityClass() {
|
||||||
|
return UserContactInfoEntity.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected <X, Y> Predicate applyAuthZ(QueryContext<X, Y> queryContext) {
|
||||||
|
if (this.authorize.contains(AuthorizationFlags.None))
|
||||||
|
return null;
|
||||||
|
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUserContactInfo))
|
||||||
|
return null;
|
||||||
|
UUID ownerId = null;
|
||||||
|
if (this.authorize.contains(AuthorizationFlags.Owner))
|
||||||
|
ownerId = this.userScope.getUserIdSafe();
|
||||||
|
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
if (ownerId != null) {
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.equal(queryContext.Root.get(UserContactInfoEntity._userId), ownerId));
|
||||||
|
}
|
||||||
|
if (!predicates.isEmpty()) {
|
||||||
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
|
} else {
|
||||||
|
return queryContext.CriteriaBuilder.or(); //Creates a false query
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
if (this.userIds != null) {
|
||||||
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId));
|
||||||
|
for (UUID item : this.userIds)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.excludedUserIds != null) {
|
||||||
|
CriteriaBuilder.In<UUID> notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId));
|
||||||
|
for (UUID item : this.excludedUserIds)
|
||||||
|
notInClause.value(item);
|
||||||
|
predicates.add(notInClause.not());
|
||||||
|
}
|
||||||
|
if (this.tenantIds != null) {
|
||||||
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._tenantId));
|
||||||
|
for (UUID item : this.tenantIds)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.type != null) {
|
||||||
|
CriteriaBuilder.In<ContactInfoType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._type));
|
||||||
|
for (ContactInfoType item : this.type)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.values != null) {
|
||||||
|
CriteriaBuilder.In<String> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._value));
|
||||||
|
for (String item : this.values)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.userQuery != null) {
|
||||||
|
QueryContext<UserEntity, UUID> subQuery = this.applySubQuery(this.userQuery, queryContext, UUID.class, root -> root.get(UserContactInfoEntity._userId));
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId)).value(subQuery.Query));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!predicates.isEmpty()) {
|
||||||
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
|
if (item.match(UserContactInfo._id))
|
||||||
|
return UserContactInfoEntity._id;
|
||||||
|
else if (item.prefix(UserContactInfo._tenant))
|
||||||
|
return UserContactInfoEntity._tenantId;
|
||||||
|
else if (item.match(UserContactInfo._type))
|
||||||
|
return UserContactInfoEntity._type;
|
||||||
|
else if (item.match(UserContactInfo._value))
|
||||||
|
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
|
||||||
|
protected UserContactInfoEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
|
UserContactInfoEntity item = new UserContactInfoEntity();
|
||||||
|
item.setId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._id, UUID.class));
|
||||||
|
item.setType(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._type, ContactInfoType.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.setTenantId(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._tenantId, UUID.class));
|
||||||
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserContactInfoEntity._createdAt, Instant.class));
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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