Skip to content
Snippets Groups Projects
Commit 5aacc4c2 authored by srosse's avatar srosse
Browse files

OO-5058: only try to delete competence which still exists

parent 26211724
No related branches found
No related tags found
No related merge requests found
......@@ -316,7 +316,9 @@ public class TaxonomyCompetenceDAO {
public void deleteCompetence(TaxonomyCompetence competence) {
TaxonomyCompetence reloadedCompetence = dbInstance.getCurrentEntityManager()
.getReference(TaxonomyCompetenceImpl.class, competence.getKey());
dbInstance.getCurrentEntityManager().remove(reloadedCompetence);
if(reloadedCompetence != null) {// onnly if not already deleted
dbInstance.getCurrentEntityManager().remove(reloadedCompetence);
}
}
private List<String> getTypesAsList(TaxonomyCompetenceTypes... competenceTypes) {
......
......@@ -246,10 +246,13 @@ public class IdentityCompetencesController extends FormBasicController implement
private void doRemoveCompetence(IdentityCompetenceRow row) {
Taxonomy taxonomy = row.getTaxonomy();
TaxonomyCompetence competence = row.getCompetence();
String before = taxonomyService.toAuditXml(competence);
competence = taxonomyService.getTaxonomyCompetence(competence);
if(competence != null) {
String before = taxonomyService.toAuditXml(competence);
taxonomyService.removeTaxonomyLevelCompetence(competence);
taxonomyService.auditLog(TaxonomyCompetenceAuditLog.Action.removeCompetence, before, null, null, taxonomy, competence, assessedIdentity, getIdentity());
}
taxonomyService.removeTaxonomyLevelCompetence(competence);
taxonomyService.auditLog(TaxonomyCompetenceAuditLog.Action.removeCompetence, before, null, null, taxonomy, competence, assessedIdentity, getIdentity());
loadModel();
tableEl.reset(true, true, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment