1 package com.trendmicro.grid.acl.ds.jpa;
2
3 import com.trendmicro.grid.acl.ds.FileProvider;
4 import com.trendmicro.grid.acl.ds.jpa.entities.JpaFileDetails;
5 import com.trendmicro.grid.acl.l0.datatypes.FileIdentifier;
6 import org.springframework.stereotype.Service;
7
8 import javax.annotation.Resource;
9 import java.util.Collections;
10
11
12
13
14
15
16
17 @Service
18 public class JpaFileDetailsFetcher extends AbstractFetcher<FileIdentifier, JpaFileDetails, FileProvider> {
19
20 @Resource
21 JpaFileRepository fallbackRepository;
22
23 public JpaFileDetailsFetcher() {
24 super(FileProvider.class);
25 }
26
27 protected JpaFileRepository getFallbackRepository() {
28 return fallbackRepository;
29 }
30
31 protected Object fetch(FileProvider repository, FileIdentifier key) {
32 return repository.getFileDetailsList(Collections.singleton(key)).iterator().next();
33 }
34 }