diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/DataType.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/DataType.java new file mode 100644 index 000000000..82706d344 --- /dev/null +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/DataType.java @@ -0,0 +1,31 @@ +package gr.cite.notification.common.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import gr.cite.notification.data.conventers.DatabaseEnum; + +import java.util.Map; + +public enum DataType implements DatabaseEnum { + Integer((short)0), + Decimal((short)1), + Double((short)2), + DateTime((short)3), + //TimeSpan(4), + String((short)5); + private final Short value; + + DataType(Short value) { + this.value = value; + } + + @JsonValue + public Short getValue() { + return value; + } + + private static final Map map = EnumUtils.getEnumValueMap(DataType.class); + + public static DataType of(Short i) { + return map.get(i); + } +} diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/EmailOverrideMode.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/EmailOverrideMode.java new file mode 100644 index 000000000..5af7c2f1e --- /dev/null +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/EmailOverrideMode.java @@ -0,0 +1,29 @@ +package gr.cite.notification.common.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import gr.cite.notification.data.conventers.DatabaseEnum; + +import java.util.Map; + +public enum EmailOverrideMode implements DatabaseEnum { + NotOverride((short)0), + Additive((short)1), + Replace((short)2); + + private final Short value; + + EmailOverrideMode(Short value) { + this.value = value; + } + + @JsonValue + public Short getValue() { + return value; + } + + private static final Map map = EnumUtils.getEnumValueMap(EmailOverrideMode.class); + + public static EmailOverrideMode of(Short i) { + return map.get(i); + } +} diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/NotificationTemplateKind.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/NotificationTemplateKind.java index 8dbabd5fc..a735ececf 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/NotificationTemplateKind.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/enums/NotificationTemplateKind.java @@ -8,7 +8,9 @@ import java.util.Map; public enum NotificationTemplateKind implements DatabaseEnum { Draft((short)0), - Primary((short)1); + Secondary((short)1), + Primary((short)2), + Default((short)3); private final Short value; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/DataType.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/DataType.java deleted file mode 100644 index d6dc095f5..000000000 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/DataType.java +++ /dev/null @@ -1,42 +0,0 @@ -package gr.cite.notification.common.types.notification; - -import com.fasterxml.jackson.annotation.JsonValue; - -import java.util.HashMap; -import java.util.Map; - -public enum DataType { - Integer(0), - Decimal(1), - Double(2), - DateTime(3), - //TimeSpan(4), - String(5); - private static final Map values = new HashMap<>(); - - private final Integer mappedName; - - //For jackson parsing (used by MVC) - @JsonValue - public Integer getMappedName() { - return mappedName; - } - - static { - for (DataType e : values()) { - values.put(e.asInt(), e); - } - } - - private DataType(int mappedName) { - this.mappedName = mappedName; - } - - public Integer asInt() { - return this.mappedName; - } - - public static DataType fromString(Integer value) { - return values.getOrDefault(value, Integer); - } -} diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/EmailOverrideMode.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/EmailOverrideMode.java deleted file mode 100644 index 1423c2a29..000000000 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/EmailOverrideMode.java +++ /dev/null @@ -1,39 +0,0 @@ -package gr.cite.notification.common.types.notification; - -import com.fasterxml.jackson.annotation.JsonValue; - -import java.util.HashMap; -import java.util.Map; - -public enum EmailOverrideMode { - NotOverride(0), - Additive(1), - Replace(2); - private static final Map values = new HashMap<>(); - - private final Integer mappedName; - - //For jackson parsing (used by MVC) - @JsonValue - public Integer getMappedName() { - return mappedName; - } - - static { - for (EmailOverrideMode e : values()) { - values.put(e.asInt(), e); - } - } - - private EmailOverrideMode(int mappedName) { - this.mappedName = mappedName; - } - - public Integer asInt() { - return this.mappedName; - } - - public static EmailOverrideMode fromString(Integer value) { - return values.getOrDefault(value, NotOverride); - } -} diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/FieldInfo.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/FieldInfo.java index 44ad9a3c5..69aa67529 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/FieldInfo.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notification/FieldInfo.java @@ -1,5 +1,7 @@ package gr.cite.notification.common.types.notification; +import gr.cite.notification.common.enums.DataType; + public class FieldInfo { private String key; public final static String _key = "key"; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/FieldInfoEntity.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/FieldInfoEntity.java index 2183ede58..93e93bd9d 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/FieldInfoEntity.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/FieldInfoEntity.java @@ -1,6 +1,6 @@ package gr.cite.notification.common.types.notificationtemplate; -import gr.cite.notification.common.types.notification.DataType; +import gr.cite.notification.common.enums.DataType; public class FieldInfoEntity { private String key; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/NotificationTemplateValueEntity.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/NotificationTemplateValueEntity.java index 6157594c2..698bfbcd8 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/NotificationTemplateValueEntity.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/common/types/notificationtemplate/NotificationTemplateValueEntity.java @@ -1,6 +1,6 @@ package gr.cite.notification.common.types.notificationtemplate; -import gr.cite.notification.common.types.notification.EmailOverrideMode; +import gr.cite.notification.common.enums.EmailOverrideMode; import java.util.List; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/config/notification/NotificationProperties.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/config/notification/NotificationProperties.java index 88f47cca8..f8a4e75af 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/config/notification/NotificationProperties.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/config/notification/NotificationProperties.java @@ -1,7 +1,7 @@ package gr.cite.notification.config.notification; import gr.cite.notification.common.enums.NotificationContactType; -import gr.cite.notification.common.types.notification.EmailOverrideMode; +import gr.cite.notification.common.enums.EmailOverrideMode; import gr.cite.notification.common.types.notification.FieldInfo; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConstructorBinding; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/notificationtemplate/NotificationTemplateValue.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/notificationtemplate/NotificationTemplateValue.java index 05725f260..0c096fb12 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/notificationtemplate/NotificationTemplateValue.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/notificationtemplate/NotificationTemplateValue.java @@ -1,6 +1,6 @@ package gr.cite.notification.model.notificationtemplate; -import gr.cite.notification.common.types.notification.EmailOverrideMode; +import gr.cite.notification.common.enums.EmailOverrideMode; import java.util.List; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/FieldInfoPersist.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/FieldInfoPersist.java index d37341758..c61b8ae0b 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/FieldInfoPersist.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/FieldInfoPersist.java @@ -1,6 +1,6 @@ package gr.cite.notification.model.persist.notificationtemplate; -import gr.cite.notification.common.types.notification.DataType; +import gr.cite.notification.common.enums.DataType; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/NotificationTemplateValuePersist.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/NotificationTemplateValuePersist.java index bba46e8ce..b52afa46c 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/NotificationTemplateValuePersist.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/persist/notificationtemplate/NotificationTemplateValuePersist.java @@ -1,6 +1,6 @@ package gr.cite.notification.model.persist.notificationtemplate; -import gr.cite.notification.common.types.notification.EmailOverrideMode; +import gr.cite.notification.common.enums.EmailOverrideMode; import gr.cite.notification.common.validation.ValidEnum; import javax.validation.Valid; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/contact/extractor/EmailContactExtractor.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/contact/extractor/EmailContactExtractor.java index f678b8fcf..be7525f1d 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/contact/extractor/EmailContactExtractor.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/contact/extractor/EmailContactExtractor.java @@ -6,7 +6,7 @@ import gr.cite.notification.common.enums.ContactInfoType; import gr.cite.notification.common.enums.IsActive; import gr.cite.notification.common.enums.NotificationContactType; import gr.cite.notification.common.types.notification.ContactPair; -import gr.cite.notification.common.types.notification.EmailOverrideMode; +import gr.cite.notification.common.enums.EmailOverrideMode; import gr.cite.notification.common.types.notification.NotificationContactData; import gr.cite.notification.config.notification.NotificationConfig; import gr.cite.notification.config.notification.NotificationProperties; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/message/infobuilder/MessageBuilderServiceImpl.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/message/infobuilder/MessageBuilderServiceImpl.java index ffa421517..b9eb1967b 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/message/infobuilder/MessageBuilderServiceImpl.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/message/infobuilder/MessageBuilderServiceImpl.java @@ -4,7 +4,7 @@ import gr.cite.notification.common.JsonHandlingService; import gr.cite.notification.common.StringUtils; import gr.cite.notification.common.enums.IsActive; import gr.cite.notification.common.scope.tenant.TenantScope; -import gr.cite.notification.common.types.notification.DataType; +import gr.cite.notification.common.enums.DataType; import gr.cite.notification.common.types.notification.FieldInfo; import gr.cite.notification.common.types.notification.NotificationFieldData; import gr.cite.notification.common.types.tenantconfiguration.DefaultUserLocaleConfigurationDataContainer;