Package org.olat.repository

Examples of org.olat.repository.RepositoryEntry


  @Override
  public Controller createPeekViewRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv,
      NodeEvaluation ne) {
    if (ne.isAtLeastOneAccessible()) {
      // Create a feed peekview controller that shows the latest two entries
      RepositoryEntry entry = getReferencedRepositoryEntry();
      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);
      FeedUIFactory uiFactory = PodcastUIFactory.getInstance(ureq.getLocale());
      Controller peekViewController = new FeedPeekviewController(entry.getOlatResource(), ureq, wControl, callback, courseId, nodeId, uiFactory, 2, "o_podcast_peekview");
      return peekViewController;
    } else {
      // use standard peekview
      return super.createPeekViewRunController(ureq, wControl, userCourseEnv, ne);
    }
View Full Code Here


  private void doLaunch(UserRequest ureq) {
    if (cpRoot == null) {
      // it is the first time we start the contentpackaging from this instance
      // of this controller.
      // need to be strict when launching -> "true"
      RepositoryEntry re = CPEditController.getCPReference(config, true);
      if (re == null) throw new AssertException("configurationkey 'CONFIG_KEY_REPOSITORY_SOFTKEY' of BB CP was missing");
      cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
      // should always exist because references cannot be deleted as long as
      // nodes reference them
      if (cpRoot == null) throw new AssertException("file of repository entry " + re.getKey() + " was missing");
    }
    // else cpRoot is already set (save some db access if the user opens /
    // closes / reopens the cp from the same CPRuncontroller instance)
    boolean activateFirstPage = true;
    if ( (nodecmd != null) && !nodecmd.equals("") ) {
View Full Code Here

      String message = trans.translate("guestnoaccess.message");
      controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
      AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
      IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
      RepositoryEntry repositoryEntry = ne.getCourseNode().getReferencedRepositoryEntry();
      OLATResourceable ores = repositoryEntry.getOlatResource();
      Long resId = ores.getResourceableId();
      TestFileResource fr = new TestFileResource();
      fr.overrideResourceableId(resId);
      if(!CoordinatorManager.getCoordinator().getLocker().isLocked(fr, null)) {
        //QTI1
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 re = IQEditController.getIQReference(getModuleConfiguration(), false);
    return re;
  }
View Full Code Here

   */
  public void exportNode(File exportDirectory, ICourse course) {
    String repositorySoftKey = (String) getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
    if (repositorySoftKey == null) return; // nothing to export
    //self healing
    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, false);
    if(re==null) {
      //nothing to export, but correct the module configuration
      IQEditController.removeIQReference(getModuleConfiguration());
      return;
    }
View Full Code Here

            // first create the efficiencies, send event to agency (all courses add link)
            List identitiesWithData = course.getCourseEnvironment().getCoursePropertyManager().getAllIdentitiesWithCourseAssessmentData();
            EfficiencyStatementManager.getInstance().updateEfficiencyStatements(course, identitiesWithData, false);             
          } else {
            // delete really the efficiencies of the users.
            RepositoryEntry courseRepoEntry = RepositoryManager.getInstance().lookupRepositoryEntry(course, true);
            EfficiencyStatementManager.getInstance().deleteEfficiencyStatementsFromCourse(courseRepoEntry.getKey());           
          }
          //inform everybody else   
          EventBus eventBus = CoordinatorManager.getCoordinator().getEventBus();
          CourseConfigEvent courseConfigEvent = new CourseConfigEvent(CourseConfigEvent.EFFICIENCY_STATEMENT_TYPE, course.getResourceableId());
          eventBus.fireEventToListenersOf(courseConfigEvent, course);
          ThreadLocalUserActivityLogger.log(ceffC.getLoggingAction(), getClass());
        }
        // CourseCalendarConfigController
        if(changedCourseConfig.isCalendarEnabled()!= initialCourseConfig.isCalendarEnabled() && calCfgCtr.getLoggingAction()!=null) {
          ThreadLocalUserActivityLogger.log(calCfgCtr.getLoggingAction(), getClass());
          // notify calendar components to refresh their calendars
          CoordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new KalendarModifiedEvent(), OresHelper.lookupType(CalendarManager.class));
        }
        // CourseConfigGlossaryController
        if((changedCourseConfig.getGlossarySoftKey()==null && initialCourseConfig.getGlossarySoftKey()!=null)
            || (changedCourseConfig.getGlossarySoftKey()!=null && initialCourseConfig.getGlossarySoftKey()==null)
            && cglosCtr.getLoggingAction()!=null) {
         
          final String glossarySoftKey = changedCourseConfig.getGlossarySoftKey();
          LoggingResourceable lri = null;
          if (glossarySoftKey!=null) {
            lri = LoggingResourceable.wrapNonOlatResource(StringResourceableType.glossarySoftKey, glossarySoftKey, glossarySoftKey);
          }
          ThreadLocalUserActivityLogger.log(cglosCtr.getLoggingAction(), getClass(), lri);
          if(changedCourseConfig.getGlossarySoftKey()==null) {
            // update references
            ReferenceManager refM = ReferenceManager.getInstance();
            List repoRefs = refM.getReferences(course);
            for (Iterator iter = repoRefs.iterator(); iter.hasNext();) {
              ReferenceImpl ref = (ReferenceImpl) iter.next();
              if (ref.getUserdata().equals(GlossaryManager.GLOSSARY_REPO_REF_IDENTIFYER)) {
                refM.delete(ref);
                continue;
              }
            }
          } else if(changedCourseConfig.getGlossarySoftKey()!=null) {
            // update references
            RepositoryManager rm = RepositoryManager.getInstance();
            RepositoryEntry repoEntry = rm.lookupRepositoryEntryBySoftkey(changedCourseConfig.getGlossarySoftKey(), false);
            ReferenceManager.getInstance().addReference(course, repoEntry.getOlatResource(), GlossaryManager.GLOSSARY_REPO_REF_IDENTIFYER);
          }
        }
        //course config transaction fihished
        initialCourseConfig = course.getCourseEnvironment().getCourseConfig().clone();       
       
View Full Code Here

  public void event(UserRequest ureq, Component source, Event event) {
    if (source == forwardButton){
     
      // check if repository entry is still available
      RepositoryManager rm = RepositoryManager.getInstance();
      RepositoryEntry checkEntry = rm.lookupRepositoryEntry(sourceEntry.getKey());
      if (checkEntry == null) { // entry has been deleted meanwhile
        getWindowControl().setError(translator.translate("error.createcopy"));
        fireEvent(ureq, Event.FAILED_EVENT);
        fireEvent(ureq, new EntryChangedEvent(sourceEntry, EntryChangedEvent.DELETED));
        return;
View Full Code Here

      return;
    }
  }

  private RepositoryEntry createNewRepositoryEntry(RepositoryEntry src, UserRequest ureq) {
    RepositoryEntry preparedEntry = RepositoryManager.getInstance()
    .createRepositoryEntryInstance(ureq.getIdentity().getName());

    preparedEntry.setCanDownload(src.getCanDownload());
    preparedEntry.setCanLaunch(src.getCanLaunch());
    // FIXME:pb:ms translation for COPY OF
    String newDispalyname = "Copy of " + src.getDisplayname();
    if (newDispalyname.length() > DetailsForm.MAX_DISPLAYNAME) newDispalyname = newDispalyname.substring(0,
        DetailsForm.MAX_DISPLAYNAME - 1);
    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;
    }
   
    OLATResource ores = OLATResourceManager.getInstance().findOrPersistResourceable(newResourceable);
    preparedEntry.setOlatResource(ores);
    // create security group
    SecurityGroup newGroup = securityManager.createAndPersistSecurityGroup();
    // member of this group may modify member's membership
    securityManager.createAndPersistPolicy(newGroup, Constants.PERMISSION_ACCESS, newGroup);
    // members of this group are always authors also
    securityManager.createAndPersistPolicy(newGroup, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR);
   
    securityManager.addIdentityToSecurityGroup(ureq.getIdentity(), newGroup);
    preparedEntry.setOwnerGroup(newGroup);

    RepositoryManager.getInstance().saveRepositoryEntry(preparedEntry);
    // copy image if available
    RepositoryEntryImageController.copyImage(src, preparedEntry);
    return preparedEntry;
View Full Code Here

  }
 
  private void cleanup() {
    Tracing.logDebug("Cleanup : newEntry=" + newEntry, RepositoryCopyController.class);
    if (newEntry != null) {
      RepositoryEntry entry = RepositoryManager.getInstance().lookupRepositoryEntry(newEntry.getKey());
      if (entry != null) {
        try {
          Tracing.logDebug("Cleanup : started", RepositoryCopyController.class);
          newEntry = (RepositoryEntry) DBFactory.getInstance().loadObject(newEntry,true);
          SecurityGroup secGroup = newEntry.getOwnerGroup();
View Full Code Here

   *
   * @param row
   * @return
   */
  public RepositoryEntry getValueAt(int row) {
    RepositoryEntry repoEntry = (RepositoryEntry)repoTableModel.getObject(row);
    return repoEntry;
  }
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.