View Javadoc
1   /*
2    * Copyright 2018 the original author or authors.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package org.openehealth.ipf.commons.spring.map;
18  
19  import lombok.Getter;
20  import lombok.Setter;
21  import org.springframework.beans.factory.InitializingBean;
22  import org.springframework.core.io.Resource;
23  
24  import java.util.List;
25  
26  /**
27   * Adds mapping scripts to a reference SpringBidiMappingService instance. Due
28   * to introduction of the new IPF's extension framework, this
29   * specific configurer is deprecated.
30   *
31   * @author Martin Krasser
32   *
33   */
34  public class SpringBidiMappingServiceConfigurer implements InitializingBean {
35  
36      @Getter @Setter
37      private SpringBidiMappingService mappingService;
38  
39      @Getter @Setter
40      private List<? extends Resource> mappingResources;
41  
42      @Getter @Setter
43      private Resource mappingResource;
44  
45      public void afterPropertiesSet() {
46          if (mappingResources != null && !mappingResources.isEmpty()) {
47              mappingService.setMappingResources(mappingResources);
48          }
49          if (mappingResource != null) {
50              mappingService.setMappingResource(mappingResource);
51          }
52      }
53  }