fix prefiling without get
This commit is contained in:
parent
c762613509
commit
b1a17faa40
|
@ -350,9 +350,14 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
|||
ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria();
|
||||
externalReferenceCriteria.setLike(model.getPrefillId());
|
||||
|
||||
ExternalDataResult externalData = this.externalFetcherService.getExternalData(Stream.of(prefillingSourceDefinition.getGetConfiguration()).collect(Collectors.toList()), externalReferenceCriteria, null);
|
||||
if (externalData == null || this.conventionService.isListNullOrEmpty(externalData.getResults())) {
|
||||
return null;
|
||||
Map<String, String> data = new HashMap<>();
|
||||
if (prefillingSourceDefinition.getGetConfiguration() != null){
|
||||
ExternalDataResult externalData = this.externalFetcherService.getExternalData(Stream.of(prefillingSourceDefinition.getGetConfiguration()).collect(Collectors.toList()), externalReferenceCriteria, null);
|
||||
if (externalData != null && !this.conventionService.isListNullOrEmpty(externalData.getResults())) {
|
||||
data = externalData.getResults().getFirst();
|
||||
}
|
||||
} else {
|
||||
data = model.getData() == null ? new HashMap<>() : model.getData();
|
||||
}
|
||||
|
||||
DescriptionTemplateEntity descriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, model.getDescriptionTemplateId());
|
||||
|
@ -363,7 +368,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
|||
FieldSet descriptionTemplateFields = fieldSet.extractPrefixed(this.conventionService.asPrefix(Description._descriptionTemplate));
|
||||
|
||||
description.setDescriptionTemplate(this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(descriptionTemplateFields, descriptionTemplateEntity));
|
||||
return mapPrefilledEntityToDescription(description, descriptionTemplateDefinition, prefillingSourceDefinition, prefillingSourceEntity.getLabel(), externalData.getResults().getFirst());//TODO
|
||||
return mapPrefilledEntityToDescription(description, descriptionTemplateDefinition, prefillingSourceDefinition, prefillingSourceEntity.getLabel(), data);
|
||||
}
|
||||
|
||||
private Description mapPrefilledEntityToDescription(Description description, DefinitionEntity descriptionTemplateDefinition, PrefillingSourceDefinitionEntity prefillingSourceDefinition, String type, Map<String, String> externalData){
|
||||
|
|
Loading…
Reference in New Issue