small fix

This commit is contained in:
CITE\amentis 2024-07-31 16:21:20 +03:00
parent de40adea46
commit 6bb095a62d
1 changed files with 23 additions and 2 deletions

View File

@ -157,8 +157,29 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName());
Map<UUID, UUID> itemMap = new HashMap<>();
PlanDescriptionTemplateQuery q = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().collect(Collectors.toList()));
List<PlanDescriptionTemplateEntity> items = q.collectAs(new BaseFieldSet().ensure(PlanDescriptionTemplate._id).ensure(PlanDescriptionTemplate._sectionId));
PlanDescriptionTemplateQuery q = null;
List<PlanDescriptionTemplateEntity> items;
if (this.isPublic) {
try {
this.entityManager.disableTenantFilters();
q =this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().collect(Collectors.toList()));
items = q.collectAs(new BaseFieldSet().ensure(PlanDescriptionTemplate._id).ensure(PlanDescriptionTemplate._sectionId));
try {
this.entityManager.reloadTenantFilters();
} catch (InvalidApplicationException e) {
throw new RuntimeException(e);
}
} finally {
try {
this.entityManager.reloadTenantFilters();
} catch (InvalidApplicationException e) {
throw new RuntimeException(e);
}
}
} else {
q =this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().collect(Collectors.toList()));
items = q.collectAs(new BaseFieldSet().ensure(PlanDescriptionTemplate._id).ensure(PlanDescriptionTemplate._sectionId));
}
for (PlanDescriptionTemplateEntity item : items){
itemMap.put(item.getId(), item.getSectionId());
}