在poi中复制过滤的数据

时间:2018-09-06 10:15:27

标签: java apache-poi

我想从excel表中复制包含过滤条件的行。我正在设置与条件不匹配的隐藏属性行。

@Configuration
@EnableRedisRepositories(basePackages = "nlp.floschne.thumbnailAnnotator.db")
public class RedisConfig {

    @Bean
    RedisConnectionFactory connectionFactory() {
        return new LettuceConnectionFactory();
    }

    @Bean
    RedisTemplate<?, ?> redisTemplate(RedisConnectionFactory connectionFactory) {

        RedisTemplate<String, byte[]> template = new RedisTemplate<>();
        template.setConnectionFactory(connectionFactory);
        template.setKeySerializer(new StringRedisSerializer());

        template.setValueSerializer(new EntityJsonSerializer());

        return template;
    }

    @Bean
    public RedisCustomConversions redisCustomConversions() {
        return new RedisCustomConversions(Arrays.asList(
                new EntityToBytesConverter(),
                new BytesToEntityConverter(),
                new ThumbnailUrlEntityToBytesConverter(),
                new BytesToThumbnailUrlEntityConverter()));
    }

    @WritingConverter
    public class EntityToBytesConverter implements Converter<Entity<?>, byte[]> {

        private final EntityJsonSerializer serializer;

        public EntityToBytesConverter() {
            serializer = new EntityJsonSerializer();
        }

        @Override
        public byte[] convert(Entity value) {
            return serializer.serialize(value);
        }
    }

    @ReadingConverter
    public class BytesToEntityConverter implements Converter<byte[], Entity<?>> {

        private final EntityJsonSerializer serializer;

        public BytesToEntityConverter() {
            serializer = new EntityJsonSerializer();
        }

        @Override
        public Entity convert(byte[] value) {
            return (Entity) serializer.deserialize(value);
        }
    }

    @WritingConverter
    public class ThumbnailUrlEntityToBytesConverter implements Converter<ThumbnailUrlEntity, byte[]> {

        private final EntityJsonSerializer serializer;

        public ThumbnailUrlEntityToBytesConverter() {
            serializer = new EntityJsonSerializer();
        }

        @Override
        public byte[] convert(ThumbnailUrlEntity value) {
            return serializer.serialize(value);
        }
    }

    @ReadingConverter
    public class BytesToThumbnailUrlEntityConverter implements Converter<byte[], ThumbnailUrlEntity> {

        private final EntityJsonSerializer serializer;

        public BytesToThumbnailUrlEntityConverter() {
            serializer = new EntityJsonSerializer();
        }

        @Override
        public ThumbnailUrlEntity convert(byte[] value) {
            return (ThumbnailUrlEntity) serializer.deserialize(value);
        }
    }
}

0 个答案:

没有答案