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

This commit is contained in:
Sofia Papacharalampous 2024-06-20 16:13:17 +03:00
commit 4f307c7d6c
23 changed files with 70 additions and 21 deletions

View File

@ -41,10 +41,6 @@ public class DescriptionElasticEntity {
private Date finalizedAt;
public final static String _finalizedAt = "finalizedAt";
@Field(value = DescriptionElasticEntity._createdAt, type = FieldType.Date)
private Date createdAt;
public final static String _createdAt = "createdAt";
@Field(value = DescriptionElasticEntity._tags, type = FieldType.Nested)
private List<NestedTagElasticEntity> tags;
public final static String _tags = "tags";
@ -61,6 +57,14 @@ public class DescriptionElasticEntity {
private List<NestedReferenceElasticEntity> references;
public final static String _references = "references";
@Field(value = DescriptionElasticEntity._updatedAt, type = FieldType.Date)
private Date updatedAt;
public final static String _updatedAt = "updatedAt";
@Field(value = DescriptionElasticEntity._createdAt, type = FieldType.Date)
private Date createdAt;
public final static String _createdAt = "createdAt";
public UUID getId() {
return this.id;
}
@ -148,4 +152,12 @@ public class DescriptionElasticEntity {
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return this.updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
}

View File

@ -82,6 +82,14 @@ public class DmpElasticEntity {
private List<NestedDoiElasticEntity> dois;
public final static String _dois = "dois";
@Field(value = DmpElasticEntity._updatedAt, type = FieldType.Date)
private Date updatedAt;
public final static String _updatedAt = "updatedAt";
@Field(value = DmpElasticEntity._createdAt, type = FieldType.Date)
private Date createdAt;
public final static String _createdAt = "createdAt";
public UUID getId() {
return this.id;
}
@ -217,4 +225,20 @@ public class DmpElasticEntity {
public void setDmpDescriptionTemplates(List<NestedDmpDescriptionTemplateElasticEntity> dmpDescriptionTemplates) {
this.dmpDescriptionTemplates = dmpDescriptionTemplates;
}
public Date getCreatedAt() {
return this.createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return this.updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
}

View File

@ -65,6 +65,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
m.setDescription(d.getDescription());
m.setStatus(d.getStatus());
m.setCreatedAt(Date.from(d.getCreatedAt()));
m.setUpdatedAt(Date.from(d.getUpdatedAt()));
if (d.getFinalizedAt() != null) {
m.setFinalizedAt(Date.from(d.getFinalizedAt()));
}

View File

@ -66,6 +66,9 @@ public class DmpElasticBuilder extends BaseElasticBuilder<DmpElasticEntity, DmpE
if (d.getTenantId() != null) {
m.setTenantId(d.getTenantId());
}
m.setUpdatedAt(Date.from(d.getUpdatedAt()));
m.setCreatedAt(Date.from(d.getCreatedAt()));
if (referenceElasticEntityMap != null) m.setReferences(referenceElasticEntityMap.getOrDefault(d.getId(), null));
if (descriptionElasticEntityMap != null) m.setDescriptions(descriptionElasticEntityMap.getOrDefault(d.getId(), null));
if (dmpDescriptionTemplateElasticEntityMap != null) m.setDmpDescriptionTemplates(dmpDescriptionTemplateElasticEntityMap.getOrDefault(d.getId(), null));

View File

@ -280,7 +280,8 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
if (columns.contains(DescriptionElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._description), String.class));
if (columns.contains(DescriptionElasticEntity._status)) mocDoc.setStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._status), DescriptionStatus.class));
if (columns.contains(DescriptionElasticEntity._finalizedAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._finalizedAt), Date.class));
if (columns.contains(DescriptionElasticEntity._createdAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._createdAt), Date.class));
if (columns.contains(DescriptionElasticEntity._createdAt)) mocDoc.setCreatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._createdAt), Date.class));
if (columns.contains(DescriptionElasticEntity._updatedAt)) mocDoc.setUpdatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._updatedAt), Date.class));
mocDoc.setTags(this.convertNested(rawData, columns, this.queryFactory.query(NestedTagElasticQuery.class), DescriptionElasticEntity._tags, null));
mocDoc.setReferences(this.convertNested(rawData, columns, this.queryFactory.query(NestedReferenceElasticQuery.class), DescriptionElasticEntity._references, null));
mocDoc.setDescriptionTemplate(this.convertInnerObject(rawData, columns, this.queryFactory.query(InnerObjectDescriptionTemplateElasticQuery.class), DescriptionElasticEntity._descriptionTemplate, null));
@ -296,6 +297,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
else if (item.match(DescriptionElasticEntity._status)) return this.elasticFieldOf(DescriptionElasticEntity._status);
else if (item.match(DescriptionElasticEntity._finalizedAt)) return this.elasticFieldOf(DescriptionElasticEntity._finalizedAt);
else if (item.match(DescriptionElasticEntity._createdAt)) return this.elasticFieldOf(DescriptionElasticEntity._createdAt);
else if (item.match(DescriptionElasticEntity._updatedAt)) return this.elasticFieldOf(DescriptionElasticEntity._updatedAt);
else if (item.prefix(DescriptionElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(DescriptionElasticEntity._references).fieldNameOf(this.extractPrefixed(item, DescriptionElasticEntity._references));
else if (item.prefix(DescriptionElasticEntity._tags)) return this.queryFactory.query(NestedTagElasticQuery.class).nestedPath(DescriptionElasticEntity._tags).fieldNameOf(this.extractPrefixed(item, DescriptionElasticEntity._tags));
else if (item.prefix(DescriptionElasticEntity._descriptionTemplate)) return this.queryFactory.query(InnerObjectDescriptionTemplateElasticQuery.class).innerPath(DescriptionElasticEntity._descriptionTemplate).fieldNameOf(this.extractPrefixed(item, DescriptionElasticEntity._description));

View File

@ -341,6 +341,8 @@ public class DmpElasticQuery extends ElasticQuery<DmpElasticEntity, UUID> {
if (columns.contains(DmpElasticEntity._groupId)) mocDoc.setGroupId(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._groupId), UUID.class));
if (columns.contains(DmpElasticEntity._accessType)) mocDoc.setAccessType(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._accessType), DmpAccessType.class));
if (columns.contains(DmpElasticEntity._finalizedAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._finalizedAt), Date.class));
if (columns.contains(DmpElasticEntity._createdAt)) mocDoc.setCreatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._createdAt), Date.class));
if (columns.contains(DmpElasticEntity._updatedAt)) mocDoc.setUpdatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._updatedAt), Date.class));
mocDoc.setCollaborators(this.convertNested(rawData, columns, this.queryFactory.query(NestedCollaboratorElasticQuery.class), DmpElasticEntity._collaborators, null));
mocDoc.setReferences(this.convertNested(rawData, columns, this.queryFactory.query(NestedReferenceElasticQuery.class), DmpElasticEntity._references, null));
mocDoc.setDescriptions(this.convertNested(rawData, columns, this.queryFactory.query(NestedDescriptionElasticQuery.class), DmpElasticEntity._descriptions, null));
@ -358,6 +360,8 @@ public class DmpElasticQuery extends ElasticQuery<DmpElasticEntity, UUID> {
else if (item.match(DmpElasticEntity._versionStatus)) return this.elasticFieldOf(DmpElasticEntity._versionStatus);
else if (item.match(DmpElasticEntity._groupId)) return this.elasticFieldOf(DmpElasticEntity._groupId);
else if (item.match(DmpElasticEntity._finalizedAt)) return this.elasticFieldOf(DmpElasticEntity._finalizedAt);
else if (item.match(DmpElasticEntity._updatedAt)) return this.elasticFieldOf(DmpElasticEntity._updatedAt);
else if (item.match(DmpElasticEntity._createdAt)) return this.elasticFieldOf(DmpElasticEntity._createdAt);
else if (item.match(DmpElasticEntity._accessType)) return this.elasticFieldOf(DmpElasticEntity._accessType);
else if (item.prefix(DmpElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DmpElasticEntity._collaborators).fieldNameOf(this.extractPrefixed(item, DmpElasticEntity._collaborators));
else if (item.prefix(DmpElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(DmpElasticEntity._references).fieldNameOf(this.extractPrefixed(item, DmpElasticEntity._references));

View File

@ -203,7 +203,7 @@ public class ActionConfirmationQuery extends QueryBase<ActionConfirmationEntity>
@Override
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
List<Predicate> predicates = new ArrayList<>();
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ActionConfirmationEntity._token), this.like));
}
if (this.ids != null) {

View File

@ -272,7 +272,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
@Override
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
List<Predicate> predicates = new ArrayList<>();
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(queryContext.CriteriaBuilder.or(
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionEntity._description), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionEntity._label), this.like)

View File

@ -310,7 +310,7 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
inClause.value(item);
predicates.add(inClause);
}
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._label), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateEntity._description), this.like)
));

View File

@ -149,7 +149,7 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
inClause.value(item);
predicates.add(inClause);
}
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateTypeEntity._name), this.like));
}
if (this.isActives != null) {

View File

@ -212,7 +212,7 @@ public class DmpBlueprintQuery extends QueryBase<DmpBlueprintEntity> {
predicates.add(notInClause.not());
}
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DmpBlueprintEntity._label), this.like));
}

View File

@ -302,7 +302,7 @@ public class DmpQuery extends QueryBase<DmpEntity> {
@Override
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
List<Predicate> predicates = new ArrayList<>();
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DmpEntity._label), this.like));
}
if (this.ids != null) {

View File

@ -148,7 +148,7 @@ public class LanguageQuery extends QueryBase<LanguageEntity> {
inClause.value(item);
predicates.add(inClause);
}
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(LanguageEntity._code), this.like));
}
if (this.isActives != null) {

View File

@ -149,7 +149,7 @@ public class PrefillingSourceQuery extends QueryBase<PrefillingSourceEntity> {
inClause.value(item);
predicates.add(inClause);
}
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(PrefillingSourceEntity._code), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(PrefillingSourceEntity._label), this.like)
));

View File

@ -269,7 +269,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
inClause.value(item);
predicates.add(inClause);
}
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceEntity._label), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceEntity._description), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceEntity._reference), this.like)

View File

@ -150,7 +150,7 @@ public class ReferenceTypeQuery extends QueryBase<ReferenceTypeEntity> {
inClause.value(item);
predicates.add(inClause);
}
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._code), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(ReferenceTypeEntity._name), this.like)
));

View File

@ -167,7 +167,7 @@ public class StorageFileQuery extends QueryBase<StorageFileEntity> {
@Override
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
List<Predicate> predicates = new ArrayList<>();
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(StorageFileEntity._name), this.like));
}
if (this.ids != null) {

View File

@ -166,7 +166,7 @@ public class SupportiveMaterialQuery extends QueryBase<SupportiveMaterialEntity>
inClause.value(item);
predicates.add(inClause);
}
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._languageCode), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(SupportiveMaterialEntity._payload), this.like)
));

View File

@ -228,7 +228,7 @@ public class TagQuery extends QueryBase<TagEntity> {
@Override
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
List<Predicate> predicates = new ArrayList<>();
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TagEntity._label), this.like));
}
if (this.ids != null) {

View File

@ -151,7 +151,7 @@ public class TenantQuery extends QueryBase<TenantEntity> {
predicates.add(inClause);
}
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._code), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(TenantEntity._name), this.like)
));

View File

@ -196,7 +196,7 @@ public class UserQuery extends QueryBase<UserEntity> {
@Override
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
List<Predicate> predicates = new ArrayList<>();
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserEntity._name), this.like));
}
if (this.ids != null) {

View File

@ -183,7 +183,7 @@ public class UserSettingsQuery extends QueryBase<UserSettingsEntity> {
@Override
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
List<Predicate> predicates = new ArrayList<>();
if (this.like != null && !this.like.isEmpty()) {
if (this.like != null && !this.like.isBlank()) {
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._key), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(UserSettingsEntity._value), this.like)
));

View File

@ -139,6 +139,7 @@ public class ElasticServiceImpl implements ElasticService {
propertyMap.put(DescriptionElasticEntity._status, this.createElastic(FieldType.Short, false));
propertyMap.put(DescriptionElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false));
propertyMap.put(DescriptionElasticEntity._createdAt, this.createElastic(FieldType.Date, false));
propertyMap.put(DescriptionElasticEntity._updatedAt, this.createElastic(FieldType.Date, false));
propertyMap.put(DescriptionElasticEntity._tags, new Property.Builder().nested(x -> x.properties(this.createNestedTagsTemplatePropertyMap())).build());
propertyMap.put(DescriptionElasticEntity._references, new Property.Builder().nested(x -> x.properties(this.createNestedReferencesTemplatePropertyMap())).build());
@ -160,6 +161,8 @@ public class ElasticServiceImpl implements ElasticService {
propertyMap.put(DmpElasticEntity._accessType, this.createElastic(FieldType.Short, false));
propertyMap.put(DmpElasticEntity._groupId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(DmpElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false));
propertyMap.put(DmpElasticEntity._updatedAt, this.createElastic(FieldType.Date, false));
propertyMap.put(DmpElasticEntity._createdAt, this.createElastic(FieldType.Date, false));
propertyMap.put(DmpElasticEntity._versionStatus, this.createElastic(FieldType.Short, false));
propertyMap.put(DmpElasticEntity._descriptions, new Property.Builder().nested(x -> x.properties(this.createNestedDescriptionTemplatePropertyMap())).build());