Package org.olat.catalog

Examples of org.olat.catalog.CatalogEntry


   * @see org.olat.core.gui.components.table.DefaultTableDataModel#getValueAt(int,
   *      int)
   */
  @Override
  public Object getValueAt(int row, int col) {
    CatalogEntry entry = (CatalogEntry) getObject(row);
    switch (col) {
      case 0:
        // calculate cat entry path: travel up to the root node
        String path = "";
        CatalogEntry tempEntry = entry;
        while (tempEntry != null) {
          path = "/" + tempEntry.getName() + path;
          tempEntry = tempEntry.getParent();
        }
        return path;

      default:
        return "error";
View Full Code Here


    this.toBeMovedEntry = toBeMovedEntry;
    // Main view is a velocity container
    contentVC = createVelocityContainer("catalogentryajaxmove");
    contentVC.contextPut("entryname", toBeMovedEntry.getName());
    // build current path for gui
    CatalogEntry tempEntry = toBeMovedEntry;
    String path = "";
    while (tempEntry != null) {
      path = "/" + tempEntry.getName() + path;
      tempEntry = tempEntry.getParent();
    }
    contentVC.contextPut("path", path.toString());
   
    // Fetch all entries that can be accessed by this user. This is kept as a
    // local copy for performance reasons. This is only used when a node is
    // moved, when moving leafs we don't check for ownership of the category
    if (toBeMovedEntry.getType() == CatalogEntry.TYPE_NODE) {
      ownedEntries = getOwnedEntries(ureq);
    }
   
    CatalogManager cm = CatalogManager.getInstance();
    CatalogEntry rootce = (CatalogEntry) cm.getRootCatalogEntries().get(0);
    // Build tree model
    treeModel = new CatalogAjaxTreeModel(rootce, toBeMovedEntry, ownedEntries, false, false);
   
    // Create the ajax tree controller, add it to your main view
    treeCtr = new TreeController(ureq, getWindowControl(), rootce.getName(), treeModel, null);
    listenTo(treeCtr);
    contentVC.put("treeCtr", treeCtr.getInitialComponent());
   
    cancelLink = LinkFactory.createButton("cancel", contentVC, this);
    // select link is disabled until an item is selected
View Full Code Here

        TreeNodeClickedEvent clickedEvent = (TreeNodeClickedEvent) event;
        // try to update the catalog
        CatalogManager cm = CatalogManager.getInstance();
        String nodeId = clickedEvent.getNodeId();
        Long newParentId = Long.parseLong(nodeId);
        CatalogEntry newParent = cm.loadCatalogEntry(newParentId);
        boolean hasAccess;
        if (toBeMovedEntry.getType() == CatalogEntry.TYPE_LEAF) {
          // Leafs can be attached anywhere in the catalog, no need to check for
          // category ownership
          hasAccess = true;
View Full Code Here

    // Main view is a velocity container
    contentVC = createVelocityContainer("catalogentryajaxadd");
    contentVC.contextPut("entryname", toBeAddedEntry.getDisplayname());
   
    CatalogManager cm = CatalogManager.getInstance();
    CatalogEntry rootce = (CatalogEntry) cm.getRootCatalogEntries().get(0);
    // Build tree model
    treeModel = new CatalogAjaxTreeModel(rootce, null, null, false, false);
   
    // Create the ajax tree controller, add it to your main view
    treeCtr = new TreeController(ureq, getWindowControl(), rootce.getName(), treeModel, null);
    listenTo(treeCtr);
    contentVC.put("treeCtr", treeCtr.getInitialComponent());

    cancelLink = LinkFactory.createButton("cancel", contentVC, this);
    // select link is disabled until an item is selected
View Full Code Here

        TreeNodeClickedEvent clickedEvent = (TreeNodeClickedEvent) event;
        // build new entry for this catalog level
        CatalogManager cm = CatalogManager.getInstance();
        String nodeId = clickedEvent.getNodeId();
        Long newParentId = Long.parseLong(nodeId);
        CatalogEntry newParent = cm.loadCatalogEntry(newParentId);
        // check first if this repo entry is already attached to this new parent
        List<CatalogEntry> existingChildren = cm.getChildrenOf(newParent);
        for (CatalogEntry existingChild : existingChildren) {
          RepositoryEntry existingRepoEntry = existingChild.getRepositoryEntry();
          if (existingRepoEntry != null && existingRepoEntry.equalsByPersistableKey(toBeAddedEntry)) {
View Full Code Here

    if (source == cancelLink) {
      fireEvent(ureq, Event.CANCELLED_EVENT);         
    } else if (source == selectLink) {
      if (selectedParent != null) {
        CatalogManager cm = CatalogManager.getInstance();
        CatalogEntry newEntry = cm.createCatalogEntry();
        newEntry.setRepositoryEntry(toBeAddedEntry);
        newEntry.setName(toBeAddedEntry.getDisplayname());
        newEntry.setDescription(toBeAddedEntry.getDescription());
        newEntry.setType(CatalogEntry.TYPE_LEAF);
        newEntry.setOwnerGroup(ManagerFactory.getManager().createAndPersistSecurityGroup());
        // save entry
        cm.addCatalogEntry(selectedParent, newEntry);
        fireEvent(ureq, Event.DONE_EVENT);               
      }
    }
View Full Code Here

      if (te.getCommand().equals(TreeEvent.COMMAND_TREENODE_CLICKED)) {

        GenericTreeNode node = (GenericTreeNode) selectionTree.getSelectedNode();
        CatalogManager cm = CatalogManager.getInstance();
        Long newParentId = Long.parseLong(node.getIdent());
        CatalogEntry newParent = cm.loadCatalogEntry(newParentId);
        if (!cm.moveCatalogEntry(moveMe, newParent)) {
          fireEvent(ureq, Event.FAILED_EVENT);
        } else {
          fireEvent(ureq, Event.DONE_EVENT);
        }
View Full Code Here

    if (entryList == null || entryList.size() < 1) {
      rootNode = new GenericTreeNode("keine Node :(", null);
    }
    // build the tree - note that the entry list is not ordered in any way
    for (int cnt = 0; cnt < entryList.size(); cnt++) {
      CatalogEntry elem = entryList.get(cnt);
      // create a tree node and add it to the entry map
      GenericTreeNode n = addNode(elem);
      if (n != null) {
        // a node was created, keep it as a potential root node candidate
        rootNode = addNode(elem);
View Full Code Here

      TreeEvent te = (TreeEvent) event;
      if (te.getCommand().equals(TreeEvent.COMMAND_TREENODE_CLICKED)) {
        GenericTreeNode node = (GenericTreeNode) selectionTree.getSelectedNode();
        CatalogManager cm = CatalogManager.getInstance();
        Long newParentId = Long.parseLong(node.getIdent());
        CatalogEntry newParent = cm.loadCatalogEntry(newParentId);
        // check first if this repo entry is already attached to this new parent
        List<CatalogEntry> existingChildren = cm.getChildrenOf(newParent);
        for (CatalogEntry existingChild : existingChildren) {
          RepositoryEntry existingRepoEntry = existingChild.getRepositoryEntry();
          if (existingRepoEntry != null && existingRepoEntry.equalsByPersistableKey(toBeAddedEntry)) {
            showError("catalog.tree.add.already.exists", toBeAddedEntry.getDisplayname());
            return;
          }
        }
        CatalogEntry newEntry = cm.createCatalogEntry();
        newEntry.setRepositoryEntry(toBeAddedEntry);
        newEntry.setName(toBeAddedEntry.getDisplayname());
        newEntry.setDescription(toBeAddedEntry.getDescription());
        newEntry.setType(CatalogEntry.TYPE_LEAF);
        newEntry.setOwnerGroup(ManagerFactory.getManager().createAndPersistSecurityGroup());
        // save entry
        cm.addCatalogEntry(newParent, newEntry);
        fireEvent(ureq, Event.DONE_EVENT);

      } else if (te.getCommand().equals(TreeEvent.COMMAND_CANCELLED)) {
View Full Code Here

  protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) { // process table actions
      TableEvent te = (TableEvent) event;
      String action  = te.getActionId();
      CategoriesListModel categoriesListModel = (CategoriesListModel) tableCtr.getTableDataModel();
      CatalogEntry selectedCategoryLevel = categoriesListModel.getCatalogEntry(te.getRowId());
     
      if (action.equals(CategoriesListModel.ACTION_GOTO)) {
        // select repo site and activate catalog entry in catalog
        DTabs dts = (DTabs) getWindowControl().getWindowBackOffice().getWindow().getAttribute("DTabs");
        dts.activateStatic(ureq, RepositorySite.class.getName(), "search.catalog:" + selectedCategoryLevel.getKey());
       
      } else if (action.equals(CategoriesListModel.ACTION_DELETE)) {
        // remove selected entry from the data model
        CatalogManager cm = CatalogManager.getInstance();
        List<CatalogEntry> children = cm.getChildrenOf(selectedCategoryLevel);
View Full Code Here

TOP

Related Classes of org.olat.catalog.CatalogEntry

Copyright © 2018 www.massapicom. 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.