Package org.olat.repository

Examples of org.olat.repository.RepositoryEntry


        fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
      }
    } else if (source == previewLink){
      // Preview as modal dialogue
      // only if the config is valid
      RepositoryEntry re = getScormCPReference(config, false);
      if (re == null) { // we cannot preview it, because the repository entry
                        // had been deleted between the time when it was
                        // chosen here, and now       
        this.showError("error.cprepoentrymissing");
      } else {
        File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
        boolean showMenu = config.getBooleanSafe(CONFIG_SHOWMENU, true);
       
        if (previewLayoutCtr != null) previewLayoutCtr.dispose();
        ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapScormRepositoryEntry(re));
        ScormAPIandDisplayController previewController = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, null, cpRoot, null, course.getResourceableId().toString(),
View Full Code Here


  public void event(UserRequest urequest, Controller source, Event event) {
    if (source == searchController) {     
      cmc.deactivate();
      if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
        // search controller done
        RepositoryEntry re = searchController.getSelectedEntry();
        if (re != null) {
          setScormCPReference(re, config);
          cpConfigurationVc.contextPut("showPreviewButton", Boolean.TRUE);
          previewLink = LinkFactory.createCustomLink("command.preview", "command.preview", re.getDisplayname(), Link.NONTRANSLATED, cpConfigurationVc, this);
          previewLink.setCustomEnabledLinkCSS("b_preview");
          previewLink.setTitle(getTranslator().translate("command.preview"));
          // fire event so the updated config is saved by the
          // editormaincontroller
          fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
View Full Code Here

  public static RepositoryEntry getScormCPReference(ModuleConfiguration config, boolean strict) {
    if (config == null) throw new AssertException("missing config in CP");
    String repoSoftkey = (String) config.get(ScormEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
    if (repoSoftkey == null) throw new AssertException("invalid config when being asked for references");
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = rm.lookupRepositoryEntryBySoftkey(repoSoftkey, strict);
    // entry can be null only if !strict
    return entry;
  }
View Full Code Here

  /**
   * @see org.olat.repository.handlers.RepositoryHandler#getAsMediaResource(org.olat.core.id.OLATResourceable
   */
  public MediaResource getAsMediaResource(OLATResourceable res) {
    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(res, true);
    String exportFileName = re.getDisplayname() + ".zip";
    exportFileName = StringHelper.transformDisplayNameToFileSystemName(exportFileName);
    File fExportZIP = new File(FolderConfig.getCanonicalTmpDir() + "/" + exportFileName);
    CourseFactory.exportCourseToZIP(res, fExportZIP);
    return new CleanupAfterDeliveryFileMediaResource(fExportZIP);
  }
View Full Code Here

   * @see org.olat.course.nodes.CourseNode#getReferencedRepositoryEntry()
   */
  public RepositoryEntry getReferencedRepositoryEntry() {
    //"false" because we do not want to be strict, but just indicate whether
    // the reference still exists or not
    RepositoryEntry entry = WikiEditController.getWikiReference(getModuleConfiguration(), false);
    return entry;
  }
View Full Code Here

  /**
   * @see org.olat.course.nodes.GenericCourseNode#exportNode(java.io.File,
   *      org.olat.course.ICourse)
   */
  public void exportNode(File exportDirectory, ICourse course) {
    RepositoryEntry re = WikiEditController.getWikiReference(getModuleConfiguration(), false);
    if (re == null) return;
    File fExportDirectory = new File(exportDirectory, getIdent());
    fExportDirectory.mkdirs();
    RepositoryEntryImportExport reie = new RepositoryEntryImportExport(re, fExportDirectory);
    reie.exportDoExport();
View Full Code Here

   *      java.lang.String, org.olat.core.gui.UserRequest,
   *      org.olat.core.gui.control.WindowControl)
   */
  public MainLayoutController getLaunchController(OLATResourceable res, String initialViewIdentifier, UserRequest ureq,
      WindowControl wControl) {
    RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntry(res, false);
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), repoEntry)
    FeedSecurityCallback callback = new FeedResourceSecurityCallback(isAdmin, isOwner);
    Controller blogCtr = BlogUIFactory.getInstance(ureq.getLocale()).createMainController(res, ureq, wControl, callback);
    LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(ureq, wControl, null, null, blogCtr.getInitialComponent(), null);
View Full Code Here

   * @param olatResourceable a general OlatResourceable
   * @param type the type of the olatResourceable
   * @return a LoggingResourceable wrapping the given olatResourceable type pair
   */
  public static LoggingResourceable wrap(OLATResourceable olatResourceable, ILoggingResourceableType type) {
    RepositoryEntry repoEntry = null;
    if (olatResourceable instanceof RepositoryEntry) {
      repoEntry = (RepositoryEntry) olatResourceable;
    } else {
      repoEntry = RepositoryManager.getInstance().lookupRepositoryEntry(olatResourceable, false);
    }
    if (repoEntry!=null) {
      return new LoggingResourceable(repoEntry, type, repoEntry.getOlatResource().getResourceableTypeName(),
          String.valueOf(repoEntry.getOlatResource().getResourceableId()), repoEntry.getDisplayname());
    } else if (olatResourceable instanceof OLATResource) {
      OLATResource olatResource = (OLATResource) olatResourceable;
      return new LoggingResourceable(olatResource, type, olatResource.getResourceableTypeName(),
          String.valueOf(olatResource.getResourceableId()), String.valueOf(olatResource.getKey()));     
    } else {
View Full Code Here

      if (ceResourceable.getResourceableTypeName().equals(resourceable_.getResourceableTypeName()) &&
          ceResourceable.getResourceableId().equals(resourceable_.getResourceableId())) {
        return true;
      }
      if (ceResourceable instanceof RepositoryEntry) {
        RepositoryEntry re = (RepositoryEntry) ceResourceable;
       
        OLATResource ores = re.getOlatResource();
        if (ores!=null &&
            ores.getResourceableTypeName().equals(resourceable_.getResourceableTypeName()) &&
            ores.getResourceableId().equals(resourceable_.getResourceableId())) {
          return true;
        }
      } else if (OresHelper.calculateTypeName(RepositoryEntry.class).equals(ceResourceable.getResourceableTypeName())) {
        // @TODO: Performance hit! Speed optimize this!
        // OLAT-4996
        // OLAT-4955
        // that's the jump-in case where the ContextEntry says it has a [RepositoryEntry:123212321] but
        // the actual class of ceResourceable is not a RepositoryEntry but an OresHelper$3 ...
       
        // in which case all we have is the key of the repositoryentry and we must make a DB lookup to
        // map the repo key to the corresponding olatresource
       
        RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(ceResourceable.getResourceableId());
        if (re!=null) {
          OLATResource ores = re.getOlatResource();
          if (ores!=null &&
              ores.getResourceableTypeName().equals(resourceable_.getResourceableTypeName()) &&
              ores.getResourceableId().equals(resourceable_.getResourceableId())) {
            return true;
          }
View Full Code Here

    try {
      log.info("setUp start ------------------------");
      DBFactory.getJunitInstance().clearDatabase();
     
      //import "Demo course" into the bcroot_junittest
      RepositoryEntry repositoryEntry = JunitTestHelper.deployDemoCourse();
      Long resourceableId = repositoryEntry.getOlatResource().getResourceableId();
      System.out.println("Demo course imported - resourceableId: " + resourceableId);
         
      course = CourseFactory.loadCourse(resourceableId);
      DBFactory.getInstance().closeSession();
           
View Full Code Here

TOP

Related Classes of org.olat.repository.RepositoryEntry

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.