fix microservice annotation notification tables
This commit is contained in:
parent
1ae6d6a20a
commit
39abb725bc
|
@ -40,12 +40,6 @@ public class UserCredentialEntity {
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
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() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -86,12 +80,4 @@ public class UserCredentialEntity {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
|
||||||
return isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsActive(IsActive isActive) {
|
|
||||||
this.isActive = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,6 @@ public class UserCredential {
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
private IsActive isActive;
|
|
||||||
|
|
||||||
public static final String _isActive = "isActive";
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -70,12 +66,4 @@ public class UserCredential {
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,10 @@ public class UserCredentialDeleter implements Deleter {
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
|
|
||||||
for (UserCredentialEntity item : data) {
|
for (UserCredentialEntity item : data) {
|
||||||
logger.trace("deleting item {}", item);
|
logger.trace("deleting item {}", item.getId());
|
||||||
item.setIsActive(IsActive.Inactive);
|
logger.trace("deleting item");
|
||||||
item.setUpdatedAt(now);
|
this.entityManager.remove(item);
|
||||||
logger.trace("updating item");
|
logger.trace("deleted item");
|
||||||
this.entityManager.merge(item);
|
|
||||||
logger.trace("updated item");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,9 +182,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||||
inClause.value(item);
|
inClause.value(item);
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.isActives != null) {
|
|
||||||
predicates.add(queryContext.Root.get(UserCredentialEntity._isActive).in(isActives));
|
|
||||||
}
|
|
||||||
if (this.userIds != null) {
|
if (this.userIds != null) {
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId));
|
||||||
for (UUID item : this.userIds)
|
for (UUID item : this.userIds)
|
||||||
|
@ -225,8 +222,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||||
return UserCredentialEntity._createdAt;
|
return UserCredentialEntity._createdAt;
|
||||||
else if (item.match(UserCredential._updatedAt))
|
else if (item.match(UserCredential._updatedAt))
|
||||||
return UserCredentialEntity._updatedAt;
|
return UserCredentialEntity._updatedAt;
|
||||||
else if (item.match(UserCredential._isActive))
|
|
||||||
return UserCredentialEntity._isActive;
|
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +234,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||||
item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class));
|
item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class));
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class));
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class));
|
||||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class));
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class));
|
||||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, IsActive.class));
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,6 @@ public class UserServiceImpl implements UserService {
|
||||||
data.setExternalId(model.getSubjectId());
|
data.setExternalId(model.getSubjectId());
|
||||||
data.setCreatedAt(Instant.now());
|
data.setCreatedAt(Instant.now());
|
||||||
data.setUpdatedAt(Instant.now());
|
data.setUpdatedAt(Instant.now());
|
||||||
data.setIsActive(IsActive.Active);
|
|
||||||
entityManager.persist(data);
|
entityManager.persist(data);
|
||||||
}
|
}
|
||||||
updatedCreatedIds.add(data.getId());
|
updatedCreatedIds.add(data.getId());
|
||||||
|
|
|
@ -11,7 +11,6 @@ CREATE TABLE IF NOT EXISTS public."ntf_UserCredential"
|
||||||
"external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL,
|
"external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL,
|
||||||
"created_at" timestamp without time zone NOT NULL,
|
"created_at" timestamp without time zone NOT NULL,
|
||||||
"updated_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",
|
"data" character varying COLLATE pg_catalog."default",
|
||||||
CONSTRAINT "ntf_UserCredential_pkey" PRIMARY KEY (id),
|
CONSTRAINT "ntf_UserCredential_pkey" PRIMARY KEY (id),
|
||||||
CONSTRAINT "ntf_UserCredential_user_fkey" FOREIGN KEY ("user")
|
CONSTRAINT "ntf_UserCredential_user_fkey" FOREIGN KEY ("user")
|
||||||
|
|
|
@ -11,7 +11,6 @@ CREATE TABLE IF NOT EXISTS public."ant_UserCredential"
|
||||||
"external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL,
|
"external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL,
|
||||||
"created_at" timestamp without time zone NOT NULL,
|
"created_at" timestamp without time zone NOT NULL,
|
||||||
"updated_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",
|
"data" character varying COLLATE pg_catalog."default",
|
||||||
CONSTRAINT "ant_UserCredential_pkey" PRIMARY KEY (id),
|
CONSTRAINT "ant_UserCredential_pkey" PRIMARY KEY (id),
|
||||||
CONSTRAINT "ant_UserCredential_user_fkey" FOREIGN KEY ("user")
|
CONSTRAINT "ant_UserCredential_user_fkey" FOREIGN KEY ("user")
|
||||||
|
|
|
@ -4,22 +4,22 @@ BEGIN
|
||||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||||
IF FOUND THEN RETURN; END IF;
|
IF FOUND THEN RETURN; END IF;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public."ant_UserContactInfo"
|
-- CREATE TABLE IF NOT EXISTS public."ant_UserContactInfo"
|
||||||
(
|
-- (
|
||||||
"id" uuid NOT NULL,
|
-- "id" uuid NOT NULL,
|
||||||
"user" uuid NOT NULL,
|
-- "user" uuid NOT NULL,
|
||||||
"ordinal" integer NOT NULL DEFAULT 0,
|
-- "ordinal" integer NOT NULL DEFAULT 0,
|
||||||
"type" smallint NOT NULL,
|
-- "type" smallint NOT NULL,
|
||||||
"value" character varying(512) COLLATE pg_catalog."default" NOT NULL,
|
-- "value" character varying(512) COLLATE pg_catalog."default" NOT NULL,
|
||||||
"created_at" timestamp without time zone NOT NULL,
|
-- "created_at" timestamp without time zone NOT NULL,
|
||||||
"updated_at" timestamp without time zone NOT NULL,
|
-- "updated_at" timestamp without time zone NOT NULL,
|
||||||
"is_active" smallint NOT NULL DEFAULT 1,
|
-- "is_active" smallint NOT NULL DEFAULT 1,
|
||||||
CONSTRAINT "ant_UserContactInfo_pkey" PRIMARY KEY (id),
|
-- CONSTRAINT "ant_UserContactInfo_pkey" PRIMARY KEY (id),
|
||||||
CONSTRAINT "ant_UserContactInfo_user_fkey" FOREIGN KEY ("user")
|
-- CONSTRAINT "ant_UserContactInfo_user_fkey" FOREIGN KEY ("user")
|
||||||
REFERENCES public."ant_User" (id) MATCH SIMPLE
|
-- REFERENCES public."ant_User" (id) MATCH SIMPLE
|
||||||
ON UPDATE NO ACTION
|
-- ON UPDATE NO ACTION
|
||||||
ON DELETE 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.');
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.058', '2024-02-28 12:00:00.000000+02', now(), 'Add table ant_UserContactInfo.');
|
||||||
|
|
||||||
|
|
|
@ -40,12 +40,6 @@ public class UserCredentialEntity {
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
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() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -85,13 +79,4 @@ public class UserCredentialEntity {
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,6 @@ public class UserCredential {
|
||||||
|
|
||||||
public static final String _updatedAt = "updatedAt";
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
private IsActive isActive;
|
|
||||||
|
|
||||||
public static final String _isActive = "isActive";
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -70,12 +66,4 @@ public class UserCredential {
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,10 @@ public class UserCredentialDeleter implements Deleter {
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
|
|
||||||
for (UserCredentialEntity item : data) {
|
for (UserCredentialEntity item : data) {
|
||||||
logger.trace("deleting item {}", item);
|
logger.trace("deleting item {}", item.getId());
|
||||||
item.setIsActive(IsActive.Inactive);
|
logger.trace("deleting item");
|
||||||
item.setUpdatedAt(now);
|
this.entityManager.remove(item);
|
||||||
logger.trace("updating item");
|
logger.trace("deleted item");
|
||||||
this.entityManager.merge(item);
|
|
||||||
logger.trace("updated item");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||||
|
|
||||||
private Collection<UUID> excludedIds;
|
private Collection<UUID> excludedIds;
|
||||||
|
|
||||||
private Collection<IsActive> isActives;
|
|
||||||
|
|
||||||
private Collection<UUID> userIds;
|
private Collection<UUID> userIds;
|
||||||
|
|
||||||
private Collection<String> externalIds;
|
private Collection<String> externalIds;
|
||||||
|
@ -75,21 +73,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||||
return this;
|
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<IsActive> values) {
|
|
||||||
this.isActives = values;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserCredentialQuery userIds(UUID value) {
|
public UserCredentialQuery userIds(UUID value) {
|
||||||
this.userIds = List.of(value);
|
this.userIds = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
|
@ -182,9 +165,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||||
inClause.value(item);
|
inClause.value(item);
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.isActives != null) {
|
|
||||||
predicates.add(queryContext.Root.get(UserCredentialEntity._isActive).in(isActives));
|
|
||||||
}
|
|
||||||
if (this.userIds != null) {
|
if (this.userIds != null) {
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserCredentialEntity._userId));
|
||||||
for (UUID item : this.userIds)
|
for (UUID item : this.userIds)
|
||||||
|
@ -225,8 +205,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||||
return UserCredentialEntity._createdAt;
|
return UserCredentialEntity._createdAt;
|
||||||
else if (item.match(UserCredential._updatedAt))
|
else if (item.match(UserCredential._updatedAt))
|
||||||
return UserCredentialEntity._updatedAt;
|
return UserCredentialEntity._updatedAt;
|
||||||
else if (item.match(UserCredential._isActive))
|
|
||||||
return UserCredentialEntity._isActive;
|
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +217,6 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||||
item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class));
|
item.setUserId(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._userId, UUID.class));
|
||||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class));
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, Instant.class));
|
||||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class));
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._updatedAt, Instant.class));
|
||||||
item.setIsActive(QueryBase.convertSafe(tuple, columns, UserCredentialEntity._createdAt, IsActive.class));
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,6 @@ public class UserServiceImpl implements UserService {
|
||||||
private void persistUserCredential(List<UserTouchedIntegrationEvent.UserCredential> models, UUID userId) throws InvalidApplicationException {
|
private void persistUserCredential(List<UserTouchedIntegrationEvent.UserCredential> models, UUID userId) throws InvalidApplicationException {
|
||||||
List<UserCredentialEntity> items = this.queryFactory.query(UserCredentialQuery.class)
|
List<UserCredentialEntity> items = this.queryFactory.query(UserCredentialQuery.class)
|
||||||
.userIds(userId)
|
.userIds(userId)
|
||||||
.isActive(IsActive.Active)
|
|
||||||
.collect();
|
.collect();
|
||||||
List<UUID> updatedCreatedIds = new ArrayList<>();
|
List<UUID> updatedCreatedIds = new ArrayList<>();
|
||||||
if (models != null) {
|
if (models != null) {
|
||||||
|
@ -196,7 +195,6 @@ public class UserServiceImpl implements UserService {
|
||||||
data.setExternalId(model.getSubjectId());
|
data.setExternalId(model.getSubjectId());
|
||||||
data.setCreatedAt(Instant.now());
|
data.setCreatedAt(Instant.now());
|
||||||
data.setUpdatedAt(Instant.now());
|
data.setUpdatedAt(Instant.now());
|
||||||
data.setIsActive(IsActive.Active);
|
|
||||||
entityManager.persist(data);
|
entityManager.persist(data);
|
||||||
}
|
}
|
||||||
updatedCreatedIds.add(data.getId());
|
updatedCreatedIds.add(data.getId());
|
||||||
|
|
Loading…
Reference in New Issue