Package org.olat.repository

Examples of org.olat.repository.RepositoryEntry


   * Called in AssessmentManager in a <code>doInSync</code> block, toghether with the saveScore.
   * @param userCourseEnv
   */
  protected void updateUserEfficiencyStatement(UserCourseEnvironment userCourseEnv) {
    Long courseResId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(
        OresHelper.createOLATResourceableInstance(CourseModule.class, courseResId), false);
    ICourse course = CourseFactory.loadCourse(userCourseEnv.getCourseEnvironment().getCourseResourceableId());
    updateUserEfficiencyStatement(userCourseEnv, re.getKey(), course, true);
  }
View Full Code Here


  public void updateEfficiencyStatements(OLATResourceable ores, List<Identity> identities, final boolean checkForExistingProperty) {
    if (identities.size() > 0) {
      final ICourse course = CourseFactory.loadCourse(ores);
      log.audit("Updating efficiency statements for course::" + course.getResourceableId() + ", this might produce temporary heavy load on the CPU");
      Long courseResId = course.getCourseEnvironment().getCourseResourceableId();
      final RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(
          OresHelper.createOLATResourceableInstance(CourseModule.class, courseResId), false);

      // preload cache to speed up things
      AssessmentManager am = course.getCourseEnvironment().getAssessmentManager();
      long start = System.currentTimeMillis();
      am.preloadCache();
      long between = System.currentTimeMillis();

      Iterator<Identity> iter = identities.iterator();     
      while (iter.hasNext()) {
        final Identity identity = iter.next();         
        //o_clusterOK: by ld
        OLATResourceable efficiencyStatementResourceable = am.createOLATResourceableForLocking(identity);
        CoordinatorManager.getCoordinator().getSyncer().doInSync(efficiencyStatementResourceable, new SyncerExecutor() {
          public void execute() {         
            // create temporary user course env
            UserCourseEnvironment uce = AssessmentHelper.createAndInitUserCourseEnvironment(identity, course);
            updateUserEfficiencyStatement(uce, re.getKey(), course, checkForExistingProperty);
            }
          });
        if (Thread.interrupted()) break;
      }
      //}
View Full Code Here

  /**
   * @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int)
   */
  public final Object getValueAt(int row, int col) {
    RepositoryEntry repoEntry = getRepositoryEntry(row);
    switch (col) {
      case 0:
        return repoEntry.getDisplayname();
      case 1:
        return repoEntry.getDescription();
      case 2:
        return repoEntry;
      default:
        return "error";
    }
View Full Code Here

  public void executeTask() {
    log.debug("IncrementLaunchCounterBackgroundTask executing with repositoryEntry=" + repositoryEntry);
    // this code must not be synchronized because in case of exception we try it again
    // this code must not have any error handling or retry, this will be done in super class
    if ( RepositoryManager.getInstance().lookupRepositoryEntry(repositoryEntry.getKey()) != null ) {
      RepositoryEntry reloadedRe = (RepositoryEntry) DBFactory.getInstance().loadObject(repositoryEntry, true);
      reloadedRe.incrementLaunchCounter();
      reloadedRe.setLastUsage(new Date());
      LifeCycleManager lcManager = LifeCycleManager.createInstanceFor(reloadedRe);
      if (lcManager.lookupLifeCycleEntry(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION) != null) {
        Tracing.logAudit("Repository-Deletion: Remove from delete-list repositoryEntry=" + reloadedRe, RepositoryManager.class);
        LifeCycleManager.createInstanceFor(reloadedRe).deleteTimestampFor(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION);
      }
View Full Code Here

  public void executeTask() {
    log.debug("IncrementDownloadCounterBackgroundTask executing with repositoryEntry=" + repositoryEntry);
    // this code must not be synchronized because in case of exception we try it again
    // this code must not have any error handling or retry, this will be done in super class
    if ( RepositoryManager.getInstance().lookupRepositoryEntry(repositoryEntry.getKey()) != null ) {
      RepositoryEntry reloadedRe = (RepositoryEntry) DBFactory.getInstance().loadObject(repositoryEntry, true);
      reloadedRe.incrementDownloadCounter();
      reloadedRe.setLastUsage(new Date());
      LifeCycleManager lcManager = LifeCycleManager.createInstanceFor(reloadedRe);
      if (lcManager.lookupLifeCycleEntry(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION) != null) {
        Tracing.logAudit("Repository-Deletion: Remove from delete-list repositoryEntry=" + reloadedRe, RepositoryManager.class);
        LifeCycleManager.createInstanceFor(reloadedRe).deleteTimestampFor(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION);
      }
View Full Code Here

    chooseCPButton = LinkFactory.createButtonSmall(NLS_COMMAND_CREATECP, cpConfigurationVc, this);
    changeCPButton = LinkFactory.createButtonSmall(NLS_COMMAND_CHANGECP, cpConfigurationVc, this);
   
    if (config.get(CONFIG_KEY_REPOSITORY_SOFTKEY) != null) {
      // fetch repository entry to display the repository entry title of the chosen cp
      RepositoryEntry re = getCPReference(config, false);
      if (re == null) { // we cannot display the entries name, because the
        // repository entry had been deleted between the time when it was chosen here, and now       
        this.showError(NLS_ERROR_CPREPOENTRYMISSING);
        cpConfigurationVc.contextPut("showPreviewButton", Boolean.FALSE);
        cpConfigurationVc.contextPut(VC_CHOSENCP, translate("no.cp.chosen"));
      } else {
        if (isEditable(ureq.getIdentity(), re)) {
          editLink = LinkFactory.createButtonSmall("edit", cpConfigurationVc, this);
        }
        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"));
      }
    } else {
      // no valid config yet
View Full Code Here

      listenTo(searchController);
      cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate(NLS_COMMAND_CREATECP));
      cmc.activate();
    } else if (source == previewLink){
      // Preview as modal dialogue only if the config is valid
      RepositoryEntry re = getCPReference(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       
        showError(NLS_ERROR_CPREPOENTRYMISSING);
      } else {
        File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
        Boolean showMenuB = config.getBooleanEntry(NodeEditController.CONFIG_COMPONENT_MENU);
        // pre: showMenuB != null
        if (previewCtr != null) previewCtr.dispose();
        previewCtr = CPUIFactory.getInstance().createMainLayoutPreviewController(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), showMenuB.booleanValue());
        previewCtr.activate();
View Full Code Here

    if (source == searchController) {
      if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
        // search controller done
        // -> close closeable modal controller
        cmc.deactivate();
        RepositoryEntry re = searchController.getSelectedEntry();
        if (re != null) {
          setCPReference(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"));
          // remove existing edit link, add new one if user is allowed to edit this CP
          if (editLink != null) {
            cpConfigurationVc.remove(editLink);
View Full Code Here

    if (repoSoftkey == null) {
      if (strict) throw new AssertException("invalid config when being asked for references");
      else return null;
    }
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = rm.lookupRepositoryEntryBySoftkey(repoSoftkey, strict);
    // entry can be null only if !strict
    return entry;
  }
View Full Code Here

   *      org.olat.course.run.userview.NodeEvaluation, java.lang.String)
   */
  @Override
  public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl control,
      UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    RepositoryEntry entry = getReferencedRepositoryEntry();
    // create business path courseID:nodeID
    // userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    // getIdent();
    Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    String nodeId = this.getIdent();
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isGuest = ureq.getUserSession().getRoles().isGuestOnly();
    FeedSecurityCallback callback = new FeedNodeSecurityCallback(ne, isAdmin, isGuest);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(this));
    FeedMainController podcastCtr = PodcastUIFactory.getInstance(ureq.getLocale()).createMainController(entry.getOlatResource(), ureq, control,
        callback, courseId, nodeId);
    podcastCtr.activate(ureq, nodecmd);
    Controller wrapperCtrl = TitledWrapperHelper.getWrapper(ureq, control, podcastCtr, this, "o_podcast_icon");
    NodeRunConstructionResult result = new NodeRunConstructionResult(wrapperCtrl);
    return result;
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.