Search in sources :

Example 1 with NegotiatorConfig

use of org.molgenis.dataexplorer.negotiator.config.NegotiatorConfig in project molgenis by molgenis.

the class NegotiatorController method exportToNegotiator.

@PostMapping("/export")
@ResponseBody
public String exportToNegotiator(@RequestBody NegotiatorRequest request) {
    LOG.info("Sending Negotiator request");
    NegotiatorEntityConfig entityConfig = getNegotiatorEntityConfig(request.getEntityId());
    NegotiatorConfig config = entityConfig.getNegotiatorConfig();
    String expression = config.getString(ENABLED_EXPRESSION);
    List<Collection> nonDisabledCollectionEntities = getCollectionEntities(request).stream().filter(entity -> expression == null || evaluateExpressionOnEntity(expression, entity)).map(entity -> getEntityCollection(entityConfig, entity)).collect(toList());
    HttpEntity<NegotiatorQuery> queryHttpEntity = getNegotiatorQueryHttpEntity(request, config, nonDisabledCollectionEntities);
    return postQueryToNegotiator(config, queryHttpEntity);
}
Also used : PluginController(org.molgenis.web.PluginController) NegotiatorConfig(org.molgenis.dataexplorer.negotiator.config.NegotiatorConfig) ErrorMessageResponse(org.molgenis.web.ErrorMessageResponse) LoggerFactory(org.slf4j.LoggerFactory) QueryImpl(org.molgenis.data.support.QueryImpl) Controller(org.springframework.stereotype.Controller) Attribute(org.molgenis.data.meta.model.Attribute) RunAsSystem(org.molgenis.security.core.runas.RunAsSystem) Function(java.util.function.Function) PluginPermission(org.molgenis.data.plugin.model.PluginPermission) Objects.requireNonNull(java.util.Objects.requireNonNull) PluginIdentity(org.molgenis.data.plugin.model.PluginIdentity) JsMagmaScriptEvaluator(org.molgenis.js.magma.JsMagmaScriptEvaluator) APPLICATION_JSON(org.springframework.http.MediaType.APPLICATION_JSON) RestTemplate(org.springframework.web.client.RestTemplate) MessageSource(org.springframework.context.MessageSource) RestClientException(org.springframework.web.client.RestClientException) QueryRsqlConverter(org.molgenis.data.rest.convert.QueryRsqlConverter) Logger(org.slf4j.Logger) URI(org.molgenis.dataexplorer.negotiator.NegotiatorController.URI) LocaleContextHolder.getLocale(org.springframework.context.i18n.LocaleContextHolder.getLocale) HttpHeaders(org.springframework.http.HttpHeaders) UTF_8(java.nio.charset.StandardCharsets.UTF_8) NegotiatorEntityConfigMeta(org.molgenis.dataexplorer.negotiator.config.NegotiatorEntityConfigMeta) EntityTypeUtils(org.molgenis.data.support.EntityTypeUtils) EntityType(org.molgenis.data.meta.model.EntityType) Collectors(java.util.stream.Collectors) HttpStatus(org.springframework.http.HttpStatus) HttpEntity(org.springframework.http.HttpEntity) Base64(java.util.Base64) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) ENABLED_EXPRESSION(org.molgenis.dataexplorer.negotiator.config.NegotiatorEntityConfigMeta.ENABLED_EXPRESSION) UserPermissionEvaluator(org.molgenis.security.core.UserPermissionEvaluator) org.springframework.web.bind.annotation(org.springframework.web.bind.annotation) DataService(org.molgenis.data.DataService) Query(org.molgenis.data.Query) NegotiatorEntityConfig(org.molgenis.dataexplorer.negotiator.config.NegotiatorEntityConfig) MolgenisDataException(org.molgenis.data.MolgenisDataException) Entity(org.molgenis.data.Entity) NegotiatorEntityConfig(org.molgenis.dataexplorer.negotiator.config.NegotiatorEntityConfig) NegotiatorConfig(org.molgenis.dataexplorer.negotiator.config.NegotiatorConfig)

Aggregations

UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 Base64 (java.util.Base64)1 List (java.util.List)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 DataService (org.molgenis.data.DataService)1 Entity (org.molgenis.data.Entity)1 MolgenisDataException (org.molgenis.data.MolgenisDataException)1 Query (org.molgenis.data.Query)1 Attribute (org.molgenis.data.meta.model.Attribute)1 EntityType (org.molgenis.data.meta.model.EntityType)1 PluginIdentity (org.molgenis.data.plugin.model.PluginIdentity)1 PluginPermission (org.molgenis.data.plugin.model.PluginPermission)1 QueryRsqlConverter (org.molgenis.data.rest.convert.QueryRsqlConverter)1 EntityTypeUtils (org.molgenis.data.support.EntityTypeUtils)1 QueryImpl (org.molgenis.data.support.QueryImpl)1 URI (org.molgenis.dataexplorer.negotiator.NegotiatorController.URI)1 NegotiatorConfig (org.molgenis.dataexplorer.negotiator.config.NegotiatorConfig)1