return list of oaipmh Sets instead of ids
This commit is contained in:
parent
768004de62
commit
829f5fa392
|
@ -60,7 +60,7 @@ public class ValidatorController {
|
|||
|
||||
@RequestMapping(value = "/getSetsOfRepository" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public List<String> getSetsOfRepository(@RequestParam(value = "url", required = true) String url) {
|
||||
public List<se.kb.oai.pmh.Set> getSetsOfRepository(@RequestParam(value = "url") String url) {
|
||||
return validatorService.getSetsOfRepository(url);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
public class InterfaceInformation{
|
||||
|
||||
private boolean identified;
|
||||
private List<String> sets;
|
||||
private List<se.kb.oai.pmh.Set> sets;
|
||||
private List<String> adminEmails;
|
||||
|
||||
public InterfaceInformation() {
|
||||
|
@ -23,11 +23,11 @@ public class InterfaceInformation{
|
|||
this.identified = identified;
|
||||
}
|
||||
|
||||
public List<String> getSets() {
|
||||
public List<se.kb.oai.pmh.Set> getSets() {
|
||||
return sets;
|
||||
}
|
||||
|
||||
public void setSets(List<String> sets) {
|
||||
public void setSets(List<se.kb.oai.pmh.Set> sets) {
|
||||
this.sets = sets;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public interface ValidatorService {
|
|||
|
||||
List<RuleSet> getRuleSets(String mode);
|
||||
|
||||
List<String> getSetsOfRepository(String url);
|
||||
List<se.kb.oai.pmh.Set> getSetsOfRepository(String url);
|
||||
|
||||
boolean identifyRepo(String url);
|
||||
|
||||
|
|
|
@ -208,9 +208,9 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSetsOfRepository(String url) {
|
||||
public List<se.kb.oai.pmh.Set> getSetsOfRepository(String url) {
|
||||
logger.debug("Getting sets of repository with url : {}", url);
|
||||
List<String> sets = null;
|
||||
List<se.kb.oai.pmh.Set> sets = null;
|
||||
try {
|
||||
sets = OaiTools.getSetsOfRepo(url);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.security.KeyManagementException;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class OaiTools {
|
|||
|
||||
private static final Logger logger = LoggerFactory.getLogger(OaiTools.class);
|
||||
|
||||
public static List<String> getSetsOfRepo(String baseUrl) throws Exception {
|
||||
public static List<se.kb.oai.pmh.Set> getSetsOfRepo(String baseUrl) throws Exception {
|
||||
try {
|
||||
logger.debug("Getting sets of repository: {}", baseUrl);
|
||||
OaiPmhServer harvester = new OaiPmhServer(baseUrl);
|
||||
|
@ -40,18 +40,12 @@ public class OaiTools {
|
|||
token = setList.getResumptionToken();
|
||||
}
|
||||
|
||||
List<String> ret = new ArrayList<String>();
|
||||
for (Set set : sets) {
|
||||
ret.add(set.getSpec().trim());
|
||||
}
|
||||
if (ret.size() > 0 )
|
||||
Collections.sort(ret);
|
||||
return ret;
|
||||
sets.sort(Comparator.comparing(Set::getName));
|
||||
return sets;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error getting sets of repository " + baseUrl, e);
|
||||
return new ArrayList<String>();
|
||||
//throw e;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue