use of org.olat.modules.taxonomy.model.TaxonomyCompetenceRefImpl in project OpenOLAT by OpenOLAT.
the class TaxonomyWebService method removeTaxonomyLevelCompetence.
/**
* Remove a competence.
*
* @response.representation.200.doc The competence was removed sucessfully
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @response.representation.404.doc The competence was not found
* @param taxonomyKey The taxonomy tree
* @param taxonomyLevelKey The taxonomy level
* @param competenceKey The competence to remove
* @param httpRequest The HTTP request
* @return Nothing
*/
@DELETE
@Path("levels/{taxonomyLevelKey}/competences/{competenceKey}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response removeTaxonomyLevelCompetence(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey, @PathParam("competenceKey") Long competenceKey, @Context HttpServletRequest httpRequest) {
Identity executor = getIdentity(httpRequest);
TaxonomyCompetence competence = taxonomyService.getTaxonomyCompetence(new TaxonomyCompetenceRefImpl(competenceKey));
if (competence == null || !competence.getTaxonomyLevel().getKey().equals(taxonomyLevelKey)) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
String before = taxonomyService.toAuditXml(competence);
taxonomyService.removeTaxonomyLevelCompetence(competence);
taxonomyService.auditLog(TaxonomyCompetenceAuditLog.Action.removeCompetence, before, null, null, taxonomy, competence, competence.getIdentity(), executor);
return Response.ok().build();
}
use of org.olat.modules.taxonomy.model.TaxonomyCompetenceRefImpl in project openolat by klemens.
the class TaxonomyWebService method removeTaxonomyLevelCompetence.
/**
* Remove a competence.
*
* @response.representation.200.doc The competence was removed sucessfully
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @response.representation.404.doc The competence was not found
* @param taxonomyKey The taxonomy tree
* @param taxonomyLevelKey The taxonomy level
* @param competenceKey The competence to remove
* @param httpRequest The HTTP request
* @return Nothing
*/
@DELETE
@Path("levels/{taxonomyLevelKey}/competences/{competenceKey}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response removeTaxonomyLevelCompetence(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey, @PathParam("competenceKey") Long competenceKey, @Context HttpServletRequest httpRequest) {
Identity executor = getIdentity(httpRequest);
TaxonomyCompetence competence = taxonomyService.getTaxonomyCompetence(new TaxonomyCompetenceRefImpl(competenceKey));
if (competence == null || !competence.getTaxonomyLevel().getKey().equals(taxonomyLevelKey)) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
String before = taxonomyService.toAuditXml(competence);
taxonomyService.removeTaxonomyLevelCompetence(competence);
taxonomyService.auditLog(TaxonomyCompetenceAuditLog.Action.removeCompetence, before, null, null, taxonomy, competence, competence.getIdentity(), executor);
return Response.ok().build();
}
Aggregations