Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Diamantis Tziotzios 2024-05-28 15:15:48 +03:00
commit f8a2bd34fa
39 changed files with 162 additions and 32 deletions

View File

@ -94,7 +94,7 @@ public class InAppNotificationController {
UUID userId = this.userScope.getUserId(); UUID userId = this.userScope.getUserId();
this.censorFactory.censor(InAppNotificationCensor.class).censor(fieldSet, userId); this.censorFactory.censor(InAppNotificationCensor.class).censor(fieldSet, userId);
InAppNotificationQuery query = this.queryFactory.query(InAppNotificationQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).userId(userId).ids(id); InAppNotificationQuery query = this.queryFactory.query(InAppNotificationQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrPermission).userId(userId).ids(id);
InAppNotification model = this.builderFactory.builder(InAppNotificationBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet)); InAppNotification model = this.builderFactory.builder(InAppNotificationBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet));
if (model == null) if (model == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Notification.class.getSimpleName()}, LocaleContextHolder.getLocale())); throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Notification.class.getSimpleName()}, LocaleContextHolder.getLocale()));
@ -145,7 +145,7 @@ public class InAppNotificationController {
this.censorFactory.censor(InAppNotificationCensor.class).censor(new BaseFieldSet(InAppNotification.Field.ID), userId); this.censorFactory.censor(InAppNotificationCensor.class).censor(new BaseFieldSet(InAppNotification.Field.ID), userId);
InAppNotificationQuery query = this.queryFactory.query(InAppNotificationQuery.class).isActive(IsActive.Active).trackingState(NotificationInAppTracking.STORED).userId(userId); InAppNotificationQuery query = this.queryFactory.query(InAppNotificationQuery.class).disableTracking().isActive(IsActive.Active).trackingState(NotificationInAppTracking.STORED).userId(userId);
int count = Math.toIntExact(query.count()); int count = Math.toIntExact(query.count());
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action); //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);

View File

@ -81,7 +81,7 @@ public class NotificationController {
this.censorFactory.censor(NotificationCensor.class).censor(fieldSet); this.censorFactory.censor(NotificationCensor.class).censor(fieldSet);
NotificationQuery query = this.queryFactory.query(NotificationQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).ids(id); NotificationQuery query = this.queryFactory.query(NotificationQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrPermission).ids(id);
Notification model = this.builderFactory.builder(NotificationBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet)); Notification model = this.builderFactory.builder(NotificationBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet));
if (model == null) if (model == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Notification.class.getSimpleName()}, LocaleContextHolder.getLocale())); throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Notification.class.getSimpleName()}, LocaleContextHolder.getLocale()));

View File

@ -81,7 +81,7 @@ public class NotificationTemplateController {
this.censorFactory.censor(NotificationTemplateCensor.class).censor(fieldSet); this.censorFactory.censor(NotificationTemplateCensor.class).censor(fieldSet);
NotificationTemplateQuery query = this.queryFactory.query(NotificationTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).ids(id); NotificationTemplateQuery query = this.queryFactory.query(NotificationTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrPermission).ids(id);
NotificationTemplate model = this.builderFactory.builder(NotificationTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.first()); NotificationTemplate model = this.builderFactory.builder(NotificationTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.first());
if (model == null) if (model == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, NotificationTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, NotificationTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));

View File

@ -103,7 +103,7 @@ public class TenantConfigurationController {
this.censorFactory.censor(TenantConfigurationCensor.class).censor(fieldSet, null); this.censorFactory.censor(TenantConfigurationCensor.class).censor(fieldSet, null);
TenantConfigurationQuery query = this.queryFactory.query(TenantConfigurationQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).ids(id); TenantConfigurationQuery query = this.queryFactory.query(TenantConfigurationQuery.class).disableTracking()authorize(AuthorizationFlags.OwnerOrPermission).ids(id);
TenantConfiguration model = this.builderFactory.builder(TenantConfigurationBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet)); TenantConfiguration model = this.builderFactory.builder(TenantConfigurationBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet));
if (model == null) if (model == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, TenantConfiguration.class.getSimpleName()}, LocaleContextHolder.getLocale())); throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, TenantConfiguration.class.getSimpleName()}, LocaleContextHolder.getLocale()));
@ -122,7 +122,7 @@ public class TenantConfigurationController {
this.censorFactory.censor(TenantConfigurationCensor.class).censor(fieldSet, null); this.censorFactory.censor(TenantConfigurationCensor.class).censor(fieldSet, null);
TenantConfigurationQuery query = this.queryFactory.query(TenantConfigurationQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).isActive(IsActive.Active).types(TenantConfigurationType.of(type)); TenantConfigurationQuery query = this.queryFactory.query(TenantConfigurationQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrPermission).isActive(IsActive.Active).types(TenantConfigurationType.of(type));
if (this.tenantScope.isDefaultTenant()) query.tenantIsSet(false); if (this.tenantScope.isDefaultTenant()) query.tenantIsSet(false);
else query.tenantIsSet(true).tenantIds(this.tenantScope.getTenant()); else query.tenantIsSet(true).tenantIds(this.tenantScope.getTenant());

View File

@ -95,7 +95,7 @@ public class UserNotificationPreferenceController {
Ordering ordering = new Ordering(); Ordering ordering = new Ordering();
ordering.addAscending(UserNotificationPreference._ordinal); ordering.addAscending(UserNotificationPreference._ordinal);
UserNotificationPreferenceQuery query = this.queryFactory.query(UserNotificationPreferenceQuery.class).userId(userId).isActives(IsActive.Active); UserNotificationPreferenceQuery query = this.queryFactory.query(UserNotificationPreferenceQuery.class).disableTracking().userId(userId).isActives(IsActive.Active);
query.setOrder(ordering); query.setOrder(ordering);
if (this.tenantScope.isMultitenant() && this.tenantScope.isSet()) { if (this.tenantScope.isMultitenant() && this.tenantScope.isSet()) {
if (!this.tenantScope.isDefaultTenant()) { if (!this.tenantScope.isDefaultTenant()) {

View File

@ -63,7 +63,7 @@ public class UserInterceptor implements WebRequestInterceptor {
this.userScope.setUserId(userId); this.userScope.setUserId(userId);
} }
private UUID findExistingUserFromDb(String subjectId) { private UUID findExistingUserFromDb(String subjectId) {
UserCredentialEntity userCredential = this.queryFactory.query(UserCredentialQuery.class).externalIds(subjectId).firstAs(new BaseFieldSet().ensure(UserCredential._user)); UserCredentialEntity userCredential = this.queryFactory.query(UserCredentialQuery.class).disableTracking().externalIds(subjectId).firstAs(new BaseFieldSet().ensure(UserCredential._user));
if (userCredential != null) { if (userCredential != null) {
return userCredential.getUserId(); return userCredential.getUserId();
} }

View File

@ -34,7 +34,7 @@ public class NotifyConsistencyHandler implements ConsistencyHandler<NotifyConsis
@Override @Override
public Boolean isConsistent(NotifyConsistencyPredicates consistencyPredicates) { public Boolean isConsistent(NotifyConsistencyPredicates consistencyPredicates) {
if (consistencyPredicates.getUserId() != null) { if (consistencyPredicates.getUserId() != null) {
UserQuery query = this.queryFactory.query(UserQuery.class).ids(consistencyPredicates.getUserId()).isActive(IsActive.Active); UserQuery query = this.queryFactory.query(UserQuery.class).disableTracking().ids(consistencyPredicates.getUserId()).isActive(IsActive.Active);
BaseFieldSet fieldSet = new BaseFieldSet( BaseFieldSet fieldSet = new BaseFieldSet(
User._id, User._id,
@ -43,7 +43,7 @@ public class NotifyConsistencyHandler implements ConsistencyHandler<NotifyConsis
User user = this.builderFactory.builder(UserBuilder.class).build(fieldSet, query.firstAs(fieldSet)); User user = this.builderFactory.builder(UserBuilder.class).build(fieldSet, query.firstAs(fieldSet));
if (user == null) if (user == null)
return false; return false;
Long activeEmails = this.queryFactory.query(UserContactInfoQuery.class).ids(consistencyPredicates.getUserId()).isActive(IsActive.Active).type(ContactInfoType.Email).count(); Long activeEmails = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().ids(consistencyPredicates.getUserId()).isActive(IsActive.Active).type(ContactInfoType.Email).count();
return consistencyPredicates.getContactTypeHint() == null || consistencyPredicates.getContactTypeHint() == NotificationContactType.IN_APP || !StringUtils.isNullOrEmpty(consistencyPredicates.getContactHint()) || activeEmails != 0; return consistencyPredicates.getContactTypeHint() == null || consistencyPredicates.getContactTypeHint() == NotificationContactType.IN_APP || !StringUtils.isNullOrEmpty(consistencyPredicates.getContactHint()) || activeEmails != 0;
} else { } else {
return !StringUtils.isNullOrEmpty(consistencyPredicates.getContactHint()); return !StringUtils.isNullOrEmpty(consistencyPredicates.getContactHint());

View File

@ -83,7 +83,7 @@ public class NotifyIntegrationEventHandlerImpl implements NotifyIntegrationEvent
EventProcessingStatus status = EventProcessingStatus.Success; EventProcessingStatus status = EventProcessingStatus.Success;
try { try {
if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) { if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) {
TenantEntity tenant = queryFactory.query(TenantQuery.class).ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code)); TenantEntity tenant = queryFactory.query(TenantQuery.class).disableTracking().ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code));
if (tenant == null) { if (tenant == null) {
logger.error("missing tenant from event message"); logger.error("missing tenant from event message");
return EventProcessingStatus.Error; return EventProcessingStatus.Error;

View File

@ -20,7 +20,7 @@ public class TenantDefaultLocaleRemovalConsistencyHandler implements Consistency
@Override @Override
public Boolean isConsistent(TenantDefaultLocaleRemovalConsistencyPredicates consistencyPredicates) { public Boolean isConsistent(TenantDefaultLocaleRemovalConsistencyPredicates consistencyPredicates) {
if (consistencyPredicates.getTenantId() == null) return true; if (consistencyPredicates.getTenantId() == null) return true;
long count = this.queryFactory.query(TenantQuery.class).ids(consistencyPredicates.getTenantId()).count(); long count = this.queryFactory.query(TenantQuery.class).disableTracking().ids(consistencyPredicates.getTenantId()).count();
return count > 0; return count > 0;
} }

View File

@ -68,7 +68,7 @@ public class TenantDefaultLocaleRemovalIntegrationEventHandlerImpl implements Te
} }
if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) { if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) {
TenantEntity tenant = queryFactory.query(TenantQuery.class).ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code)); TenantEntity tenant = queryFactory.query(TenantQuery.class).disableTracking().ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code));
if (tenant == null) { if (tenant == null) {
logger.error("missing tenant from event message"); logger.error("missing tenant from event message");
return EventProcessingStatus.Error; return EventProcessingStatus.Error;

View File

@ -20,7 +20,7 @@ public class TenantDefaultLocaleTouchedConsistencyHandler implements Consistency
@Override @Override
public Boolean isConsistent(TenantDefaultLocaleTouchedConsistencyPredicates consistencyPredicates) { public Boolean isConsistent(TenantDefaultLocaleTouchedConsistencyPredicates consistencyPredicates) {
if (consistencyPredicates.getTenantId() == null) return true; if (consistencyPredicates.getTenantId() == null) return true;
long count = this.queryFactory.query(TenantQuery.class).ids(consistencyPredicates.getTenantId()).count(); long count = this.queryFactory.query(TenantQuery.class).disableTracking().ids(consistencyPredicates.getTenantId()).count();
return count > 0; return count > 0;
} }

View File

@ -77,7 +77,7 @@ public class TenantDefaultLocaleTouchedIntegrationEventHandlerImpl implements Te
return status; return status;
} }
if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) { if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) {
TenantEntity tenant = queryFactory.query(TenantQuery.class).ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code)); TenantEntity tenant = queryFactory.query(TenantQuery.class).disableTracking().ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code));
if (tenant == null) { if (tenant == null) {
logger.error("missing tenant from event message"); logger.error("missing tenant from event message");
return EventProcessingStatus.Error; return EventProcessingStatus.Error;

View File

@ -19,7 +19,7 @@ public class TenantRemovalConsistencyHandler implements ConsistencyHandler<Tenan
@Override @Override
public Boolean isConsistent(TenantRemovalConsistencyPredicates consistencyPredicates) { public Boolean isConsistent(TenantRemovalConsistencyPredicates consistencyPredicates) {
long count = this.queryFactory.query(TenantQuery.class).ids(consistencyPredicates.getTenantId()).count(); long count = this.queryFactory.query(TenantQuery.class).disableTracking().ids(consistencyPredicates.getTenantId()).count();
return count > 0; return count > 0;
} }

View File

@ -19,7 +19,7 @@ public class UserRemovalConsistencyHandler implements ConsistencyHandler<UserRem
@Override @Override
public Boolean isConsistent(UserRemovalConsistencyPredicates consistencyPredicates) { public Boolean isConsistent(UserRemovalConsistencyPredicates consistencyPredicates) {
long count = this.queryFactory.query(UserQuery.class).ids(consistencyPredicates.getUserId()).count(); long count = this.queryFactory.query(UserQuery.class).disableTracking().ids(consistencyPredicates.getUserId()).count();
return count != 0; return count != 0;
} }
} }

View File

@ -82,7 +82,7 @@ public class UserRemovalIntegrationEventHandlerImpl implements UserRemovalIntegr
EventProcessingStatus status = EventProcessingStatus.Success; EventProcessingStatus status = EventProcessingStatus.Success;
try { try {
if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) { if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) {
TenantEntity tenant = queryFactory.query(TenantQuery.class).ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code)); TenantEntity tenant = queryFactory.query(TenantQuery.class).disableTracking().ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code));
if (tenant == null) { if (tenant == null) {
logger.error("missing tenant from event message"); logger.error("missing tenant from event message");
return EventProcessingStatus.Error; return EventProcessingStatus.Error;

View File

@ -72,7 +72,7 @@ public class UserTouchedIntegrationEventHandlerImpl implements UserTouchedIntegr
EventProcessingStatus status = EventProcessingStatus.Success; EventProcessingStatus status = EventProcessingStatus.Success;
try { try {
if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) { if (this.tenantScope.isMultitenant() && properties.getTenantId() != null) {
TenantEntity tenant = queryFactory.query(TenantQuery.class).ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code)); TenantEntity tenant = queryFactory.query(TenantQuery.class).disableTracking().ids(properties.getTenantId()).firstAs(new BaseFieldSet().ensure(Tenant._id).ensure(Tenant._code));
if (tenant == null) { if (tenant == null) {
logger.error("missing tenant from event message"); logger.error("missing tenant from event message");
return EventProcessingStatus.Error; return EventProcessingStatus.Error;

View File

@ -102,7 +102,7 @@ public class InAppNotificationBuilder extends BaseBuilder<InAppNotification, InA
Tenant::getId); Tenant::getId);
} else { } else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tenant._id); FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tenant._id);
TenantQuery q = this.queryFactory.query(TenantQuery.class).authorize(this.authorize).ids(data.stream().map(InAppNotificationEntity::getTenantId).distinct().collect(Collectors.toList())); TenantQuery q = this.queryFactory.query(TenantQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(InAppNotificationEntity::getTenantId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(TenantBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Tenant::getId); itemMap = this.builderFactory.builder(TenantBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Tenant::getId);
} }
if (!fields.hasField(Tenant._id)) { if (!fields.hasField(Tenant._id)) {
@ -128,7 +128,7 @@ public class InAppNotificationBuilder extends BaseBuilder<InAppNotification, InA
User::getId); User::getId);
} else { } else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id); FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id);
UserQuery q = this.queryFactory.query(UserQuery.class).authorize(this.authorize).ids(data.stream().map(InAppNotificationEntity::getUserId).distinct().collect(Collectors.toList())); UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().disableTracking().authorize(this.authorize).ids(data.stream().map(InAppNotificationEntity::getUserId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, User::getId); itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, User::getId);
} }
if (!fields.hasField(User._id)) { if (!fields.hasField(User._id)) {

View File

@ -103,7 +103,7 @@ public class NotificationBuilder extends BaseBuilder<Notification, NotificationE
Tenant::getId); Tenant::getId);
} else { } else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tenant._id); FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tenant._id);
TenantQuery q = this.queryFactory.query(TenantQuery.class).authorize(this.authorize).ids(data.stream().map(NotificationEntity::getTenantId).distinct().collect(Collectors.toList())); TenantQuery q = this.queryFactory.query(TenantQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(NotificationEntity::getTenantId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(TenantBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Tenant::getId); itemMap = this.builderFactory.builder(TenantBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Tenant::getId);
} }
if (!fields.hasField(Tenant._id)) { if (!fields.hasField(Tenant._id)) {
@ -129,7 +129,7 @@ public class NotificationBuilder extends BaseBuilder<Notification, NotificationE
User::getId); User::getId);
} else { } else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id); FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id);
UserQuery q = this.queryFactory.query(UserQuery.class).authorize(this.authorize).ids(data.stream().map(NotificationEntity::getUserId).filter(Objects::nonNull).distinct().collect(Collectors.toList())); UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(NotificationEntity::getUserId).filter(Objects::nonNull).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, User::getId); itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, User::getId);
} }
if (!fields.hasField(User._id)) { if (!fields.hasField(User._id)) {

View File

@ -95,7 +95,7 @@ public class NotificationTemplateBuilder extends BaseBuilder<NotificationTemplat
x -> x.getId()); x -> x.getId());
} else { } else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tenant._id); FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tenant._id);
TenantQuery q = this.queryFactory.query(TenantQuery.class).authorize(this.authorize).ids(datas.stream().map(x -> x.getTenantId()).distinct().collect(Collectors.toList())); TenantQuery q = this.queryFactory.query(TenantQuery.class).disableTracking().authorize(this.authorize).ids(datas.stream().map(x -> x.getTenantId()).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(TenantBuilder.class).authorize(this.authorize).asForeignKey(q, clone, x -> x.getId()); itemMap = this.builderFactory.builder(TenantBuilder.class).authorize(this.authorize).asForeignKey(q, clone, x -> x.getId());
} }
if (!fields.hasField(Tenant._id)) { if (!fields.hasField(Tenant._id)) {

View File

@ -85,7 +85,7 @@ public class UserContactInfoBuilder extends BaseBuilder<UserContactInfo, UserCon
User::getId); User::getId);
} else { } else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id); FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id);
UserQuery q = this.queryFactory.query(UserQuery.class).authorize(this.authorize).ids(data.stream().map(UserContactInfoEntity::getUserId).distinct().collect(Collectors.toList())); UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(UserContactInfoEntity::getUserId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, User::getId); itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, User::getId);
} }
if (!fields.hasField(User._id)) { if (!fields.hasField(User._id)) {

View File

@ -156,6 +156,16 @@ public class InAppNotificationQuery extends QueryBase<InAppNotificationEntity> {
return this; return this;
} }
public InAppNotificationQuery enableTracking() {
this.noTracking = false;
return this;
}
public InAppNotificationQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return this.isNullOrEmpty(this.ids) return this.isNullOrEmpty(this.ids)

View File

@ -206,6 +206,16 @@ public class NotificationQuery extends QueryBase<NotificationEntity> {
return this; return this;
} }
public NotificationQuery enableTracking() {
this.noTracking = false;
return this;
}
public NotificationQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return this.isNullOrEmpty(this.ids) return this.isNullOrEmpty(this.ids)

View File

@ -145,6 +145,16 @@ public class NotificationTemplateQuery extends QueryBase<NotificationTemplateEnt
return this; return this;
} }
public NotificationTemplateQuery enableTracking() {
this.noTracking = false;
return this;
}
public NotificationTemplateQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return this.isNullOrEmpty(this.ids) return this.isNullOrEmpty(this.ids)

View File

@ -120,6 +120,16 @@ public class QueueInboxQuery extends QueryBase<QueueInboxEntity> {
return this; return this;
} }
public QueueInboxQuery enableTracking() {
this.noTracking = false;
return this;
}
public QueueInboxQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Class<QueueInboxEntity> entityClass() { protected Class<QueueInboxEntity> entityClass() {
return QueueInboxEntity.class; return QueueInboxEntity.class;

View File

@ -126,6 +126,16 @@ public class QueueOutboxQuery extends QueryBase<QueueOutboxEntity> {
return this; return this;
} }
public QueueOutboxQuery enableTracking() {
this.noTracking = false;
return this;
}
public QueueOutboxQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Class<QueueOutboxEntity> entityClass() { protected Class<QueueOutboxEntity> entityClass() {
return QueueOutboxEntity.class; return QueueOutboxEntity.class;

View File

@ -119,6 +119,16 @@ public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntit
return this; return this;
} }
public TenantConfigurationQuery enableTracking() {
this.noTracking = false;
return this;
}
public TenantConfigurationQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return this.isEmpty(this.ids) ||this.isEmpty(this.isActives) ||this.isEmpty(this.types) || this.isEmpty(this.tenantIds); return this.isEmpty(this.ids) ||this.isEmpty(this.isActives) ||this.isEmpty(this.types) || this.isEmpty(this.tenantIds);

View File

@ -63,6 +63,16 @@ public class TenantQuery extends QueryBase<TenantEntity> {
return this; return this;
} }
public TenantQuery enableTracking() {
this.noTracking = false;
return this;
}
public TenantQuery disableTracking() {
this.noTracking = false;
return this;
}
public TenantQuery authorize(EnumSet<AuthorizationFlags> values) { public TenantQuery authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values; this.authorize = values;
return this; return this;

View File

@ -114,6 +114,16 @@ public class TenantUserQuery extends QueryBase<TenantUserEntity> {
return this; return this;
} }
public TenantUserQuery enableTracking() {
this.noTracking = false;
return this;
}
public TenantUserQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Class<TenantUserEntity> entityClass() { protected Class<TenantUserEntity> entityClass() {
return TenantUserEntity.class; return TenantUserEntity.class;

View File

@ -154,6 +154,16 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
return this; return this;
} }
public UserContactInfoQuery enableTracking() {
this.noTracking = false;
return this;
}
public UserContactInfoQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return this.isEmpty(this.userIds) || this.isEmpty(this.excludedUserIds) || this.isEmpty(this.isActives) return this.isEmpty(this.userIds) || this.isEmpty(this.excludedUserIds) || this.isEmpty(this.isActives)

View File

@ -125,6 +125,16 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
return this; return this;
} }
public UserCredentialQuery enableTracking() {
this.noTracking = false;
return this;
}
public UserCredentialQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return return

View File

@ -127,6 +127,16 @@ public class UserNotificationPreferenceQuery extends QueryBase<UserNotificationP
return this; return this;
} }
public UserNotificationPreferenceQuery enableTracking() {
this.noTracking = false;
return this;
}
public UserNotificationPreferenceQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return this.isEmpty(this.ids) || this.isEmpty(this.tenantIds) ||this.isEmpty(this.excludedIds) ||this.isNullOrEmpty(this.userId) && this.isNullOrEmpty(this.type) && this.isNullOrEmpty(this.channel); return this.isEmpty(this.ids) || this.isEmpty(this.tenantIds) ||this.isEmpty(this.excludedIds) ||this.isNullOrEmpty(this.userId) && this.isNullOrEmpty(this.type) && this.isNullOrEmpty(this.channel);

View File

@ -81,6 +81,16 @@ public class UserQuery extends QueryBase<UserEntity> {
return this; return this;
} }
public UserQuery enableTracking() {
this.noTracking = false;
return this;
}
public UserQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Class<UserEntity> entityClass() { protected Class<UserEntity> entityClass() {
return UserEntity.class; return UserEntity.class;

View File

@ -125,6 +125,16 @@ public class UserRoleQuery extends QueryBase<UserRoleEntity> {
return this; return this;
} }
public UserRoleQuery enableTracking() {
this.noTracking = false;
return this;
}
public UserRoleQuery disableTracking() {
this.noTracking = false;
return this;
}
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return return

View File

@ -65,7 +65,7 @@ public class EmailContactExtractor implements ContactExtractor {
} }
else if (notification.getUserId() != null) { else if (notification.getUserId() != null) {
logger.trace("extracting from user"); logger.trace("extracting from user");
UserContactInfoEntity userContactInfo = this.queryFactory.query(UserContactInfoQuery.class) UserContactInfoEntity userContactInfo = this.queryFactory.query(UserContactInfoQuery.class).disableTracking()
.userIds(notification.getUserId()) .userIds(notification.getUserId())
.isActive(IsActive.Active) .isActive(IsActive.Active)
.type(ContactInfoType.Email).firstAs(new BaseFieldSet().ensure(UserContactInfo._value)); .type(ContactInfoType.Email).firstAs(new BaseFieldSet().ensure(UserContactInfo._value));

View File

@ -57,7 +57,7 @@ public class InAppNotificationServiceImpl implements InAppNotificationService {
try { try {
logger.debug(new DataLogEntry("marking as read in-app notifications", ids)); logger.debug(new DataLogEntry("marking as read in-app notifications", ids));
UUID userId = this.userScope.getUserId(); UUID userId = this.userScope.getUserId();
List<InAppNotificationEntity> items = this.queryFactory.query(InAppNotificationQuery.class) List<InAppNotificationEntity> items = this.queryFactory.query(InAppNotificationQuery.class).disableTracking()
.ids(ids) .ids(ids)
.userId(userId) .userId(userId)
.collect(); .collect();

View File

@ -83,7 +83,7 @@ public class MessageBuilderServiceImpl implements MessageInfoBuilderService {
UserEntity userProfile = null; UserEntity userProfile = null;
if (notification.getUserId() != null) { if (notification.getUserId() != null) {
userProfile = this.queryFactory.query(UserQuery.class) userProfile = this.queryFactory.query(UserQuery.class).disableTracking()
.ids(notification.getUserId()) .ids(notification.getUserId())
.isActive(IsActive.Active).first(); .isActive(IsActive.Active).first();
} }
@ -109,7 +109,7 @@ public class MessageBuilderServiceImpl implements MessageInfoBuilderService {
if (this.scope.isMultitenant()) { if (this.scope.isMultitenant()) {
if (!this.scope.isDefaultTenant()) { if (!this.scope.isDefaultTenant()) {
TenantEntity tenantInfo = this.queryFactory.query(TenantQuery.class) TenantEntity tenantInfo = this.queryFactory.query(TenantQuery.class).disableTracking()
.isActive(IsActive.Active).firstAs(new BaseFieldSet(TenantEntity._id, TenantEntity._code)); .isActive(IsActive.Active).firstAs(new BaseFieldSet(TenantEntity._id, TenantEntity._code));
if (tenantInfo == null) { if (tenantInfo == null) {

View File

@ -159,7 +159,7 @@ public class NotificationServiceImpl implements NotificationService {
if (notification.getUserId() == null) return null; if (notification.getUserId() == null) return null;
Ordering ordering = new Ordering(); Ordering ordering = new Ordering();
ordering.addAscending(UserNotificationPreference._ordinal); ordering.addAscending(UserNotificationPreference._ordinal);
UserNotificationPreferenceQuery query = this.queryFactory.query(UserNotificationPreferenceQuery.class).userId(notification.getUserId()).type(notification.getType()).isActives(IsActive.Active); UserNotificationPreferenceQuery query = this.queryFactory.query(UserNotificationPreferenceQuery.class).disableTracking().userId(notification.getUserId()).type(notification.getType()).isActives(IsActive.Active);
query.setOrder(ordering); query.setOrder(ordering);
List<UserNotificationPreferenceEntity> preferences = query.collectAs(new BaseFieldSet().ensure(UserNotificationPreference._channel).ensure(UserNotificationPreference._tenantId).ensure(UserNotificationPreference._id)); List<UserNotificationPreferenceEntity> preferences = query.collectAs(new BaseFieldSet().ensure(UserNotificationPreference._channel).ensure(UserNotificationPreference._tenantId).ensure(UserNotificationPreference._id));

View File

@ -184,7 +184,7 @@ public class NotificationServiceTemplateImpl implements NotificationTemplateServ
@Override @Override
public NotificationTemplate lookupOverriddenTemplates(UUID notificationType, NotificationTemplateChannel channel, String language) { public NotificationTemplate lookupOverriddenTemplates(UUID notificationType, NotificationTemplateChannel channel, String language) {
NotificationTemplateQuery query = this.queryFactory.query(NotificationTemplateQuery.class) NotificationTemplateQuery query = this.queryFactory.query(NotificationTemplateQuery.class).disableTracking()
.notificationTypes(notificationType) .notificationTypes(notificationType)
.channels(channel) .channels(channel)
.languageCodes(language) .languageCodes(language)

View File

@ -207,7 +207,7 @@ public class TenantConfigurationServiceImpl implements TenantConfigurationServic
@Override @Override
public TenantConfigurationEntity getTenantConfigurationEntityForType(TenantConfigurationType type){ public TenantConfigurationEntity getTenantConfigurationEntityForType(TenantConfigurationType type){
TenantConfigurationQuery query = this.queryFactory.query(TenantConfigurationQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).isActive(IsActive.Active).types(type); TenantConfigurationQuery query = this.queryFactory.query(TenantConfigurationQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrPermission).isActive(IsActive.Active).types(type);
if (this.tenantScope.isDefaultTenant()) query.tenantIsSet(false); if (this.tenantScope.isDefaultTenant()) query.tenantIsSet(false);
else { else {
try { try {