Examples of CatalogEntry


Examples of org.olat.catalog.CatalogEntry

  /**
   * Helper to imports simple tree structure, for simplicity
   */
  private void importStructure() {
    CatalogEntry oldRoot = (CatalogEntry) cm.getRootCatalogEntries().get(0);
    SecurityGroup rootOwners = oldRoot.getOwnerGroup();
    Manager secMgr = ManagerFactory.getManager();
    List olatAdminIdents = secMgr.getIdentitiesOfSecurityGroup(rootOwners);
    SecurityGroup catalogAdmins = secMgr.createAndPersistSecurityGroup();
    for (int i = 0; i < olatAdminIdents.size(); i++) {
      secMgr.addIdentityToSecurityGroup((Identity) olatAdminIdents.get(i), catalogAdmins);
    }
    cm.deleteCatalogEntry(oldRoot);

    CatalogEntry dummy = cm.createCatalogEntry();
    addStructureForm.fillEntry(dummy);
    String structure = dummy.getDescription();
    String[] lines = structure.split("\n");
    Stack<CatalogEntry> treeStack = new Stack<CatalogEntry>();
    //
    CatalogEntry newRoot = cm.createCatalogEntry();
    newRoot.setParent(null);
    newRoot.setType(CatalogEntry.TYPE_NODE);
    newRoot.setDescription("fill it");
    newRoot.setName(lines[0]);
    newRoot.setOwnerGroup(catalogAdmins);
    cm.saveCatalogEntry(newRoot);
    treeStack.push(newRoot);
    for (int i = 1; i < lines.length; i++) {
      int level = 0;
      int pos = 0;
      while ("".equals(lines[i].substring(pos, pos + 2).trim())) {
        level++;
        pos += 3;
      }
      CatalogEntry tmp = cm.createCatalogEntry();
      tmp.setType(CatalogEntry.TYPE_NODE);
      tmp.setDescription("fill it");
      tmp.setName(lines[i].trim());
      if (treeStack.size() == level) {
        tmp.setParent(treeStack.lastElement());
        treeStack.push(tmp);
      } else if (treeStack.size() > level) {
        // moving towards root
        for (int ii = treeStack.size() - 1; ii >= level; ii--) {
          treeStack.pop();
        }
        tmp.setParent(treeStack.lastElement());
        treeStack.push(tmp);
      }
      cm.saveCatalogEntry(tmp);
    }
  }
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

   * @param ce The current catalog category element from the given level
   * @param pos The current level in the catalog
   */
  private void updateToolAccessRights(UserRequest ureq, CatalogEntry ce, int pos) {
    // 1) check if user has already a bookmark for this level
    final CatalogEntry tmp=ce;
    OLATResourceable catEntryOres = CatalogManager.getInstance().createOLATResouceableFor(ce);
    if (tmp != null && BookmarkManager.getInstance().isResourceableBookmarked(ureq.getIdentity(), catEntryOres)){
      canBookmark = false;
      if(catalogToolC != null){
        catalogToolC.setEnabled(TOOL_BOOKMARK, canBookmark);
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

   *
   * @return true if successful otherwise false (e.c. jumpToNode referenced a
   *         catalog leaf or no catalog entry at all)
   */
  private boolean jumpToNode(UserRequest ureq, long jumpToNode){
    CatalogEntry cE=CatalogManager.getInstance().loadCatalogEntry(Long.valueOf(jumpToNode));
      if(cE!=null){
          Stack<CatalogEntry> stack=new Stack<CatalogEntry>();
          // get elements, and add to filo stack
          while(cE !=null){
            stack.push(cE);
            cE=cE.getParent();
          }
          // read filo stack
          while ( !stack.isEmpty())
          {
            cE = stack.pop();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.