use of org.olat.modules.taxonomy.restapi.TaxonomyWebService in project OpenOLAT by OpenOLAT.
the class DocumentPoolModuleWebService method getTaxonomyWebService.
@Path("{taxonomyKey}")
public TaxonomyWebService getTaxonomyWebService(@PathParam("taxonomyKey") Long taxonomyKey, @Context HttpServletRequest httpRequest) {
Roles roles = getRoles(httpRequest);
if (!roles.isOLATAdmin()) {
throw new WebApplicationException(Response.serverError().status(Status.UNAUTHORIZED).build());
}
if (taxonomyKey == null || taxonomyKey.longValue() <= 0) {
throw new WebApplicationException(Response.serverError().status(Status.BAD_REQUEST).build());
}
TaxonomyService taxonomyService = CoreSpringFactory.getImpl(TaxonomyService.class);
Taxonomy taxonomy = taxonomyService.getTaxonomy(new TaxonomyRefImpl(taxonomyKey));
if (taxonomy == null) {
throw new WebApplicationException(Response.serverError().status(Status.NOT_FOUND).build());
}
return new TaxonomyWebService(taxonomy);
}
use of org.olat.modules.taxonomy.restapi.TaxonomyWebService in project openolat by klemens.
the class DocumentPoolModuleWebService method getTaxonomyWebService.
@Path("{taxonomyKey}")
public TaxonomyWebService getTaxonomyWebService(@PathParam("taxonomyKey") Long taxonomyKey, @Context HttpServletRequest httpRequest) {
Roles roles = getRoles(httpRequest);
if (!roles.isOLATAdmin()) {
throw new WebApplicationException(Response.serverError().status(Status.UNAUTHORIZED).build());
}
if (taxonomyKey == null || taxonomyKey.longValue() <= 0) {
throw new WebApplicationException(Response.serverError().status(Status.BAD_REQUEST).build());
}
TaxonomyService taxonomyService = CoreSpringFactory.getImpl(TaxonomyService.class);
Taxonomy taxonomy = taxonomyService.getTaxonomy(new TaxonomyRefImpl(taxonomyKey));
if (taxonomy == null) {
throw new WebApplicationException(Response.serverError().status(Status.NOT_FOUND).build());
}
return new TaxonomyWebService(taxonomy);
}
Aggregations