Search in sources :

Example 1 with Breadcrumb

use of com.odysseusinc.arachne.portal.service.impl.breadcrumb.Breadcrumb in project ArachneCentralAPI by OHDSI.

the class BaseSolrServiceImpl method addBreadcrumbsIfNeeded.

private void addBreadcrumbsIfNeeded(final Object entity, final Map<T, Object> values) {
    if (entity instanceof Breadcrumb) {
        final Breadcrumb bc = (Breadcrumb) entity;
        try {
            final List<BreadcrumbDTO> breadcrumbs = breadcrumbService.getBreadcrumbs(bc).stream().map(v -> conversionService.convert(v, BreadcrumbDTO.class)).collect(Collectors.toList());
            final T field = newSolrField(BREADCRUMBS);
            field.setPostfixNeeded(Boolean.FALSE);
            field.setSearchable(Boolean.FALSE);
            values.put(field, objectMapper.writeValueAsString(breadcrumbs));
        } catch (final JsonProcessingException e) {
            throw new UnsupportedOperationException(e);
        }
    }
}
Also used : BreadcrumbDTO(com.odysseusinc.arachne.portal.api.v1.dto.BreadcrumbDTO) Arrays(java.util.Arrays) BreadcrumbDTO(com.odysseusinc.arachne.portal.api.v1.dto.BreadcrumbDTO) FieldList(com.odysseusinc.arachne.portal.service.impl.solr.FieldList) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) SolrFieldExtractor(com.odysseusinc.arachne.portal.api.v1.dto.converters.SolrFieldExtractor) StringUtils(org.apache.commons.lang3.StringUtils) TenantContext(com.odysseusinc.arachne.portal.config.tenancy.TenantContext) BreadcrumbService(com.odysseusinc.arachne.portal.service.BreadcrumbService) SolrException(com.odysseusinc.arachne.portal.model.solr.SolrException) SolrServerException(org.apache.solr.client.solrj.SolrServerException) SolrField(com.odysseusinc.arachne.portal.service.impl.solr.SolrField) Map(java.util.Map) Breadcrumb(com.odysseusinc.arachne.portal.service.impl.breadcrumb.Breadcrumb) LinkedList(java.util.LinkedList) ConversionService(org.springframework.core.convert.ConversionService) BaseSolrService(com.odysseusinc.arachne.portal.service.BaseSolrService) SolrValue(com.odysseusinc.arachne.portal.model.solr.SolrValue) Collection(java.util.Collection) QueryResponse(org.apache.solr.client.solrj.response.QueryResponse) AnnotationUtils(org.springframework.core.annotation.AnnotationUtils) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SolrFieldAnno(com.odysseusinc.arachne.portal.model.solr.SolrFieldAnno) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) Field(java.lang.reflect.Field) Collectors(java.util.stream.Collectors) SolrClient(org.apache.solr.client.solrj.SolrClient) SolrCollection(com.odysseusinc.arachne.portal.model.solr.SolrCollection) SolrEntity(com.odysseusinc.arachne.portal.model.solr.SolrEntity) List(java.util.List) SolrQuery(org.apache.solr.client.solrj.SolrQuery) Optional(java.util.Optional) Collections(java.util.Collections) UpdateResponse(org.apache.solr.client.solrj.response.UpdateResponse) SolrInputDocument(org.apache.solr.common.SolrInputDocument) BeanUtils(org.springframework.beans.BeanUtils) Breadcrumb(com.odysseusinc.arachne.portal.service.impl.breadcrumb.Breadcrumb) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 BreadcrumbDTO (com.odysseusinc.arachne.portal.api.v1.dto.BreadcrumbDTO)1 SolrFieldExtractor (com.odysseusinc.arachne.portal.api.v1.dto.converters.SolrFieldExtractor)1 TenantContext (com.odysseusinc.arachne.portal.config.tenancy.TenantContext)1 SolrCollection (com.odysseusinc.arachne.portal.model.solr.SolrCollection)1 SolrEntity (com.odysseusinc.arachne.portal.model.solr.SolrEntity)1 SolrException (com.odysseusinc.arachne.portal.model.solr.SolrException)1 SolrFieldAnno (com.odysseusinc.arachne.portal.model.solr.SolrFieldAnno)1 SolrValue (com.odysseusinc.arachne.portal.model.solr.SolrValue)1 BaseSolrService (com.odysseusinc.arachne.portal.service.BaseSolrService)1 BreadcrumbService (com.odysseusinc.arachne.portal.service.BreadcrumbService)1 Breadcrumb (com.odysseusinc.arachne.portal.service.impl.breadcrumb.Breadcrumb)1 FieldList (com.odysseusinc.arachne.portal.service.impl.solr.FieldList)1 SolrField (com.odysseusinc.arachne.portal.service.impl.solr.SolrField)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1