add no tracking
This commit is contained in:
parent
86aff14a64
commit
b734606141
|
@ -1,5 +1,7 @@
|
||||||
package org.opencdmp.authorization.authorizationcontentresolver;
|
package org.opencdmp.authorization.authorizationcontentresolver;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import org.opencdmp.authorization.AffiliatedResource;
|
import org.opencdmp.authorization.AffiliatedResource;
|
||||||
import org.opencdmp.authorization.PermissionNameProvider;
|
import org.opencdmp.authorization.PermissionNameProvider;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
@ -9,14 +11,12 @@ import org.opencdmp.data.DescriptionEntity;
|
||||||
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
||||||
import org.opencdmp.data.DmpEntity;
|
import org.opencdmp.data.DmpEntity;
|
||||||
import org.opencdmp.data.DmpUserEntity;
|
import org.opencdmp.data.DmpUserEntity;
|
||||||
import org.opencdmp.model.description.Description;
|
|
||||||
import org.opencdmp.model.DmpDescriptionTemplate;
|
import org.opencdmp.model.DmpDescriptionTemplate;
|
||||||
import org.opencdmp.model.DmpUser;
|
import org.opencdmp.model.DmpUser;
|
||||||
|
import org.opencdmp.model.description.Description;
|
||||||
import org.opencdmp.query.DescriptionQuery;
|
import org.opencdmp.query.DescriptionQuery;
|
||||||
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
||||||
import org.opencdmp.query.DmpUserQuery;
|
import org.opencdmp.query.DmpUserQuery;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.context.annotation.RequestScope;
|
import org.springframework.web.context.annotation.RequestScope;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getPermissionNames() {
|
public List<String> getPermissionNames() {
|
||||||
return permissionNameProvider.getPermissions();
|
return this.permissionNameProvider.getPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,12 +56,12 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
|
||||||
for (UUID id : ids){
|
for (UUID id : ids){
|
||||||
affiliatedResources.put(id, new AffiliatedResource());
|
affiliatedResources.put(id, new AffiliatedResource());
|
||||||
}
|
}
|
||||||
if (userId == null || !userScope.isSet()) return affiliatedResources;
|
if (userId == null || !this.userScope.isSet()) return affiliatedResources;
|
||||||
|
|
||||||
List<UUID> idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, DmpEntity.class.getSimpleName());
|
List<UUID> idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, DmpEntity.class.getSimpleName());
|
||||||
if (idsToResolve.isEmpty()) return affiliatedResources;
|
if (idsToResolve.isEmpty()) return affiliatedResources;
|
||||||
|
|
||||||
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).dmpIds(ids).sectionIsEmpty(true).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._role).ensure(DmpUser._dmp));
|
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(ids).sectionIsEmpty(true).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._role).ensure(DmpUser._dmp));
|
||||||
|
|
||||||
for (DmpUserEntity dmpUser : dmpUsers){
|
for (DmpUserEntity dmpUser : dmpUsers){
|
||||||
affiliatedResources.get(dmpUser.getDmpId()).getDmpUserRoles().add(dmpUser.getRole());
|
affiliatedResources.get(dmpUser.getDmpId()).getDmpUserRoles().add(dmpUser.getRole());
|
||||||
|
@ -82,16 +82,16 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
|
||||||
for (UUID id : ids){
|
for (UUID id : ids){
|
||||||
affiliatedResources.put(id, new AffiliatedResource());
|
affiliatedResources.put(id, new AffiliatedResource());
|
||||||
}
|
}
|
||||||
if (userId == null || !userScope.isSet()) return affiliatedResources;
|
if (userId == null || !this.userScope.isSet()) return affiliatedResources;
|
||||||
|
|
||||||
List<UUID> idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, DescriptionEntity.class.getSimpleName());
|
List<UUID> idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, DescriptionEntity.class.getSimpleName());
|
||||||
if (idsToResolve.isEmpty()) return affiliatedResources;
|
if (idsToResolve.isEmpty()) return affiliatedResources;
|
||||||
|
|
||||||
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).ids(ids).collectAs(new BaseFieldSet().ensure(Description._id).ensure(Description._dmpDescriptionTemplate).ensure(Description._dmp));
|
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(ids).collectAs(new BaseFieldSet().ensure(Description._id).ensure(Description._dmpDescriptionTemplate).ensure(Description._dmp));
|
||||||
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).ids(descriptionEntities.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().toList()).collectAs(new BaseFieldSet().ensure(DmpDescriptionTemplate._id).ensure(DmpDescriptionTemplate._sectionId));
|
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().ids(descriptionEntities.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().toList()).collectAs(new BaseFieldSet().ensure(DmpDescriptionTemplate._id).ensure(DmpDescriptionTemplate._sectionId));
|
||||||
Map<UUID, DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntityMap = dmpDescriptionTemplateEntities == null ? new HashMap<>() : dmpDescriptionTemplateEntities.stream().collect(Collectors.toMap(DmpDescriptionTemplateEntity::getId, x-> x));
|
Map<UUID, DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntityMap = dmpDescriptionTemplateEntities == null ? new HashMap<>() : dmpDescriptionTemplateEntities.stream().collect(Collectors.toMap(DmpDescriptionTemplateEntity::getId, x-> x));
|
||||||
|
|
||||||
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).descriptionIds(ids).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._role).ensure(DmpUser._sectionId).ensure(DmpUser._dmp));
|
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().descriptionIds(ids).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._role).ensure(DmpUser._sectionId).ensure(DmpUser._dmp));
|
||||||
Map<UUID, List<DmpUserEntity>> dmpUsersMap = dmpUsers.stream().collect(Collectors.groupingBy(DmpUserEntity::getDmpId));
|
Map<UUID, List<DmpUserEntity>> dmpUsersMap = dmpUsers.stream().collect(Collectors.groupingBy(DmpUserEntity::getDmpId));
|
||||||
|
|
||||||
for (DescriptionEntity description : descriptionEntities){
|
for (DescriptionEntity description : descriptionEntities){
|
||||||
|
@ -123,9 +123,9 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
|
||||||
for (UUID id : sectionIds){
|
for (UUID id : sectionIds){
|
||||||
affiliatedResources.put(id, new AffiliatedResource());
|
affiliatedResources.put(id, new AffiliatedResource());
|
||||||
}
|
}
|
||||||
if (userId == null || !userScope.isSet()) return affiliatedResources;
|
if (userId == null || !this.userScope.isSet()) return affiliatedResources;
|
||||||
|
|
||||||
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmpId).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._role).ensure(DmpUser._sectionId).ensure(DmpUser._dmp));
|
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(dmpId).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._role).ensure(DmpUser._sectionId).ensure(DmpUser._dmp));
|
||||||
|
|
||||||
for (UUID sectionId : sectionIds.stream().distinct().toList()){
|
for (UUID sectionId : sectionIds.stream().distinct().toList()){
|
||||||
List<DmpUserEntity> dmpSectionUsers = dmpUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList();
|
List<DmpUserEntity> dmpSectionUsers = dmpUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList();
|
||||||
|
|
|
@ -1,25 +1,28 @@
|
||||||
package org.opencdmp.elastic.elasticbuilder;
|
package org.opencdmp.elastic.elasticbuilder;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.data.DescriptionEntity;
|
import org.opencdmp.data.DescriptionEntity;
|
||||||
import org.opencdmp.data.DescriptionReferenceEntity;
|
import org.opencdmp.data.DescriptionReferenceEntity;
|
||||||
import org.opencdmp.data.DescriptionTagEntity;
|
import org.opencdmp.data.DescriptionTagEntity;
|
||||||
import org.opencdmp.elastic.data.DescriptionElasticEntity;
|
import org.opencdmp.elastic.data.DescriptionElasticEntity;
|
||||||
import org.opencdmp.elastic.data.nested.*;
|
import org.opencdmp.elastic.data.nested.NestedDescriptionTemplateElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedDmpElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedReferenceElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedTagElasticEntity;
|
||||||
import org.opencdmp.elastic.elasticbuilder.nested.NestedDescriptionTemplateElasticBuilder;
|
import org.opencdmp.elastic.elasticbuilder.nested.NestedDescriptionTemplateElasticBuilder;
|
||||||
import org.opencdmp.elastic.elasticbuilder.nested.NestedDmpElasticBuilder;
|
import org.opencdmp.elastic.elasticbuilder.nested.NestedDmpElasticBuilder;
|
||||||
import org.opencdmp.elastic.elasticbuilder.nested.NestedReferenceElasticBuilder;
|
import org.opencdmp.elastic.elasticbuilder.nested.NestedReferenceElasticBuilder;
|
||||||
import org.opencdmp.elastic.elasticbuilder.nested.NestedTagElasticBuilder;
|
import org.opencdmp.elastic.elasticbuilder.nested.NestedTagElasticBuilder;
|
||||||
import org.opencdmp.model.*;
|
import org.opencdmp.model.DescriptionTag;
|
||||||
import org.opencdmp.model.descriptionreference.DescriptionReference;
|
import org.opencdmp.model.descriptionreference.DescriptionReference;
|
||||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||||
import org.opencdmp.model.dmp.Dmp;
|
import org.opencdmp.model.dmp.Dmp;
|
||||||
import org.opencdmp.query.*;
|
import org.opencdmp.query.*;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -30,7 +33,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionElasticEntity, DescriptionEntity> {
|
public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionElasticEntity, DescriptionEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -82,10 +85,10 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
|
||||||
if (data.isEmpty()) return null;
|
if (data.isEmpty()) return null;
|
||||||
this.logger.debug("checking related - {}", DescriptionReference.class.getSimpleName());
|
this.logger.debug("checking related - {}", DescriptionReference.class.getSimpleName());
|
||||||
|
|
||||||
DescriptionReferenceQuery associationQuery = this.queryFactory.query(DescriptionReferenceQuery.class).descriptionIds(data.stream().map(DescriptionEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
DescriptionReferenceQuery associationQuery = this.queryFactory.query(DescriptionReferenceQuery.class).disableTracking().descriptionIds(data.stream().map(DescriptionEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
||||||
List<DescriptionReferenceEntity> associationEntities = associationQuery.collect();
|
List<DescriptionReferenceEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).ids(associationEntities.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).disableTracking().ids(associationEntities.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
||||||
Map<UUID, NestedReferenceElasticEntity> itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId);
|
Map<UUID, NestedReferenceElasticEntity> itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId);
|
||||||
|
|
||||||
Map<UUID, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
Map<UUID, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
||||||
|
@ -102,10 +105,10 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
|
||||||
if (data.isEmpty()) return null;
|
if (data.isEmpty()) return null;
|
||||||
this.logger.debug("checking related - {}", DescriptionTag.class.getSimpleName());
|
this.logger.debug("checking related - {}", DescriptionTag.class.getSimpleName());
|
||||||
|
|
||||||
DescriptionTagQuery associationQuery = this.queryFactory.query(DescriptionTagQuery.class).descriptionIds(data.stream().map(DescriptionEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
DescriptionTagQuery associationQuery = this.queryFactory.query(DescriptionTagQuery.class).disableTracking().descriptionIds(data.stream().map(DescriptionEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
||||||
List<DescriptionTagEntity> associationEntities = associationQuery.collect();
|
List<DescriptionTagEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
TagQuery query = this.queryFactory.query(TagQuery.class).isActive(IsActive.Active).ids(associationEntities.stream().map(DescriptionTagEntity::getTagId).distinct().collect(Collectors.toList()));
|
TagQuery query = this.queryFactory.query(TagQuery.class).disableTracking().isActive(IsActive.Active).ids(associationEntities.stream().map(DescriptionTagEntity::getTagId).distinct().collect(Collectors.toList()));
|
||||||
Map<UUID, NestedTagElasticEntity> itemMapById = this.builderFactory.builder(NestedTagElasticBuilder.class).asForeignKey(query, NestedTagElasticEntity::getId);
|
Map<UUID, NestedTagElasticEntity> itemMapById = this.builderFactory.builder(NestedTagElasticBuilder.class).asForeignKey(query, NestedTagElasticEntity::getId);
|
||||||
|
|
||||||
Map<UUID, List<NestedTagElasticEntity>> itemMap = new HashMap<>();
|
Map<UUID, List<NestedTagElasticEntity>> itemMap = new HashMap<>();
|
||||||
|
@ -124,7 +127,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
|
||||||
this.logger.debug("checking related - {}", Dmp.class.getSimpleName());
|
this.logger.debug("checking related - {}", Dmp.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, NestedDmpElasticEntity> itemMap;
|
Map<UUID, NestedDmpElasticEntity> itemMap;
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().isActive(IsActive.Active).ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(NestedDmpElasticBuilder.class).asForeignKey(q, NestedDmpElasticEntity::getId);
|
itemMap = this.builderFactory.builder(NestedDmpElasticBuilder.class).asForeignKey(q, NestedDmpElasticEntity::getId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
@ -136,7 +139,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
|
||||||
this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName());
|
this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, NestedDescriptionTemplateElasticEntity> itemMap;
|
Map<UUID, NestedDescriptionTemplateElasticEntity> itemMap;
|
||||||
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).isActive(IsActive.Active).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().isActive(IsActive.Active).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(NestedDescriptionTemplateElasticBuilder.class).asForeignKey(q, NestedDescriptionTemplateElasticEntity::getId);
|
itemMap = this.builderFactory.builder(NestedDescriptionTemplateElasticBuilder.class).asForeignKey(q, NestedDescriptionTemplateElasticEntity::getId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
|
|
@ -1,17 +1,23 @@
|
||||||
package org.opencdmp.elastic.elasticbuilder;
|
package org.opencdmp.elastic.elasticbuilder;
|
||||||
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.*;
|
|
||||||
import org.opencdmp.elastic.data.DmpElasticEntity;
|
|
||||||
import org.opencdmp.elastic.data.nested.*;
|
|
||||||
import org.opencdmp.elastic.elasticbuilder.nested.*;
|
|
||||||
import org.opencdmp.model.dmpreference.DmpReference;
|
|
||||||
import org.opencdmp.query.*;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.*;
|
||||||
|
import org.opencdmp.elastic.data.DmpElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedCollaboratorElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedDescriptionElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedDoiElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedReferenceElasticEntity;
|
||||||
|
import org.opencdmp.elastic.elasticbuilder.nested.NestedCollaboratorElasticBuilder;
|
||||||
|
import org.opencdmp.elastic.elasticbuilder.nested.NestedDescriptionElasticBuilder;
|
||||||
|
import org.opencdmp.elastic.elasticbuilder.nested.NestedDoiElasticBuilder;
|
||||||
|
import org.opencdmp.elastic.elasticbuilder.nested.NestedReferenceElasticBuilder;
|
||||||
|
import org.opencdmp.model.dmpreference.DmpReference;
|
||||||
|
import org.opencdmp.query.*;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -22,7 +28,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpEntity> {
|
public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -79,10 +85,10 @@ public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpE
|
||||||
if (data.isEmpty()) return null;
|
if (data.isEmpty()) return null;
|
||||||
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
||||||
|
|
||||||
DmpReferenceQuery associationQuery = this.queryFactory.query(DmpReferenceQuery.class).dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active);
|
DmpReferenceQuery associationQuery = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active);
|
||||||
List<DmpReferenceEntity> associationEntities = associationQuery.collect();
|
List<DmpReferenceEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).ids(associationEntities.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).ids(associationEntities.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
||||||
Map<UUID, NestedReferenceElasticEntity> itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId);
|
Map<UUID, NestedReferenceElasticEntity> itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId);
|
||||||
|
|
||||||
Map<UUID, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
Map<UUID, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
||||||
|
@ -101,7 +107,7 @@ public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpE
|
||||||
this.logger.debug("checking related - {}", DescriptionEntity.class.getSimpleName());
|
this.logger.debug("checking related - {}", DescriptionEntity.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, List<NestedDescriptionElasticEntity>> itemMap;
|
Map<UUID, List<NestedDescriptionElasticEntity>> itemMap;
|
||||||
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).isActive(IsActive.Active).dmpSubQuery(this.queryFactory.query(DmpQuery.class).ids(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())));
|
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(this.queryFactory.query(DmpQuery.class).ids(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())));
|
||||||
itemMap = this.builderFactory.builder(NestedDescriptionElasticBuilder.class).asMasterKey(q, NestedDescriptionElasticEntity::getDmpId);
|
itemMap = this.builderFactory.builder(NestedDescriptionElasticBuilder.class).asMasterKey(q, NestedDescriptionElasticEntity::getDmpId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
@ -112,7 +118,7 @@ public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpE
|
||||||
return null;
|
return null;
|
||||||
this.logger.debug("checking related - {}", DmpUserEntity.class.getSimpleName());
|
this.logger.debug("checking related - {}", DmpUserEntity.class.getSimpleName());
|
||||||
|
|
||||||
DmpUserQuery associationQuery = this.queryFactory.query(DmpUserQuery.class).dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active);
|
DmpUserQuery associationQuery = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active);
|
||||||
List<DmpUserEntity> associationEntities = associationQuery.collect();
|
List<DmpUserEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
Map<UUID, NestedCollaboratorElasticEntity> itemMapById = this.builderFactory.builder(NestedCollaboratorElasticBuilder.class).asForeignKey(associationEntities, NestedCollaboratorElasticEntity::getId);
|
Map<UUID, NestedCollaboratorElasticEntity> itemMapById = this.builderFactory.builder(NestedCollaboratorElasticBuilder.class).asForeignKey(associationEntities, NestedCollaboratorElasticEntity::getId);
|
||||||
|
@ -131,7 +137,7 @@ public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpE
|
||||||
return null;
|
return null;
|
||||||
this.logger.debug("checking related - {}", EntityDoiEntity.class.getSimpleName());
|
this.logger.debug("checking related - {}", EntityDoiEntity.class.getSimpleName());
|
||||||
|
|
||||||
EntityDoiQuery associationQuery = this.queryFactory.query(EntityDoiQuery.class).entityIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
EntityDoiQuery associationQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().entityIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
||||||
List<EntityDoiEntity> associationEntities = associationQuery.collect();
|
List<EntityDoiEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
Map<UUID, NestedDoiElasticEntity> itemMapById = this.builderFactory.builder(NestedDoiElasticBuilder.class).asForeignKey(associationEntities, NestedDoiElasticEntity::getId);
|
Map<UUID, NestedDoiElasticEntity> itemMapById = this.builderFactory.builder(NestedDoiElasticBuilder.class).asForeignKey(associationEntities, NestedDoiElasticEntity::getId);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class NestedCollaboratorElasticBuilder extends BaseElasticBuilder<NestedC
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|
||||||
List<NestedCollaboratorElasticEntity> models = new ArrayList<>();
|
List<NestedCollaboratorElasticEntity> models = new ArrayList<>();
|
||||||
Map<UUID, String> userNameMap = this.queryFactory.query(UserQuery.class).isActive(IsActive.Active).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList())).collectAs(new BaseFieldSet().ensure(User._id).ensure(User._name))
|
Map<UUID, String> userNameMap = this.queryFactory.query(UserQuery.class).disableTracking().isActive(IsActive.Active).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList())).collectAs(new BaseFieldSet().ensure(User._id).ensure(User._name))
|
||||||
.stream().collect(Collectors.toMap(UserEntity::getId, UserEntity::getName));
|
.stream().collect(Collectors.toMap(UserEntity::getId, UserEntity::getName));
|
||||||
for (DmpUserEntity d : data) {
|
for (DmpUserEntity d : data) {
|
||||||
NestedCollaboratorElasticEntity m = new NestedCollaboratorElasticEntity();
|
NestedCollaboratorElasticEntity m = new NestedCollaboratorElasticEntity();
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.opencdmp.elastic.elasticbuilder.nested;
|
package org.opencdmp.elastic.elasticbuilder.nested;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.data.DescriptionEntity;
|
import org.opencdmp.data.DescriptionEntity;
|
||||||
|
@ -10,14 +14,10 @@ import org.opencdmp.elastic.data.nested.NestedDescriptionTemplateElasticEntity;
|
||||||
import org.opencdmp.elastic.data.nested.NestedReferenceElasticEntity;
|
import org.opencdmp.elastic.data.nested.NestedReferenceElasticEntity;
|
||||||
import org.opencdmp.elastic.data.nested.NestedTagElasticEntity;
|
import org.opencdmp.elastic.data.nested.NestedTagElasticEntity;
|
||||||
import org.opencdmp.elastic.elasticbuilder.BaseElasticBuilder;
|
import org.opencdmp.elastic.elasticbuilder.BaseElasticBuilder;
|
||||||
import org.opencdmp.model.descriptionreference.DescriptionReference;
|
|
||||||
import org.opencdmp.model.DescriptionTag;
|
import org.opencdmp.model.DescriptionTag;
|
||||||
|
import org.opencdmp.model.descriptionreference.DescriptionReference;
|
||||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||||
import org.opencdmp.query.*;
|
import org.opencdmp.query.*;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -28,7 +28,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class NestedDescriptionElasticBuilder extends BaseElasticBuilder<NestedDescriptionElasticEntity, DescriptionEntity> {
|
public class NestedDescriptionElasticBuilder extends BaseElasticBuilder<NestedDescriptionElasticEntity, DescriptionEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -74,10 +74,10 @@ public class NestedDescriptionElasticBuilder extends BaseElasticBuilder<NestedDe
|
||||||
if (data.isEmpty()) return null;
|
if (data.isEmpty()) return null;
|
||||||
this.logger.debug("checking related - {}", DescriptionReference.class.getSimpleName());
|
this.logger.debug("checking related - {}", DescriptionReference.class.getSimpleName());
|
||||||
|
|
||||||
DescriptionReferenceQuery associationQuery = this.queryFactory.query(DescriptionReferenceQuery.class).descriptionIds(data.stream().map(DescriptionEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
DescriptionReferenceQuery associationQuery = this.queryFactory.query(DescriptionReferenceQuery.class).disableTracking().descriptionIds(data.stream().map(DescriptionEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
||||||
List<DescriptionReferenceEntity> associationEntities = associationQuery.collect();
|
List<DescriptionReferenceEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).ids(associationEntities.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).ids(associationEntities.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
||||||
Map<UUID, NestedReferenceElasticEntity> itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId);
|
Map<UUID, NestedReferenceElasticEntity> itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId);
|
||||||
|
|
||||||
Map<UUID, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
Map<UUID, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
||||||
|
@ -94,10 +94,10 @@ public class NestedDescriptionElasticBuilder extends BaseElasticBuilder<NestedDe
|
||||||
if (data.isEmpty()) return null;
|
if (data.isEmpty()) return null;
|
||||||
this.logger.debug("checking related - {}", DescriptionTag.class.getSimpleName());
|
this.logger.debug("checking related - {}", DescriptionTag.class.getSimpleName());
|
||||||
|
|
||||||
DescriptionTagQuery associationQuery = this.queryFactory.query(DescriptionTagQuery.class).descriptionIds(data.stream().map(DescriptionEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
DescriptionTagQuery associationQuery = this.queryFactory.query(DescriptionTagQuery.class).disableTracking().descriptionIds(data.stream().map(DescriptionEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
||||||
List<DescriptionTagEntity> associationEntities = associationQuery.collect();
|
List<DescriptionTagEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
TagQuery query = this.queryFactory.query(TagQuery.class).isActive(IsActive.Active).ids(associationEntities.stream().map(DescriptionTagEntity::getTagId).distinct().collect(Collectors.toList()));
|
TagQuery query = this.queryFactory.query(TagQuery.class).disableTracking().isActive(IsActive.Active).ids(associationEntities.stream().map(DescriptionTagEntity::getTagId).distinct().collect(Collectors.toList()));
|
||||||
Map<UUID, NestedTagElasticEntity> itemMapById = this.builderFactory.builder(NestedTagElasticBuilder.class).asForeignKey(query, NestedTagElasticEntity::getId);
|
Map<UUID, NestedTagElasticEntity> itemMapById = this.builderFactory.builder(NestedTagElasticBuilder.class).asForeignKey(query, NestedTagElasticEntity::getId);
|
||||||
|
|
||||||
Map<UUID, List<NestedTagElasticEntity>> itemMap = new HashMap<>();
|
Map<UUID, List<NestedTagElasticEntity>> itemMap = new HashMap<>();
|
||||||
|
@ -116,7 +116,7 @@ public class NestedDescriptionElasticBuilder extends BaseElasticBuilder<NestedDe
|
||||||
this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName());
|
this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, NestedDescriptionTemplateElasticEntity> itemMap;
|
Map<UUID, NestedDescriptionTemplateElasticEntity> itemMap;
|
||||||
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).isActive(IsActive.Active).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().isActive(IsActive.Active).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(NestedDescriptionTemplateElasticBuilder.class).asForeignKey(q, NestedDescriptionTemplateElasticEntity::getId);
|
itemMap = this.builderFactory.builder(NestedDescriptionTemplateElasticBuilder.class).asForeignKey(q, NestedDescriptionTemplateElasticEntity::getId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
|
|
@ -1,22 +1,25 @@
|
||||||
package org.opencdmp.elastic.elasticbuilder.nested;
|
package org.opencdmp.elastic.elasticbuilder.nested;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.data.DmpEntity;
|
import org.opencdmp.data.DmpEntity;
|
||||||
import org.opencdmp.data.DmpReferenceEntity;
|
import org.opencdmp.data.DmpReferenceEntity;
|
||||||
import org.opencdmp.data.DmpUserEntity;
|
import org.opencdmp.data.DmpUserEntity;
|
||||||
import org.opencdmp.data.EntityDoiEntity;
|
import org.opencdmp.data.EntityDoiEntity;
|
||||||
import org.opencdmp.elastic.data.nested.*;
|
import org.opencdmp.elastic.data.nested.NestedCollaboratorElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedDmpElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedDoiElasticEntity;
|
||||||
|
import org.opencdmp.elastic.data.nested.NestedReferenceElasticEntity;
|
||||||
import org.opencdmp.elastic.elasticbuilder.BaseElasticBuilder;
|
import org.opencdmp.elastic.elasticbuilder.BaseElasticBuilder;
|
||||||
import org.opencdmp.model.dmpreference.DmpReference;
|
import org.opencdmp.model.dmpreference.DmpReference;
|
||||||
import org.opencdmp.query.DmpReferenceQuery;
|
import org.opencdmp.query.DmpReferenceQuery;
|
||||||
import org.opencdmp.query.DmpUserQuery;
|
import org.opencdmp.query.DmpUserQuery;
|
||||||
import org.opencdmp.query.EntityDoiQuery;
|
import org.opencdmp.query.EntityDoiQuery;
|
||||||
import org.opencdmp.query.ReferenceQuery;
|
import org.opencdmp.query.ReferenceQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -27,7 +30,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class NestedDmpElasticBuilder extends BaseElasticBuilder<NestedDmpElasticEntity, DmpEntity> {
|
public class NestedDmpElasticBuilder extends BaseElasticBuilder<NestedDmpElasticEntity, DmpEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -80,10 +83,10 @@ public class NestedDmpElasticBuilder extends BaseElasticBuilder<NestedDmpElastic
|
||||||
if (data.isEmpty()) return null;
|
if (data.isEmpty()) return null;
|
||||||
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
||||||
|
|
||||||
DmpReferenceQuery associationQuery = this.queryFactory.query(DmpReferenceQuery.class).dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active);
|
DmpReferenceQuery associationQuery = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active);
|
||||||
List<DmpReferenceEntity> associationEntities = associationQuery.collect();
|
List<DmpReferenceEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).ids(associationEntities.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).ids(associationEntities.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
||||||
Map<UUID, NestedReferenceElasticEntity> itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId);
|
Map<UUID, NestedReferenceElasticEntity> itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId);
|
||||||
|
|
||||||
Map<UUID, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
Map<UUID, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
||||||
|
@ -101,7 +104,7 @@ public class NestedDmpElasticBuilder extends BaseElasticBuilder<NestedDmpElastic
|
||||||
return null;
|
return null;
|
||||||
this.logger.debug("checking related - {}", DmpUserEntity.class.getSimpleName());
|
this.logger.debug("checking related - {}", DmpUserEntity.class.getSimpleName());
|
||||||
|
|
||||||
DmpUserQuery associationQuery = this.queryFactory.query(DmpUserQuery.class).dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active);
|
DmpUserQuery associationQuery = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active);
|
||||||
List<DmpUserEntity> associationEntities = associationQuery.collect();
|
List<DmpUserEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
Map<UUID, NestedCollaboratorElasticEntity> itemMapById = this.builderFactory.builder(NestedCollaboratorElasticBuilder.class).asForeignKey(associationEntities, NestedCollaboratorElasticEntity::getId);
|
Map<UUID, NestedCollaboratorElasticEntity> itemMapById = this.builderFactory.builder(NestedCollaboratorElasticBuilder.class).asForeignKey(associationEntities, NestedCollaboratorElasticEntity::getId);
|
||||||
|
@ -120,7 +123,7 @@ public class NestedDmpElasticBuilder extends BaseElasticBuilder<NestedDmpElastic
|
||||||
return null;
|
return null;
|
||||||
this.logger.debug("checking related - {}", EntityDoiEntity.class.getSimpleName());
|
this.logger.debug("checking related - {}", EntityDoiEntity.class.getSimpleName());
|
||||||
|
|
||||||
EntityDoiQuery associationQuery = this.queryFactory.query(EntityDoiQuery.class).entityIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
EntityDoiQuery associationQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().entityIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active);
|
||||||
List<EntityDoiEntity> associationEntities = associationQuery.collect();
|
List<EntityDoiEntity> associationEntities = associationQuery.collect();
|
||||||
|
|
||||||
Map<UUID, NestedDoiElasticEntity> itemMapById = this.builderFactory.builder(NestedDoiElasticBuilder.class).asForeignKey(associationEntities, NestedDoiElasticEntity::getId);
|
Map<UUID, NestedDoiElasticEntity> itemMapById = this.builderFactory.builder(NestedDoiElasticBuilder.class).asForeignKey(associationEntities, NestedDoiElasticEntity::getId);
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package org.opencdmp.integrationevent.outbox.annotationentityremoval;
|
package org.opencdmp.integrationevent.outbox.annotationentityremoval;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
import org.opencdmp.data.DescriptionEntity;
|
import org.opencdmp.data.DescriptionEntity;
|
||||||
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
||||||
import org.opencdmp.integrationevent.outbox.OutboxService;
|
import org.opencdmp.integrationevent.outbox.OutboxService;
|
||||||
import org.opencdmp.model.description.Description;
|
import org.opencdmp.model.description.Description;
|
||||||
import org.opencdmp.query.DescriptionQuery;
|
import org.opencdmp.query.DescriptionQuery;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
@ -20,7 +20,7 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements AnnotationEntityRemovalIntegrationEventHandler {
|
public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements AnnotationEntityRemovalIntegrationEventHandler {
|
||||||
|
|
||||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(AnnotationEntityRemovalIntegrationEventHandlerImpl.class));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(AnnotationEntityRemovalIntegrationEventHandlerImpl.class));
|
||||||
|
@ -41,7 +41,7 @@ public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements Annot
|
||||||
message.setMessageId(UUID.randomUUID());
|
message.setMessageId(UUID.randomUUID());
|
||||||
message.setType(OutboxIntegrationEvent.ANNOTATION_ENTITY_REMOVE);
|
message.setType(OutboxIntegrationEvent.ANNOTATION_ENTITY_REMOVE);
|
||||||
message.setEvent(event);
|
message.setEvent(event);
|
||||||
if (this.tenantScope.isSet()) message.setTenantId(tenantScope.getTenant());
|
if (this.tenantScope.isSet()) message.setTenantId(this.tenantScope.getTenant());
|
||||||
this.outboxService.publish(message);
|
this.outboxService.publish(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements Annot
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleDmp(UUID dmpId) throws InvalidApplicationException {
|
public void handleDmp(UUID dmpId) throws InvalidApplicationException {
|
||||||
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).dmpIds(dmpId).collectAs(new BaseFieldSet().ensure(Description._id));
|
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().dmpIds(dmpId).collectAs(new BaseFieldSet().ensure(Description._id));
|
||||||
|
|
||||||
AnnotationEntitiesRemovalIntegrationEvent event = new AnnotationEntitiesRemovalIntegrationEvent();
|
AnnotationEntitiesRemovalIntegrationEvent event = new AnnotationEntitiesRemovalIntegrationEvent();
|
||||||
event.setEntityIds(new ArrayList<>());
|
event.setEntityIds(new ArrayList<>());
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package org.opencdmp.integrationevent.outbox.annotationentitytouch;
|
package org.opencdmp.integrationevent.outbox.annotationentitytouch;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.data.DescriptionEntity;
|
import org.opencdmp.data.DescriptionEntity;
|
||||||
import org.opencdmp.data.DmpUserEntity;
|
import org.opencdmp.data.DmpUserEntity;
|
||||||
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
||||||
import org.opencdmp.integrationevent.outbox.OutboxService;
|
import org.opencdmp.integrationevent.outbox.OutboxService;
|
||||||
import org.opencdmp.model.description.Description;
|
|
||||||
import org.opencdmp.model.DmpUser;
|
import org.opencdmp.model.DmpUser;
|
||||||
|
import org.opencdmp.model.description.Description;
|
||||||
import org.opencdmp.query.DescriptionQuery;
|
import org.opencdmp.query.DescriptionQuery;
|
||||||
import org.opencdmp.query.DmpUserQuery;
|
import org.opencdmp.query.DmpUserQuery;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements AnnotationEntityTouchedIntegrationEventHandler {
|
public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements AnnotationEntityTouchedIntegrationEventHandler {
|
||||||
|
|
||||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(AnnotationEntityTouchedIntegrationEventHandlerImpl.class));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(AnnotationEntityTouchedIntegrationEventHandlerImpl.class));
|
||||||
|
@ -47,9 +47,9 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleDescription(UUID descriptionId) {
|
public void handleDescription(UUID descriptionId) {
|
||||||
DescriptionEntity entity = this.queryFactory.query(DescriptionQuery.class).ids(descriptionId).firstAs(new BaseFieldSet().ensure(Description._dmp).ensure(DescriptionEntity._tenantId));
|
DescriptionEntity entity = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(descriptionId).firstAs(new BaseFieldSet().ensure(Description._dmp).ensure(DescriptionEntity._tenantId));
|
||||||
if (entity == null) return;
|
if (entity == null) return;
|
||||||
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).dmpIds(entity.getDmpId()).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._user));
|
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(entity.getDmpId()).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._user));
|
||||||
|
|
||||||
AnnotationEntitiesTouchedIntegrationEvent event = new AnnotationEntitiesTouchedIntegrationEvent();
|
AnnotationEntitiesTouchedIntegrationEvent event = new AnnotationEntitiesTouchedIntegrationEvent();
|
||||||
event.setEvents(List.of(this.buildEventItem(descriptionId, dmpUsers)));
|
event.setEvents(List.of(this.buildEventItem(descriptionId, dmpUsers)));
|
||||||
|
@ -59,9 +59,9 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleDmp(UUID dmpId) {
|
public void handleDmp(UUID dmpId) {
|
||||||
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).dmpIds(dmpId).collectAs(new BaseFieldSet().ensure(Description._id));
|
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().dmpIds(dmpId).collectAs(new BaseFieldSet().ensure(Description._id));
|
||||||
if (descriptionEntities == null || descriptionEntities.isEmpty()) return;
|
if (descriptionEntities == null || descriptionEntities.isEmpty()) return;
|
||||||
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmpId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._user));
|
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(dmpId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._user));
|
||||||
|
|
||||||
AnnotationEntitiesTouchedIntegrationEvent event = new AnnotationEntitiesTouchedIntegrationEvent();
|
AnnotationEntitiesTouchedIntegrationEvent event = new AnnotationEntitiesTouchedIntegrationEvent();
|
||||||
event.setEvents(new ArrayList<>());
|
event.setEvents(new ArrayList<>());
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
package org.opencdmp.integrationevent.outbox.usertouched;
|
package org.opencdmp.integrationevent.outbox.usertouched;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.commons.JsonHandlingService;
|
import org.opencdmp.commons.JsonHandlingService;
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
import org.opencdmp.commons.types.user.AdditionalInfoEntity;
|
import org.opencdmp.commons.types.user.AdditionalInfoEntity;
|
||||||
import org.opencdmp.data.*;
|
import org.opencdmp.data.*;
|
||||||
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
||||||
import org.opencdmp.integrationevent.outbox.OutboxService;
|
import org.opencdmp.integrationevent.outbox.OutboxService;
|
||||||
import org.opencdmp.model.*;
|
import org.opencdmp.model.TenantUser;
|
||||||
|
import org.opencdmp.model.UserContactInfo;
|
||||||
import org.opencdmp.model.user.User;
|
import org.opencdmp.model.user.User;
|
||||||
import org.opencdmp.model.usercredential.UserCredential;
|
import org.opencdmp.model.usercredential.UserCredential;
|
||||||
import org.opencdmp.query.*;
|
import org.opencdmp.query.TenantUserQuery;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import org.opencdmp.query.UserContactInfoQuery;
|
||||||
import gr.cite.tools.exception.MyNotFoundException;
|
import org.opencdmp.query.UserCredentialQuery;
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
import org.opencdmp.query.UserQuery;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
|
@ -27,7 +31,7 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Component("outboxusertouchedintegrationeventhandler")
|
@Component("outboxusertouchedintegrationeventhandler")
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserTouchedIntegrationEventHandlerImpl implements UserTouchedIntegrationEventHandler {
|
public class UserTouchedIntegrationEventHandlerImpl implements UserTouchedIntegrationEventHandler {
|
||||||
|
|
||||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(UserTouchedIntegrationEventHandlerImpl.class));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(UserTouchedIntegrationEventHandlerImpl.class));
|
||||||
|
@ -54,22 +58,22 @@ public class UserTouchedIntegrationEventHandlerImpl implements UserTouchedIntegr
|
||||||
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
|
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
|
||||||
message.setMessageId(UUID.randomUUID());
|
message.setMessageId(UUID.randomUUID());
|
||||||
message.setType(OutboxIntegrationEvent.USER_TOUCH);
|
message.setType(OutboxIntegrationEvent.USER_TOUCH);
|
||||||
if (this.tenantScope.isSet()) message.setTenantId(tenantScope.getTenant());
|
if (this.tenantScope.isSet()) message.setTenantId(this.tenantScope.getTenant());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.entityManager.disableTenantFilters();
|
this.entityManager.disableTenantFilters();
|
||||||
|
|
||||||
UserEntity user = this.queryFactory.query(UserQuery.class).ids(userId)
|
UserEntity user = this.queryFactory.query(UserQuery.class).ids(userId).disableTracking()
|
||||||
.firstAs(new BaseFieldSet().ensure(User._name).ensure(User._additionalInfo));
|
.firstAs(new BaseFieldSet().ensure(User._name).ensure(User._additionalInfo));
|
||||||
if (user == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{userId, User.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
if (user == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{userId, User.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
List<UserContactInfoEntity> userContactInfoEntities = this.queryFactory.query(UserContactInfoQuery.class).userIds(userId)
|
List<UserContactInfoEntity> userContactInfoEntities = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().userIds(userId)
|
||||||
.collectAs(new BaseFieldSet().ensure(UserContactInfo._type).ensure(UserContactInfo._ordinal).ensure(UserContactInfo._value));
|
.collectAs(new BaseFieldSet().ensure(UserContactInfo._type).ensure(UserContactInfo._ordinal).ensure(UserContactInfo._value));
|
||||||
|
|
||||||
List<UserCredentialEntity> userCredentialEntities = this.queryFactory.query(UserCredentialQuery.class).userIds(userId)
|
List<UserCredentialEntity> userCredentialEntities = this.queryFactory.query(UserCredentialQuery.class).disableTracking().userIds(userId)
|
||||||
.collectAs(new BaseFieldSet().ensure(UserCredential._id, UserCredential._externalId));
|
.collectAs(new BaseFieldSet().ensure(UserCredential._id, UserCredential._externalId));
|
||||||
|
|
||||||
List<TenantUserEntity> tenantUserEntities = this.queryFactory.query(TenantUserQuery.class).userIds(userId)
|
List<TenantUserEntity> tenantUserEntities = this.queryFactory.query(TenantUserQuery.class).disableTracking().userIds(userId)
|
||||||
.collectAs(new BaseFieldSet().ensure(TenantUser._id, TenantUser._tenant));
|
.collectAs(new BaseFieldSet().ensure(TenantUser._id, TenantUser._tenant));
|
||||||
|
|
||||||
UserTouchedIntegrationEvent event = new UserTouchedIntegrationEvent();
|
UserTouchedIntegrationEvent event = new UserTouchedIntegrationEvent();
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.DescriptionTagEntity;
|
|
||||||
import org.opencdmp.model.builder.descriptionproperties.DescriptionBuilder;
|
|
||||||
import org.opencdmp.model.description.Description;
|
|
||||||
import org.opencdmp.model.DescriptionTag;
|
|
||||||
import org.opencdmp.model.Tag;
|
|
||||||
import org.opencdmp.query.DescriptionQuery;
|
|
||||||
import org.opencdmp.query.TagQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -17,6 +7,16 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.DescriptionTagEntity;
|
||||||
|
import org.opencdmp.model.DescriptionTag;
|
||||||
|
import org.opencdmp.model.Tag;
|
||||||
|
import org.opencdmp.model.builder.descriptionproperties.DescriptionBuilder;
|
||||||
|
import org.opencdmp.model.description.Description;
|
||||||
|
import org.opencdmp.query.DescriptionQuery;
|
||||||
|
import org.opencdmp.query.TagQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -27,7 +27,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionTagBuilder extends BaseBuilder<DescriptionTag, DescriptionTagEntity> {
|
public class DescriptionTagBuilder extends BaseBuilder<DescriptionTag, DescriptionTagEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -103,7 +103,7 @@ public class DescriptionTagBuilder extends BaseBuilder<DescriptionTag, Descripti
|
||||||
Description::getId);
|
Description::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tag._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tag._id);
|
||||||
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionTagEntity::getDescriptionId).distinct().collect(Collectors.toList()));
|
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionTagEntity::getDescriptionId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Description::getId);
|
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Description::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Description._id)) {
|
if (!fields.hasField(Description._id)) {
|
||||||
|
@ -133,7 +133,7 @@ public class DescriptionTagBuilder extends BaseBuilder<DescriptionTag, Descripti
|
||||||
Tag::getId);
|
Tag::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tag._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tag._id);
|
||||||
TagQuery q = this.queryFactory.query(TagQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionTagEntity::getTagId).distinct().collect(Collectors.toList()));
|
TagQuery q = this.queryFactory.query(TagQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionTagEntity::getTagId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(TagBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Tag::getId);
|
itemMap = this.builderFactory.builder(TagBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Tag::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Tag._id)) {
|
if (!fields.hasField(Tag._id)) {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.ContactInfoType;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.UserEntity;
|
|
||||||
import org.opencdmp.model.*;
|
|
||||||
import org.opencdmp.model.user.User;
|
|
||||||
import org.opencdmp.query.UserContactInfoQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -14,6 +7,14 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.ContactInfoType;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.UserEntity;
|
||||||
|
import org.opencdmp.model.DmpAssociatedUser;
|
||||||
|
import org.opencdmp.model.UserContactInfo;
|
||||||
|
import org.opencdmp.model.user.User;
|
||||||
|
import org.opencdmp.query.UserContactInfoQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -24,7 +25,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpAssociatedUserBuilder extends BaseBuilder<DmpAssociatedUser, UserEntity> {
|
public class DmpAssociatedUserBuilder extends BaseBuilder<DmpAssociatedUser, UserEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -82,7 +83,7 @@ public class DmpAssociatedUserBuilder extends BaseBuilder<DmpAssociatedUser, Use
|
||||||
|
|
||||||
Map<UUID, List<UserContactInfo>> itemMap;
|
Map<UUID, List<UserContactInfo>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserContactInfo._user, User._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserContactInfo._user, User._id));
|
||||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).authorize(this.authorize).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().authorize(this.authorize).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserContactInfoBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
itemMap = this.builderFactory.builder(UserContactInfoBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(UserContactInfo._user, User._id))) {
|
if (!fields.hasField(this.asIndexer(UserContactInfo._user, User._id))) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder<DmpDescriptionTem
|
||||||
Dmp::getId);
|
Dmp::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).ids(data.stream().map(DmpDescriptionTemplateEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpDescriptionTemplateEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Dmp._id)) {
|
if (!fields.hasField(Dmp._id)) {
|
||||||
|
@ -126,7 +126,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder<DmpDescriptionTem
|
||||||
|
|
||||||
Map<UUID, List<DescriptionTemplate>> itemMap;
|
Map<UUID, List<DescriptionTemplate>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._groupId);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._groupId);
|
||||||
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).groupIds(data.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).groupIds(data.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, DescriptionTemplate::getGroupId);
|
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, DescriptionTemplate::getGroupId);
|
||||||
|
|
||||||
if (!fields.hasField(DescriptionTemplate._groupId)) {
|
if (!fields.hasField(DescriptionTemplate._groupId)) {
|
||||||
|
@ -155,7 +155,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder<DmpDescriptionTem
|
||||||
DescriptionTemplate::getGroupId);
|
DescriptionTemplate::getGroupId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id, DescriptionTemplate._groupId);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id, DescriptionTemplate._groupId);
|
||||||
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).versionStatuses(DescriptionTemplateVersionStatus.Current).groupIds(data.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).versionStatuses(DescriptionTemplateVersionStatus.Current).groupIds(data.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DescriptionTemplate::getGroupId);
|
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DescriptionTemplate::getGroupId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(DescriptionTemplate._groupId)) {
|
if (!fields.hasField(DescriptionTemplate._groupId)) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class DmpUserBuilder extends BaseBuilder<DmpUser, DmpUserEntity>{
|
||||||
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(DmpUserEntity::getUserId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpUserEntity::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)) {
|
||||||
|
@ -132,7 +132,7 @@ public class DmpUserBuilder extends BaseBuilder<DmpUser, DmpUserEntity>{
|
||||||
Dmp::getId);
|
Dmp::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Dmp._id)) {
|
if (!fields.hasField(Dmp._id)) {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.LockEntity;
|
|
||||||
import org.opencdmp.model.Lock;
|
|
||||||
import org.opencdmp.model.user.User;
|
|
||||||
import org.opencdmp.query.UserQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -14,6 +7,13 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.LockEntity;
|
||||||
|
import org.opencdmp.model.Lock;
|
||||||
|
import org.opencdmp.model.user.User;
|
||||||
|
import org.opencdmp.query.UserQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class LockBuilder extends BaseBuilder<Lock, LockEntity>{
|
public class LockBuilder extends BaseBuilder<Lock, LockEntity>{
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -91,7 +91,7 @@ public class LockBuilder extends BaseBuilder<Lock, LockEntity>{
|
||||||
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(LockEntity::getLockedBy).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(LockEntity::getLockedBy).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)) {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.DescriptionEntity;
|
|
||||||
import org.opencdmp.model.*;
|
|
||||||
import org.opencdmp.query.DescriptionTemplateQuery;
|
|
||||||
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
|
||||||
import org.opencdmp.query.DmpQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -14,6 +7,16 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.DescriptionEntity;
|
||||||
|
import org.opencdmp.model.PublicDescription;
|
||||||
|
import org.opencdmp.model.PublicDescriptionTemplate;
|
||||||
|
import org.opencdmp.model.PublicDmp;
|
||||||
|
import org.opencdmp.model.PublicDmpDescriptionTemplate;
|
||||||
|
import org.opencdmp.query.DescriptionTemplateQuery;
|
||||||
|
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
||||||
|
import org.opencdmp.query.DmpQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -24,7 +27,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class PublicDescriptionBuilder extends BaseBuilder<PublicDescription, DescriptionEntity> {
|
public class PublicDescriptionBuilder extends BaseBuilder<PublicDescription, DescriptionEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -101,7 +104,7 @@ public class PublicDescriptionBuilder extends BaseBuilder<PublicDescription, Des
|
||||||
PublicDmpDescriptionTemplate::getId);
|
PublicDmpDescriptionTemplate::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmpDescriptionTemplate._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmpDescriptionTemplate._id);
|
||||||
DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicDmpDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmpDescriptionTemplate::getId);
|
itemMap = this.builderFactory.builder(PublicDmpDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmpDescriptionTemplate::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(PublicDmpDescriptionTemplate._id)) {
|
if (!fields.hasField(PublicDmpDescriptionTemplate._id)) {
|
||||||
|
@ -131,7 +134,7 @@ public class PublicDescriptionBuilder extends BaseBuilder<PublicDescription, Des
|
||||||
PublicDescriptionTemplate::getId);
|
PublicDescriptionTemplate::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDescriptionTemplate._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDescriptionTemplate._id);
|
||||||
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDescriptionTemplate::getId);
|
itemMap = this.builderFactory.builder(PublicDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDescriptionTemplate::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(PublicDescriptionTemplate._id)) {
|
if (!fields.hasField(PublicDescriptionTemplate._id)) {
|
||||||
|
@ -161,7 +164,7 @@ public class PublicDescriptionBuilder extends BaseBuilder<PublicDescription, Des
|
||||||
PublicDmp::getId);
|
PublicDmp::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id);
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId);
|
itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(PublicDmp._id)) {
|
if (!fields.hasField(PublicDmp._id)) {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commons.enums.EntityType;
|
import org.opencdmp.commons.enums.EntityType;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
@ -9,13 +16,6 @@ import org.opencdmp.query.DescriptionQuery;
|
||||||
import org.opencdmp.query.DmpReferenceQuery;
|
import org.opencdmp.query.DmpReferenceQuery;
|
||||||
import org.opencdmp.query.DmpUserQuery;
|
import org.opencdmp.query.DmpUserQuery;
|
||||||
import org.opencdmp.query.EntityDoiQuery;
|
import org.opencdmp.query.EntityDoiQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
|
public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -101,7 +101,7 @@ public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
|
||||||
|
|
||||||
Map<UUID, List<PublicDmpReference>> itemMap = null;
|
Map<UUID, List<PublicDmpReference>> itemMap = null;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDmpReference._dmp, PublicDmp._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDmpReference._dmp, PublicDmp._id));
|
||||||
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicDmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(PublicDmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(PublicDmpReference._dmp, PublicDmp._id))) {
|
if (!fields.hasField(this.asIndexer(PublicDmpReference._dmp, PublicDmp._id))) {
|
||||||
|
@ -119,7 +119,7 @@ public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
|
||||||
|
|
||||||
Map<UUID, List<PublicDmpUser>> itemMap = null;
|
Map<UUID, List<PublicDmpUser>> itemMap = null;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDmpUser._dmp, PublicDmp._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDmpUser._dmp, PublicDmp._id));
|
||||||
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicDmpUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(PublicDmpUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(PublicDmpUser._dmp, PublicDmp._id))) {
|
if (!fields.hasField(this.asIndexer(PublicDmpUser._dmp, PublicDmp._id))) {
|
||||||
|
@ -137,7 +137,7 @@ public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
|
||||||
|
|
||||||
Map<UUID, List<PublicDescription>> itemMap;
|
Map<UUID, List<PublicDescription>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDescription._dmp, PublicDescription._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDescription._dmp, PublicDescription._id));
|
||||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(PublicDescription._dmp, PublicDescription._id))) {
|
if (!fields.hasField(this.asIndexer(PublicDescription._dmp, PublicDescription._id))) {
|
||||||
|
@ -155,7 +155,7 @@ public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
|
||||||
|
|
||||||
Map<UUID, List<PublicEntityDoi>> itemMap;
|
Map<UUID, List<PublicEntityDoi>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicEntityDoi._entityId));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicEntityDoi._entityId));
|
||||||
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicEntityDoiBuilder.class).authorize(this.authorize).asMasterKey(query, clone, PublicEntityDoi::getEntityId);
|
itemMap = this.builderFactory.builder(PublicEntityDoiBuilder.class).authorize(this.authorize).asMasterKey(query, clone, PublicEntityDoi::getEntityId);
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(PublicEntityDoi._entityId))) {
|
if (!fields.hasField(this.asIndexer(PublicEntityDoi._entityId))) {
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
|
||||||
import org.opencdmp.model.PublicDescriptionTemplate;
|
|
||||||
import org.opencdmp.model.PublicDmp;
|
|
||||||
import org.opencdmp.model.PublicDmpDescriptionTemplate;
|
|
||||||
import org.opencdmp.query.DescriptionTemplateQuery;
|
|
||||||
import org.opencdmp.query.DmpQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -15,6 +7,12 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
||||||
|
import org.opencdmp.model.PublicDmp;
|
||||||
|
import org.opencdmp.model.PublicDmpDescriptionTemplate;
|
||||||
|
import org.opencdmp.query.DmpQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -25,7 +23,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class PublicDmpDescriptionTemplateBuilder extends BaseBuilder<PublicDmpDescriptionTemplate, DmpDescriptionTemplateEntity> {
|
public class PublicDmpDescriptionTemplateBuilder extends BaseBuilder<PublicDmpDescriptionTemplate, DmpDescriptionTemplateEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -87,7 +85,7 @@ public class PublicDmpDescriptionTemplateBuilder extends BaseBuilder<PublicDmpDe
|
||||||
PublicDmp::getId);
|
PublicDmp::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id);
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).ids(data.stream().map(DmpDescriptionTemplateEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpDescriptionTemplateEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId);
|
itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(PublicDmp._id)) {
|
if (!fields.hasField(PublicDmp._id)) {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
@ -9,13 +16,6 @@ import org.opencdmp.model.PublicDmpReference;
|
||||||
import org.opencdmp.model.PublicReference;
|
import org.opencdmp.model.PublicReference;
|
||||||
import org.opencdmp.query.DmpQuery;
|
import org.opencdmp.query.DmpQuery;
|
||||||
import org.opencdmp.query.ReferenceQuery;
|
import org.opencdmp.query.ReferenceQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class PublicDmpReferenceBuilder extends BaseBuilder<PublicDmpReference, DmpReferenceEntity> {
|
public class PublicDmpReferenceBuilder extends BaseBuilder<PublicDmpReference, DmpReferenceEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -92,7 +92,7 @@ public class PublicDmpReferenceBuilder extends BaseBuilder<PublicDmpReference, D
|
||||||
PublicReference::getId);
|
PublicReference::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicReference._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicReference._id);
|
||||||
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).isActive(IsActive.Active).ids(data.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).disableTracking().authorize(this.authorize).isActive(IsActive.Active).ids(data.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicReference::getId);
|
itemMap = this.builderFactory.builder(PublicReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicReference::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(PublicReference._id)) {
|
if (!fields.hasField(PublicReference._id)) {
|
||||||
|
@ -119,7 +119,7 @@ public class PublicDmpReferenceBuilder extends BaseBuilder<PublicDmpReference, D
|
||||||
PublicDmp::getId);
|
PublicDmp::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id);
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).isActive(IsActive.Active).ids(data.stream().map(DmpReferenceEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).isActive(IsActive.Active).ids(data.stream().map(DmpReferenceEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId);
|
itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(PublicDmp._id)) {
|
if (!fields.hasField(PublicDmp._id)) {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.data.DmpUserEntity;
|
import org.opencdmp.data.DmpUserEntity;
|
||||||
|
@ -9,13 +16,6 @@ import org.opencdmp.model.PublicUser;
|
||||||
import org.opencdmp.model.user.User;
|
import org.opencdmp.model.user.User;
|
||||||
import org.opencdmp.query.DmpQuery;
|
import org.opencdmp.query.DmpQuery;
|
||||||
import org.opencdmp.query.UserQuery;
|
import org.opencdmp.query.UserQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class PublicDmpUserBuilder extends BaseBuilder<PublicDmpUser, DmpUserEntity>{
|
public class PublicDmpUserBuilder extends BaseBuilder<PublicDmpUser, DmpUserEntity>{
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -92,7 +92,7 @@ public class PublicDmpUserBuilder extends BaseBuilder<PublicDmpUser, DmpUserEnti
|
||||||
PublicUser::getId);
|
PublicUser::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicUser._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicUser._id);
|
||||||
UserQuery q = this.queryFactory.query(UserQuery.class).authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicUserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicUser::getId);
|
itemMap = this.builderFactory.builder(PublicUserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicUser::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(PublicUser._id)) {
|
if (!fields.hasField(PublicUser._id)) {
|
||||||
|
@ -122,7 +122,7 @@ public class PublicDmpUserBuilder extends BaseBuilder<PublicDmpUser, DmpUserEnti
|
||||||
PublicDmp::getId);
|
PublicDmp::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id);
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId);
|
itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(PublicDmp._id)) {
|
if (!fields.hasField(PublicDmp._id)) {
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.DmpReferenceEntity;
|
|
||||||
import org.opencdmp.data.ReferenceEntity;
|
|
||||||
import org.opencdmp.model.PublicDmp;
|
|
||||||
import org.opencdmp.model.PublicDmpUser;
|
|
||||||
import org.opencdmp.model.PublicReference;
|
|
||||||
import org.opencdmp.model.PublicReferenceType;
|
|
||||||
import org.opencdmp.query.DmpQuery;
|
|
||||||
import org.opencdmp.query.ReferenceTypeQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -18,6 +7,13 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.ReferenceEntity;
|
||||||
|
import org.opencdmp.model.PublicReference;
|
||||||
|
import org.opencdmp.model.PublicReferenceType;
|
||||||
|
import org.opencdmp.query.ReferenceTypeQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -28,7 +24,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class PublicReferenceBuilder extends BaseBuilder<PublicReference, ReferenceEntity>{
|
public class PublicReferenceBuilder extends BaseBuilder<PublicReference, ReferenceEntity>{
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
|
||||||
|
@ -92,7 +88,7 @@ public class PublicReferenceBuilder extends BaseBuilder<PublicReference, Referen
|
||||||
PublicReferenceType::getId);
|
PublicReferenceType::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicReferenceType._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicReferenceType._id);
|
||||||
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).isActive(IsActive.Active).ids(data.stream().map(ReferenceEntity::getTypeId).distinct().collect(Collectors.toList()));
|
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().authorize(this.authorize).isActive(IsActive.Active).ids(data.stream().map(ReferenceEntity::getTypeId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(PublicReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicReferenceType::getId);
|
itemMap = this.builderFactory.builder(PublicReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicReferenceType::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(PublicReferenceType._id)) {
|
if (!fields.hasField(PublicReferenceType._id)) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class RecentActivityItemBuilder extends BaseBuilder<RecentActivityItem, R
|
||||||
Dmp::getId);
|
Dmp::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).ids(data.stream().filter(x-> x.getType().equals(RecentActivityItemType.Dmp)).map(RecentActivityItemEntity::getId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().filter(x-> x.getType().equals(RecentActivityItemType.Dmp)).map(RecentActivityItemEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Dmp._id)) {
|
if (!fields.hasField(Dmp._id)) {
|
||||||
|
@ -121,7 +121,7 @@ public class RecentActivityItemBuilder extends BaseBuilder<RecentActivityItem, R
|
||||||
Description::getId);
|
Description::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Description._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Description._id);
|
||||||
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).authorize(this.authorize).ids(data.stream().filter(x-> x.getType().equals(RecentActivityItemType.Description)).map(RecentActivityItemEntity::getId).distinct().collect(Collectors.toList()));
|
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().filter(x-> x.getType().equals(RecentActivityItemType.Description)).map(RecentActivityItemEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Description::getId);
|
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Description::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Description._id)) {
|
if (!fields.hasField(Description._id)) {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.StorageFileEntity;
|
|
||||||
import org.opencdmp.model.*;
|
|
||||||
import org.opencdmp.model.user.User;
|
|
||||||
import org.opencdmp.query.*;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -14,6 +7,13 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.StorageFileEntity;
|
||||||
|
import org.opencdmp.model.StorageFile;
|
||||||
|
import org.opencdmp.model.user.User;
|
||||||
|
import org.opencdmp.query.UserQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class StorageFileBuilder extends BaseBuilder<StorageFile, StorageFileEntity> {
|
public class StorageFileBuilder extends BaseBuilder<StorageFile, StorageFileEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -100,7 +100,7 @@ public class StorageFileBuilder extends BaseBuilder<StorageFile, StorageFileEnti
|
||||||
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(StorageFileEntity::getOwnerId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(StorageFileEntity::getOwnerId).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)) {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.TagEntity;
|
|
||||||
import org.opencdmp.model.Tag;
|
|
||||||
import org.opencdmp.model.user.User;
|
|
||||||
import org.opencdmp.query.UserQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -14,6 +7,13 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.TagEntity;
|
||||||
|
import org.opencdmp.model.Tag;
|
||||||
|
import org.opencdmp.model.user.User;
|
||||||
|
import org.opencdmp.query.UserQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class TagBuilder extends BaseBuilder<Tag, TagEntity>{
|
public class TagBuilder extends BaseBuilder<Tag, TagEntity>{
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -89,7 +89,7 @@ public class TagBuilder extends BaseBuilder<Tag, TagEntity>{
|
||||||
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(TagEntity::getCreatedById).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(TagEntity::getCreatedById).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)) {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
@ -9,13 +16,6 @@ import org.opencdmp.model.TenantUser;
|
||||||
import org.opencdmp.model.user.User;
|
import org.opencdmp.model.user.User;
|
||||||
import org.opencdmp.query.TenantQuery;
|
import org.opencdmp.query.TenantQuery;
|
||||||
import org.opencdmp.query.UserQuery;
|
import org.opencdmp.query.UserQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class TenantUserBuilder extends BaseBuilder<TenantUser, TenantUserEntity> {
|
public class TenantUserBuilder extends BaseBuilder<TenantUser, TenantUserEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -98,7 +98,7 @@ public class TenantUserBuilder extends BaseBuilder<TenantUser, TenantUserEntity>
|
||||||
x -> x.getId());
|
x -> x.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(datas.stream().map(x -> x.getUserId()).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(datas.stream().map(x -> x.getUserId()).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, x -> x.getId());
|
itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, x -> x.getId());
|
||||||
}
|
}
|
||||||
if (!fields.hasField(User._id)) {
|
if (!fields.hasField(User._id)) {
|
||||||
|
@ -127,7 +127,7 @@ public class TenantUserBuilder extends BaseBuilder<TenantUser, TenantUserEntity>
|
||||||
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)) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class UserAdditionalInfoBuilder extends BaseBuilder<UserAdditionalInfo, A
|
||||||
Reference::getId);
|
Reference::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
||||||
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).ids(data.stream().map(AdditionalInfoEntity::getOrganizationId).filter(Objects::nonNull).distinct().collect(Collectors.toList()));
|
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(AdditionalInfoEntity::getOrganizationId).filter(Objects::nonNull).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Reference._id)) {
|
if (!fields.hasField(Reference._id)) {
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class UserBuilder extends BaseBuilder<User, UserEntity> {
|
||||||
|
|
||||||
Map<UUID, List<UserContactInfo>> itemMap;
|
Map<UUID, List<UserContactInfo>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserContactInfo._user, User._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserContactInfo._user, User._id));
|
||||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).authorize(this.authorize).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().authorize(this.authorize).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserContactInfoBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
itemMap = this.builderFactory.builder(UserContactInfoBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(UserContactInfo._user, User._id))) {
|
if (!fields.hasField(this.asIndexer(UserContactInfo._user, User._id))) {
|
||||||
|
@ -145,7 +145,7 @@ public class UserBuilder extends BaseBuilder<User, UserEntity> {
|
||||||
|
|
||||||
Map<UUID, List<UserRole>> itemMap;
|
Map<UUID, List<UserRole>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserRole._user, User._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserRole._user, User._id));
|
||||||
UserRoleQuery query = this.queryFactory.query(UserRoleQuery.class).authorize(this.authorize).tenantIsSet(false).roles(this.authorizationProperties.getAllowedGlobalRoles()).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
UserRoleQuery query = this.queryFactory.query(UserRoleQuery.class).disableTracking().authorize(this.authorize).tenantIsSet(false).roles(this.authorizationProperties.getAllowedGlobalRoles()).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserRoleBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
itemMap = this.builderFactory.builder(UserRoleBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(UserRole._user, User._id))) {
|
if (!fields.hasField(this.asIndexer(UserRole._user, User._id))) {
|
||||||
|
@ -165,7 +165,7 @@ public class UserBuilder extends BaseBuilder<User, UserEntity> {
|
||||||
|
|
||||||
if (!this.tenantScope.isSet()) throw new MyForbiddenException("tenant scope required");
|
if (!this.tenantScope.isSet()) throw new MyForbiddenException("tenant scope required");
|
||||||
|
|
||||||
UserRoleQuery query = this.queryFactory.query(UserRoleQuery.class).authorize(this.authorize).roles(this.authorizationProperties.getAllowedTenantRoles()).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
UserRoleQuery query = this.queryFactory.query(UserRoleQuery.class).disableTracking().authorize(this.authorize).roles(this.authorizationProperties.getAllowedTenantRoles()).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
if (this.tenantScope.isDefaultTenant()) query.tenantIsSet(false);
|
if (this.tenantScope.isDefaultTenant()) query.tenantIsSet(false);
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
|
@ -192,7 +192,7 @@ public class UserBuilder extends BaseBuilder<User, UserEntity> {
|
||||||
|
|
||||||
Map<UUID, List<UserCredential>> itemMap;
|
Map<UUID, List<UserCredential>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserCredential._user, User._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserCredential._user, User._id));
|
||||||
UserCredentialQuery query = this.queryFactory.query(UserCredentialQuery.class).authorize(this.authorize).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
UserCredentialQuery query = this.queryFactory.query(UserCredentialQuery.class).disableTracking().authorize(this.authorize).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserCredentialBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
itemMap = this.builderFactory.builder(UserCredentialBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(UserCredential._user, User._id))) {
|
if (!fields.hasField(this.asIndexer(UserCredential._user, User._id))) {
|
||||||
|
@ -210,7 +210,7 @@ public class UserBuilder extends BaseBuilder<User, UserEntity> {
|
||||||
|
|
||||||
Map<UUID, List<TenantUser>> itemMap = null;
|
Map<UUID, List<TenantUser>> itemMap = null;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(TenantUser._user, User._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(TenantUser._user, User._id));
|
||||||
TenantUserQuery query = this.queryFactory.query(TenantUserQuery.class).authorize(this.authorize).userIds(datas.stream().map(x -> x.getId()).distinct().collect(Collectors.toList()));
|
TenantUserQuery query = this.queryFactory.query(TenantUserQuery.class).disableTracking().authorize(this.authorize).userIds(datas.stream().map(x -> x.getId()).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(TenantUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
itemMap = this.builderFactory.builder(TenantUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getUser().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(TenantUser._user, User._id))) {
|
if (!fields.hasField(this.asIndexer(TenantUser._user, User._id))) {
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.UserContactInfoEntity;
|
|
||||||
import org.opencdmp.model.user.User;
|
|
||||||
import org.opencdmp.model.UserContactInfo;
|
|
||||||
import org.opencdmp.query.UserQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -13,6 +7,12 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.UserContactInfoEntity;
|
||||||
|
import org.opencdmp.model.UserContactInfo;
|
||||||
|
import org.opencdmp.model.user.User;
|
||||||
|
import org.opencdmp.query.UserQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -23,7 +23,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserContactInfoBuilder extends BaseBuilder<UserContactInfo, UserContactInfoEntity> {
|
public class UserContactInfoBuilder extends BaseBuilder<UserContactInfo, UserContactInfoEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -92,7 +92,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)) {
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.UserDescriptionTemplateEntity;
|
|
||||||
import org.opencdmp.model.builder.descriptiontemplate.DescriptionTemplateBuilder;
|
|
||||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
|
||||||
import org.opencdmp.model.user.User;
|
|
||||||
import org.opencdmp.model.UserDescriptionTemplate;
|
|
||||||
import org.opencdmp.query.DescriptionTemplateQuery;
|
|
||||||
import org.opencdmp.query.UserQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -17,6 +7,16 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.UserDescriptionTemplateEntity;
|
||||||
|
import org.opencdmp.model.UserDescriptionTemplate;
|
||||||
|
import org.opencdmp.model.builder.descriptiontemplate.DescriptionTemplateBuilder;
|
||||||
|
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||||
|
import org.opencdmp.model.user.User;
|
||||||
|
import org.opencdmp.query.DescriptionTemplateQuery;
|
||||||
|
import org.opencdmp.query.UserQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -27,7 +27,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionTemplate, UserDescriptionTemplateEntity> {
|
public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionTemplate, UserDescriptionTemplateEntity> {
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
@ -97,7 +97,7 @@ public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionT
|
||||||
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(UserDescriptionTemplateEntity::getUserId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(UserDescriptionTemplateEntity::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)) {
|
||||||
|
@ -126,7 +126,7 @@ public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionT
|
||||||
x -> x.getId());
|
x -> x.getId());
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id);
|
||||||
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).ids(data.stream().map(UserDescriptionTemplateEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().ids(data.stream().map(UserDescriptionTemplateEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).asForeignKey(q, clone, DescriptionTemplate::getId);
|
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).asForeignKey(q, clone, DescriptionTemplate::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(DescriptionTemplate._id)) {
|
if (!fields.hasField(DescriptionTemplate._id)) {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.model.builder;
|
package org.opencdmp.model.builder;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.UserRoleEntity;
|
|
||||||
import org.opencdmp.model.user.User;
|
|
||||||
import org.opencdmp.model.UserRole;
|
|
||||||
import org.opencdmp.query.UserQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -14,6 +7,13 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.UserRoleEntity;
|
||||||
|
import org.opencdmp.model.UserRole;
|
||||||
|
import org.opencdmp.model.user.User;
|
||||||
|
import org.opencdmp.query.UserQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserRoleBuilder extends BaseBuilder<UserRole, UserRoleEntity> {
|
public class UserRoleBuilder extends BaseBuilder<UserRole, UserRoleEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -94,7 +94,7 @@ public class UserRoleBuilder extends BaseBuilder<UserRole, UserRoleEntity> {
|
||||||
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(UserRoleEntity::getUserId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(UserRoleEntity::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)) {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package org.opencdmp.model.builder.actionconfirmation;
|
package org.opencdmp.model.builder.actionconfirmation;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commons.XmlHandlingService;
|
import org.opencdmp.commons.XmlHandlingService;
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
|
@ -13,13 +20,6 @@ import org.opencdmp.model.builder.BaseBuilder;
|
||||||
import org.opencdmp.model.builder.UserBuilder;
|
import org.opencdmp.model.builder.UserBuilder;
|
||||||
import org.opencdmp.model.user.User;
|
import org.opencdmp.model.user.User;
|
||||||
import org.opencdmp.query.UserQuery;
|
import org.opencdmp.query.UserQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -30,7 +30,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class ActionConfirmationBuilder extends BaseBuilder<ActionConfirmation, ActionConfirmationEntity> {
|
public class ActionConfirmationBuilder extends BaseBuilder<ActionConfirmation, ActionConfirmationEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -120,7 +120,7 @@ public class ActionConfirmationBuilder extends BaseBuilder<ActionConfirmation, A
|
||||||
x -> x.getId());
|
x -> x.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(datas.stream().map(x -> x.getCreatedById()).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(datas.stream().map(x -> x.getCreatedById()).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, x -> x.getId());
|
itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, x -> x.getId());
|
||||||
}
|
}
|
||||||
if (!fields.hasField(User._id)) {
|
if (!fields.hasField(User._id)) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class DmpUserCommonModelBuilder extends BaseCommonModelBuilder<DmpUserMod
|
||||||
this.logger.debug("checking related - {}", UserModel.class.getSimpleName());
|
this.logger.debug("checking related - {}", UserModel.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, UserModel> itemMap;
|
Map<UUID, UserModel> itemMap;
|
||||||
UserQuery q = this.queryFactory.query(UserQuery.class).isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, UserEntity::getId);
|
itemMap = this.builderFactory.builder(UserCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, UserEntity::getId);
|
||||||
return itemMap;
|
return itemMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,17 @@
|
||||||
package org.opencdmp.model.builder.commonmodels;
|
package org.opencdmp.model.builder.commonmodels;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commonmodels.models.DmpUserModel;
|
|
||||||
import org.opencdmp.commonmodels.models.UserContactInfoModel;
|
|
||||||
import org.opencdmp.commonmodels.models.UserModel;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.DmpEntity;
|
|
||||||
import org.opencdmp.data.DmpUserEntity;
|
|
||||||
import org.opencdmp.data.UserContactInfoEntity;
|
|
||||||
import org.opencdmp.data.UserEntity;
|
|
||||||
import org.opencdmp.model.DmpUser;
|
|
||||||
import org.opencdmp.model.UserContactInfo;
|
|
||||||
import org.opencdmp.query.DmpUserQuery;
|
|
||||||
import org.opencdmp.query.UserContactInfoQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commonmodels.models.UserContactInfoModel;
|
||||||
|
import org.opencdmp.commonmodels.models.UserModel;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.UserContactInfoEntity;
|
||||||
|
import org.opencdmp.data.UserEntity;
|
||||||
|
import org.opencdmp.model.UserContactInfo;
|
||||||
|
import org.opencdmp.query.UserContactInfoQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -28,7 +22,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserCommonModelBuilder extends BaseCommonModelBuilder<UserModel, UserEntity> {
|
public class UserCommonModelBuilder extends BaseCommonModelBuilder<UserModel, UserEntity> {
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
@ -49,7 +43,7 @@ public class UserCommonModelBuilder extends BaseCommonModelBuilder<UserModel, Us
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserCommonModelBuilder disableContacts(boolean values) {
|
public UserCommonModelBuilder disableContacts(boolean values) {
|
||||||
this.disableContacts = disableContacts;
|
this.disableContacts = this.disableContacts;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +71,7 @@ public class UserCommonModelBuilder extends BaseCommonModelBuilder<UserModel, Us
|
||||||
this.logger.debug("checking related - {}", UserContactInfo.class.getSimpleName());
|
this.logger.debug("checking related - {}", UserContactInfo.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, List<UserContactInfoModel>> itemMap;
|
Map<UUID, List<UserContactInfoModel>> itemMap;
|
||||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).authorize(this.authorize).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().authorize(this.authorize).userIds(data.stream().map(UserEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserContactInfoCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, UserContactInfoEntity::getUserId);
|
itemMap = this.builderFactory.builder(UserContactInfoCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, UserContactInfoEntity::getUserId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package org.opencdmp.model.builder.commonmodels.description;
|
package org.opencdmp.model.builder.commonmodels.description;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commonmodels.enums.DescriptionStatus;
|
import org.opencdmp.commonmodels.enums.DescriptionStatus;
|
||||||
import org.opencdmp.commonmodels.models.description.DescriptionModel;
|
import org.opencdmp.commonmodels.models.description.DescriptionModel;
|
||||||
|
@ -14,20 +19,17 @@ import org.opencdmp.data.DescriptionEntity;
|
||||||
import org.opencdmp.data.DescriptionTemplateEntity;
|
import org.opencdmp.data.DescriptionTemplateEntity;
|
||||||
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
||||||
import org.opencdmp.data.DmpEntity;
|
import org.opencdmp.data.DmpEntity;
|
||||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
|
||||||
import org.opencdmp.model.DmpDescriptionTemplate;
|
import org.opencdmp.model.DmpDescriptionTemplate;
|
||||||
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||||
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
||||||
import org.opencdmp.model.builder.commonmodels.dmp.DmpCommonModelBuilder;
|
|
||||||
import org.opencdmp.model.builder.commonmodels.descriptiontemplate.DescriptionTemplateCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.descriptiontemplate.DescriptionTemplateCommonModelBuilder;
|
||||||
import org.opencdmp.query.*;
|
import org.opencdmp.model.builder.commonmodels.dmp.DmpCommonModelBuilder;
|
||||||
|
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||||
|
import org.opencdmp.query.DescriptionTemplateQuery;
|
||||||
|
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
||||||
|
import org.opencdmp.query.DmpQuery;
|
||||||
import org.opencdmp.service.visibility.VisibilityService;
|
import org.opencdmp.service.visibility.VisibilityService;
|
||||||
import org.opencdmp.service.visibility.VisibilityServiceImpl;
|
import org.opencdmp.service.visibility.VisibilityServiceImpl;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -38,7 +40,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<DescriptionModel, DescriptionEntity> {
|
public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<DescriptionModel, DescriptionEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -110,7 +112,7 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
|
||||||
if (d.getProperties() != null){
|
if (d.getProperties() != null){
|
||||||
PropertyDefinitionEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PropertyDefinitionEntity.class, d.getProperties());
|
PropertyDefinitionEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PropertyDefinitionEntity.class, d.getProperties());
|
||||||
DefinitionEntity definition = definitionEntityMap != null ? definitionEntityMap.getOrDefault(d.getDescriptionTemplateId(), null) : null;
|
DefinitionEntity definition = definitionEntityMap != null ? definitionEntityMap.getOrDefault(d.getDescriptionTemplateId(), null) : null;
|
||||||
m.setProperties(this.builderFactory.builder(PropertyDefinitionCommonModelBuilder.class).useSharedStorage(useSharedStorage).withDefinition(definition).authorize(this.authorize).build(propertyDefinition));
|
m.setProperties(this.builderFactory.builder(PropertyDefinitionCommonModelBuilder.class).useSharedStorage(this.useSharedStorage).withDefinition(definition).authorize(this.authorize).build(propertyDefinition));
|
||||||
VisibilityService visibilityService = new VisibilityServiceImpl(definition, propertyDefinition);
|
VisibilityService visibilityService = new VisibilityServiceImpl(definition, propertyDefinition);
|
||||||
m.setVisibilityStates(this.builderFactory.builder(VisibilityStateModelBuilder.class).authorize(this.authorize).build(visibilityService.getVisibilityStates().entrySet().stream().toList()));
|
m.setVisibilityStates(this.builderFactory.builder(VisibilityStateModelBuilder.class).authorize(this.authorize).build(visibilityService.getVisibilityStates().entrySet().stream().toList()));
|
||||||
}
|
}
|
||||||
|
@ -128,7 +130,7 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
|
||||||
this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName());
|
this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName());
|
||||||
|
|
||||||
Map<java.util.UUID, DefinitionEntity> itemMap = new HashMap<>();
|
Map<java.util.UUID, DefinitionEntity> itemMap = new HashMap<>();
|
||||||
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
List<DescriptionTemplateEntity> items = q.collectAs(new BaseFieldSet().ensure(DescriptionTemplate._id).ensure(DescriptionTemplate._definition));
|
List<DescriptionTemplateEntity> items = q.collectAs(new BaseFieldSet().ensure(DescriptionTemplate._id).ensure(DescriptionTemplate._definition));
|
||||||
for (DescriptionTemplateEntity item : items){
|
for (DescriptionTemplateEntity item : items){
|
||||||
DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, item.getDefinition());
|
DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, item.getDefinition());
|
||||||
|
@ -144,7 +146,7 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
|
||||||
this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName());
|
this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, UUID> itemMap = new HashMap<>();
|
Map<UUID, UUID> itemMap = new HashMap<>();
|
||||||
DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
List<DmpDescriptionTemplateEntity> items = q.collectAs(new BaseFieldSet().ensure(org.opencdmp.model.DmpDescriptionTemplate._id).ensure(DmpDescriptionTemplate._sectionId));
|
List<DmpDescriptionTemplateEntity> items = q.collectAs(new BaseFieldSet().ensure(org.opencdmp.model.DmpDescriptionTemplate._id).ensure(DmpDescriptionTemplate._sectionId));
|
||||||
for (DmpDescriptionTemplateEntity item : items){
|
for (DmpDescriptionTemplateEntity item : items){
|
||||||
itemMap.put(item.getId(), item.getSectionId());
|
itemMap.put(item.getId(), item.getSectionId());
|
||||||
|
@ -159,8 +161,8 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
|
||||||
this.logger.debug("checking related - {}", DmpModel.class.getSimpleName());
|
this.logger.debug("checking related - {}", DmpModel.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, DmpModel> itemMap;
|
Map<UUID, DmpModel> itemMap;
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpCommonModelBuilder.class).setRepositoryId(repositoryId).useSharedStorage(useSharedStorage).setDisableDescriptions(true).authorize(this.authorize).asForeignKey(q, DmpEntity::getId);
|
itemMap = this.builderFactory.builder(DmpCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).setDisableDescriptions(true).authorize(this.authorize).asForeignKey(q, DmpEntity::getId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +173,7 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
|
||||||
this.logger.debug("checking related - {}", DescriptionTemplateModel.class.getSimpleName());
|
this.logger.debug("checking related - {}", DescriptionTemplateModel.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, DescriptionTemplateModel> itemMap;
|
Map<UUID, DescriptionTemplateModel> itemMap;
|
||||||
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionTemplateCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, DescriptionTemplateEntity::getId);
|
itemMap = this.builderFactory.builder(DescriptionTemplateCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, DescriptionTemplateEntity::getId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
|
|
@ -18,12 +18,12 @@ import org.opencdmp.commons.types.description.FieldEntity;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.data.ReferenceEntity;
|
import org.opencdmp.data.ReferenceEntity;
|
||||||
import org.opencdmp.data.StorageFileEntity;
|
import org.opencdmp.data.StorageFileEntity;
|
||||||
import org.opencdmp.model.reference.Reference;
|
|
||||||
import org.opencdmp.model.StorageFile;
|
import org.opencdmp.model.StorageFile;
|
||||||
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||||
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
||||||
import org.opencdmp.model.builder.commonmodels.reference.ReferenceCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.reference.ReferenceCommonModelBuilder;
|
||||||
import org.opencdmp.model.persist.StorageFilePersist;
|
import org.opencdmp.model.persist.StorageFilePersist;
|
||||||
|
import org.opencdmp.model.reference.Reference;
|
||||||
import org.opencdmp.query.ReferenceQuery;
|
import org.opencdmp.query.ReferenceQuery;
|
||||||
import org.opencdmp.query.StorageFileQuery;
|
import org.opencdmp.query.StorageFileQuery;
|
||||||
import org.opencdmp.service.storage.StorageFileProperties;
|
import org.opencdmp.service.storage.StorageFileProperties;
|
||||||
|
@ -105,7 +105,7 @@ public class FieldCommonModelBuilder extends BaseCommonModelBuilder<FieldModel,
|
||||||
try {
|
try {
|
||||||
byte[] bytes = this.storageFileService.readAsBytesSafe(UUID.fromString(d.getTextValue()));
|
byte[] bytes = this.storageFileService.readAsBytesSafe(UUID.fromString(d.getTextValue()));
|
||||||
FileEnvelopeModel fileEnvelopeModel = new FileEnvelopeModel();
|
FileEnvelopeModel fileEnvelopeModel = new FileEnvelopeModel();
|
||||||
StorageFileEntity storageFile = this.queryFactory.query(StorageFileQuery.class).ids(UUID.fromString(d.getTextValue())).first();
|
StorageFileEntity storageFile = this.queryFactory.query(StorageFileQuery.class).disableTracking().ids(UUID.fromString(d.getTextValue())).first();
|
||||||
fileEnvelopeModel.setFile(bytes);
|
fileEnvelopeModel.setFile(bytes);
|
||||||
fileEnvelopeModel.setFilename(storageFile.getName() + (storageFile.getExtension().startsWith(".") ? "" : ".") + storageFile.getExtension());
|
fileEnvelopeModel.setFilename(storageFile.getName() + (storageFile.getExtension().startsWith(".") ? "" : ".") + storageFile.getExtension());
|
||||||
fileEnvelopeModel.setMimeType(storageFile.getMimeType());
|
fileEnvelopeModel.setMimeType(storageFile.getMimeType());
|
||||||
|
@ -148,7 +148,7 @@ public class FieldCommonModelBuilder extends BaseCommonModelBuilder<FieldModel,
|
||||||
|
|
||||||
Map<UUID, ReferenceModel> itemMap;
|
Map<UUID, ReferenceModel> itemMap;
|
||||||
|
|
||||||
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).ids(data.stream().filter(x-> x.getTextListValue() != null).map(FieldEntity::getTextListValue).flatMap(List::stream).filter(x-> !this.conventionService.isNullOrEmpty(x)).map(UUID::fromString).distinct().collect(Collectors.toList()));
|
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().filter(x-> x.getTextListValue() != null).map(FieldEntity::getTextListValue).flatMap(List::stream).filter(x-> !this.conventionService.isNullOrEmpty(x)).map(UUID::fromString).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(ReferenceCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, ReferenceEntity::getId);
|
itemMap = this.builderFactory.builder(ReferenceCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, ReferenceEntity::getId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.opencdmp.model.builder.commonmodels.descriptiontemplate;
|
package org.opencdmp.model.builder.commonmodels.descriptiontemplate;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commonmodels.models.DescriptionTemplateTypeModel;
|
import org.opencdmp.commonmodels.models.DescriptionTemplateTypeModel;
|
||||||
import org.opencdmp.commonmodels.models.descriptiotemplate.DescriptionTemplateModel;
|
import org.opencdmp.commonmodels.models.descriptiotemplate.DescriptionTemplateModel;
|
||||||
|
@ -12,10 +16,6 @@ import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||||
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
||||||
import org.opencdmp.model.builder.commonmodels.DescriptionTemplateTypeCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.DescriptionTemplateTypeCommonModelBuilder;
|
||||||
import org.opencdmp.query.DescriptionTemplateTypeQuery;
|
import org.opencdmp.query.DescriptionTemplateTypeQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionTemplateCommonModelBuilder extends BaseCommonModelBuilder<DescriptionTemplateModel, DescriptionTemplateEntity> {
|
public class DescriptionTemplateCommonModelBuilder extends BaseCommonModelBuilder<DescriptionTemplateModel, DescriptionTemplateEntity> {
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
@ -88,7 +88,7 @@ public class DescriptionTemplateCommonModelBuilder extends BaseCommonModelBuilde
|
||||||
this.logger.debug("checking related - {}", DescriptionTemplateTypeModel.class.getSimpleName());
|
this.logger.debug("checking related - {}", DescriptionTemplateTypeModel.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, DescriptionTemplateTypeModel> itemMap;
|
Map<UUID, DescriptionTemplateTypeModel> itemMap;
|
||||||
DescriptionTemplateTypeQuery q = this.queryFactory.query(DescriptionTemplateTypeQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionTemplateEntity::getTypeId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateTypeQuery q = this.queryFactory.query(DescriptionTemplateTypeQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionTemplateEntity::getTypeId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionTemplateTypeCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, DescriptionTemplateTypeEntity::getId);
|
itemMap = this.builderFactory.builder(DescriptionTemplateTypeCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, DescriptionTemplateTypeEntity::getId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class ReferenceTypeDataCommonModelBuilder extends BaseFieldDataCommonMode
|
||||||
@Override
|
@Override
|
||||||
protected void buildChild(ReferenceTypeDataEntity d, ReferenceTypeDataModel m) {
|
protected void buildChild(ReferenceTypeDataEntity d, ReferenceTypeDataModel m) {
|
||||||
m.setMultipleSelect(d.getMultipleSelect());
|
m.setMultipleSelect(d.getMultipleSelect());
|
||||||
if (d.getReferenceTypeId() != null) m.setReferenceType(this.builderFactory.builder(ReferenceTypeCommonModelBuilder.class).build(this.queryFactory.query(ReferenceTypeQuery.class).ids(d.getReferenceTypeId()).first())); //TODO: Optimize
|
if (d.getReferenceTypeId() != null) m.setReferenceType(this.builderFactory.builder(ReferenceTypeCommonModelBuilder.class).build(this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(d.getReferenceTypeId()).first())); //TODO: Optimize
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package org.opencdmp.model.builder.commonmodels.dmp;
|
package org.opencdmp.model.builder.commonmodels.dmp;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.Ordering;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commonmodels.enums.DmpAccessType;
|
import org.opencdmp.commonmodels.enums.DmpAccessType;
|
||||||
import org.opencdmp.commonmodels.enums.DmpStatus;
|
import org.opencdmp.commonmodels.enums.DmpStatus;
|
||||||
|
@ -16,7 +22,8 @@ import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.commons.types.dmp.DmpPropertiesEntity;
|
import org.opencdmp.commons.types.dmp.DmpPropertiesEntity;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.data.*;
|
import org.opencdmp.data.*;
|
||||||
import org.opencdmp.model.*;
|
import org.opencdmp.model.DmpUser;
|
||||||
|
import org.opencdmp.model.EntityDoi;
|
||||||
import org.opencdmp.model.builder.commonmodels.*;
|
import org.opencdmp.model.builder.commonmodels.*;
|
||||||
import org.opencdmp.model.builder.commonmodels.description.DescriptionCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.description.DescriptionCommonModelBuilder;
|
||||||
import org.opencdmp.model.builder.commonmodels.dmpblueprint.DmpBlueprintCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.dmpblueprint.DmpBlueprintCommonModelBuilder;
|
||||||
|
@ -25,12 +32,6 @@ import org.opencdmp.model.description.Description;
|
||||||
import org.opencdmp.model.dmp.Dmp;
|
import org.opencdmp.model.dmp.Dmp;
|
||||||
import org.opencdmp.model.dmpreference.DmpReference;
|
import org.opencdmp.model.dmpreference.DmpReference;
|
||||||
import org.opencdmp.query.*;
|
import org.opencdmp.query.*;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.Ordering;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -41,7 +42,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpEntity> {
|
public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpEntity> {
|
||||||
|
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
@ -156,15 +157,15 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPreviousDOI(UUID dmpGroup, UUID currentDmpId) {
|
private String getPreviousDOI(UUID dmpGroup, UUID currentDmpId) {
|
||||||
if (repositoryId == null || repositoryId.isEmpty()) throw new MyApplicationException("repositoryId required");
|
if (this.repositoryId == null || this.repositoryId.isEmpty()) throw new MyApplicationException("repositoryId required");
|
||||||
|
|
||||||
//GK: Step one get the previous version of the Data management plan
|
//GK: Step one get the previous version of the Data management plan
|
||||||
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class);
|
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking();
|
||||||
dmpQuery.setOrder(new Ordering().addDescending(Dmp._version));
|
dmpQuery.setOrder(new Ordering().addDescending(Dmp._version));
|
||||||
List<UUID> dmpIds = dmpQuery.groupIds(dmpGroup).excludedIds(currentDmpId).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Dmp._id)).stream().map(DmpEntity::getId).toList();
|
List<UUID> dmpIds = dmpQuery.groupIds(dmpGroup).excludedIds(currentDmpId).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Dmp._id)).stream().map(DmpEntity::getId).toList();
|
||||||
|
|
||||||
//GK: Step two get it's doiEntity
|
//GK: Step two get it's doiEntity
|
||||||
List<EntityDoiEntity> dois = this.queryFactory.query(EntityDoiQuery.class).repositoryIds(repositoryId).entityIds(dmpIds).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(EntityDoi._entityId, EntityDoi._doi));
|
List<EntityDoiEntity> dois = this.queryFactory.query(EntityDoiQuery.class).disableTracking().repositoryIds(this.repositoryId).entityIds(dmpIds).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(EntityDoi._entityId, EntityDoi._doi));
|
||||||
for(UUID uuid: dmpIds) {
|
for(UUID uuid: dmpIds) {
|
||||||
EntityDoiEntity doiEntity = dois.stream().filter(x -> x.getEntityId().equals(uuid)).findFirst().orElse(null);
|
EntityDoiEntity doiEntity = dois.stream().filter(x -> x.getEntityId().equals(uuid)).findFirst().orElse(null);
|
||||||
if (doiEntity != null) return doiEntity.getDoi();
|
if (doiEntity != null) return doiEntity.getDoi();
|
||||||
|
@ -176,7 +177,7 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
||||||
this.logger.debug("checking related - {}", DmpUser.class.getSimpleName());
|
this.logger.debug("checking related - {}", DmpUser.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, List<DmpUserModel>> itemMap;
|
Map<UUID, List<DmpUserModel>> itemMap;
|
||||||
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).isActives(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).disableTracking().isActives(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpUserCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, DmpUserEntity::getDmpId);
|
itemMap = this.builderFactory.builder(DmpUserCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, DmpUserEntity::getDmpId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
@ -186,7 +187,7 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
||||||
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, List<DmpReferenceModel>> itemMap;
|
Map<UUID, List<DmpReferenceModel>> itemMap;
|
||||||
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).isActives(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().isActives(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpReferenceCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, DmpReferenceEntity::getDmpId);
|
itemMap = this.builderFactory.builder(DmpReferenceCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, DmpReferenceEntity::getDmpId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
@ -197,8 +198,8 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
||||||
this.logger.debug("checking related - {}", Description.class.getSimpleName());
|
this.logger.debug("checking related - {}", Description.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, List<DescriptionModel>> itemMap;
|
Map<UUID, List<DescriptionModel>> itemMap;
|
||||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).isActive(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionCommonModelBuilder.class).setRepositoryId(repositoryId).useSharedStorage(useSharedStorage).authorize(this.authorize).asMasterKey(query, DescriptionEntity::getDmpId);
|
itemMap = this.builderFactory.builder(DescriptionCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).authorize(this.authorize).asMasterKey(query, DescriptionEntity::getDmpId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +209,7 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
||||||
this.logger.debug("checking related - {}", EntityDoi.class.getSimpleName());
|
this.logger.debug("checking related - {}", EntityDoi.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, List<EntityDoiModel>> itemMap;
|
Map<UUID, List<EntityDoiModel>> itemMap;
|
||||||
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).isActive(IsActive.Active).authorize(this.authorize).entityIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).entityIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(EntityDoiCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, EntityDoiEntity::getEntityId);
|
itemMap = this.builderFactory.builder(EntityDoiCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, EntityDoiEntity::getEntityId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
@ -220,7 +221,7 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
||||||
this.logger.debug("checking related - {}", UserModel.class.getSimpleName());
|
this.logger.debug("checking related - {}", UserModel.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, UserModel> itemMap;
|
Map<UUID, UserModel> itemMap;
|
||||||
UserQuery q = this.queryFactory.query(UserQuery.class).isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().filter(x-> x.getCreatorId() != null).map(DmpEntity::getCreatorId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().disableTracking().isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().filter(x-> x.getCreatorId() != null).map(DmpEntity::getCreatorId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, UserEntity::getId);
|
itemMap = this.builderFactory.builder(UserCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, UserEntity::getId);
|
||||||
return itemMap;
|
return itemMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.opencdmp.model.builder.commonmodels.dmp;
|
package org.opencdmp.model.builder.commonmodels.dmp;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commonmodels.models.UserModel;
|
import org.opencdmp.commonmodels.models.UserModel;
|
||||||
import org.opencdmp.commonmodels.models.dmp.DmpContactModel;
|
import org.opencdmp.commonmodels.models.dmp.DmpContactModel;
|
||||||
|
@ -11,10 +15,6 @@ import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||||
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
||||||
import org.opencdmp.model.builder.commonmodels.UserCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.UserCommonModelBuilder;
|
||||||
import org.opencdmp.query.UserQuery;
|
import org.opencdmp.query.UserQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -25,7 +25,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpContactCommonModelBuilder extends BaseCommonModelBuilder<DmpContactModel, DmpContactEntity> {
|
public class DmpContactCommonModelBuilder extends BaseCommonModelBuilder<DmpContactModel, DmpContactEntity> {
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
@ -72,7 +72,7 @@ public class DmpContactCommonModelBuilder extends BaseCommonModelBuilder<DmpCont
|
||||||
this.logger.debug("checking related - {}", UserModel.class.getSimpleName());
|
this.logger.debug("checking related - {}", UserModel.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, UserModel> itemMap;
|
Map<UUID, UserModel> itemMap;
|
||||||
UserQuery q = this.queryFactory.query(UserQuery.class).isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().filter(x-> x.getUserId() != null).map(DmpContactEntity::getUserId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().filter(x-> x.getUserId() != null).map(DmpContactEntity::getUserId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserCommonModelBuilder.class).disableContacts(true).authorize(this.authorize).asForeignKey(q, UserEntity::getId);
|
itemMap = this.builderFactory.builder(UserCommonModelBuilder.class).disableContacts(true).authorize(this.authorize).asForeignKey(q, UserEntity::getId);
|
||||||
return itemMap;
|
return itemMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package org.opencdmp.model.builder.commonmodels.dmpblueprint;
|
package org.opencdmp.model.builder.commonmodels.dmpblueprint;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import org.opencdmp.commonmodels.models.dmpblueprint.ReferenceTypeFieldModel;
|
import org.opencdmp.commonmodels.models.dmpblueprint.ReferenceTypeFieldModel;
|
||||||
import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity;
|
import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.model.builder.commonmodels.ReferenceTypeCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.ReferenceTypeCommonModelBuilder;
|
||||||
import org.opencdmp.query.ReferenceTypeQuery;
|
import org.opencdmp.query.ReferenceTypeQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class ReferenceTypeFieldCommonModelBuilder extends FieldCommonModelBuilder<ReferenceTypeFieldModel, ReferenceTypeFieldEntity> {
|
public class ReferenceTypeFieldCommonModelBuilder extends FieldCommonModelBuilder<ReferenceTypeFieldModel, ReferenceTypeFieldEntity> {
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -30,7 +30,7 @@ public class ReferenceTypeFieldCommonModelBuilder extends FieldCommonModelBuilde
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ReferenceTypeFieldModel buildChild(ReferenceTypeFieldEntity data, ReferenceTypeFieldModel model) {
|
protected ReferenceTypeFieldModel buildChild(ReferenceTypeFieldEntity data, ReferenceTypeFieldModel model) {
|
||||||
if (data.getReferenceTypeId() != null ) model.setReferenceType(this.builderFactory.builder(ReferenceTypeCommonModelBuilder.class).build(this.queryFactory.query(ReferenceTypeQuery.class).ids(data.getReferenceTypeId()).first())); //TODO: Optimize
|
if (data.getReferenceTypeId() != null ) model.setReferenceType(this.builderFactory.builder(ReferenceTypeCommonModelBuilder.class).build(this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(data.getReferenceTypeId()).first())); //TODO: Optimize
|
||||||
model.setMultipleSelect(data.getMultipleSelect());
|
model.setMultipleSelect(data.getMultipleSelect());
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.opencdmp.model.builder.commonmodels.dmpreference;
|
package org.opencdmp.model.builder.commonmodels.dmpreference;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commonmodels.models.dmpreference.DmpReferenceModel;
|
import org.opencdmp.commonmodels.models.dmpreference.DmpReferenceModel;
|
||||||
import org.opencdmp.commonmodels.models.reference.ReferenceModel;
|
import org.opencdmp.commonmodels.models.reference.ReferenceModel;
|
||||||
|
@ -12,10 +16,6 @@ import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||||
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
||||||
import org.opencdmp.model.builder.commonmodels.reference.ReferenceCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.reference.ReferenceCommonModelBuilder;
|
||||||
import org.opencdmp.query.ReferenceQuery;
|
import org.opencdmp.query.ReferenceQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpReferenceCommonModelBuilder extends BaseCommonModelBuilder<DmpReferenceModel, DmpReferenceEntity> {
|
public class DmpReferenceCommonModelBuilder extends BaseCommonModelBuilder<DmpReferenceModel, DmpReferenceEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -78,7 +78,7 @@ public class DmpReferenceCommonModelBuilder extends BaseCommonModelBuilder<DmpRe
|
||||||
this.logger.debug("checking related - {}", ReferenceModel.class.getSimpleName());
|
this.logger.debug("checking related - {}", ReferenceModel.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, ReferenceModel> itemMap;
|
Map<UUID, ReferenceModel> itemMap;
|
||||||
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).ids(data.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(ReferenceCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, ReferenceEntity::getId);
|
itemMap = this.builderFactory.builder(ReferenceCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, ReferenceEntity::getId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.opencdmp.model.builder.commonmodels.reference;
|
package org.opencdmp.model.builder.commonmodels.reference;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commonmodels.enums.ReferenceSourceType;
|
import org.opencdmp.commonmodels.enums.ReferenceSourceType;
|
||||||
import org.opencdmp.commonmodels.models.reference.ReferenceModel;
|
import org.opencdmp.commonmodels.models.reference.ReferenceModel;
|
||||||
|
@ -7,16 +11,12 @@ import org.opencdmp.commonmodels.models.reference.ReferenceTypeModel;
|
||||||
import org.opencdmp.commons.XmlHandlingService;
|
import org.opencdmp.commons.XmlHandlingService;
|
||||||
import org.opencdmp.commons.types.reference.DefinitionEntity;
|
import org.opencdmp.commons.types.reference.DefinitionEntity;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.data.ReferenceTypeEntity;
|
|
||||||
import org.opencdmp.data.ReferenceEntity;
|
import org.opencdmp.data.ReferenceEntity;
|
||||||
|
import org.opencdmp.data.ReferenceTypeEntity;
|
||||||
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||||
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
||||||
import org.opencdmp.model.builder.commonmodels.ReferenceTypeCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.ReferenceTypeCommonModelBuilder;
|
||||||
import org.opencdmp.query.ReferenceTypeQuery;
|
import org.opencdmp.query.ReferenceTypeQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -27,7 +27,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class ReferenceCommonModelBuilder extends BaseCommonModelBuilder<ReferenceModel, ReferenceEntity> {
|
public class ReferenceCommonModelBuilder extends BaseCommonModelBuilder<ReferenceModel, ReferenceEntity> {
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -89,7 +89,7 @@ public class ReferenceCommonModelBuilder extends BaseCommonModelBuilder<Referenc
|
||||||
this.logger.debug("checking related - {}", ReferenceTypeModel.class.getSimpleName());
|
this.logger.debug("checking related - {}", ReferenceTypeModel.class.getSimpleName());
|
||||||
|
|
||||||
Map<UUID, ReferenceTypeModel> itemMap;
|
Map<UUID, ReferenceTypeModel> itemMap;
|
||||||
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).ids(data.stream().map(ReferenceEntity::getTypeId).distinct().collect(Collectors.toList()));
|
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(ReferenceEntity::getTypeId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(ReferenceTypeCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, ReferenceTypeEntity::getId);
|
itemMap = this.builderFactory.builder(ReferenceTypeCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, ReferenceTypeEntity::getId);
|
||||||
|
|
||||||
return itemMap;
|
return itemMap;
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
||||||
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(DescriptionEntity::getCreatedById).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getCreatedById).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)) {
|
||||||
|
@ -189,7 +189,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
||||||
DmpDescriptionTemplate::getId);
|
DmpDescriptionTemplate::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DmpDescriptionTemplate._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DmpDescriptionTemplate._id);
|
||||||
DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DmpDescriptionTemplate::getId);
|
itemMap = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DmpDescriptionTemplate::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(DmpDescriptionTemplate._id)) {
|
if (!fields.hasField(DmpDescriptionTemplate._id)) {
|
||||||
|
@ -219,7 +219,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
||||||
DescriptionTemplate::getId);
|
DescriptionTemplate::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id);
|
||||||
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DescriptionTemplate::getId);
|
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DescriptionTemplate::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(DescriptionTemplate._id)) {
|
if (!fields.hasField(DescriptionTemplate._id)) {
|
||||||
|
@ -238,7 +238,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
||||||
this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName());
|
this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName());
|
||||||
|
|
||||||
Map<java.util.UUID, DefinitionEntity> itemMap = new HashMap<>();
|
Map<java.util.UUID, DefinitionEntity> itemMap = new HashMap<>();
|
||||||
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList()));
|
||||||
List<DescriptionTemplateEntity> items = q.collectAs(new BaseFieldSet().ensure(DescriptionTemplate._id).ensure(DescriptionTemplate._definition));
|
List<DescriptionTemplateEntity> items = q.collectAs(new BaseFieldSet().ensure(DescriptionTemplate._id).ensure(DescriptionTemplate._definition));
|
||||||
for (DescriptionTemplateEntity item : items){
|
for (DescriptionTemplateEntity item : items){
|
||||||
DefinitionEntity definition =this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, item.getDefinition());
|
DefinitionEntity definition =this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, item.getDefinition());
|
||||||
|
@ -265,7 +265,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
||||||
Dmp::getId);
|
Dmp::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Dmp._id)) {
|
if (!fields.hasField(Dmp._id)) {
|
||||||
|
@ -284,7 +284,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
||||||
|
|
||||||
Map<UUID, List<DescriptionReference>> itemMap;
|
Map<UUID, List<DescriptionReference>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DescriptionReference._description, Description._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DescriptionReference._description, Description._id));
|
||||||
DescriptionReferenceQuery query = this.queryFactory.query(DescriptionReferenceQuery.class).authorize(this.authorize).descriptionIds(data.stream().map(DescriptionEntity::getId).distinct().collect(Collectors.toList()));
|
DescriptionReferenceQuery query = this.queryFactory.query(DescriptionReferenceQuery.class).disableTracking().authorize(this.authorize).descriptionIds(data.stream().map(DescriptionEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionReferenceBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDescription().getId());
|
itemMap = this.builderFactory.builder(DescriptionReferenceBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDescription().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(DescriptionReference._description, Description._id))) {
|
if (!fields.hasField(this.asIndexer(DescriptionReference._description, Description._id))) {
|
||||||
|
@ -302,7 +302,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
||||||
|
|
||||||
Map<UUID, List<DescriptionTag>> itemMap;
|
Map<UUID, List<DescriptionTag>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DescriptionTag._description, Description._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DescriptionTag._description, Description._id));
|
||||||
DescriptionTagQuery query = this.queryFactory.query(DescriptionTagQuery.class).authorize(this.authorize).descriptionIds(data.stream().map(DescriptionEntity::getId).distinct().collect(Collectors.toList()));
|
DescriptionTagQuery query = this.queryFactory.query(DescriptionTagQuery.class).disableTracking().authorize(this.authorize).descriptionIds(data.stream().map(DescriptionEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionTagBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDescription().getId());
|
itemMap = this.builderFactory.builder(DescriptionTagBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDescription().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(DescriptionTag._description, Description._id))) {
|
if (!fields.hasField(this.asIndexer(DescriptionTag._description, Description._id))) {
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class FieldBuilder extends BaseBuilder<Field, FieldEntity> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
||||||
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).ids(ids);
|
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).disableTracking().authorize(this.authorize).ids(ids);
|
||||||
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class DescriptionReferenceBuilder extends BaseBuilder<DescriptionReferenc
|
||||||
Description::getId);
|
Description::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
||||||
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionReferenceEntity::getDescriptionId).distinct().collect(Collectors.toList()));
|
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionReferenceEntity::getDescriptionId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Description::getId);
|
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Description::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Description._id)) {
|
if (!fields.hasField(Description._id)) {
|
||||||
|
@ -143,7 +143,7 @@ public class DescriptionReferenceBuilder extends BaseBuilder<DescriptionReferenc
|
||||||
Reference::getId);
|
Reference::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
||||||
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).ids(data.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Reference._id)) {
|
if (!fields.hasField(Reference._id)) {
|
||||||
|
|
|
@ -1,19 +1,5 @@
|
||||||
package org.opencdmp.model.builder.descriptiontemplate;
|
package org.opencdmp.model.builder.descriptiontemplate;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.XmlHandlingService;
|
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
|
||||||
import org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.DescriptionTemplateEntity;
|
|
||||||
import org.opencdmp.model.builder.BaseBuilder;
|
|
||||||
import org.opencdmp.model.builder.DescriptionTemplateTypeBuilder;
|
|
||||||
import org.opencdmp.model.builder.UserDescriptionTemplateBuilder;
|
|
||||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
|
||||||
import org.opencdmp.model.DescriptionTemplateType;
|
|
||||||
import org.opencdmp.model.UserDescriptionTemplate;
|
|
||||||
import org.opencdmp.query.DescriptionTemplateTypeQuery;
|
|
||||||
import org.opencdmp.query.UserDescriptionTemplateQuery;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -21,6 +7,20 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.XmlHandlingService;
|
||||||
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
|
import org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.DescriptionTemplateEntity;
|
||||||
|
import org.opencdmp.model.DescriptionTemplateType;
|
||||||
|
import org.opencdmp.model.UserDescriptionTemplate;
|
||||||
|
import org.opencdmp.model.builder.BaseBuilder;
|
||||||
|
import org.opencdmp.model.builder.DescriptionTemplateTypeBuilder;
|
||||||
|
import org.opencdmp.model.builder.UserDescriptionTemplateBuilder;
|
||||||
|
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||||
|
import org.opencdmp.query.DescriptionTemplateTypeQuery;
|
||||||
|
import org.opencdmp.query.UserDescriptionTemplateQuery;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -31,7 +31,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate, DescriptionTemplateEntity> {
|
public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate, DescriptionTemplateEntity> {
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
@ -131,11 +131,11 @@ public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate,
|
||||||
x -> x.getId());
|
x -> x.getId());
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplateType._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplateType._id);
|
||||||
DescriptionTemplateTypeQuery q = this.queryFactory.query(DescriptionTemplateTypeQuery.class).ids(data.stream().map(DescriptionTemplateEntity::getTypeId).distinct().collect(Collectors.toList()));
|
DescriptionTemplateTypeQuery q = this.queryFactory.query(DescriptionTemplateTypeQuery.class).disableTracking().ids(data.stream().map(DescriptionTemplateEntity::getTypeId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).asForeignKey(q, clone, DescriptionTemplateType::getId);
|
itemMap = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).asForeignKey(q, clone, DescriptionTemplateType::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(DescriptionTemplateType._id)) {
|
if (!fields.hasField(DescriptionTemplateType._id)) {
|
||||||
itemMap.values().stream().filter(x -> x != null).map(x -> {
|
itemMap.values().stream().filter(Objects::nonNull).map(x -> {
|
||||||
x.setId(null);
|
x.setId(null);
|
||||||
return x;
|
return x;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -151,7 +151,7 @@ public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate,
|
||||||
|
|
||||||
Map<UUID, List<UserDescriptionTemplate>> itemMap = null;
|
Map<UUID, List<UserDescriptionTemplate>> itemMap = null;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserDescriptionTemplate._descriptionTemplate, DescriptionTemplate._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserDescriptionTemplate._descriptionTemplate, DescriptionTemplate._id));
|
||||||
UserDescriptionTemplateQuery query = this.queryFactory.query(UserDescriptionTemplateQuery.class).authorize(this.authorize).descriptionTemplateIds(data.stream().map(DescriptionTemplateEntity::getId).distinct().collect(Collectors.toList()));
|
UserDescriptionTemplateQuery query = this.queryFactory.query(UserDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).descriptionTemplateIds(data.stream().map(DescriptionTemplateEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(UserDescriptionTemplateBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDescriptionTemplate().getId());
|
itemMap = this.builderFactory.builder(UserDescriptionTemplateBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDescriptionTemplate().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(UserDescriptionTemplate._descriptionTemplate, DescriptionTemplate._id))) {
|
if (!fields.hasField(this.asIndexer(UserDescriptionTemplate._descriptionTemplate, DescriptionTemplate._id))) {
|
||||||
|
|
|
@ -37,6 +37,6 @@ public class ReferenceTypeDataBuilder extends BaseFieldDataBuilder<ReferenceType
|
||||||
if (fields.hasField(this.asIndexer(ReferenceTypeData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
|
if (fields.hasField(this.asIndexer(ReferenceTypeData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
|
||||||
|
|
||||||
FieldSet referenceTypeFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeData._referenceType));
|
FieldSet referenceTypeFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeData._referenceType));
|
||||||
if (d.getReferenceTypeId() != null && !referenceTypeFields.isEmpty() ) m.setReferenceType(this.builderFactory.builder(ReferenceTypeBuilder.class).build(referenceTypeFields, this.queryFactory.query(ReferenceTypeQuery.class).ids(d.getReferenceTypeId()).first())); //TODO: Optimize
|
if (d.getReferenceTypeId() != null && !referenceTypeFields.isEmpty() ) m.setReferenceType(this.builderFactory.builder(ReferenceTypeBuilder.class).build(referenceTypeFields, this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(d.getReferenceTypeId()).first())); //TODO: Optimize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import jakarta.persistence.PersistenceContext;
|
||||||
import org.opencdmp.authorization.AffiliatedResource;
|
import org.opencdmp.authorization.AffiliatedResource;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.authorization.authorizationcontentresolver.AuthorizationContentResolver;
|
import org.opencdmp.authorization.authorizationcontentresolver.AuthorizationContentResolver;
|
||||||
|
@ -43,6 +45,8 @@ import java.util.stream.Collectors;
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
|
|
||||||
|
@PersistenceContext
|
||||||
|
private EntityManager entityManager;
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
|
||||||
private final BuilderFactory builderFactory;
|
private final BuilderFactory builderFactory;
|
||||||
|
@ -148,7 +152,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
|
|
||||||
Map<UUID, List<DmpReference>> itemMap;
|
Map<UUID, List<DmpReference>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._dmp, DmpReference._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._dmp, DmpReference._id));
|
||||||
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(DmpReference._dmp, Dmp._id))) {
|
if (!fields.hasField(this.asIndexer(DmpReference._dmp, Dmp._id))) {
|
||||||
|
@ -166,7 +170,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
|
|
||||||
Map<UUID, List<EntityDoi>> itemMap;
|
Map<UUID, List<EntityDoi>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(EntityDoi._entityId));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(EntityDoi._entityId));
|
||||||
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(EntityDoiBuilder.class).authorize(this.authorize).asMasterKey(query, clone, EntityDoi::getEntityId);
|
itemMap = this.builderFactory.builder(EntityDoiBuilder.class).authorize(this.authorize).asMasterKey(query, clone, EntityDoi::getEntityId);
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(EntityDoi._entityId))) {
|
if (!fields.hasField(this.asIndexer(EntityDoi._entityId))) {
|
||||||
|
@ -195,7 +199,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
DmpBlueprint::getId);
|
DmpBlueprint::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DmpBlueprint._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DmpBlueprint._id);
|
||||||
DmpBlueprintQuery q = this.queryFactory.query(DmpBlueprintQuery.class).authorize(this.authorize).ids(data.stream().map(DmpEntity::getBlueprintId).distinct().collect(Collectors.toList()));
|
DmpBlueprintQuery q = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpEntity::getBlueprintId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DmpBlueprint::getId);
|
itemMap = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DmpBlueprint::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(DmpBlueprint._id)) {
|
if (!fields.hasField(DmpBlueprint._id)) {
|
||||||
|
@ -225,7 +229,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
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(DmpEntity::getCreatorId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpEntity::getCreatorId).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)) {
|
||||||
|
@ -245,7 +249,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
|
|
||||||
Map<UUID, List<DmpUser>> itemMap;
|
Map<UUID, List<DmpUser>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpUser._dmp, DmpUser._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpUser._dmp, DmpUser._id));
|
||||||
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(DmpUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(DmpUser._dmp, Dmp._id))) {
|
if (!fields.hasField(this.asIndexer(DmpUser._dmp, Dmp._id))) {
|
||||||
|
@ -263,7 +267,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
|
|
||||||
Map<UUID, List<Description>> itemMap;
|
Map<UUID, List<Description>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(Description._dmp, Description._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(Description._dmp, Description._id));
|
||||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(Description._dmp, Dmp._id))) {
|
if (!fields.hasField(this.asIndexer(Description._dmp, Dmp._id))) {
|
||||||
|
@ -281,7 +285,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||||
|
|
||||||
Map<UUID, List<DmpDescriptionTemplate>> itemMap;
|
Map<UUID, List<DmpDescriptionTemplate>> itemMap;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpDescriptionTemplate._dmp, DmpDescriptionTemplate._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpDescriptionTemplate._dmp, DmpDescriptionTemplate._id));
|
||||||
DmpDescriptionTemplateQuery query = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
DmpDescriptionTemplateQuery query = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
itemMap = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(DmpDescriptionTemplate._dmp, Dmp._id))) {
|
if (!fields.hasField(this.asIndexer(DmpDescriptionTemplate._dmp, Dmp._id))) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class DmpContactBuilder extends BaseBuilder<DmpContact, DmpContactEntity>
|
||||||
DmpAssociatedUser::getId);
|
DmpAssociatedUser::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().filter(x-> x.getUserId() != null).map(DmpContactEntity::getUserId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().filter(x-> x.getUserId() != null).map(DmpContactEntity::getUserId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpAssociatedUserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DmpAssociatedUser::getId);
|
itemMap = this.builderFactory.builder(DmpAssociatedUserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DmpAssociatedUser::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(User._id)) {
|
if (!fields.hasField(User._id)) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ReferenceFieldBuilder extends FieldBuilder<ReferenceTypeField, Refe
|
||||||
protected ReferenceTypeField buildChild(FieldSet fields, ReferenceTypeFieldEntity data, ReferenceTypeField model) {
|
protected ReferenceTypeField buildChild(FieldSet fields, ReferenceTypeFieldEntity data, ReferenceTypeField model) {
|
||||||
FieldSet referenceTypeFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeField._referenceType));
|
FieldSet referenceTypeFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeField._referenceType));
|
||||||
|
|
||||||
if (data.getReferenceTypeId() != null && !referenceTypeFields.isEmpty() ) model.setReferenceType(this.builderFactory.builder(ReferenceTypeBuilder.class).build(referenceTypeFields, this.queryFactory.query(ReferenceTypeQuery.class).ids(data.getReferenceTypeId()).first())); //TODO: Optimize
|
if (data.getReferenceTypeId() != null && !referenceTypeFields.isEmpty() ) model.setReferenceType(this.builderFactory.builder(ReferenceTypeBuilder.class).build(referenceTypeFields, this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(data.getReferenceTypeId()).first())); //TODO: Optimize
|
||||||
if (fields.hasField(this.asIndexer(ReferenceTypeField._multipleSelect))) model.setMultipleSelect(data.getMultipleSelect());
|
if (fields.hasField(this.asIndexer(ReferenceTypeField._multipleSelect))) model.setMultipleSelect(data.getMultipleSelect());
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
|
||||||
m.getFields().addAll(this.builderFactory.builder(ReferenceFieldBuilder.class).authorize(this.authorize).build(fieldsFields, referenceFieldEntities));
|
m.getFields().addAll(this.builderFactory.builder(ReferenceFieldBuilder.class).authorize(this.authorize).build(fieldsFields, referenceFieldEntities));
|
||||||
}
|
}
|
||||||
if (!prefillingSourcesFields.isEmpty() && d.getPrefillingSourcesIds() != null) {
|
if (!prefillingSourcesFields.isEmpty() && d.getPrefillingSourcesIds() != null) {
|
||||||
List<PrefillingSourceEntity> prefillingSourceEntities = this.queryFactory.query(PrefillingSourceQuery.class).authorize(this.authorize).ids(d.getPrefillingSourcesIds()).collectAs(prefillingSourcesFields);
|
List<PrefillingSourceEntity> prefillingSourceEntities = this.queryFactory.query(PrefillingSourceQuery.class).disableTracking().authorize(this.authorize).ids(d.getPrefillingSourcesIds()).collectAs(prefillingSourcesFields);
|
||||||
m.setPrefillingSources(this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(this.authorize).build(prefillingSourcesFields, prefillingSourceEntities));
|
m.setPrefillingSources(this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(this.authorize).build(prefillingSourcesFields, prefillingSourceEntities));
|
||||||
}
|
}
|
||||||
models.add(m);
|
models.add(m);
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class DmpReferenceBuilder extends BaseBuilder<DmpReference, DmpReferenceE
|
||||||
Reference::getId);
|
Reference::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
||||||
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).ids(data.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Reference._id)) {
|
if (!fields.hasField(Reference._id)) {
|
||||||
|
@ -137,7 +137,7 @@ public class DmpReferenceBuilder extends BaseBuilder<DmpReference, DmpReferenceE
|
||||||
Dmp::getId);
|
Dmp::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id);
|
||||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).ids(data.stream().map(DmpReferenceEntity::getDmpId).distinct().collect(Collectors.toList()));
|
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DmpReferenceEntity::getDmpId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(Dmp._id)) {
|
if (!fields.hasField(Dmp._id)) {
|
||||||
|
|
|
@ -97,7 +97,7 @@ public abstract class ExternalFetcherBaseSourceConfigurationBuilder<Model extend
|
||||||
ReferenceType::getId);
|
ReferenceType::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(ReferenceType._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(ReferenceType._id);
|
||||||
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).ids(data.stream().filter(x-> x.getReferenceTypeDependencyIds() != null).map(ExternalFetcherBaseSourceConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList()));
|
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().filter(x-> x.getReferenceTypeDependencyIds() != null).map(ExternalFetcherBaseSourceConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, ReferenceType::getId);
|
itemMap = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, ReferenceType::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(ReferenceType._id)) {
|
if (!fields.hasField(ReferenceType._id)) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class QueryCaseConfigBuilder extends BaseBuilder<QueryCaseConfig, QueryCa
|
||||||
ReferenceType::getId);
|
ReferenceType::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(ReferenceType._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(ReferenceType._id);
|
||||||
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).ids(data.stream().filter(x-> x.getReferenceTypeId() != null).map(QueryCaseConfigEntity::getReferenceTypeId).distinct().collect(Collectors.toList()));
|
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().filter(x-> x.getReferenceTypeId() != null).map(QueryCaseConfigEntity::getReferenceTypeId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, ReferenceType::getId);
|
itemMap = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, ReferenceType::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(ReferenceType._id)) {
|
if (!fields.hasField(ReferenceType._id)) {
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity> {
|
||||||
ReferenceType::getId);
|
ReferenceType::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(ReferenceType._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(ReferenceType._id);
|
||||||
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).ids(data.stream().map(ReferenceEntity::getTypeId).distinct().collect(Collectors.toList()));
|
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(ReferenceEntity::getTypeId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, ReferenceType::getId);
|
itemMap = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, ReferenceType::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(ReferenceType._id)) {
|
if (!fields.hasField(ReferenceType._id)) {
|
||||||
|
@ -153,7 +153,7 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity> {
|
||||||
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(ReferenceEntity::getCreatedById).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(ReferenceEntity::getCreatedById).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)) {
|
||||||
|
@ -172,7 +172,7 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity> {
|
||||||
|
|
||||||
Map<UUID, List<DmpReference>> itemMap = null;
|
Map<UUID, List<DmpReference>> itemMap = null;
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._reference, Reference._id));
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._reference, Reference._id));
|
||||||
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).referenceIds(data.stream().map(ReferenceEntity::getId).distinct().collect(Collectors.toList()));
|
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().authorize(this.authorize).referenceIds(data.stream().map(ReferenceEntity::getId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getReference().getId());
|
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getReference().getId());
|
||||||
|
|
||||||
if (!fields.hasField(this.asIndexer(DmpReference._reference, Reference._id))) {
|
if (!fields.hasField(this.asIndexer(DmpReference._reference, Reference._id))) {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package org.opencdmp.model.builder.tenantconfiguration;
|
package org.opencdmp.model.builder.tenantconfiguration;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commons.types.tenantconfiguration.LogoTenantConfigurationEntity;
|
import org.opencdmp.commons.types.tenantconfiguration.LogoTenantConfigurationEntity;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
@ -8,13 +15,6 @@ import org.opencdmp.model.builder.BaseBuilder;
|
||||||
import org.opencdmp.model.builder.StorageFileBuilder;
|
import org.opencdmp.model.builder.StorageFileBuilder;
|
||||||
import org.opencdmp.model.tenantconfiguration.LogoTenantConfiguration;
|
import org.opencdmp.model.tenantconfiguration.LogoTenantConfiguration;
|
||||||
import org.opencdmp.query.StorageFileQuery;
|
import org.opencdmp.query.StorageFileQuery;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
@ -25,7 +25,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class LogoTenantConfigurationBuilder extends BaseBuilder<LogoTenantConfiguration, LogoTenantConfigurationEntity> {
|
public class LogoTenantConfigurationBuilder extends BaseBuilder<LogoTenantConfiguration, LogoTenantConfigurationEntity> {
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class LogoTenantConfigurationBuilder extends BaseBuilder<LogoTenantConfig
|
||||||
StorageFile::getId);
|
StorageFile::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(StorageFile._id);
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(StorageFile._id);
|
||||||
StorageFileQuery q = this.queryFactory.query(StorageFileQuery.class).authorize(this.authorize).ids(data.stream().map(LogoTenantConfigurationEntity::getStorageFileId).distinct().collect(Collectors.toList()));
|
StorageFileQuery q = this.queryFactory.query(StorageFileQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(LogoTenantConfigurationEntity::getStorageFileId).distinct().collect(Collectors.toList()));
|
||||||
itemMap = this.builderFactory.builder(StorageFileBuilder.class).authorize(this.authorize).asForeignKey(q, clone, StorageFile::getId);
|
itemMap = this.builderFactory.builder(StorageFileBuilder.class).authorize(this.authorize).asForeignKey(q, clone, StorageFile::getId);
|
||||||
}
|
}
|
||||||
if (!fields.hasField(StorageFile._id)) {
|
if (!fields.hasField(StorageFile._id)) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class UserCredentialBuilder extends BaseBuilder<UserCredential, UserCrede
|
||||||
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(UserCredentialEntity::getUserId).distinct().collect(Collectors.toList()));
|
UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(UserCredentialEntity::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)) {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.opencdmp.model.persist;
|
package org.opencdmp.model.persist;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commons.XmlHandlingService;
|
import org.opencdmp.commons.XmlHandlingService;
|
||||||
import org.opencdmp.commons.enums.DescriptionStatus;
|
import org.opencdmp.commons.enums.DescriptionStatus;
|
||||||
|
@ -13,9 +16,6 @@ import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
||||||
import org.opencdmp.model.persist.descriptionproperties.PropertyDefinitionPersist;
|
import org.opencdmp.model.persist.descriptionproperties.PropertyDefinitionPersist;
|
||||||
import org.opencdmp.query.DescriptionQuery;
|
import org.opencdmp.query.DescriptionQuery;
|
||||||
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
@ -67,7 +67,7 @@ public class DescriptionPersist {
|
||||||
public static final String _hash = "hash";
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(UUID id) {
|
public void setId(UUID id) {
|
||||||
|
@ -75,7 +75,7 @@ public class DescriptionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return this.label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public void setLabel(String label) {
|
||||||
|
@ -83,7 +83,7 @@ public class DescriptionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getDmpId() {
|
public UUID getDmpId() {
|
||||||
return dmpId;
|
return this.dmpId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDmpId(UUID dmpId) {
|
public void setDmpId(UUID dmpId) {
|
||||||
|
@ -91,7 +91,7 @@ public class DescriptionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getDmpDescriptionTemplateId() {
|
public UUID getDmpDescriptionTemplateId() {
|
||||||
return dmpDescriptionTemplateId;
|
return this.dmpDescriptionTemplateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDmpDescriptionTemplateId(UUID dmpDescriptionTemplateId) {
|
public void setDmpDescriptionTemplateId(UUID dmpDescriptionTemplateId) {
|
||||||
|
@ -99,7 +99,7 @@ public class DescriptionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DescriptionStatus getStatus() {
|
public DescriptionStatus getStatus() {
|
||||||
return status;
|
return this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(DescriptionStatus status) {
|
public void setStatus(DescriptionStatus status) {
|
||||||
|
@ -107,7 +107,7 @@ public class DescriptionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
|
@ -115,7 +115,7 @@ public class DescriptionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyDefinitionPersist getProperties() {
|
public PropertyDefinitionPersist getProperties() {
|
||||||
return properties;
|
return this.properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProperties(PropertyDefinitionPersist properties) {
|
public void setProperties(PropertyDefinitionPersist properties) {
|
||||||
|
@ -123,7 +123,7 @@ public class DescriptionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getTags() {
|
public List<String> getTags() {
|
||||||
return tags;
|
return this.tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTags(List<String> tags) {
|
public void setTags(List<String> tags) {
|
||||||
|
@ -131,7 +131,7 @@ public class DescriptionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHash() {
|
public String getHash() {
|
||||||
return hash;
|
return this.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHash(String hash) {
|
public void setHash(String hash) {
|
||||||
|
@ -139,7 +139,7 @@ public class DescriptionPersist {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getDescriptionTemplateId() {
|
public UUID getDescriptionTemplateId() {
|
||||||
return descriptionTemplateId;
|
return this.descriptionTemplateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
||||||
|
@ -193,37 +193,37 @@ public class DescriptionPersist {
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> this.isValidGuid(item.getId()))
|
.iff(() -> this.isValidGuid(item.getId()))
|
||||||
.must(() -> this.isValidHash(item.getHash()))
|
.must(() -> this.isValidHash(item.getHash()))
|
||||||
.failOn(DescriptionPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._hash}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._hash).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._hash}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> !this.isValidGuid(item.getId()))
|
.iff(() -> !this.isValidGuid(item.getId()))
|
||||||
.must(() -> !this.isValidHash(item.getHash()))
|
.must(() -> !this.isValidHash(item.getHash()))
|
||||||
.failOn(DescriptionPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._hash).failWith(this.messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isEmpty(item.getLabel()))
|
.must(() -> !this.isEmpty(item.getLabel()))
|
||||||
.failOn(DescriptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._label}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> !this.isEmpty(item.getLabel()))
|
.iff(() -> !this.isEmpty(item.getLabel()))
|
||||||
.must(() -> this.lessEqualLength(item.getLabel(), DescriptionEntity._labelLength))
|
.must(() -> this.lessEqualLength(item.getLabel(), DescriptionEntity._labelLength))
|
||||||
.failOn(DescriptionPersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionPersist._label}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionPersist._label}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> this.isValidGuid(item.getDmpId()))
|
.must(() -> this.isValidGuid(item.getDmpId()))
|
||||||
.failOn(DescriptionPersist._dmpId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpId}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._dmpId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpId}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> this.isValidGuid(item.getDescriptionTemplateId()))
|
.must(() -> this.isValidGuid(item.getDescriptionTemplateId()))
|
||||||
.failOn(DescriptionPersist._descriptionTemplateId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._descriptionTemplateId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> this.isValidGuid(item.getDmpDescriptionTemplateId()))
|
.must(() -> this.isValidGuid(item.getDmpDescriptionTemplateId()))
|
||||||
.failOn(DescriptionPersist._dmpDescriptionTemplateId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpDescriptionTemplateId}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._dmpDescriptionTemplateId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpDescriptionTemplateId}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> !this.isNull(item.getStatus()))
|
.must(() -> !this.isNull(item.getStatus()))
|
||||||
.failOn(DescriptionPersist._status).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._status}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._status).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._status}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
|
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
|
||||||
.must(() -> !this.isNull(item.getProperties()))
|
.must(() -> !this.isNull(item.getProperties()))
|
||||||
.failOn(DescriptionPersist._properties).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._properties}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._properties).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._properties}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.must(() -> this.isDescriptionTemplateMaxMultiplicityValid(finalDmpBlueprintEntity, item.getDmpId(), item.getDmpDescriptionTemplateId(), this.isValidGuid(item.getId())))
|
.must(() -> this.isDescriptionTemplateMaxMultiplicityValid(finalDmpBlueprintEntity, item.getDmpId(), item.getDmpDescriptionTemplateId(), this.isValidGuid(item.getId())))
|
||||||
.failOn(DescriptionPersist._descriptionTemplateId).failWith(messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicity", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale())),
|
.failOn(DescriptionPersist._descriptionTemplateId).failWith(this.messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicity", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale())),
|
||||||
this.refSpec()
|
this.refSpec()
|
||||||
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
|
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
|
||||||
.on(DescriptionPersist._properties)
|
.on(DescriptionPersist._properties)
|
||||||
|
@ -241,10 +241,10 @@ public class DescriptionPersist {
|
||||||
org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition());
|
org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition());
|
||||||
if (definition == null || this.isListNullOrEmpty(definition.getSections())) return true;
|
if (definition == null || this.isListNullOrEmpty(definition.getSections())) return true;
|
||||||
|
|
||||||
DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = this.queryFactory.query(DmpDescriptionTemplateQuery.class).ids(dmpDescriptionTemplateId).isActive(IsActive.Active).dmpIds(dmpId).first();
|
DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().ids(dmpDescriptionTemplateId).isActive(IsActive.Active).dmpIds(dmpId).first();
|
||||||
if (dmpDescriptionTemplateEntity == null) return true;
|
if (dmpDescriptionTemplateEntity == null) return true;
|
||||||
|
|
||||||
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpIds(dmpId).dmpDescriptionTemplateIds(dmpDescriptionTemplateId).isActive(IsActive.Active).collect();
|
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpIds(dmpId).dmpDescriptionTemplateIds(dmpDescriptionTemplateId).isActive(IsActive.Active).collect();
|
||||||
|
|
||||||
for (SectionEntity section: definition.getSections()) {
|
for (SectionEntity section: definition.getSections()) {
|
||||||
if (dmpDescriptionTemplateEntity.getSectionId().equals(section.getId()) && section.getHasTemplates() && !this.isListNullOrEmpty(section.getDescriptionTemplates())){
|
if (dmpDescriptionTemplateEntity.getSectionId().equals(section.getId()) && section.getHasTemplates() && !this.isListNullOrEmpty(section.getDescriptionTemplates())){
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.opencdmp.model.persist;
|
package org.opencdmp.model.persist;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commons.XmlHandlingService;
|
import org.opencdmp.commons.XmlHandlingService;
|
||||||
import org.opencdmp.commons.enums.*;
|
import org.opencdmp.commons.enums.*;
|
||||||
|
@ -8,15 +11,12 @@ import org.opencdmp.commons.types.dmpblueprint.FieldEntity;
|
||||||
import org.opencdmp.commons.types.dmpblueprint.SectionEntity;
|
import org.opencdmp.commons.types.dmpblueprint.SectionEntity;
|
||||||
import org.opencdmp.commons.types.dmpblueprint.SystemFieldEntity;
|
import org.opencdmp.commons.types.dmpblueprint.SystemFieldEntity;
|
||||||
import org.opencdmp.commons.validation.BaseValidator;
|
import org.opencdmp.commons.validation.BaseValidator;
|
||||||
import org.opencdmp.data.*;
|
|
||||||
import org.opencdmp.query.DescriptionQuery;
|
|
||||||
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.*;
|
||||||
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
||||||
import org.opencdmp.model.persist.dmpproperties.DmpPropertiesPersist;
|
import org.opencdmp.model.persist.dmpproperties.DmpPropertiesPersist;
|
||||||
|
import org.opencdmp.query.DescriptionQuery;
|
||||||
|
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
@ -274,8 +274,8 @@ public class DmpPersist {
|
||||||
org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition());
|
org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition());
|
||||||
if (definition == null || this.isListNullOrEmpty(definition.getSections())) return true;
|
if (definition == null || this.isListNullOrEmpty(definition.getSections())) return true;
|
||||||
|
|
||||||
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).dmpIds(dmpId).collect();
|
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).dmpIds(dmpId).collect();
|
||||||
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpIds(dmpId).isActive(IsActive.Active).collect();
|
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpIds(dmpId).isActive(IsActive.Active).collect();
|
||||||
|
|
||||||
for (SectionEntity section: definition.getSections()) {
|
for (SectionEntity section: definition.getSections()) {
|
||||||
if (section.getHasTemplates() && !this.isListNullOrEmpty(section.getDescriptionTemplates())){
|
if (section.getHasTemplates() && !this.isListNullOrEmpty(section.getDescriptionTemplates())){
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
package org.opencdmp.model.persist.dmpproperties;
|
package org.opencdmp.model.persist.dmpproperties;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commons.enums.DmpBlueprintFieldCategory;
|
import org.opencdmp.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity;
|
import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity;
|
||||||
import org.opencdmp.commons.types.dmpblueprint.FieldEntity;
|
import org.opencdmp.commons.types.dmpblueprint.FieldEntity;
|
||||||
import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity;
|
import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity;
|
||||||
import org.opencdmp.commons.validation.BaseValidator;
|
import org.opencdmp.commons.validation.BaseValidator;
|
||||||
import org.opencdmp.model.referencetype.ReferenceType;
|
|
||||||
import org.opencdmp.query.ReferenceTypeQuery;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
||||||
import org.opencdmp.model.persist.ReferencePersist;
|
import org.opencdmp.model.persist.ReferencePersist;
|
||||||
|
import org.opencdmp.model.referencetype.ReferenceType;
|
||||||
|
import org.opencdmp.query.ReferenceTypeQuery;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
@ -138,7 +138,7 @@ public class DmpBlueprintValuePersist {
|
||||||
|
|
||||||
private String getReferenceTypeName(FieldEntity fieldEntity){
|
private String getReferenceTypeName(FieldEntity fieldEntity){
|
||||||
if (fieldEntity instanceof ReferenceTypeFieldEntity) {
|
if (fieldEntity instanceof ReferenceTypeFieldEntity) {
|
||||||
return this.queryFactory.query(ReferenceTypeQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(((ReferenceTypeFieldEntity)fieldEntity).getReferenceTypeId()).firstAs(new BaseFieldSet().ensure(ReferenceType._name)).getName();
|
return this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(((ReferenceTypeFieldEntity)fieldEntity).getReferenceTypeId()).firstAs(new BaseFieldSet().ensure(ReferenceType._name)).getName();
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.commons.enums.ActionConfirmationStatus;
|
import org.opencdmp.commons.enums.ActionConfirmationStatus;
|
||||||
import org.opencdmp.commons.enums.ActionConfirmationType;
|
import org.opencdmp.commons.enums.ActionConfirmationType;
|
||||||
|
@ -7,12 +13,6 @@ import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.data.ActionConfirmationEntity;
|
import org.opencdmp.data.ActionConfirmationEntity;
|
||||||
import org.opencdmp.model.actionconfirmation.ActionConfirmation;
|
import org.opencdmp.model.actionconfirmation.ActionConfirmation;
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -21,7 +21,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class ActionConfirmationQuery extends QueryBase<ActionConfirmationEntity> {
|
public class ActionConfirmationQuery extends QueryBase<ActionConfirmationEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -158,6 +158,16 @@ public class ActionConfirmationQuery extends QueryBase<ActionConfirmationEntity>
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public ActionConfirmationQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public ActionConfirmationQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
this.authorize = values;
|
this.authorize = values;
|
||||||
|
@ -185,7 +195,7 @@ public class ActionConfirmationQuery extends QueryBase<ActionConfirmationEntity>
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ActionConfirmationEntity._token), this.like));
|
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ActionConfirmationEntity._token), this.like));
|
||||||
}
|
}
|
||||||
if (this.ids != null) {
|
if (this.ids != null) {
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ActionConfirmationEntity._id));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ActionConfirmationEntity._id));
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.authorization.Permission;
|
import org.opencdmp.authorization.Permission;
|
||||||
import org.opencdmp.commons.enums.DescriptionStatus;
|
import org.opencdmp.commons.enums.DescriptionStatus;
|
||||||
|
@ -8,16 +15,9 @@ import org.opencdmp.commons.scope.user.UserScope;
|
||||||
import org.opencdmp.data.DescriptionEntity;
|
import org.opencdmp.data.DescriptionEntity;
|
||||||
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
||||||
import org.opencdmp.data.DmpEntity;
|
import org.opencdmp.data.DmpEntity;
|
||||||
import org.opencdmp.model.description.Description;
|
|
||||||
import org.opencdmp.model.PublicDescription;
|
import org.opencdmp.model.PublicDescription;
|
||||||
|
import org.opencdmp.model.description.Description;
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -26,7 +26,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -211,6 +211,16 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DescriptionQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isFalseQuery() {
|
protected Boolean isFalseQuery() {
|
||||||
return
|
return
|
||||||
|
@ -240,7 +250,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
||||||
|
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (userId != null || usePublic) {
|
if (userId != null || usePublic) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._id)).value(queryUtilsService.buildDescriptionAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._id)).value(this.queryUtilsService.buildDescriptionAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
||||||
}
|
}
|
||||||
if (!predicates.isEmpty()) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
@ -255,8 +265,8 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.or(
|
predicates.add(queryContext.CriteriaBuilder.or(
|
||||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionEntity._description), this.like),
|
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionEntity._description), this.like),
|
||||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionEntity._label), this.like)
|
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionEntity._label), this.like)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (this.ids != null) {
|
if (this.ids != null) {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.DescriptionReferenceEntity;
|
|
||||||
import org.opencdmp.model.descriptionreference.DescriptionReference;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -14,6 +7,13 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.DescriptionReferenceEntity;
|
||||||
|
import org.opencdmp.model.descriptionreference.DescriptionReference;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -22,7 +22,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEntity> {
|
public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -126,6 +126,16 @@ public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEnt
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DescriptionReferenceQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionReferenceQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isFalseQuery() {
|
protected Boolean isFalseQuery() {
|
||||||
return
|
return
|
||||||
|
@ -153,7 +163,7 @@ public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEnt
|
||||||
|
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (userId != null || usePublic ) {
|
if (userId != null || usePublic ) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionReferenceEntity._descriptionId)).value(queryUtilsService.buildDescriptionAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionReferenceEntity._descriptionId)).value(this.queryUtilsService.buildDescriptionAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
||||||
}
|
}
|
||||||
if (!predicates.isEmpty()) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
|
|
@ -1,23 +1,16 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.DescriptionEntity;
|
|
||||||
import org.opencdmp.data.DescriptionTagEntity;
|
|
||||||
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
|
||||||
import org.opencdmp.model.DescriptionTag;
|
|
||||||
import org.opencdmp.query.utils.BuildSubQueryInput;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import jakarta.persistence.criteria.Subquery;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.data.DescriptionEntity;
|
||||||
|
import org.opencdmp.data.DescriptionTagEntity;
|
||||||
|
import org.opencdmp.model.DescriptionTag;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -26,7 +19,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionTagQuery extends QueryBase<DescriptionTagEntity> {
|
public class DescriptionTagQuery extends QueryBase<DescriptionTagEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -122,15 +115,18 @@ public class DescriptionTagQuery extends QueryBase<DescriptionTagEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final UserScope userScope;
|
public DescriptionTagQuery enableTracking() {
|
||||||
private final AuthorizationService authService;
|
this.noTracking = false;
|
||||||
private final QueryUtilsService queryUtilsService;
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public DescriptionTagQuery(
|
public DescriptionTagQuery disableTracking() {
|
||||||
UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService) {
|
this.noTracking = false;
|
||||||
this.userScope = userScope;
|
return this;
|
||||||
this.authService = authService;
|
}
|
||||||
this.queryUtilsService = queryUtilsService;
|
|
||||||
|
|
||||||
|
public DescriptionTagQuery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Subquery;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.authorization.Permission;
|
import org.opencdmp.authorization.Permission;
|
||||||
import org.opencdmp.commons.enums.DescriptionTemplateStatus;
|
import org.opencdmp.commons.enums.DescriptionTemplateStatus;
|
||||||
|
@ -12,14 +20,6 @@ import org.opencdmp.data.DmpEntity;
|
||||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||||
import org.opencdmp.query.utils.BuildSubQueryInput;
|
import org.opencdmp.query.utils.BuildSubQueryInput;
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import jakarta.persistence.criteria.Subquery;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -28,7 +28,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntity> {
|
public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -212,6 +212,16 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplateQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplateQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final UserScope userScope;
|
private final UserScope userScope;
|
||||||
|
|
||||||
private final AuthorizationService authService;
|
private final AuthorizationService authService;
|
||||||
|
@ -250,11 +260,11 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
|
||||||
|
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (userId != null || usePublic) {
|
if (userId != null || usePublic) {
|
||||||
Subquery<UUID> dmpDescriptionTemplateSubquery = queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(
|
Subquery<UUID> dmpDescriptionTemplateSubquery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(
|
||||||
new BuildSubQueryInput.Builder<>(DmpDescriptionTemplateEntity.class, UUID.class, queryContext)
|
new BuildSubQueryInput.Builder<>(DmpDescriptionTemplateEntity.class, UUID.class, queryContext)
|
||||||
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpDescriptionTemplateEntity._descriptionTemplateGroupId))
|
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpDescriptionTemplateEntity._descriptionTemplateGroupId))
|
||||||
.filterFunc((subQueryRoot, cb) ->
|
.filterFunc((subQueryRoot, cb) ->
|
||||||
cb.in(subQueryRoot.get(DmpDescriptionTemplateEntity._dmpId)).value(queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))
|
cb.in(subQueryRoot.get(DmpDescriptionTemplateEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateEntity._groupId)).value(dmpDescriptionTemplateSubquery));
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateEntity._groupId)).value(dmpDescriptionTemplateSubquery));
|
||||||
|
@ -289,8 +299,8 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._label), this.like),
|
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._label), this.like),
|
||||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._description), this.like)
|
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._description), this.like)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.DescriptionTemplateTypeStatus;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.data.DescriptionTemplateTypeEntity;
|
|
||||||
import org.opencdmp.model.DescriptionTemplateType;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.DescriptionTemplateTypeStatus;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.data.DescriptionTemplateTypeEntity;
|
||||||
|
import org.opencdmp.model.DescriptionTemplateType;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateTypeEntity> {
|
public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateTypeEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -105,6 +105,16 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplateTypeQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplateTypeQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final QueryUtilsService queryUtilsService;
|
private final QueryUtilsService queryUtilsService;
|
||||||
public DescriptionTemplateTypeQuery(
|
public DescriptionTemplateTypeQuery(
|
||||||
QueryUtilsService queryUtilsService) {
|
QueryUtilsService queryUtilsService) {
|
||||||
|
@ -131,7 +141,7 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateTypeEntity._name), this.like));
|
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateTypeEntity._name), this.like));
|
||||||
}
|
}
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._isActive));
|
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._isActive));
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.DmpBlueprintStatus;
|
|
||||||
import org.opencdmp.commons.enums.DmpBlueprintVersionStatus;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.data.DmpBlueprintEntity;
|
|
||||||
import org.opencdmp.model.dmpblueprint.DmpBlueprint;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -14,6 +7,13 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.DmpBlueprintStatus;
|
||||||
|
import org.opencdmp.commons.enums.DmpBlueprintVersionStatus;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.data.DmpBlueprintEntity;
|
||||||
|
import org.opencdmp.model.dmpblueprint.DmpBlueprint;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -22,7 +22,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpBlueprintQuery extends QueryBase<DmpBlueprintEntity> {
|
public class DmpBlueprintQuery extends QueryBase<DmpBlueprintEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -158,6 +158,16 @@ public class DmpBlueprintQuery extends QueryBase<DmpBlueprintEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final QueryUtilsService queryUtilsService;
|
private final QueryUtilsService queryUtilsService;
|
||||||
public DmpBlueprintQuery(
|
public DmpBlueprintQuery(
|
||||||
AuthorizationService authService, QueryUtilsService queryUtilsService
|
AuthorizationService authService, QueryUtilsService queryUtilsService
|
||||||
|
@ -194,7 +204,7 @@ public class DmpBlueprintQuery extends QueryBase<DmpBlueprintEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DmpBlueprintEntity._label), this.like));
|
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DmpBlueprintEntity._label), this.like));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.DescriptionTemplateEntity;
|
|
||||||
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
|
||||||
import org.opencdmp.data.DmpEntity;
|
|
||||||
import org.opencdmp.model.DmpDescriptionTemplate;
|
|
||||||
import org.opencdmp.model.PublicDmpDescriptionTemplate;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -17,6 +7,15 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.DescriptionTemplateEntity;
|
||||||
|
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
||||||
|
import org.opencdmp.model.DmpDescriptionTemplate;
|
||||||
|
import org.opencdmp.model.PublicDmpDescriptionTemplate;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -25,7 +24,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplateEntity> {
|
public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplateEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -151,6 +150,16 @@ public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplat
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DmpDescriptionTemplateQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpDescriptionTemplateQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final UserScope userScope;
|
private final UserScope userScope;
|
||||||
|
|
||||||
private final AuthorizationService authService;
|
private final AuthorizationService authService;
|
||||||
|
@ -187,7 +196,7 @@ public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplat
|
||||||
|
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (userId != null || usePublic) {
|
if (userId != null || usePublic) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._dmpId)).value(queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
||||||
}
|
}
|
||||||
if (!predicates.isEmpty()) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.*;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.*;
|
|
||||||
import org.opencdmp.model.dmp.Dmp;
|
|
||||||
import org.opencdmp.model.PublicDmp;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -15,6 +7,14 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.enums.*;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.*;
|
||||||
|
import org.opencdmp.model.PublicDmp;
|
||||||
|
import org.opencdmp.model.dmp.Dmp;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -23,7 +23,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpQuery extends QueryBase<DmpEntity> {
|
public class DmpQuery extends QueryBase<DmpEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -241,6 +241,16 @@ public class DmpQuery extends QueryBase<DmpEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DmpQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isFalseQuery() {
|
protected Boolean isFalseQuery() {
|
||||||
return this.isEmpty(this.ids) || this.isEmpty(this.creatorIds) || this.isEmpty(this.isActives) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes) || this.isEmpty(this.statuses) || this.isFalseQuery(this.dmpDescriptionTemplateQuery) || this.isFalseQuery(this.dmpUserQuery);
|
return this.isEmpty(this.ids) || this.isEmpty(this.creatorIds) || this.isEmpty(this.isActives) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes) || this.isEmpty(this.statuses) || this.isFalseQuery(this.dmpDescriptionTemplateQuery) || this.isFalseQuery(this.dmpUserQuery);
|
||||||
|
@ -285,7 +295,7 @@ public class DmpQuery extends QueryBase<DmpEntity> {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DmpEntity._label), this.like));
|
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DmpEntity._label), this.like));
|
||||||
}
|
}
|
||||||
if (this.ids != null) {
|
if (this.ids != null) {
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id));
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.DmpEntity;
|
|
||||||
import org.opencdmp.data.DmpReferenceEntity;
|
|
||||||
import org.opencdmp.data.ReferenceEntity;
|
|
||||||
import org.opencdmp.model.dmpreference.DmpReference;
|
|
||||||
import org.opencdmp.model.PublicDmpReference;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -17,6 +7,16 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.DmpEntity;
|
||||||
|
import org.opencdmp.data.DmpReferenceEntity;
|
||||||
|
import org.opencdmp.data.ReferenceEntity;
|
||||||
|
import org.opencdmp.model.PublicDmpReference;
|
||||||
|
import org.opencdmp.model.dmpreference.DmpReference;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -25,7 +25,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpReferenceQuery extends QueryBase<DmpReferenceEntity> {
|
public class DmpReferenceQuery extends QueryBase<DmpReferenceEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -116,6 +116,16 @@ public class DmpReferenceQuery extends QueryBase<DmpReferenceEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DmpReferenceQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpReferenceQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final UserScope userScope;
|
private final UserScope userScope;
|
||||||
|
|
||||||
private final AuthorizationService authService;
|
private final AuthorizationService authService;
|
||||||
|
@ -151,7 +161,7 @@ public class DmpReferenceQuery extends QueryBase<DmpReferenceEntity> {
|
||||||
|
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (userId != null || usePublic ) {
|
if (userId != null || usePublic ) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._dmpId)).value(queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
||||||
}
|
}
|
||||||
if (!predicates.isEmpty()) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.DmpUserRole;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.*;
|
|
||||||
import org.opencdmp.model.DmpUser;
|
|
||||||
import org.opencdmp.model.PublicDmpUser;
|
|
||||||
import org.opencdmp.query.utils.BuildSubQueryInput;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -18,6 +8,17 @@ import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import jakarta.persistence.criteria.Subquery;
|
import jakarta.persistence.criteria.Subquery;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.enums.DmpUserRole;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.DescriptionEntity;
|
||||||
|
import org.opencdmp.data.DmpUserEntity;
|
||||||
|
import org.opencdmp.model.DmpUser;
|
||||||
|
import org.opencdmp.model.PublicDmpUser;
|
||||||
|
import org.opencdmp.query.utils.BuildSubQueryInput;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -26,7 +27,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -161,6 +162,16 @@ public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DmpUserQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpUserQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final UserScope userScope;
|
private final UserScope userScope;
|
||||||
|
|
||||||
private final AuthorizationService authService;
|
private final AuthorizationService authService;
|
||||||
|
@ -197,8 +208,8 @@ public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (userId != null || usePublic ) {
|
if (userId != null || usePublic ) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.or(
|
predicates.add(queryContext.CriteriaBuilder.or(
|
||||||
usePublic ? queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(queryUtilsService.buildPublicDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, usePublic)) : queryContext.CriteriaBuilder.or(), //Creates a false query
|
usePublic ? queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(this.queryUtilsService.buildPublicDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, usePublic)) : queryContext.CriteriaBuilder.or(), //Creates a false query
|
||||||
userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query
|
userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(this.queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (!predicates.isEmpty()) {
|
if (!predicates.isEmpty()) {
|
||||||
|
@ -235,7 +246,7 @@ public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
||||||
else predicates.add(queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(DmpUserEntity._sectionId)));
|
else predicates.add(queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(DmpUserEntity._sectionId)));
|
||||||
}
|
}
|
||||||
if (this.descriptionIds != null) {
|
if (this.descriptionIds != null) {
|
||||||
Subquery<UUID> descriptionSubquery = queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(
|
Subquery<UUID> descriptionSubquery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(
|
||||||
new BuildSubQueryInput.Builder<>(DescriptionEntity.class, UUID.class, queryContext)
|
new BuildSubQueryInput.Builder<>(DescriptionEntity.class, UUID.class, queryContext)
|
||||||
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DescriptionEntity._dmpId))
|
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DescriptionEntity._dmpId))
|
||||||
.filterFunc((subQueryRoot, cb) -> {
|
.filterFunc((subQueryRoot, cb) -> {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.authorization.Permission;
|
import org.opencdmp.authorization.Permission;
|
||||||
import org.opencdmp.commons.enums.EntityType;
|
import org.opencdmp.commons.enums.EntityType;
|
||||||
|
@ -9,13 +16,6 @@ import org.opencdmp.data.DmpEntity;
|
||||||
import org.opencdmp.data.EntityDoiEntity;
|
import org.opencdmp.data.EntityDoiEntity;
|
||||||
import org.opencdmp.model.EntityDoi;
|
import org.opencdmp.model.EntityDoi;
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -24,7 +24,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
|
public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -160,6 +160,16 @@ public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityDoiQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityDoiQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final UserScope userScope;
|
private final UserScope userScope;
|
||||||
|
|
||||||
private final AuthorizationService authService;
|
private final AuthorizationService authService;
|
||||||
|
@ -198,7 +208,7 @@ public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
|
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
|
||||||
if (userId != null || usePublic) {
|
if (userId != null || usePublic) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(EntityDoiEntity._entityId)).value(queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(EntityDoiEntity._entityId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
|
||||||
}
|
}
|
||||||
if (!predicates.isEmpty()) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.data.LanguageEntity;
|
|
||||||
import org.opencdmp.model.Language;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.data.LanguageEntity;
|
||||||
|
import org.opencdmp.model.Language;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class LanguageQuery extends QueryBase<LanguageEntity> {
|
public class LanguageQuery extends QueryBase<LanguageEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -104,6 +104,16 @@ public class LanguageQuery extends QueryBase<LanguageEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LanguageQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LanguageQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final QueryUtilsService queryUtilsService;
|
private final QueryUtilsService queryUtilsService;
|
||||||
public LanguageQuery(
|
public LanguageQuery(
|
||||||
QueryUtilsService queryUtilsService) {
|
QueryUtilsService queryUtilsService) {
|
||||||
|
@ -130,7 +140,7 @@ public class LanguageQuery extends QueryBase<LanguageEntity> {
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(LanguageEntity._code), this.like));
|
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(LanguageEntity._code), this.like));
|
||||||
}
|
}
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(LanguageEntity._isActive));
|
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(LanguageEntity._isActive));
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.LockTargetType;
|
|
||||||
import org.opencdmp.convention.ConventionService;
|
|
||||||
import org.opencdmp.data.LockEntity;
|
|
||||||
import org.opencdmp.model.Lock;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.LockTargetType;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.data.LockEntity;
|
||||||
|
import org.opencdmp.model.Lock;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class LockQuery extends QueryBase<LockEntity> {
|
public class LockQuery extends QueryBase<LockEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -36,7 +36,7 @@ public class LockQuery extends QueryBase<LockEntity> {
|
||||||
|
|
||||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
private ConventionService conventionService;
|
private final ConventionService conventionService;
|
||||||
|
|
||||||
public LockQuery like(String value) {
|
public LockQuery like(String value) {
|
||||||
this.like = value;
|
this.like = value;
|
||||||
|
@ -138,6 +138,16 @@ public class LockQuery extends QueryBase<LockEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LockQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LockQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public LockQuery(ConventionService conventionService) {
|
public LockQuery(ConventionService conventionService) {
|
||||||
this.conventionService = conventionService;
|
this.conventionService = conventionService;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +167,7 @@ public class LockQuery extends QueryBase<LockEntity> {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
this.like = this.like.replaceAll("%", "");
|
this.like = this.like.replaceAll("%", "");
|
||||||
if (this.conventionService.isValidUUID(like)){
|
if (this.conventionService.isValidUUID(this.like)){
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(LockEntity._id));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(LockEntity._id));
|
||||||
inClause.value(UUID.fromString(this.like));
|
inClause.value(UUID.fromString(this.like));
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.data.PrefillingSourceEntity;
|
|
||||||
import org.opencdmp.model.prefillingsource.PrefillingSource;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.data.PrefillingSourceEntity;
|
||||||
|
import org.opencdmp.model.prefillingsource.PrefillingSource;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class PrefillingSourceQuery extends QueryBase<PrefillingSourceEntity> {
|
public class PrefillingSourceQuery extends QueryBase<PrefillingSourceEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -87,6 +87,16 @@ public class PrefillingSourceQuery extends QueryBase<PrefillingSourceEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PrefillingSourceQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrefillingSourceQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private final QueryUtilsService queryUtilsService;
|
private final QueryUtilsService queryUtilsService;
|
||||||
public PrefillingSourceQuery(
|
public PrefillingSourceQuery(
|
||||||
|
@ -114,7 +124,7 @@ public class PrefillingSourceQuery extends QueryBase<PrefillingSourceEntity> {
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(PrefillingSourceEntity._label), this.like));
|
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(PrefillingSourceEntity._label), this.like));
|
||||||
}
|
}
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PrefillingSourceEntity._isActive));
|
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PrefillingSourceEntity._isActive));
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.data.QueueInboxEntity;
|
|
||||||
import gr.cite.queueinbox.entity.QueueInboxStatus;
|
import gr.cite.queueinbox.entity.QueueInboxStatus;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.Ordering;
|
import gr.cite.tools.data.query.Ordering;
|
||||||
|
@ -11,6 +9,8 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.data.QueueInboxEntity;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class QueueInboxQuery extends QueryBase<QueueInboxEntity> {
|
public class QueueInboxQuery extends QueryBase<QueueInboxEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.data.QueueOutboxEntity;
|
|
||||||
import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus;
|
import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.Ordering;
|
import gr.cite.tools.data.query.Ordering;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.data.QueueOutboxEntity;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.persistence.Tuple;
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class QueueOutboxQuery extends QueryBase<QueueOutboxEntity> {
|
public class QueueOutboxQuery extends QueryBase<QueueOutboxEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -178,6 +178,16 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReferenceQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReferenceQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final UserScope userScope;
|
private final UserScope userScope;
|
||||||
|
|
||||||
private final AuthorizationService authService;
|
private final AuthorizationService authService;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.data.ReferenceEntity;
|
|
||||||
import org.opencdmp.data.ReferenceTypeEntity;
|
|
||||||
import org.opencdmp.model.referencetype.ReferenceType;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.data.ReferenceEntity;
|
||||||
|
import org.opencdmp.data.ReferenceTypeEntity;
|
||||||
|
import org.opencdmp.model.referencetype.ReferenceType;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class ReferenceTypeQuery extends QueryBase<ReferenceTypeEntity> {
|
public class ReferenceTypeQuery extends QueryBase<ReferenceTypeEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -105,6 +105,16 @@ public class ReferenceTypeQuery extends QueryBase<ReferenceTypeEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReferenceTypeQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReferenceTypeQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private final QueryUtilsService queryUtilsService;
|
private final QueryUtilsService queryUtilsService;
|
||||||
public ReferenceTypeQuery(
|
public ReferenceTypeQuery(
|
||||||
|
@ -132,8 +142,8 @@ public class ReferenceTypeQuery extends QueryBase<ReferenceTypeEntity> {
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._code), this.like),
|
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._code), this.like),
|
||||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._name), this.like)
|
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._name), this.like)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.StorageType;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.StorageFileEntity;
|
|
||||||
import org.opencdmp.model.StorageFile;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -14,6 +7,13 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.enums.StorageType;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.StorageFileEntity;
|
||||||
|
import org.opencdmp.model.StorageFile;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -22,7 +22,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class StorageFileQuery extends QueryBase<StorageFileEntity> {
|
public class StorageFileQuery extends QueryBase<StorageFileEntity> {
|
||||||
private String like;
|
private String like;
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -112,6 +112,16 @@ public class StorageFileQuery extends QueryBase<StorageFileEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StorageFileQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StorageFileQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isFalseQuery() {
|
protected Boolean isFalseQuery() {
|
||||||
return
|
return
|
||||||
|
@ -149,7 +159,7 @@ public class StorageFileQuery extends QueryBase<StorageFileEntity> {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add( queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(StorageFileEntity._name), this.like));
|
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(StorageFileEntity._name), this.like));
|
||||||
}
|
}
|
||||||
if (this.ids != null) {
|
if (this.ids != null) {
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(StorageFileEntity._id));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(StorageFileEntity._id));
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.commons.enums.SupportiveMaterialFieldType;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.SupportiveMaterialEntity;
|
|
||||||
import org.opencdmp.model.SupportiveMaterial;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.commons.enums.SupportiveMaterialFieldType;
|
||||||
|
import org.opencdmp.data.SupportiveMaterialEntity;
|
||||||
|
import org.opencdmp.model.SupportiveMaterial;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -22,7 +20,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class SupportiveMaterialQuery extends QueryBase<SupportiveMaterialEntity> {
|
public class SupportiveMaterialQuery extends QueryBase<SupportiveMaterialEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -124,6 +122,16 @@ public class SupportiveMaterialQuery extends QueryBase<SupportiveMaterialEntity>
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SupportiveMaterialQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SupportiveMaterialQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private final QueryUtilsService queryUtilsService;
|
private final QueryUtilsService queryUtilsService;
|
||||||
public SupportiveMaterialQuery(
|
public SupportiveMaterialQuery(
|
||||||
QueryUtilsService queryUtilsService) {
|
QueryUtilsService queryUtilsService) {
|
||||||
|
@ -150,8 +158,8 @@ public class SupportiveMaterialQuery extends QueryBase<SupportiveMaterialEntity>
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._languageCode), this.like),
|
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._languageCode), this.like),
|
||||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._payload), this.like)
|
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._payload), this.like)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (this.isActives != null) {
|
if (this.isActives != null) {
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.DescriptionTagEntity;
|
|
||||||
import org.opencdmp.data.DmpReferenceEntity;
|
|
||||||
import org.opencdmp.data.ReferenceEntity;
|
|
||||||
import org.opencdmp.data.TagEntity;
|
|
||||||
import org.opencdmp.model.Tag;
|
|
||||||
import org.opencdmp.query.utils.BuildSubQueryInput;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -18,6 +7,15 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.DescriptionTagEntity;
|
||||||
|
import org.opencdmp.data.TagEntity;
|
||||||
|
import org.opencdmp.model.Tag;
|
||||||
|
import org.opencdmp.query.utils.BuildSubQueryInput;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -26,7 +24,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class TagQuery extends QueryBase<TagEntity> {
|
public class TagQuery extends QueryBase<TagEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -153,6 +151,16 @@ public class TagQuery extends QueryBase<TagEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TagQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TagQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isFalseQuery() {
|
protected Boolean isFalseQuery() {
|
||||||
return
|
return
|
||||||
|
@ -182,12 +190,12 @@ public class TagQuery extends QueryBase<TagEntity> {
|
||||||
predicates.add(queryContext.CriteriaBuilder.or(
|
predicates.add(queryContext.CriteriaBuilder.or(
|
||||||
queryContext.CriteriaBuilder.isNull(queryContext.Root.get(TagEntity._createdById)),
|
queryContext.CriteriaBuilder.isNull(queryContext.Root.get(TagEntity._createdById)),
|
||||||
userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(TagEntity._createdById), userId) : queryContext.CriteriaBuilder.or(), //Creates a false query
|
userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(TagEntity._createdById), userId) : queryContext.CriteriaBuilder.or(), //Creates a false query
|
||||||
queryContext.CriteriaBuilder.in(queryContext.Root.get(TagEntity._id)).value(queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DescriptionTagEntity.class, UUID.class)
|
queryContext.CriteriaBuilder.in(queryContext.Root.get(TagEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DescriptionTagEntity.class, UUID.class)
|
||||||
.query(queryContext.Query)
|
.query(queryContext.Query)
|
||||||
.criteriaBuilder(queryContext.CriteriaBuilder)
|
.criteriaBuilder(queryContext.CriteriaBuilder)
|
||||||
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DescriptionTagEntity._tagId))
|
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DescriptionTagEntity._tagId))
|
||||||
.filterFunc((subQueryRoot, cb) ->
|
.filterFunc((subQueryRoot, cb) ->
|
||||||
cb.in(subQueryRoot.get(DescriptionTagEntity._descriptionId)).value(queryUtilsService.buildDescriptionAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))
|
cb.in(subQueryRoot.get(DescriptionTagEntity._descriptionId)).value(this.queryUtilsService.buildDescriptionAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))
|
||||||
)
|
)
|
||||||
))) //Creates a false query
|
))) //Creates a false query
|
||||||
));
|
));
|
||||||
|
@ -204,7 +212,7 @@ public class TagQuery extends QueryBase<TagEntity> {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TagEntity._label), this.like));
|
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TagEntity._label), this.like));
|
||||||
}
|
}
|
||||||
if (this.ids != null) {
|
if (this.ids != null) {
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(TagEntity._id));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(TagEntity._id));
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.commons.enums.TenantConfigurationType;
|
|
||||||
import org.opencdmp.data.TenantConfigurationEntity;
|
|
||||||
import org.opencdmp.model.tenantconfiguration.TenantConfiguration;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.commons.enums.TenantConfigurationType;
|
||||||
|
import org.opencdmp.data.TenantConfigurationEntity;
|
||||||
|
import org.opencdmp.model.tenantconfiguration.TenantConfiguration;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntity> {
|
public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -120,6 +120,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);
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.data.DmpBlueprintEntity;
|
|
||||||
import org.opencdmp.data.TenantEntity;
|
|
||||||
import org.opencdmp.model.Tenant;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.data.TenantEntity;
|
||||||
|
import org.opencdmp.model.Tenant;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -22,7 +20,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class TenantQuery extends QueryBase<TenantEntity> {
|
public class TenantQuery extends QueryBase<TenantEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -109,6 +107,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;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isFalseQuery() {
|
protected Boolean isFalseQuery() {
|
||||||
return this.isEmpty(this.ids) || this.isEmpty(this.codes) ||this.isEmpty(this.isActives);
|
return this.isEmpty(this.ids) || this.isEmpty(this.codes) ||this.isEmpty(this.isActives);
|
||||||
|
@ -135,8 +143,8 @@ public class TenantQuery extends QueryBase<TenantEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._code), this.like),
|
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._code), this.like),
|
||||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._name), this.like)
|
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._name), this.like)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.authorization.Permission;
|
import org.opencdmp.authorization.Permission;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
import org.opencdmp.data.TenantUserEntity;
|
import org.opencdmp.data.TenantUserEntity;
|
||||||
import org.opencdmp.data.UserEntity;
|
import org.opencdmp.data.UserEntity;
|
||||||
import org.opencdmp.model.Tenant;
|
|
||||||
import org.opencdmp.model.TenantUser;
|
import org.opencdmp.model.TenantUser;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
|
||||||
import jakarta.persistence.criteria.Predicate;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class TenantUserQuery extends QueryBase<TenantUserEntity> {
|
public class TenantUserQuery extends QueryBase<TenantUserEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -113,6 +112,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;
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.ContactInfoType;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.UserContactInfoEntity;
|
|
||||||
import org.opencdmp.model.UserContactInfo;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -13,6 +7,12 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.enums.ContactInfoType;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.UserContactInfoEntity;
|
||||||
|
import org.opencdmp.model.UserContactInfo;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -21,7 +21,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
private Collection<UUID> excludedIds;
|
private Collection<UUID> excludedIds;
|
||||||
|
@ -129,6 +129,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;
|
||||||
|
}
|
||||||
|
|
||||||
public UserContactInfoQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public UserContactInfoQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
this.authorize = values;
|
this.authorize = values;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.UserCredentialEntity;
|
|
||||||
import org.opencdmp.model.usercredential.UserCredential;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -12,6 +7,11 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.UserCredentialEntity;
|
||||||
|
import org.opencdmp.model.usercredential.UserCredential;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
private Collection<UUID> excludedIds;
|
private Collection<UUID> excludedIds;
|
||||||
|
@ -96,6 +96,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;
|
||||||
|
}
|
||||||
|
|
||||||
public UserCredentialQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public UserCredentialQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
this.authorize = values;
|
this.authorize = values;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
|
||||||
import org.opencdmp.commons.enums.UserDescriptionTemplateRole;
|
|
||||||
import org.opencdmp.data.UserDescriptionTemplateEntity;
|
|
||||||
import org.opencdmp.model.UserDescriptionTemplate;
|
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
import gr.cite.tools.data.query.QueryContext;
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
import org.opencdmp.commons.enums.UserDescriptionTemplateRole;
|
||||||
|
import org.opencdmp.data.UserDescriptionTemplateEntity;
|
||||||
|
import org.opencdmp.model.UserDescriptionTemplate;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserDescriptionTemplateQuery extends QueryBase<UserDescriptionTemplateEntity> {
|
public class UserDescriptionTemplateQuery extends QueryBase<UserDescriptionTemplateEntity> {
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
@ -121,6 +121,16 @@ public class UserDescriptionTemplateQuery extends QueryBase<UserDescriptionTempl
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserDescriptionTemplateQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserDescriptionTemplateQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public UserDescriptionTemplateQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public UserDescriptionTemplateQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
this.authorize = values;
|
this.authorize = values;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -125,6 +125,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;
|
||||||
|
}
|
||||||
|
|
||||||
public UserQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public UserQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
this.authorize = values;
|
this.authorize = values;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.UserRoleEntity;
|
|
||||||
import org.opencdmp.model.UserRole;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -12,6 +7,11 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.UserRoleEntity;
|
||||||
|
import org.opencdmp.model.UserRole;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserRoleQuery extends QueryBase<UserRoleEntity> {
|
public class UserRoleQuery extends QueryBase<UserRoleEntity> {
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
private Collection<UUID> excludedIds;
|
private Collection<UUID> excludedIds;
|
||||||
|
@ -123,6 +123,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
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package org.opencdmp.query;
|
package org.opencdmp.query;
|
||||||
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.authorization.Permission;
|
|
||||||
import org.opencdmp.commons.enums.UserSettingsType;
|
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
|
||||||
import org.opencdmp.data.UserSettingsEntity;
|
|
||||||
import org.opencdmp.model.UserSettings;
|
|
||||||
import org.opencdmp.query.utils.QueryUtilsService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -14,6 +7,13 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.authorization.Permission;
|
||||||
|
import org.opencdmp.commons.enums.UserSettingsType;
|
||||||
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
|
import org.opencdmp.data.UserSettingsEntity;
|
||||||
|
import org.opencdmp.model.UserSettings;
|
||||||
|
import org.opencdmp.query.utils.QueryUtilsService;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -22,7 +22,7 @@ import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class UserSettingsQuery extends QueryBase<UserSettingsEntity> {
|
public class UserSettingsQuery extends QueryBase<UserSettingsEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
@ -127,6 +127,16 @@ public class UserSettingsQuery extends QueryBase<UserSettingsEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserSettingsQuery enableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserSettingsQuery disableTracking() {
|
||||||
|
this.noTracking = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public UserSettingsQuery authorize(EnumSet<AuthorizationFlags> values) {
|
public UserSettingsQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
this.authorize = values;
|
this.authorize = values;
|
||||||
return this;
|
return this;
|
||||||
|
@ -165,8 +175,8 @@ public class UserSettingsQuery extends QueryBase<UserSettingsEntity> {
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
if (this.like != null && !this.like.isEmpty()) {
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._key), this.like),
|
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._key), this.like),
|
||||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._value), this.like)
|
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._value), this.like)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (this.ids != null) {
|
if (this.ids != null) {
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
package org.opencdmp.service.contactsupport;
|
package org.opencdmp.service.contactsupport;
|
||||||
|
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.query.Ordering;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import org.opencdmp.authorization.Permission;
|
import org.opencdmp.authorization.Permission;
|
||||||
import org.opencdmp.commons.JsonHandlingService;
|
import org.opencdmp.commons.JsonHandlingService;
|
||||||
import org.opencdmp.commons.enums.ContactInfoType;
|
import org.opencdmp.commons.enums.ContactInfoType;
|
||||||
import org.opencdmp.commons.enums.notification.NotificationContactType;
|
import org.opencdmp.commons.enums.notification.NotificationContactType;
|
||||||
|
import org.opencdmp.commons.notification.NotificationProperties;
|
||||||
import org.opencdmp.commons.scope.user.UserScope;
|
import org.opencdmp.commons.scope.user.UserScope;
|
||||||
import org.opencdmp.commons.types.notification.*;
|
import org.opencdmp.commons.types.notification.*;
|
||||||
import org.opencdmp.commons.notification.NotificationProperties;
|
|
||||||
import org.opencdmp.data.UserContactInfoEntity;
|
import org.opencdmp.data.UserContactInfoEntity;
|
||||||
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||||
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||||
|
@ -14,11 +19,6 @@ import org.opencdmp.model.UserContactInfo;
|
||||||
import org.opencdmp.model.persist.ContactSupportPersist;
|
import org.opencdmp.model.persist.ContactSupportPersist;
|
||||||
import org.opencdmp.model.persist.PublicContactSupportPersist;
|
import org.opencdmp.model.persist.PublicContactSupportPersist;
|
||||||
import org.opencdmp.query.UserContactInfoQuery;
|
import org.opencdmp.query.UserContactInfoQuery;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
||||||
import gr.cite.tools.data.query.Ordering;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import gr.cite.tools.logging.MapLogEntry;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -69,26 +69,26 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
||||||
|
|
||||||
event.setUserId(this.userScope.getUserId());
|
event.setUserId(this.userScope.getUserId());
|
||||||
|
|
||||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(this.userScope.getUserId());
|
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().userIds(this.userScope.getUserId());
|
||||||
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
||||||
UserContactInfoEntity contactInfo = query.first();
|
UserContactInfoEntity contactInfo = query.first();
|
||||||
|
|
||||||
List<ContactPair> contactPairs = new ArrayList<>();
|
List<ContactPair> contactPairs = new ArrayList<>();
|
||||||
contactPairs.add(new ContactPair(ContactInfoType.Email, notificationProperties.getContactSupportEmail()));
|
contactPairs.add(new ContactPair(ContactInfoType.Email, this.notificationProperties.getContactSupportEmail()));
|
||||||
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
event.setContactHint(this.jsonHandlingService.toJsonSafe(contactData));
|
||||||
event.setContactTypeHint(NotificationContactType.EMAIL);
|
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||||
|
|
||||||
event.setNotificationType(notificationProperties.getContactSupportType());
|
event.setNotificationType(this.notificationProperties.getContactSupportType());
|
||||||
NotificationFieldData data = new NotificationFieldData();
|
NotificationFieldData data = new NotificationFieldData();
|
||||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||||
fieldInfoList.add(new FieldInfo("{subject}", DataType.String, model.getSubject()));
|
fieldInfoList.add(new FieldInfo("{subject}", DataType.String, model.getSubject()));
|
||||||
fieldInfoList.add(new FieldInfo("{description}", DataType.String, model.getDescription()));
|
fieldInfoList.add(new FieldInfo("{description}", DataType.String, model.getDescription()));
|
||||||
fieldInfoList.add(new FieldInfo("{email}", DataType.String, contactInfo.getValue()));
|
fieldInfoList.add(new FieldInfo("{email}", DataType.String, contactInfo.getValue()));
|
||||||
data.setFields(fieldInfoList);
|
data.setFields(fieldInfoList);
|
||||||
event.setData(jsonHandlingService.toJsonSafe(data));
|
event.setData(this.jsonHandlingService.toJsonSafe(data));
|
||||||
|
|
||||||
notifyIntegrationEventHandler.handle(event);
|
this.notifyIntegrationEventHandler.handle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -99,12 +99,12 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
||||||
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
|
|
||||||
List<ContactPair> contactPairs = new ArrayList<>();
|
List<ContactPair> contactPairs = new ArrayList<>();
|
||||||
contactPairs.add(new ContactPair(ContactInfoType.Email, notificationProperties.getContactSupportEmail()));
|
contactPairs.add(new ContactPair(ContactInfoType.Email, this.notificationProperties.getContactSupportEmail()));
|
||||||
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
event.setContactHint(this.jsonHandlingService.toJsonSafe(contactData));
|
||||||
event.setContactTypeHint(NotificationContactType.EMAIL);
|
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||||
|
|
||||||
event.setNotificationType(notificationProperties.getPublicContactSupportType());
|
event.setNotificationType(this.notificationProperties.getPublicContactSupportType());
|
||||||
NotificationFieldData data = new NotificationFieldData();
|
NotificationFieldData data = new NotificationFieldData();
|
||||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||||
fieldInfoList.add(new FieldInfo("{subject}", DataType.String, model.getAffiliation()));
|
fieldInfoList.add(new FieldInfo("{subject}", DataType.String, model.getAffiliation()));
|
||||||
|
@ -112,9 +112,9 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
||||||
fieldInfoList.add(new FieldInfo("{email}", DataType.String, model.getEmail()));
|
fieldInfoList.add(new FieldInfo("{email}", DataType.String, model.getEmail()));
|
||||||
fieldInfoList.add(new FieldInfo("{name}", DataType.String, model.getFullName()));
|
fieldInfoList.add(new FieldInfo("{name}", DataType.String, model.getFullName()));
|
||||||
data.setFields(fieldInfoList);
|
data.setFields(fieldInfoList);
|
||||||
event.setData(jsonHandlingService.toJsonSafe(data));
|
event.setData(this.jsonHandlingService.toJsonSafe(data));
|
||||||
|
|
||||||
notifyIntegrationEventHandler.handle(event);
|
this.notifyIntegrationEventHandler.handle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package org.opencdmp.service.dashborad;
|
package org.opencdmp.service.dashborad;
|
||||||
|
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.authorization.OwnedResource;
|
import org.opencdmp.authorization.OwnedResource;
|
||||||
import org.opencdmp.authorization.Permission;
|
import org.opencdmp.authorization.Permission;
|
||||||
|
@ -18,12 +24,6 @@ import org.opencdmp.query.*;
|
||||||
import org.opencdmp.query.lookup.DescriptionLookup;
|
import org.opencdmp.query.lookup.DescriptionLookup;
|
||||||
import org.opencdmp.query.lookup.DmpLookup;
|
import org.opencdmp.query.lookup.DmpLookup;
|
||||||
import org.opencdmp.service.elastic.ElasticQueryHelperService;
|
import org.opencdmp.service.elastic.ElasticQueryHelperService;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
|
||||||
import gr.cite.tools.logging.MapLogEntry;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -114,19 +114,19 @@ public class DashboardServiceImpl implements DashboardService {
|
||||||
|
|
||||||
DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(DashboardStatisticsCacheService.publicKey));
|
DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(DashboardStatisticsCacheService.publicKey));
|
||||||
if (cacheValue == null || cacheValue.getDashboardStatistics() == null) {
|
if (cacheValue == null || cacheValue.getDashboardStatistics() == null) {
|
||||||
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).versionStatuses(DmpVersionStatus.Current).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public);
|
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().isActive(IsActive.Active).versionStatuses(DmpVersionStatus.Current).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public);
|
||||||
DashboardStatistics statistics = new DashboardStatistics();
|
DashboardStatistics statistics = new DashboardStatistics();
|
||||||
statistics.setDmpCount(dmpQuery.authorize(EnumSet.of(Public)).count());
|
statistics.setDmpCount(dmpQuery.authorize(EnumSet.of(Public)).count());
|
||||||
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).isActive(IsActive.Active).dmpSubQuery(dmpQuery).statuses(DescriptionStatus.Finalized).authorize(EnumSet.of(Public)).count());
|
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(dmpQuery).statuses(DescriptionStatus.Finalized).authorize(EnumSet.of(Public)).count());
|
||||||
|
|
||||||
statistics.setReferenceTypeStatistics(new ArrayList<>());
|
statistics.setReferenceTypeStatistics(new ArrayList<>());
|
||||||
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
|
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
|
||||||
for (UUID typeId : this.config.getReferenceTypeCounters()){
|
for (UUID typeId : this.config.getReferenceTypeCounters()){
|
||||||
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
|
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
|
||||||
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).typeIds(typeId).authorize(EnumSet.of(Public))
|
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(EnumSet.of(Public))
|
||||||
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).isActives(IsActive.Active)
|
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).disableTracking().isActives(IsActive.Active)
|
||||||
.dmpSubQuery(dmpQuery)).count());
|
.dmpSubQuery(dmpQuery)).count());
|
||||||
referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._id), this.queryFactory.query(ReferenceTypeQuery.class).ids(typeId).first()));
|
referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._id), this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(typeId).first()));
|
||||||
statistics.getReferenceTypeStatistics().add(referenceTypeStatistics);
|
statistics.getReferenceTypeStatistics().add(referenceTypeStatistics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,24 +145,24 @@ public class DashboardServiceImpl implements DashboardService {
|
||||||
|
|
||||||
DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(this.dashboardStatisticsCacheService.generateUserTenantCacheKey(this.userScope.getUserId(), this.tenantScope.getTenantCode())));
|
DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(this.dashboardStatisticsCacheService.generateUserTenantCacheKey(this.userScope.getUserId(), this.tenantScope.getTenantCode())));
|
||||||
if (cacheValue == null || cacheValue.getDashboardStatistics() == null) {
|
if (cacheValue == null || cacheValue.getDashboardStatistics() == null) {
|
||||||
DmpUserQuery dmpUserLookup = this.queryFactory.query(DmpUserQuery.class);
|
DmpUserQuery dmpUserLookup = this.queryFactory.query(DmpUserQuery.class).disableTracking();
|
||||||
dmpUserLookup.userIds(this.userScope.getUserId());
|
dmpUserLookup.userIds(this.userScope.getUserId());
|
||||||
dmpUserLookup.isActives(IsActive.Active);
|
dmpUserLookup.isActives(IsActive.Active);
|
||||||
|
|
||||||
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).dmpUserSubQuery(dmpUserLookup).versionStatuses(List.of(DmpVersionStatus.Current, DmpVersionStatus.NotFinalized));
|
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().isActive(IsActive.Active).dmpUserSubQuery(dmpUserLookup).versionStatuses(List.of(DmpVersionStatus.Current, DmpVersionStatus.NotFinalized));
|
||||||
|
|
||||||
DashboardStatistics statistics = new DashboardStatistics();
|
DashboardStatistics statistics = new DashboardStatistics();
|
||||||
statistics.setDmpCount(dmpQuery.authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).count());
|
statistics.setDmpCount(dmpQuery.authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).count());
|
||||||
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).isActive(IsActive.Active).dmpSubQuery(dmpQuery).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).count());
|
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(dmpQuery).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).count());
|
||||||
|
|
||||||
statistics.setReferenceTypeStatistics(new ArrayList<>());
|
statistics.setReferenceTypeStatistics(new ArrayList<>());
|
||||||
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
|
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
|
||||||
for (UUID typeId : this.config.getReferenceTypeCounters()){
|
for (UUID typeId : this.config.getReferenceTypeCounters()){
|
||||||
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
|
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
|
||||||
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).typeIds(typeId).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission)
|
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission)
|
||||||
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).isActives(IsActive.Active)
|
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).disableTracking().isActives(IsActive.Active)
|
||||||
.dmpSubQuery(dmpQuery)).count());
|
.dmpSubQuery(dmpQuery)).count());
|
||||||
referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._id), this.queryFactory.query(ReferenceTypeQuery.class).ids(typeId).first()));
|
referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._id), this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(typeId).first()));
|
||||||
statistics.getReferenceTypeStatistics().add(referenceTypeStatistics);
|
statistics.getReferenceTypeStatistics().add(referenceTypeStatistics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
package org.opencdmp.service.deposit;
|
package org.opencdmp.service.deposit;
|
||||||
|
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeCacheService;
|
||||||
|
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeFilterFunction;
|
||||||
|
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeModel;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.Ordering;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.authorization.Permission;
|
import org.opencdmp.authorization.Permission;
|
||||||
import org.opencdmp.authorization.authorizationcontentresolver.AuthorizationContentResolver;
|
import org.opencdmp.authorization.authorizationcontentresolver.AuthorizationContentResolver;
|
||||||
|
@ -24,7 +36,6 @@ import org.opencdmp.data.UserEntity;
|
||||||
import org.opencdmp.depositbase.repository.DepositClient;
|
import org.opencdmp.depositbase.repository.DepositClient;
|
||||||
import org.opencdmp.depositbase.repository.DepositConfiguration;
|
import org.opencdmp.depositbase.repository.DepositConfiguration;
|
||||||
import org.opencdmp.event.TenantConfigurationTouchedEvent;
|
import org.opencdmp.event.TenantConfigurationTouchedEvent;
|
||||||
import org.opencdmp.event.UserAddedToTenantEvent;
|
|
||||||
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||||
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||||
import org.opencdmp.model.EntityDoi;
|
import org.opencdmp.model.EntityDoi;
|
||||||
|
@ -32,30 +43,18 @@ import org.opencdmp.model.StorageFile;
|
||||||
import org.opencdmp.model.UserContactInfo;
|
import org.opencdmp.model.UserContactInfo;
|
||||||
import org.opencdmp.model.builder.commonmodels.DepositConfigurationBuilder;
|
import org.opencdmp.model.builder.commonmodels.DepositConfigurationBuilder;
|
||||||
import org.opencdmp.model.builder.commonmodels.dmp.DmpCommonModelBuilder;
|
import org.opencdmp.model.builder.commonmodels.dmp.DmpCommonModelBuilder;
|
||||||
|
import org.opencdmp.model.persist.EntityDoiPersist;
|
||||||
import org.opencdmp.model.persist.StorageFilePersist;
|
import org.opencdmp.model.persist.StorageFilePersist;
|
||||||
import org.opencdmp.model.persist.deposit.DepositAuthenticateRequest;
|
import org.opencdmp.model.persist.deposit.DepositAuthenticateRequest;
|
||||||
import org.opencdmp.model.persist.deposit.DepositRequest;
|
import org.opencdmp.model.persist.deposit.DepositRequest;
|
||||||
import org.opencdmp.model.persist.EntityDoiPersist;
|
|
||||||
import org.opencdmp.model.tenantconfiguration.TenantConfiguration;
|
import org.opencdmp.model.tenantconfiguration.TenantConfiguration;
|
||||||
import org.opencdmp.query.*;
|
import org.opencdmp.query.*;
|
||||||
import org.opencdmp.service.encryption.EncryptionService;
|
import org.opencdmp.service.encryption.EncryptionService;
|
||||||
import org.opencdmp.service.entitydoi.EntityDoiService;
|
import org.opencdmp.service.entitydoi.EntityDoiService;
|
||||||
|
import org.opencdmp.service.filetransformer.FileTransformerService;
|
||||||
import org.opencdmp.service.storage.StorageFileProperties;
|
import org.opencdmp.service.storage.StorageFileProperties;
|
||||||
import org.opencdmp.service.storage.StorageFileService;
|
import org.opencdmp.service.storage.StorageFileService;
|
||||||
import org.opencdmp.service.filetransformer.FileTransformerService;
|
|
||||||
import org.opencdmp.service.tenant.TenantProperties;
|
import org.opencdmp.service.tenant.TenantProperties;
|
||||||
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeCacheService;
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
|
||||||
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeFilterFunction;
|
|
||||||
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeModel;
|
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
|
||||||
import gr.cite.tools.data.query.Ordering;
|
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.exception.MyNotFoundException;
|
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
|
||||||
import org.apache.commons.io.FilenameUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -75,7 +74,10 @@ import java.security.InvalidAlgorithmParameterException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -160,9 +162,9 @@ public class DepositServiceImpl implements DepositService {
|
||||||
String tenantCode = this.tenantScope.isSet() && this.tenantScope.isMultitenant() ? this.tenantScope.getTenantCode() : "";
|
String tenantCode = this.tenantScope.isSet() && this.tenantScope.isMultitenant() ? this.tenantScope.getTenantCode() : "";
|
||||||
DepositSourcesCacheService.DepositSourceCacheValue cacheValue = this.depositSourcesCacheService.lookup(this.depositSourcesCacheService.buildKey(tenantCode));
|
DepositSourcesCacheService.DepositSourceCacheValue cacheValue = this.depositSourcesCacheService.lookup(this.depositSourcesCacheService.buildKey(tenantCode));
|
||||||
if (cacheValue == null) {
|
if (cacheValue == null) {
|
||||||
List<DepositSourceEntity> depositSourceEntities = new ArrayList<>(depositProperties.getSources());
|
List<DepositSourceEntity> depositSourceEntities = new ArrayList<>(this.depositProperties.getSources());
|
||||||
if (this.tenantScope.isSet() && this.tenantScope.isMultitenant()) {
|
if (this.tenantScope.isSet() && this.tenantScope.isMultitenant()) {
|
||||||
TenantConfigurationQuery tenantConfigurationQuery = this.queryFactory.query(TenantConfigurationQuery.class).isActive(IsActive.Active).types(TenantConfigurationType.DepositPlugins);
|
TenantConfigurationQuery tenantConfigurationQuery = this.queryFactory.query(TenantConfigurationQuery.class).disableTracking().isActive(IsActive.Active).types(TenantConfigurationType.DepositPlugins);
|
||||||
if (this.tenantScope.isDefaultTenant()) tenantConfigurationQuery.tenantIsSet(false);
|
if (this.tenantScope.isDefaultTenant()) tenantConfigurationQuery.tenantIsSet(false);
|
||||||
else tenantConfigurationQuery.tenantIsSet(true).tenantIds(this.tenantScope.getTenant());
|
else tenantConfigurationQuery.tenantIsSet(true).tenantIds(this.tenantScope.getTenant());
|
||||||
TenantConfigurationEntity tenantConfiguration = tenantConfigurationQuery.firstAs(new BaseFieldSet().ensure(TenantConfiguration._depositPlugins));
|
TenantConfigurationEntity tenantConfiguration = tenantConfigurationQuery.firstAs(new BaseFieldSet().ensure(TenantConfiguration._depositPlugins));
|
||||||
|
@ -204,7 +206,7 @@ public class DepositServiceImpl implements DepositService {
|
||||||
item.setUrl(source.getUrl());
|
item.setUrl(source.getUrl());
|
||||||
item.setIssuerUrl(source.getIssuerUrl());
|
item.setIssuerUrl(source.getIssuerUrl());
|
||||||
item.setClientId(source.getClientId());
|
item.setClientId(source.getClientId());
|
||||||
if (!this.conventionService.isNullOrEmpty(source.getClientSecret())) item.setClientSecret(this.encryptionService.decryptAES(source.getClientSecret(), tenantProperties.getConfigEncryptionAesKey(), tenantProperties.getConfigEncryptionAesIv()));
|
if (!this.conventionService.isNullOrEmpty(source.getClientSecret())) item.setClientSecret(this.encryptionService.decryptAES(source.getClientSecret(), this.tenantProperties.getConfigEncryptionAesKey(), this.tenantProperties.getConfigEncryptionAesIv()));
|
||||||
item.setScope(source.getScope());
|
item.setScope(source.getScope());
|
||||||
item.setRdaTransformerId(source.getRdaTransformerId());
|
item.setRdaTransformerId(source.getRdaTransformerId());
|
||||||
item.setPdfTransformerId(source.getPdfTransformerId());
|
item.setPdfTransformerId(source.getPdfTransformerId());
|
||||||
|
@ -234,8 +236,8 @@ public class DepositServiceImpl implements DepositService {
|
||||||
DepositConfigurationCacheService.DepositConfigurationCacheValue cacheValue = this.depositConfigurationCacheService.lookup(this.depositConfigurationCacheService.buildKey(depositSource.getRepositoryId(), tenantCode));
|
DepositConfigurationCacheService.DepositConfigurationCacheValue cacheValue = this.depositConfigurationCacheService.lookup(this.depositConfigurationCacheService.buildKey(depositSource.getRepositoryId(), tenantCode));
|
||||||
if (cacheValue == null){
|
if (cacheValue == null){
|
||||||
try {
|
try {
|
||||||
DepositClient depositClient = getDepositClient(depositSource.getRepositoryId());
|
DepositClient depositClient = this.getDepositClient(depositSource.getRepositoryId());
|
||||||
if (depositClient == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{depositSource.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
if (depositClient == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{depositSource.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
DepositConfiguration configuration = depositClient.getConfiguration();
|
DepositConfiguration configuration = depositClient.getConfiguration();
|
||||||
cacheValue = new DepositConfigurationCacheService.DepositConfigurationCacheValue(depositSource.getRepositoryId(), tenantCode, configuration);
|
cacheValue = new DepositConfigurationCacheService.DepositConfigurationCacheValue(depositSource.getRepositoryId(), tenantCode, configuration);
|
||||||
|
@ -257,17 +259,17 @@ public class DepositServiceImpl implements DepositService {
|
||||||
public EntityDoi deposit(DepositRequest dmpDepositModel) throws Exception {
|
public EntityDoi deposit(DepositRequest dmpDepositModel) throws Exception {
|
||||||
this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(dmpDepositModel.getDmpId())), Permission.DepositDmp);
|
this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(dmpDepositModel.getDmpId())), Permission.DepositDmp);
|
||||||
//GK: First get the right client
|
//GK: First get the right client
|
||||||
DepositClient depositClient = getDepositClient(dmpDepositModel.getRepositoryId());
|
DepositClient depositClient = this.getDepositClient(dmpDepositModel.getRepositoryId());
|
||||||
if (depositClient == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
if (depositClient == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
//GK: Second get the Target Data Management Plan
|
//GK: Second get the Target Data Management Plan
|
||||||
DmpEntity dmpEntity = this.queryFactory.query(DmpQuery.class).ids(dmpDepositModel.getDmpId()).first();
|
DmpEntity dmpEntity = this.queryFactory.query(DmpQuery.class).disableTracking().ids(dmpDepositModel.getDmpId()).first();
|
||||||
if (dmpEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getDmpId(), DmpEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getDmpId(), DmpEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
//GK: Forth make the required files to be uploaded with the deposit
|
//GK: Forth make the required files to be uploaded with the deposit
|
||||||
//TODO: Properly create required files
|
//TODO: Properly create required files
|
||||||
DepositSourceEntity source = this.getDepositSources().stream().filter(depositSource -> depositSource.getRepositoryId().equals(dmpDepositModel.getRepositoryId())).findFirst().orElse(null);
|
DepositSourceEntity source = this.getDepositSources().stream().filter(depositSource -> depositSource.getRepositoryId().equals(dmpDepositModel.getRepositoryId())).findFirst().orElse(null);
|
||||||
if (source == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getRepositoryId(), DepositSourceEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
if (source == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getRepositoryId(), DepositSourceEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
org.opencdmp.model.file.FileEnvelope pdfFile = this.fileTransformerService.exportDmp(dmpEntity.getId(), source.getPdfTransformerId(),"pdf");
|
org.opencdmp.model.file.FileEnvelope pdfFile = this.fileTransformerService.exportDmp(dmpEntity.getId(), source.getPdfTransformerId(),"pdf");
|
||||||
org.opencdmp.model.file.FileEnvelope rda = this.fileTransformerService.exportDmp(dmpEntity.getId(), source.getRdaTransformerId(),"json");
|
org.opencdmp.model.file.FileEnvelope rda = this.fileTransformerService.exportDmp(dmpEntity.getId(), source.getRdaTransformerId(),"json");
|
||||||
|
@ -302,16 +304,16 @@ public class DepositServiceImpl implements DepositService {
|
||||||
doiPersist.setDoi(doi);
|
doiPersist.setDoi(doi);
|
||||||
doiPersist.setEntityId(dmpEntity.getId());
|
doiPersist.setEntityId(dmpEntity.getId());
|
||||||
this.sendNotification(dmpEntity);
|
this.sendNotification(dmpEntity);
|
||||||
return doiService.persist(doiPersist, dmpDepositModel.getProject());
|
return this.doiService.persist(doiPersist, dmpDepositModel.getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendNotification(DmpEntity dmpEntity) throws InvalidApplicationException {
|
private void sendNotification(DmpEntity dmpEntity) throws InvalidApplicationException {
|
||||||
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmpEntity.getId()).isActives(IsActive.Active).collect();
|
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(dmpEntity.getId()).isActives(IsActive.Active).collect();
|
||||||
if (this.conventionService.isListNullOrEmpty(dmpUsers)){
|
if (this.conventionService.isListNullOrEmpty(dmpUsers)){
|
||||||
throw new MyNotFoundException("Dmp does not have Users");
|
throw new MyNotFoundException("Dmp does not have Users");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<UserEntity> users = this.queryFactory.query(UserQuery.class).ids(dmpUsers.stream().map(DmpUserEntity::getUserId).collect(Collectors.toList())).isActive(IsActive.Active).collect();
|
List<UserEntity> users = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUsers.stream().map(DmpUserEntity::getUserId).collect(Collectors.toList())).isActive(IsActive.Active).collect();
|
||||||
|
|
||||||
for (UserEntity user: users) {
|
for (UserEntity user: users) {
|
||||||
if (!user.getId().equals(this.userScope.getUserIdSafe()) && !this.conventionService.isListNullOrEmpty(dmpUsers.stream().filter(x -> x.getUserId().equals(user.getId())).collect(Collectors.toList()))){
|
if (!user.getId().equals(this.userScope.getUserIdSafe()) && !this.conventionService.isListNullOrEmpty(dmpUsers.stream().filter(x -> x.getUserId().equals(user.getId())).collect(Collectors.toList()))){
|
||||||
|
@ -323,24 +325,24 @@ public class DepositServiceImpl implements DepositService {
|
||||||
private void createDmpDepositNotificationEvent(DmpEntity dmp, UserEntity user) throws InvalidApplicationException {
|
private void createDmpDepositNotificationEvent(DmpEntity dmp, UserEntity user) throws InvalidApplicationException {
|
||||||
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||||
event.setUserId(user.getId());
|
event.setUserId(user.getId());
|
||||||
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
|
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().userIds(user.getId());
|
||||||
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
||||||
|
|
||||||
List<ContactPair> contactPairs = new ArrayList<>();
|
List<ContactPair> contactPairs = new ArrayList<>();
|
||||||
contactPairs.add(new ContactPair(ContactInfoType.Email, query.first().getValue()));
|
contactPairs.add(new ContactPair(ContactInfoType.Email, query.first().getValue()));
|
||||||
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
event.setContactHint(this.jsonHandlingService.toJsonSafe(contactData));
|
||||||
event.setNotificationType(notificationProperties.getDmpDepositType());
|
event.setNotificationType(this.notificationProperties.getDmpDepositType());
|
||||||
NotificationFieldData data = new NotificationFieldData();
|
NotificationFieldData data = new NotificationFieldData();
|
||||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||||
fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, user.getName()));
|
fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, user.getName()));
|
||||||
fieldInfoList.add(new FieldInfo("{reasonName}", DataType.String, this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first().getName()));
|
fieldInfoList.add(new FieldInfo("{reasonName}", DataType.String, this.queryFactory.query(UserQuery.class).disableTracking().ids(this.userScope.getUserId()).first().getName()));
|
||||||
fieldInfoList.add(new FieldInfo("{name}", DataType.String, dmp.getLabel()));
|
fieldInfoList.add(new FieldInfo("{name}", DataType.String, dmp.getLabel()));
|
||||||
fieldInfoList.add(new FieldInfo("{id}", DataType.String, dmp.getId().toString()));
|
fieldInfoList.add(new FieldInfo("{id}", DataType.String, dmp.getId().toString()));
|
||||||
data.setFields(fieldInfoList);
|
data.setFields(fieldInfoList);
|
||||||
event.setData(jsonHandlingService.toJsonSafe(data));
|
event.setData(this.jsonHandlingService.toJsonSafe(data));
|
||||||
|
|
||||||
eventHandler.handle(event);
|
this.eventHandler.handle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String addFileToSharedStorage(org.opencdmp.model.file.FileEnvelope file) throws IOException {
|
private String addFileToSharedStorage(org.opencdmp.model.file.FileEnvelope file) throws IOException {
|
||||||
|
@ -360,8 +362,8 @@ public class DepositServiceImpl implements DepositService {
|
||||||
public String getLogo(String repositoryId) throws InvalidApplicationException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {
|
public String getLogo(String repositoryId) throws InvalidApplicationException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {
|
||||||
this.authorizationService.authorizeForce(Permission.BrowseDeposit, Permission.DeferredAffiliation);
|
this.authorizationService.authorizeForce(Permission.BrowseDeposit, Permission.DeferredAffiliation);
|
||||||
|
|
||||||
DepositClient depositClient = getDepositClient(repositoryId);
|
DepositClient depositClient = this.getDepositClient(repositoryId);
|
||||||
if (depositClient == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{repositoryId, DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
if (depositClient == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{repositoryId, DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
return depositClient.getLogo();
|
return depositClient.getLogo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,8 +371,8 @@ public class DepositServiceImpl implements DepositService {
|
||||||
public String authenticate(DepositAuthenticateRequest model) throws InvalidApplicationException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {
|
public String authenticate(DepositAuthenticateRequest model) throws InvalidApplicationException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {
|
||||||
this.authorizationService.authorizeForce(Permission.BrowseDeposit, Permission.DeferredAffiliation);
|
this.authorizationService.authorizeForce(Permission.BrowseDeposit, Permission.DeferredAffiliation);
|
||||||
|
|
||||||
DepositClient depositClient = getDepositClient(model.getRepositoryId());
|
DepositClient depositClient = this.getDepositClient(model.getRepositoryId());
|
||||||
if (depositClient == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
if (depositClient == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
return depositClient.authenticate(model.getCode());
|
return depositClient.authenticate(model.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,9 @@
|
||||||
//import jakarta.persistence.PersistenceException;
|
//import jakarta.persistence.PersistenceException;
|
||||||
//import org.hibernate.FlushMode;
|
//import org.hibernate.FlushMode;
|
||||||
//import org.hibernate.Session;
|
//import org.hibernate.Session;
|
||||||
//import org.springframework.context.annotation.Bean;
|
|
||||||
//import org.springframework.lang.Nullable;
|
|
||||||
//import org.springframework.orm.jpa.JpaVendorAdapter;
|
|
||||||
//import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|
||||||
//import org.springframework.orm.jpa.vendor.HibernateJpaDialect;
|
//import org.springframework.orm.jpa.vendor.HibernateJpaDialect;
|
||||||
//import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
|
||||||
//import org.springframework.stereotype.Service;
|
//import org.springframework.stereotype.Service;
|
||||||
//
|
//
|
||||||
//import javax.sql.DataSource;
|
|
||||||
//import java.sql.SQLException;
|
|
||||||
//
|
|
||||||
//@Service
|
//@Service
|
||||||
//public class MyHibernateJpaDialect extends HibernateJpaDialect {
|
//public class MyHibernateJpaDialect extends HibernateJpaDialect {
|
||||||
// @Override
|
// @Override
|
||||||
|
|
|
@ -19,11 +19,13 @@ import org.opencdmp.commons.enums.DmpStatus;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.convention.ConventionService;
|
import org.opencdmp.convention.ConventionService;
|
||||||
import org.opencdmp.data.StorageFileEntity;
|
import org.opencdmp.data.StorageFileEntity;
|
||||||
import org.opencdmp.model.*;
|
import org.opencdmp.model.DescriptionValidationResult;
|
||||||
import org.opencdmp.model.builder.descriptionproperties.DescriptionBuilder;
|
import org.opencdmp.model.PublicDescription;
|
||||||
|
import org.opencdmp.model.StorageFile;
|
||||||
import org.opencdmp.model.builder.PublicDescriptionBuilder;
|
import org.opencdmp.model.builder.PublicDescriptionBuilder;
|
||||||
import org.opencdmp.model.censorship.description.DescriptionCensor;
|
import org.opencdmp.model.builder.descriptionproperties.DescriptionBuilder;
|
||||||
import org.opencdmp.model.censorship.PublicDescriptionCensor;
|
import org.opencdmp.model.censorship.PublicDescriptionCensor;
|
||||||
|
import org.opencdmp.model.censorship.description.DescriptionCensor;
|
||||||
import org.opencdmp.model.description.Description;
|
import org.opencdmp.model.description.Description;
|
||||||
import org.opencdmp.model.dmpblueprint.DmpBlueprint;
|
import org.opencdmp.model.dmpblueprint.DmpBlueprint;
|
||||||
import org.opencdmp.model.persist.*;
|
import org.opencdmp.model.persist.*;
|
||||||
|
@ -122,7 +124,7 @@ public class DescriptionController {
|
||||||
|
|
||||||
this.censorFactory.censor(PublicDescriptionCensor.class).censor(fieldSet);
|
this.censorFactory.censor(PublicDescriptionCensor.class).censor(fieldSet);
|
||||||
|
|
||||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(EnumSet.of(Public)).ids(id).dmpSubQuery(this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public));
|
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).dmpSubQuery(this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public));
|
||||||
|
|
||||||
PublicDescription model = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet));
|
PublicDescription model = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet));
|
||||||
if (model == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PublicDescription.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
if (model == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PublicDescription.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
@ -156,7 +158,7 @@ public class DescriptionController {
|
||||||
|
|
||||||
this.censorFactory.censor(DescriptionCensor.class).censor(fieldSet, null);
|
this.censorFactory.censor(DescriptionCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).ids(id);
|
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).ids(id);
|
||||||
Description model = this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
Description model = this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||||
if (model == null)
|
if (model == null)
|
||||||
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
|
@ -17,11 +17,11 @@ import jakarta.xml.bind.JAXBException;
|
||||||
import org.opencdmp.audit.AuditableAction;
|
import org.opencdmp.audit.AuditableAction;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.data.DescriptionTemplateEntity;
|
import org.opencdmp.data.DescriptionTemplateEntity;
|
||||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
|
||||||
import org.opencdmp.model.dmpblueprint.DmpBlueprint;
|
|
||||||
import org.opencdmp.model.builder.descriptiontemplate.DescriptionTemplateBuilder;
|
import org.opencdmp.model.builder.descriptiontemplate.DescriptionTemplateBuilder;
|
||||||
import org.opencdmp.model.censorship.descriptiontemplate.DescriptionTemplateCensor;
|
import org.opencdmp.model.censorship.descriptiontemplate.DescriptionTemplateCensor;
|
||||||
import org.opencdmp.model.censorship.dmpblueprint.DmpBlueprintCensor;
|
import org.opencdmp.model.censorship.dmpblueprint.DmpBlueprintCensor;
|
||||||
|
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||||
|
import org.opencdmp.model.dmpblueprint.DmpBlueprint;
|
||||||
import org.opencdmp.model.persist.DescriptionTemplatePersist;
|
import org.opencdmp.model.persist.DescriptionTemplatePersist;
|
||||||
import org.opencdmp.model.persist.NewVersionDescriptionTemplatePersist;
|
import org.opencdmp.model.persist.NewVersionDescriptionTemplatePersist;
|
||||||
import org.opencdmp.model.result.QueryResult;
|
import org.opencdmp.model.result.QueryResult;
|
||||||
|
@ -106,7 +106,7 @@ public class DescriptionTemplateController {
|
||||||
|
|
||||||
this.censorFactory.censor(DescriptionTemplateCensor.class).censor(fieldSet, null);
|
this.censorFactory.censor(DescriptionTemplateCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||||
DescriptionTemplate model = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
DescriptionTemplate model = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||||
if (model == null)
|
if (model == null)
|
||||||
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
package org.opencdmp.controllers;
|
package org.opencdmp.controllers;
|
||||||
|
|
||||||
import org.opencdmp.audit.AuditableAction;
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.data.DescriptionTemplateTypeEntity;
|
|
||||||
import org.opencdmp.model.DescriptionTemplateType;
|
|
||||||
import org.opencdmp.model.builder.DescriptionTemplateTypeBuilder;
|
|
||||||
import org.opencdmp.model.censorship.DescriptionTemplateTypeCensor;
|
|
||||||
import org.opencdmp.model.persist.DescriptionTemplateTypePersist;
|
|
||||||
import org.opencdmp.model.result.QueryResult;
|
|
||||||
import org.opencdmp.query.DescriptionTemplateTypeQuery;
|
|
||||||
import org.opencdmp.query.lookup.DescriptionTemplateTypeLookup;
|
|
||||||
import org.opencdmp.service.descriptiontemplatetype.DescriptionTemplateTypeService;
|
|
||||||
import gr.cite.tools.auditing.AuditService;
|
import gr.cite.tools.auditing.AuditService;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.censor.CensorFactory;
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
@ -22,6 +11,17 @@ import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import gr.cite.tools.logging.MapLogEntry;
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||||
|
import org.opencdmp.audit.AuditableAction;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.data.DescriptionTemplateTypeEntity;
|
||||||
|
import org.opencdmp.model.DescriptionTemplateType;
|
||||||
|
import org.opencdmp.model.builder.DescriptionTemplateTypeBuilder;
|
||||||
|
import org.opencdmp.model.censorship.DescriptionTemplateTypeCensor;
|
||||||
|
import org.opencdmp.model.persist.DescriptionTemplateTypePersist;
|
||||||
|
import org.opencdmp.model.result.QueryResult;
|
||||||
|
import org.opencdmp.query.DescriptionTemplateTypeQuery;
|
||||||
|
import org.opencdmp.query.lookup.DescriptionTemplateTypeLookup;
|
||||||
|
import org.opencdmp.service.descriptiontemplatetype.DescriptionTemplateTypeService;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
@ -86,10 +86,10 @@ public class DescriptionTemplateTypeController {
|
||||||
|
|
||||||
this.censorFactory.censor(DescriptionTemplateTypeCensor.class).censor(fieldSet, null);
|
this.censorFactory.censor(DescriptionTemplateTypeCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
DescriptionTemplateTypeQuery query = this.queryFactory.query(DescriptionTemplateTypeQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
DescriptionTemplateTypeQuery query = this.queryFactory.query(DescriptionTemplateTypeQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||||
DescriptionTemplateType model = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
DescriptionTemplateType model = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||||
if (model == null)
|
if (model == null)
|
||||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplateType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplateType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
this.auditService.track(AuditableAction.DescriptionTemplateType_Lookup, Map.ofEntries(
|
this.auditService.track(AuditableAction.DescriptionTemplateType_Lookup, Map.ofEntries(
|
||||||
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
|
|
|
@ -1,19 +1,6 @@
|
||||||
package org.opencdmp.controllers;
|
package org.opencdmp.controllers;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import org.opencdmp.audit.AuditableAction;
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import org.opencdmp.model.persist.NewVersionDmpBlueprintPersist;
|
|
||||||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
|
||||||
import org.opencdmp.data.DmpBlueprintEntity;
|
|
||||||
import org.opencdmp.model.dmpblueprint.DmpBlueprint;
|
|
||||||
import org.opencdmp.model.builder.dmpblueprint.DmpBlueprintBuilder;
|
|
||||||
import org.opencdmp.model.censorship.dmpblueprint.DmpBlueprintCensor;
|
|
||||||
import org.opencdmp.model.persist.DmpBlueprintPersist;
|
|
||||||
import org.opencdmp.model.result.QueryResult;
|
|
||||||
import org.opencdmp.query.DmpBlueprintQuery;
|
|
||||||
import org.opencdmp.query.lookup.DmpBlueprintLookup;
|
|
||||||
import org.opencdmp.service.dmpblueprint.DmpBlueprintService;
|
|
||||||
import gr.cite.tools.auditing.AuditService;
|
import gr.cite.tools.auditing.AuditService;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.censor.CensorFactory;
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
@ -24,8 +11,21 @@ import gr.cite.tools.exception.MyNotFoundException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import gr.cite.tools.logging.MapLogEntry;
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import jakarta.xml.bind.JAXBException;
|
import jakarta.xml.bind.JAXBException;
|
||||||
|
import org.opencdmp.audit.AuditableAction;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.data.DmpBlueprintEntity;
|
||||||
|
import org.opencdmp.model.builder.dmpblueprint.DmpBlueprintBuilder;
|
||||||
|
import org.opencdmp.model.censorship.dmpblueprint.DmpBlueprintCensor;
|
||||||
|
import org.opencdmp.model.dmpblueprint.DmpBlueprint;
|
||||||
|
import org.opencdmp.model.persist.DmpBlueprintPersist;
|
||||||
|
import org.opencdmp.model.persist.NewVersionDmpBlueprintPersist;
|
||||||
|
import org.opencdmp.model.result.QueryResult;
|
||||||
|
import org.opencdmp.query.DmpBlueprintQuery;
|
||||||
|
import org.opencdmp.query.lookup.DmpBlueprintLookup;
|
||||||
|
import org.opencdmp.service.dmpblueprint.DmpBlueprintService;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
@ -98,10 +98,10 @@ public class DmpBlueprintController {
|
||||||
|
|
||||||
this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null);
|
this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||||
DmpBlueprint model = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
DmpBlueprint model = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||||
if (model == null)
|
if (model == null)
|
||||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
this.auditService.track(AuditableAction.DmpBlueprint_Lookup, Map.ofEntries(
|
this.auditService.track(AuditableAction.DmpBlueprint_Lookup, Map.ofEntries(
|
||||||
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
|
@ -169,7 +169,7 @@ public class DmpBlueprintController {
|
||||||
return persisted;
|
return persisted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/xml/export/{id}"}, produces = "application/xml")
|
@RequestMapping(method = RequestMethod.GET, value = "/xml/export/{id}", produces = "application/xml")
|
||||||
public @ResponseBody ResponseEntity<byte[]> getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
|
public @ResponseBody ResponseEntity<byte[]> getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
|
||||||
logger.debug(new MapLogEntry("export" + DmpBlueprint.class.getSimpleName()).And("id", id));
|
logger.debug(new MapLogEntry("export" + DmpBlueprint.class.getSimpleName()).And("id", id));
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ public class DmpBlueprintController {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/xml/import"})
|
@RequestMapping(method = RequestMethod.POST, value = "/xml/import")
|
||||||
public DmpBlueprint importXml(@RequestParam("file") MultipartFile file, FieldSet fieldSet) throws IOException, JAXBException, InvalidApplicationException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException {
|
public DmpBlueprint importXml(@RequestParam("file") MultipartFile file, FieldSet fieldSet) throws IOException, JAXBException, InvalidApplicationException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException {
|
||||||
logger.debug(new MapLogEntry("clone" + DmpBlueprint.class.getSimpleName()).And("file", file));
|
logger.debug(new MapLogEntry("clone" + DmpBlueprint.class.getSimpleName()).And("file", file));
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class DmpController {
|
||||||
|
|
||||||
this.censorFactory.censor(PublicDmpCensor.class).censor(fieldSet);
|
this.censorFactory.censor(PublicDmpCensor.class).censor(fieldSet);
|
||||||
|
|
||||||
DmpQuery query = this.queryFactory.query(DmpQuery.class).authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public);
|
DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public);
|
||||||
|
|
||||||
PublicDmp model = this.builderFactory.builder(PublicDmpBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet));
|
PublicDmp model = this.builderFactory.builder(PublicDmpBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet));
|
||||||
if (model == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
if (model == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
@ -144,7 +144,7 @@ public class DmpController {
|
||||||
|
|
||||||
this.censorFactory.censor(DmpCensor.class).censor(fieldSet, null);
|
this.censorFactory.censor(DmpCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
DmpQuery query = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||||
Dmp model = this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
Dmp model = this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||||
if (model == null)
|
if (model == null)
|
||||||
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
|
@ -1,19 +1,5 @@
|
||||||
package org.opencdmp.controllers;
|
package org.opencdmp.controllers;
|
||||||
|
|
||||||
import org.opencdmp.audit.AuditableAction;
|
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
|
||||||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
|
||||||
import org.opencdmp.data.EntityDoiEntity;
|
|
||||||
import org.opencdmp.model.DescriptionTemplateType;
|
|
||||||
import org.opencdmp.model.EntityDoi;
|
|
||||||
import org.opencdmp.model.builder.EntityDoiBuilder;
|
|
||||||
import org.opencdmp.model.censorship.EntityDoiCensor;
|
|
||||||
import org.opencdmp.model.persist.EntityDoiPersist;
|
|
||||||
import org.opencdmp.model.result.QueryResult;
|
|
||||||
import org.opencdmp.query.EntityDoiQuery;
|
|
||||||
import org.opencdmp.query.lookup.EntityDoiLookup;
|
|
||||||
import org.opencdmp.service.deposit.DepositService;
|
|
||||||
import org.opencdmp.service.entitydoi.EntityDoiService;
|
|
||||||
import gr.cite.tools.auditing.AuditService;
|
import gr.cite.tools.auditing.AuditService;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.censor.CensorFactory;
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
@ -24,6 +10,19 @@ import gr.cite.tools.exception.MyNotFoundException;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import gr.cite.tools.logging.MapLogEntry;
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||||
|
import org.opencdmp.audit.AuditableAction;
|
||||||
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
import org.opencdmp.data.EntityDoiEntity;
|
||||||
|
import org.opencdmp.model.DescriptionTemplateType;
|
||||||
|
import org.opencdmp.model.EntityDoi;
|
||||||
|
import org.opencdmp.model.builder.EntityDoiBuilder;
|
||||||
|
import org.opencdmp.model.censorship.EntityDoiCensor;
|
||||||
|
import org.opencdmp.model.persist.EntityDoiPersist;
|
||||||
|
import org.opencdmp.model.result.QueryResult;
|
||||||
|
import org.opencdmp.query.EntityDoiQuery;
|
||||||
|
import org.opencdmp.query.lookup.EntityDoiLookup;
|
||||||
|
import org.opencdmp.service.entitydoi.EntityDoiService;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
@ -88,10 +87,10 @@ public class EntityDoiController {
|
||||||
|
|
||||||
this.censorFactory.censor(EntityDoiCensor.class).censor(fieldSet, null);
|
this.censorFactory.censor(EntityDoiCensor.class).censor(fieldSet, null);
|
||||||
|
|
||||||
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||||
EntityDoi model = this.builderFactory.builder(EntityDoiBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
EntityDoi model = this.builderFactory.builder(EntityDoiBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||||
if (model == null)
|
if (model == null)
|
||||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, EntityDoi.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, EntityDoi.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
this.auditService.track(AuditableAction.EntityDoi_Lookup, Map.ofEntries(
|
this.auditService.track(AuditableAction.EntityDoi_Lookup, Map.ofEntries(
|
||||||
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue