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)));
}
Aggregations