no message

This commit is contained in:
Diamantis Tziotzios 2024-02-16 11:48:56 +02:00
parent 244c8f2afd
commit bc8da3676a
2 changed files with 9 additions and 9 deletions

View File

@ -169,7 +169,7 @@ public class ReferenceServiceImpl implements ReferenceService {
ReferenceTypeEntity data = this.entityManager.find(ReferenceTypeEntity.class, lookup.getTypeId());
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{lookup.getTypeId(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(lookup.getLike());
ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(lookup.getLike().replaceAll("%", ""));
ExternalDataResult remoteRepos = this.getReferenceData(data, externalReferenceCriteria, lookup.getKey());
@ -190,7 +190,7 @@ public class ReferenceServiceImpl implements ReferenceService {
if (models.stream().noneMatch(x-> x.getReference() != null && x.getSource() != null && x.getReference().equals(externalReference.getReference()) && x.getSource().equals(externalReference.getSource()))) models.add(externalReference);
}
if (!this.conventionService.isNullOrEmpty(lookup.getLike())) { models = models.stream().filter(x -> x.getLabel().toLowerCase().contains(lookup.getLike().toLowerCase())).collect(Collectors.toList()); }
if (!this.conventionService.isNullOrEmpty(lookup.getLike())) { models = models.stream().filter(x -> x.getLabel().toLowerCase().contains(lookup.getLike().replaceAll("%", "").toLowerCase())).collect(Collectors.toList()); }
models = models.stream().sorted(Comparator.comparing(Reference::getLabel, Comparator.nullsFirst(Comparator.naturalOrder()))).collect(Collectors.toList());
if (lookup.getPage() != null && !lookup.getPage().isEmpty()){
@ -205,11 +205,11 @@ public class ReferenceServiceImpl implements ReferenceService {
ReferenceEntity referenceEntity = new ReferenceEntity();
referenceEntity.setTypeId(data.getId());
referenceEntity.setIsActive(IsActive.Active);
referenceEntity.setReference(result.getOrDefault(ReferenceEntity.KnownFields.ReferenceId, null) + ":" + remoteRepos.getResults().getFirst().getOrDefault("reference_id", null));
referenceEntity.setReference(result.getOrDefault(ReferenceEntity.KnownFields.ReferenceId, null));
referenceEntity.setSource(result.getOrDefault(ReferenceEntity.KnownFields.Key, null));
referenceEntity.setAbbreviation(result.getOrDefault(ReferenceEntity.KnownFields.Abbreviation, null));
referenceEntity.setDescription(result.getOrDefault(ReferenceEntity.KnownFields.Description, null));
referenceEntity.setLabel(result.getOrDefault(ReferenceEntity.KnownFields.Abbreviation, null));
referenceEntity.setLabel(result.getOrDefault(ReferenceEntity.KnownFields.Label, null));
referenceEntity.setSourceType(ReferenceSourceType.External);
DefinitionEntity definitionEntity = new DefinitionEntity();
definitionEntity.setFields(new ArrayList<>());

View File

@ -191,21 +191,21 @@ public class RemoteFetcherServiceImpl implements RemoteFetcherService {
filterValue = filterValue.replaceAll("\\{like}", likeValue);
}
} else {
filterValue = queryConfig.getDefaultValue();
filterValue = queryConfig.getDefaultValue() == null ? "" : queryConfig.getDefaultValue();
}
}
finalQuery = finalQuery.replaceAll("{" + queryConfig.getName() + "}", filterValue);
finalQuery = finalQuery.replaceAll("\\{" + queryConfig.getName() + "}", filterValue);
}
return finalQuery;
}
protected String replaceLookupFields(String path, final SourceExternalApiConfiguration<ResultsConfiguration<ResultFieldsMappingConfiguration>, AuthenticationConfiguration, QueryConfig<QueryCaseConfig>> apiSource, ExternalReferenceCriteria externalReferenceCriteria) {
if (!this.conventionService.isNullOrEmpty(path)) return path;
if (this.conventionService.isNullOrEmpty(path)) return path;
String completedPath = path;
if (this.conventionService.isListNullOrEmpty(apiSource.getQueries())){
this.replaceLookupFieldQuery(completedPath, externalReferenceCriteria, apiSource.getQueries());
if (!this.conventionService.isListNullOrEmpty(apiSource.getQueries())){
completedPath = this.replaceLookupFieldQuery(completedPath, externalReferenceCriteria, apiSource.getQueries());
}
if (!this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPage())) completedPath = completedPath.replace("{page}", externalReferenceCriteria.getPage());