diff --git a/annotation-service/annotation/src/main/java/gr/cite/annotation/data/UserCredentialEntity.java b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/UserCredentialEntity.java index 35ef7c853..650794344 100644 --- a/annotation-service/annotation/src/main/java/gr/cite/annotation/data/UserCredentialEntity.java +++ b/annotation-service/annotation/src/main/java/gr/cite/annotation/data/UserCredentialEntity.java @@ -40,12 +40,6 @@ public class UserCredentialEntity { public static final String _updatedAt = "updatedAt"; - @Column(name = "\"is_active\"", nullable = false) - @Convert(converter = IsActiveConverter.class) - private IsActive isActive; - - public static final String _isActive = "isActive"; - public UUID getId() { return id; } @@ -86,12 +80,4 @@ public class UserCredentialEntity { this.updatedAt = updatedAt; } - public IsActive getIsActive() { - return isActive; - } - - public void setIsActive(IsActive isActive) { - this.isActive = isActive; - } - } diff --git a/annotation-service/annotation/src/main/java/gr/cite/annotation/model/UserCredential.java b/annotation-service/annotation/src/main/java/gr/cite/annotation/model/UserCredential.java index f894fc5f3..8375d9668 100644 --- a/annotation-service/annotation/src/main/java/gr/cite/annotation/model/UserCredential.java +++ b/annotation-service/annotation/src/main/java/gr/cite/annotation/model/UserCredential.java @@ -27,10 +27,6 @@ public class UserCredential { public static final String _updatedAt = "updatedAt"; - private IsActive isActive; - - public static final String _isActive = "isActive"; - public UUID getId() { return id; } @@ -70,12 +66,4 @@ public class UserCredential { public void setUpdatedAt(Instant updatedAt) { this.updatedAt = updatedAt; } - - public IsActive getIsActive() { - return isActive; - } - - public void setIsActive(IsActive isActive) { - this.isActive = isActive; - } } diff --git a/annotation-service/annotation/src/main/java/gr/cite/annotation/model/deleter/UserCredentialDeleter.java b/annotation-service/annotation/src/main/java/gr/cite/annotation/model/deleter/UserCredentialDeleter.java index a1357f37d..77df59d82 100644 --- a/annotation-service/annotation/src/main/java/gr/cite/annotation/model/deleter/UserCredentialDeleter.java +++ b/annotation-service/annotation/src/main/java/gr/cite/annotation/model/deleter/UserCredentialDeleter.java @@ -62,12 +62,10 @@ public class UserCredentialDeleter implements Deleter { Instant now = Instant.now(); for (UserCredentialEntity item : data) { - logger.trace("deleting item {}", item); - item.setIsActive(IsActive.Inactive); - item.setUpdatedAt(now); - logger.trace("updating item"); - this.entityManager.merge(item); - logger.trace("updated item"); + logger.trace("deleting item {}", item.getId()); + logger.trace("deleting item"); + this.entityManager.remove(item); + logger.trace("deleted item"); } } diff --git a/annotation-service/annotation/src/main/java/gr/cite/annotation/query/UserCredentialQuery.java b/annotation-service/annotation/src/main/java/gr/cite/annotation/query/UserCredentialQuery.java index 08bf1ea88..c4e55a1ee 100644 --- a/annotation-service/annotation/src/main/java/gr/cite/annotation/query/UserCredentialQuery.java +++ b/annotation-service/annotation/src/main/java/gr/cite/annotation/query/UserCredentialQuery.java @@ -182,9 +182,6 @@ public class UserCredentialQuery extends QueryBase { inClause.value(item); predicates.add(inClause); } - if (this.isActives != null) { - predicates.add(queryContext.Root.get(UserCredentialEntity._isActive).in(isActives)); - } if (this.userIds != null) { CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId)); for (UUID item : this.userIds) @@ -225,8 +222,6 @@ public class UserCredentialQuery extends QueryBase { return UserCredentialEntity._createdAt; else if (item.match(UserCredential._updatedAt)) return UserCredentialEntity._updatedAt; - else if (item.match(UserCredential._isActive)) - return UserCredentialEntity._isActive; else return null; } @@ -239,7 +234,6 @@ public class UserCredentialQuery extends QueryBase { item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class)); item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class)); item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class)); - item.setIsActive(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, IsActive.class)); return item; } diff --git a/annotation-service/annotation/src/main/java/gr/cite/annotation/service/user/UserServiceImpl.java b/annotation-service/annotation/src/main/java/gr/cite/annotation/service/user/UserServiceImpl.java index 9898a97dc..b99a5383c 100644 --- a/annotation-service/annotation/src/main/java/gr/cite/annotation/service/user/UserServiceImpl.java +++ b/annotation-service/annotation/src/main/java/gr/cite/annotation/service/user/UserServiceImpl.java @@ -153,7 +153,6 @@ public class UserServiceImpl implements UserService { data.setExternalId(model.getSubjectId()); data.setCreatedAt(Instant.now()); data.setUpdatedAt(Instant.now()); - data.setIsActive(IsActive.Active); entityManager.persist(data); } updatedCreatedIds.add(data.getId()); diff --git a/dmp-db-scema/updates/00.01.034_Add_ntf_User_Credential.sql b/dmp-db-scema/updates/00.01.034_Add_ntf_User_Credential.sql index 9dc8332a2..2021dd5f5 100644 --- a/dmp-db-scema/updates/00.01.034_Add_ntf_User_Credential.sql +++ b/dmp-db-scema/updates/00.01.034_Add_ntf_User_Credential.sql @@ -11,7 +11,6 @@ CREATE TABLE IF NOT EXISTS public."ntf_UserCredential" "external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL, "created_at" timestamp without time zone NOT NULL, "updated_at" timestamp without time zone NOT NULL, - "is_active" smallint NOT NULL DEFAULT 1, "data" character varying COLLATE pg_catalog."default", CONSTRAINT "ntf_UserCredential_pkey" PRIMARY KEY (id), CONSTRAINT "ntf_UserCredential_user_fkey" FOREIGN KEY ("user") diff --git a/dmp-db-scema/updates/00.01.052_Add_ant_User_Credential.sql b/dmp-db-scema/updates/00.01.052_Add_ant_User_Credential.sql index f2c9dec8f..f9e0f9219 100644 --- a/dmp-db-scema/updates/00.01.052_Add_ant_User_Credential.sql +++ b/dmp-db-scema/updates/00.01.052_Add_ant_User_Credential.sql @@ -11,7 +11,6 @@ CREATE TABLE IF NOT EXISTS public."ant_UserCredential" "external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL, "created_at" timestamp without time zone NOT NULL, "updated_at" timestamp without time zone NOT NULL, - "is_active" smallint NOT NULL DEFAULT 1, "data" character varying COLLATE pg_catalog."default", CONSTRAINT "ant_UserCredential_pkey" PRIMARY KEY (id), CONSTRAINT "ant_UserCredential_user_fkey" FOREIGN KEY ("user") diff --git a/dmp-db-scema/updates/00.01.058_Add_ant_UserContactInfo_table.sql b/dmp-db-scema/updates/00.01.058_Add_ant_UserContactInfo_table.sql index 688ca8246..3ed288b3d 100644 --- a/dmp-db-scema/updates/00.01.058_Add_ant_UserContactInfo_table.sql +++ b/dmp-db-scema/updates/00.01.058_Add_ant_UserContactInfo_table.sql @@ -4,22 +4,22 @@ BEGIN PERFORM * FROM "DBVersion" WHERE version = this_version; IF FOUND THEN RETURN; END IF; -CREATE TABLE IF NOT EXISTS public."ant_UserContactInfo" -( - "id" uuid NOT NULL, - "user" uuid NOT NULL, - "ordinal" integer NOT NULL DEFAULT 0, - "type" smallint NOT NULL, - "value" character varying(512) COLLATE pg_catalog."default" NOT NULL, - "created_at" timestamp without time zone NOT NULL, - "updated_at" timestamp without time zone NOT NULL, - "is_active" smallint NOT NULL DEFAULT 1, - CONSTRAINT "ant_UserContactInfo_pkey" PRIMARY KEY (id), - CONSTRAINT "ant_UserContactInfo_user_fkey" FOREIGN KEY ("user") - REFERENCES public."ant_User" (id) MATCH SIMPLE - ON UPDATE NO ACTION - ON DELETE NO ACTION -); +-- CREATE TABLE IF NOT EXISTS public."ant_UserContactInfo" +-- ( +-- "id" uuid NOT NULL, +-- "user" uuid NOT NULL, +-- "ordinal" integer NOT NULL DEFAULT 0, +-- "type" smallint NOT NULL, +-- "value" character varying(512) COLLATE pg_catalog."default" NOT NULL, +-- "created_at" timestamp without time zone NOT NULL, +-- "updated_at" timestamp without time zone NOT NULL, +-- "is_active" smallint NOT NULL DEFAULT 1, +-- CONSTRAINT "ant_UserContactInfo_pkey" PRIMARY KEY (id), +-- CONSTRAINT "ant_UserContactInfo_user_fkey" FOREIGN KEY ("user") +-- REFERENCES public."ant_User" (id) MATCH SIMPLE +-- ON UPDATE NO ACTION +-- ON DELETE NO ACTION +-- ); INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.058', '2024-02-28 12:00:00.000000+02', now(), 'Add table ant_UserContactInfo.'); diff --git a/notification-service/notification/src/main/java/gr/cite/notification/data/UserCredentialEntity.java b/notification-service/notification/src/main/java/gr/cite/notification/data/UserCredentialEntity.java index bfd867001..71e08b15a 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/data/UserCredentialEntity.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/data/UserCredentialEntity.java @@ -40,12 +40,6 @@ public class UserCredentialEntity { public static final String _updatedAt = "updatedAt"; - @Column(name = "\"is_active\"", nullable = false) - @Convert(converter = IsActiveConverter.class) - private IsActive isActive; - - public static final String _isActive = "isActive"; - public UUID getId() { return id; } @@ -85,13 +79,4 @@ public class UserCredentialEntity { public void setUpdatedAt(Instant updatedAt) { this.updatedAt = updatedAt; } - - public IsActive getIsActive() { - return isActive; - } - - public void setIsActive(IsActive isActive) { - this.isActive = isActive; - } - } diff --git a/notification-service/notification/src/main/java/gr/cite/notification/model/UserCredential.java b/notification-service/notification/src/main/java/gr/cite/notification/model/UserCredential.java index 826a39d20..7da0a716a 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/model/UserCredential.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/model/UserCredential.java @@ -27,10 +27,6 @@ public class UserCredential { public static final String _updatedAt = "updatedAt"; - private IsActive isActive; - - public static final String _isActive = "isActive"; - public UUID getId() { return id; } @@ -70,12 +66,4 @@ public class UserCredential { public void setUpdatedAt(Instant updatedAt) { this.updatedAt = updatedAt; } - - public IsActive getIsActive() { - return isActive; - } - - public void setIsActive(IsActive isActive) { - this.isActive = isActive; - } } diff --git a/notification-service/notification/src/main/java/gr/cite/notification/model/deleter/UserCredentialDeleter.java b/notification-service/notification/src/main/java/gr/cite/notification/model/deleter/UserCredentialDeleter.java index e400ff201..fd9eec69b 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/model/deleter/UserCredentialDeleter.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/model/deleter/UserCredentialDeleter.java @@ -62,12 +62,10 @@ public class UserCredentialDeleter implements Deleter { Instant now = Instant.now(); for (UserCredentialEntity item : data) { - logger.trace("deleting item {}", item); - item.setIsActive(IsActive.Inactive); - item.setUpdatedAt(now); - logger.trace("updating item"); - this.entityManager.merge(item); - logger.trace("updated item"); + logger.trace("deleting item {}", item.getId()); + logger.trace("deleting item"); + this.entityManager.remove(item); + logger.trace("deleted item"); } } diff --git a/notification-service/notification/src/main/java/gr/cite/notification/query/UserCredentialQuery.java b/notification-service/notification/src/main/java/gr/cite/notification/query/UserCredentialQuery.java index 2ab55d414..59f93f1be 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/query/UserCredentialQuery.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/query/UserCredentialQuery.java @@ -28,8 +28,6 @@ public class UserCredentialQuery extends QueryBase { private Collection excludedIds; - private Collection isActives; - private Collection userIds; private Collection externalIds; @@ -75,21 +73,6 @@ public class UserCredentialQuery extends QueryBase { return this; } - public UserCredentialQuery isActive(IsActive value) { - this.isActives = List.of(value); - return this; - } - - public UserCredentialQuery isActive(IsActive... value) { - this.isActives = Arrays.asList(value); - return this; - } - - public UserCredentialQuery isActive(Collection values) { - this.isActives = values; - return this; - } - public UserCredentialQuery userIds(UUID value) { this.userIds = List.of(value); return this; @@ -182,9 +165,6 @@ public class UserCredentialQuery extends QueryBase { inClause.value(item); predicates.add(inClause); } - if (this.isActives != null) { - predicates.add(queryContext.Root.get(UserCredentialEntity._isActive).in(isActives)); - } if (this.userIds != null) { CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId)); for (UUID item : this.userIds) @@ -225,8 +205,6 @@ public class UserCredentialQuery extends QueryBase { return UserCredentialEntity._createdAt; else if (item.match(UserCredential._updatedAt)) return UserCredentialEntity._updatedAt; - else if (item.match(UserCredential._isActive)) - return UserCredentialEntity._isActive; else return null; } @@ -239,7 +217,6 @@ public class UserCredentialQuery extends QueryBase { item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class)); item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class)); item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class)); - item.setIsActive(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, IsActive.class)); return item; } diff --git a/notification-service/notification/src/main/java/gr/cite/notification/service/user/UserServiceImpl.java b/notification-service/notification/src/main/java/gr/cite/notification/service/user/UserServiceImpl.java index 43af4ed3f..b07727761 100644 --- a/notification-service/notification/src/main/java/gr/cite/notification/service/user/UserServiceImpl.java +++ b/notification-service/notification/src/main/java/gr/cite/notification/service/user/UserServiceImpl.java @@ -183,7 +183,6 @@ public class UserServiceImpl implements UserService { private void persistUserCredential(List models, UUID userId) throws InvalidApplicationException { List items = this.queryFactory.query(UserCredentialQuery.class) .userIds(userId) - .isActive(IsActive.Active) .collect(); List updatedCreatedIds = new ArrayList<>(); if (models != null) { @@ -196,7 +195,6 @@ public class UserServiceImpl implements UserService { data.setExternalId(model.getSubjectId()); data.setCreatedAt(Instant.now()); data.setUpdatedAt(Instant.now()); - data.setIsActive(IsActive.Active); entityManager.persist(data); } updatedCreatedIds.add(data.getId());