use of org.olat.modules.taxonomy.TaxonomyCompetence in project openolat by klemens.
the class TaxonomyLevelCompetenceController method doAddCompetence.
private void doAddCompetence(List<Identity> identities, TaxonomyCompetenceTypes comptenceType) {
Taxonomy taxonomy = taxonomyLevel.getTaxonomy();
for (Identity identity : identities) {
TaxonomyCompetence competence = taxonomyService.addTaxonomyLevelCompetences(taxonomyLevel, identity, comptenceType, null);
String after = taxonomyService.toAuditXml(competence);
taxonomyService.auditLog(TaxonomyCompetenceAuditLog.Action.addCompetence, null, after, null, taxonomy, competence, identity, getIdentity());
}
}
use of org.olat.modules.taxonomy.TaxonomyCompetence in project openolat by klemens.
the class TaxonomyLevelCompetenceController method doSelectTaxonomyLevelCompetence.
private void doSelectTaxonomyLevelCompetence(UserRequest ureq, TaxonomyLevelCompetenceRow row) {
if (editCompetenceCtrl != null)
return;
TaxonomyCompetence competence = row.getCompetence();
editCompetenceCtrl = new EditTaxonomyCompetenceController(ureq, getWindowControl(), competence);
listenTo(editCompetenceCtrl);
String fullname = userManager.getUserDisplayName(row.getCompetence().getIdentity());
String type = translate(row.getCompetenceType().name());
String title = translate("edit.competence.title", new String[] { fullname, type });
cmc = new CloseableModalController(getWindowControl(), translate("close"), editCompetenceCtrl.getInitialComponent(), true, title);
listenTo(cmc);
cmc.activate();
}
use of org.olat.modules.taxonomy.TaxonomyCompetence in project openolat by klemens.
the class TaxonomyWebService method getTaxonomyLevelComptencesByIdentity.
/**
* Return the competences of a specific user on the taxonomy level
* specified in the key in path.
*
* @response.representation.200.qname {http://www.example.com}taxonomyCompetenceVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc An array of competences
* @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYCOMPETENCEVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @param taxonomyKey The taxonomy tree
* @param taxonomyLevelKey The level of the taxonomy
* @param identityKey The user
* @param httpRequest The HTTP request
* @return An array of competences
*/
@GET
@Path("levels/{taxonomyLevelKey}/competences/{identityKey}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getTaxonomyLevelComptencesByIdentity(@PathParam("taxonomyLevelKey") Long taxonomyLevelKey, @PathParam("identityKey") Long identityKey) {
TaxonomyLevel level = taxonomyService.getTaxonomyLevel(new TaxonomyLevelRefImpl(new Long(taxonomyLevelKey)));
if (level == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
Identity identity = securityManager.loadIdentityByKey(identityKey);
if (identity == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
List<TaxonomyCompetence> competences = taxonomyService.getTaxonomyLevelCompetences(level, identity);
List<TaxonomyCompetenceVO> competenceVOes = new ArrayList<>(competences.size());
for (TaxonomyCompetence competence : competences) {
competenceVOes.add(new TaxonomyCompetenceVO(competence));
}
return Response.ok(competenceVOes.toArray(new TaxonomyCompetenceVO[competenceVOes.size()])).build();
}
use of org.olat.modules.taxonomy.TaxonomyCompetence 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();
}
use of org.olat.modules.taxonomy.TaxonomyCompetence in project openolat by klemens.
the class TaxonomyWebService method getTaxonomyComptencesByIdentity.
/**
* Return the competences of a specific user in the taxonomy tree.
*
* @response.representation.200.qname {http://www.example.com}taxonomyCompetenceVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc An array of competences
* @response.representation.200.example {@link org.olat.modules.taxonomy.restapi.Examples#SAMPLE_TAXONOMYCOMPETENCEVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @param taxonomyKey The taxonomy tree
* @param identityKey The user
* @param httpRequest The HTTP request
* @return An array of competences
*/
@GET
@Path("competences/{identityKey}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getTaxonomyComptencesByIdentity(@PathParam("identityKey") Long identityKey) {
Identity identity = securityManager.loadIdentityByKey(identityKey);
if (identity == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
List<TaxonomyCompetence> competences = taxonomyService.getTaxonomyCompetences(identity);
List<TaxonomyCompetenceVO> competenceVOes = new ArrayList<>(competences.size());
for (TaxonomyCompetence competence : competences) {
competenceVOes.add(new TaxonomyCompetenceVO(competence));
}
return Response.ok(competenceVOes.toArray(new TaxonomyCompetenceVO[competenceVOes.size()])).build();
}
Aggregations