Package org.olat.repository.handlers

Examples of org.olat.repository.handlers.RepositoryHandler


    // invoke handler delete callback
    Tracing.logDebug("deleteRepositoryEntry start entry=" + entry, this.getClass());
    entry = (RepositoryEntry) DBFactory.getInstance().loadObject(entry,true);
    Tracing.logDebug("deleteRepositoryEntry after load entry=" + entry, this.getClass());
    Tracing.logDebug("deleteRepositoryEntry after load entry.getOwnerGroup()=" + entry.getOwnerGroup(), this.getClass());
    RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(entry);
    OLATResource ores = entry.getOlatResource();
    if (!handler.readyToDelete(ores, ureq, wControl)) return false;

    // start transaction
    // delete entry picture
    File uploadDir = new File(FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome());
    File picFile = new File(uploadDir, entry.getKey() + ".jpg");
    if (picFile.exists()) {
      picFile.delete();
    }
    // delete all bookmarks referencing deleted entry
    BookmarkManager.getInstance().deleteAllBookmarksFor(entry);
    // delete all catalog entries referencing deleted entry
    CatalogManager.getInstance().resourceableDeleted(entry);
    // delete the entry
    entry = (RepositoryEntry) DBFactory.getInstance().loadObject(entry,true);
    Tracing.logDebug("deleteRepositoryEntry after reload entry=" + entry, this.getClass());
    Tracing.logDebug("deleteRepositoryEntry after reload entry.getOwnerGroup()=" + entry.getOwnerGroup(), this.getClass());
    SecurityGroup ownerGroup = entry.getOwnerGroup();
    deleteRepositoryEntry(entry);
    if (ownerGroup != null) {
      // delete secGroup
      Tracing.logDebug("deleteRepositoryEntry deleteSecurityGroup ownerGroup=" + ownerGroup, this.getClass());
      ManagerFactory.getManager().deleteSecurityGroup(ownerGroup);
    }
    // inform handler to do any cleanup work... handler must delete the
    // referenced resourceable aswell.
    handler.cleanupOnDelete(entry.getOlatResource(), ureq, wControl);
    Tracing.logDebug("deleteRepositoryEntry Done" , this.getClass());
    return true;
  }
View Full Code Here


  /**
   * Initialize form data based on repository entry.
   */
  public void init() {
   
    RepositoryHandler handler = null;
    handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(entry);
   
    canCopy = new CheckBoxElement("cif.canCopy", entry.getCanCopy());
    addFormElement("cif_canCopy", canCopy);

    canReference = new CheckBoxElement("cif.canReference", entry.getCanReference());
    addFormElement("cif_canReference", canReference);
   
    if (handler != null && handler.supportsLaunch()) {
      canLaunch = new CheckBoxElement("cif.canLaunch", entry.getCanLaunch());
      addFormElement("cif_canLaunch", canLaunch);
    } else { // launch not supported
      canLaunch = null;
      addFormElement("cif_canLaunch", new StaticHTMLTextElement("cif.canLaunch", translate("cif.canLaunch.na"), 255));
    }

    if (handler != null && handler.supportsDownload()) {
      canDownload = new CheckBoxElement("cif.canDownload", entry.getCanDownload());
      addFormElement("cif_canDownload", canDownload);
    } else { // download not supported
      canDownload = null;
      addFormElement("cif_canDownload", new StaticHTMLTextElement("cif.canDownload", translate("cif.canDownload.na"), 255));
View Full Code Here

      LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(ureq, wControl, null, null, c.getInitialComponent(), null);
      layoutCtr.addDisposableChildController(c); // dispose content on layout dispose
      return layoutCtr;
    }
    rm.incrementLaunchCounter(re);
    RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(re);
 
   
    // build up the context path
    OLATResourceable businessOres = re;
    ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(businessOres);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, wControl)
 
    MainLayoutController ctrl = handler.getLaunchController(re.getOlatResource(), initialViewIdentifier, ureq, bwControl);
    if (ctrl == null) throw new AssertException("could not create controller for repositoryEntry "+re);
    if (ctrl instanceof MainLayoutController) {
      return ctrl;     
    } else {
      // add layout wrapper
View Full Code Here

      typeDisplayText.append(translate("cif.type.na"));
    }
    type = new StaticHTMLTextElement("cif.type", typeDisplayText.toString(), 255);
    addFormElement("cif_type", type);
   
    RepositoryHandler handler = null;
    if (typeName != null) handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(typeName);
   
    canCopy = new CheckBoxElement("cif.canCopy", entry.getCanCopy());
    if (enableAuthorView)
      addFormElement("cif_canCopy", canCopy);

    canReference = new CheckBoxElement("cif.canReference", entry.getCanReference());
    if (enableAuthorView)
      addFormElement("cif_canReference", canReference);

    if (handler != null && handler.supportsLaunch()) {
      canLaunch = new CheckBoxElement("cif.canLaunch", entry.getCanLaunch());
      addFormElement("cif_canLaunch", canLaunch);
    } else { // launch not supported
      canLaunch = null;
      addFormElement("cif_canLaunch", new StaticHTMLTextElement("cif.canLaunch", translate("cif.canLaunch.na"), 255));
    }

    if (handler != null && handler.supportsDownload()) {
      canDownload = new CheckBoxElement("cif.canDownload", entry.getCanDownload());
      addFormElement("cif_canDownload", canDownload);
    } else { // download not supported
      canDownload = null;
      addFormElement("cif_canDownload", new StaticHTMLTextElement("cif.canDownload", translate("cif.canDownload.na"), 255));
View Full Code Here

        fireEvent(ureq, Event.FAILED_EVENT);
        fireEvent(ureq, new EntryChangedEvent(sourceEntry, EntryChangedEvent.DELETED));
        return;
      }
      newEntry = descriptionController.getRepositoryEntry();                 
      RepositoryHandler typeToCopy = RepositoryHandlerFactory.getInstance().getRepositoryHandler(sourceEntry);     
      IAddController addController = typeToCopy.getAddController(null, null, ureq, getWindowControl());
      addController.repositoryEntryCreated(newEntry);

      getWindowControl().setInfo(translator.translate("add.success"));
      workflowSuccessful = true;
      fireEvent(ureq, Event.DONE_EVENT);
View Full Code Here

    preparedEntry.setDisplayname(newDispalyname);
    preparedEntry.setDescription(src.getDescription());
    String resName = src.getResourcename();
    if (resName == null) resName = "";
    preparedEntry.setResourcename(resName);
    RepositoryHandler typeToCopy = RepositoryHandlerFactory.getInstance().getRepositoryHandler(src);     
    OLATResourceable newResourceable = typeToCopy.createCopy(sourceEntry.getOlatResource(), ureq);
    if (newResourceable == null) {
      getWindowControl().setError(translator.translate("error.createcopy"));
      fireEvent(ureq, Event.FAILED_EVENT);
      return null;
    }
View Full Code Here

      if (entry != null) {
        try {
          Tracing.logDebug("Cleanup : started", RepositoryCopyController.class);
          newEntry = (RepositoryEntry) DBFactory.getInstance().loadObject(newEntry,true);
          SecurityGroup secGroup = newEntry.getOwnerGroup();
          RepositoryHandler repositoryHandler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(newEntry);     
          Tracing.logDebug("Cleanup : repositoryHandler.cleanupOnDelete for olat-resource=" + newEntry.getOlatResource(), RepositoryCopyController.class);
          repositoryHandler.cleanupOnDelete(newEntry.getOlatResource(), null, this.getWindowControl());
          Tracing.logDebug("Cleanup : deleteRepositoryEntry", RepositoryCopyController.class);
          RepositoryManager.getInstance().deleteRepositoryEntry(newEntry);
          if (secGroup != null) { // delete owner group
            Tracing.logDebug("Cleanup : deleteSecurityGroup secGroup=" + secGroup, RepositoryCopyController.class);
            securityManager.deleteSecurityGroup(secGroup);
View Full Code Here

        mainPanel.setContent(detailsController.getInitialComponent());
        columnsLayoutCtr.setCol2(toolComp);
        menuTree.setSelectedNodeId(myEntriesNodeId);

        // ask if we should start the editor right now.
        RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(addController.getAddedEntry());
        if (handler.supportsEdit()) { // start Editor
          removeAsListenerAndDispose(launchEditorDialog); // cleanup old                                                          // instance
          launchEditorDialog = activateYesNoDialog(urequest, null, translate("add.launchedit.msg"), launchEditorDialog);
          launchEditorDialog.setUserObject(addController.getAddedEntry());
          return;
        }
View Full Code Here

    // push addtl infos
    main.put("displayform", new DisplayInfoForm("displayform", getTranslator(), repositoryEntry));
    infopanelVC.contextPut("isAuthor", Boolean.valueOf(isAuthor));
    infopanelVC.contextPut("isOwner", Boolean.valueOf(isOwner));
    // init handler details
    RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    infopanelVC.contextPut("iscourse", new Boolean(handler instanceof CourseHandler));
    main.contextPut("iscourse", new Boolean(handler instanceof CourseHandler));
    //brasato:: review why such a type check was necessary
    if (handler instanceof CourseHandler) {
      infopanelVC
      .put("CourseInfoForm", new DisplayCourseInfoForm("CourseInfoForm", getTranslator(), CourseFactory.loadCourse(repositoryEntry.getOlatResource())));
    }
    Component comp = handler.getDetailsComponent(repositoryEntry.getOlatResource(), ureq);
    if (comp != null) { // push handler specific details view
      infopanelVC.contextPut("hasHandlerDetails", Boolean.valueOf("true"));
      infopanelVC.put("handlerDetails", comp);
    } else {
      infopanelVC.contextRemove("hasHandlerDetails");
View Full Code Here

      detailsToolC = ToolFactory.createToolController(getWindowControl());
      detailsToolC.addControllerListener(this);
      isNewController = true;
    }
    // init handler details
    RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
    if (isNewController) {
      detailsToolC.addHeader(translate("tools.details.header"));
      detailsToolC.addLink(ACTION_LAUNCH, translate("details.launch"), TOOL_LAUNCH, null);
    }
    detailsToolC.setEnabled(TOOL_LAUNCH, checkIsRepositoryEntryLaunchable(ureq));
    if (!isGuestOnly) {
      if (isNewController) {
        //mark as download link
        detailsToolC.addLink(ACTION_DOWNLOAD, translate("details.download"), TOOL_DOWNLOAD, null, true);
        detailsToolC.addLink(ACTION_BOOKMARK, translate("details.bookmark"), TOOL_BOOKMARK, null);
      }
      boolean canDownload = repositoryEntry.getCanDownload() && handler.supportsDownload();
      // disable download for courses if not author or owner
      if (repositoryEntry.getOlatResource().getResourceableTypeName().equals(CourseModule.getCourseTypeName())
        && !(isOwner || isAuthor)) canDownload = false;
      // always enable download for owners
      if (isOwner && handler.supportsDownload()) canDownload = true;
      detailsToolC.setEnabled(TOOL_DOWNLOAD, canDownload);
      boolean canBookmark = true;
      if (BookmarkManager.getInstance().isResourceableBookmarked(ureq.getIdentity(), repositoryEntry) || !repositoryEntry.getCanLaunch())
        canBookmark = false;
      detailsToolC.setEnabled(TOOL_BOOKMARK, canBookmark);
    }
    if (isAuthor || isOwner) {
      boolean canCopy = repositoryEntry.getCanCopy();
      if (isOwner) {
        if (isNewController) {
          detailsToolC.addLink(ACTION_EDIT, translate("details.openeditor"), TOOL_EDIT, null);
          detailsToolC.addLink(ACTION_EDITDESC, translate("details.chdesc"), TOOL_CHDESC, null);
          detailsToolC.addLink(ACTION_EDITPROP, translate("details.chprop"), TOOL_CHPROP, null);
          detailsToolC.addLink(ACTION_ADD_CATALOG, translate("details.catadd"), TOOL_CATALOG, null);
          if ((OresHelper.isOfType(repositoryEntry.getOlatResource(), CourseModule.class)) && (!RepositoryManager.getInstance().createRepositoryEntryStatus(repositoryEntry.getStatusCode()).isClosed())) {
            detailsToolC.addLink(ACTION_CLOSE_RESSOURCE, translate("details.close.ressoure"), TOOL_CLOSE_RESSOURCE, null);
          }
        }
        // update catalog link
        detailsToolC.setEnabled(TOOL_CATALOG, (repositoryEntry.getAccess() >= RepositoryEntry.ACC_USERS));
      }
      if (isNewController)
        detailsToolC.addLink(ACTION_COPY, translate("details.copy"), TOOL_COPY, null);
      if (isOwner) {
        if (isNewController) {
          detailsToolC.addLink(ACTION_DELETE, translate("details.delete"));
          detailsToolC.addLink(ACTION_GROUPS, translate("details.groups"));
        }
        // enable
        detailsToolC.setEnabled(TOOL_EDIT, handler.supportsEdit());
        detailsToolC.setEnabled(TOOL_CHDESC, true);
        detailsToolC.setEnabled(TOOL_CHPROP, true);
        canCopy = true;
      }
      detailsToolC.setEnabled(TOOL_COPY, canCopy);
View Full Code Here

TOP

Related Classes of org.olat.repository.handlers.RepositoryHandler

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.