rename dmp

This commit is contained in:
amentis 2024-07-05 13:20:01 +03:00
parent 52f93e3aa7
commit 9f3a029b19
158 changed files with 784 additions and 789 deletions

View File

@ -3,7 +3,7 @@ package org.opencdmp.authorization;
import java.util.EnumSet;
public enum AuthorizationFlags {
None, Permission, DmpAssociated, Public, Owner, DescriptionTemplateAssociated;
public static final EnumSet<AuthorizationFlags> AllExceptPublic = EnumSet.of(DmpAssociated, Permission, Owner, DescriptionTemplateAssociated);
public static final EnumSet<AuthorizationFlags> All = EnumSet.of(DmpAssociated, Permission, Owner, Public);
None, Permission, PlanAssociated, Public, Owner, DescriptionTemplateAssociated;
public static final EnumSet<AuthorizationFlags> AllExceptPublic = EnumSet.of(PlanAssociated, Permission, Owner, DescriptionTemplateAssociated);
public static final EnumSet<AuthorizationFlags> All = EnumSet.of(PlanAssociated, Permission, Owner, Public);
}

View File

@ -7,9 +7,9 @@ public final class Permission {
//Public
public static String PublicBrowseDescription = "PublicBrowseDescription";
public static String PublicBrowseDescriptionTemplate = "PublicBrowseDescriptionTemplate";
public static String PublicBrowseDmp = "PublicBrowseDmp";
public static String PublicBrowseDmpReference = "PublicBrowseDmpReference";
public static String PublicBrowseDmpUser = "PublicBrowseDmpUser";
public static String PublicBrowsePlan = "PublicBrowsePlan";
public static String PublicBrowsePlanReference = "PublicBrowsePlanReference";
public static String PublicBrowsePlanUser = "PublicBrowsePlanUser";
public static String PublicBrowseReference = "PublicBrowseReference";
public static String PublicBrowseUser = "PublicBrowseUser";
public static String PublicBrowseDashboardStatistics = "PublicBrowseDashboardStatistics";
@ -223,7 +223,7 @@ public final class Permission {
public static String ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage";
public static String ViewPlanBlueprintPage = "ViewPlanBlueprintPage";
public static String ViewPublicDescriptionPage = "ViewPublicDescriptionPage";
public static String ViewPublicDmpPage = "ViewPublicDmpPage";
public static String ViewPublicPlanPage = "ViewPublicPlanPage";
public static String ViewMyDescriptionPage = "ViewMyDescriptionPage";
public static String ViewMyPlanPage = "ViewMyPlanPage";
public static String ViewHomePage = "ViewHomePage";

View File

@ -67,10 +67,10 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
List<UUID> idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, PlanEntity.class.getSimpleName());
if (idsToResolve.isEmpty()) return affiliatedResources;
List<PlanUserEntity> dmpUsers;
List<PlanUserEntity> planUsers;
try {
this.tenantEntityManager.loadExplictTenantFilters();
dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(ids).sectionIsEmpty(true).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._plan));
planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(ids).sectionIsEmpty(true).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._plan));
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
@ -82,8 +82,8 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
throw new MyApplicationException(e.getMessage());
}
}
for (PlanUserEntity dmpUser : dmpUsers){
affiliatedResources.get(dmpUser.getPlanId()).getPlanUserRoles().add(dmpUser.getRole());
for (PlanUserEntity planUser : planUsers){
affiliatedResources.get(planUser.getPlanId()).getPlanUserRoles().add(planUser.getRole());
}
this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, PlanEntity.class.getSimpleName());
@ -123,8 +123,8 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
}
}
for (UserDescriptionTemplateEntity dmpUser : userDescriptionTemplates){
affiliatedResources.get(dmpUser.getDescriptionTemplateId()).getUserDescriptionTemplateRoles().add(dmpUser.getRole());
for (UserDescriptionTemplateEntity planUser : userDescriptionTemplates){
affiliatedResources.get(planUser.getDescriptionTemplateId()).getUserDescriptionTemplateRoles().add(planUser.getRole());
}
this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, DescriptionTemplateEntity.class.getSimpleName());
@ -199,13 +199,13 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
Map<UUID, List<PlanUserEntity>> planUsersMap = planUsers.stream().collect(Collectors.groupingBy(PlanUserEntity::getPlanId));
for (DescriptionEntity description : descriptionEntities){
List<PlanUserEntity> dmpDescriptionUsers = planUsersMap.getOrDefault(description.getPlanId(), new ArrayList<>());
for (PlanUserEntity dmpUser : dmpDescriptionUsers) {
if (dmpUser.getSectionId() == null) affiliatedResources.get(description.getId()).getPlanUserRoles().add(dmpUser.getRole());
List<PlanUserEntity> planDescriptionUsers = planUsersMap.getOrDefault(description.getPlanId(), new ArrayList<>());
for (PlanUserEntity planUser : planDescriptionUsers) {
if (planUser.getSectionId() == null) affiliatedResources.get(description.getId()).getPlanUserRoles().add(planUser.getRole());
else {
PlanDescriptionTemplateEntity planDescriptionTemplateEntity = planDescriptionTemplateEntityMap.getOrDefault(description.getPlanDescriptionTemplateId(), null);
if (planDescriptionTemplateEntity != null && dmpUser.getSectionId().equals(planDescriptionTemplateEntity.getSectionId())){
affiliatedResources.get(description.getId()).getPlanUserRoles().add(dmpUser.getRole());
if (planDescriptionTemplateEntity != null && planUser.getSectionId().equals(planDescriptionTemplateEntity.getSectionId())){
affiliatedResources.get(description.getId()).getPlanUserRoles().add(planUser.getRole());
}
}
}
@ -230,10 +230,10 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
if (userId == null || !this.userScope.isSet()) return affiliatedResources;
List<PlanUserEntity> dmpUsers;
List<PlanUserEntity> planUsers;
try {
this.tenantEntityManager.loadExplictTenantFilters();
dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planId).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._sectionId).ensure(PlanUser._plan));
planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planId).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._sectionId).ensure(PlanUser._plan));
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
@ -247,12 +247,12 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
}
for (UUID sectionId : sectionIds.stream().distinct().toList()){
List<PlanUserEntity> dmpSectionUsers = dmpUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList();
for (PlanUserEntity dmpUser : dmpSectionUsers) {
if (dmpUser.getSectionId() == null) affiliatedResources.get(sectionId).getPlanUserRoles().add(dmpUser.getRole());
List<PlanUserEntity> planSectionUsers = planUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList();
for (PlanUserEntity planUser : planSectionUsers) {
if (planUser.getSectionId() == null) affiliatedResources.get(sectionId).getPlanUserRoles().add(planUser.getRole());
else {
if (dmpUser.getSectionId().equals(sectionId)){
affiliatedResources.get(sectionId).getPlanUserRoles().add(dmpUser.getRole());
if (planUser.getSectionId().equals(sectionId)){
affiliatedResources.get(sectionId).getPlanUserRoles().add(planUser.getRole());
}
}
}

View File

@ -7,7 +7,7 @@ import java.util.Map;
public enum EntityType implements DatabaseEnum<Short> {
DMP((short) 0);
Plan((short) 0);
private final Short value;

View File

@ -9,7 +9,7 @@ public enum FieldType implements DatabaseEnum<String> {
SELECT(Names.Select),
BOOLEAN_DECISION(Names.BooleanDecision),
RADIO_BOX(Names.RadioBox),
INTERNAL_ENTRIES_DMPS(Names.InternalEntitiesDmps),
INTERNAL_ENTRIES_PLANS(Names.InternalEntitiesPlans),
INTERNAL_ENTRIES_DESCRIPTIONS(Names.InternalEntitiesDescriptions),
CHECK_BOX(Names.CheckBox),
FREE_TEXT(Names.FreeText),
@ -27,7 +27,7 @@ public enum FieldType implements DatabaseEnum<String> {
public static final String Select = "select";
public static final String BooleanDecision = "booleanDecision";
public static final String RadioBox = "radiobox";
public static final String InternalEntitiesDmps = "internalEntitiesDmps";
public static final String InternalEntitiesPlans = "internalEntitiesPlans";
public static final String InternalEntitiesDescriptions = "internalEntitiesDescriptions";
public static final String CheckBox = "checkBox";
public static final String FreeText = "freetext";
@ -68,7 +68,7 @@ public enum FieldType implements DatabaseEnum<String> {
}
public static boolean isTextListType(FieldType fieldType){
return fieldType.equals(FieldType.SELECT) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DMPS) ||
return fieldType.equals(FieldType.SELECT) || fieldType.equals(FieldType.INTERNAL_ENTRIES_PLANS) ||
fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS);
}

View File

@ -6,9 +6,9 @@ import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum LockTargetType implements DatabaseEnum<Short> {
Dmp((short) 0),
Plan((short) 0),
Description((short) 1),
DmpBlueprint((short) 2),
PlanBlueprint((short) 2),
DescriptionTemplate((short) 3);
private final Short value;

View File

@ -7,10 +7,10 @@ import java.util.UUID;
@ConfigurationProperties(prefix = "notification")
public class NotificationProperties {
private UUID dmpInvitationExternalUserType;
private UUID dmpInvitationExistingUserType;
private UUID dmpModifiedType;
private UUID dmpFinalisedType;
private UUID planInvitationExternalUserType;
private UUID planInvitationExistingUserType;
private UUID planModifiedType;
private UUID planFinalisedType;
private UUID descriptionCreatedType;
private UUID descriptionModifiedType;
private UUID descriptionFinalisedType;
@ -18,7 +18,7 @@ public class NotificationProperties {
private UUID descriptionAnnotationStatusChanged;
private UUID mergeAccountConfirmationType;
private UUID removeCredentialConfirmationType;
private UUID dmpDepositType;
private UUID planDepositType;
private UUID descriptionTemplateInvitationType;
private UUID contactSupportType;
private UUID publicContactSupportType;
@ -27,36 +27,36 @@ public class NotificationProperties {
private int emailExpirationTimeSeconds;
private String contactSupportEmail;
public UUID getDmpInvitationExternalUserType() {
return this.dmpInvitationExternalUserType;
public UUID getPlanInvitationExternalUserType() {
return this.planInvitationExternalUserType;
}
public void setDmpInvitationExternalUserType(UUID dmpInvitationExternalUserType) {
this.dmpInvitationExternalUserType = dmpInvitationExternalUserType;
public void setPlanInvitationExternalUserType(UUID planInvitationExternalUserType) {
this.planInvitationExternalUserType = planInvitationExternalUserType;
}
public UUID getDmpInvitationExistingUserType() {
return this.dmpInvitationExistingUserType;
public UUID getPlanInvitationExistingUserType() {
return this.planInvitationExistingUserType;
}
public void setDmpInvitationExistingUserType(UUID dmpInvitationExistingUserType) {
this.dmpInvitationExistingUserType = dmpInvitationExistingUserType;
public void setPlanInvitationExistingUserType(UUID planInvitationExistingUserType) {
this.planInvitationExistingUserType = planInvitationExistingUserType;
}
public UUID getDmpModifiedType() {
return this.dmpModifiedType;
public UUID getPlanModifiedType() {
return this.planModifiedType;
}
public void setDmpModifiedType(UUID dmpModifiedType) {
this.dmpModifiedType = dmpModifiedType;
public void setPlanModifiedType(UUID planModifiedType) {
this.planModifiedType = planModifiedType;
}
public UUID getDmpFinalisedType() {
return this.dmpFinalisedType;
public UUID getPlanFinalisedType() {
return this.planFinalisedType;
}
public void setDmpFinalisedType(UUID dmpFinalisedType) {
this.dmpFinalisedType = dmpFinalisedType;
public void setPlanFinalisedType(UUID planFinalisedType) {
this.planFinalisedType = planFinalisedType;
}
public UUID getDescriptionCreatedType() {
@ -99,12 +99,12 @@ public class NotificationProperties {
this.removeCredentialConfirmationType = removeCredentialConfirmationType;
}
public UUID getDmpDepositType() {
return this.dmpDepositType;
public UUID getPlanDepositType() {
return this.planDepositType;
}
public void setDmpDepositType(UUID dmpDepositType) {
this.dmpDepositType = dmpDepositType;
public void setPlanDepositType(UUID planDepositType) {
this.planDepositType = planDepositType;
}
public UUID getDescriptionTemplateInvitationType() {

View File

@ -5,17 +5,17 @@ import jakarta.xml.bind.annotation.*;
import java.util.UUID;
@XmlRootElement(name = "dmp-invitation")
@XmlRootElement(name = "plan-invitation")
@XmlAccessorType(XmlAccessType.FIELD)
public class PlanInvitationEntity {
@XmlAttribute(name = "email")
private String email;
@XmlAttribute(name = "dmp")
@XmlAttribute(name = "plan")
private UUID planId;
@XmlAttribute(name = "dmp-role")
@XmlAttribute(name = "plan-role")
private PlanUserRole role;
public String getEmail() {

View File

@ -11,7 +11,7 @@ import java.time.Instant;
import java.util.List;
import java.util.UUID;
@XmlRootElement(name = "dmp")
@XmlRootElement(name = "plan")
@XmlAccessorType(XmlAccessType.FIELD)
public class PlanImportExport {

View File

@ -49,9 +49,9 @@ public class DescriptionElasticEntity {
private NestedDescriptionTemplateElasticEntity descriptionTemplate;
public final static String _descriptionTemplate = "descriptionTemplate";
@Field(value = DescriptionElasticEntity._dmp, type = FieldType.Object)
private NestedPlanElasticEntity dmp;
public final static String _dmp = "dmp";
@Field(value = DescriptionElasticEntity._plan, type = FieldType.Object)
private NestedPlanElasticEntity plan;
public final static String _plan = "plan";
@Field(value = DescriptionElasticEntity._references, type = FieldType.Nested)
private List<NestedReferenceElasticEntity> references;
@ -129,12 +129,12 @@ public class DescriptionElasticEntity {
this.descriptionTemplate = descriptionTemplate;
}
public NestedPlanElasticEntity getDmp() {
return this.dmp;
public NestedPlanElasticEntity getPlan() {
return this.plan;
}
public void setDmp(NestedPlanElasticEntity dmp) {
this.dmp = dmp;
public void setPlan(NestedPlanElasticEntity plan) {
this.plan = plan;
}
public List<NestedReferenceElasticEntity> getReferences() {

View File

@ -12,7 +12,7 @@ import java.util.Date;
import java.util.List;
import java.util.UUID;
@Document(indexName = "dmp")
@Document(indexName = "plan")
public class PlanElasticEntity {
@Id
@Field(value = PlanElasticEntity._id, type = FieldType.Keyword)
@ -74,9 +74,9 @@ public class PlanElasticEntity {
private List<NestedDescriptionElasticEntity> descriptions;
public final static String _descriptions = "descriptions";
@Field(value = PlanElasticEntity._dmpDescriptionTemplates, type = FieldType.Nested)
@Field(value = PlanElasticEntity._planDescriptionTemplates, type = FieldType.Nested)
private List<NestedPlanDescriptionTemplateElasticEntity> planDescriptionTemplates;
public final static String _dmpDescriptionTemplates = "dmpDescriptionTemplates";
public final static String _planDescriptionTemplates = "planDescriptionTemplates";
@Field(value = PlanElasticEntity._dois, type = FieldType.Nested)
private List<NestedDoiElasticEntity> dois;

View File

@ -20,9 +20,9 @@ public class NestedDescriptionElasticEntity {
private UUID id;
public final static String _id = "id";
@Field(value = NestedDescriptionElasticEntity._dmpId, type = FieldType.Keyword)
@Field(value = NestedDescriptionElasticEntity._planId, type = FieldType.Keyword)
private UUID planId;
public final static String _dmpId = "dmpId";
public final static String _planId = "planId";
@MultiField(mainField = @Field(value = NestedDescriptionElasticEntity._label, type = FieldType.Text), otherFields = @InnerField(suffix = ElasticConstants.SubFields.keyword, type = FieldType.Keyword))
private String label;

View File

@ -13,9 +13,9 @@ public class NestedPlanDescriptionTemplateElasticEntity {
private UUID id;
public final static String _id = "id";
@Field(value = NestedDescriptionElasticEntity._dmpId, type = FieldType.Keyword)
@Field(value = NestedDescriptionElasticEntity._planId, type = FieldType.Keyword)
private UUID planId;
public final static String _dmpId = "dmpId";
public final static String _planId = "planId";
@Field(value = NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId, type = FieldType.Keyword)
private UUID descriptionTemplateGroupId;

View File

@ -74,7 +74,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
}
if (referenceElasticEntityMap != null) m.setReferences(referenceElasticEntityMap.getOrDefault(d.getId(), null));
if (tagElasticEntityMap != null) m.setTags(tagElasticEntityMap.getOrDefault(d.getId(), null));
if (planElasticEntityMap != null) m.setDmp(planElasticEntityMap.getOrDefault(d.getPlanId(), null));
if (planElasticEntityMap != null) m.setPlan(planElasticEntityMap.getOrDefault(d.getPlanId(), null));
if (descriptionTemplateElasticEntityMap != null) m.setDescriptionTemplate(descriptionTemplateElasticEntityMap.getOrDefault(d.getPlanId(), null));
models.add(m);
}

View File

@ -106,7 +106,7 @@ public class PlanElasticBuilder extends BaseElasticBuilder<PlanElasticEntity, Pl
this.logger.debug("checking related - {}", DescriptionEntity.class.getSimpleName());
Map<UUID, List<NestedDescriptionElasticEntity>> itemMap;
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(this.queryFactory.query(PlanQuery.class).ids(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())));
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(this.queryFactory.query(PlanQuery.class).ids(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())));
itemMap = this.builderFactory.builder(NestedDescriptionElasticBuilder.class).asMasterKey(q, NestedDescriptionElasticEntity::getPlanId);
return itemMap;

View File

@ -43,7 +43,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
private Collection<UUID> ids;
private String like;
private InnerObjectDmpElasticQuery planSubQuery;
private InnerObjectPlanElasticQuery planSubQuery;
private Instant createdAfter;
private Instant createdBefore;
private Instant finalizedAfter;
@ -72,7 +72,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
return this;
}
public DescriptionElasticQuery planSubQuery(InnerObjectDmpElasticQuery subQuery) {
public DescriptionElasticQuery planSubQuery(InnerObjectPlanElasticQuery subQuery) {
this.planSubQuery = subQuery;
return this;
}
@ -191,17 +191,17 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDescription)) return this.applyTenant(null);
UUID userId = null;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe();
List<Query> predicates = new ArrayList<>();
if (usePublic ) {
predicates.add(this.and(
this.equals(new ElasticField(DescriptionElasticEntity._dmp + "." + PlanElasticEntity._status, this.entityClass()).disableInfer(true), PlanStatus.Finalized.getValue()),
this.equals(new ElasticField(DescriptionElasticEntity._dmp + "." + PlanElasticEntity._accessType, this.entityClass()).disableInfer(true), PlanAccessType.Public.getValue())
this.equals(new ElasticField(DescriptionElasticEntity._plan + "." + PlanElasticEntity._status, this.entityClass()).disableInfer(true), PlanStatus.Finalized.getValue()),
this.equals(new ElasticField(DescriptionElasticEntity._plan + "." + PlanElasticEntity._accessType, this.entityClass()).disableInfer(true), PlanAccessType.Public.getValue())
));
}
if (userId != null) {
NestedCollaboratorElasticQuery query = this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DescriptionElasticEntity._dmp + "." + NestedPlanElasticEntity._collaborators);
NestedCollaboratorElasticQuery query = this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DescriptionElasticEntity._plan + "." + NestedPlanElasticEntity._collaborators);
query.userIds(userId);
predicates.add(this.nestedQuery(query).build()._toQuery());
}
@ -230,13 +230,13 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
QueryBuilders.nested().path(DescriptionElasticEntity._references).query(
this.like(elasticFields, List.of(this.like))._toQuery()
).build()._toQuery(),
QueryBuilders.nested().path(DescriptionElasticEntity._dmp + "." + NestedPlanElasticEntity._references).query(
QueryBuilders.nested().path(DescriptionElasticEntity._plan + "." + NestedPlanElasticEntity._references).query(
this.like(elasticFields, List.of(this.like))._toQuery()
).build()._toQuery(),
QueryBuilders.nested().path(DescriptionElasticEntity._dmp + "." + NestedPlanElasticEntity._collaborators).query(
QueryBuilders.nested().path(DescriptionElasticEntity._plan + "." + NestedPlanElasticEntity._collaborators).query(
this.like(elasticFields, List.of(this.like))._toQuery()
).build()._toQuery(),
QueryBuilders.nested().path(DescriptionElasticEntity._dmp + "." + NestedPlanElasticEntity._dois).query(
QueryBuilders.nested().path(DescriptionElasticEntity._plan + "." + NestedPlanElasticEntity._dois).query(
this.like(elasticFields, List.of(this.like))._toQuery()
).build()._toQuery()
)._toQuery());
@ -263,7 +263,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
predicates.add(this.dateLessThanQuery(this.elasticFieldOf(DescriptionElasticEntity._createdAt), this.createdBefore)._toQuery());
}
if (this.planSubQuery != null) {
predicates.add(this.planSubQuery.innerPath(DescriptionElasticEntity._dmp).applyFilters());
predicates.add(this.planSubQuery.innerPath(DescriptionElasticEntity._plan).applyFilters());
}
if (!predicates.isEmpty()) {
return this.and(predicates);
@ -285,7 +285,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
mocDoc.setTags(this.convertNested(rawData, columns, this.queryFactory.query(NestedTagElasticQuery.class), DescriptionElasticEntity._tags, null));
mocDoc.setReferences(this.convertNested(rawData, columns, this.queryFactory.query(NestedReferenceElasticQuery.class), DescriptionElasticEntity._references, null));
mocDoc.setDescriptionTemplate(this.convertInnerObject(rawData, columns, this.queryFactory.query(InnerObjectDescriptionTemplateElasticQuery.class), DescriptionElasticEntity._descriptionTemplate, null));
mocDoc.setDmp(this.convertInnerObject(rawData, columns, this.queryFactory.query(InnerObjectDmpElasticQuery.class), DescriptionElasticEntity._dmp, null));
mocDoc.setPlan(this.convertInnerObject(rawData, columns, this.queryFactory.query(InnerObjectPlanElasticQuery.class), DescriptionElasticEntity._plan, null));
return mocDoc;
}
@ -301,7 +301,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
else if (item.prefix(DescriptionElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(DescriptionElasticEntity._references).fieldNameOf(this.extractPrefixed(item, DescriptionElasticEntity._references));
else if (item.prefix(DescriptionElasticEntity._tags)) return this.queryFactory.query(NestedTagElasticQuery.class).nestedPath(DescriptionElasticEntity._tags).fieldNameOf(this.extractPrefixed(item, DescriptionElasticEntity._tags));
else if (item.prefix(DescriptionElasticEntity._descriptionTemplate)) return this.queryFactory.query(InnerObjectDescriptionTemplateElasticQuery.class).innerPath(DescriptionElasticEntity._descriptionTemplate).fieldNameOf(this.extractPrefixed(item, DescriptionElasticEntity._description));
else if (item.prefix(DescriptionElasticEntity._dmp)) return this.queryFactory.query(InnerObjectDmpElasticQuery.class).innerPath(DescriptionElasticEntity._dmp).fieldNameOf(this.extractPrefixed(item, DescriptionElasticEntity._dmp));
else if (item.prefix(DescriptionElasticEntity._plan)) return this.queryFactory.query(InnerObjectPlanElasticQuery.class).innerPath(DescriptionElasticEntity._plan).fieldNameOf(this.extractPrefixed(item, DescriptionElasticEntity._plan));
else return null;
}

View File

@ -26,7 +26,7 @@ import java.util.stream.Collectors;
@Component
//Like in C# make it Transient
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery<InnerObjectDmpElasticQuery, NestedPlanElasticEntity, UUID> {
public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerObjectPlanElasticQuery, NestedPlanElasticEntity, UUID> {
private String like;
private Collection<UUID> ids;
private Collection<UUID> excludedIds;
@ -35,120 +35,120 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery<InnerObj
private Collection<PlanAccessType> accessTypes;
private Collection<Integer> versions;
private Collection<UUID> groupIds;
private NestedCollaboratorElasticQuery dmpUserSubQuery;
private NestedCollaboratorElasticQuery planUserSubQuery;
public InnerObjectDmpElasticQuery dmpSubQuery(NestedCollaboratorElasticQuery subQuery) {
this.dmpUserSubQuery = subQuery;
public InnerObjectPlanElasticQuery planSubQuery(NestedCollaboratorElasticQuery subQuery) {
this.planUserSubQuery = subQuery;
return this;
}
public InnerObjectDmpElasticQuery like(String value) {
public InnerObjectPlanElasticQuery like(String value) {
this.like = value;
return this;
}
public InnerObjectDmpElasticQuery ids(UUID value) {
public InnerObjectPlanElasticQuery ids(UUID value) {
this.ids = List.of(value);
return this;
}
public InnerObjectDmpElasticQuery ids(UUID... value) {
public InnerObjectPlanElasticQuery ids(UUID... value) {
this.ids = Arrays.asList(value);
return this;
}
public InnerObjectDmpElasticQuery ids(Collection<UUID> values) {
public InnerObjectPlanElasticQuery ids(Collection<UUID> values) {
this.ids = values;
return this;
}
public InnerObjectDmpElasticQuery excludedIds(Collection<UUID> values) {
public InnerObjectPlanElasticQuery excludedIds(Collection<UUID> values) {
this.excludedIds = values;
return this;
}
public InnerObjectDmpElasticQuery excludedIds(UUID value) {
public InnerObjectPlanElasticQuery excludedIds(UUID value) {
this.excludedIds = List.of(value);
return this;
}
public InnerObjectDmpElasticQuery excludedIds(UUID... value) {
public InnerObjectPlanElasticQuery excludedIds(UUID... value) {
this.excludedIds = Arrays.asList(value);
return this;
}
public InnerObjectDmpElasticQuery versionStatuses(PlanVersionStatus value) {
public InnerObjectPlanElasticQuery versionStatuses(PlanVersionStatus value) {
this.versionStatuses = List.of(value);
return this;
}
public InnerObjectDmpElasticQuery versionStatuses(PlanVersionStatus... value) {
public InnerObjectPlanElasticQuery versionStatuses(PlanVersionStatus... value) {
this.versionStatuses = Arrays.asList(value);
return this;
}
public InnerObjectDmpElasticQuery versionStatuses(Collection<PlanVersionStatus> values) {
public InnerObjectPlanElasticQuery versionStatuses(Collection<PlanVersionStatus> values) {
this.versionStatuses = values;
return this;
}
public InnerObjectDmpElasticQuery accessTypes(PlanAccessType value) {
public InnerObjectPlanElasticQuery accessTypes(PlanAccessType value) {
this.accessTypes = List.of(value);
return this;
}
public InnerObjectDmpElasticQuery accessTypes(PlanAccessType... value) {
public InnerObjectPlanElasticQuery accessTypes(PlanAccessType... value) {
this.accessTypes = Arrays.asList(value);
return this;
}
public InnerObjectDmpElasticQuery accessTypes(Collection<PlanAccessType> values) {
public InnerObjectPlanElasticQuery accessTypes(Collection<PlanAccessType> values) {
this.accessTypes = values;
return this;
}
public InnerObjectDmpElasticQuery statuses(PlanStatus value) {
public InnerObjectPlanElasticQuery statuses(PlanStatus value) {
this.statuses = List.of(value);
return this;
}
public InnerObjectDmpElasticQuery statuses(PlanStatus... value) {
public InnerObjectPlanElasticQuery statuses(PlanStatus... value) {
this.statuses = Arrays.asList(value);
return this;
}
public InnerObjectDmpElasticQuery statuses(Collection<PlanStatus> values) {
public InnerObjectPlanElasticQuery statuses(Collection<PlanStatus> values) {
this.statuses = values;
return this;
}
public InnerObjectDmpElasticQuery versions(Integer value) {
public InnerObjectPlanElasticQuery versions(Integer value) {
this.versions = List.of(value);
return this;
}
public InnerObjectDmpElasticQuery versions(Integer... value) {
public InnerObjectPlanElasticQuery versions(Integer... value) {
this.versions = Arrays.asList(value);
return this;
}
public InnerObjectDmpElasticQuery versions(Collection<Integer> values) {
public InnerObjectPlanElasticQuery versions(Collection<Integer> values) {
this.versions = values;
return this;
}
public InnerObjectDmpElasticQuery groupIds(UUID value) {
public InnerObjectPlanElasticQuery groupIds(UUID value) {
this.groupIds = List.of(value);
return this;
}
public InnerObjectDmpElasticQuery groupIds(UUID... value) {
public InnerObjectPlanElasticQuery groupIds(UUID... value) {
this.groupIds = Arrays.asList(value);
return this;
}
public InnerObjectDmpElasticQuery groupIds(Collection<UUID> values) {
public InnerObjectPlanElasticQuery groupIds(Collection<UUID> values) {
this.groupIds = values;
return this;
}
@ -156,7 +156,7 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery<InnerObj
private String innerPath;
@Override
public InnerObjectDmpElasticQuery innerPath(String value) {
public InnerObjectPlanElasticQuery innerPath(String value) {
this.innerPath = value;
return this;
}
@ -164,7 +164,7 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery<InnerObj
private final QueryFactory queryFactory;
@Autowired
public InnerObjectDmpElasticQuery(ElasticsearchTemplate elasticsearchTemplate, ElasticProperties elasticProperties, QueryFactory queryFactory) {
public InnerObjectPlanElasticQuery(ElasticsearchTemplate elasticsearchTemplate, ElasticProperties elasticProperties, QueryFactory queryFactory) {
super(elasticsearchTemplate, elasticProperties);
this.queryFactory = queryFactory;
}
@ -212,8 +212,8 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery<InnerObj
if (this.accessTypes != null) {
predicates.add(this.contains(this.elasticFieldOf(NestedPlanElasticEntity._accessType).disableInfer(true), this.accessTypes.stream().map(x-> x.getValue()).collect(Collectors.toList()).toArray(new Short[this.accessTypes.size()]))._toQuery());
}
if (this.dmpUserSubQuery != null) {
predicates.add(this.nestedQuery( this.dmpUserSubQuery.nestedPath(DescriptionElasticEntity._dmp + "." + NestedPlanElasticEntity._collaborators)).build()._toQuery());
if (this.planUserSubQuery != null) {
predicates.add(this.nestedQuery( this.planUserSubQuery.nestedPath(DescriptionElasticEntity._plan + "." + NestedPlanElasticEntity._collaborators)).build()._toQuery());
}
if (!predicates.isEmpty()) {

View File

@ -83,7 +83,7 @@ public class NestedDescriptionElasticQuery extends ElasticNestedQuery<NestedDesc
NestedDescriptionElasticEntity mocDoc = new NestedDescriptionElasticEntity();
if (columns.contains(NestedDescriptionElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDescriptionElasticEntity._id), UUID.class));
if (columns.contains(NestedDescriptionElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDescriptionElasticEntity._label), String.class));
if (columns.contains(NestedDescriptionElasticEntity._dmpId)) mocDoc.setPlanId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDescriptionElasticEntity._dmpId), UUID.class));
if (columns.contains(NestedDescriptionElasticEntity._planId)) mocDoc.setPlanId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDescriptionElasticEntity._planId), UUID.class));
if (columns.contains(NestedDescriptionElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDescriptionElasticEntity._description), String.class));
if (columns.contains(NestedDescriptionElasticEntity._status)) mocDoc.setStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDescriptionElasticEntity._status), DescriptionStatus.class));
if (columns.contains(NestedDescriptionElasticEntity._finalizedAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDescriptionElasticEntity._finalizedAt), Date.class));
@ -97,7 +97,7 @@ public class NestedDescriptionElasticQuery extends ElasticNestedQuery<NestedDesc
protected ElasticField fieldNameOf(FieldResolver item) {
if (item.match(NestedDescriptionElasticEntity._id)) return this.elasticFieldOf(NestedDescriptionElasticEntity._id);
else if (item.match(NestedDescriptionElasticEntity._label)) return this.elasticFieldOf(NestedDescriptionElasticEntity._label);
else if (item.match(NestedDescriptionElasticEntity._dmpId)) return this.elasticFieldOf(NestedDescriptionElasticEntity._dmpId);
else if (item.match(NestedDescriptionElasticEntity._planId)) return this.elasticFieldOf(NestedDescriptionElasticEntity._planId);
else if (item.match(NestedDescriptionElasticEntity._description)) return this.elasticFieldOf(NestedDescriptionElasticEntity._description);
else if (item.match(NestedDescriptionElasticEntity._status)) return this.elasticFieldOf(NestedDescriptionElasticEntity._status);
else if (item.match(NestedDescriptionElasticEntity._finalizedAt)) return this.elasticFieldOf(NestedDescriptionElasticEntity._finalizedAt);

View File

@ -148,7 +148,7 @@ public class NestedPlanDescriptionTemplateElasticQuery extends ElasticNestedQuer
}
if (this.planIds != null) {
predicates.add(this.containsUUID(this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._dmpId), this.planIds)._toQuery());
predicates.add(this.containsUUID(this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._planId), this.planIds)._toQuery());
}
if (!predicates.isEmpty()) {
@ -164,7 +164,7 @@ public class NestedPlanDescriptionTemplateElasticQuery extends ElasticNestedQuer
if (columns.contains(NestedPlanDescriptionTemplateElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanDescriptionTemplateElasticEntity._id), UUID.class));
if (columns.contains(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId), UUID.class));
if (columns.contains(NestedPlanDescriptionTemplateElasticEntity._sectionId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanDescriptionTemplateElasticEntity._sectionId), UUID.class));
if (columns.contains(NestedPlanDescriptionTemplateElasticEntity._dmpId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanDescriptionTemplateElasticEntity._dmpId), UUID.class));
if (columns.contains(NestedPlanDescriptionTemplateElasticEntity._planId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanDescriptionTemplateElasticEntity._planId), UUID.class));
return mocDoc;
}
@ -173,7 +173,7 @@ public class NestedPlanDescriptionTemplateElasticQuery extends ElasticNestedQuer
if (item.match(NestedPlanDescriptionTemplateElasticEntity._id)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._id).disableInfer(true);
else if (item.match(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId).disableInfer(true);
else if (item.match(NestedPlanDescriptionTemplateElasticEntity._sectionId)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._sectionId).disableInfer(true);
else if (item.match(NestedPlanDescriptionTemplateElasticEntity._dmpId)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._dmpId).disableInfer(true);
else if (item.match(NestedPlanDescriptionTemplateElasticEntity._planId)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._planId).disableInfer(true);
else return null;
}

View File

@ -238,7 +238,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlan)) return this.applyTenant(null);
UUID userId = null;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe();
List<Query> predicates = new ArrayList<>();
if (usePublic) {
@ -319,7 +319,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
predicates.add(this.nestedQuery( this.descriptionSubQuery.nestedPath(PlanElasticEntity._descriptions)).build()._toQuery());
}
if (this.planDescriptionTemplateSubQuery != null) {
predicates.add(this.nestedQuery( this.planDescriptionTemplateSubQuery.nestedPath(PlanElasticEntity._dmpDescriptionTemplates)).build()._toQuery());
predicates.add(this.nestedQuery( this.planDescriptionTemplateSubQuery.nestedPath(PlanElasticEntity._planDescriptionTemplates)).build()._toQuery());
}
if (!predicates.isEmpty()) {
@ -346,7 +346,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
mocDoc.setCollaborators(this.convertNested(rawData, columns, this.queryFactory.query(NestedCollaboratorElasticQuery.class), PlanElasticEntity._collaborators, null));
mocDoc.setReferences(this.convertNested(rawData, columns, this.queryFactory.query(NestedReferenceElasticQuery.class), PlanElasticEntity._references, null));
mocDoc.setDescriptions(this.convertNested(rawData, columns, this.queryFactory.query(NestedDescriptionElasticQuery.class), PlanElasticEntity._descriptions, null));
mocDoc.setPlanDescriptionTemplates(this.convertNested(rawData, columns, this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class), PlanElasticEntity._dmpDescriptionTemplates, null));
mocDoc.setPlanDescriptionTemplates(this.convertNested(rawData, columns, this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class), PlanElasticEntity._planDescriptionTemplates, null));
return mocDoc;
}
@ -366,14 +366,14 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
else if (item.prefix(PlanElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(PlanElasticEntity._collaborators).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._collaborators));
else if (item.prefix(PlanElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(PlanElasticEntity._references).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._references));
else if (item.prefix(PlanElasticEntity._descriptions)) return this.queryFactory.query(NestedDescriptionElasticQuery.class).nestedPath(PlanElasticEntity._descriptions).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._descriptions));
else if (item.prefix(PlanElasticEntity._dmpDescriptionTemplates)) return this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class).nestedPath(PlanElasticEntity._dmpDescriptionTemplates).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._dmpDescriptionTemplates));
else if (item.prefix(PlanElasticEntity._planDescriptionTemplates)) return this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class).nestedPath(PlanElasticEntity._planDescriptionTemplates).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._planDescriptionTemplates));
else return null;
}
@Override
protected String[] getIndex() {
List<String> indexNames = new ArrayList<>();
indexNames.add(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName());
indexNames.add(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName());
try {
this.elasticService.ensureDescriptionIndex();
} catch (IOException e) {
@ -397,7 +397,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
if (item.prefix(PlanElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(PlanElasticEntity._collaborators);
else if (item.prefix(PlanElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(PlanElasticEntity._references);
else if (item.prefix(PlanElasticEntity._descriptions)) return this.queryFactory.query(NestedDescriptionElasticQuery.class).nestedPath(PlanElasticEntity._descriptions);
else if (item.prefix(PlanElasticEntity._dmpDescriptionTemplates)) return this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class).nestedPath(PlanElasticEntity._dmpDescriptionTemplates);
else if (item.prefix(PlanElasticEntity._planDescriptionTemplates)) return this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class).nestedPath(PlanElasticEntity._planDescriptionTemplates);
else return null;
}
}

View File

@ -85,84 +85,84 @@ public class ErrorThesaurusProperties {
this.multipleDescriptionTemplateVersionsNotSupported = multipleDescriptionTemplateVersionsNotSupported;
}
private ErrorDescription dmpNewVersionConflict;
private ErrorDescription planNewVersionConflict;
public ErrorDescription getDmpNewVersionConflict() {
return this.dmpNewVersionConflict;
public ErrorDescription getPlanNewVersionConflict() {
return this.planNewVersionConflict;
}
public void setDmpNewVersionConflict(ErrorDescription dmpNewVersionConflict) {
this.dmpNewVersionConflict = dmpNewVersionConflict;
public void setPlanNewVersionConflict(ErrorDescription planNewVersionConflict) {
this.planNewVersionConflict = planNewVersionConflict;
}
private ErrorDescription dmpIsNotFinalized;
private ErrorDescription planIsNotFinalized;
public ErrorDescription getDmpIsNotFinalized() {
return this.dmpIsNotFinalized;
public ErrorDescription getPlanIsNotFinalized() {
return this.planIsNotFinalized;
}
public void setDmpIsNotFinalized(ErrorDescription dmpIsNotFinalized) {
this.dmpIsNotFinalized = dmpIsNotFinalized;
public void setPlanIsNotFinalized(ErrorDescription planIsNotFinalized) {
this.planIsNotFinalized = planIsNotFinalized;
}
private ErrorDescription multipleDmpVersionsNotSupported;
private ErrorDescription multiplePlanVersionsNotSupported;
public ErrorDescription getMultipleDmpVersionsNotSupported() {
return this.multipleDmpVersionsNotSupported;
public ErrorDescription getMultiplePlanVersionsNotSupported() {
return this.multiplePlanVersionsNotSupported;
}
public void setMultipleDmpVersionsNotSupported(ErrorDescription multipleDmpVersionsNotSupported) {
this.multipleDmpVersionsNotSupported = multipleDmpVersionsNotSupported;
public void setMultiplePlanVersionsNotSupported(ErrorDescription multiplePlanVersionsNotSupported) {
this.multiplePlanVersionsNotSupported = multiplePlanVersionsNotSupported;
}
public ErrorDescription dmpBlueprintNewVersionConflict;
public ErrorDescription planBlueprintNewVersionConflict;
public ErrorDescription getDmpBlueprintNewVersionConflict() {
return this.dmpBlueprintNewVersionConflict;
public ErrorDescription getPlanBlueprintNewVersionConflict() {
return this.planBlueprintNewVersionConflict;
}
public void setDmpBlueprintNewVersionConflict(ErrorDescription dmpBlueprintNewVersionConflict) {
this.dmpBlueprintNewVersionConflict = dmpBlueprintNewVersionConflict;
public void setPlanBlueprintNewVersionConflict(ErrorDescription planBlueprintNewVersionConflict) {
this.planBlueprintNewVersionConflict = planBlueprintNewVersionConflict;
}
private ErrorDescription dmpBlueprintNewVersionAlreadyCreatedDraft;
private ErrorDescription planBlueprintNewVersionAlreadyCreatedDraft;
public ErrorDescription getDmpBlueprintNewVersionAlreadyCreatedDraft() {
return this.dmpBlueprintNewVersionAlreadyCreatedDraft;
public ErrorDescription getPlanBlueprintNewVersionAlreadyCreatedDraft() {
return this.planBlueprintNewVersionAlreadyCreatedDraft;
}
public void setDmpBlueprintNewVersionAlreadyCreatedDraft(ErrorDescription dmpBlueprintNewVersionAlreadyCreatedDraft) {
this.dmpBlueprintNewVersionAlreadyCreatedDraft = dmpBlueprintNewVersionAlreadyCreatedDraft;
public void setPlanBlueprintNewVersionAlreadyCreatedDraft(ErrorDescription planBlueprintNewVersionAlreadyCreatedDraft) {
this.planBlueprintNewVersionAlreadyCreatedDraft = planBlueprintNewVersionAlreadyCreatedDraft;
}
private ErrorDescription dmpIsFinalized;
private ErrorDescription planIsFinalized;
public ErrorDescription getDmpIsFinalized() {
return this.dmpIsFinalized;
public ErrorDescription getPlanIsFinalized() {
return this.planIsFinalized;
}
public void setDmpIsFinalized(ErrorDescription dmpIsFinalized) {
this.dmpIsFinalized = dmpIsFinalized;
public void setPlanIsFinalized(ErrorDescription planIsFinalized) {
this.planIsFinalized = planIsFinalized;
}
private ErrorDescription dmpCanNotChange;
private ErrorDescription planCanNotChange;
public ErrorDescription getDmpCanNotChange() {
return this.dmpCanNotChange;
public ErrorDescription getPlanCanNotChange() {
return this.planCanNotChange;
}
public void setDmpCanNotChange(ErrorDescription dmpCanNotChange) {
this.dmpCanNotChange = dmpCanNotChange;
public void setPlanCanNotChange(ErrorDescription planCanNotChange) {
this.planCanNotChange = planCanNotChange;
}
private ErrorDescription dmpDescriptionTemplateCanNotChange;
private ErrorDescription planDescriptionTemplateCanNotChange;
public ErrorDescription getDmpDescriptionTemplateCanNotChange() {
return this.dmpDescriptionTemplateCanNotChange;
public ErrorDescription getPlanDescriptionTemplateCanNotChange() {
return this.planDescriptionTemplateCanNotChange;
}
public void setDmpDescriptionTemplateCanNotChange(ErrorDescription dmpDescriptionTemplateCanNotChange) {
this.dmpDescriptionTemplateCanNotChange = dmpDescriptionTemplateCanNotChange;
public void setPlanDescriptionTemplateCanNotChange(ErrorDescription planDescriptionTemplateCanNotChange) {
this.planDescriptionTemplateCanNotChange = planDescriptionTemplateCanNotChange;
}
private ErrorDescription invalidDescriptionTemplate;
@ -185,24 +185,24 @@ public class ErrorThesaurusProperties {
this.descriptionIsFinalized = descriptionIsFinalized;
}
private ErrorDescription dmpBlueprintHasNoDescriptionTemplates;
private ErrorDescription planBlueprintHasNoDescriptionTemplates;
public ErrorDescription getDmpBlueprintHasNoDescriptionTemplates() {
return this.dmpBlueprintHasNoDescriptionTemplates;
public ErrorDescription getPlanBlueprintHasNoDescriptionTemplates() {
return this.planBlueprintHasNoDescriptionTemplates;
}
public void setDmpBlueprintHasNoDescriptionTemplates(ErrorDescription dmpBlueprintHasNoDescriptionTemplates) {
this.dmpBlueprintHasNoDescriptionTemplates = dmpBlueprintHasNoDescriptionTemplates;
public void setPlanBlueprintHasNoDescriptionTemplates(ErrorDescription planBlueprintHasNoDescriptionTemplates) {
this.planBlueprintHasNoDescriptionTemplates = planBlueprintHasNoDescriptionTemplates;
}
private ErrorDescription dmpDescriptionTemplateCanNotRemove;
private ErrorDescription planDescriptionTemplateCanNotRemove;
public ErrorDescription getDmpDescriptionTemplateCanNotRemove() {
return this.dmpDescriptionTemplateCanNotRemove;
public ErrorDescription getPlanDescriptionTemplateCanNotRemove() {
return this.planDescriptionTemplateCanNotRemove;
}
public void setDmpDescriptionTemplateCanNotRemove(ErrorDescription dmpDescriptionTemplateCanNotRemove) {
this.dmpDescriptionTemplateCanNotRemove = dmpDescriptionTemplateCanNotRemove;
public void setPlanDescriptionTemplateCanNotRemove(ErrorDescription planDescriptionTemplateCanNotRemove) {
this.planDescriptionTemplateCanNotRemove = planDescriptionTemplateCanNotRemove;
}
private ErrorDescription missingTenant;
@ -266,14 +266,14 @@ public class ErrorThesaurusProperties {
}
private ErrorDescription dmpNewVersionAlreadyCreatedDraft;
private ErrorDescription planNewVersionAlreadyCreatedDraft;
public ErrorDescription getDmpNewVersionAlreadyCreatedDraft() {
return this.dmpNewVersionAlreadyCreatedDraft;
public ErrorDescription getPlanNewVersionAlreadyCreatedDraft() {
return this.planNewVersionAlreadyCreatedDraft;
}
public void setDmpNewVersionAlreadyCreatedDraft(ErrorDescription dmpNewVersionAlreadyCreatedDraft) {
this.dmpNewVersionAlreadyCreatedDraft = dmpNewVersionAlreadyCreatedDraft;
public void setPlanNewVersionAlreadyCreatedDraft(ErrorDescription planNewVersionAlreadyCreatedDraft) {
this.planNewVersionAlreadyCreatedDraft = planNewVersionAlreadyCreatedDraft;
}
private ErrorDescription descriptionTemplateInactiveUser;
@ -297,46 +297,46 @@ public class ErrorThesaurusProperties {
}
private ErrorDescription dmpInactiveUser;
private ErrorDescription planInactiveUser;
public ErrorDescription getDmpInactiveUser() {
return this.dmpInactiveUser;
public ErrorDescription getPlanInactiveUser() {
return this.planInactiveUser;
}
public void setDmpInactiveUser(ErrorDescription dmpInactiveUser) {
this.dmpInactiveUser = dmpInactiveUser;
public void setPlanInactiveUser(ErrorDescription planInactiveUser) {
this.planInactiveUser = planInactiveUser;
}
private ErrorDescription dmpMissingUserContactInfo;
private ErrorDescription planMissingUserContactInfo;
public ErrorDescription getDmpMissingUserContactInfo() {
return this.dmpMissingUserContactInfo;
public ErrorDescription getPlanMissingUserContactInfo() {
return this.planMissingUserContactInfo;
}
public void setDmpMissingUserContactInfo(ErrorDescription dmpMissingUserContactInfo) {
this.dmpMissingUserContactInfo = dmpMissingUserContactInfo;
public void setPlanMissingUserContactInfo(ErrorDescription planMissingUserContactInfo) {
this.planMissingUserContactInfo = planMissingUserContactInfo;
}
private ErrorDescription importDescriptionWithoutDmpDescriptionTemplate;
private ErrorDescription importDescriptionWithoutPlanDescriptionTemplate;
public ErrorDescription getImportDescriptionWithoutDmpDescriptionTemplate() {
return this.importDescriptionWithoutDmpDescriptionTemplate;
public ErrorDescription getImportDescriptionWithoutPlanDescriptionTemplate() {
return this.importDescriptionWithoutPlanDescriptionTemplate;
}
public void setImportDescriptionWithoutDmpDescriptionTemplate(ErrorDescription importDescriptionWithoutDmpDescriptionTemplate) {
this.importDescriptionWithoutDmpDescriptionTemplate = importDescriptionWithoutDmpDescriptionTemplate;
public void setImportDescriptionWithoutPlanDescriptionTemplate(ErrorDescription importDescriptionWithoutPlanDescriptionTemplate) {
this.importDescriptionWithoutPlanDescriptionTemplate = importDescriptionWithoutPlanDescriptionTemplate;
}
private ErrorDescription duplicateDmpUser;
private ErrorDescription duplicatePlanUser;
public ErrorDescription getDuplicateDmpUser() {
return this.duplicateDmpUser;
public ErrorDescription getDuplicatePlanUser() {
return this.duplicatePlanUser;
}
public void setDuplicateDmpUser(ErrorDescription duplicateDmpUser) {
this.duplicateDmpUser = duplicateDmpUser;
public void setDuplicatePlanUser(ErrorDescription duplicatePlanUser) {
this.duplicatePlanUser = duplicatePlanUser;
}
private ErrorDescription referenceTypeCodeExists;

View File

@ -144,12 +144,12 @@ public class AnnotationEntityCreatedIntegrationEventHandlerImpl implements Annot
List<UUID> existingUSerIDs = existingUsers.stream()
.map(PlanUserEntity::getUserId)
.filter(dmpUserId -> !dmpUserId.equals(event.getSubjectId()))
.filter(planUserId -> !planUserId.equals(event.getSubjectId()))
.distinct().toList();
for (UUID dmpUserId : existingUSerIDs) {
UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUserId).first();
for (UUID planUserId : existingUSerIDs) {
UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUserId).first();
if (user == null || user.getIsActive().equals(IsActive.Inactive))
throw new MyValidationException(this.errors.getDmpInactiveUser().getCode(), this.errors.getDmpInactiveUser().getMessage());
throw new MyValidationException(this.errors.getPlanInactiveUser().getCode(), this.errors.getPlanInactiveUser().getMessage());
this.createAnnotationNotificationEvent(user, descriptionEntity, sender.getName(), event.getAnchor());
}

View File

@ -144,12 +144,12 @@ public class AnnotationStatusEntityChangedIntegrationEventHandlerImpl implements
List<UUID> existingUSerIDs = existingUsers.stream()
.map(PlanUserEntity::getUserId)
.filter(dmpUserId -> !dmpUserId.equals(event.getSubjectId()))
.filter(planUserId -> !planUserId.equals(event.getSubjectId()))
.distinct().toList();
for (UUID dmpUserId : existingUSerIDs) {
UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUserId).first();
for (UUID planUserId : existingUSerIDs) {
UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUserId).first();
if (user == null || user.getIsActive().equals(IsActive.Inactive))
throw new MyValidationException(this.errors.getDmpInactiveUser().getCode(), this.errors.getDmpInactiveUser().getMessage());
throw new MyValidationException(this.errors.getPlanInactiveUser().getCode(), this.errors.getPlanInactiveUser().getMessage());
this.createAnnotationStatusChangedNotificationEvent(user, descriptionEntity, sender.getName(), event.getAnchor(), event.getStatusLabel());
}

View File

@ -25,7 +25,7 @@ public class OutboxIntegrationEvent extends IntegrationEvent {
public static final String USER_REMOVE = "USER_REMOVE";
public static final String DMP_TOUCH = "DMP_TOUCH";
public static final String PLAN_TOUCH = "PLAN_TOUCH";
public static final String DESCRIPTION_TOUCH = "DESCRIPTION_TOUCH";

View File

@ -25,7 +25,7 @@ public class OutboxProperties {
private final String userTouchTopic;
private final String dmpTouchTopic;
private final String planTouchTopic;
private final String descriptionTouchTopic;
@ -49,7 +49,7 @@ public class OutboxProperties {
String tenantUserInviteTopic,
String userRemovalTopic,
String userTouchTopic,
String dmpTouchTopic,
String planTouchTopic,
String descriptionTouchTopic,
String annotationEntitiesTouchTopic,
String annotationEntitiesRemovalTopic,
@ -71,7 +71,7 @@ public class OutboxProperties {
this.tenantUserInviteTopic = tenantUserInviteTopic;
this.userRemovalTopic = userRemovalTopic;
this.userTouchTopic = userTouchTopic;
this.dmpTouchTopic = dmpTouchTopic;
this.planTouchTopic = planTouchTopic;
this.descriptionTouchTopic = descriptionTouchTopic;
this.annotationEntitiesTouchTopic = annotationEntitiesTouchTopic;
this.annotationEntitiesRemovalTopic = annotationEntitiesRemovalTopic;
@ -133,8 +133,8 @@ public class OutboxProperties {
return this.userTouchTopic;
}
public String getDmpTouchTopic() {
return this.dmpTouchTopic;
public String getPlanTouchTopic() {
return this.planTouchTopic;
}
public String getDescriptionTouchTopic() {

View File

@ -458,8 +458,8 @@ public class OutboxRepositoryImpl implements OutboxRepository {
routingKey = this.outboxProperties.getUserTouchTopic();
break;
}
case OutboxIntegrationEvent.DMP_TOUCH: {
routingKey = this.outboxProperties.getDmpTouchTopic();
case OutboxIntegrationEvent.PLAN_TOUCH: {
routingKey = this.outboxProperties.getPlanTouchTopic();
break;
}
case OutboxIntegrationEvent.DESCRIPTION_TOUCH: {

View File

@ -6,5 +6,5 @@ import java.util.UUID;
public interface AnnotationEntityRemovalIntegrationEventHandler {
void handleDescription(UUID descriptionId) throws InvalidApplicationException;
void handleDmp(UUID planId) throws InvalidApplicationException;
void handlePlan(UUID planId) throws InvalidApplicationException;
}

View File

@ -56,9 +56,9 @@ public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements Annot
}
@Override
public void handleDmp(UUID planId) {
PlanEntity dmp = this.queryFactory.query(PlanQuery.class).disableTracking().ids(planId).firstAs(new BaseFieldSet().ensure(Plan._id).ensure(PlanEntity._tenantId));
if(dmp == null) return;
public void handlePlan(UUID planId) {
PlanEntity plan = this.queryFactory.query(PlanQuery.class).disableTracking().ids(planId).firstAs(new BaseFieldSet().ensure(Plan._id).ensure(PlanEntity._tenantId));
if(plan == null) return;
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().planIds(planId).collectAs(new BaseFieldSet().ensure(Description._id));
@ -68,6 +68,6 @@ public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements Annot
for (DescriptionEntity description : descriptionEntities) event.getEntityIds().add(description.getId());
this.handle(event, dmp.getTenantId());
this.handle(event, plan.getTenantId());
}
}

View File

@ -49,10 +49,10 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot
public void handleDescription(UUID descriptionId) {
DescriptionEntity entity = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(descriptionId).firstAs(new BaseFieldSet().ensure(Description._plan).ensure(DescriptionEntity._tenantId));
if (entity == null) return;
List<PlanUserEntity> dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(entity.getPlanId()).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._user));
List<PlanUserEntity> planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(entity.getPlanId()).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._user));
AnnotationEntitiesTouchedIntegrationEvent event = new AnnotationEntitiesTouchedIntegrationEvent();
event.setEvents(List.of(this.buildEventItem(descriptionId, dmpUsers)));
event.setEvents(List.of(this.buildEventItem(descriptionId, planUsers)));
this.handle(event, entity.getTenantId());
}
@ -61,23 +61,23 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot
public void handlePlan(UUID planId) {
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().planIds(planId).collectAs(new BaseFieldSet().ensure(Description._id));
if (descriptionEntities == null || descriptionEntities.isEmpty()) return;
List<PlanUserEntity> dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._user));
List<PlanUserEntity> planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._user));
AnnotationEntitiesTouchedIntegrationEvent event = new AnnotationEntitiesTouchedIntegrationEvent();
event.setEvents(new ArrayList<>());
event.getEvents().add(this.buildEventItem(planId, dmpUsers));
event.getEvents().add(this.buildEventItem(planId, planUsers));
for (DescriptionEntity description : descriptionEntities) event.getEvents().add(this.buildEventItem(description.getId(), dmpUsers));
for (DescriptionEntity description : descriptionEntities) event.getEvents().add(this.buildEventItem(description.getId(), planUsers));
this.handle(event, descriptionEntities.getFirst().getTenantId());
}
private AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent buildEventItem(UUID entityId, List<PlanUserEntity> dmpUsers){
private AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent buildEventItem(UUID entityId, List<PlanUserEntity> planUsers){
AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent eventItem = new AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent();
eventItem.setEntityId(entityId);
List<UUID> users = new ArrayList<>();
for (PlanUserEntity dmpUser : dmpUsers){
users.add(dmpUser.getUserId());
for (PlanUserEntity planUser : planUsers){
users.add(planUser.getUserId());
}
eventItem.setUserIds(users);
return eventItem;

View File

@ -1,24 +1,23 @@
package org.opencdmp.model;
import java.util.List;
import java.util.UUID;
public class DashboardStatistics {
private long dmpCount;
private long planCount;
public static final String _dmpCount = "dmpCount";
public static final String _planCount = "planCount";
private long descriptionCount;
private List<DashboardReferenceTypeStatistics> referenceTypeStatistics;
public long getDmpCount() {
return dmpCount;
public long getPlanCount() {
return planCount;
}
public void setDmpCount(long dmpCount) {
this.dmpCount = dmpCount;
public void setPlanCount(long planCount) {
this.planCount = planCount;
}
public long getDescriptionCount() {

View File

@ -61,11 +61,11 @@ public class PlanDescriptionTemplate {
this.id = id;
}
public Plan getDmp() {
public Plan getPlan() {
return plan;
}
public void setDmp(Plan plan) {
public void setPlan(Plan plan) {
this.plan = plan;
}

View File

@ -20,7 +20,7 @@ public class RecentActivityItemLookup{
private String like;
private Boolean onlyDraft;
private Boolean onlyDmp;
private Boolean onlyPlan;
private Boolean onlyDescription;
private List<UUID> userIds;
private Paging page;
@ -75,12 +75,12 @@ public class RecentActivityItemLookup{
this.orderField = orderField;
}
public Boolean getOnlyDmp() {
return onlyDmp;
public Boolean getOnlyPlan() {
return onlyPlan;
}
public void setOnlyDmp(Boolean onlyDmp) {
this.onlyDmp = onlyDmp;
public void setOnlyPlan(Boolean onlyPlan) {
this.onlyPlan = onlyPlan;
}
public Boolean getOnlyDescription() {
@ -92,7 +92,7 @@ public class RecentActivityItemLookup{
}
public DescriptionLookup asDescriptionLookup() {
if (this.onlyDmp != null) return null;
if (this.onlyPlan != null) return null;
DescriptionLookup lookup = new DescriptionLookup();
lookup.setIsActive(List.of(IsActive.Active));
@ -125,7 +125,7 @@ public class RecentActivityItemLookup{
return lookup;
}
public PlanLookup asDmpLookup() {
public PlanLookup asPlanLookup() {
if (this.onlyDescription != null) return null;
PlanLookup lookup = new PlanLookup();

View File

@ -84,7 +84,7 @@ public class PlanDescriptionTemplateBuilder extends BaseBuilder<PlanDescriptionT
if (fields.hasField(this.asIndexer(DescriptionTemplateType._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope));
if (!templateFields.isEmpty() && templateItemsMap != null && templateItemsMap.containsKey(d.getDescriptionTemplateGroupId())) m.setDescriptionTemplates(templateItemsMap.get(d.getDescriptionTemplateGroupId()));
if (!currentDescriptionTemplateFields.isEmpty() && currentDescriptionTemplateItemsMap != null && currentDescriptionTemplateItemsMap.containsKey(d.getDescriptionTemplateGroupId())) m.setCurrentDescriptionTemplate(currentDescriptionTemplateItemsMap.get(d.getDescriptionTemplateGroupId()));
if (!planFields.isEmpty() && planItemsMap != null && planItemsMap.containsKey(d.getPlanId())) m.setDmp(planItemsMap.get(d.getPlanId()));
if (!planFields.isEmpty() && planItemsMap != null && planItemsMap.containsKey(d.getPlanId())) m.setPlan(planItemsMap.get(d.getPlanId()));
models.add(m);
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));

View File

@ -160,7 +160,7 @@ public class PublicPlanBuilder extends BaseBuilder<PublicPlan, PlanEntity> {
Map<UUID, List<PublicEntityDoi>> itemMap;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicEntityDoi._entityId));
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList()));
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.Plan).entityIds(data.stream().map(PlanEntity::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))) {

View File

@ -84,8 +84,8 @@ public class ActionConfirmationBuilder extends BaseBuilder<ActionConfirmation, A
m.setMergeAccountConfirmation(this.builderFactory.builder(MergeAccountConfirmationBuilder.class).authorize(this.authorize).build(mergeAccountConfirmationFields, emailConfirmation));
}
case PlanInvitation -> {
PlanInvitationEntity dmpInvitation = this.xmlHandlingService.fromXmlSafe(PlanInvitationEntity.class, d.getData());
m.setPlanInvitation(this.builderFactory.builder(PlanInvitationBuilder.class).authorize(this.authorize).build(planInvitationFields, dmpInvitation));
PlanInvitationEntity planInvitation = this.xmlHandlingService.fromXmlSafe(PlanInvitationEntity.class, d.getData());
m.setPlanInvitation(this.builderFactory.builder(PlanInvitationBuilder.class).authorize(this.authorize).build(planInvitationFields, planInvitation));
}
case RemoveCredential -> {
RemoveCredentialRequestEntity emailConfirmation = this.xmlHandlingService.fromXmlSafe(RemoveCredentialRequestEntity.class, d.getData());

View File

@ -53,7 +53,7 @@ public abstract class BaseFieldDataCommonModelBuilder<Model extends BaseFieldDat
case SELECT -> m.setFieldType(FieldType.SELECT);
case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION);
case RADIO_BOX -> m.setFieldType(FieldType.RADIO_BOX);
case INTERNAL_ENTRIES_DMPS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_DMPS);
case INTERNAL_ENTRIES_PLANS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_DMPS);
case INTERNAL_ENTRIES_DESCRIPTIONS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS);
case CHECK_BOX -> m.setFieldType(FieldType.CHECK_BOX);
case FREE_TEXT -> m.setFieldType(FieldType.FREE_TEXT);

View File

@ -114,7 +114,7 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, Pla
Map<UUID, List<DescriptionModel>> descriptionsMap = this.disableDescriptions ? null : this.collectPlanDescriptions(data);
Map<UUID, List<EntityDoiModel>> entityDois = this.collectPlanEntityDois(data);
Map<UUID, UserModel> creators = this.collectCreators(data);
Map<UUID, DmpBlueprintModel> dmpBlueprints = this.collectPlanBlueprints(data);
Map<UUID, DmpBlueprintModel> planBlueprints = this.collectPlanBlueprints(data);
Map<UUID, DefinitionEntity> definitionEntityMap = this.collectPlanBlueprintDefinitions(data);
for (PlanEntity d : data) {
@ -133,7 +133,7 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, Pla
}
if (entityDois != null && !entityDois.isEmpty() && entityDois.containsKey(d.getId())) m.setEntityDois(entityDois.get(d.getId()));
if (creators != null && !creators.isEmpty() && d.getCreatorId() != null && creators.containsKey(d.getCreatorId())) m.setCreator(creators.get(d.getCreatorId()));
if (dmpBlueprints != null && !dmpBlueprints.isEmpty() && d.getBlueprintId() != null && dmpBlueprints.containsKey(d.getBlueprintId())) m.setDmpBlueprint(dmpBlueprints.get(d.getBlueprintId()));
if (planBlueprints != null && !planBlueprints.isEmpty() && d.getBlueprintId() != null && planBlueprints.containsKey(d.getBlueprintId())) m.setDmpBlueprint(planBlueprints.get(d.getBlueprintId()));
if (d.getProperties() != null){
//TODO Update with the new logic of property definition
PlanPropertiesEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PlanPropertiesEntity.class, d.getProperties());
@ -162,13 +162,13 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, Pla
return models;
}
private String getPreviousDOI(UUID dmpGroup, UUID currentPlanId) {
private String getPreviousDOI(UUID planGroup, UUID currentPlanId) {
if (this.repositoryId == null || this.repositoryId.isEmpty()) throw new MyApplicationException("repositoryId required");
//GK: Step one get the previous version of the Data management plan
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking();
planQuery.setOrder(new Ordering().addDescending(Plan._version));
List<UUID> planIds = planQuery.groupIds(dmpGroup).excludedIds(currentPlanId).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Plan._id)).stream().map(PlanEntity::getId).toList();
List<UUID> planIds = planQuery.groupIds(planGroup).excludedIds(currentPlanId).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Plan._id)).stream().map(PlanEntity::getId).toList();
//GK: Step two get it's doiEntity
List<EntityDoiEntity> dois = this.queryFactory.query(EntityDoiQuery.class).disableTracking().repositoryIds(this.repositoryId).entityIds(planIds).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(EntityDoi._entityId, EntityDoi._doi));

View File

@ -20,7 +20,7 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@Component("dmpblueprint.DefinitionCommonModelBuilder")
@Component("planblueprint.DefinitionCommonModelBuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DefinitionCommonModelBuilder extends BaseCommonModelBuilder<DefinitionModel, DefinitionEntity> {
private final BuilderFactory builderFactory;

View File

@ -20,7 +20,7 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@Component("dmpblueprint.FieldCommonModelBuilder")
@Component("planblueprint.FieldCommonModelBuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public abstract class FieldCommonModelBuilder<Model extends FieldModel, Entity extends FieldEntity> extends BaseCommonModelBuilder<Model, Entity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);

View File

@ -24,7 +24,7 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@Component("dmpblueprint.SectionCommonModelBuilder")
@Component("planblueprint.SectionCommonModelBuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class SectionCommonModelBuilder extends BaseCommonModelBuilder<SectionModel, SectionEntity> {
private final BuilderFactory builderFactory;

View File

@ -82,7 +82,7 @@ public class FieldBuilder extends BaseBuilder<Field, FieldEntity> {
if (fields.hasField(this.asIndexer(Field._textListValue)) && FieldType.isTextListType(fieldType)) {
boolean isMultiSelect = true;
if(this.fieldEntity != null && this.fieldEntity.getData() != null && (this.fieldEntity.getData().getFieldType().equals(FieldType.SELECT)
|| this.fieldEntity.getData().getFieldType().equals(FieldType.INTERNAL_ENTRIES_DMPS)
|| this.fieldEntity.getData().getFieldType().equals(FieldType.INTERNAL_ENTRIES_PLANS)
|| this.fieldEntity.getData().getFieldType().equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS))){
if (this.fieldEntity.getData() instanceof SelectDataEntity) isMultiSelect = ((SelectDataEntity) this.fieldEntity.getData()).getMultipleSelect();
else if (this.fieldEntity.getData() instanceof LabelAndMultiplicityDataEntity) isMultiSelect = ((LabelAndMultiplicityDataEntity) this.fieldEntity.getData()).getMultipleSelect();

View File

@ -47,10 +47,10 @@ public class PlanBlueprintValueBuilder extends BaseBuilder<PlanBlueprintValue, P
}
@Override
public List<PlanBlueprintValue> build(FieldSet DmpBlueprintValues, List<PlanBlueprintValueEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} DmpBlueprintValues", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(DmpBlueprintValues).map(FieldSet::getFields).map(Set::size).orElse(0));
this.logger.trace(new DataLogEntry("requested DmpBlueprintValues", DmpBlueprintValues));
if (DmpBlueprintValues == null || data == null || DmpBlueprintValues.isEmpty())
public List<PlanBlueprintValue> build(FieldSet planBlueprintValues, List<PlanBlueprintValueEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} PlanBlueprintValues", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(planBlueprintValues).map(FieldSet::getFields).map(Set::size).orElse(0));
this.logger.trace(new DataLogEntry("requested PlanBlueprintValues", planBlueprintValues));
if (planBlueprintValues == null || data == null || planBlueprintValues.isEmpty())
return new ArrayList<>();
@ -61,13 +61,13 @@ public class PlanBlueprintValueBuilder extends BaseBuilder<PlanBlueprintValue, P
if (fieldEntity != null && fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)) {
ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity;
PlanBlueprintValue m = new PlanBlueprintValue();
if (DmpBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._fieldId))) m.setFieldId(d.getFieldId());
if (planBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._fieldId))) m.setFieldId(d.getFieldId());
if (extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){
if (DmpBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._dateValue))) m.setDateValue(d.getDateValue());
if (planBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._dateValue))) m.setDateValue(d.getDateValue());
} else if (extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isNumberType(extraFieldEntity.getType())){
if (DmpBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._numberValue))) m.setNumberValue(d.getNumberValue());
if (planBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._numberValue))) m.setNumberValue(d.getNumberValue());
} else {
if (DmpBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._fieldValue))) m.setFieldValue(d.getValue());
if (planBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._fieldValue))) m.setFieldValue(d.getValue());
}
models.add(m);

View File

@ -180,7 +180,7 @@ public class PlanBuilder extends BaseBuilder<Plan, PlanEntity> {
Map<UUID, List<EntityDoi>> itemMap;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(EntityDoi._entityId));
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList()));
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.Plan).entityIds(data.stream().map(PlanEntity::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))) {
@ -312,11 +312,11 @@ public class PlanBuilder extends BaseBuilder<Plan, PlanEntity> {
Map<UUID, List<PlanDescriptionTemplate>> itemMap;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PlanDescriptionTemplate._plan, PlanDescriptionTemplate._id));
PlanDescriptionTemplateQuery query = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(PlanDescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
itemMap = this.builderFactory.builder(PlanDescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getPlan().getId());
if (!fields.hasField(this.asIndexer(PlanDescriptionTemplate._plan, Plan._id))) {
itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).forEach(x -> {
x.getDmp().setId(null);
itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getPlan() != null).forEach(x -> {
x.getPlan().setId(null);
});
}

View File

@ -52,13 +52,13 @@ public class PlanPropertiesBuilder extends BaseBuilder<PlanProperties, PlanPrope
return new ArrayList<>();
//Not Bulk Build because is XML no interaction with db
FieldSet dmpBlueprintValuesFields = fields.extractPrefixed(this.asPrefix(PlanProperties._planBlueprintValues));
FieldSet planBlueprintValuesFields = fields.extractPrefixed(this.asPrefix(PlanProperties._planBlueprintValues));
FieldSet contactsFields = fields.extractPrefixed(this.asPrefix(PlanProperties._contacts));
List<PlanProperties> models = new ArrayList<>();
for (PlanPropertiesEntity d : data) {
PlanProperties m = new PlanProperties();
if (!dmpBlueprintValuesFields.isEmpty() && d.getPlanBlueprintValues() != null) m.setPlanBlueprintValues(this.builderFactory.builder(PlanBlueprintValueBuilder.class).withDefinition(definition).authorize(this.authorize).build(dmpBlueprintValuesFields, d.getPlanBlueprintValues()));
if (!planBlueprintValuesFields.isEmpty() && d.getPlanBlueprintValues() != null) m.setPlanBlueprintValues(this.builderFactory.builder(PlanBlueprintValueBuilder.class).withDefinition(definition).authorize(this.authorize).build(planBlueprintValuesFields, d.getPlanBlueprintValues()));
if (!contactsFields.isEmpty() && d.getContacts() != null) m.setContacts(this.builderFactory.builder(PlanContactBuilder.class).authorize(this.authorize).build(contactsFields, d.getContacts()));
models.add(m);
}

View File

@ -18,7 +18,7 @@ import org.springframework.stereotype.Component;
import java.util.*;
@Component("dmpblueprintdefinitionbuilder")
@Component("planblueprintdefinitionbuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DefinitionBuilder extends BaseBuilder<Definition, DefinitionEntity> {

View File

@ -17,7 +17,7 @@ import org.springframework.stereotype.Component;
import java.util.*;
@Component("dmpblueprintdefinitiondescriptiontemplatebuilder")
@Component("planblueprintdefinitiondescriptiontemplatebuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate, DescriptionTemplateEntity> {

View File

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
import java.util.*;
@Component("dmpblueprintdefinitionfieldbuilder")
@Component("planblueprintdefinitionfieldbuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public abstract class FieldBuilder<Model extends Field, Entity extends FieldEntity> extends BaseBuilder<Model, Entity> {

View File

@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
import java.util.*;
@Component("dmpblueprintdefinitionsectionbuilder")
@Component("planblueprintdefinitionsectionbuilder")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {

View File

@ -36,7 +36,7 @@ public class PublicPlanCensor extends BaseCensor {
if (fields.isEmpty())
return;
this.authService.authorizeForce(Permission.PublicBrowseDmp);
this.authService.authorizeForce(Permission.PublicBrowsePlan);
FieldSet planDescriptionsFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlan._planUsers));
this.censorFactory.censor(PublicPlanUserCensor.class).censor(planDescriptionsFields);

View File

@ -35,7 +35,7 @@ public class PublicPlanReferenceCensor extends BaseCensor {
if (fields == null || fields.isEmpty())
return;
this.authService.authorizeForce(Permission.PublicBrowseDmpReference);
this.authService.authorizeForce(Permission.PublicBrowsePlanReference);
FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanReference._plan));
this.censorFactory.censor(PublicPlanCensor.class).censor(planFields);
FieldSet templateFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanReference._reference));

View File

@ -33,7 +33,7 @@ public class PublicPlanUserCensor extends BaseCensor {
if (fields == null || fields.isEmpty())
return;
this.authService.authorizeForce(Permission.PublicBrowseDmpUser);
this.authService.authorizeForce(Permission.PublicBrowsePlanUser);
FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanUser._plan));
this.censorFactory.censor(PublicPlanCensor.class).censor(planFields);
FieldSet userFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanUser._user));

View File

@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("dmpcontactcensor")
@Component("plancontactcensor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class PlanContactCensor extends BaseCensor {

View File

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("dmppropertiescensor")
@Component("planpropertiescensor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class PlanPropertiesCensor extends BaseCensor {
@ -39,8 +39,8 @@ public class PlanPropertiesCensor extends BaseCensor {
return;
this.authService.authorizeForce(Permission.BrowsePlan, Permission.DeferredAffiliation);
FieldSet dmpBlueprintValuesFields = fields.extractPrefixed(this.asIndexerPrefix(PlanProperties._planBlueprintValues));
this.censorFactory.censor(PlanBlueprintValueCensor.class).censor(dmpBlueprintValuesFields, userId);
FieldSet planBlueprintValuesFields = fields.extractPrefixed(this.asIndexerPrefix(PlanProperties._planBlueprintValues));
this.censorFactory.censor(PlanBlueprintValueCensor.class).censor(planBlueprintValuesFields, userId);
FieldSet contactsFields = fields.extractPrefixed(this.asIndexerPrefix(PlanProperties._contacts));
this.censorFactory.censor(PlanContactCensor.class).censor(contactsFields, userId);
}

View File

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("dmpblueprintdefinitioncensor")
@Component("planblueprintdefinitioncensor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DefinitionCensor extends BaseCensor {

View File

@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("dmpblueprintdefinitiondescriptiontemplatecensor")
@Component("planblueprintdefinitiondescriptiontemplatecensor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DescriptionTemplatesCensor extends BaseCensor {

View File

@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("dmpblueprintdefinitionfieldcensor")
@Component("planblueprintdefinitionfieldcensor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class FieldCensor extends BaseCensor {

View File

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("dmpblueprintdefinitionsectioncensor")
@Component("planblueprintdefinitionsectioncensor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class SectionCensor extends BaseCensor {

View File

@ -104,9 +104,9 @@ public class PlanDeleter implements Deleter {
for (PlanEntity item : data) {
logger.trace("deleting item {}", item.getId());
EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).authorize(AuthorizationFlags.AllExceptPublic).types(EntityType.DMP).entityIds(item.getId());
if (entityDoiQuery.count() > 0) throw new MyApplicationException("DMP is deposited can not deleted");
if(item.getVersionStatus().equals(PlanVersionStatus.Current)) throw new MyApplicationException("DMP is current can not deleted");
EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).authorize(AuthorizationFlags.AllExceptPublic).types(EntityType.Plan).entityIds(item.getId());
if (entityDoiQuery.count() > 0) throw new MyApplicationException("Plan is deposited can not deleted");
if(item.getVersionStatus().equals(PlanVersionStatus.Current)) throw new MyApplicationException("Plan is current can not deleted");
item.setIsActive(IsActive.Inactive);
item.setUpdatedAt(now);
logger.trace("updating item");

View File

@ -44,8 +44,8 @@ public class PlanToPublicApiPlanMapper {
model.setUsers(plan.getPlanUsers().stream().map(UserInfoPublicModel::fromDmpUser).toList());
model.setResearchers(plan.getPlanReferences().stream().map(x-> ResearcherPublicModel.fromDmpReference(x, config)).filter(Objects::nonNull).toList());
model.setGrant(GrantPublicOverviewModel.fromDmpReferences(plan.getPlanReferences(), config));
model.setOrganisations(plan.getPlanReferences().stream().map(x-> OrganizationPublicModel.fromDmpReference(x, config)).filter(Objects::nonNull).toList());
model.setGrant(GrantPublicOverviewModel.fromPlanReferences(plan.getPlanReferences(), config));
model.setOrganisations(plan.getPlanReferences().stream().map(x-> OrganizationPublicModel.fromPlanReference(x, config)).filter(Objects::nonNull).toList());
model.setDois(doiEntities.stream().map(DoiPublicModel::fromDataModel).toList());
model.setAssociatedProfiles(descriptionTemplates.stream().map(x -> AssociatedProfilePublicModel.fromPlanDescriptionTemplate(x, plan.getBlueprint())).toList());

View File

@ -243,7 +243,7 @@ public class PlanPersist {
this.spec()
.iff(() -> item.getStatus() == PlanStatus.Finalized)
.must(() -> this.isDescriptionTemplateMultiplicityValid(finalPlanBlueprintEntity, item.getId()))
.failOn(PlanPersist._descriptionTemplates).failWith(this.messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicityOnDMP", new Object[]{PlanPersist._descriptionTemplates}, LocaleContextHolder.getLocale())),
.failOn(PlanPersist._descriptionTemplates).failWith(this.messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicityOnPlan", new Object[]{PlanPersist._descriptionTemplates}, LocaleContextHolder.getLocale())),
this.refSpec()
.iff(() -> !this.isNull(item.getProperties()))
.on(PlanPersist._properties)

View File

@ -10,7 +10,6 @@ import org.opencdmp.commons.validation.BaseValidator;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.model.persist.ReferencePersist;
import org.opencdmp.model.persist.TagPersist;
import org.opencdmp.service.visibility.VisibilityService;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource;
@ -179,7 +178,7 @@ public class FieldPersist {
.must(() -> !this.isListNullOrEmpty(item.getReferences()) || !this.isNull(item.getReference()))
.failOn(FieldPersist._textListValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
this.spec()
.iff(()-> !this.isNull(item.getTextListValue()) && (fieldType.equals(FieldType.INTERNAL_ENTRIES_DMPS) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS)))
.iff(()-> !this.isNull(item.getTextListValue()) && (fieldType.equals(FieldType.INTERNAL_ENTRIES_PLANS) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS)))
.must(() -> item.getTextListValue().stream().allMatch(this::isUUID))
.failOn(FieldPersist._textListValue).failWith(this.messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
this.navSpec()

View File

@ -110,7 +110,7 @@ public class RulePersist {
.failOn(RulePersist._target).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{RulePersist._target}, LocaleContextHolder.getLocale())),
this.spec()
.iff(() -> this.isNull(fieldType))
.must(() -> !FieldType.TAGS.equals(fieldType) && !FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !FieldType.INTERNAL_ENTRIES_DMPS.equals(fieldType) &&
.must(() -> !FieldType.TAGS.equals(fieldType) && !FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !FieldType.INTERNAL_ENTRIES_PLANS.equals(fieldType) &&
!FieldType.UPLOAD.equals(fieldType) && !FieldType.REFERENCE_TYPES.equals(fieldType) && !FieldType.DATASET_IDENTIFIER.equals(fieldType)
&& !FieldType.VALIDATION.equals(fieldType))
.failOn(RulePersist._target).failWith(this.messageSource.getMessage("Validation_UnexpectedValue", new Object[]{RulePersist._target}, LocaleContextHolder.getLocale())),

View File

@ -23,7 +23,7 @@ import java.util.List;
@JsonSubTypes({
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.BooleanDecision),
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalEntitiesDescriptions),
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalEntitiesDmps),
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalEntitiesPlans),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.CheckBox),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatePicker),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.FreeText),

View File

@ -35,7 +35,7 @@ public class DefinitionPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class DefinitionPersistValidator extends BaseValidator<DefinitionPersist> {
public static final String ValidatorName = "DmpBlueprint.DefinitionPersistValidator";
public static final String ValidatorName = "PlanBlueprint.DefinitionPersistValidator";
private final MessageSource messageSource;

View File

@ -68,7 +68,7 @@ public class DescriptionTemplatePersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class DescriptionTemplatePersistValidator extends BaseValidator<DescriptionTemplatePersist> {
public static final String ValidatorName = "DmpBlueprint.DescriptionTemplatePersistValidator";
public static final String ValidatorName = "PlanBlueprint.DescriptionTemplatePersistValidator";
private final MessageSource messageSource;

View File

@ -31,7 +31,7 @@ public class ExtraFieldPersist extends FieldPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class ExtraFieldPersistValidator extends BaseFieldPersistValidator<ExtraFieldPersist> {
public static final String ValidatorName = "DmpBlueprint.ExtraFieldPersistValidator";
public static final String ValidatorName = "PlanBlueprint.ExtraFieldPersistValidator";
protected ExtraFieldPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
super(conventionService, errors, messageSource);

View File

@ -44,7 +44,7 @@ public class ReferenceTypeFieldPersist extends FieldPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class ReferenceFieldPersistPersistValidator extends BaseFieldPersistValidator<ReferenceTypeFieldPersist> {
public static final String ValidatorName = "DmpBlueprint.ReferenceFieldPersistPersistValidator";
public static final String ValidatorName = "PlanBlueprint.ReferenceFieldPersistPersistValidator";
protected ReferenceFieldPersistPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
super(conventionService, errors, messageSource);

View File

@ -117,7 +117,7 @@ public class SectionPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class SectionPersistValidator extends BaseValidator<SectionPersist> {
public static final String ValidatorName = "DmpBlueprint.SectionPersistValidator";
public static final String ValidatorName = "PlanBlueprint.SectionPersistValidator";
private final MessageSource messageSource;

View File

@ -30,7 +30,7 @@ public class SystemFieldPersist extends FieldPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class SystemFieldPersistValidator extends BaseFieldPersistValidator<SystemFieldPersist> {
public static final String ValidatorName = "DmpBlueprint.SystemFieldPersistValidator";
public static final String ValidatorName = "PlanBlueprint.SystemFieldPersistValidator";
protected SystemFieldPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
super(conventionService, errors, messageSource);

View File

@ -60,13 +60,13 @@ public class AssociatedProfilePublicModel {
model.setDescriptionTemplateId(currentDescriptionTemplate.getId());
model.setLabel(currentDescriptionTemplate.getLabel());
HashMap<String, Object> data = new HashMap<>();
data.put("dmpSectionIndex", getDmpSectionIndexes(planBlueprint, sectionId));
data.put("planSectionIndex", getPlanSectionIndexes(planBlueprint, sectionId));
model.setData(data);
return model;
}
private static List<Integer> getDmpSectionIndexes(PlanBlueprint planBlueprint, UUID sectionId) {
private static List<Integer> getPlanSectionIndexes(PlanBlueprint planBlueprint, UUID sectionId) {
ArrayList<Integer> indexes = new ArrayList<>();
planBlueprint.getDefinition().getSections().forEach(x -> {
if (Objects.equals(sectionId, x.getId()))

View File

@ -79,7 +79,7 @@ public class GrantPublicOverviewModel {
this.funder = funder;
}
public static GrantPublicOverviewModel fromDmpReferences(List<PlanReference> references, PublicApiProperties.ReferenceTypeMapConfig config) {
public static GrantPublicOverviewModel fromPlanReferences(List<PlanReference> references, PublicApiProperties.ReferenceTypeMapConfig config) {
FunderPublicOverviewModel funder = null;
for (PlanReference planReference : references) {
if (!Objects.equals(planReference.getReference().getType().getId(), config.getFunderTypeId())) {

View File

@ -48,7 +48,7 @@ public class OrganizationPublicModel {
this.key = key;
}
public static OrganizationPublicModel fromDmpReference(PlanReference planReference, PublicApiProperties.ReferenceTypeMapConfig config) {
public static OrganizationPublicModel fromPlanReference(PlanReference planReference, PublicApiProperties.ReferenceTypeMapConfig config) {
if (!Objects.equals(planReference.getReference().getType().getId(), config.getOrganizationTypeId()))
return null;
OrganizationPublicModel model = new OrganizationPublicModel();

View File

@ -113,7 +113,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
return this;
}
public DescriptionQuery dmpDescriptionTemplateSubQuery(PlanDescriptionTemplateQuery subQuery) {
public DescriptionQuery planDescriptionTemplateSubQuery(PlanDescriptionTemplateQuery subQuery) {
this.planDescriptionTemplateQuery = subQuery;
return this;
}
@ -153,7 +153,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
return this;
}
public DescriptionQuery dmpSubQuery(PlanQuery subQuery) {
public DescriptionQuery planSubQuery(PlanQuery subQuery) {
this.planQuery = subQuery;
return this;
}
@ -270,7 +270,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
return null;
UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated))
if (this.authorize.contains(AuthorizationFlags.PlanAssociated))
userId = this.userScope.getUserIdSafe();
else
userId = null;
@ -345,11 +345,11 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
predicates.add(inClause);
}
if (this.planDescriptionTemplateQuery != null) {
QueryContext<PlanDescriptionTemplateEntity, UUID> subQuery = this.applySubQuery(this.planDescriptionTemplateQuery, queryContext, UUID.class, dmpDescriptionTemplateEntityRoot -> dmpDescriptionTemplateEntityRoot.get(PlanDescriptionTemplateEntity._id));
QueryContext<PlanDescriptionTemplateEntity, UUID> subQuery = this.applySubQuery(this.planDescriptionTemplateQuery, queryContext, UUID.class, planDescriptionTemplateEntityRoot -> planDescriptionTemplateEntityRoot.get(PlanDescriptionTemplateEntity._id));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planDescriptionTemplateId)).value(subQuery.Query));
}
if (this.planQuery != null) {
QueryContext<PlanEntity, UUID> subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(PlanEntity._id));
QueryContext<PlanEntity, UUID> subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, planEntityRoot -> planEntityRoot.get(PlanEntity._id));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planId)).value(subQuery.Query));
}
if (this.descriptionTemplateQuery != null) {

View File

@ -166,7 +166,7 @@ public class DescriptionReferenceQuery extends QueryBase<DescriptionReferenceEnt
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDescriptionReference)) return null;
UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe();
else userId = null;
if (this.authorize.contains(AuthorizationFlags.Owner)) userId = this.userScope.getUserIdSafe();

View File

@ -265,21 +265,21 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
return null;
UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated))
if (this.authorize.contains(AuthorizationFlags.PlanAssociated))
userId = this.userScope.getUserIdSafe();
else
userId = null;
List<Predicate> predicates = new ArrayList<>();
if (userId != null || usePublic) {
Subquery<UUID> dmpDescriptionTemplateSubquery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(
Subquery<UUID> planDescriptionTemplateSubquery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(
new BuildSubQueryInput.Builder<>(PlanDescriptionTemplateEntity.class, UUID.class, queryContext)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId))
.filterFunc((subQueryRoot, cb) ->
cb.in(subQueryRoot.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))
cb.in(subQueryRoot.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))
)
));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateEntity._groupId)).value(dmpDescriptionTemplateSubquery));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateEntity._groupId)).value(planDescriptionTemplateSubquery));
}
if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);

View File

@ -217,7 +217,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(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(EntityDoiEntity._entityId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
}
if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);

View File

@ -200,12 +200,12 @@ public class PlanDescriptionTemplateQuery extends QueryBase<PlanDescriptionTempl
return null;
UUID userId = null;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated))
if (this.authorize.contains(AuthorizationFlags.PlanAssociated))
userId = this.userScope.getUserIdSafe();
List<Predicate> predicates = new ArrayList<>();
if (userId != null || usePublic) {
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
}
if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);

View File

@ -242,7 +242,7 @@ public class PlanQuery extends QueryBase<PlanEntity> {
public PlanQuery entityDoiSubQuery(EntityDoiQuery subQuery) {
this.entityDoiQuery = subQuery;
this.entityDoiQuery.types(EntityType.DMP);
this.entityDoiQuery.types(EntityType.Plan);
return this;
}
@ -284,7 +284,7 @@ public class PlanQuery extends QueryBase<PlanEntity> {
return null;
UUID userId = null;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated))
if (this.authorize.contains(AuthorizationFlags.PlanAssociated))
userId = this.userScope.getUserIdSafe();
List<Predicate> predicates = new ArrayList<>();
@ -295,7 +295,7 @@ public class PlanQuery extends QueryBase<PlanEntity> {
queryContext.CriteriaBuilder.equal(queryContext.Root.get(PlanEntity._accessType), PlanAccessType.Public)
)
: queryContext.CriteriaBuilder.or(), //Creates a false query
userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)).value(this.queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query
userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)).value(this.queryUtilsService.buildPlanUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query
));
}
if (!predicates.isEmpty()) {

View File

@ -103,7 +103,7 @@ public class PlanReferenceQuery extends QueryBase<PlanReferenceEntity> {
return this;
}
public PlanReferenceQuery dmpSubQuery(PlanQuery value) {
public PlanReferenceQuery planSubQuery(PlanQuery value) {
this.planQuery = value;
return this;
}
@ -165,12 +165,12 @@ public class PlanReferenceQuery extends QueryBase<PlanReferenceEntity> {
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlanReference)) return null;
UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe();
else userId = null;
List<Predicate> predicates = new ArrayList<>();
if (userId != null || usePublic ) {
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)));
}
if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
@ -208,7 +208,7 @@ public class PlanReferenceQuery extends QueryBase<PlanReferenceEntity> {
predicates.add(inClause);
}
if (this.planQuery != null) {
QueryContext<PlanEntity, UUID> subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(PlanEntity._id));
QueryContext<PlanEntity, UUID> subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, planEntityRoot -> planEntityRoot.get(PlanEntity._id));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)).value(subQuery.Query));
}
if (this.referenceQuery != null) {

View File

@ -212,13 +212,13 @@ public class PlanUserQuery extends QueryBase<PlanUserEntity> {
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlan)) return null;
UUID userId = null;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe();
List<Predicate> predicates = new ArrayList<>();
if (userId != null || usePublic ) {
predicates.add(queryContext.CriteriaBuilder.or(
usePublic ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPublicDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, usePublic)) : queryContext.CriteriaBuilder.or(), //Creates a false query
userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query
usePublic ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPublicPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, usePublic)) : queryContext.CriteriaBuilder.or(), //Creates a false query
userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPlanUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query
));
}
if (!predicates.isEmpty()) {

View File

@ -166,7 +166,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
return this;
}
public ReferenceQuery dmpReferenceSubQuery(PlanReferenceQuery value) {
public ReferenceQuery planReferenceSubQuery(PlanReferenceQuery value) {
this.planReferenceQuery = value;
return this;
}
@ -224,7 +224,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
return null;
UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated))
if (this.authorize.contains(AuthorizationFlags.PlanAssociated))
userId = this.userScope.getUserIdSafe();
else
userId = null;
@ -239,7 +239,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
.criteriaBuilder(queryContext.CriteriaBuilder)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanReferenceEntity._referenceId))
.filterFunc((subQueryRoot, cb) ->
cb.in(subQueryRoot.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))
cb.in(subQueryRoot.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))
)
))),
queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DescriptionReferenceEntity.class, UUID.class)

View File

@ -199,7 +199,7 @@ public class TagQuery extends QueryBase<TagEntity> {
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseTag)) return null;
UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe();
else userId = null;
List<Predicate> predicates = new ArrayList<>();

View File

@ -188,7 +188,7 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
.criteriaBuilder(queryContext.CriteriaBuilder)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId))
.filterFunc((subQueryRoot, cb) ->
cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false))
cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false))
)
)))
));

View File

@ -173,7 +173,7 @@ public class UserQuery extends QueryBase<UserEntity> {
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUser)) return null;
UUID userId;
if (this.authorize.contains(AuthorizationFlags.Owner)) userId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.DescriptionTemplateAssociated)) userId = this.userScope.getUserIdSafe();
else userId = null;
@ -188,7 +188,7 @@ public class UserQuery extends QueryBase<UserEntity> {
.criteriaBuilder(queryContext.CriteriaBuilder)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId))
.filterFunc((subQueryRoot, cb) ->
cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, finalUserId, usePublic))
cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, finalUserId, usePublic))
)
))),
queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(UserDescriptionTemplateEntity.class, UUID.class)
@ -260,15 +260,15 @@ public class UserQuery extends QueryBase<UserEntity> {
if (this.userScope.isSet()) userId = this.userScope.getUserIdSafe();
else throw new MyNotFoundException("Only user scoped allowed");
Subquery<UUID> dmpUserUserQuery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(
Subquery<UUID> planUserUserQuery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(
new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class, queryContext)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId))
.filterFunc((subQueryRoot, cb) -> cb.and(
cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false)) ,
cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false)) ,
cb.equal(subQueryRoot.get(PlanUserEntity._isActive), IsActive.Active)
))
));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(dmpUserUserQuery));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(planUserUserQuery));
}

View File

@ -166,7 +166,7 @@ public class UserSettingsQuery extends QueryBase<UserSettingsEntity> {
if (this.authorize.contains(AuthorizationFlags.None)) return null;
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUserSettings)) return null;
UUID ownerId = null;
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) ownerId = this.userScope.getUserIdSafe();
if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) ownerId = this.userScope.getUserIdSafe();
List<Predicate> predicates = new ArrayList<>();
if (ownerId != null) {

View File

@ -81,7 +81,7 @@ public class DescriptionLookup extends Lookup {
public DescriptionTemplateLookup getDescriptionTemplateSubQuery() { return this.descriptionTemplateSubQuery; }
public void setDescriptionTemplateSubQuery(DescriptionTemplateLookup dmpSubQuery) { this.descriptionTemplateSubQuery = dmpSubQuery; }
public void setDescriptionTemplateSubQuery(DescriptionTemplateLookup descriptionTemplateSubQuery) { this.descriptionTemplateSubQuery = descriptionTemplateSubQuery; }
public DescriptionReferenceLookup getDescriptionReferenceSubQuery() { return this.descriptionReferenceSubQuery; }
@ -128,7 +128,7 @@ public class DescriptionLookup extends Lookup {
if (this.like != null) query.like(this.like);
if (this.ids != null) query.ids(this.ids);
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
if (this.planSubQuery != null) query.dmpSubQuery(this.planSubQuery.enrich(queryFactory));
if (this.planSubQuery != null) query.planSubQuery(this.planSubQuery.enrich(queryFactory));
if (this.descriptionTemplateSubQuery != null) query.descriptionTemplateSubQuery(this.descriptionTemplateSubQuery.enrich(queryFactory));
if (this.descriptionReferenceSubQuery != null) query.descriptionReferenceSubQuery(this.descriptionReferenceSubQuery.enrich(queryFactory));
if (this.descriptionTagSubQuery != null) query.descriptionTagSubQuery(this.descriptionTagSubQuery.enrich(queryFactory));

View File

@ -8,7 +8,7 @@ import org.opencdmp.commons.enums.PlanStatus;
import org.opencdmp.commons.enums.PlanVersionStatus;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.elastic.query.PlanElasticQuery;
import org.opencdmp.elastic.query.InnerObjectDmpElasticQuery;
import org.opencdmp.elastic.query.InnerObjectPlanElasticQuery;
import org.opencdmp.query.PlanQuery;
import java.util.List;
@ -126,12 +126,12 @@ public class PlanLookup extends Lookup {
public PlanBlueprintLookup getPlanBlueprintSubQuery() { return this.planBlueprintSubQuery; }
public void setPlanBlueprintLookup(PlanBlueprintLookup dmpBlueprintSubQuery) { this.planBlueprintSubQuery = dmpBlueprintSubQuery; }
public void setPlanBlueprintLookup(PlanBlueprintLookup planBlueprintSubQuery) { this.planBlueprintSubQuery = planBlueprintSubQuery; }
public PlanReferenceLookup getPlanReferenceSubQuery() { return this.planReferenceSubQuery; }
public void setPlanReferenceLookup(PlanReferenceLookup dmpReferenceSubQuery) { this.planReferenceSubQuery = dmpReferenceSubQuery; }
public void setPlanReferenceLookup(PlanReferenceLookup planReferenceSubQuery) { this.planReferenceSubQuery = planReferenceSubQuery; }
public PlanQuery enrich(QueryFactory queryFactory) {
PlanQuery query = queryFactory.query(PlanQuery.class);
@ -172,8 +172,8 @@ public class PlanLookup extends Lookup {
return query;
}
public InnerObjectDmpElasticQuery enrichElasticInner(QueryFactory queryFactory) {
InnerObjectDmpElasticQuery query = queryFactory.query(InnerObjectDmpElasticQuery.class);
public InnerObjectPlanElasticQuery enrichElasticInner(QueryFactory queryFactory) {
InnerObjectPlanElasticQuery query = queryFactory.query(InnerObjectPlanElasticQuery.class);
if (this.like != null) query.like(StringUtils.strip(this.like, "%"));
if (this.ids != null) query.ids(this.ids);
if (this.groupIds != null) query.groupIds(this.groupIds);
@ -183,7 +183,7 @@ public class PlanLookup extends Lookup {
if (this.versions != null) query.versions(this.versions);
if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses);
if (this.planDescriptionTemplateSubQuery != null) throw new UnsupportedOperationException("");
if (this.planUserSubQuery != null) query.dmpSubQuery(this.planUserSubQuery.enrichElasticInner(queryFactory));
if (this.planUserSubQuery != null) query.planSubQuery(this.planUserSubQuery.enrichElasticInner(queryFactory));
// TODO ??
return query;
}

View File

@ -7,19 +7,19 @@ import java.util.UUID;
public interface QueryUtilsService {
<Key, D> Subquery<Key> buildSubQuery(BuildSubQueryInput<D, Key> parameters);
Subquery<UUID> buildDmpAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic);
Subquery<UUID> buildPlanAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic);
Subquery<UUID> buildUserDescriptionTemplateEntityAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, UUID userId);
Subquery<UUID> buildDescriptionAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic);
Subquery<UUID> buildPublicDmpAuthZSubQuery(AbstractQuery<?> query,
CriteriaBuilder criteriaBuilder,
Boolean usePublic);
Subquery<UUID> buildPublicPlanAuthZSubQuery(AbstractQuery<?> query,
CriteriaBuilder criteriaBuilder,
Boolean usePublic);
Subquery<UUID> buildDmpUserAuthZSubQuery(AbstractQuery<?> query,
CriteriaBuilder criteriaBuilder,
UUID userId);
Subquery<UUID> buildPlanUserAuthZSubQuery(AbstractQuery<?> query,
CriteriaBuilder criteriaBuilder,
UUID userId);
Predicate ilike(CriteriaBuilder criteriaBuilder, Expression<String> path, String value);
}

View File

@ -26,7 +26,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService {
}
@Override
public Subquery<UUID> buildDmpAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic){
public Subquery<UUID> buildPlanAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic){
return this.buildSubQuery(new BuildSubQueryInput<>(
new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class)
.query(query)
@ -38,7 +38,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService {
cb.equal(subQueryRoot.get(PlanEntity._status), PlanStatus.Finalized),
cb.equal(subQueryRoot.get(PlanEntity._isActive), IsActive.Active)
): cb.or(), //Creates a false query
userId != null ? cb.in(subQueryRoot.get(PlanEntity._id)).value(this.buildDmpUserAuthZSubQuery(query, criteriaBuilder, userId)) : cb.or() //Creates a false query
userId != null ? cb.in(subQueryRoot.get(PlanEntity._id)).value(this.buildPlanUserAuthZSubQuery(query, criteriaBuilder, userId)) : cb.or() //Creates a false query
)
)
));
@ -71,12 +71,12 @@ public class QueryUtilsServiceImpl implements QueryUtilsService {
usePublic ? cb.and(
cb.equal(subQueryRoot.get(DescriptionEntity._status), DescriptionStatus.Finalized),
cb.equal(subQueryRoot.get(DescriptionEntity._isActive), IsActive.Active),
cb.in(subQueryRoot.get(DescriptionEntity._planId)).value(this.buildPublicDmpAuthZSubQuery(query, criteriaBuilder, usePublic))
cb.in(subQueryRoot.get(DescriptionEntity._planId)).value(this.buildPublicPlanAuthZSubQuery(query, criteriaBuilder, usePublic))
): cb.or(), //Creates a false query
userId != null ?
cb.or(
cb.equal(subQueryRoot.get(DescriptionEntity._createdById), userId),
cb.in(subQueryRoot.get(DescriptionEntity._planId)).value(this.buildDmpUserAuthZSubQuery(query, criteriaBuilder, userId))
cb.in(subQueryRoot.get(DescriptionEntity._planId)).value(this.buildPlanUserAuthZSubQuery(query, criteriaBuilder, userId))
) : cb.or() //Creates a false query
)
)
@ -84,7 +84,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService {
}
@Override
public Subquery<UUID> buildPublicDmpAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, Boolean usePublic){
public Subquery<UUID> buildPublicPlanAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, Boolean usePublic){
return this.buildSubQuery(new BuildSubQueryInput<>(
new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class)
.query(query)
@ -101,7 +101,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService {
}
@Override
public Subquery<UUID> buildDmpUserAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, UUID userId){
public Subquery<UUID> buildPlanUserAuthZSubQuery(AbstractQuery<?> query, CriteriaBuilder criteriaBuilder, UUID userId){
return this.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class)
.query(query)
.criteriaBuilder(criteriaBuilder)

View File

@ -104,7 +104,7 @@ public class ActionConfirmationServiceImpl implements ActionConfirmationService
data.setExpiresAt(model.getExpiresAt());
switch (model.getType()){
case MergeAccount -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildMergeAccountConfirmationEntity(model.getMergeAccountConfirmation())));
case PlanInvitation -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildDmpInvitationEntity(model.getPlanInvitation())));
case PlanInvitation -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildPlanInvitationEntity(model.getPlanInvitation())));
case RemoveCredential -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildMergeAccountConfirmationEntity(model.getRemoveCredentialRequest())));
case UserInviteToTenant -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildUserInviteToTenantRequestEntity(model.getUserInviteToTenantRequest())));
default -> throw new InternalError("unknown type: " + model.getType());
@ -119,7 +119,7 @@ public class ActionConfirmationServiceImpl implements ActionConfirmationService
return this.builderFactory.builder(ActionConfirmationBuilder.class).build(BaseFieldSet.build(fields, ActionConfirmation._id), data);
}
private @NotNull PlanInvitationEntity buildDmpInvitationEntity(PlanInvitationPersist persist){
private @NotNull PlanInvitationEntity buildPlanInvitationEntity(PlanInvitationPersist persist){
PlanInvitationEntity data = new PlanInvitationEntity();
if (persist == null) return data;

View File

@ -83,14 +83,14 @@ public class DashboardServiceImpl implements DashboardService {
}
}
PlanLookup planLookup = model.asDmpLookup();
PlanLookup planLookup = model.asPlanLookup();
if (planLookup != null){
planLookup.getPage().setOffset(0);
planLookup.getPage().setSize(model.getPage().getSize()+model.getPage().getOffset());
QueryResult<Plan> dmps = this.elasticQueryHelperService.collect(planLookup, AuthorizationFlags.AllExceptPublic, new BaseFieldSet().ensure(Plan._id).ensure(Plan._updatedAt).ensure(Plan._label).ensure(Plan._status));
if (!this.conventionService.isListNullOrEmpty(dmps.getItems())) {
for (Plan plan : dmps.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Plan, plan.getId(), plan.getUpdatedAt(), plan.getLabel(), plan.getStatus().getValue()));
QueryResult<Plan> plans = this.elasticQueryHelperService.collect(planLookup, AuthorizationFlags.AllExceptPublic, new BaseFieldSet().ensure(Plan._id).ensure(Plan._updatedAt).ensure(Plan._label).ensure(Plan._status));
if (!this.conventionService.isListNullOrEmpty(plans.getItems())) {
for (Plan plan : plans.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Plan, plan.getId(), plan.getUpdatedAt(), plan.getLabel(), plan.getStatus().getValue()));
}
}
@ -120,16 +120,16 @@ public class DashboardServiceImpl implements DashboardService {
if (cacheValue == null || cacheValue.getDashboardStatistics() == null) {
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).versionStatuses(PlanVersionStatus.Current).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public);
DashboardStatistics statistics = new DashboardStatistics();
statistics.setDmpCount(planQuery.authorize(EnumSet.of(Public)).count());
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(planQuery).statuses(DescriptionStatus.Finalized).authorize(EnumSet.of(Public)).count());
statistics.setPlanCount(planQuery.authorize(EnumSet.of(Public)).count());
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(planQuery).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).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(EnumSet.of(Public))
.dmpReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active)
.dmpSubQuery(planQuery)).count());
.planReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active)
.planSubQuery(planQuery)).count());
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);
}
@ -149,23 +149,23 @@ 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) {
PlanUserQuery dmpUserLookup = this.queryFactory.query(PlanUserQuery.class).disableTracking();
dmpUserLookup.userIds(this.userScope.getUserId());
dmpUserLookup.isActives(IsActive.Active);
PlanUserQuery planUserLookup = this.queryFactory.query(PlanUserQuery.class).disableTracking();
planUserLookup.userIds(this.userScope.getUserId());
planUserLookup.isActives(IsActive.Active);
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).planUserSubQuery(dmpUserLookup).versionStatuses(List.of(PlanVersionStatus.Current, PlanVersionStatus.NotFinalized));
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).planUserSubQuery(planUserLookup).versionStatuses(List.of(PlanVersionStatus.Current, PlanVersionStatus.NotFinalized));
DashboardStatistics statistics = new DashboardStatistics();
statistics.setDmpCount(planQuery.authorize(AuthorizationFlags.AllExceptPublic).count());
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(planQuery).authorize(AuthorizationFlags.AllExceptPublic).count());
statistics.setPlanCount(planQuery.authorize(AuthorizationFlags.AllExceptPublic).count());
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(planQuery).authorize(AuthorizationFlags.AllExceptPublic).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).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(AuthorizationFlags.AllExceptPublic)
.dmpReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active)
.dmpSubQuery(planQuery)).count());
.planReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active)
.planSubQuery(planQuery)).count());
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);
}

View File

@ -292,8 +292,8 @@ public class DepositServiceImpl implements DepositService {
accessToken = this.authenticate(authenticateRequest);
}
org.opencdmp.model.file.FileEnvelope pdfFile = this.fileTransformerService.exportDmp(planEntity.getId(), source.getPdfTransformerId(),"pdf");
org.opencdmp.model.file.FileEnvelope rda = this.fileTransformerService.exportDmp(planEntity.getId(), source.getRdaTransformerId(),"json");
org.opencdmp.model.file.FileEnvelope pdfFile = this.fileTransformerService.exportPlan(planEntity.getId(), source.getPdfTransformerId(),"pdf");
org.opencdmp.model.file.FileEnvelope rda = this.fileTransformerService.exportPlan(planEntity.getId(), source.getRdaTransformerId(),"json");
FileEnvelopeModel pdfEnvelope = new FileEnvelopeModel();
FileEnvelopeModel jsonEnvelope = new FileEnvelopeModel();
@ -329,31 +329,31 @@ public class DepositServiceImpl implements DepositService {
}
private void sendNotification(PlanEntity planEntity) throws InvalidApplicationException {
List<PlanUserEntity> dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planEntity.getId()).isActives(IsActive.Active).collect();
if (this.conventionService.isListNullOrEmpty(dmpUsers)){
throw new MyNotFoundException("Dmp does not have Users");
List<PlanUserEntity> planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planEntity.getId()).isActives(IsActive.Active).collect();
if (this.conventionService.isListNullOrEmpty(planUsers)){
throw new MyNotFoundException("Plan does not have Users");
}
List<UserEntity> users = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUsers.stream().map(PlanUserEntity::getUserId).collect(Collectors.toList())).isActive(IsActive.Active).collect();
List<UserEntity> users = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUsers.stream().map(PlanUserEntity::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()))){
this.createDmpDepositNotificationEvent(planEntity, user);
if (!user.getId().equals(this.userScope.getUserIdSafe()) && !this.conventionService.isListNullOrEmpty(planUsers.stream().filter(x -> x.getUserId().equals(user.getId())).collect(Collectors.toList()))){
this.createPlanDepositNotificationEvent(planEntity, user);
}
}
}
private void createDmpDepositNotificationEvent(PlanEntity dmp, UserEntity user) throws InvalidApplicationException {
private void createPlanDepositNotificationEvent(PlanEntity plan, UserEntity user) throws InvalidApplicationException {
NotifyIntegrationEvent event = new NotifyIntegrationEvent();
event.setUserId(user.getId());
event.setNotificationType(this.notificationProperties.getDmpDepositType());
event.setNotificationType(this.notificationProperties.getPlanDepositType());
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).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()));
fieldInfoList.add(new FieldInfo("{name}", DataType.String, plan.getLabel()));
fieldInfoList.add(new FieldInfo("{id}", DataType.String, plan.getId().toString()));
if(this.tenantScope.getTenantCode() != null && !this.tenantScope.getTenantCode().equals(this.tenantScope.getDefaultTenantCode())){
fieldInfoList.add(new FieldInfo("{tenant-url-path}", DataType.String, String.format("/t/%s", this.tenantScope.getTenantCode())));

View File

@ -218,8 +218,8 @@ public class DescriptionServiceImpl implements DescriptionService {
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
if (data.getStatus().equals(DescriptionStatus.Finalized)) throw new MyValidationException(this.errors.getDescriptionIsFinalized().getCode(), this.errors.getDescriptionIsFinalized().getMessage());
if (!data.getPlanId().equals(model.getPlanId())) throw new MyValidationException(this.errors.getDmpCanNotChange().getCode(), this.errors.getDmpCanNotChange().getMessage());
if (!data.getPlanDescriptionTemplateId().equals(model.getPlanDescriptionTemplateId())) throw new MyValidationException(this.errors.getDmpDescriptionTemplateCanNotChange().getCode(), this.errors.getDmpDescriptionTemplateCanNotChange().getMessage());
if (!data.getPlanId().equals(model.getPlanId())) throw new MyValidationException(this.errors.getPlanCanNotChange().getCode(), this.errors.getPlanCanNotChange().getMessage());
if (!data.getPlanDescriptionTemplateId().equals(model.getPlanDescriptionTemplateId())) throw new MyValidationException(this.errors.getPlanDescriptionTemplateCanNotChange().getCode(), this.errors.getPlanDescriptionTemplateCanNotChange().getMessage());
} else {
data = new DescriptionEntity();
data.setId(UUID.randomUUID());
@ -238,7 +238,7 @@ public class DescriptionServiceImpl implements DescriptionService {
PlanEntity plan = this.entityManager.find(PlanEntity.class, data.getPlanId(), true);
if (plan == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (plan.getStatus().equals(PlanStatus.Finalized) && isUpdate) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage());
if (plan.getStatus().equals(PlanStatus.Finalized) && isUpdate) throw new MyValidationException(this.errors.getPlanIsFinalized().getCode(), this.errors.getPlanIsFinalized().getMessage());
data.setLabel(model.getLabel());
data.setStatus(model.getStatus());
@ -337,7 +337,7 @@ public class DescriptionServiceImpl implements DescriptionService {
for (PlanUserEntity planUser : existingUsers) {
if (!planUser.getUserId().equals(this.userScope.getUserIdSafe())){
UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUser.getUserId()).first();
if (user == null || user.getIsActive().equals(IsActive.Inactive)) throw new MyValidationException(this.errors.getDmpInactiveUser().getCode(), this.errors.getDmpInactiveUser().getMessage());
if (user == null || user.getIsActive().equals(IsActive.Inactive)) throw new MyValidationException(this.errors.getPlanInactiveUser().getCode(), this.errors.getPlanInactiveUser().getMessage());
this.createDescriptionNotificationEvent(description, user, isUpdate);
}
}
@ -437,7 +437,7 @@ public class DescriptionServiceImpl implements DescriptionService {
this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(model.getId())), Permission.FinalizeDescription);
PlanEntity planEntity = this.entityManager.find(PlanEntity.class, data.getPlanId(), true);
if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getPlanId(), PlanEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if(!planEntity.getStatus().equals(PlanStatus.Draft)) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage());
if(!planEntity.getStatus().equals(PlanStatus.Draft)) throw new MyValidationException(this.errors.getPlanIsFinalized().getCode(), this.errors.getPlanIsFinalized().getMessage());
}
data.setStatus(model.getStatus());
@ -548,7 +548,7 @@ public class DescriptionServiceImpl implements DescriptionService {
}
else if (FieldType.isTextListType(fieldType)) {
List<UUID> ids = new ArrayList<>();
if (FieldType.INTERNAL_ENTRIES_DMPS.equals(fieldType)) {
if (FieldType.INTERNAL_ENTRIES_PLANS.equals(fieldType)) {
if (!this.conventionService.isListNullOrEmpty(persist.getTextListValue())) ids = persist.getTextListValue().stream().map(UUID::fromString).toList();
else if (!this.conventionService.isNullOrEmpty(persist.getTextValue())) ids.add(UUID.fromString(persist.getTextValue()));
@ -877,7 +877,7 @@ public class DescriptionServiceImpl implements DescriptionService {
@Override
public StorageFile uploadFieldFile(DescriptionFieldFilePersist model, MultipartFile file, FieldSet fields) throws IOException {
//this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.CloneDescription);
this.authorizationService.authorizeForce(Permission.EditDescription);//TODO: Missing Description or dmp for authz
this.authorizationService.authorizeForce(Permission.EditDescription);//TODO: Missing Description or plan for authz
DescriptionTemplateEntity descriptionTemplate = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().ids(model.getDescriptionTemplateId()).authorize(AuthorizationFlags.AllExceptPublic).first();
if (descriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
@ -930,8 +930,8 @@ public class DescriptionServiceImpl implements DescriptionService {
if (!planEntity.getAccessType().equals(PlanAccessType.Public))
{
boolean isDmpUser = this.queryFactory.query(PlanUserQuery.class).planIds(planEntity.getId()).disableTracking().userIds(this.userScope.getUserIdSafe()).isActives(IsActive.Active).count() > 0;
if (!isDmpUser) throw new MyUnauthorizedException();
boolean isPlanUser = this.queryFactory.query(PlanUserQuery.class).planIds(planEntity.getId()).disableTracking().userIds(this.userScope.getUserIdSafe()).isActives(IsActive.Active).count() > 0;
if (!isPlanUser) throw new MyUnauthorizedException();
}
StorageFileEntity storageFile = this.queryFactory.query(StorageFileQuery.class).disableTracking().ids(storageFileId).first();

View File

@ -409,7 +409,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
if (FieldType.isTextType(fieldType) || FieldType.isTextListType(fieldType)) {
if (FieldType.UPLOAD.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("Upload not supported");
if (FieldType.INTERNAL_ENTRIES_DMPS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("dmps not supported");
if (FieldType.INTERNAL_ENTRIES_PLANS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("plans not supported");
if (FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("descriptions not supported");
data.setTextValue(persist.getTextValue());
@ -434,7 +434,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
if (FieldType.isTextType(fieldType) || FieldType.isTextListType(fieldType)) {
if (FieldType.UPLOAD.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("Upload not supported");
if (FieldType.INTERNAL_ENTRIES_DMPS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("dmps not supported");
if (FieldType.INTERNAL_ENTRIES_PLANS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("plans not supported");
if (FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("descriptions not supported");
data.setTextValue(persist.getTextValue());
@ -628,7 +628,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
if (latestVersionDescriptionTemplates.isEmpty())
throw new MyValidationException(this.errors.getDescriptionTemplateIsNotFinalized().getCode(), this.errors.getDescriptionTemplateIsNotFinalized().getMessage());
if (latestVersionDescriptionTemplates.size() > 1)
throw new MyValidationException(this.errors.getMultipleDmpVersionsNotSupported().getCode(), this.errors.getMultipleDmpVersionsNotSupported().getMessage());
throw new MyValidationException(this.errors.getMultiplePlanVersionsNotSupported().getCode(), this.errors.getMultiplePlanVersionsNotSupported().getMessage());
if (!latestVersionDescriptionTemplates.getFirst().getVersion().equals(oldDescriptionTemplateEntity.getVersion()))
throw new MyValidationException(this.errors.getDescriptionTemplateNewVersionConflict().getCode(), this.errors.getDescriptionTemplateNewVersionConflict().getMessage());
Long notFinalizedCount = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking()
@ -1187,7 +1187,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
case SELECT -> fieldType = FieldType.SELECT;
case BOOLEAN_DECISION -> fieldType = FieldType.BOOLEAN_DECISION;
case RADIO_BOX -> fieldType = FieldType.RADIO_BOX;
case INTERNAL_ENTRIES_DMPS -> fieldType = FieldType.INTERNAL_ENTRIES_DMPS;
case INTERNAL_ENTRIES_DMPS -> fieldType = FieldType.INTERNAL_ENTRIES_PLANS;
case INTERNAL_ENTRIES_DESCRIPTIONS -> fieldType = FieldType.INTERNAL_ENTRIES_DESCRIPTIONS;
case CHECK_BOX -> fieldType = FieldType.CHECK_BOX;
case FREE_TEXT -> fieldType = FieldType.FREE_TEXT;

View File

@ -5,17 +5,17 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "app-elastic")
public class AppElasticProperties {
private boolean enabled;
private String dmpIndexName;
private String planIndexName;
private String descriptionIndexName;
private int resetBatchSize;
private boolean enableIcuAnalysisPlugin;
public String getDmpIndexName() {
return this.dmpIndexName;
public String getPlanIndexName() {
return this.planIndexName;
}
public void setDmpIndexName(String dmpIndexName) {
this.dmpIndexName = dmpIndexName;
public void setPlanIndexName(String planIndexName) {
this.planIndexName = planIndexName;
}
public boolean isEnableIcuAnalysisPlugin() {

View File

@ -18,9 +18,9 @@ public interface ElasticService {
void ensureIndexes() throws IOException;
void persistPlan(PlanEntity dmp) throws IOException;
void persistPlan(PlanEntity plan) throws IOException;
void deletePlan(PlanEntity dmp) throws IOException;
void deletePlan(PlanEntity plan) throws IOException;
void persistDescription(DescriptionEntity description) throws IOException, InvalidApplicationException;

View File

@ -74,7 +74,7 @@ public class ElasticServiceImpl implements ElasticService {
@Override
public boolean existsPlanIndex() throws IOException {
if (!this.enabled()) return false;
return this.restHighLevelClient.indices().exists(new ExistsRequest.Builder().index(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()).includeDefaults(true).build()).value();
return this.restHighLevelClient.indices().exists(new ExistsRequest.Builder().index(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()).includeDefaults(true).build()).value();
}
@ -92,7 +92,7 @@ public class ElasticServiceImpl implements ElasticService {
boolean exists = this.existsPlanIndex();
if (exists) return ;
this.ensureIndex(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName(), this.createDmpTemplatePropertyMap());
this.ensureIndex(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName(), this.createPlanTemplatePropertyMap());
}
@Override
@ -144,11 +144,11 @@ public class ElasticServiceImpl implements ElasticService {
propertyMap.put(DescriptionElasticEntity._tags, new Property.Builder().nested(x -> x.properties(this.createNestedTagsTemplatePropertyMap())).build());
propertyMap.put(DescriptionElasticEntity._references, new Property.Builder().nested(x -> x.properties(this.createNestedReferencesTemplatePropertyMap())).build());
propertyMap.put(DescriptionElasticEntity._descriptionTemplate, new Property.Builder().object(x -> x.properties(this.createNestedDescriptionTemplateTemplatePropertyMap())).build());
propertyMap.put(DescriptionElasticEntity._dmp, new Property.Builder().object(x -> x.properties(this.createNetsedDmpTemplatePropertyMap())).build());
propertyMap.put(DescriptionElasticEntity._plan, new Property.Builder().object(x -> x.properties(this.createNetsedPlanTemplatePropertyMap())).build());
return propertyMap;
}
private Map<String, Property> createDmpTemplatePropertyMap(){
private Map<String, Property> createPlanTemplatePropertyMap(){
Map<String, Property> propertyMap = new HashMap<>();
propertyMap.put(PlanElasticEntity._id, this.createElastic(FieldType.Keyword, false));
propertyMap.put(PlanElasticEntity._tenantId, this.createElastic(FieldType.Keyword, false));
@ -166,19 +166,19 @@ public class ElasticServiceImpl implements ElasticService {
propertyMap.put(PlanElasticEntity._versionStatus, this.createElastic(FieldType.Short, false));
propertyMap.put(PlanElasticEntity._descriptions, new Property.Builder().nested(x -> x.properties(this.createNestedDescriptionTemplatePropertyMap())).build());
propertyMap.put(PlanElasticEntity._dmpDescriptionTemplates, new Property.Builder().nested(x -> x.properties(this.createNestedDmpDescriptionTemplateElasticEntityPropertyMap())).build());
propertyMap.put(PlanElasticEntity._planDescriptionTemplates, new Property.Builder().nested(x -> x.properties(this.createNestedPlanDescriptionTemplateElasticEntityPropertyMap())).build());
propertyMap.put(PlanElasticEntity._references, new Property.Builder().nested(x -> x.properties(this.createNestedReferencesTemplatePropertyMap())).build());
propertyMap.put(PlanElasticEntity._collaborators, new Property.Builder().nested(x -> x.properties(this.createNestedCollaboratorTemplatePropertyMap())).build());
propertyMap.put(PlanElasticEntity._dois, new Property.Builder().nested(x -> x.properties(this.createNestedDoisTemplatePropertyMap())).build());
return propertyMap;
}
private Map<String, Property> createNestedDmpDescriptionTemplateElasticEntityPropertyMap(){
private Map<String, Property> createNestedPlanDescriptionTemplateElasticEntityPropertyMap(){
Map<String, Property> propertyMap = new HashMap<>();
propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._id, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._sectionId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._dmpId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._planId, this.createElastic(FieldType.Keyword, false));
return propertyMap;
}
@ -187,7 +187,7 @@ public class ElasticServiceImpl implements ElasticService {
Map<String, Property> propertyMap = new HashMap<>();
propertyMap.put(NestedDescriptionElasticEntity._id, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedDescriptionElasticEntity._label, this.createElastic(FieldType.Text, true));
propertyMap.put(NestedDescriptionElasticEntity._dmpId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedDescriptionElasticEntity._planId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedDescriptionElasticEntity._description, this.createElastic(FieldType.Text, true));
propertyMap.put(NestedDescriptionElasticEntity._status, this.createElastic(FieldType.Short, false));
propertyMap.put(NestedDescriptionElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false));
@ -225,7 +225,7 @@ public class ElasticServiceImpl implements ElasticService {
return propertyMap;
}
private Map<String, Property> createNetsedDmpTemplatePropertyMap(){
private Map<String, Property> createNetsedPlanTemplatePropertyMap(){
Map<String, Property> propertyMap = new HashMap<>();
propertyMap.put(NestedPlanElasticEntity._id, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedPlanElasticEntity._label, this.createElastic(FieldType.Text, true));
@ -289,24 +289,24 @@ public class ElasticServiceImpl implements ElasticService {
//region persist delete
@Override
public void persistPlan(PlanEntity dmp) throws IOException {
public void persistPlan(PlanEntity plan) throws IOException {
if (!this.enabled()) return;
this.ensureIndexes();
PlanElasticEntity planElasticEntity = this.builderFactory.builder(PlanElasticBuilder.class).build(dmp);
this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()));
List<DescriptionElasticEntity> descriptions = this.builderFactory.builder(DescriptionElasticBuilder.class).build(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(this.queryFactory.query(PlanQuery.class).ids(dmp.getId())).collect());
PlanElasticEntity planElasticEntity = this.builderFactory.builder(PlanElasticBuilder.class).build(plan);
this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()));
List<DescriptionElasticEntity> descriptions = this.builderFactory.builder(DescriptionElasticBuilder.class).build(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(this.queryFactory.query(PlanQuery.class).ids(plan.getId())).collect());
this.elasticsearchTemplate.save(descriptions, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDescriptionIndexName()));
}
@Override
public void deletePlan(PlanEntity dmp) throws IOException {
public void deletePlan(PlanEntity plan) throws IOException {
if (!this.enabled()) return;
this.ensureIndexes();
PlanElasticEntity planElasticEntity = this.elasticsearchTemplate.get(dmp.getId().toString(), PlanElasticEntity.class, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()));
PlanElasticEntity planElasticEntity = this.elasticsearchTemplate.get(plan.getId().toString(), PlanElasticEntity.class, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()));
if (planElasticEntity == null) return;
this.elasticsearchTemplate.delete(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()));
List<DescriptionEntity> descriptions = this.queryFactory.query(DescriptionQuery.class).dmpSubQuery(this.queryFactory.query(PlanQuery.class).disableTracking().ids(dmp.getId())).collectAs(new BaseFieldSet().ensure(Description._id));
this.elasticsearchTemplate.delete(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()));
List<DescriptionEntity> descriptions = this.queryFactory.query(DescriptionQuery.class).planSubQuery(this.queryFactory.query(PlanQuery.class).disableTracking().ids(plan.getId())).collectAs(new BaseFieldSet().ensure(Description._id));
for (DescriptionEntity description: descriptions) {
DescriptionElasticEntity descriptionElasticEntity = this.elasticsearchTemplate.get(description.getId().toString(), DescriptionElasticEntity.class, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDescriptionIndexName()));
if (descriptionElasticEntity == null) continue;
@ -325,7 +325,7 @@ public class ElasticServiceImpl implements ElasticService {
if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{description.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (planEntity.getIsActive().equals(IsActive.Active)) {
PlanElasticEntity planElasticEntity = this.builderFactory.builder(PlanElasticBuilder.class).build(planEntity);
this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()));
this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()));
}
}
@ -342,7 +342,7 @@ public class ElasticServiceImpl implements ElasticService {
if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{description.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (planEntity.getIsActive().equals(IsActive.Active)) {
PlanElasticEntity planElasticEntity = this.builderFactory.builder(PlanElasticBuilder.class).build(planEntity);
this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()));
this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()));
}
}
@ -352,14 +352,14 @@ public class ElasticServiceImpl implements ElasticService {
@Override
public void deletePlanIndex() throws IOException {
logger.debug(new MapLogEntry("delete dmp index"));
logger.debug(new MapLogEntry("delete plan index"));
this.authorizationService.authorizeForce(Permission.ManageElastic);
if (!this.enabled()) return;
boolean exists = this.existsPlanIndex();
if (!exists) return ;
this.restHighLevelClient.indices().delete(new DeleteIndexRequest.Builder().index(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()).build());
this.restHighLevelClient.indices().delete(new DeleteIndexRequest.Builder().index(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()).build());
}
@Override
@ -375,7 +375,7 @@ public class ElasticServiceImpl implements ElasticService {
@Override
public void resetPlanIndex() throws IOException, InvalidApplicationException {
logger.debug(new MapLogEntry("reset dmp index"));
logger.debug(new MapLogEntry("reset plan index"));
this.authorizationService.authorizeForce(Permission.ManageElastic);
if (!this.enabled()) return;
@ -395,7 +395,7 @@ public class ElasticServiceImpl implements ElasticService {
items = query.collect();
if (items != null && !items.isEmpty()) {
List<PlanElasticEntity> elasticEntities = this.builderFactory.builder(PlanElasticBuilder.class).build(items);
this.elasticsearchTemplate.save(elasticEntities, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()));
this.elasticsearchTemplate.save(elasticEntities, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()));
page++;
}
} while (items != null && !items.isEmpty());

View File

@ -96,7 +96,7 @@ public class EntityDoiServiceImpl implements EntityDoiService {
data.setCreatedAt(Instant.now());
}
data.setEntityType(EntityType.DMP);
data.setEntityType(EntityType.Plan);
data.setEntityId(model.getEntityId());
data.setRepositoryId(model.getRepositoryId());
data.setDoi(model.getDoi());

View File

@ -16,7 +16,7 @@ public class FieldDataHelperServiceProvider {
switch (type) {
case INTERNAL_ENTRIES_DESCRIPTIONS:
case INTERNAL_ENTRIES_DMPS: {
case INTERNAL_ENTRIES_PLANS: {
item = this.applicationContext.getBean(LabelAndMultiplicityFieldDataHelperService.class);
break;
}

View File

@ -20,11 +20,11 @@ import java.util.UUID;
public interface FileTransformerService {
List<RepositoryFileFormat> getAvailableExportFileFormats() throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException;
org.opencdmp.model.file.FileEnvelope exportDmp(UUID dmpId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException;
org.opencdmp.model.file.FileEnvelope exportPlan(UUID planId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException;
org.opencdmp.model.file.FileEnvelope exportDescription(UUID descriptionId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException;
DmpModel importDmp(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException;
DmpModel importPlan(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException;
PreprocessingDmpModel preprocessingDmp(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException;
PreprocessingDmpModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException;
}

Some files were not shown because too many files have changed in this diff Show More