add no tracking
This commit is contained in:
parent
86aff14a64
commit
b734606141
|
@ -1,5 +1,7 @@
|
|||
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.PermissionNameProvider;
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
|
@ -9,14 +11,12 @@ import org.opencdmp.data.DescriptionEntity;
|
|||
import org.opencdmp.data.DmpDescriptionTemplateEntity;
|
||||
import org.opencdmp.data.DmpEntity;
|
||||
import org.opencdmp.data.DmpUserEntity;
|
||||
import org.opencdmp.model.description.Description;
|
||||
import org.opencdmp.model.DmpDescriptionTemplate;
|
||||
import org.opencdmp.model.DmpUser;
|
||||
import org.opencdmp.model.description.Description;
|
||||
import org.opencdmp.query.DescriptionQuery;
|
||||
import org.opencdmp.query.DmpDescriptionTemplateQuery;
|
||||
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.web.context.annotation.RequestScope;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
|
|||
|
||||
@Override
|
||||
public List<String> getPermissionNames() {
|
||||
return permissionNameProvider.getPermissions();
|
||||
return this.permissionNameProvider.getPermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,12 +56,12 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
|
|||
for (UUID id : ids){
|
||||
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());
|
||||
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){
|
||||
affiliatedResources.get(dmpUser.getDmpId()).getDmpUserRoles().add(dmpUser.getRole());
|
||||
|
@ -82,16 +82,16 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
|
|||
for (UUID id : ids){
|
||||
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());
|
||||
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<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<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).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));
|
||||
|
||||
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));
|
||||
|
||||
for (DescriptionEntity description : descriptionEntities){
|
||||
|
@ -123,9 +123,9 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
|
|||
for (UUID id : sectionIds){
|
||||
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()){
|
||||
List<DmpUserEntity> dmpSectionUsers = dmpUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList();
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
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.convention.ConventionService;
|
||||
import org.opencdmp.data.DescriptionEntity;
|
||||
import org.opencdmp.data.DescriptionReferenceEntity;
|
||||
import org.opencdmp.data.DescriptionTagEntity;
|
||||
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.NestedDmpElasticBuilder;
|
||||
import org.opencdmp.elastic.elasticbuilder.nested.NestedReferenceElasticBuilder;
|
||||
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.descriptiontemplate.DescriptionTemplate;
|
||||
import org.opencdmp.model.dmp.Dmp;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -30,7 +33,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionElasticEntity, DescriptionEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -82,10 +85,10 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
|
|||
if (data.isEmpty()) return null;
|
||||
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();
|
||||
|
||||
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, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
||||
|
@ -102,10 +105,10 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
|
|||
if (data.isEmpty()) return null;
|
||||
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();
|
||||
|
||||
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, List<NestedTagElasticEntity>> itemMap = new HashMap<>();
|
||||
|
@ -124,7 +127,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
|
|||
this.logger.debug("checking related - {}", Dmp.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
@ -136,7 +139,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
|
|||
this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
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.query.QueryFactory;
|
||||
import gr.cite.tools.exception.MyApplicationException;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -22,7 +28,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -79,10 +85,10 @@ public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpE
|
|||
if (data.isEmpty()) return null;
|
||||
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();
|
||||
|
||||
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, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
||||
|
@ -101,7 +107,7 @@ public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpE
|
|||
this.logger.debug("checking related - {}", DescriptionEntity.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
@ -112,7 +118,7 @@ public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpE
|
|||
return null;
|
||||
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();
|
||||
|
||||
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;
|
||||
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();
|
||||
|
||||
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<>();
|
||||
|
||||
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));
|
||||
for (DmpUserEntity d : data) {
|
||||
NestedCollaboratorElasticEntity m = new NestedCollaboratorElasticEntity();
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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.convention.ConventionService;
|
||||
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.NestedTagElasticEntity;
|
||||
import org.opencdmp.elastic.elasticbuilder.BaseElasticBuilder;
|
||||
import org.opencdmp.model.descriptionreference.DescriptionReference;
|
||||
import org.opencdmp.model.DescriptionTag;
|
||||
import org.opencdmp.model.descriptionreference.DescriptionReference;
|
||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -28,7 +28,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class NestedDescriptionElasticBuilder extends BaseElasticBuilder<NestedDescriptionElasticEntity, DescriptionEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -74,10 +74,10 @@ public class NestedDescriptionElasticBuilder extends BaseElasticBuilder<NestedDe
|
|||
if (data.isEmpty()) return null;
|
||||
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();
|
||||
|
||||
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, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
||||
|
@ -94,10 +94,10 @@ public class NestedDescriptionElasticBuilder extends BaseElasticBuilder<NestedDe
|
|||
if (data.isEmpty()) return null;
|
||||
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();
|
||||
|
||||
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, List<NestedTagElasticEntity>> itemMap = new HashMap<>();
|
||||
|
@ -116,7 +116,7 @@ public class NestedDescriptionElasticBuilder extends BaseElasticBuilder<NestedDe
|
|||
this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
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.convention.ConventionService;
|
||||
import org.opencdmp.data.DmpEntity;
|
||||
import org.opencdmp.data.DmpReferenceEntity;
|
||||
import org.opencdmp.data.DmpUserEntity;
|
||||
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.model.dmpreference.DmpReference;
|
||||
import org.opencdmp.query.DmpReferenceQuery;
|
||||
import org.opencdmp.query.DmpUserQuery;
|
||||
import org.opencdmp.query.EntityDoiQuery;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -27,7 +30,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class NestedDmpElasticBuilder extends BaseElasticBuilder<NestedDmpElasticEntity, DmpEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -80,10 +83,10 @@ public class NestedDmpElasticBuilder extends BaseElasticBuilder<NestedDmpElastic
|
|||
if (data.isEmpty()) return null;
|
||||
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();
|
||||
|
||||
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, List<NestedReferenceElasticEntity>> itemMap = new HashMap<>();
|
||||
|
@ -101,7 +104,7 @@ public class NestedDmpElasticBuilder extends BaseElasticBuilder<NestedDmpElastic
|
|||
return null;
|
||||
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();
|
||||
|
||||
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;
|
||||
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();
|
||||
|
||||
Map<UUID, NestedDoiElasticEntity> itemMapById = this.builderFactory.builder(NestedDoiElasticBuilder.class).asForeignKey(associationEntities, NestedDoiElasticEntity::getId);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
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.data.DescriptionEntity;
|
||||
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
||||
import org.opencdmp.integrationevent.outbox.OutboxService;
|
||||
import org.opencdmp.model.description.Description;
|
||||
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.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements AnnotationEntityRemovalIntegrationEventHandler {
|
||||
|
||||
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.setType(OutboxIntegrationEvent.ANNOTATION_ENTITY_REMOVE);
|
||||
message.setEvent(event);
|
||||
if (this.tenantScope.isSet()) message.setTenantId(tenantScope.getTenant());
|
||||
if (this.tenantScope.isSet()) message.setTenantId(this.tenantScope.getTenant());
|
||||
this.outboxService.publish(message);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements Annot
|
|||
|
||||
@Override
|
||||
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();
|
||||
event.setEntityIds(new ArrayList<>());
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
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.data.DescriptionEntity;
|
||||
import org.opencdmp.data.DmpUserEntity;
|
||||
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
||||
import org.opencdmp.integrationevent.outbox.OutboxService;
|
||||
import org.opencdmp.model.description.Description;
|
||||
import org.opencdmp.model.DmpUser;
|
||||
import org.opencdmp.model.description.Description;
|
||||
import org.opencdmp.query.DescriptionQuery;
|
||||
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.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements AnnotationEntityTouchedIntegrationEventHandler {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(AnnotationEntityTouchedIntegrationEventHandlerImpl.class));
|
||||
|
@ -47,9 +47,9 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot
|
|||
|
||||
@Override
|
||||
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;
|
||||
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();
|
||||
event.setEvents(List.of(this.buildEventItem(descriptionId, dmpUsers)));
|
||||
|
@ -59,9 +59,9 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot
|
|||
|
||||
@Override
|
||||
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;
|
||||
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();
|
||||
event.setEvents(new ArrayList<>());
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
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.scope.tenant.TenantScope;
|
||||
import org.opencdmp.commons.types.user.AdditionalInfoEntity;
|
||||
import org.opencdmp.data.*;
|
||||
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
||||
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.usercredential.UserCredential;
|
||||
import org.opencdmp.query.*;
|
||||
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.query.TenantUserQuery;
|
||||
import org.opencdmp.query.UserContactInfoQuery;
|
||||
import org.opencdmp.query.UserCredentialQuery;
|
||||
import org.opencdmp.query.UserQuery;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.MessageSource;
|
||||
|
@ -27,7 +31,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
@Component("outboxusertouchedintegrationeventhandler")
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserTouchedIntegrationEventHandlerImpl implements UserTouchedIntegrationEventHandler {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(UserTouchedIntegrationEventHandlerImpl.class));
|
||||
|
@ -54,22 +58,22 @@ public class UserTouchedIntegrationEventHandlerImpl implements UserTouchedIntegr
|
|||
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
|
||||
message.setMessageId(UUID.randomUUID());
|
||||
message.setType(OutboxIntegrationEvent.USER_TOUCH);
|
||||
if (this.tenantScope.isSet()) message.setTenantId(tenantScope.getTenant());
|
||||
if (this.tenantScope.isSet()) message.setTenantId(this.tenantScope.getTenant());
|
||||
|
||||
try {
|
||||
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));
|
||||
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));
|
||||
|
||||
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));
|
||||
|
||||
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));
|
||||
|
||||
UserTouchedIntegrationEvent event = new UserTouchedIntegrationEvent();
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -27,7 +27,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionTagBuilder extends BaseBuilder<DescriptionTag, DescriptionTagEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -103,7 +103,7 @@ public class DescriptionTagBuilder extends BaseBuilder<DescriptionTag, Descripti
|
|||
Description::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Description._id)) {
|
||||
|
@ -133,7 +133,7 @@ public class DescriptionTagBuilder extends BaseBuilder<DescriptionTag, Descripti
|
|||
Tag::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Tag._id)) {
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -24,7 +25,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpAssociatedUserBuilder extends BaseBuilder<DmpAssociatedUser, UserEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -82,7 +83,7 @@ public class DmpAssociatedUserBuilder extends BaseBuilder<DmpAssociatedUser, Use
|
|||
|
||||
Map<UUID, List<UserContactInfo>> itemMap;
|
||||
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());
|
||||
|
||||
if (!fields.hasField(this.asIndexer(UserContactInfo._user, User._id))) {
|
||||
|
|
|
@ -109,7 +109,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder<DmpDescriptionTem
|
|||
Dmp::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Dmp._id)) {
|
||||
|
@ -126,7 +126,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder<DmpDescriptionTem
|
|||
|
||||
Map<UUID, List<DescriptionTemplate>> itemMap;
|
||||
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);
|
||||
|
||||
if (!fields.hasField(DescriptionTemplate._groupId)) {
|
||||
|
@ -155,7 +155,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder<DmpDescriptionTem
|
|||
DescriptionTemplate::getGroupId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(DescriptionTemplate._groupId)) {
|
||||
|
|
|
@ -102,7 +102,7 @@ public class DmpUserBuilder extends BaseBuilder<DmpUser, DmpUserEntity>{
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
@ -132,7 +132,7 @@ public class DmpUserBuilder extends BaseBuilder<DmpUser, DmpUserEntity>{
|
|||
Dmp::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Dmp._id)) {
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class LockBuilder extends BaseBuilder<Lock, LockEntity>{
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -91,7 +91,7 @@ public class LockBuilder extends BaseBuilder<Lock, LockEntity>{
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -24,7 +27,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class PublicDescriptionBuilder extends BaseBuilder<PublicDescription, DescriptionEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -101,7 +104,7 @@ public class PublicDescriptionBuilder extends BaseBuilder<PublicDescription, Des
|
|||
PublicDmpDescriptionTemplate::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(PublicDmpDescriptionTemplate._id)) {
|
||||
|
@ -131,7 +134,7 @@ public class PublicDescriptionBuilder extends BaseBuilder<PublicDescription, Des
|
|||
PublicDescriptionTemplate::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(PublicDescriptionTemplate._id)) {
|
||||
|
@ -161,7 +164,7 @@ public class PublicDescriptionBuilder extends BaseBuilder<PublicDescription, Des
|
|||
PublicDmp::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(PublicDmp._id)) {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
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.commons.enums.EntityType;
|
||||
import org.opencdmp.convention.ConventionService;
|
||||
|
@ -9,13 +16,6 @@ import org.opencdmp.query.DescriptionQuery;
|
|||
import org.opencdmp.query.DmpReferenceQuery;
|
||||
import org.opencdmp.query.DmpUserQuery;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -101,7 +101,7 @@ public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
|
|||
|
||||
Map<UUID, List<PublicDmpReference>> itemMap = null;
|
||||
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());
|
||||
|
||||
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;
|
||||
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());
|
||||
|
||||
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;
|
||||
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());
|
||||
|
||||
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;
|
||||
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);
|
||||
|
||||
if (!fields.hasField(this.asIndexer(PublicEntityDoi._entityId))) {
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -25,7 +23,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class PublicDmpDescriptionTemplateBuilder extends BaseBuilder<PublicDmpDescriptionTemplate, DmpDescriptionTemplateEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -87,7 +85,7 @@ public class PublicDmpDescriptionTemplateBuilder extends BaseBuilder<PublicDmpDe
|
|||
PublicDmp::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(PublicDmp._id)) {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
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.commons.enums.IsActive;
|
||||
import org.opencdmp.convention.ConventionService;
|
||||
|
@ -9,13 +16,6 @@ import org.opencdmp.model.PublicDmpReference;
|
|||
import org.opencdmp.model.PublicReference;
|
||||
import org.opencdmp.query.DmpQuery;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class PublicDmpReferenceBuilder extends BaseBuilder<PublicDmpReference, DmpReferenceEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -92,7 +92,7 @@ public class PublicDmpReferenceBuilder extends BaseBuilder<PublicDmpReference, D
|
|||
PublicReference::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(PublicReference._id)) {
|
||||
|
@ -119,7 +119,7 @@ public class PublicDmpReferenceBuilder extends BaseBuilder<PublicDmpReference, D
|
|||
PublicDmp::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(PublicDmp._id)) {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
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.convention.ConventionService;
|
||||
import org.opencdmp.data.DmpUserEntity;
|
||||
|
@ -9,13 +16,6 @@ import org.opencdmp.model.PublicUser;
|
|||
import org.opencdmp.model.user.User;
|
||||
import org.opencdmp.query.DmpQuery;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class PublicDmpUserBuilder extends BaseBuilder<PublicDmpUser, DmpUserEntity>{
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -92,7 +92,7 @@ public class PublicDmpUserBuilder extends BaseBuilder<PublicDmpUser, DmpUserEnti
|
|||
PublicUser::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(PublicUser._id)) {
|
||||
|
@ -122,7 +122,7 @@ public class PublicDmpUserBuilder extends BaseBuilder<PublicDmpUser, DmpUserEnti
|
|||
PublicDmp::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(PublicDmp._id)) {
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -28,7 +24,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class PublicReferenceBuilder extends BaseBuilder<PublicReference, ReferenceEntity>{
|
||||
private final BuilderFactory builderFactory;
|
||||
|
||||
|
@ -92,7 +88,7 @@ public class PublicReferenceBuilder extends BaseBuilder<PublicReference, Referen
|
|||
PublicReferenceType::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(PublicReferenceType._id)) {
|
||||
|
|
|
@ -94,7 +94,7 @@ public class RecentActivityItemBuilder extends BaseBuilder<RecentActivityItem, R
|
|||
Dmp::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Dmp._id)) {
|
||||
|
@ -121,7 +121,7 @@ public class RecentActivityItemBuilder extends BaseBuilder<RecentActivityItem, R
|
|||
Description::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Description._id)) {
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class StorageFileBuilder extends BaseBuilder<StorageFile, StorageFileEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -100,7 +100,7 @@ public class StorageFileBuilder extends BaseBuilder<StorageFile, StorageFileEnti
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class TagBuilder extends BaseBuilder<Tag, TagEntity>{
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -89,7 +89,7 @@ public class TagBuilder extends BaseBuilder<Tag, TagEntity>{
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
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.commons.scope.tenant.TenantScope;
|
||||
import org.opencdmp.convention.ConventionService;
|
||||
|
@ -9,13 +16,6 @@ import org.opencdmp.model.TenantUser;
|
|||
import org.opencdmp.model.user.User;
|
||||
import org.opencdmp.query.TenantQuery;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class TenantUserBuilder extends BaseBuilder<TenantUser, TenantUserEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -98,7 +98,7 @@ public class TenantUserBuilder extends BaseBuilder<TenantUser, TenantUserEntity>
|
|||
x -> x.getId());
|
||||
} else {
|
||||
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());
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
@ -127,7 +127,7 @@ public class TenantUserBuilder extends BaseBuilder<TenantUser, TenantUserEntity>
|
|||
x -> x.getId());
|
||||
} else {
|
||||
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());
|
||||
}
|
||||
if (!fields.hasField(Tenant._id)) {
|
||||
|
|
|
@ -94,7 +94,7 @@ public class UserAdditionalInfoBuilder extends BaseBuilder<UserAdditionalInfo, A
|
|||
Reference::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Reference._id)) {
|
||||
|
|
|
@ -127,7 +127,7 @@ public class UserBuilder extends BaseBuilder<User, UserEntity> {
|
|||
|
||||
Map<UUID, List<UserContactInfo>> itemMap;
|
||||
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());
|
||||
|
||||
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;
|
||||
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());
|
||||
|
||||
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");
|
||||
|
||||
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);
|
||||
else {
|
||||
try {
|
||||
|
@ -192,7 +192,7 @@ public class UserBuilder extends BaseBuilder<User, UserEntity> {
|
|||
|
||||
Map<UUID, List<UserCredential>> itemMap;
|
||||
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());
|
||||
|
||||
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;
|
||||
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());
|
||||
|
||||
if (!fields.hasField(this.asIndexer(TenantUser._user, User._id))) {
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -23,7 +23,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserContactInfoBuilder extends BaseBuilder<UserContactInfo, UserContactInfoEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -92,7 +92,7 @@ public class UserContactInfoBuilder extends BaseBuilder<UserContactInfo, UserCon
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -27,7 +27,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionTemplate, UserDescriptionTemplateEntity> {
|
||||
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
@ -97,7 +97,7 @@ public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionT
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
@ -126,7 +126,7 @@ public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionT
|
|||
x -> x.getId());
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(DescriptionTemplate._id)) {
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserRoleBuilder extends BaseBuilder<UserRole, UserRoleEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -94,7 +94,7 @@ public class UserRoleBuilder extends BaseBuilder<UserRole, UserRoleEntity> {
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
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.commons.XmlHandlingService;
|
||||
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.user.User;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -30,7 +30,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class ActionConfirmationBuilder extends BaseBuilder<ActionConfirmation, ActionConfirmationEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -120,7 +120,7 @@ public class ActionConfirmationBuilder extends BaseBuilder<ActionConfirmation, A
|
|||
x -> x.getId());
|
||||
} else {
|
||||
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());
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
|
|
@ -78,7 +78,7 @@ public class DmpUserCommonModelBuilder extends BaseCommonModelBuilder<DmpUserMod
|
|||
this.logger.debug("checking related - {}", UserModel.class.getSimpleName());
|
||||
|
||||
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);
|
||||
return itemMap;
|
||||
}
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
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.query.QueryFactory;
|
||||
import gr.cite.tools.exception.MyApplicationException;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -28,7 +22,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserCommonModelBuilder extends BaseCommonModelBuilder<UserModel, UserEntity> {
|
||||
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
@ -49,7 +43,7 @@ public class UserCommonModelBuilder extends BaseCommonModelBuilder<UserModel, Us
|
|||
}
|
||||
|
||||
public UserCommonModelBuilder disableContacts(boolean values) {
|
||||
this.disableContacts = disableContacts;
|
||||
this.disableContacts = this.disableContacts;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -77,7 +71,7 @@ public class UserCommonModelBuilder extends BaseCommonModelBuilder<UserModel, Us
|
|||
this.logger.debug("checking related - {}", UserContactInfo.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
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.commonmodels.enums.DescriptionStatus;
|
||||
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.DmpDescriptionTemplateEntity;
|
||||
import org.opencdmp.data.DmpEntity;
|
||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||
import org.opencdmp.model.DmpDescriptionTemplate;
|
||||
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||
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.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.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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -38,7 +40,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<DescriptionModel, DescriptionEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -110,7 +112,7 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
|
|||
if (d.getProperties() != null){
|
||||
PropertyDefinitionEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PropertyDefinitionEntity.class, d.getProperties());
|
||||
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);
|
||||
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());
|
||||
|
||||
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));
|
||||
for (DescriptionTemplateEntity item : items){
|
||||
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());
|
||||
|
||||
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));
|
||||
for (DmpDescriptionTemplateEntity item : items){
|
||||
itemMap.put(item.getId(), item.getSectionId());
|
||||
|
@ -159,8 +161,8 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
|
|||
this.logger.debug("checking related - {}", DmpModel.class.getSimpleName());
|
||||
|
||||
Map<UUID, DmpModel> itemMap;
|
||||
DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).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);
|
||||
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(this.repositoryId).useSharedStorage(this.useSharedStorage).setDisableDescriptions(true).authorize(this.authorize).asForeignKey(q, DmpEntity::getId);
|
||||
|
||||
return itemMap;
|
||||
}
|
||||
|
@ -171,7 +173,7 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
|
|||
this.logger.debug("checking related - {}", DescriptionTemplateModel.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
|
|
@ -18,12 +18,12 @@ import org.opencdmp.commons.types.description.FieldEntity;
|
|||
import org.opencdmp.convention.ConventionService;
|
||||
import org.opencdmp.data.ReferenceEntity;
|
||||
import org.opencdmp.data.StorageFileEntity;
|
||||
import org.opencdmp.model.reference.Reference;
|
||||
import org.opencdmp.model.StorageFile;
|
||||
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
||||
import org.opencdmp.model.builder.commonmodels.reference.ReferenceCommonModelBuilder;
|
||||
import org.opencdmp.model.persist.StorageFilePersist;
|
||||
import org.opencdmp.model.reference.Reference;
|
||||
import org.opencdmp.query.ReferenceQuery;
|
||||
import org.opencdmp.query.StorageFileQuery;
|
||||
import org.opencdmp.service.storage.StorageFileProperties;
|
||||
|
@ -105,7 +105,7 @@ public class FieldCommonModelBuilder extends BaseCommonModelBuilder<FieldModel,
|
|||
try {
|
||||
byte[] bytes = this.storageFileService.readAsBytesSafe(UUID.fromString(d.getTextValue()));
|
||||
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.setFilename(storageFile.getName() + (storageFile.getExtension().startsWith(".") ? "" : ".") + storageFile.getExtension());
|
||||
fileEnvelopeModel.setMimeType(storageFile.getMimeType());
|
||||
|
@ -148,7 +148,7 @@ public class FieldCommonModelBuilder extends BaseCommonModelBuilder<FieldModel,
|
|||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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.commonmodels.models.DescriptionTemplateTypeModel;
|
||||
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.DescriptionTemplateTypeCommonModelBuilder;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionTemplateCommonModelBuilder extends BaseCommonModelBuilder<DescriptionTemplateModel, DescriptionTemplateEntity> {
|
||||
|
||||
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());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ReferenceTypeDataCommonModelBuilder extends BaseFieldDataCommonMode
|
|||
@Override
|
||||
protected void buildChild(ReferenceTypeDataEntity d, ReferenceTypeDataModel m) {
|
||||
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;
|
||||
|
||||
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.commonmodels.enums.DmpAccessType;
|
||||
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.convention.ConventionService;
|
||||
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.description.DescriptionCommonModelBuilder;
|
||||
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.dmpreference.DmpReference;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -41,7 +42,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpEntity> {
|
||||
|
||||
private final QueryFactory queryFactory;
|
||||
|
@ -156,15 +157,15 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
|||
}
|
||||
|
||||
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
|
||||
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class);
|
||||
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking();
|
||||
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();
|
||||
|
||||
//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) {
|
||||
EntityDoiEntity doiEntity = dois.stream().filter(x -> x.getEntityId().equals(uuid)).findFirst().orElse(null);
|
||||
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());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
@ -186,7 +187,7 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
|||
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
@ -197,8 +198,8 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
|||
this.logger.debug("checking related - {}", Description.class.getSimpleName());
|
||||
|
||||
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()));
|
||||
itemMap = this.builderFactory.builder(DescriptionCommonModelBuilder.class).setRepositoryId(repositoryId).useSharedStorage(useSharedStorage).authorize(this.authorize).asMasterKey(query, DescriptionEntity::getDmpId);
|
||||
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(this.repositoryId).useSharedStorage(this.useSharedStorage).authorize(this.authorize).asMasterKey(query, DescriptionEntity::getDmpId);
|
||||
|
||||
return itemMap;
|
||||
}
|
||||
|
@ -208,7 +209,7 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
|||
this.logger.debug("checking related - {}", EntityDoi.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
@ -220,7 +221,7 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, DmpE
|
|||
this.logger.debug("checking related - {}", UserModel.class.getSimpleName());
|
||||
|
||||
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);
|
||||
return itemMap;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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.commonmodels.models.UserModel;
|
||||
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.UserCommonModelBuilder;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -25,7 +25,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpContactCommonModelBuilder extends BaseCommonModelBuilder<DmpContactModel, DmpContactEntity> {
|
||||
|
||||
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());
|
||||
|
||||
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);
|
||||
return itemMap;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
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.commons.types.dmpblueprint.ReferenceTypeFieldEntity;
|
||||
import org.opencdmp.convention.ConventionService;
|
||||
import org.opencdmp.model.builder.commonmodels.ReferenceTypeCommonModelBuilder;
|
||||
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.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class ReferenceTypeFieldCommonModelBuilder extends FieldCommonModelBuilder<ReferenceTypeFieldModel, ReferenceTypeFieldEntity> {
|
||||
private final QueryFactory queryFactory;
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -30,7 +30,7 @@ public class ReferenceTypeFieldCommonModelBuilder extends FieldCommonModelBuilde
|
|||
}
|
||||
|
||||
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());
|
||||
|
||||
return model;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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.commonmodels.models.dmpreference.DmpReferenceModel;
|
||||
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.reference.ReferenceCommonModelBuilder;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -26,7 +26,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpReferenceCommonModelBuilder extends BaseCommonModelBuilder<DmpReferenceModel, DmpReferenceEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -78,7 +78,7 @@ public class DmpReferenceCommonModelBuilder extends BaseCommonModelBuilder<DmpRe
|
|||
this.logger.debug("checking related - {}", ReferenceModel.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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.commonmodels.enums.ReferenceSourceType;
|
||||
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.types.reference.DefinitionEntity;
|
||||
import org.opencdmp.convention.ConventionService;
|
||||
import org.opencdmp.data.ReferenceTypeEntity;
|
||||
import org.opencdmp.data.ReferenceEntity;
|
||||
import org.opencdmp.data.ReferenceTypeEntity;
|
||||
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
|
||||
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
|
||||
import org.opencdmp.model.builder.commonmodels.ReferenceTypeCommonModelBuilder;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -27,7 +27,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class ReferenceCommonModelBuilder extends BaseCommonModelBuilder<ReferenceModel, ReferenceEntity> {
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -89,7 +89,7 @@ public class ReferenceCommonModelBuilder extends BaseCommonModelBuilder<Referenc
|
|||
this.logger.debug("checking related - {}", ReferenceTypeModel.class.getSimpleName());
|
||||
|
||||
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);
|
||||
|
||||
return itemMap;
|
||||
|
|
|
@ -159,7 +159,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
@ -189,7 +189,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
|||
DmpDescriptionTemplate::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(DmpDescriptionTemplate._id)) {
|
||||
|
@ -219,7 +219,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
|||
DescriptionTemplate::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(DescriptionTemplate._id)) {
|
||||
|
@ -238,7 +238,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
|||
this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName());
|
||||
|
||||
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));
|
||||
for (DescriptionTemplateEntity item : items){
|
||||
DefinitionEntity definition =this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, item.getDefinition());
|
||||
|
@ -265,7 +265,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
|||
Dmp::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Dmp._id)) {
|
||||
|
@ -284,7 +284,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
|||
|
||||
Map<UUID, List<DescriptionReference>> itemMap;
|
||||
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());
|
||||
|
||||
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;
|
||||
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());
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public class DescriptionReferenceBuilder extends BaseBuilder<DescriptionReferenc
|
|||
Description::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Description._id)) {
|
||||
|
@ -143,7 +143,7 @@ public class DescriptionReferenceBuilder extends BaseBuilder<DescriptionReferenc
|
|||
Reference::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Reference._id)) {
|
||||
|
|
|
@ -1,19 +1,5 @@
|
|||
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.query.QueryFactory;
|
||||
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.logging.DataLogEntry;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -31,7 +31,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate, DescriptionTemplateEntity> {
|
||||
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
@ -131,11 +131,11 @@ public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate,
|
|||
x -> x.getId());
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
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);
|
||||
return x;
|
||||
}).collect(Collectors.toList());
|
||||
|
@ -151,7 +151,7 @@ public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate,
|
|||
|
||||
Map<UUID, List<UserDescriptionTemplate>> itemMap = null;
|
||||
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());
|
||||
|
||||
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());
|
||||
|
||||
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.logging.DataLogEntry;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import org.opencdmp.authorization.AffiliatedResource;
|
||||
import org.opencdmp.authorization.AuthorizationFlags;
|
||||
import org.opencdmp.authorization.authorizationcontentresolver.AuthorizationContentResolver;
|
||||
|
@ -43,6 +45,8 @@ import java.util.stream.Collectors;
|
|||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
private final QueryFactory queryFactory;
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
|
@ -148,7 +152,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
|||
|
||||
Map<UUID, List<DmpReference>> itemMap;
|
||||
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());
|
||||
|
||||
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;
|
||||
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);
|
||||
|
||||
if (!fields.hasField(this.asIndexer(EntityDoi._entityId))) {
|
||||
|
@ -195,7 +199,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
|||
DmpBlueprint::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(DmpBlueprint._id)) {
|
||||
|
@ -225,7 +229,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
@ -245,7 +249,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
|||
|
||||
Map<UUID, List<DmpUser>> itemMap;
|
||||
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());
|
||||
|
||||
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;
|
||||
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());
|
||||
|
||||
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;
|
||||
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());
|
||||
|
||||
if (!fields.hasField(this.asIndexer(DmpDescriptionTemplate._dmp, Dmp._id))) {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class DmpContactBuilder extends BaseBuilder<DmpContact, DmpContactEntity>
|
|||
DmpAssociatedUser::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
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) {
|
||||
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());
|
||||
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));
|
||||
}
|
||||
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));
|
||||
}
|
||||
models.add(m);
|
||||
|
|
|
@ -110,7 +110,7 @@ public class DmpReferenceBuilder extends BaseBuilder<DmpReference, DmpReferenceE
|
|||
Reference::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Reference._id)) {
|
||||
|
@ -137,7 +137,7 @@ public class DmpReferenceBuilder extends BaseBuilder<DmpReference, DmpReferenceE
|
|||
Dmp::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(Dmp._id)) {
|
||||
|
|
|
@ -97,7 +97,7 @@ public abstract class ExternalFetcherBaseSourceConfigurationBuilder<Model extend
|
|||
ReferenceType::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(ReferenceType._id)) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class QueryCaseConfigBuilder extends BaseBuilder<QueryCaseConfig, QueryCa
|
|||
ReferenceType::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(ReferenceType._id)) {
|
||||
|
|
|
@ -123,7 +123,7 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity> {
|
|||
ReferenceType::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(ReferenceType._id)) {
|
||||
|
@ -153,7 +153,7 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity> {
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
@ -172,7 +172,7 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity> {
|
|||
|
||||
Map<UUID, List<DmpReference>> itemMap = null;
|
||||
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());
|
||||
|
||||
if (!fields.hasField(this.asIndexer(DmpReference._reference, Reference._id))) {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
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.commons.types.tenantconfiguration.LogoTenantConfigurationEntity;
|
||||
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.tenantconfiguration.LogoTenantConfiguration;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -25,7 +25,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class LogoTenantConfigurationBuilder extends BaseBuilder<LogoTenantConfiguration, LogoTenantConfigurationEntity> {
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class LogoTenantConfigurationBuilder extends BaseBuilder<LogoTenantConfig
|
|||
StorageFile::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(StorageFile._id)) {
|
||||
|
|
|
@ -101,7 +101,7 @@ public class UserCredentialBuilder extends BaseBuilder<UserCredential, UserCrede
|
|||
User::getId);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
if (!fields.hasField(User._id)) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.commons.XmlHandlingService;
|
||||
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.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.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
@ -67,7 +67,7 @@ public class DescriptionPersist {
|
|||
public static final String _hash = "hash";
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
|
@ -75,7 +75,7 @@ public class DescriptionPersist {
|
|||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
return this.label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
|
@ -83,7 +83,7 @@ public class DescriptionPersist {
|
|||
}
|
||||
|
||||
public UUID getDmpId() {
|
||||
return dmpId;
|
||||
return this.dmpId;
|
||||
}
|
||||
|
||||
public void setDmpId(UUID dmpId) {
|
||||
|
@ -91,7 +91,7 @@ public class DescriptionPersist {
|
|||
}
|
||||
|
||||
public UUID getDmpDescriptionTemplateId() {
|
||||
return dmpDescriptionTemplateId;
|
||||
return this.dmpDescriptionTemplateId;
|
||||
}
|
||||
|
||||
public void setDmpDescriptionTemplateId(UUID dmpDescriptionTemplateId) {
|
||||
|
@ -99,7 +99,7 @@ public class DescriptionPersist {
|
|||
}
|
||||
|
||||
public DescriptionStatus getStatus() {
|
||||
return status;
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(DescriptionStatus status) {
|
||||
|
@ -107,7 +107,7 @@ public class DescriptionPersist {
|
|||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
|
@ -115,7 +115,7 @@ public class DescriptionPersist {
|
|||
}
|
||||
|
||||
public PropertyDefinitionPersist getProperties() {
|
||||
return properties;
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
public void setProperties(PropertyDefinitionPersist properties) {
|
||||
|
@ -123,7 +123,7 @@ public class DescriptionPersist {
|
|||
}
|
||||
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
return this.tags;
|
||||
}
|
||||
|
||||
public void setTags(List<String> tags) {
|
||||
|
@ -131,7 +131,7 @@ public class DescriptionPersist {
|
|||
}
|
||||
|
||||
public String getHash() {
|
||||
return hash;
|
||||
return this.hash;
|
||||
}
|
||||
|
||||
public void setHash(String hash) {
|
||||
|
@ -139,7 +139,7 @@ public class DescriptionPersist {
|
|||
}
|
||||
|
||||
public UUID getDescriptionTemplateId() {
|
||||
return descriptionTemplateId;
|
||||
return this.descriptionTemplateId;
|
||||
}
|
||||
|
||||
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
||||
|
@ -193,37 +193,37 @@ public class DescriptionPersist {
|
|||
this.spec()
|
||||
.iff(() -> this.isValidGuid(item.getId()))
|
||||
.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()
|
||||
.iff(() -> !this.isValidGuid(item.getId()))
|
||||
.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()
|
||||
.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()
|
||||
.iff(() -> !this.isEmpty(item.getLabel()))
|
||||
.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()
|
||||
.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()
|
||||
.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()
|
||||
.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()
|
||||
.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()
|
||||
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
|
||||
.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()
|
||||
.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()
|
||||
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
|
||||
.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());
|
||||
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;
|
||||
|
||||
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()) {
|
||||
if (dmpDescriptionTemplateEntity.getSectionId().equals(section.getId()) && section.getHasTemplates() && !this.isListNullOrEmpty(section.getDescriptionTemplates())){
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.commons.XmlHandlingService;
|
||||
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.SystemFieldEntity;
|
||||
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.data.*;
|
||||
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
||||
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.context.MessageSource;
|
||||
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());
|
||||
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<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpIds(dmpId).isActive(IsActive.Active).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).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).dmpIds(dmpId).isActive(IsActive.Active).collect();
|
||||
|
||||
for (SectionEntity section: definition.getSections()) {
|
||||
if (section.getHasTemplates() && !this.isListNullOrEmpty(section.getDescriptionTemplates())){
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
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.commons.enums.DmpBlueprintFieldCategory;
|
||||
import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity;
|
||||
import org.opencdmp.commons.types.dmpblueprint.FieldEntity;
|
||||
import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity;
|
||||
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.errorcode.ErrorThesaurusProperties;
|
||||
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.context.MessageSource;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
@ -138,7 +138,7 @@ public class DmpBlueprintValuePersist {
|
|||
|
||||
private String getReferenceTypeName(FieldEntity fieldEntity){
|
||||
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 "";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
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.commons.enums.ActionConfirmationStatus;
|
||||
import org.opencdmp.commons.enums.ActionConfirmationType;
|
||||
|
@ -7,12 +13,6 @@ import org.opencdmp.commons.enums.IsActive;
|
|||
import org.opencdmp.data.ActionConfirmationEntity;
|
||||
import org.opencdmp.model.actionconfirmation.ActionConfirmation;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -21,7 +21,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class ActionConfirmationQuery extends QueryBase<ActionConfirmationEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -158,6 +158,16 @@ public class ActionConfirmationQuery extends QueryBase<ActionConfirmationEntity>
|
|||
return this;
|
||||
}
|
||||
|
||||
public ActionConfirmationQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ActionConfirmationQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public ActionConfirmationQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||
this.authorize = values;
|
||||
|
@ -185,7 +195,7 @@ public class ActionConfirmationQuery extends QueryBase<ActionConfirmationEntity>
|
|||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
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) {
|
||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ActionConfirmationEntity._id));
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
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.Permission;
|
||||
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.DmpDescriptionTemplateEntity;
|
||||
import org.opencdmp.data.DmpEntity;
|
||||
import org.opencdmp.model.description.Description;
|
||||
import org.opencdmp.model.PublicDescription;
|
||||
import org.opencdmp.model.description.Description;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -26,7 +26,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -211,6 +211,16 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DescriptionQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
return
|
||||
|
@ -240,7 +250,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
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()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
@ -255,8 +265,8 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
List<Predicate> predicates = new ArrayList<>();
|
||||
if (this.like != null && !this.like.isEmpty()) {
|
||||
predicates.add(queryContext.CriteriaBuilder.or(
|
||||
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._description), this.like),
|
||||
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionEntity._label), this.like)
|
||||
));
|
||||
}
|
||||
if (this.ids != null) {
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -22,7 +22,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -126,6 +126,16 @@ public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEnt
|
|||
return this;
|
||||
}
|
||||
|
||||
public DescriptionReferenceQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionReferenceQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
return
|
||||
|
@ -153,7 +163,7 @@ public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEnt
|
|||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
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()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
|
|
@ -1,23 +1,16 @@
|
|||
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.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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -26,7 +19,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionTagQuery extends QueryBase<DescriptionTagEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -121,16 +114,19 @@ public class DescriptionTagQuery extends QueryBase<DescriptionTagEntity> {
|
|||
this.authorize = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionTagQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionTagQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final UserScope userScope;
|
||||
private final AuthorizationService authService;
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
|
||||
public DescriptionTagQuery(
|
||||
UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService) {
|
||||
this.userScope = userScope;
|
||||
this.authService = authService;
|
||||
this.queryUtilsService = queryUtilsService;
|
||||
public DescriptionTagQuery() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
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.Permission;
|
||||
import org.opencdmp.commons.enums.DescriptionTemplateStatus;
|
||||
|
@ -12,14 +20,6 @@ import org.opencdmp.data.DmpEntity;
|
|||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||
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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -28,7 +28,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -212,6 +212,16 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
|
|||
return this;
|
||||
}
|
||||
|
||||
public DescriptionTemplateQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionTemplateQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final UserScope userScope;
|
||||
|
||||
private final AuthorizationService authService;
|
||||
|
@ -250,11 +260,11 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
|
|||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
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)
|
||||
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpDescriptionTemplateEntity._descriptionTemplateGroupId))
|
||||
.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));
|
||||
|
@ -289,8 +299,8 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
|
|||
predicates.add(inClause);
|
||||
}
|
||||
if (this.like != null && !this.like.isEmpty()) {
|
||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._label), this.like),
|
||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._description), this.like)
|
||||
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._label), this.like),
|
||||
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._description), this.like)
|
||||
));
|
||||
}
|
||||
if (this.isActives != null) {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
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.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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateTypeEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -105,6 +105,16 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
|
|||
return this;
|
||||
}
|
||||
|
||||
public DescriptionTemplateTypeQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionTemplateTypeQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
public DescriptionTemplateTypeQuery(
|
||||
QueryUtilsService queryUtilsService) {
|
||||
|
@ -131,7 +141,7 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
|
|||
predicates.add(inClause);
|
||||
}
|
||||
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) {
|
||||
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._isActive));
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -22,7 +22,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpBlueprintQuery extends QueryBase<DmpBlueprintEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -158,6 +158,16 @@ public class DmpBlueprintQuery extends QueryBase<DmpBlueprintEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DmpBlueprintQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DmpBlueprintQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
public DmpBlueprintQuery(
|
||||
AuthorizationService authService, QueryUtilsService queryUtilsService
|
||||
|
@ -194,7 +204,7 @@ public class DmpBlueprintQuery extends QueryBase<DmpBlueprintEntity> {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -25,7 +24,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplateEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -151,6 +150,16 @@ public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplat
|
|||
return this;
|
||||
}
|
||||
|
||||
public DmpDescriptionTemplateQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DmpDescriptionTemplateQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final UserScope userScope;
|
||||
|
||||
private final AuthorizationService authService;
|
||||
|
@ -187,7 +196,7 @@ public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplat
|
|||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
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()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -23,7 +23,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpQuery extends QueryBase<DmpEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -241,6 +241,16 @@ public class DmpQuery extends QueryBase<DmpEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DmpQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DmpQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
|
@ -285,7 +295,7 @@ public class DmpQuery extends QueryBase<DmpEntity> {
|
|||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
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) {
|
||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id));
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -25,7 +25,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpReferenceQuery extends QueryBase<DmpReferenceEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -116,6 +116,16 @@ public class DmpReferenceQuery extends QueryBase<DmpReferenceEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DmpReferenceQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DmpReferenceQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final UserScope userScope;
|
||||
|
||||
private final AuthorizationService authService;
|
||||
|
@ -151,7 +161,7 @@ public class DmpReferenceQuery extends QueryBase<DmpReferenceEntity> {
|
|||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
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()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
import gr.cite.tools.data.query.QueryBase;
|
||||
|
@ -18,6 +8,17 @@ 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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -26,7 +27,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -161,6 +162,16 @@ public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DmpUserQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DmpUserQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final UserScope userScope;
|
||||
|
||||
private final AuthorizationService authService;
|
||||
|
@ -197,8 +208,8 @@ public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
|||
List<Predicate> predicates = new ArrayList<>();
|
||||
if (userId != null || usePublic ) {
|
||||
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
|
||||
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
|
||||
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(this.queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query
|
||||
));
|
||||
}
|
||||
if (!predicates.isEmpty()) {
|
||||
|
@ -235,7 +246,7 @@ public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
|||
else predicates.add(queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(DmpUserEntity._sectionId)));
|
||||
}
|
||||
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)
|
||||
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DescriptionEntity._dmpId))
|
||||
.filterFunc((subQueryRoot, cb) -> {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
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.Permission;
|
||||
import org.opencdmp.commons.enums.EntityType;
|
||||
|
@ -9,13 +16,6 @@ import org.opencdmp.data.DmpEntity;
|
|||
import org.opencdmp.data.EntityDoiEntity;
|
||||
import org.opencdmp.model.EntityDoi;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -24,7 +24,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -160,6 +160,16 @@ public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public EntityDoiQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityDoiQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final UserScope userScope;
|
||||
|
||||
private final AuthorizationService authService;
|
||||
|
@ -198,7 +208,7 @@ public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
|
|||
List<Predicate> predicates = new ArrayList<>();
|
||||
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
|
||||
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()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
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.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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class LanguageQuery extends QueryBase<LanguageEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -104,6 +104,16 @@ public class LanguageQuery extends QueryBase<LanguageEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public LanguageQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LanguageQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
public LanguageQuery(
|
||||
QueryUtilsService queryUtilsService) {
|
||||
|
@ -130,7 +140,7 @@ public class LanguageQuery extends QueryBase<LanguageEntity> {
|
|||
predicates.add(inClause);
|
||||
}
|
||||
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) {
|
||||
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(LanguageEntity._isActive));
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
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.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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class LockQuery extends QueryBase<LockEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -36,7 +36,7 @@ public class LockQuery extends QueryBase<LockEntity> {
|
|||
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
||||
private ConventionService conventionService;
|
||||
private final ConventionService conventionService;
|
||||
|
||||
public LockQuery like(String value) {
|
||||
this.like = value;
|
||||
|
@ -138,6 +138,16 @@ public class LockQuery extends QueryBase<LockEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public LockQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LockQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LockQuery(ConventionService conventionService) {
|
||||
this.conventionService = conventionService;
|
||||
}
|
||||
|
@ -157,7 +167,7 @@ public class LockQuery extends QueryBase<LockEntity> {
|
|||
List<Predicate> predicates = new ArrayList<>();
|
||||
if (this.like != null && !this.like.isEmpty()) {
|
||||
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));
|
||||
inClause.value(UUID.fromString(this.like));
|
||||
predicates.add(inClause);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
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.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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class PrefillingSourceQuery extends QueryBase<PrefillingSourceEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -87,6 +87,16 @@ public class PrefillingSourceQuery extends QueryBase<PrefillingSourceEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public PrefillingSourceQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrefillingSourceQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
public PrefillingSourceQuery(
|
||||
|
@ -114,7 +124,7 @@ public class PrefillingSourceQuery extends QueryBase<PrefillingSourceEntity> {
|
|||
predicates.add(inClause);
|
||||
}
|
||||
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) {
|
||||
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PrefillingSourceEntity._isActive));
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package org.opencdmp.query;
|
||||
|
||||
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.data.QueueInboxEntity;
|
||||
import gr.cite.queueinbox.entity.QueueInboxStatus;
|
||||
import gr.cite.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class QueueInboxQuery extends QueryBase<QueueInboxEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -120,6 +120,16 @@ public class QueueInboxQuery extends QueryBase<QueueInboxEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public QueueInboxQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueueInboxQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<QueueInboxEntity> entityClass() {
|
||||
return QueueInboxEntity.class;
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
package org.opencdmp.query;
|
||||
|
||||
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.data.QueueOutboxEntity;
|
||||
import gr.cite.queueoutbox.entity.QueueOutboxNotifyStatus;
|
||||
import gr.cite.tools.data.query.FieldResolver;
|
||||
import gr.cite.tools.data.query.Ordering;
|
||||
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.commons.enums.IsActive;
|
||||
import org.opencdmp.data.QueueOutboxEntity;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
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.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class QueueOutboxQuery extends QueryBase<QueueOutboxEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -126,6 +126,16 @@ public class QueueOutboxQuery extends QueryBase<QueueOutboxEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public QueueOutboxQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueueOutboxQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<QueueOutboxEntity> entityClass() {
|
||||
return QueueOutboxEntity.class;
|
||||
|
|
|
@ -178,6 +178,16 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ReferenceQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReferenceQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final UserScope userScope;
|
||||
|
||||
private final AuthorizationService authService;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
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.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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class ReferenceTypeQuery extends QueryBase<ReferenceTypeEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -105,6 +105,16 @@ public class ReferenceTypeQuery extends QueryBase<ReferenceTypeEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ReferenceTypeQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReferenceTypeQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
public ReferenceTypeQuery(
|
||||
|
@ -132,8 +142,8 @@ public class ReferenceTypeQuery extends QueryBase<ReferenceTypeEntity> {
|
|||
predicates.add(inClause);
|
||||
}
|
||||
if (this.like != null && !this.like.isEmpty()) {
|
||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._code), this.like),
|
||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._name), this.like)
|
||||
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._code), this.like),
|
||||
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._name), this.like)
|
||||
));
|
||||
}
|
||||
if (this.isActives != null) {
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -22,7 +22,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class StorageFileQuery extends QueryBase<StorageFileEntity> {
|
||||
private String like;
|
||||
private Collection<UUID> ids;
|
||||
|
@ -112,6 +112,16 @@ public class StorageFileQuery extends QueryBase<StorageFileEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public StorageFileQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public StorageFileQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
return
|
||||
|
@ -149,7 +159,7 @@ public class StorageFileQuery extends QueryBase<StorageFileEntity> {
|
|||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
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) {
|
||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(StorageFileEntity._id));
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
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.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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -22,7 +20,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class SupportiveMaterialQuery extends QueryBase<SupportiveMaterialEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -124,6 +122,16 @@ public class SupportiveMaterialQuery extends QueryBase<SupportiveMaterialEntity>
|
|||
return this;
|
||||
}
|
||||
|
||||
public SupportiveMaterialQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SupportiveMaterialQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
public SupportiveMaterialQuery(
|
||||
QueryUtilsService queryUtilsService) {
|
||||
|
@ -150,8 +158,8 @@ public class SupportiveMaterialQuery extends QueryBase<SupportiveMaterialEntity>
|
|||
predicates.add(inClause);
|
||||
}
|
||||
if (this.like != null && !this.like.isEmpty()) {
|
||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._languageCode), this.like),
|
||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._payload), this.like)
|
||||
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._languageCode), this.like),
|
||||
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._payload), this.like)
|
||||
));
|
||||
}
|
||||
if (this.isActives != null) {
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -26,7 +24,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class TagQuery extends QueryBase<TagEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -153,6 +151,16 @@ public class TagQuery extends QueryBase<TagEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public TagQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TagQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
return
|
||||
|
@ -182,12 +190,12 @@ public class TagQuery extends QueryBase<TagEntity> {
|
|||
predicates.add(queryContext.CriteriaBuilder.or(
|
||||
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
|
||||
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)
|
||||
.criteriaBuilder(queryContext.CriteriaBuilder)
|
||||
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DescriptionTagEntity._tagId))
|
||||
.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
|
||||
));
|
||||
|
@ -204,7 +212,7 @@ public class TagQuery extends QueryBase<TagEntity> {
|
|||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
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) {
|
||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(TagEntity._id));
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
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.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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -120,6 +120,16 @@ public class TenantConfigurationQuery extends QueryBase<TenantConfigurationEntit
|
|||
return this;
|
||||
}
|
||||
|
||||
public TenantConfigurationQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TenantConfigurationQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
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;
|
||||
|
||||
|
||||
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.QueryBase;
|
||||
import gr.cite.tools.data.query.QueryContext;
|
||||
import jakarta.persistence.Tuple;
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -22,7 +20,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class TenantQuery extends QueryBase<TenantEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -109,6 +107,16 @@ public class TenantQuery extends QueryBase<TenantEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public TenantQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TenantQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
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()) {
|
||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._code), this.like),
|
||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._name), this.like)
|
||||
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._code), this.like),
|
||||
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._name), this.like)
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,29 +1,28 @@
|
|||
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.Permission;
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.commons.scope.user.UserScope;
|
||||
import org.opencdmp.data.TenantUserEntity;
|
||||
import org.opencdmp.data.UserEntity;
|
||||
import org.opencdmp.model.Tenant;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class TenantUserQuery extends QueryBase<TenantUserEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -113,6 +112,16 @@ public class TenantUserQuery extends QueryBase<TenantUserEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public TenantUserQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TenantUserQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<TenantUserEntity> entityClass() {
|
||||
return TenantUserEntity.class;
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -21,7 +21,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
||||
private Collection<UUID> ids;
|
||||
private Collection<UUID> excludedIds;
|
||||
|
@ -129,6 +129,16 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public UserContactInfoQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserContactInfoQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserContactInfoQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||
this.authorize = values;
|
||||
return this;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
||||
private Collection<UUID> ids;
|
||||
private Collection<UUID> excludedIds;
|
||||
|
@ -96,6 +96,16 @@ public class UserCredentialQuery extends QueryBase<UserCredentialEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public UserCredentialQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserCredentialQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserCredentialQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||
this.authorize = values;
|
||||
return this;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
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.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.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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -19,7 +19,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserDescriptionTemplateQuery extends QueryBase<UserDescriptionTemplateEntity> {
|
||||
|
||||
private Collection<UUID> ids;
|
||||
|
@ -121,6 +121,16 @@ public class UserDescriptionTemplateQuery extends QueryBase<UserDescriptionTempl
|
|||
return this;
|
||||
}
|
||||
|
||||
public UserDescriptionTemplateQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserDescriptionTemplateQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserDescriptionTemplateQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||
this.authorize = values;
|
||||
return this;
|
||||
|
|
|
@ -125,6 +125,16 @@ public class UserQuery extends QueryBase<UserEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public UserQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||
this.authorize = values;
|
||||
return this;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -20,7 +20,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserRoleQuery extends QueryBase<UserRoleEntity> {
|
||||
private Collection<UUID> ids;
|
||||
private Collection<UUID> excludedIds;
|
||||
|
@ -123,6 +123,16 @@ public class UserRoleQuery extends QueryBase<UserRoleEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public UserRoleQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserRoleQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
return
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
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.tools.data.query.FieldResolver;
|
||||
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.criteria.CriteriaBuilder;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -22,7 +22,7 @@ import java.time.Instant;
|
|||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class UserSettingsQuery extends QueryBase<UserSettingsEntity> {
|
||||
|
||||
private String like;
|
||||
|
@ -127,6 +127,16 @@ public class UserSettingsQuery extends QueryBase<UserSettingsEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public UserSettingsQuery enableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserSettingsQuery disableTracking() {
|
||||
this.noTracking = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UserSettingsQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||
this.authorize = values;
|
||||
return this;
|
||||
|
@ -165,8 +175,8 @@ public class UserSettingsQuery extends QueryBase<UserSettingsEntity> {
|
|||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
if (this.like != null && !this.like.isEmpty()) {
|
||||
predicates.add(queryContext.CriteriaBuilder.or(queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._key), this.like),
|
||||
queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._value), this.like)
|
||||
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._key), this.like),
|
||||
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._value), this.like)
|
||||
));
|
||||
}
|
||||
if (this.ids != null) {
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
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.commons.JsonHandlingService;
|
||||
import org.opencdmp.commons.enums.ContactInfoType;
|
||||
import org.opencdmp.commons.enums.notification.NotificationContactType;
|
||||
import org.opencdmp.commons.notification.NotificationProperties;
|
||||
import org.opencdmp.commons.scope.user.UserScope;
|
||||
import org.opencdmp.commons.types.notification.*;
|
||||
import org.opencdmp.commons.notification.NotificationProperties;
|
||||
import org.opencdmp.data.UserContactInfoEntity;
|
||||
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||
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.PublicContactSupportPersist;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -69,26 +69,26 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
|||
|
||||
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));
|
||||
UserContactInfoEntity contactInfo = query.first();
|
||||
|
||||
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);
|
||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setContactHint(this.jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||
|
||||
event.setNotificationType(notificationProperties.getContactSupportType());
|
||||
event.setNotificationType(this.notificationProperties.getContactSupportType());
|
||||
NotificationFieldData data = new NotificationFieldData();
|
||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||
fieldInfoList.add(new FieldInfo("{subject}", DataType.String, model.getSubject()));
|
||||
fieldInfoList.add(new FieldInfo("{description}", DataType.String, model.getDescription()));
|
||||
fieldInfoList.add(new FieldInfo("{email}", DataType.String, contactInfo.getValue()));
|
||||
data.setFields(fieldInfoList);
|
||||
event.setData(jsonHandlingService.toJsonSafe(data));
|
||||
event.setData(this.jsonHandlingService.toJsonSafe(data));
|
||||
|
||||
notifyIntegrationEventHandler.handle(event);
|
||||
this.notifyIntegrationEventHandler.handle(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -99,12 +99,12 @@ public class ContactSupportServiceImpl implements ContactSupportService {
|
|||
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||
|
||||
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);
|
||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setContactHint(this.jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||
|
||||
event.setNotificationType(notificationProperties.getPublicContactSupportType());
|
||||
event.setNotificationType(this.notificationProperties.getPublicContactSupportType());
|
||||
NotificationFieldData data = new NotificationFieldData();
|
||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||
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("{name}", DataType.String, model.getFullName()));
|
||||
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;
|
||||
|
||||
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.OwnedResource;
|
||||
import org.opencdmp.authorization.Permission;
|
||||
|
@ -18,12 +24,6 @@ import org.opencdmp.query.*;
|
|||
import org.opencdmp.query.lookup.DescriptionLookup;
|
||||
import org.opencdmp.query.lookup.DmpLookup;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
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));
|
||||
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();
|
||||
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<>());
|
||||
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
|
||||
for (UUID typeId : this.config.getReferenceTypeCounters()){
|
||||
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
|
||||
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).typeIds(typeId).authorize(EnumSet.of(Public))
|
||||
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).isActives(IsActive.Active)
|
||||
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(EnumSet.of(Public))
|
||||
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).disableTracking().isActives(IsActive.Active)
|
||||
.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);
|
||||
}
|
||||
}
|
||||
|
@ -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())));
|
||||
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.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();
|
||||
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<>());
|
||||
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
|
||||
for (UUID typeId : this.config.getReferenceTypeCounters()){
|
||||
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
|
||||
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).typeIds(typeId).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission)
|
||||
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).isActives(IsActive.Active)
|
||||
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission)
|
||||
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).disableTracking().isActives(IsActive.Active)
|
||||
.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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
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.Permission;
|
||||
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.DepositConfiguration;
|
||||
import org.opencdmp.event.TenantConfigurationTouchedEvent;
|
||||
import org.opencdmp.event.UserAddedToTenantEvent;
|
||||
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||
import org.opencdmp.model.EntityDoi;
|
||||
|
@ -32,30 +43,18 @@ import org.opencdmp.model.StorageFile;
|
|||
import org.opencdmp.model.UserContactInfo;
|
||||
import org.opencdmp.model.builder.commonmodels.DepositConfigurationBuilder;
|
||||
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.deposit.DepositAuthenticateRequest;
|
||||
import org.opencdmp.model.persist.deposit.DepositRequest;
|
||||
import org.opencdmp.model.persist.EntityDoiPersist;
|
||||
import org.opencdmp.model.tenantconfiguration.TenantConfiguration;
|
||||
import org.opencdmp.query.*;
|
||||
import org.opencdmp.service.encryption.EncryptionService;
|
||||
import org.opencdmp.service.entitydoi.EntityDoiService;
|
||||
import org.opencdmp.service.filetransformer.FileTransformerService;
|
||||
import org.opencdmp.service.storage.StorageFileProperties;
|
||||
import org.opencdmp.service.storage.StorageFileService;
|
||||
import org.opencdmp.service.filetransformer.FileTransformerService;
|
||||
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.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -75,7 +74,10 @@ import java.security.InvalidAlgorithmParameterException;
|
|||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
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;
|
||||
|
||||
@Service
|
||||
|
@ -160,9 +162,9 @@ public class DepositServiceImpl implements DepositService {
|
|||
String tenantCode = this.tenantScope.isSet() && this.tenantScope.isMultitenant() ? this.tenantScope.getTenantCode() : "";
|
||||
DepositSourcesCacheService.DepositSourceCacheValue cacheValue = this.depositSourcesCacheService.lookup(this.depositSourcesCacheService.buildKey(tenantCode));
|
||||
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()) {
|
||||
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);
|
||||
else tenantConfigurationQuery.tenantIsSet(true).tenantIds(this.tenantScope.getTenant());
|
||||
TenantConfigurationEntity tenantConfiguration = tenantConfigurationQuery.firstAs(new BaseFieldSet().ensure(TenantConfiguration._depositPlugins));
|
||||
|
@ -204,7 +206,7 @@ public class DepositServiceImpl implements DepositService {
|
|||
item.setUrl(source.getUrl());
|
||||
item.setIssuerUrl(source.getIssuerUrl());
|
||||
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.setRdaTransformerId(source.getRdaTransformerId());
|
||||
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));
|
||||
if (cacheValue == null){
|
||||
try {
|
||||
DepositClient depositClient = getDepositClient(depositSource.getRepositoryId());
|
||||
if (depositClient == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{depositSource.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
DepositClient depositClient = this.getDepositClient(depositSource.getRepositoryId());
|
||||
if (depositClient == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{depositSource.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
DepositConfiguration configuration = depositClient.getConfiguration();
|
||||
cacheValue = new DepositConfigurationCacheService.DepositConfigurationCacheValue(depositSource.getRepositoryId(), tenantCode, configuration);
|
||||
|
@ -257,17 +259,17 @@ public class DepositServiceImpl implements DepositService {
|
|||
public EntityDoi deposit(DepositRequest dmpDepositModel) throws Exception {
|
||||
this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(dmpDepositModel.getDmpId())), Permission.DepositDmp);
|
||||
//GK: First get the right client
|
||||
DepositClient depositClient = getDepositClient(dmpDepositModel.getRepositoryId());
|
||||
if (depositClient == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
DepositClient depositClient = this.getDepositClient(dmpDepositModel.getRepositoryId());
|
||||
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
|
||||
DmpEntity dmpEntity = this.queryFactory.query(DmpQuery.class).ids(dmpDepositModel.getDmpId()).first();
|
||||
if (dmpEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getDmpId(), DmpEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
DmpEntity dmpEntity = this.queryFactory.query(DmpQuery.class).disableTracking().ids(dmpDepositModel.getDmpId()).first();
|
||||
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
|
||||
//TODO: Properly create required files
|
||||
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 rda = this.fileTransformerService.exportDmp(dmpEntity.getId(), source.getRdaTransformerId(),"json");
|
||||
|
@ -302,16 +304,16 @@ public class DepositServiceImpl implements DepositService {
|
|||
doiPersist.setDoi(doi);
|
||||
doiPersist.setEntityId(dmpEntity.getId());
|
||||
this.sendNotification(dmpEntity);
|
||||
return doiService.persist(doiPersist, dmpDepositModel.getProject());
|
||||
return this.doiService.persist(doiPersist, dmpDepositModel.getProject());
|
||||
}
|
||||
|
||||
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)){
|
||||
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) {
|
||||
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 {
|
||||
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
|
||||
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));
|
||||
|
||||
List<ContactPair> contactPairs = new ArrayList<>();
|
||||
contactPairs.add(new ContactPair(ContactInfoType.Email, query.first().getValue()));
|
||||
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setNotificationType(notificationProperties.getDmpDepositType());
|
||||
event.setContactHint(this.jsonHandlingService.toJsonSafe(contactData));
|
||||
event.setNotificationType(this.notificationProperties.getDmpDepositType());
|
||||
NotificationFieldData data = new NotificationFieldData();
|
||||
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||
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("{id}", DataType.String, dmp.getId().toString()));
|
||||
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 {
|
||||
|
@ -360,8 +362,8 @@ public class DepositServiceImpl implements DepositService {
|
|||
public String getLogo(String repositoryId) throws InvalidApplicationException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {
|
||||
this.authorizationService.authorizeForce(Permission.BrowseDeposit, Permission.DeferredAffiliation);
|
||||
|
||||
DepositClient depositClient = getDepositClient(repositoryId);
|
||||
if (depositClient == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{repositoryId, DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
DepositClient depositClient = this.getDepositClient(repositoryId);
|
||||
if (depositClient == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{repositoryId, DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
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 {
|
||||
this.authorizationService.authorizeForce(Permission.BrowseDeposit, Permission.DeferredAffiliation);
|
||||
|
||||
DepositClient depositClient = getDepositClient(model.getRepositoryId());
|
||||
if (depositClient == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
DepositClient depositClient = this.getDepositClient(model.getRepositoryId());
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -3,17 +3,9 @@
|
|||
//import jakarta.persistence.PersistenceException;
|
||||
//import org.hibernate.FlushMode;
|
||||
//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.HibernateJpaVendorAdapter;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import javax.sql.DataSource;
|
||||
//import java.sql.SQLException;
|
||||
//
|
||||
//@Service
|
||||
//public class MyHibernateJpaDialect extends HibernateJpaDialect {
|
||||
// @Override
|
||||
|
|
|
@ -19,11 +19,13 @@ import org.opencdmp.commons.enums.DmpStatus;
|
|||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.convention.ConventionService;
|
||||
import org.opencdmp.data.StorageFileEntity;
|
||||
import org.opencdmp.model.*;
|
||||
import org.opencdmp.model.builder.descriptionproperties.DescriptionBuilder;
|
||||
import org.opencdmp.model.DescriptionValidationResult;
|
||||
import org.opencdmp.model.PublicDescription;
|
||||
import org.opencdmp.model.StorageFile;
|
||||
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.description.DescriptionCensor;
|
||||
import org.opencdmp.model.description.Description;
|
||||
import org.opencdmp.model.dmpblueprint.DmpBlueprint;
|
||||
import org.opencdmp.model.persist.*;
|
||||
|
@ -122,7 +124,7 @@ public class DescriptionController {
|
|||
|
||||
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));
|
||||
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);
|
||||
|
||||
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));
|
||||
if (model == null)
|
||||
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.authorization.AuthorizationFlags;
|
||||
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.censorship.descriptiontemplate.DescriptionTemplateCensor;
|
||||
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.NewVersionDescriptionTemplatePersist;
|
||||
import org.opencdmp.model.result.QueryResult;
|
||||
|
@ -106,7 +106,7 @@ public class DescriptionTemplateController {
|
|||
|
||||
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));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
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.data.builder.BuilderFactory;
|
||||
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.MapLogEntry;
|
||||
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.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
@ -86,10 +86,10 @@ public class DescriptionTemplateTypeController {
|
|||
|
||||
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));
|
||||
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(
|
||||
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
package org.opencdmp.controllers;
|
||||
|
||||
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.data.builder.BuilderFactory;
|
||||
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.logging.LoggerService;
|
||||
import gr.cite.tools.logging.MapLogEntry;
|
||||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||
import jakarta.transaction.Transactional;
|
||||
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.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
@ -98,10 +98,10 @@ public class DmpBlueprintController {
|
|||
|
||||
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));
|
||||
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(
|
||||
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||
|
@ -169,7 +169,7 @@ public class DmpBlueprintController {
|
|||
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 {
|
||||
logger.debug(new MapLogEntry("export" + DmpBlueprint.class.getSimpleName()).And("id", id));
|
||||
|
||||
|
@ -181,7 +181,7 @@ public class DmpBlueprintController {
|
|||
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 {
|
||||
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);
|
||||
|
||||
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));
|
||||
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);
|
||||
|
||||
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));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
|
|
@ -1,19 +1,5 @@
|
|||
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.data.builder.BuilderFactory;
|
||||
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.logging.LoggerService;
|
||||
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.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
@ -88,10 +87,10 @@ public class EntityDoiController {
|
|||
|
||||
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));
|
||||
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(
|
||||
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