use of org.olat.modules.taxonomy.ui.component.TaxonomyLevelDepthComparator in project OpenOLAT by OpenOLAT.
the class DeleteTaxonomyLevelController method formOK.
@Override
protected void formOK(UserRequest ureq) {
StringBuilder sb = new StringBuilder();
if (levels.size() > 1) {
Collections.sort(levels, new TaxonomyLevelDepthComparator());
}
TaxonomyLevel mergeTo = null;
if (mergeToEl.isOneSelected() && !"-".equals(mergeToEl.getSelectedKey())) {
String selectedNodeKey = mergeToEl.getSelectedKey();
TreeNode selectedNode = treeModel.getNodeById(selectedNodeKey);
mergeTo = (TaxonomyLevel) selectedNode.getUserObject();
}
for (TaxonomyLevel level : levels) {
TaxonomyLevel taxonomyLevel = taxonomyService.getTaxonomyLevel(level);
if (taxonomyService.deleteTaxonomyLevel(taxonomyLevel, mergeTo)) {
if (sb.length() > 0)
sb.append(", ");
sb.append(StringHelper.escapeHtml(taxonomyLevel.getDisplayName()));
}
}
// commit before sending event
dbInstance.commit();
fireEvent(ureq, new DeleteTaxonomyLevelEvent());
showInfo("confirm.deleted.level", new String[] { sb.toString() });
fireEvent(ureq, Event.DONE_EVENT);
}
use of org.olat.modules.taxonomy.ui.component.TaxonomyLevelDepthComparator in project openolat by klemens.
the class MergeTaxonomyLevelController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (levels.size() > 1) {
Collections.sort(levels, new TaxonomyLevelDepthComparator());
}
String selectedNodeKey = mergeToEl.getSelectedKey();
TreeNode selectedNode = treeModel.getNodeById(selectedNodeKey);
TaxonomyLevel mergeTo = (TaxonomyLevel) selectedNode.getUserObject();
StringBuilder sb = new StringBuilder();
for (TaxonomyLevel level : levels) {
TaxonomyLevel taxonomyLevel = taxonomyService.getTaxonomyLevel(level);
if (taxonomyService.deleteTaxonomyLevel(taxonomyLevel, mergeTo)) {
if (sb.length() > 0)
sb.append(", ");
sb.append(StringHelper.escapeHtml(taxonomyLevel.getDisplayName()));
}
}
// commit before sending event
dbInstance.commit();
fireEvent(ureq, new DeleteTaxonomyLevelEvent());
showInfo("confirm.merge.level", new String[] { sb.toString() });
}
use of org.olat.modules.taxonomy.ui.component.TaxonomyLevelDepthComparator in project OpenOLAT by OpenOLAT.
the class MergeTaxonomyLevelController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (levels.size() > 1) {
Collections.sort(levels, new TaxonomyLevelDepthComparator());
}
String selectedNodeKey = mergeToEl.getSelectedKey();
TreeNode selectedNode = treeModel.getNodeById(selectedNodeKey);
TaxonomyLevel mergeTo = (TaxonomyLevel) selectedNode.getUserObject();
StringBuilder sb = new StringBuilder();
for (TaxonomyLevel level : levels) {
TaxonomyLevel taxonomyLevel = taxonomyService.getTaxonomyLevel(level);
if (taxonomyService.deleteTaxonomyLevel(taxonomyLevel, mergeTo)) {
if (sb.length() > 0)
sb.append(", ");
sb.append(StringHelper.escapeHtml(taxonomyLevel.getDisplayName()));
}
}
// commit before sending event
dbInstance.commit();
fireEvent(ureq, new DeleteTaxonomyLevelEvent());
showInfo("confirm.merge.level", new String[] { sb.toString() });
}
use of org.olat.modules.taxonomy.ui.component.TaxonomyLevelDepthComparator in project openolat by klemens.
the class DeleteTaxonomyLevelController method formOK.
@Override
protected void formOK(UserRequest ureq) {
StringBuilder sb = new StringBuilder();
if (levels.size() > 1) {
Collections.sort(levels, new TaxonomyLevelDepthComparator());
}
TaxonomyLevel mergeTo = null;
if (mergeToEl.isOneSelected() && !"-".equals(mergeToEl.getSelectedKey())) {
String selectedNodeKey = mergeToEl.getSelectedKey();
TreeNode selectedNode = treeModel.getNodeById(selectedNodeKey);
mergeTo = (TaxonomyLevel) selectedNode.getUserObject();
}
for (TaxonomyLevel level : levels) {
TaxonomyLevel taxonomyLevel = taxonomyService.getTaxonomyLevel(level);
if (taxonomyService.deleteTaxonomyLevel(taxonomyLevel, mergeTo)) {
if (sb.length() > 0)
sb.append(", ");
sb.append(StringHelper.escapeHtml(taxonomyLevel.getDisplayName()));
}
}
// commit before sending event
dbInstance.commit();
fireEvent(ureq, new DeleteTaxonomyLevelEvent());
showInfo("confirm.deleted.level", new String[] { sb.toString() });
fireEvent(ureq, Event.DONE_EVENT);
}
Aggregations