no message
This commit is contained in:
parent
244c8f2afd
commit
bc8da3676a
|
@ -169,7 +169,7 @@ public class ReferenceServiceImpl implements ReferenceService {
|
||||||
ReferenceTypeEntity data = this.entityManager.find(ReferenceTypeEntity.class, lookup.getTypeId());
|
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()));
|
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());
|
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 (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());
|
models = models.stream().sorted(Comparator.comparing(Reference::getLabel, Comparator.nullsFirst(Comparator.naturalOrder()))).collect(Collectors.toList());
|
||||||
|
|
||||||
if (lookup.getPage() != null && !lookup.getPage().isEmpty()){
|
if (lookup.getPage() != null && !lookup.getPage().isEmpty()){
|
||||||
|
@ -205,11 +205,11 @@ public class ReferenceServiceImpl implements ReferenceService {
|
||||||
ReferenceEntity referenceEntity = new ReferenceEntity();
|
ReferenceEntity referenceEntity = new ReferenceEntity();
|
||||||
referenceEntity.setTypeId(data.getId());
|
referenceEntity.setTypeId(data.getId());
|
||||||
referenceEntity.setIsActive(IsActive.Active);
|
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.setSource(result.getOrDefault(ReferenceEntity.KnownFields.Key, null));
|
||||||
referenceEntity.setAbbreviation(result.getOrDefault(ReferenceEntity.KnownFields.Abbreviation, null));
|
referenceEntity.setAbbreviation(result.getOrDefault(ReferenceEntity.KnownFields.Abbreviation, null));
|
||||||
referenceEntity.setDescription(result.getOrDefault(ReferenceEntity.KnownFields.Description, 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);
|
referenceEntity.setSourceType(ReferenceSourceType.External);
|
||||||
DefinitionEntity definitionEntity = new DefinitionEntity();
|
DefinitionEntity definitionEntity = new DefinitionEntity();
|
||||||
definitionEntity.setFields(new ArrayList<>());
|
definitionEntity.setFields(new ArrayList<>());
|
||||||
|
|
|
@ -191,21 +191,21 @@ public class RemoteFetcherServiceImpl implements RemoteFetcherService {
|
||||||
filterValue = filterValue.replaceAll("\\{like}", likeValue);
|
filterValue = filterValue.replaceAll("\\{like}", likeValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
filterValue = queryConfig.getDefaultValue();
|
filterValue = queryConfig.getDefaultValue() == null ? "" : queryConfig.getDefaultValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finalQuery = finalQuery.replaceAll("{" + queryConfig.getName() + "}", filterValue);
|
finalQuery = finalQuery.replaceAll("\\{" + queryConfig.getName() + "}", filterValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalQuery;
|
return finalQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String replaceLookupFields(String path, final SourceExternalApiConfiguration<ResultsConfiguration<ResultFieldsMappingConfiguration>, AuthenticationConfiguration, QueryConfig<QueryCaseConfig>> apiSource, ExternalReferenceCriteria externalReferenceCriteria) {
|
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;
|
String completedPath = path;
|
||||||
|
|
||||||
if (this.conventionService.isListNullOrEmpty(apiSource.getQueries())){
|
if (!this.conventionService.isListNullOrEmpty(apiSource.getQueries())){
|
||||||
this.replaceLookupFieldQuery(completedPath, externalReferenceCriteria, apiSource.getQueries());
|
completedPath = this.replaceLookupFieldQuery(completedPath, externalReferenceCriteria, apiSource.getQueries());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPage())) completedPath = completedPath.replace("{page}", externalReferenceCriteria.getPage());
|
if (!this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPage())) completedPath = completedPath.replace("{page}", externalReferenceCriteria.getPage());
|
||||||
|
|
Loading…
Reference in New Issue