add single reference description editor build form
This commit is contained in:
parent
1d5403fc25
commit
c5b1c89a7e
|
@ -518,7 +518,10 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
}
|
||||
|
||||
private void BuildDescriptionReferencePersist(String fieldId, FieldPersist fieldPersist, List<DescriptionReferencePersist> descriptionReferencePersists) {
|
||||
if (fieldPersist.getReference() != null) fieldPersist.getReferences().add(fieldPersist.getReference());
|
||||
if (fieldPersist.getReference() != null) {
|
||||
if (fieldPersist.getReferences() == null) fieldPersist.setReferences(new ArrayList<>());
|
||||
fieldPersist.getReferences().add(fieldPersist.getReference());
|
||||
}
|
||||
if (!this.conventionService.isListNullOrEmpty(fieldPersist.getReferences())) {
|
||||
for (ReferencePersist referencePersist : fieldPersist.getReferences()) {
|
||||
DescriptionReferencePersist descriptionReferencePersist = new DescriptionReferencePersist();
|
||||
|
|
|
@ -4,6 +4,7 @@ import eu.eudat.commons.types.description.FieldEntity;
|
|||
import eu.eudat.model.persist.descriptionproperties.FieldPersist;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Field {
|
||||
|
@ -43,7 +44,10 @@ public class Field {
|
|||
tempTextListValue = persist.getTextListValue();
|
||||
if (persist.getExternalIdentifier() != null) this.externalIdentifier = new ExternalIdentifier(persist.getExternalIdentifier());
|
||||
else this.externalIdentifier = null;
|
||||
if (persist.getReference() != null) persist.getReferences().add(persist.getReference());
|
||||
if (persist.getReference() != null) {
|
||||
if (persist.getReferences() == null) persist.setReferences(new ArrayList<>());
|
||||
persist.getReferences().add(persist.getReference());
|
||||
}
|
||||
if (persist.getReferences() != null && !persist.getReferences().isEmpty()){
|
||||
tempTextListValue = persist.getReferences().stream().filter(x-> x.getId() != null).map(x-> x.getId().toString()).toList();
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ export interface DescriptionTemplateMultiplicity {
|
|||
export interface DescriptionTemplateBaseFieldData {
|
||||
label: string;
|
||||
fieldType: DescriptionTemplateFieldType;
|
||||
multipleSelect?: boolean;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -430,20 +430,34 @@ export class DescriptionFieldEditorModel implements DescriptionFieldPersist {
|
|||
this.textListValue = item.textListValue;
|
||||
this.dateValue = item.dateValue;
|
||||
|
||||
// this.reference = descriptionReferences?.find(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active)?.reference;
|
||||
this.reference = descriptionReferences?.filter(x => descriptionTemplateField.data.multipleSelect == false && x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active).map(x => {
|
||||
return {
|
||||
id: x.reference.id,
|
||||
label: x.reference.label,
|
||||
reference: x.reference.reference,
|
||||
source: x.reference.source,
|
||||
typeId: x.reference.type.id,
|
||||
description: x.reference.source,
|
||||
definition: x.reference.definition,
|
||||
abbreviation: x.reference.abbreviation,
|
||||
sourceType: x.reference.sourceType
|
||||
}
|
||||
})[0];
|
||||
|
||||
this.references = descriptionReferences?.filter(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active).map(x => {
|
||||
return {
|
||||
id: x.reference.id,
|
||||
label: x.reference.label,
|
||||
reference: x.reference.reference,
|
||||
source: x.reference.source,
|
||||
typeId: x.reference.type.id,
|
||||
description: x.reference.source,
|
||||
definition: x.reference.definition,
|
||||
abbreviation: x.reference.abbreviation,
|
||||
sourceType: x.reference.sourceType
|
||||
}
|
||||
});
|
||||
return {
|
||||
id: x.reference.id,
|
||||
label: x.reference.label,
|
||||
reference: x.reference.reference,
|
||||
source: x.reference.source,
|
||||
typeId: x.reference.type.id,
|
||||
description: x.reference.source,
|
||||
definition: x.reference.definition,
|
||||
abbreviation: x.reference.abbreviation,
|
||||
sourceType: x.reference.sourceType
|
||||
}
|
||||
});
|
||||
|
||||
this.externalIdentifier = new DescriptionExternalIdentifierEditorModel(this.validationErrorModel).fromModel(item.externalIdentifier);
|
||||
}
|
||||
return this;
|
||||
|
|
|
@ -294,28 +294,22 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist {
|
|||
fromModel(item: DmpBlueprintValue, dmpReferences: DmpReference[]): DmpBlueprintValueEditorModel {
|
||||
this.fieldId = item.fieldId;
|
||||
this.fieldValue = item.fieldValue;
|
||||
// TODO check typeId field
|
||||
if(dmpReferences){
|
||||
dmpReferences.forEach(dmpReference => {
|
||||
if(dmpReference.data.blueprintFieldId == this.fieldId && dmpReference.isActive == IsActive.Active){
|
||||
this.references.push({
|
||||
data: dmpReference.data,
|
||||
reference: {
|
||||
id: dmpReference.reference.id,
|
||||
label: dmpReference.reference.label,
|
||||
reference: dmpReference.reference.reference,
|
||||
source: dmpReference.reference.source,
|
||||
typeId: null,
|
||||
description: dmpReference.reference.source,
|
||||
definition: dmpReference.reference.definition,
|
||||
abbreviation: dmpReference.reference.abbreviation,
|
||||
sourceType: dmpReference.reference.sourceType
|
||||
}
|
||||
})
|
||||
|
||||
this.references = dmpReferences?.filter(x => x.data.blueprintFieldId == this.fieldId && x.isActive == IsActive.Active).map(x => {
|
||||
return {
|
||||
data: x.data,
|
||||
reference: {
|
||||
id: x.reference.id,
|
||||
label: x.reference.label,
|
||||
reference: x.reference.reference,
|
||||
source: x.reference.source,
|
||||
typeId: x.reference.type?.id,
|
||||
description: x.reference.source,
|
||||
definition: x.reference.definition,
|
||||
abbreviation: x.reference.abbreviation,
|
||||
sourceType: x.reference.sourceType
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue