Search in sources :

Example 6 with DocumentType

use of io.openk9.plugin.driver.manager.api.DocumentType in project openk9 by smclab.

the class PluginDriverDTOServiceImpl method _findDocumentType.

private PluginDriverDTO _findDocumentType(PluginDriver pluginDriver) {
    String name = pluginDriver.getName();
    List<DocumentType> documentTypeList = _documentTypeProvider.getDocumentTypeList(name);
    DocumentType defaultDocumentType = _documentTypeProvider.getDefaultDocumentType(name);
    if (documentTypeList.isEmpty() && defaultDocumentType != null) {
        documentTypeList = List.of(defaultDocumentType);
    } else if (!documentTypeList.isEmpty() && defaultDocumentType == null) {
        defaultDocumentType = documentTypeList.get(0);
    }
    List<DocumentTypeDTO> documentTypeDTOS = documentTypeList.stream().map(documentType -> DocumentTypeDTO.of(documentType.getName(), documentType.getIcon(), _wrapSearchKeywords(documentType))).collect(Collectors.toList());
    return PluginDriverDTO.of(pluginDriver.getDriverServiceName(), pluginDriver.getName(), pluginDriver.schedulerEnabled(), documentTypeDTOS, defaultDocumentType == null ? null : DocumentTypeDTO.of(defaultDocumentType.getName(), defaultDocumentType.getIcon(), _wrapSearchKeywords(defaultDocumentType)));
}
Also used : PluginDriverDTO(io.openk9.plugin.driver.manager.model.PluginDriverDTO) SearchKeyword(io.openk9.plugin.driver.manager.api.SearchKeyword) FieldBoostDTO(io.openk9.plugin.driver.manager.model.FieldBoostDTO) PluginDriverDTOList(io.openk9.plugin.driver.manager.model.PluginDriverDTOList) Collection(java.util.Collection) DocumentTypeDTO(io.openk9.plugin.driver.manager.model.DocumentTypeDTO) PluginDriverDTOService(io.openk9.plugin.driver.manager.api.PluginDriverDTOService) PluginDriverRegistry(io.openk9.plugin.driver.manager.api.PluginDriverRegistry) DocumentType(io.openk9.plugin.driver.manager.api.DocumentType) SearchKeywordDTO(io.openk9.plugin.driver.manager.model.SearchKeywordDTO) Collectors(java.util.stream.Collectors) Component(org.osgi.service.component.annotations.Component) List(java.util.List) Optional(java.util.Optional) PluginDriver(io.openk9.plugin.driver.manager.api.PluginDriver) Reference(org.osgi.service.component.annotations.Reference) DocumentTypeProvider(io.openk9.plugin.driver.manager.api.DocumentTypeProvider) DocumentType(io.openk9.plugin.driver.manager.api.DocumentType) DocumentTypeDTO(io.openk9.plugin.driver.manager.model.DocumentTypeDTO)

Aggregations

DocumentType (io.openk9.plugin.driver.manager.api.DocumentType)3 DocumentTypeDTO (io.openk9.plugin.driver.manager.model.DocumentTypeDTO)3 List (java.util.List)3 Map (java.util.Map)3 Reference (org.osgi.service.component.annotations.Reference)3 PluginDriver (io.openk9.plugin.driver.manager.api.PluginDriver)2 PluginDriverDTO (io.openk9.plugin.driver.manager.model.PluginDriverDTO)2 SearchKeywordDTO (io.openk9.plugin.driver.manager.model.SearchKeywordDTO)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 Collectors (java.util.stream.Collectors)2 Component (org.osgi.service.component.annotations.Component)2 HttpClient (io.openk9.http.client.HttpClient)1 IndexWriterEventPublisher (io.openk9.index.writer.mappings.publisher.api.IndexWriterEventPublisher)1 IndexTemplateDTO (io.openk9.index.writer.model.IndexTemplateDTO)1 JsonFactory (io.openk9.json.api.JsonFactory)1 JsonNode (io.openk9.json.api.JsonNode)1 ObjectNode (io.openk9.json.api.ObjectNode)1 Datasource (io.openk9.model.Datasource)1 BasePluginDriver (io.openk9.plugin.driver.manager.api.BasePluginDriver)1