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

This commit is contained in:
Sofia Papacharalampous 2024-04-12 11:47:06 +03:00
commit ce07fb0894
2 changed files with 10 additions and 4 deletions

View File

@ -125,12 +125,16 @@ public class FieldPersist {
.must(() -> !this.isNull(item.getExternalIdentifier())) .must(() -> !this.isNull(item.getExternalIdentifier()))
.failOn(FieldPersist._externalIdentifier).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._externalIdentifier}, LocaleContextHolder.getLocale())), .failOn(FieldPersist._externalIdentifier).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._externalIdentifier}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(()-> FieldType.isTextListType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && required) .iff(()-> FieldType.isTextListType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && required && !fieldType.equals(FieldType.TAGS))
.must(() -> !this.isNull(item.getTextListValue())) .must(() -> !this.isListNullOrEmpty(item.getTextListValue()) || !this.isEmpty(item.getTextValue()))
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
this.spec()
.iff(()-> fieldType.equals(FieldType.TAGS) && DescriptionStatus.Finalized.equals(this.status) && required)
.must(() -> !this.isListNullOrEmpty(item.getTextListValue()))
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())), .failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(()-> FieldType.isReferenceType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && required) .iff(()-> FieldType.isReferenceType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && required)
.must(() -> !this.isNull(item.getTextListValue())) .must(() -> !this.isListNullOrEmpty(item.getTextListValue()))
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())), .failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(()-> !this.isEmpty(item.getTextValue()) && fieldType.equals(FieldType.CHECK_BOX) || fieldType.equals(FieldType.BOOLEAN_DECISION) ) .iff(()-> !this.isEmpty(item.getTextValue()) && fieldType.equals(FieldType.CHECK_BOX) || fieldType.equals(FieldType.BOOLEAN_DECISION) )

View File

@ -104,10 +104,12 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
const fields = [ const fields = [
nameof<StorageFile>(x => x.id), nameof<StorageFile>(x => x.id),
nameof<StorageFile>(x => x.name), nameof<StorageFile>(x => x.name),
nameof<StorageFile>(x => x.extension),
] ]
this.storageFileService.getSingle(id, fields).pipe(takeUntil(this._destroyed)).subscribe(storageFile => { this.storageFileService.getSingle(id, fields).pipe(takeUntil(this._destroyed)).subscribe(storageFile => {
this.fileNameDisplay = storageFile.name; if(storageFile.extension.startsWith('.')) this.fileNameDisplay = storageFile.name + storageFile.extension;
else this.fileNameDisplay = storageFile.name + '.' +storageFile.extension;
this.applyFieldType(); this.applyFieldType();
}); });
} else { } else {