Search in sources :

Example 1 with StringToDateConverter

use of org.molgenis.data.convert.StringToDateConverter in project molgenis by molgenis.

the class MolgenisWebAppConfig method addFormatters.

@Override
public void addFormatters(FormatterRegistry registry) {
    registry.addConverter(new StringToDateTimeConverter());
    registry.addConverter(new StringToDateConverter());
}
Also used : StringToDateTimeConverter(org.molgenis.data.convert.StringToDateTimeConverter) StringToDateConverter(org.molgenis.data.convert.StringToDateConverter)

Example 2 with StringToDateConverter

use of org.molgenis.data.convert.StringToDateConverter in project molgenis by molgenis.

the class DataConverter method getConversionService.

private static ConversionService getConversionService() {
    if (conversionService == null) {
        if (ApplicationContextProvider.getApplicationContext() == null) {
            // We are not in a Spring managed environment
            conversionService = new DefaultConversionService();
            ((DefaultConversionService) conversionService).addConverter(new StringToDateConverter());
            ((DefaultConversionService) conversionService).addConverter(new StringToDateTimeConverter());
        } else {
            conversionService = ApplicationContextProvider.getApplicationContext().getBean(ConversionService.class);
        }
    }
    return conversionService;
}
Also used : StringToDateTimeConverter(org.molgenis.data.convert.StringToDateTimeConverter) ConversionService(org.springframework.core.convert.ConversionService) DefaultConversionService(org.springframework.core.convert.support.DefaultConversionService) DefaultConversionService(org.springframework.core.convert.support.DefaultConversionService) StringToDateConverter(org.molgenis.data.convert.StringToDateConverter)

Example 3 with StringToDateConverter

use of org.molgenis.data.convert.StringToDateConverter in project molgenis by molgenis.

the class PlatformITConfig method conversionService.

@Bean
public ConversionService conversionService() {
    DefaultConversionService defaultConversionService = new DefaultConversionService();
    defaultConversionService.addConverter(new StringToDateConverter());
    defaultConversionService.addConverter(new StringToDateTimeConverter());
    return defaultConversionService;
}
Also used : StringToDateTimeConverter(org.molgenis.data.convert.StringToDateTimeConverter) DefaultConversionService(org.springframework.core.convert.support.DefaultConversionService) StringToDateConverter(org.molgenis.data.convert.StringToDateConverter)

Aggregations

StringToDateConverter (org.molgenis.data.convert.StringToDateConverter)3 StringToDateTimeConverter (org.molgenis.data.convert.StringToDateTimeConverter)3 DefaultConversionService (org.springframework.core.convert.support.DefaultConversionService)2 ConversionService (org.springframework.core.convert.ConversionService)1