use of annis.service.objects.SegmentationList in project ANNIS by korpling.
the class SearchOptionsPanel method getSegmentationNamesFromService.
private static List<String> getSegmentationNamesFromService(Set<String> corpora) {
List<String> segNames = new ArrayList<>();
WebResource service = Helper.getAnnisWebResource();
if (service != null) {
for (String corpus : corpora) {
try {
SegmentationList segList = service.path("query").path("corpora").path(Helper.encodeJersey(corpus)).path("segmentation-names").get(SegmentationList.class);
segNames.addAll(segList.getSegmentatioNames());
} catch (UniformInterfaceException ex) {
if (ex.getResponse().getStatus() == 403) {
log.debug("Did not have access rights to query segmentation names for corpus", ex);
} else {
log.warn("Could not query segmentation names for corpus", ex);
}
}
}
}
return segNames;
}
use of annis.service.objects.SegmentationList in project ANNIS by korpling.
the class QueryServiceImpl method segmentationNames.
@GET
@Path("corpora/{top}/segmentation-names")
@Produces("application/xml")
public SegmentationList segmentationNames(@PathParam("top") String toplevelCorpus) throws WebApplicationException {
Subject user = SecurityUtils.getSubject();
user.checkPermission("query:annotations:" + toplevelCorpus);
List<Long> corpusList = new ArrayList<>();
corpusList.add(queryDao.mapCorpusNameToId(toplevelCorpus));
return new SegmentationList(queryDao.listSegmentationNames(corpusList));
}
Aggregations