use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class TaxonomyLibraryIndexer method doIndexTaxonomyLibrary.
protected void doIndexTaxonomyLibrary(SearchResourceContext searchResourceContext, Taxonomy taxonomy, OlatFullIndexer indexerWriter) throws InterruptedException {
VFSContainer templatesContainer = taxonomyService.getDocumentsLibrary(taxonomy);
if (templatesContainer != null) {
try {
taxonomyTemplatesLibraryIndexer.doIndex(searchResourceContext, taxonomy, indexerWriter);
} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
logError("", e);
}
}
List<TaxonomyLevel> levels = taxonomyService.getTaxonomyLevels(taxonomy);
for (TaxonomyLevel level : levels) {
TaxonomyLevelType type = level.getType();
if (type != null && hasDocumentLibraryEnabled(type)) {
try {
taxonomyLevelLibraryIndexer.doIndex(searchResourceContext, level, indexerWriter);
} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
logError("", e);
}
}
}
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class MoveTaxonomyLevelController method filterByAllowedTypes.
private boolean filterByAllowedTypes(TreeNode node, List<TreeNode> openedNodes) {
((GenericTreeNode) node).setIconCssClass(null);
for (int i = node.getChildCount(); i-- > 0; ) {
boolean ok = filterByAllowedTypes((TreeNode) node.getChildAt(i), openedNodes);
if (!ok) {
node.remove(node.getChildAt(i));
}
}
boolean ok = false;
Object uobject = node.getUserObject();
if (uobject instanceof TaxonomyLevel) {
TaxonomyLevel level = (TaxonomyLevel) uobject;
TaxonomyLevelType type = level.getType();
if (type == null || allowedTypes.contains(type)) {
openedNodes.add(node);
((GenericTreeNode) node).setIconCssClass("o_icon_node_under o_icon-rotate-180");
targetableNodes.add(node);
ok = true;
} else if (node.getChildCount() > 0) {
openedNodes.add(node);
ok = true;
}
} else {
targetableNodes.add(node);
openedNodes.add(node);
ok = true;
}
return ok;
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class TaxonomyTreeTableController method getFilters.
private List<FlexiTableFilter> getFilters() {
List<TaxonomyLevelType> types = taxonomyService.getTaxonomyLevelTypes(taxonomy);
List<FlexiTableFilter> resources = new ArrayList<>(types.size() + 1);
for (TaxonomyLevelType type : types) {
resources.add(new FlexiTableFilter(type.getDisplayName(), type.getKey().toString()));
}
resources.add(new FlexiTableFilter(translate("filter.no.level.type"), "-"));
resources.add(FlexiTableFilter.SPACER);
resources.add(new FlexiTableFilter(translate("show.all"), "all", true));
return resources;
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class TypeTaxonomyLevelController method formOK.
@Override
protected void formOK(UserRequest ureq) {
String selectedTypeKey = typeEl.getSelectedKey();
TaxonomyLevelType selectedType = taxonomyService.getTaxonomyLevelType(new TaxonomyLevelTypeRefImpl(Long.valueOf(selectedTypeKey)));
for (TaxonomyLevel level : levels) {
level.setType(selectedType);
level = taxonomyService.updateTaxonomyLevel(level);
}
fireEvent(ureq, Event.CHANGED_EVENT);
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class TypeTaxonomyLevelController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (availableTypes.isEmpty()) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("errorMsg", translate("error.found.no.allowed.sub.types"));
}
uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
} else {
String[] theKeys = new String[availableTypes.size()];
String[] theValues = new String[availableTypes.size()];
for (int i = availableTypes.size(); i-- > 0; ) {
TaxonomyLevelType type = availableTypes.get(i);
theKeys[i] = type.getKey().toString();
theValues[i] = type.getDisplayName();
}
typeEl = uifactory.addDropdownSingleselect("types", "level.types.to.assign", formLayout, theKeys, theValues, null);
uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
uifactory.addFormSubmitButton("assign.type", formLayout);
}
}
Aggregations