Search in sources :

Example 16 with TaxonomyRefImpl

use of org.olat.modules.taxonomy.model.TaxonomyRefImpl in project openolat by klemens.

the class DocumentPoolIndexer method doIndex.

@Override
public void doIndex(SearchResourceContext parentResourceContext, Object object, OlatFullIndexer indexerWriter) throws IOException, InterruptedException {
    String taxonomyTreeKey = documentPoolModule.getTaxonomyTreeKey();
    if (StringHelper.isLong(taxonomyTreeKey)) {
        Long taxonomyKey = new Long(taxonomyTreeKey);
        Taxonomy taxonomy = taxonomyService.getTaxonomy(new TaxonomyRefImpl(taxonomyKey));
        OLATResourceable docPoolOres = OresHelper.createOLATResourceableInstanceWithoutCheck(getSupportedTypeName(), 0l);
        SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
        searchResourceContext.setBusinessControlFor(docPoolOres);
        searchResourceContext.setTitle(taxonomy.getDisplayName());
        searchResourceContext.setDescription(taxonomy.getDescription());
        searchResourceContext.setLastModified(taxonomy.getLastModified());
        searchResourceContext.setCreatedDate(taxonomy.getCreationDate());
        doIndexTaxonomyLibrary(searchResourceContext, taxonomy, indexerWriter);
    }
}
Also used : TaxonomyRefImpl(org.olat.modules.taxonomy.model.TaxonomyRefImpl) Taxonomy(org.olat.modules.taxonomy.Taxonomy) OLATResourceable(org.olat.core.id.OLATResourceable) SearchResourceContext(org.olat.search.service.SearchResourceContext)

Example 17 with TaxonomyRefImpl

use of org.olat.modules.taxonomy.model.TaxonomyRefImpl in project openolat by klemens.

the class DocumentPoolAdminController method doOpenPermissions.

private void doOpenPermissions(UserRequest ureq) {
    removeAsListenerAndDispose(permissionsCtrl);
    if (StringHelper.containsNonWhitespace(docPoolModule.getTaxonomyTreeKey())) {
        WindowControl bwControl = addToHistory(ureq, OresHelper.createOLATResourceableType("Types"), null);
        Taxonomy taxonomy = taxonomyService.getTaxonomy(new TaxonomyRefImpl(new Long(docPoolModule.getTaxonomyTreeKey())));
        permissionsCtrl = new DocumentPoolAdminPermissionsController(ureq, bwControl, taxonomy);
        listenTo(permissionsCtrl);
        mainVC.put("segmentCmp", permissionsCtrl.getInitialComponent());
    }
}
Also used : TaxonomyRefImpl(org.olat.modules.taxonomy.model.TaxonomyRefImpl) Taxonomy(org.olat.modules.taxonomy.Taxonomy) WindowControl(org.olat.core.gui.control.WindowControl)

Example 18 with TaxonomyRefImpl

use of org.olat.modules.taxonomy.model.TaxonomyRefImpl in project openolat by klemens.

the class DocumentPoolWebDAVMergeSource method loadMergedContainers.

@Override
protected List<VFSContainer> loadMergedContainers() {
    List<VFSContainer> containers = new ArrayList<>();
    String taxonomyTreeKey = docPoolModule.getTaxonomyTreeKey();
    if (StringHelper.isLong(taxonomyTreeKey)) {
        Taxonomy taxonomy = taxonomyService.getTaxonomy(new TaxonomyRefImpl(new Long(taxonomyTreeKey)));
        if (taxonomy != null) {
            String templatesDir = Util.createPackageTranslator(DocumentPoolMainController.class, identityEnv.getLocale()).translate("document.pool.templates");
            TaxonomyTreeBuilder builder = new TaxonomyTreeBuilder(taxonomy, identityEnv.getIdentity(), null, identityEnv.getRoles().isOLATAdmin(), docPoolModule.isTemplatesDirectoryEnabled(), templatesDir, null);
            TreeModel model = builder.buildTreeModel();
            TreeNode rootNode = model.getRootNode();
            for (int i = 0; i < rootNode.getChildCount(); i++) {
                VFSContainer container = loadRecursiveMergedContainers(taxonomy, rootNode.getChildAt(i));
                if (container != null) {
                    containers.add(container);
                }
            }
        }
    }
    return containers;
}
Also used : TreeModel(org.olat.core.gui.components.tree.TreeModel) TaxonomyRefImpl(org.olat.modules.taxonomy.model.TaxonomyRefImpl) Taxonomy(org.olat.modules.taxonomy.Taxonomy) TreeNode(org.olat.core.gui.components.tree.TreeNode) TaxonomyTreeNode(org.olat.modules.taxonomy.model.TaxonomyTreeNode) VFSContainer(org.olat.core.util.vfs.VFSContainer) ArrayList(java.util.ArrayList) DocumentPoolMainController(org.olat.modules.docpool.ui.DocumentPoolMainController) TaxonomyTreeBuilder(org.olat.modules.taxonomy.manager.TaxonomyTreeBuilder)

Aggregations

TaxonomyRefImpl (org.olat.modules.taxonomy.model.TaxonomyRefImpl)18 Taxonomy (org.olat.modules.taxonomy.Taxonomy)14 Roles (org.olat.core.id.Roles)10 TaxonomyService (org.olat.modules.taxonomy.TaxonomyService)8 Date (java.util.Date)4 Path (javax.ws.rs.Path)4 WebApplicationException (javax.ws.rs.WebApplicationException)4 TreeModel (org.olat.core.gui.components.tree.TreeModel)4 Translator (org.olat.core.gui.translator.Translator)4 UserSession (org.olat.core.util.UserSession)4 VFSContainer (org.olat.core.util.vfs.VFSContainer)4 TaxonomyRef (org.olat.modules.taxonomy.TaxonomyRef)4 DocumentPoolMainController (org.olat.modules.docpool.ui.DocumentPoolMainController)3 TaxonomyTreeBuilder (org.olat.modules.taxonomy.manager.TaxonomyTreeBuilder)3 TaxonomyTreeNode (org.olat.modules.taxonomy.model.TaxonomyTreeNode)3 RestSecurityHelper.getRoles (org.olat.restapi.security.RestSecurityHelper.getRoles)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Locale (java.util.Locale)2 BaseSecurity (org.olat.basesecurity.BaseSecurity)2