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

This commit is contained in:
Sofia Papacharalampous 2024-07-05 14:21:23 +03:00
commit 6856561583
167 changed files with 871 additions and 873 deletions

View File

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

View File

@ -7,9 +7,9 @@ public final class Permission {
//Public //Public
public static String PublicBrowseDescription = "PublicBrowseDescription"; public static String PublicBrowseDescription = "PublicBrowseDescription";
public static String PublicBrowseDescriptionTemplate = "PublicBrowseDescriptionTemplate"; public static String PublicBrowseDescriptionTemplate = "PublicBrowseDescriptionTemplate";
public static String PublicBrowseDmp = "PublicBrowseDmp"; public static String PublicBrowsePlan = "PublicBrowsePlan";
public static String PublicBrowseDmpReference = "PublicBrowseDmpReference"; public static String PublicBrowsePlanReference = "PublicBrowsePlanReference";
public static String PublicBrowseDmpUser = "PublicBrowseDmpUser"; public static String PublicBrowsePlanUser = "PublicBrowsePlanUser";
public static String PublicBrowseReference = "PublicBrowseReference"; public static String PublicBrowseReference = "PublicBrowseReference";
public static String PublicBrowseUser = "PublicBrowseUser"; public static String PublicBrowseUser = "PublicBrowseUser";
public static String PublicBrowseDashboardStatistics = "PublicBrowseDashboardStatistics"; public static String PublicBrowseDashboardStatistics = "PublicBrowseDashboardStatistics";
@ -223,7 +223,7 @@ public final class Permission {
public static String ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage"; public static String ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage";
public static String ViewPlanBlueprintPage = "ViewPlanBlueprintPage"; public static String ViewPlanBlueprintPage = "ViewPlanBlueprintPage";
public static String ViewPublicDescriptionPage = "ViewPublicDescriptionPage"; public static String ViewPublicDescriptionPage = "ViewPublicDescriptionPage";
public static String ViewPublicDmpPage = "ViewPublicDmpPage"; public static String ViewPublicPlanPage = "ViewPublicPlanPage";
public static String ViewMyDescriptionPage = "ViewMyDescriptionPage"; public static String ViewMyDescriptionPage = "ViewMyDescriptionPage";
public static String ViewMyPlanPage = "ViewMyPlanPage"; public static String ViewMyPlanPage = "ViewMyPlanPage";
public static String ViewHomePage = "ViewHomePage"; 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()); List<UUID> idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, PlanEntity.class.getSimpleName());
if (idsToResolve.isEmpty()) return affiliatedResources; if (idsToResolve.isEmpty()) return affiliatedResources;
List<PlanUserEntity> dmpUsers; List<PlanUserEntity> planUsers;
try { try {
this.tenantEntityManager.loadExplictTenantFilters(); 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) { } catch (InvalidApplicationException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage()); throw new MyApplicationException(e.getMessage());
@ -82,8 +82,8 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
throw new MyApplicationException(e.getMessage()); throw new MyApplicationException(e.getMessage());
} }
} }
for (PlanUserEntity dmpUser : dmpUsers){ for (PlanUserEntity planUser : planUsers){
affiliatedResources.get(dmpUser.getPlanId()).getPlanUserRoles().add(dmpUser.getRole()); affiliatedResources.get(planUser.getPlanId()).getPlanUserRoles().add(planUser.getRole());
} }
this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, PlanEntity.class.getSimpleName()); this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, PlanEntity.class.getSimpleName());
@ -123,8 +123,8 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
} }
} }
for (UserDescriptionTemplateEntity dmpUser : userDescriptionTemplates){ for (UserDescriptionTemplateEntity planUser : userDescriptionTemplates){
affiliatedResources.get(dmpUser.getDescriptionTemplateId()).getUserDescriptionTemplateRoles().add(dmpUser.getRole()); affiliatedResources.get(planUser.getDescriptionTemplateId()).getUserDescriptionTemplateRoles().add(planUser.getRole());
} }
this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, DescriptionTemplateEntity.class.getSimpleName()); 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)); Map<UUID, List<PlanUserEntity>> planUsersMap = planUsers.stream().collect(Collectors.groupingBy(PlanUserEntity::getPlanId));
for (DescriptionEntity description : descriptionEntities){ for (DescriptionEntity description : descriptionEntities){
List<PlanUserEntity> dmpDescriptionUsers = planUsersMap.getOrDefault(description.getPlanId(), new ArrayList<>()); List<PlanUserEntity> planDescriptionUsers = planUsersMap.getOrDefault(description.getPlanId(), new ArrayList<>());
for (PlanUserEntity dmpUser : dmpDescriptionUsers) { for (PlanUserEntity planUser : planDescriptionUsers) {
if (dmpUser.getSectionId() == null) affiliatedResources.get(description.getId()).getPlanUserRoles().add(dmpUser.getRole()); if (planUser.getSectionId() == null) affiliatedResources.get(description.getId()).getPlanUserRoles().add(planUser.getRole());
else { else {
PlanDescriptionTemplateEntity planDescriptionTemplateEntity = planDescriptionTemplateEntityMap.getOrDefault(description.getPlanDescriptionTemplateId(), null); PlanDescriptionTemplateEntity planDescriptionTemplateEntity = planDescriptionTemplateEntityMap.getOrDefault(description.getPlanDescriptionTemplateId(), null);
if (planDescriptionTemplateEntity != null && dmpUser.getSectionId().equals(planDescriptionTemplateEntity.getSectionId())){ if (planDescriptionTemplateEntity != null && planUser.getSectionId().equals(planDescriptionTemplateEntity.getSectionId())){
affiliatedResources.get(description.getId()).getPlanUserRoles().add(dmpUser.getRole()); 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; if (userId == null || !this.userScope.isSet()) return affiliatedResources;
List<PlanUserEntity> dmpUsers; List<PlanUserEntity> planUsers;
try { try {
this.tenantEntityManager.loadExplictTenantFilters(); 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) { } catch (InvalidApplicationException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage()); throw new MyApplicationException(e.getMessage());
@ -247,12 +247,12 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes
} }
for (UUID sectionId : sectionIds.stream().distinct().toList()){ for (UUID sectionId : sectionIds.stream().distinct().toList()){
List<PlanUserEntity> dmpSectionUsers = dmpUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList(); List<PlanUserEntity> planSectionUsers = planUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList();
for (PlanUserEntity dmpUser : dmpSectionUsers) { for (PlanUserEntity planUser : planSectionUsers) {
if (dmpUser.getSectionId() == null) affiliatedResources.get(sectionId).getPlanUserRoles().add(dmpUser.getRole()); if (planUser.getSectionId() == null) affiliatedResources.get(sectionId).getPlanUserRoles().add(planUser.getRole());
else { else {
if (dmpUser.getSectionId().equals(sectionId)){ if (planUser.getSectionId().equals(sectionId)){
affiliatedResources.get(sectionId).getPlanUserRoles().add(dmpUser.getRole()); affiliatedResources.get(sectionId).getPlanUserRoles().add(planUser.getRole());
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -70,11 +70,11 @@ public class DescriptionEntity extends TenantScopedBaseEntity {
public static final String _createdById = "createdById"; public static final String _createdById = "createdById";
@Column(name = "dmp_description_template", columnDefinition = "uuid", nullable = false) @Column(name = "plan_description_template", columnDefinition = "uuid", nullable = false)
private UUID planDescriptionTemplateId; private UUID planDescriptionTemplateId;
public static final String _planDescriptionTemplateId = "planDescriptionTemplateId"; public static final String _planDescriptionTemplateId = "planDescriptionTemplateId";
@Column(name = "dmp", columnDefinition = "uuid", nullable = false) @Column(name = "plan", columnDefinition = "uuid", nullable = false)
private UUID planId; private UUID planId;
public static final String _planId = "planId"; public static final String _planId = "planId";

View File

@ -1,21 +1,21 @@
package org.opencdmp.data; package org.opencdmp.data;
import org.opencdmp.commons.enums.PlanBlueprintStatus;
import org.opencdmp.commons.enums.PlanBlueprintVersionStatus;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.data.converters.PlanBlueprintVersionStatusConverter;
import org.opencdmp.data.converters.enums.PlanBlueprintStatusConverter;
import org.opencdmp.data.converters.enums.IsActiveConverter;
import org.opencdmp.data.tenant.TenantScopedBaseEntity;
import org.opencdmp.data.types.SQLXMLType;
import jakarta.persistence.*; import jakarta.persistence.*;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.commons.enums.PlanBlueprintStatus;
import org.opencdmp.commons.enums.PlanBlueprintVersionStatus;
import org.opencdmp.data.converters.PlanBlueprintVersionStatusConverter;
import org.opencdmp.data.converters.enums.IsActiveConverter;
import org.opencdmp.data.converters.enums.PlanBlueprintStatusConverter;
import org.opencdmp.data.tenant.TenantScopedBaseEntity;
import org.opencdmp.data.types.SQLXMLType;
import java.time.Instant; import java.time.Instant;
import java.util.UUID; import java.util.UUID;
@Entity @Entity
@Table(name = "\"DmpBlueprint\"") @Table(name = "\"PlanBlueprint\"")
public class PlanBlueprintEntity extends TenantScopedBaseEntity { public class PlanBlueprintEntity extends TenantScopedBaseEntity {
@Id @Id
@ -31,7 +31,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
public static final int _labelLength = 250; public static final int _labelLength = 250;
@Type(value = SQLXMLType.class) @Type(SQLXMLType.class)
@Column(name = "definition", columnDefinition = "xml") @Column(name = "definition", columnDefinition = "xml")
private String definition; private String definition;
@ -60,7 +60,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
public static final String _versionStatus = "versionStatus"; public static final String _versionStatus = "versionStatus";
@Column(name = "created_at", nullable = false) @Column(name = "created_at", nullable = false)
private Instant createdAt = null; private Instant createdAt;
public static final String _createdAt = "createdAt"; public static final String _createdAt = "createdAt";
@ -76,7 +76,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
public static final String _isActive = "isActive"; public static final String _isActive = "isActive";
public UUID getId() { public UUID getId() {
return id; return this.id;
} }
public void setId(UUID id) { public void setId(UUID id) {
@ -84,7 +84,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
} }
public String getLabel() { public String getLabel() {
return label; return this.label;
} }
public void setLabel(String label) { public void setLabel(String label) {
@ -92,7 +92,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
} }
public String getDefinition() { public String getDefinition() {
return definition; return this.definition;
} }
public void setDefinition(String definition) { public void setDefinition(String definition) {
@ -100,7 +100,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
} }
public PlanBlueprintStatus getStatus() { public PlanBlueprintStatus getStatus() {
return status; return this.status;
} }
public void setStatus(PlanBlueprintStatus status) { public void setStatus(PlanBlueprintStatus status) {
@ -108,7 +108,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
} }
public UUID getGroupId() { public UUID getGroupId() {
return groupId; return this.groupId;
} }
public void setGroupId(UUID groupId) { public void setGroupId(UUID groupId) {
@ -116,7 +116,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
} }
public Short getVersion() { public Short getVersion() {
return version; return this.version;
} }
public void setVersion(Short version) { public void setVersion(Short version) {
@ -124,7 +124,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
} }
public PlanBlueprintVersionStatus getVersionStatus() { public PlanBlueprintVersionStatus getVersionStatus() {
return versionStatus; return this.versionStatus;
} }
public void setVersionStatus(PlanBlueprintVersionStatus versionStatus) { public void setVersionStatus(PlanBlueprintVersionStatus versionStatus) {
@ -132,7 +132,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
} }
public Instant getCreatedAt() { public Instant getCreatedAt() {
return createdAt; return this.createdAt;
} }
public void setCreatedAt(Instant createdAt) { public void setCreatedAt(Instant createdAt) {
@ -140,7 +140,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
} }
public Instant getUpdatedAt() { public Instant getUpdatedAt() {
return updatedAt; return this.updatedAt;
} }
public void setUpdatedAt(Instant updatedAt) { public void setUpdatedAt(Instant updatedAt) {
@ -148,7 +148,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity {
} }
public IsActive getIsActive() { public IsActive getIsActive() {
return isActive; return this.isActive;
} }
public void setIsActive(IsActive isActive) { public void setIsActive(IsActive isActive) {

View File

@ -9,7 +9,7 @@ import java.time.Instant;
import java.util.UUID; import java.util.UUID;
@Entity @Entity
@Table(name = "\"DmpDescriptionTemplate\"") @Table(name = "\"PlanDescriptionTemplate\"")
public class PlanDescriptionTemplateEntity extends TenantScopedBaseEntity { public class PlanDescriptionTemplateEntity extends TenantScopedBaseEntity {
@Id @Id
@ -18,7 +18,7 @@ public class PlanDescriptionTemplateEntity extends TenantScopedBaseEntity {
public static final String _id = "id"; public static final String _id = "id";
@Column(name = "dmp", columnDefinition = "uuid", nullable = false) @Column(name = "plan", columnDefinition = "uuid", nullable = false)
private UUID planId; private UUID planId;
public static final String _planId = "planId"; public static final String _planId = "planId";

View File

@ -1,21 +1,21 @@
package org.opencdmp.data; package org.opencdmp.data;
import jakarta.persistence.*; import jakarta.persistence.*;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.commons.enums.PlanAccessType; import org.opencdmp.commons.enums.PlanAccessType;
import org.opencdmp.commons.enums.PlanStatus; import org.opencdmp.commons.enums.PlanStatus;
import org.opencdmp.commons.enums.PlanVersionStatus; import org.opencdmp.commons.enums.PlanVersionStatus;
import org.opencdmp.commons.enums.IsActive; import org.opencdmp.data.converters.enums.IsActiveConverter;
import org.opencdmp.data.converters.enums.PlanAccessTypeNullableConverter; import org.opencdmp.data.converters.enums.PlanAccessTypeNullableConverter;
import org.opencdmp.data.converters.enums.PlanStatusConverter; import org.opencdmp.data.converters.enums.PlanStatusConverter;
import org.opencdmp.data.converters.enums.PlanVersionStatusConverter; import org.opencdmp.data.converters.enums.PlanVersionStatusConverter;
import org.opencdmp.data.converters.enums.IsActiveConverter;
import org.opencdmp.data.tenant.TenantScopedBaseEntity; import org.opencdmp.data.tenant.TenantScopedBaseEntity;
import java.time.Instant; import java.time.Instant;
import java.util.UUID; import java.util.UUID;
@Entity @Entity
@Table(name = "\"Dmp\"") @Table(name = "\"Plan\"")
public class PlanEntity extends TenantScopedBaseEntity { public class PlanEntity extends TenantScopedBaseEntity {
@Id @Id

View File

@ -1,15 +1,15 @@
package org.opencdmp.data; package org.opencdmp.data;
import jakarta.persistence.*;
import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.converters.enums.IsActiveConverter;
import org.opencdmp.data.tenant.TenantScopedBaseEntity; import org.opencdmp.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant; import java.time.Instant;
import java.util.UUID; import java.util.UUID;
@Entity @Entity
@Table(name = "\"DmpReference\"") @Table(name = "\"PlanReference\"")
public class PlanReferenceEntity extends TenantScopedBaseEntity { public class PlanReferenceEntity extends TenantScopedBaseEntity {
@Id @Id
@ -17,7 +17,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity {
private UUID id; private UUID id;
public static final String _id = "id"; public static final String _id = "id";
@Column(name = "dmp_id", columnDefinition = "uuid", nullable = false) @Column(name = "plan_id", columnDefinition = "uuid", nullable = false)
private UUID planId; private UUID planId;
public static final String _planId = "planId"; public static final String _planId = "planId";
@ -43,7 +43,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity {
public static final String _isActive = "isActive"; public static final String _isActive = "isActive";
public UUID getId() { public UUID getId() {
return id; return this.id;
} }
public void setId(UUID id) { public void setId(UUID id) {
@ -51,7 +51,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity {
} }
public UUID getPlanId() { public UUID getPlanId() {
return planId; return this.planId;
} }
public void setPlanId(UUID planId) { public void setPlanId(UUID planId) {
@ -59,7 +59,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity {
} }
public UUID getReferenceId() { public UUID getReferenceId() {
return referenceId; return this.referenceId;
} }
public void setReferenceId(UUID referenceId) { public void setReferenceId(UUID referenceId) {
@ -67,7 +67,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity {
} }
public String getData() { public String getData() {
return data; return this.data;
} }
public void setData(String data) { public void setData(String data) {
@ -75,7 +75,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity {
} }
public Instant getCreatedAt() { public Instant getCreatedAt() {
return createdAt; return this.createdAt;
} }
public void setCreatedAt(Instant createdAt) { public void setCreatedAt(Instant createdAt) {
@ -83,7 +83,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity {
} }
public Instant getUpdatedAt() { public Instant getUpdatedAt() {
return updatedAt; return this.updatedAt;
} }
public void setUpdatedAt(Instant updatedAt) { public void setUpdatedAt(Instant updatedAt) {
@ -91,7 +91,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity {
} }
public IsActive getIsActive() { public IsActive getIsActive() {
return isActive; return this.isActive;
} }
public void setIsActive(IsActive isActive) { public void setIsActive(IsActive isActive) {

View File

@ -1,17 +1,17 @@
package org.opencdmp.data; package org.opencdmp.data;
import jakarta.persistence.*; import jakarta.persistence.*;
import org.opencdmp.commons.enums.PlanUserRole;
import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.data.converters.enums.PlanUserRoleConverter; import org.opencdmp.commons.enums.PlanUserRole;
import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.converters.enums.IsActiveConverter;
import org.opencdmp.data.converters.enums.PlanUserRoleConverter;
import org.opencdmp.data.tenant.TenantScopedBaseEntity; import org.opencdmp.data.tenant.TenantScopedBaseEntity;
import java.time.Instant; import java.time.Instant;
import java.util.UUID; import java.util.UUID;
@Entity @Entity
@Table(name = "\"DmpUser\"") @Table(name = "\"PlanUser\"")
public class PlanUserEntity extends TenantScopedBaseEntity { public class PlanUserEntity extends TenantScopedBaseEntity {
@Id @Id
@ -20,7 +20,7 @@ public class PlanUserEntity extends TenantScopedBaseEntity {
public static final String _id = "id"; public static final String _id = "id";
@Column(name = "dmp", columnDefinition = "uuid", nullable = false) @Column(name = "plan", columnDefinition = "uuid", nullable = false)
private UUID planId; private UUID planId;
public static final String _planId = "planId"; public static final String _planId = "planId";

View File

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

View File

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

View File

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

View File

@ -13,9 +13,9 @@ public class NestedPlanDescriptionTemplateElasticEntity {
private UUID id; private UUID id;
public final static String _id = "id"; public final static String _id = "id";
@Field(value = NestedDescriptionElasticEntity._dmpId, type = FieldType.Keyword) @Field(value = NestedDescriptionElasticEntity._planId, type = FieldType.Keyword)
private UUID planId; private UUID planId;
public final static String _dmpId = "dmpId"; public final static String _planId = "planId";
@Field(value = NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId, type = FieldType.Keyword) @Field(value = NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId, type = FieldType.Keyword)
private UUID descriptionTemplateGroupId; 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 (referenceElasticEntityMap != null) m.setReferences(referenceElasticEntityMap.getOrDefault(d.getId(), null));
if (tagElasticEntityMap != null) m.setTags(tagElasticEntityMap.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)); if (descriptionTemplateElasticEntityMap != null) m.setDescriptionTemplate(descriptionTemplateElasticEntityMap.getOrDefault(d.getPlanId(), null));
models.add(m); models.add(m);
} }

View File

@ -106,7 +106,7 @@ public class PlanElasticBuilder extends BaseElasticBuilder<PlanElasticEntity, Pl
this.logger.debug("checking related - {}", DescriptionEntity.class.getSimpleName()); this.logger.debug("checking related - {}", DescriptionEntity.class.getSimpleName());
Map<UUID, List<NestedDescriptionElasticEntity>> itemMap; Map<UUID, List<NestedDescriptionElasticEntity>> itemMap;
DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).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); itemMap = this.builderFactory.builder(NestedDescriptionElasticBuilder.class).asMasterKey(q, NestedDescriptionElasticEntity::getPlanId);
return itemMap; return itemMap;

View File

@ -43,7 +43,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
private Collection<UUID> ids; private Collection<UUID> ids;
private String like; private String like;
private InnerObjectDmpElasticQuery planSubQuery; private InnerObjectPlanElasticQuery planSubQuery;
private Instant createdAfter; private Instant createdAfter;
private Instant createdBefore; private Instant createdBefore;
private Instant finalizedAfter; private Instant finalizedAfter;
@ -72,7 +72,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
return this; return this;
} }
public DescriptionElasticQuery planSubQuery(InnerObjectDmpElasticQuery subQuery) { public DescriptionElasticQuery planSubQuery(InnerObjectPlanElasticQuery subQuery) {
this.planSubQuery = subQuery; this.planSubQuery = subQuery;
return this; 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); if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDescription)) return this.applyTenant(null);
UUID userId = null; UUID userId = null;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); 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<>(); List<Query> predicates = new ArrayList<>();
if (usePublic ) { if (usePublic ) {
predicates.add(this.and( predicates.add(this.and(
this.equals(new ElasticField(DescriptionElasticEntity._dmp + "." + PlanElasticEntity._status, this.entityClass()).disableInfer(true), PlanStatus.Finalized.getValue()), this.equals(new ElasticField(DescriptionElasticEntity._plan + "." + 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._accessType, this.entityClass()).disableInfer(true), PlanAccessType.Public.getValue())
)); ));
} }
if (userId != null) { 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); query.userIds(userId);
predicates.add(this.nestedQuery(query).build()._toQuery()); predicates.add(this.nestedQuery(query).build()._toQuery());
} }
@ -230,13 +230,13 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
QueryBuilders.nested().path(DescriptionElasticEntity._references).query( QueryBuilders.nested().path(DescriptionElasticEntity._references).query(
this.like(elasticFields, List.of(this.like))._toQuery() this.like(elasticFields, List.of(this.like))._toQuery()
).build()._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() this.like(elasticFields, List.of(this.like))._toQuery()
).build()._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() this.like(elasticFields, List.of(this.like))._toQuery()
).build()._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() this.like(elasticFields, List.of(this.like))._toQuery()
).build()._toQuery() ).build()._toQuery()
)._toQuery()); )._toQuery());
@ -263,7 +263,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
predicates.add(this.dateLessThanQuery(this.elasticFieldOf(DescriptionElasticEntity._createdAt), this.createdBefore)._toQuery()); predicates.add(this.dateLessThanQuery(this.elasticFieldOf(DescriptionElasticEntity._createdAt), this.createdBefore)._toQuery());
} }
if (this.planSubQuery != null) { if (this.planSubQuery != null) {
predicates.add(this.planSubQuery.innerPath(DescriptionElasticEntity._dmp).applyFilters()); predicates.add(this.planSubQuery.innerPath(DescriptionElasticEntity._plan).applyFilters());
} }
if (!predicates.isEmpty()) { if (!predicates.isEmpty()) {
return this.and(predicates); 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.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.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.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; 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._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._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._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; else return null;
} }

View File

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

View File

@ -83,7 +83,7 @@ public class NestedDescriptionElasticQuery extends ElasticNestedQuery<NestedDesc
NestedDescriptionElasticEntity mocDoc = new NestedDescriptionElasticEntity(); NestedDescriptionElasticEntity mocDoc = new NestedDescriptionElasticEntity();
if (columns.contains(NestedDescriptionElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDescriptionElasticEntity._id), UUID.class)); 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._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._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._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)); 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) { protected ElasticField fieldNameOf(FieldResolver item) {
if (item.match(NestedDescriptionElasticEntity._id)) return this.elasticFieldOf(NestedDescriptionElasticEntity._id); 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._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._description)) return this.elasticFieldOf(NestedDescriptionElasticEntity._description);
else if (item.match(NestedDescriptionElasticEntity._status)) return this.elasticFieldOf(NestedDescriptionElasticEntity._status); else if (item.match(NestedDescriptionElasticEntity._status)) return this.elasticFieldOf(NestedDescriptionElasticEntity._status);
else if (item.match(NestedDescriptionElasticEntity._finalizedAt)) return this.elasticFieldOf(NestedDescriptionElasticEntity._finalizedAt); 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) { 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()) { 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._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._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._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; return mocDoc;
} }
@ -173,7 +173,7 @@ public class NestedPlanDescriptionTemplateElasticQuery extends ElasticNestedQuer
if (item.match(NestedPlanDescriptionTemplateElasticEntity._id)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._id).disableInfer(true); 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._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._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; 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); if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlan)) return this.applyTenant(null);
UUID userId = null; UUID userId = null;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); 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<>(); List<Query> predicates = new ArrayList<>();
if (usePublic) { if (usePublic) {
@ -319,7 +319,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
predicates.add(this.nestedQuery( this.descriptionSubQuery.nestedPath(PlanElasticEntity._descriptions)).build()._toQuery()); predicates.add(this.nestedQuery( this.descriptionSubQuery.nestedPath(PlanElasticEntity._descriptions)).build()._toQuery());
} }
if (this.planDescriptionTemplateSubQuery != null) { 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()) { 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.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.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.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; 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._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._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._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; else return null;
} }
@Override @Override
protected String[] getIndex() { protected String[] getIndex() {
List<String> indexNames = new ArrayList<>(); List<String> indexNames = new ArrayList<>();
indexNames.add(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()); indexNames.add(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName());
try { try {
this.elasticService.ensureDescriptionIndex(); this.elasticService.ensureDescriptionIndex();
} catch (IOException e) { } 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); 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._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._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; else return null;
} }
} }

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
package org.opencdmp.integrationevent.outbox; package org.opencdmp.integrationevent.outbox;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.opencdmp.integrationevent.TrackedEvent;
import gr.cite.rabbitmq.IntegrationEvent; import gr.cite.rabbitmq.IntegrationEvent;
import org.opencdmp.integrationevent.TrackedEvent;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class OutboxIntegrationEvent extends IntegrationEvent { public class OutboxIntegrationEvent extends IntegrationEvent {
@ -25,10 +25,6 @@ public class OutboxIntegrationEvent extends IntegrationEvent {
public static final String USER_REMOVE = "USER_REMOVE"; public static final String USER_REMOVE = "USER_REMOVE";
public static final String DMP_TOUCH = "DMP_TOUCH";
public static final String DESCRIPTION_TOUCH = "DESCRIPTION_TOUCH";
public static final String ANNOTATION_ENTITY_TOUCH = "ANNOTATION_ENTITY_TOUCH"; public static final String ANNOTATION_ENTITY_TOUCH = "ANNOTATION_ENTITY_TOUCH";
public static final String ANNOTATION_ENTITY_REMOVE = "ANNOTATION_ENTITY_REMOVE"; public static final String ANNOTATION_ENTITY_REMOVE = "ANNOTATION_ENTITY_REMOVE";
@ -39,7 +35,7 @@ public class OutboxIntegrationEvent extends IntegrationEvent {
private TrackedEvent event; private TrackedEvent event;
public TrackedEvent getEvent() { public TrackedEvent getEvent() {
return event; return this.event;
} }
public void setEvent(TrackedEvent event) { public void setEvent(TrackedEvent event) {

View File

@ -25,10 +25,6 @@ public class OutboxProperties {
private final String userTouchTopic; private final String userTouchTopic;
private final String dmpTouchTopic;
private final String descriptionTouchTopic;
private final String annotationEntitiesTouchTopic; private final String annotationEntitiesTouchTopic;
private final String annotationEntitiesRemovalTopic; private final String annotationEntitiesRemovalTopic;
@ -49,8 +45,6 @@ public class OutboxProperties {
String tenantUserInviteTopic, String tenantUserInviteTopic,
String userRemovalTopic, String userRemovalTopic,
String userTouchTopic, String userTouchTopic,
String dmpTouchTopic,
String descriptionTouchTopic,
String annotationEntitiesTouchTopic, String annotationEntitiesTouchTopic,
String annotationEntitiesRemovalTopic, String annotationEntitiesRemovalTopic,
String notifyTopic, String notifyTopic,
@ -71,8 +65,6 @@ public class OutboxProperties {
this.tenantUserInviteTopic = tenantUserInviteTopic; this.tenantUserInviteTopic = tenantUserInviteTopic;
this.userRemovalTopic = userRemovalTopic; this.userRemovalTopic = userRemovalTopic;
this.userTouchTopic = userTouchTopic; this.userTouchTopic = userTouchTopic;
this.dmpTouchTopic = dmpTouchTopic;
this.descriptionTouchTopic = descriptionTouchTopic;
this.annotationEntitiesTouchTopic = annotationEntitiesTouchTopic; this.annotationEntitiesTouchTopic = annotationEntitiesTouchTopic;
this.annotationEntitiesRemovalTopic = annotationEntitiesRemovalTopic; this.annotationEntitiesRemovalTopic = annotationEntitiesRemovalTopic;
this.notifyTopic = notifyTopic; this.notifyTopic = notifyTopic;
@ -133,14 +125,6 @@ public class OutboxProperties {
return this.userTouchTopic; return this.userTouchTopic;
} }
public String getDmpTouchTopic() {
return this.dmpTouchTopic;
}
public String getDescriptionTouchTopic() {
return this.descriptionTouchTopic;
}
public String getAnnotationEntitiesTouchTopic() { public String getAnnotationEntitiesTouchTopic() {
return this.annotationEntitiesTouchTopic; return this.annotationEntitiesTouchTopic;
} }

View File

@ -458,14 +458,6 @@ public class OutboxRepositoryImpl implements OutboxRepository {
routingKey = this.outboxProperties.getUserTouchTopic(); routingKey = this.outboxProperties.getUserTouchTopic();
break; break;
} }
case OutboxIntegrationEvent.DMP_TOUCH: {
routingKey = this.outboxProperties.getDmpTouchTopic();
break;
}
case OutboxIntegrationEvent.DESCRIPTION_TOUCH: {
routingKey = this.outboxProperties.getDescriptionTouchTopic();
break;
}
case OutboxIntegrationEvent.ANNOTATION_ENTITY_TOUCH: { case OutboxIntegrationEvent.ANNOTATION_ENTITY_TOUCH: {
routingKey = this.outboxProperties.getAnnotationEntitiesTouchTopic(); routingKey = this.outboxProperties.getAnnotationEntitiesTouchTopic();
break; break;

View File

@ -6,5 +6,5 @@ import java.util.UUID;
public interface AnnotationEntityRemovalIntegrationEventHandler { public interface AnnotationEntityRemovalIntegrationEventHandler {
void handleDescription(UUID descriptionId) throws InvalidApplicationException; 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 @Override
public void handleDmp(UUID planId) { public void handlePlan(UUID planId) {
PlanEntity dmp = this.queryFactory.query(PlanQuery.class).disableTracking().ids(planId).firstAs(new BaseFieldSet().ensure(Plan._id).ensure(PlanEntity._tenantId)); PlanEntity plan = this.queryFactory.query(PlanQuery.class).disableTracking().ids(planId).firstAs(new BaseFieldSet().ensure(Plan._id).ensure(PlanEntity._tenantId));
if(dmp == null) return; if(plan == null) return;
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().planIds(planId).collectAs(new BaseFieldSet().ensure(Description._id)); 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()); 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) { public void handleDescription(UUID descriptionId) {
DescriptionEntity entity = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(descriptionId).firstAs(new BaseFieldSet().ensure(Description._plan).ensure(DescriptionEntity._tenantId)); DescriptionEntity entity = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(descriptionId).firstAs(new BaseFieldSet().ensure(Description._plan).ensure(DescriptionEntity._tenantId));
if (entity == null) return; 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(); 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()); this.handle(event, entity.getTenantId());
} }
@ -61,23 +61,23 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot
public void handlePlan(UUID planId) { public void handlePlan(UUID planId) {
List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().planIds(planId).collectAs(new BaseFieldSet().ensure(Description._id)); List<DescriptionEntity> descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().planIds(planId).collectAs(new BaseFieldSet().ensure(Description._id));
if (descriptionEntities == null || descriptionEntities.isEmpty()) return; 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(); AnnotationEntitiesTouchedIntegrationEvent event = new AnnotationEntitiesTouchedIntegrationEvent();
event.setEvents(new ArrayList<>()); 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()); 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(); AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent eventItem = new AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent();
eventItem.setEntityId(entityId); eventItem.setEntityId(entityId);
List<UUID> users = new ArrayList<>(); List<UUID> users = new ArrayList<>();
for (PlanUserEntity dmpUser : dmpUsers){ for (PlanUserEntity planUser : planUsers){
users.add(dmpUser.getUserId()); users.add(planUser.getUserId());
} }
eventItem.setUserIds(users); eventItem.setUserIds(users);
return eventItem; return eventItem;

View File

@ -1,24 +1,23 @@
package org.opencdmp.model; package org.opencdmp.model;
import java.util.List; import java.util.List;
import java.util.UUID;
public class DashboardStatistics { 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 long descriptionCount;
private List<DashboardReferenceTypeStatistics> referenceTypeStatistics; private List<DashboardReferenceTypeStatistics> referenceTypeStatistics;
public long getDmpCount() { public long getPlanCount() {
return dmpCount; return planCount;
} }
public void setDmpCount(long dmpCount) { public void setPlanCount(long planCount) {
this.dmpCount = dmpCount; this.planCount = planCount;
} }
public long getDescriptionCount() { public long getDescriptionCount() {

View File

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

View File

@ -20,7 +20,7 @@ public class RecentActivityItemLookup{
private String like; private String like;
private Boolean onlyDraft; private Boolean onlyDraft;
private Boolean onlyDmp; private Boolean onlyPlan;
private Boolean onlyDescription; private Boolean onlyDescription;
private List<UUID> userIds; private List<UUID> userIds;
private Paging page; private Paging page;
@ -75,12 +75,12 @@ public class RecentActivityItemLookup{
this.orderField = orderField; this.orderField = orderField;
} }
public Boolean getOnlyDmp() { public Boolean getOnlyPlan() {
return onlyDmp; return onlyPlan;
} }
public void setOnlyDmp(Boolean onlyDmp) { public void setOnlyPlan(Boolean onlyPlan) {
this.onlyDmp = onlyDmp; this.onlyPlan = onlyPlan;
} }
public Boolean getOnlyDescription() { public Boolean getOnlyDescription() {
@ -92,7 +92,7 @@ public class RecentActivityItemLookup{
} }
public DescriptionLookup asDescriptionLookup() { public DescriptionLookup asDescriptionLookup() {
if (this.onlyDmp != null) return null; if (this.onlyPlan != null) return null;
DescriptionLookup lookup = new DescriptionLookup(); DescriptionLookup lookup = new DescriptionLookup();
lookup.setIsActive(List.of(IsActive.Active)); lookup.setIsActive(List.of(IsActive.Active));
@ -125,7 +125,7 @@ public class RecentActivityItemLookup{
return lookup; return lookup;
} }
public PlanLookup asDmpLookup() { public PlanLookup asPlanLookup() {
if (this.onlyDescription != null) return null; if (this.onlyDescription != null) return null;
PlanLookup lookup = new PlanLookup(); 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 (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 (!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 (!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); models.add(m);
} }
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); 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; Map<UUID, List<PublicEntityDoi>> itemMap;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicEntityDoi._entityId)); FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicEntityDoi._entityId));
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).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); itemMap = this.builderFactory.builder(PublicEntityDoiBuilder.class).authorize(this.authorize).asMasterKey(query, clone, PublicEntityDoi::getEntityId);
if (!fields.hasField(this.asIndexer(PublicEntityDoi._entityId))) { if (!fields.hasField(this.asIndexer(PublicEntityDoi._entityId))) {

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)); m.setMergeAccountConfirmation(this.builderFactory.builder(MergeAccountConfirmationBuilder.class).authorize(this.authorize).build(mergeAccountConfirmationFields, emailConfirmation));
} }
case PlanInvitation -> { case PlanInvitation -> {
PlanInvitationEntity dmpInvitation = this.xmlHandlingService.fromXmlSafe(PlanInvitationEntity.class, d.getData()); PlanInvitationEntity planInvitation = this.xmlHandlingService.fromXmlSafe(PlanInvitationEntity.class, d.getData());
m.setPlanInvitation(this.builderFactory.builder(PlanInvitationBuilder.class).authorize(this.authorize).build(planInvitationFields, dmpInvitation)); m.setPlanInvitation(this.builderFactory.builder(PlanInvitationBuilder.class).authorize(this.authorize).build(planInvitationFields, planInvitation));
} }
case RemoveCredential -> { case RemoveCredential -> {
RemoveCredentialRequestEntity emailConfirmation = this.xmlHandlingService.fromXmlSafe(RemoveCredentialRequestEntity.class, d.getData()); 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 SELECT -> m.setFieldType(FieldType.SELECT);
case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION); case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION);
case RADIO_BOX -> m.setFieldType(FieldType.RADIO_BOX); 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 INTERNAL_ENTRIES_DESCRIPTIONS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS);
case CHECK_BOX -> m.setFieldType(FieldType.CHECK_BOX); case CHECK_BOX -> m.setFieldType(FieldType.CHECK_BOX);
case FREE_TEXT -> m.setFieldType(FieldType.FREE_TEXT); 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<DescriptionModel>> descriptionsMap = this.disableDescriptions ? null : this.collectPlanDescriptions(data);
Map<UUID, List<EntityDoiModel>> entityDois = this.collectPlanEntityDois(data); Map<UUID, List<EntityDoiModel>> entityDois = this.collectPlanEntityDois(data);
Map<UUID, UserModel> creators = this.collectCreators(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); Map<UUID, DefinitionEntity> definitionEntityMap = this.collectPlanBlueprintDefinitions(data);
for (PlanEntity d : 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 (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 (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){ if (d.getProperties() != null){
//TODO Update with the new logic of property definition //TODO Update with the new logic of property definition
PlanPropertiesEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PlanPropertiesEntity.class, d.getProperties()); PlanPropertiesEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PlanPropertiesEntity.class, d.getProperties());
@ -162,13 +162,13 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder<DmpModel, Pla
return models; 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"); if (this.repositoryId == null || this.repositoryId.isEmpty()) throw new MyApplicationException("repositoryId required");
//GK: Step one get the previous version of the Data management plan //GK: Step one get the previous version of the Data management plan
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking(); PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking();
planQuery.setOrder(new Ordering().addDescending(Plan._version)); 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 //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)); 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.List;
import java.util.Optional; import java.util.Optional;
@Component("dmpblueprint.DefinitionCommonModelBuilder") @Component("planblueprint.DefinitionCommonModelBuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DefinitionCommonModelBuilder extends BaseCommonModelBuilder<DefinitionModel, DefinitionEntity> { public class DefinitionCommonModelBuilder extends BaseCommonModelBuilder<DefinitionModel, DefinitionEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;

View File

@ -20,7 +20,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@Component("dmpblueprint.FieldCommonModelBuilder") @Component("planblueprint.FieldCommonModelBuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public abstract class FieldCommonModelBuilder<Model extends FieldModel, Entity extends FieldEntity> extends BaseCommonModelBuilder<Model, Entity> { public abstract class FieldCommonModelBuilder<Model extends FieldModel, Entity extends FieldEntity> extends BaseCommonModelBuilder<Model, Entity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None); 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.List;
import java.util.Optional; import java.util.Optional;
@Component("dmpblueprint.SectionCommonModelBuilder") @Component("planblueprint.SectionCommonModelBuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class SectionCommonModelBuilder extends BaseCommonModelBuilder<SectionModel, SectionEntity> { public class SectionCommonModelBuilder extends BaseCommonModelBuilder<SectionModel, SectionEntity> {
private final BuilderFactory builderFactory; 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)) { if (fields.hasField(this.asIndexer(Field._textListValue)) && FieldType.isTextListType(fieldType)) {
boolean isMultiSelect = true; boolean isMultiSelect = true;
if(this.fieldEntity != null && this.fieldEntity.getData() != null && (this.fieldEntity.getData().getFieldType().equals(FieldType.SELECT) 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))){ || this.fieldEntity.getData().getFieldType().equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS))){
if (this.fieldEntity.getData() instanceof SelectDataEntity) isMultiSelect = ((SelectDataEntity) this.fieldEntity.getData()).getMultipleSelect(); 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(); 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 @Override
public List<PlanBlueprintValue> build(FieldSet DmpBlueprintValues, List<PlanBlueprintValueEntity> data) throws MyApplicationException { public List<PlanBlueprintValue> build(FieldSet planBlueprintValues, 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.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 DmpBlueprintValues", DmpBlueprintValues)); this.logger.trace(new DataLogEntry("requested PlanBlueprintValues", planBlueprintValues));
if (DmpBlueprintValues == null || data == null || DmpBlueprintValues.isEmpty()) if (planBlueprintValues == null || data == null || planBlueprintValues.isEmpty())
return new ArrayList<>(); return new ArrayList<>();
@ -61,13 +61,13 @@ public class PlanBlueprintValueBuilder extends BaseBuilder<PlanBlueprintValue, P
if (fieldEntity != null && fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)) { if (fieldEntity != null && fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)) {
ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity; ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity;
PlanBlueprintValue m = new PlanBlueprintValue(); 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 (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())){ } 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 { } 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); models.add(m);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,13 +1,13 @@
package org.opencdmp.model.deleter; package org.opencdmp.model.deleter;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.data.*;
import org.opencdmp.query.*;
import gr.cite.tools.data.deleter.Deleter; import gr.cite.tools.data.deleter.Deleter;
import gr.cite.tools.data.deleter.DeleterFactory; import gr.cite.tools.data.deleter.DeleterFactory;
import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry; import gr.cite.tools.logging.MapLogEntry;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.data.*;
import org.opencdmp.query.*;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -22,7 +22,7 @@ import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class UserDeleter implements Deleter { public class UserDeleter implements Deleter {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(UserDeleter.class)); private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(UserDeleter.class));
@ -87,12 +87,6 @@ public class UserDeleter implements Deleter {
TenantUserDeleter deleter = this.deleterFactory.deleter(TenantUserDeleter.class); TenantUserDeleter deleter = this.deleterFactory.deleter(TenantUserDeleter.class);
deleter.delete(items); deleter.delete(items);
} }
// {
// logger.debug("checking related - {}", DmpUserEntity.class.getSimpleName());
// List<DmpUserEntity> items = this.queryFactory.query(DmpUserQuery.class).userIds(ids).collect();
// DmpUserDeleter deleter = this.deleterFactory.deleter(DmpUserDeleter.class);
// deleter.delete(items);
// }
Instant now = Instant.now(); Instant now = Instant.now();
for (UserEntity item : data) { for (UserEntity item : data) {

View File

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

View File

@ -58,10 +58,6 @@ public class PlanPersist {
private PlanAccessType accessType; private PlanAccessType accessType;
public static final String _accessType = "accessType"; public static final String _accessType = "accessType";
// private List<DmpReferencePersist> references;
//
// public static final String _references = "references";
private List<PlanDescriptionTemplatePersist> descriptionTemplates; private List<PlanDescriptionTemplatePersist> descriptionTemplates;
public static final String _descriptionTemplates = "descriptionTemplates"; public static final String _descriptionTemplates = "descriptionTemplates";
@ -243,7 +239,7 @@ public class PlanPersist {
this.spec() this.spec()
.iff(() -> item.getStatus() == PlanStatus.Finalized) .iff(() -> item.getStatus() == PlanStatus.Finalized)
.must(() -> this.isDescriptionTemplateMultiplicityValid(finalPlanBlueprintEntity, item.getId())) .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() this.refSpec()
.iff(() -> !this.isNull(item.getProperties())) .iff(() -> !this.isNull(item.getProperties()))
.on(PlanPersist._properties) .on(PlanPersist._properties)

View File

@ -10,7 +10,6 @@ import org.opencdmp.commons.validation.BaseValidator;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.model.persist.ReferencePersist; import org.opencdmp.model.persist.ReferencePersist;
import org.opencdmp.model.persist.TagPersist;
import org.opencdmp.service.visibility.VisibilityService; import org.opencdmp.service.visibility.VisibilityService;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
@ -179,7 +178,7 @@ public class FieldPersist {
.must(() -> !this.isListNullOrEmpty(item.getReferences()) || !this.isNull(item.getReference())) .must(() -> !this.isListNullOrEmpty(item.getReferences()) || !this.isNull(item.getReference()))
.failOn(FieldPersist._textListValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())), .failOn(FieldPersist._textListValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
this.spec() 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)) .must(() -> item.getTextListValue().stream().allMatch(this::isUUID))
.failOn(FieldPersist._textListValue).failWith(this.messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())), .failOn(FieldPersist._textListValue).failWith(this.messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
this.navSpec() 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())), .failOn(RulePersist._target).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{RulePersist._target}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(() -> this.isNull(fieldType)) .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.UPLOAD.equals(fieldType) && !FieldType.REFERENCE_TYPES.equals(fieldType) && !FieldType.DATASET_IDENTIFIER.equals(fieldType)
&& !FieldType.VALIDATION.equals(fieldType)) && !FieldType.VALIDATION.equals(fieldType))
.failOn(RulePersist._target).failWith(this.messageSource.getMessage("Validation_UnexpectedValue", new Object[]{RulePersist._target}, LocaleContextHolder.getLocale())), .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({
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.BooleanDecision), @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.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.CheckBox),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatePicker), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatePicker),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.FreeText), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.FreeText),

View File

@ -35,7 +35,7 @@ public class DefinitionPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class DefinitionPersistValidator extends BaseValidator<DefinitionPersist> { 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; private final MessageSource messageSource;

View File

@ -68,7 +68,7 @@ public class DescriptionTemplatePersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class DescriptionTemplatePersistValidator extends BaseValidator<DescriptionTemplatePersist> { 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; private final MessageSource messageSource;

View File

@ -31,7 +31,7 @@ public class ExtraFieldPersist extends FieldPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class ExtraFieldPersistValidator extends BaseFieldPersistValidator<ExtraFieldPersist> { 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) { protected ExtraFieldPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
super(conventionService, errors, messageSource); super(conventionService, errors, messageSource);

View File

@ -44,7 +44,7 @@ public class ReferenceTypeFieldPersist extends FieldPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class ReferenceFieldPersistPersistValidator extends BaseFieldPersistValidator<ReferenceTypeFieldPersist> { 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) { protected ReferenceFieldPersistPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
super(conventionService, errors, messageSource); super(conventionService, errors, messageSource);

View File

@ -117,7 +117,7 @@ public class SectionPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class SectionPersistValidator extends BaseValidator<SectionPersist> { 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; private final MessageSource messageSource;

View File

@ -30,7 +30,7 @@ public class SystemFieldPersist extends FieldPersist {
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class SystemFieldPersistValidator extends BaseFieldPersistValidator<SystemFieldPersist> { 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) { protected SystemFieldPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
super(conventionService, errors, messageSource); super(conventionService, errors, messageSource);

View File

@ -146,13 +146,11 @@ public class PlanBlueprintValuePersist {
.iff(() -> this.fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && ((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required) .iff(() -> this.fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && ((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required)
.must(() -> !this.isListNullOrEmpty(item.getReferences())) .must(() -> !this.isListNullOrEmpty(item.getReferences()))
// TODO: Cast Exception // TODO: Cast Exception
// .failOn(DmpBlueprintValuePersist._references).failWith(messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(fieldEntity.getLabel()) ? fieldEntity.getLabel() : this.getReferenceTypeName(fieldEntity)}, LocaleContextHolder.getLocale())),
.failOn(PlanBlueprintValuePersist._references).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : PlanBlueprintValuePersist._references}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintValuePersist._references).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : PlanBlueprintValuePersist._references}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(() -> this.fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && !((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required) .iff(() -> this.fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && !((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required)
.must(() -> !this.isNull(item.getReference())) .must(() -> !this.isNull(item.getReference()))
// TODO: Cast Exception // TODO: Cast Exception
// .failOn(DmpBlueprintValuePersist._references).failWith(messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(fieldEntity.getLabel()) ? fieldEntity.getLabel() : this.getReferenceTypeName(fieldEntity)}, LocaleContextHolder.getLocale())),
.failOn(PlanBlueprintValuePersist._reference).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : PlanBlueprintValuePersist._reference}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintValuePersist._reference).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : PlanBlueprintValuePersist._reference}, LocaleContextHolder.getLocale())),
this.navSpec() this.navSpec()
.iff(() -> !this.isListNullOrEmpty(item.getReferences())) .iff(() -> !this.isListNullOrEmpty(item.getReferences()))

View File

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

View File

@ -79,7 +79,7 @@ public class GrantPublicOverviewModel {
this.funder = funder; 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; FunderPublicOverviewModel funder = null;
for (PlanReference planReference : references) { for (PlanReference planReference : references) {
if (!Objects.equals(planReference.getReference().getType().getId(), config.getFunderTypeId())) { if (!Objects.equals(planReference.getReference().getType().getId(), config.getFunderTypeId())) {

View File

@ -48,7 +48,7 @@ public class OrganizationPublicModel {
this.key = key; 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())) if (!Objects.equals(planReference.getReference().getType().getId(), config.getOrganizationTypeId()))
return null; return null;
OrganizationPublicModel model = new OrganizationPublicModel(); OrganizationPublicModel model = new OrganizationPublicModel();

View File

@ -113,7 +113,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
return this; return this;
} }
public DescriptionQuery dmpDescriptionTemplateSubQuery(PlanDescriptionTemplateQuery subQuery) { public DescriptionQuery planDescriptionTemplateSubQuery(PlanDescriptionTemplateQuery subQuery) {
this.planDescriptionTemplateQuery = subQuery; this.planDescriptionTemplateQuery = subQuery;
return this; return this;
} }
@ -153,7 +153,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
return this; return this;
} }
public DescriptionQuery dmpSubQuery(PlanQuery subQuery) { public DescriptionQuery planSubQuery(PlanQuery subQuery) {
this.planQuery = subQuery; this.planQuery = subQuery;
return this; return this;
} }
@ -270,7 +270,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
return null; return null;
UUID userId; UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) if (this.authorize.contains(AuthorizationFlags.PlanAssociated))
userId = this.userScope.getUserIdSafe(); userId = this.userScope.getUserIdSafe();
else else
userId = null; userId = null;
@ -345,11 +345,11 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
predicates.add(inClause); predicates.add(inClause);
} }
if (this.planDescriptionTemplateQuery != null) { 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)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planDescriptionTemplateId)).value(subQuery.Query));
} }
if (this.planQuery != null) { 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)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planId)).value(subQuery.Query));
} }
if (this.descriptionTemplateQuery != null) { 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; if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDescriptionReference)) return null;
UUID userId; UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); 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; else userId = null;
if (this.authorize.contains(AuthorizationFlags.Owner)) userId = this.userScope.getUserIdSafe(); if (this.authorize.contains(AuthorizationFlags.Owner)) userId = this.userScope.getUserIdSafe();

View File

@ -265,21 +265,21 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
return null; return null;
UUID userId; UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) if (this.authorize.contains(AuthorizationFlags.PlanAssociated))
userId = this.userScope.getUserIdSafe(); userId = this.userScope.getUserIdSafe();
else else
userId = null; userId = null;
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();
if (userId != null || usePublic) { 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) new BuildSubQueryInput.Builder<>(PlanDescriptionTemplateEntity.class, UUID.class, queryContext)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId)) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId))
.filterFunc((subQueryRoot, cb) -> .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()) { if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);

View File

@ -217,7 +217,7 @@ public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (userId != null || usePublic) { if (userId != null || usePublic) {
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(EntityDoiEntity._entityId)).value(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()) { if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);

View File

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

View File

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

View File

@ -103,7 +103,7 @@ public class PlanReferenceQuery extends QueryBase<PlanReferenceEntity> {
return this; return this;
} }
public PlanReferenceQuery dmpSubQuery(PlanQuery value) { public PlanReferenceQuery planSubQuery(PlanQuery value) {
this.planQuery = value; this.planQuery = value;
return this; 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; if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlanReference)) return null;
UUID userId; UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); 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; else userId = null;
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();
if (userId != null || usePublic ) { if (userId != null || usePublic ) {
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(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()) { if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
@ -208,7 +208,7 @@ public class PlanReferenceQuery extends QueryBase<PlanReferenceEntity> {
predicates.add(inClause); predicates.add(inClause);
} }
if (this.planQuery != null) { 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)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)).value(subQuery.Query));
} }
if (this.referenceQuery != null) { 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; if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlan)) return null;
UUID userId = null; UUID userId = null;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); 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<>(); List<Predicate> predicates = new ArrayList<>();
if (userId != null || usePublic ) { if (userId != null || usePublic ) {
predicates.add(queryContext.CriteriaBuilder.or( predicates.add(queryContext.CriteriaBuilder.or(
usePublic ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPublicDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, usePublic)) : 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.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : 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()) { if (!predicates.isEmpty()) {

View File

@ -166,7 +166,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
return this; return this;
} }
public ReferenceQuery dmpReferenceSubQuery(PlanReferenceQuery value) { public ReferenceQuery planReferenceSubQuery(PlanReferenceQuery value) {
this.planReferenceQuery = value; this.planReferenceQuery = value;
return this; return this;
} }
@ -224,7 +224,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
return null; return null;
UUID userId; UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) if (this.authorize.contains(AuthorizationFlags.PlanAssociated))
userId = this.userScope.getUserIdSafe(); userId = this.userScope.getUserIdSafe();
else else
userId = null; userId = null;
@ -239,7 +239,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
.criteriaBuilder(queryContext.CriteriaBuilder) .criteriaBuilder(queryContext.CriteriaBuilder)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanReferenceEntity._referenceId)) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanReferenceEntity._referenceId))
.filterFunc((subQueryRoot, cb) -> .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) 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; if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseTag)) return null;
UUID userId; UUID userId;
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); 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; else userId = null;
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();

View File

@ -188,7 +188,7 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
.criteriaBuilder(queryContext.CriteriaBuilder) .criteriaBuilder(queryContext.CriteriaBuilder)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId)) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId))
.filterFunc((subQueryRoot, cb) -> .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; if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUser)) return null;
UUID userId; UUID userId;
if (this.authorize.contains(AuthorizationFlags.Owner)) userId = this.userScope.getUserIdSafe(); 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(); if (this.authorize.contains(AuthorizationFlags.DescriptionTemplateAssociated)) userId = this.userScope.getUserIdSafe();
else userId = null; else userId = null;
@ -188,7 +188,7 @@ public class UserQuery extends QueryBase<UserEntity> {
.criteriaBuilder(queryContext.CriteriaBuilder) .criteriaBuilder(queryContext.CriteriaBuilder)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId)) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId))
.filterFunc((subQueryRoot, cb) -> .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) 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(); if (this.userScope.isSet()) userId = this.userScope.getUserIdSafe();
else throw new MyNotFoundException("Only user scoped allowed"); 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) new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class, queryContext)
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId)) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId))
.filterFunc((subQueryRoot, cb) -> cb.and( .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) 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.None)) return null;
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUserSettings)) return null; if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUserSettings)) return null;
UUID ownerId = 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<>(); List<Predicate> predicates = new ArrayList<>();
if (ownerId != null) { if (ownerId != null) {

View File

@ -81,7 +81,7 @@ public class DescriptionLookup extends Lookup {
public DescriptionTemplateLookup getDescriptionTemplateSubQuery() { return this.descriptionTemplateSubQuery; } 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; } 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.like != null) query.like(this.like);
if (this.ids != null) query.ids(this.ids); if (this.ids != null) query.ids(this.ids);
if (this.excludedIds != null) query.excludedIds(this.excludedIds); 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.descriptionTemplateSubQuery != null) query.descriptionTemplateSubQuery(this.descriptionTemplateSubQuery.enrich(queryFactory));
if (this.descriptionReferenceSubQuery != null) query.descriptionReferenceSubQuery(this.descriptionReferenceSubQuery.enrich(queryFactory)); if (this.descriptionReferenceSubQuery != null) query.descriptionReferenceSubQuery(this.descriptionReferenceSubQuery.enrich(queryFactory));
if (this.descriptionTagSubQuery != null) query.descriptionTagSubQuery(this.descriptionTagSubQuery.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.PlanVersionStatus;
import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.elastic.query.PlanElasticQuery; import org.opencdmp.elastic.query.PlanElasticQuery;
import org.opencdmp.elastic.query.InnerObjectDmpElasticQuery; import org.opencdmp.elastic.query.InnerObjectPlanElasticQuery;
import org.opencdmp.query.PlanQuery; import org.opencdmp.query.PlanQuery;
import java.util.List; import java.util.List;
@ -126,12 +126,12 @@ public class PlanLookup extends Lookup {
public PlanBlueprintLookup getPlanBlueprintSubQuery() { return this.planBlueprintSubQuery; } 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 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) { public PlanQuery enrich(QueryFactory queryFactory) {
PlanQuery query = queryFactory.query(PlanQuery.class); PlanQuery query = queryFactory.query(PlanQuery.class);
@ -172,8 +172,8 @@ public class PlanLookup extends Lookup {
return query; return query;
} }
public InnerObjectDmpElasticQuery enrichElasticInner(QueryFactory queryFactory) { public InnerObjectPlanElasticQuery enrichElasticInner(QueryFactory queryFactory) {
InnerObjectDmpElasticQuery query = queryFactory.query(InnerObjectDmpElasticQuery.class); InnerObjectPlanElasticQuery query = queryFactory.query(InnerObjectPlanElasticQuery.class);
if (this.like != null) query.like(StringUtils.strip(this.like, "%")); if (this.like != null) query.like(StringUtils.strip(this.like, "%"));
if (this.ids != null) query.ids(this.ids); if (this.ids != null) query.ids(this.ids);
if (this.groupIds != null) query.groupIds(this.groupIds); 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.versions != null) query.versions(this.versions);
if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses); if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses);
if (this.planDescriptionTemplateSubQuery != null) throw new UnsupportedOperationException(""); 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 ?? // TODO ??
return query; return query;
} }

View File

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

View File

@ -26,7 +26,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService {
} }
@Override @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<>( return this.buildSubQuery(new BuildSubQueryInput<>(
new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class) new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class)
.query(query) .query(query)
@ -38,7 +38,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService {
cb.equal(subQueryRoot.get(PlanEntity._status), PlanStatus.Finalized), cb.equal(subQueryRoot.get(PlanEntity._status), PlanStatus.Finalized),
cb.equal(subQueryRoot.get(PlanEntity._isActive), IsActive.Active) cb.equal(subQueryRoot.get(PlanEntity._isActive), IsActive.Active)
): cb.or(), //Creates a false query ): 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( usePublic ? cb.and(
cb.equal(subQueryRoot.get(DescriptionEntity._status), DescriptionStatus.Finalized), cb.equal(subQueryRoot.get(DescriptionEntity._status), DescriptionStatus.Finalized),
cb.equal(subQueryRoot.get(DescriptionEntity._isActive), IsActive.Active), 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 ): cb.or(), //Creates a false query
userId != null ? userId != null ?
cb.or( cb.or(
cb.equal(subQueryRoot.get(DescriptionEntity._createdById), userId), 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 ) : cb.or() //Creates a false query
) )
) )
@ -84,7 +84,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService {
} }
@Override @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<>( return this.buildSubQuery(new BuildSubQueryInput<>(
new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class) new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class)
.query(query) .query(query)
@ -101,7 +101,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService {
} }
@Override @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) return this.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class)
.query(query) .query(query)
.criteriaBuilder(criteriaBuilder) .criteriaBuilder(criteriaBuilder)

View File

@ -104,7 +104,7 @@ public class ActionConfirmationServiceImpl implements ActionConfirmationService
data.setExpiresAt(model.getExpiresAt()); data.setExpiresAt(model.getExpiresAt());
switch (model.getType()){ switch (model.getType()){
case MergeAccount -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildMergeAccountConfirmationEntity(model.getMergeAccountConfirmation()))); 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 RemoveCredential -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildMergeAccountConfirmationEntity(model.getRemoveCredentialRequest())));
case UserInviteToTenant -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildUserInviteToTenantRequestEntity(model.getUserInviteToTenantRequest()))); case UserInviteToTenant -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildUserInviteToTenantRequestEntity(model.getUserInviteToTenantRequest())));
default -> throw new InternalError("unknown type: " + model.getType()); 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); 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(); PlanInvitationEntity data = new PlanInvitationEntity();
if (persist == null) return data; 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){ if (planLookup != null){
planLookup.getPage().setOffset(0); planLookup.getPage().setOffset(0);
planLookup.getPage().setSize(model.getPage().getSize()+model.getPage().getOffset()); 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)); 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(dmps.getItems())) { if (!this.conventionService.isListNullOrEmpty(plans.getItems())) {
for (Plan plan : dmps.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Plan, plan.getId(), plan.getUpdatedAt(), plan.getLabel(), plan.getStatus().getValue())); 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) { 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); PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).versionStatuses(PlanVersionStatus.Current).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public);
DashboardStatistics statistics = new DashboardStatistics(); DashboardStatistics statistics = new DashboardStatistics();
statistics.setDmpCount(planQuery.authorize(EnumSet.of(Public)).count()); statistics.setPlanCount(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.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(planQuery).statuses(DescriptionStatus.Finalized).authorize(EnumSet.of(Public)).count());
statistics.setReferenceTypeStatistics(new ArrayList<>()); statistics.setReferenceTypeStatistics(new ArrayList<>());
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){ if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
for (UUID typeId : this.config.getReferenceTypeCounters()){ for (UUID typeId : this.config.getReferenceTypeCounters()){
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics(); DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(EnumSet.of(Public)) referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(EnumSet.of(Public))
.dmpReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active) .planReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active)
.dmpSubQuery(planQuery)).count()); .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())); referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._id), this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(typeId).first()));
statistics.getReferenceTypeStatistics().add(referenceTypeStatistics); statistics.getReferenceTypeStatistics().add(referenceTypeStatistics);
} }
@ -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()))); DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(this.dashboardStatisticsCacheService.generateUserTenantCacheKey(this.userScope.getUserId(), this.tenantScope.getTenantCode())));
if (cacheValue == null || cacheValue.getDashboardStatistics() == null) { if (cacheValue == null || cacheValue.getDashboardStatistics() == null) {
PlanUserQuery dmpUserLookup = this.queryFactory.query(PlanUserQuery.class).disableTracking(); PlanUserQuery planUserLookup = this.queryFactory.query(PlanUserQuery.class).disableTracking();
dmpUserLookup.userIds(this.userScope.getUserId()); planUserLookup.userIds(this.userScope.getUserId());
dmpUserLookup.isActives(IsActive.Active); 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(); DashboardStatistics statistics = new DashboardStatistics();
statistics.setDmpCount(planQuery.authorize(AuthorizationFlags.AllExceptPublic).count()); statistics.setPlanCount(planQuery.authorize(AuthorizationFlags.AllExceptPublic).count());
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(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<>()); statistics.setReferenceTypeStatistics(new ArrayList<>());
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){ if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
for (UUID typeId : this.config.getReferenceTypeCounters()){ for (UUID typeId : this.config.getReferenceTypeCounters()){
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics(); DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(AuthorizationFlags.AllExceptPublic) 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) .planReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active)
.dmpSubQuery(planQuery)).count()); .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())); referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._id), this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(typeId).first()));
statistics.getReferenceTypeStatistics().add(referenceTypeStatistics); statistics.getReferenceTypeStatistics().add(referenceTypeStatistics);
} }

View File

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

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