Examples of RepositoryManager


Examples of org.olat.repository.RepositoryManager

  public String getMountPoint() { return MOUNTPOINT; }

  public VFSContainer getContainer(Identity identity) {
    MergeSource cfRoot = new MergeSource(null, null);
    RepositoryManager rm = RepositoryManager.getInstance();
    List courseEntries = rm.queryByOwner(identity, CourseModule.getCourseTypeName());
   
    for (Iterator iter = courseEntries.iterator(); iter.hasNext();) {
      RepositoryEntry re = (RepositoryEntry) iter.next();
      OLATResourceable res = re.getOlatResource();
      ICourse course = CourseFactory.loadCourse(res.getResourceableId());
View Full Code Here

Examples of org.olat.repository.RepositoryManager

   */
  public VFSContainer getContainer(Identity identity) {
    MergeSource rootContainer = new MergeSource(null, "root");

    SharedFolderManager sfm = SharedFolderManager.getInstance();
    RepositoryManager repoManager = RepositoryManager.getInstance();
    List<RepositoryEntry> ownerEntries = (List<RepositoryEntry>) repoManager.queryByOwner(identity, SharedFolderFileResource.TYPE_NAME);
    for (RepositoryEntry repoEntry : ownerEntries) {
      rootContainer.addContainer(sfm.getNamedSharedFolder(repoEntry));
    }

    // see /olat3/webapp/WEB-INF/olat_extensions.xml
    if (publiclyReadableFolders != null && publiclyReadableFolders.size() > 0) {
      // Temporarily save added entries. This is needed to make sure not to add
      // an
      // entry twice.
      List<RepositoryEntry> addedEntries = new ArrayList<RepositoryEntry>(ownerEntries);
      //
      String firstItem = publiclyReadableFolders.get(0);
      // If the first value in the list is '*', list all resource folders.
      if (firstItem != null && firstItem.equals("*")) {
        // fake role that represents normally logged in user
        Roles registeredUserRole = new Roles(false, false, false, false, false, false);
        List<RepositoryEntry> allEntries = (List<RepositoryEntry>) repoManager.queryByTypeLimitAccess(SharedFolderFileResource.TYPE_NAME,
            registeredUserRole);
        for (RepositoryEntry entry : allEntries) {
          addReadonlyFolder(rootContainer, entry, sfm, addedEntries);
        }
      } else {
        // only list the specified folders
        for (String folder : publiclyReadableFolders) {
          try {
            Long repoKey = Long.parseLong(folder);
            RepositoryEntry entry = repoManager.lookupRepositoryEntry(repoKey);
            if (entry != null) {
              if (entry.getAccess() >= RepositoryEntry.ACC_USERS) {
                // add folder (which is a repo entry) to root container if not
                // present
                addReadonlyFolder(rootContainer, entry, sfm, addedEntries);
View Full Code Here

Examples of org.olat.repository.RepositoryManager

     * problems: A tries to reference this test, after test editor has been
     * started
     */
    changeEmail = new ContactMessage(ureq.getIdentity());

    RepositoryManager rm = RepositoryManager.getInstance();
    // the owners of this qtiPkg
    RepositoryEntry myEntry = rm.lookupRepositoryEntry(qtiPackage.getRepresentingResourceable(), false);
    SecurityGroup qtiPkgOwners = myEntry.getOwnerGroup();

    // add qti resource owners as group
    ContactList cl = new ContactList("qtiPkgOwners");
    cl.addAllIdentites(ManagerFactory.getManager().getIdentitiesOfSecurityGroup(qtiPkgOwners));
    changeEmail.addEmailTo(cl);

    StringBuilder result = new StringBuilder();
    result.append(translate("qti.restricted.leading"));
    for (Iterator iter = referencees.iterator(); iter.hasNext();) {
      ReferenceImpl element = (ReferenceImpl) iter.next();
      // FIXME:discuss:possible performance/cache problem
      if ("CourseModule".equals(element.getSource().getResourceableTypeName())) {
        ICourse course = CourseFactory.loadCourse(element.getSource().getResourceableId());

        // the course owners

        RepositoryEntry entry = rm.lookupRepositoryEntry(course, false);
        String courseTitle = course.getCourseTitle();
        SecurityGroup owners = entry.getOwnerGroup();
        List stakeHoldersIds = ManagerFactory.getManager().getIdentitiesOfSecurityGroup(owners);

        // add stakeholders as group
View Full Code Here

Examples of org.olat.repository.RepositoryManager

      return null;
    }
    File courseExportData = ImportCourseController.getExportDataDir(course);
    // get the export data directory
    // create the repository entry
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry re = rm.createRepositoryEntryInstance("administrator");
    RepositoryEntryImportExport importExport = new RepositoryEntryImportExport(courseExportData);
    String softKey = importExport.getSoftkey();
    RepositoryEntry existingEntry = rm.lookupRepositoryEntryBySoftkey(softKey, false);
    if (existingEntry != null) {
      Tracing.logInfo("RepositoryEntry with softkey " + softKey + " already exists. Course will not be deployed.", CourseFactory.class);
      CourseFactory.deleteCourse(newCourseResource);
      return existingEntry;
    }
    // ok, continue import
    newCourseResource = OLATResourceManager.getInstance().findOrPersistResourceable(newCourseResource);
    re.setOlatResource(newCourseResource);
    re.setSoftkey(softKey);
    re.setInitialAuthor(importExport.getInitialAuthor());
    re.setDisplayname(importExport.getDisplayName());
    re.setResourcename(importExport.getResourceName());
    re.setDescription(importExport.getDescription());
    re.setCanLaunch(true);
   
    // set access configuration
    re.setAccess(access);
   
    course = openCourseEditSession(course.getResourceableId());
    // create group management
    CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
    cgm.createCourseGroupmanagement(course.getResourceableId().toString());
    // import groups
    cgm.importCourseLearningGroups(courseExportData);
    cgm.importCourseRightGroups(courseExportData);

    // create security group
    Manager securityManager = ManagerFactory.getManager();
    SecurityGroup ownerGroup = securityManager.createAndPersistSecurityGroup();
    // member of this group may modify member's membership
    securityManager.createAndPersistPolicy(ownerGroup, Constants.PERMISSION_ACCESS, ownerGroup);
    // members of this group are always authors also
    securityManager.createAndPersistPolicy(ownerGroup, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR);
    securityManager.addIdentityToSecurityGroup(securityManager.findIdentityByName("administrator"), ownerGroup);
    re.setOwnerGroup(ownerGroup);
    // save the repository entry
    rm.saveRepositoryEntry(re);
    // Create course admin policy for owner group of repository entry
    // -> All owners of repository entries are course admins
    securityManager.createAndPersistPolicy(re.getOwnerGroup(), Constants.PERMISSION_ADMIN, re.getOlatResource());
   
    // deploy any referenced repository entries of the editor structure. This will also
View Full Code Here

Examples of org.olat.repository.RepositoryManager

   * @return The help-course run controller
   */
  public static Controller createHelpCourseLaunchController(UserRequest ureq, WindowControl wControl) {
    // Find repository entry for this course
    String helpCourseSoftKey = CourseModule.getHelpCourseSoftKey();
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = null;
    if (helpCourseSoftKey != null) {
      entry = rm.lookupRepositoryEntryBySoftkey(helpCourseSoftKey, false);
    }
    if (entry == null) {
      wControl.setError("error.helpcourse.not.configured");
      // create empty main controller
      LayoutMain3ColsController emptyCtr = new LayoutMain3ColsController(ureq, wControl, null, null, null, null);
      return emptyCtr;
    } else {
      // Increment launch counter
      rm.incrementLaunchCounter(entry);
      OLATResource ores = entry.getOlatResource();
      ICourse course = loadCourse(ores);
     
      ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(entry);
      WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, wControl)
View Full Code Here

Examples of org.olat.repository.RepositoryManager

      } else {
        try {
          String courseNodeId = courseNode.substring(0, courseNode.indexOf(':'));
          Long resId = publisher.getResId();
          ICourse course = CourseFactory.loadCourse(resId);
          RepositoryManager rm = RepositoryManager.getInstance();
          OLATResource rsrc = OLATResourceManager.getInstance().findResourceable(course.getResourceableId(), course.getResourceableTypeName());
          RepositoryEntry re = rm.lookupRepositoryEntry(rsrc, true);
          //node forum
          businessPath = "[RepositoryEntry:" + re.getKey() + "][CourseNode:" + courseNodeId + "]";
        } catch (Exception e) {
          businessPath = null;
          //if something went wrong, like error while loading course...
View Full Code Here

Examples of org.olat.repository.RepositoryManager

  /**
   * @return The jump in link
   */
  public String getJumpInLink() {
    String jumpInLink = null;
    RepositoryManager resMgr = RepositoryManager.getInstance();
    if (courseId != null && nodeId != null) {
      OLATResourceable oresCourse = OLATResourceManager.getInstance().findResourceable(courseId, CourseModule.getCourseTypeName());
      RepositoryEntry repositoryEntry = resMgr.lookupRepositoryEntry(oresCourse, false);
      jumpInLink = RepoJumpInHandlerFactory.buildRepositoryDispatchURI(repositoryEntry, nodeId);
    } else {
      RepositoryEntry repositoryEntry = resMgr.lookupRepositoryEntry(feed, false);
      jumpInLink = RepoJumpInHandlerFactory.buildRepositoryDispatchURI(repositoryEntry);
    }
    return jumpInLink;
  }
View Full Code Here

Examples of org.olat.repository.RepositoryManager

  /**
   * @param ores
   * @return The repository entry of ores or null
   */
  private RepositoryEntry getRepositoryEntry(OLATResourceable ores) {
    RepositoryManager resMgr = RepositoryManager.getInstance();
    return resMgr.lookupRepositoryEntry(ores, false);
  }
View Full Code Here

Examples of org.olat.repository.RepositoryManager

   *
   * @see org.olat.instantMessaging.InstantMessaging#synchronizeLearningGroupsWithIMServer()
   */
  public boolean synchronizeLearningGroupsWithIMServer() {
    log.info("Starting synchronisation of LearningGroups with IM server");
    RepositoryManager rm = RepositoryManager.getInstance();
    BGContextManager contextManager = BGContextManagerImpl.getInstance();
    //pull as admin
    Roles roles = new Roles(true, true, true, true, false, true);
    List<RepositoryEntry> allCourses = rm.queryByTypeLimitAccess(CourseModule.getCourseTypeName(), roles);
    int counter = 0;
    for (Iterator<RepositoryEntry> iterator = allCourses.iterator(); iterator.hasNext();) {
      RepositoryEntry entry = iterator.next();
      ICourse course = null;
      try{
View Full Code Here

Examples of org.olat.repository.RepositoryManager

          //open in new browser window
          PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
          pbw.open(ureq);
          //
        } else if (actionid.equals(CMD_LAUNCH_COURSE)) {
          RepositoryManager rm = RepositoryManager.getInstance();
          RepositoryEntry re = rm.lookupRepositoryEntry(efficiencyStatement.getCourseRepoEntryKey());
          if (re == null) {
            showWarning("efficiencyStatements.course.noexists");
          } else if (!rm.isAllowedToLaunch(ureq, re)) {
            showWarning("efficiencyStatements.course.noaccess");
          } else {
            OLATResourceable ores = re.getOlatResource();
            //was brasato:: DTabs dts = getWindowControl().getDTabs();
            DTabs dts = (DTabs)Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.