From 31b4e8fd39bb337091ad05f60b33d39340bae2b3 Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Thu, 9 May 2024 09:50:34 +0300 Subject: [PATCH 1/5] maintenance changes --- .../opencdmp/service/maintenance/MaintenanceServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceServiceImpl.java index f9df1bd34..0934f5593 100644 --- a/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceServiceImpl.java @@ -141,7 +141,7 @@ public class MaintenanceServiceImpl implements MaintenanceService { private void sendTenantDmpTouchEvents(UUID tenantId, String tenantCode) throws InvalidApplicationException { try { this.tenantScope.setTempTenant(this.entityManager.getEntityManager(), tenantId, tenantCode); - List items = this.queryFactory.query(DmpQuery.class).disableTracking().isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._isActive)); + List items = this.queryFactory.query(DmpQuery.class).disableTracking().collectAs(new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._isActive)); for (DmpEntity item : items) { if (item.getIsActive().equals(IsActive.Active)) this.annotationEntityTouchedIntegrationEventHandler.handleDmp(item.getId()); else this.annotationEntityRemovalIntegrationEventHandler.handleDmp(item.getId()); @@ -171,7 +171,7 @@ public class MaintenanceServiceImpl implements MaintenanceService { private void sendTenantDescriptionTouchEvents(UUID tenantId, String tenantCode) throws InvalidApplicationException { try { this.tenantScope.setTempTenant(this.entityManager.getEntityManager(), tenantId, tenantCode); - List items = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Description._id).ensure(Description._isActive)); + List items = this.queryFactory.query(DescriptionQuery.class).disableTracking().collectAs(new BaseFieldSet().ensure(Description._id).ensure(Description._isActive)); for (DescriptionEntity item : items) { if (item.getIsActive().equals(IsActive.Active)) this.annotationEntityTouchedIntegrationEventHandler.handleDescription(item.getId()); else this.annotationEntityRemovalIntegrationEventHandler.handleDescription(item.getId()); From 33c7676464b52d806c4fda89950c5c2f23c5796a Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Thu, 9 May 2024 10:47:34 +0300 Subject: [PATCH 2/5] small fixes --- .../components/form-field/form-field.component.ts | 13 +++---------- .../form-section/form-section.component.html | 2 +- .../form-section/form-section.component.ts | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts index a904605f7..a4eed8824 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts @@ -87,7 +87,8 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn public dialog: MatDialog, private fileUtils: FileUtils, private referenceService: ReferenceService, - private storageFileService: StorageFileService + private storageFileService: StorageFileService, + private changeDetectorRef: ChangeDetectorRef ) { super(); } @@ -117,15 +118,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn } } - checkBoxChanged(event: MatCheckboxChange){ - if (event.checked){ - this.propertiesFormGroup?.get(this.field.id).get('textValue').setValue("true"); - } else{ - this.propertiesFormGroup?.get(this.field.id).get('textValue').setValue("false"); - } - this.visibilityRulesService.reloadVisibility(); - } - private applyFieldType(){ this.isRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Required); @@ -287,6 +279,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn private createFileNameDisplay(name: string, extension: string){ if (extension.startsWith('.')) this.fileNameDisplay = name + extension; else this.fileNameDisplay = name + '.' + extension; + this.changeDetectorRef.markForCheck(); } diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html index 11d7a32fe..f8b89731b 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html @@ -33,7 +33,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts index 135098f79..72ae9989c 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts @@ -70,7 +70,7 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On } onAskedToScroll(event:MouseEvent, id: string) { - event.stopPropagation(); + event?.stopPropagation(); this.panelExpanded = true; this.askedToScroll.emit(id); } From 0dc9a5e8568805c8d59addaff7d8b57381a1eba8 Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 9 May 2024 10:52:36 +0300 Subject: [PATCH 3/5] dmp ui contact ui fix --- .../app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html index 562dc4966..85f5c534b 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html @@ -228,7 +228,7 @@ -
+
@@ -239,7 +239,7 @@
-
From 40df26c56084081ebb286138512d0b652547935b Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 9 May 2024 11:09:51 +0300 Subject: [PATCH 4/5] description template build default value fix issue --- .../descriptiontemplatedefinition/DefaultValuePersist.java | 6 ++++++ .../descriptiontemplate/DescriptionTemplateServiceImpl.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/DefaultValuePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/DefaultValuePersist.java index 5fa6cdca9..5e70ab236 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/DefaultValuePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/DefaultValuePersist.java @@ -48,6 +48,12 @@ public class DefaultValuePersist { this.booleanValue = booleanValue; } + public Boolean isNullOrEmpty(){ + if ((this.textValue == null || this.textValue.isEmpty()) && this.dateValue == null && this.booleanValue == null) return true; + return false; + } + + @Component(DefaultValuePersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class DefaultValuePersistValidator extends BaseValidator { diff --git a/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java index da9b91407..593d08005 100644 --- a/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java @@ -413,7 +413,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic private @NotNull DefaultValueEntity buildDefaultValueEntity(DefaultValuePersist persist, FieldEntity fieldEntity) { FieldType fieldType = fieldEntity != null && fieldEntity.getData() != null ? fieldEntity.getData().getFieldType() : FieldType.FREE_TEXT; DefaultValueEntity data = new DefaultValueEntity(); - if (persist == null) return data; + if (persist == null || persist.isNullOrEmpty()) return data; if (FieldType.isTextType(fieldType) || FieldType.isTextListType(fieldType)) { if (FieldType.UPLOAD.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("Upload not supported"); From 4b32d5f5482f5e6d0b6f526e1a8327c4de7611f2 Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Thu, 9 May 2024 12:38:55 +0300 Subject: [PATCH 5/5] bug fixes --- .../description/FieldCommonModelBuilder.java | 2 ++ ...efinitionFieldSetItemModelCommonModelBuilder.java | 12 ++++++------ .../DefaultValueCommonModelBuilder.java | 2 ++ .../filetransformer/FileTransformerRepository.java | 10 +++++----- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/FieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/FieldCommonModelBuilder.java index 0a353c716..42605a61c 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/FieldCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/FieldCommonModelBuilder.java @@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import java.io.IOException; import java.net.URLConnection; @@ -39,6 +40,7 @@ import java.time.Duration; import java.util.*; import java.util.stream.Collectors; +@Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class FieldCommonModelBuilder extends BaseCommonModelBuilder { private final BuilderFactory builderFactory; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/PropertyDefinitionFieldSetItemModelCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/PropertyDefinitionFieldSetItemModelCommonModelBuilder.java index cbb499fb0..95523c825 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/PropertyDefinitionFieldSetItemModelCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/PropertyDefinitionFieldSetItemModelCommonModelBuilder.java @@ -1,5 +1,8 @@ package org.opencdmp.model.builder.commonmodels.description; +import gr.cite.tools.data.builder.BuilderFactory; +import gr.cite.tools.exception.MyApplicationException; +import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.models.description.PropertyDefinitionFieldSetItemModel; import org.opencdmp.commons.types.description.PropertyDefinitionFieldSetItemEntity; @@ -8,9 +11,6 @@ import org.opencdmp.commons.types.descriptiontemplate.FieldSetEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; -import gr.cite.tools.data.builder.BuilderFactory; -import gr.cite.tools.exception.MyApplicationException; -import gr.cite.tools.logging.LoggerService; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -20,7 +20,7 @@ import org.springframework.stereotype.Component; import java.util.*; @Component -@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class PropertyDefinitionFieldSetItemModelCommonModelBuilder extends BaseCommonModelBuilder { private final BuilderFactory builderFactory; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @@ -66,8 +66,8 @@ public class PropertyDefinitionFieldSetItemModelCommonModelBuilder extends BaseC if (d.getFields() != null && !d.getFields().isEmpty()) { m.setFields(new HashMap<>()); for (String key : d.getFields().keySet()){ - FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null; - m.getFields().put(key, this.builderFactory.builder(FieldCommonModelBuilder.class).useSharedStorage(useSharedStorage).authorize(this.authorize).withFieldEntity(fieldEntity).build(d.getFields().get(key))); + FieldEntity fieldEntity = this.fieldSetEntity != null ? this.fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null; + m.getFields().put(key, this.builderFactory.builder(FieldCommonModelBuilder.class).useSharedStorage(this.useSharedStorage).authorize(this.authorize).withFieldEntity(fieldEntity).build(d.getFields().get(key))); } } models.add(new CommonModelBuilderItemResponse<>(m, d)); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/DefaultValueCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/DefaultValueCommonModelBuilder.java index 3777eaabb..f179f018d 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/DefaultValueCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/DefaultValueCommonModelBuilder.java @@ -12,12 +12,14 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; import java.util.Optional; +@Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DefaultValueCommonModelBuilder extends BaseCommonModelBuilder { private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); diff --git a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerRepository.java b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerRepository.java index 21af559a8..1a28fa2ff 100644 --- a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerRepository.java +++ b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerRepository.java @@ -20,31 +20,31 @@ public class FileTransformerRepository implements FileTransformerClient { @Override public FileEnvelopeModel exportDmp(DmpModel dmpModel, String format) { - return transformerClient.post().uri("/export/dmp", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(dmpModel) + return this.transformerClient.post().uri("/export/dmp", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(dmpModel) .exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(FileEnvelopeModel.class)).block(); } @Override public DmpModel importDmp(FileEnvelopeModel fileEnvelope) { - return transformerClient.post().uri("/import/dmp").bodyValue(fileEnvelope) + return this.transformerClient.post().uri("/import/dmp").bodyValue(fileEnvelope) .exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(DmpModel.class)).block(); } @Override public FileEnvelopeModel exportDescription(DescriptionModel descriptionModel, String format) { - return transformerClient.post().uri("/export/description", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(descriptionModel) + return this.transformerClient.post().uri("/export/description", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(descriptionModel) .exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(FileEnvelopeModel.class)).block(); } @Override public DescriptionModel importDescription(FileEnvelopeModel fileEnvelope) { - return transformerClient.post().uri("/import/description").bodyValue(fileEnvelope) + return this.transformerClient.post().uri("/import/description").bodyValue(fileEnvelope) .exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(DescriptionModel.class)).block(); } @Override public FileTransformerConfiguration getConfiguration() { - return transformerClient.get().uri("/formats") + return this.transformerClient.get().uri("/formats") .exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(new ParameterizedTypeReference() {})).block(); }