1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package de.kaiserpfalzedv.services.dnb.client;
19
20 import org.springframework.cloud.openfeign.support.ResponseEntityDecoder;
21 import org.springframework.context.annotation.Bean;
22
23 import com.fasterxml.jackson.databind.ObjectMapper;
24
25 import de.kaiserpfalzedv.services.dnb.marcxml.MarcConverter;
26 import feign.Logger;
27 import feign.RequestInterceptor;
28
29
30
31
32
33
34
35
36 public class DnbLookupClientConfig {
37 private static final String VERSION = "1.1";
38 private static final String OPERATION = "searchRetrieve";
39 private static final String RECORD_SCHEMA = "MARC21-xml";
40
41
42 @Bean
43 public RequestInterceptor dnbDefaultParameters() {
44 return requestTemplate -> requestTemplate
45 .query("operation", OPERATION)
46 .query("version", VERSION)
47 .query("recordSchema", RECORD_SCHEMA)
48 ;
49 }
50
51 @Bean
52 public ResponseEntityDecoder dnbDecoder() {
53 return new ResponseEntityDecoder(new Marc21Decoder(new MarcConverter(new ObjectMapper())));
54 }
55
56 @Bean
57 public Logger.Level logLevel() {
58 return Logger.Level.FULL;
59 }
60 }