Package org.olat.repository

Examples of org.olat.repository.RepositoryManager


  /**
   * @see org.olat.navigation.SiteInstance#createController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
   */
  public MainLayoutController createController(UserRequest ureq, WindowControl wControl) {
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = rm.lookupRepositoryEntryBySoftkey(repositorySoftKey, true);
    ICourse course = CourseFactory.loadCourse(entry.getOlatResource());
    RunMainController c = new RunMainController(ureq, wControl, course, null, false, true);   
    // needed for css style reasons: a site own the whole content area and needs either to use a MenuAndToolController for the 3-columns layout or,
    // like here, the contentOnlyController
    //ContentOnlyController coc = new ContentOnlyController(ureq, wControl, c);
View Full Code Here


      } 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);
          businessPath = "[RepositoryEntry:" + re.getKey() + "][CourseNode:" + courseNodeId + "]";
        } catch (Exception e) {
          businessPath = null;
          //if something went wrong, like error while loading course...
          logWarn("error while processing resid: "+publisher.getResId(), e);
View Full Code Here

      ZipUtil.unzip(new LocalFileImpl(fExportedFile), sfContainer);
    else
      Tracing.logWarn("The actual contents of the shared folder were not found in the export.", ImportSharedfolderReferencesController.class);
   
    // create repository entry
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry importedRepositoryEntry = rm.createRepositoryEntryInstance(owner.getName());
    importedRepositoryEntry.setDisplayname(importExport.getDisplayName());
    importedRepositoryEntry.setResourcename(importExport.getResourceName());
    importedRepositoryEntry.setDescription(importExport.getDescription());
    if (keepSoftkey)
      importedRepositoryEntry.setSoftkey(importExport.getSoftkey());
   
    // Set the resource on the repository entry.
    OLATResource ores = OLATResourceManager.getInstance().findOrPersistResourceable(resource);
    importedRepositoryEntry.setOlatResource(ores);
    RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(importedRepositoryEntry);
    importedRepositoryEntry.setCanLaunch(rh.supportsLaunch());
   
    // create security group
    Manager securityManager = ManagerFactory.getManager();
    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(owner, newGroup);
    importedRepositoryEntry.setOwnerGroup(newGroup);
    rm.saveRepositoryEntry(importedRepositoryEntry);
   
    if (!keepSoftkey) {
      // set the new shared folder reference
      CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
      courseConfig.setSharedFolderSoftkey(importedRepositoryEntry.getSoftkey());
View Full Code Here

    }

    // BEGIN EFFICIENCY STATEMENT
    // create all efficiency statements for all users in all courses
    if (! uhd.getBooleanDataValue(TASK_EFFICIENCY_STATEMENT_DONE)) {
      RepositoryManager rm = RepositoryManager.getInstance();
      EfficiencyStatementManager esm = EfficiencyStatementManager.getInstance();
      // get all course repository entries
      List entries = rm.queryByType(CourseModule.ORES_TYPE_COURSE);
      Iterator iter = entries.iterator();
      while (iter.hasNext()) {
        RepositoryEntry re = (RepositoryEntry) iter.next();
        // load course from entry
        ICourse course = CourseFactory.loadCourse(re.getOlatResource());
View Full Code Here

   * @param ores
   * @param orga
   */
  private void setOrgaTitleToRepoEntryTitle(OLATResourceable ores, CPOrganization orga) {
    // Set the title of the organization to the title of the resource.
    RepositoryManager resMgr = RepositoryManager.getInstance();
    RepositoryEntry cpEntry = resMgr.lookupRepositoryEntry(ores, false);
    if (cpEntry != null) {
      String title = cpEntry.getDisplayname();
      orga.setTitle(title);
    }
  }
View Full Code Here

    File fExportedFile = importExport.importGetExportedFile();
    if (fExportedFile.exists()) ZipUtil.unzip(new LocalFileImpl(fExportedFile), glossaryContainer);
    else Tracing.logWarn("The actual contents of the glossary were not found in the export.", ImportGlossaryReferencesController.class);

    // create repository entry
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry importedRepositoryEntry = rm.createRepositoryEntryInstance(owner.getName());
    importedRepositoryEntry.setDisplayname(importExport.getDisplayName());
    importedRepositoryEntry.setResourcename(importExport.getResourceName());
    importedRepositoryEntry.setDescription(importExport.getDescription());
    if (keepSoftkey) importedRepositoryEntry.setSoftkey(importExport.getSoftkey());

    // Set the resource on the repository entry.
    OLATResource ores = OLATResourceManager.getInstance().findOrPersistResourceable(resource);
    importedRepositoryEntry.setOlatResource(ores);
    RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(importedRepositoryEntry);
    importedRepositoryEntry.setCanLaunch(rh.supportsLaunch());

    // create security group
    Manager securityManager = ManagerFactory.getManager();
    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(owner, newGroup);
    importedRepositoryEntry.setOwnerGroup(newGroup);
    rm.saveRepositoryEntry(importedRepositoryEntry);

    if (!keepSoftkey) {
      // set the new glossary reference
      CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
      courseConfig.setGlossarySoftKey(importedRepositoryEntry.getSoftkey());
View Full Code Here

        return null;
      }
    }

    // create repository entry
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry importedRepositoryEntry = rm.createRepositoryEntryInstance(owner.getName());
    importedRepositoryEntry.setDisplayname(importExport.getDisplayName());
    importedRepositoryEntry.setResourcename(importExport.getResourceName());
    importedRepositoryEntry.setDescription(importExport.getDescription());
    if (keepSoftkey) {
      String theSoftKey = importExport.getSoftkey();
      if (rm.lookupRepositoryEntryBySoftkey(theSoftKey, false) != null) {
        /*
         * keepSoftKey == true -> is used for importing in unattended mode.
         * "Importing and keeping the soft key" only works if there is not an
         * already existing soft key. In the case both if's are taken the
         * respective IMS resource is not imported. It is important to be aware
         * that the resource which triggered the import process still keeps the
         * soft key reference, and thus points to the already existing resource.
         */
        return null;
      }
      importedRepositoryEntry.setSoftkey(importExport.getSoftkey());
    }

    // Set the resource on the repository entry.
    OLATResource ores = OLATResourceManager.getInstance().findOrPersistResourceable(fileResource);
    importedRepositoryEntry.setOlatResource(ores);
    RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(importedRepositoryEntry);
    importedRepositoryEntry.setCanLaunch(rh.supportsLaunch());

    // create security group
    Manager securityManager = ManagerFactory.getManager();
    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(owner, newGroup);
    importedRepositoryEntry.setOwnerGroup(newGroup);
    rm.saveRepositoryEntry(importedRepositoryEntry);

    if (!keepSoftkey) setReference(importedRepositoryEntry, node, importMode);

    return importedRepositoryEntry;
  }
View Full Code Here

      Tracing.logAudit("+------------------------------------------+",this.getClass());
      Tracing.logAudit("+... LOCKS FOR OPEN QTI EDITOR SESSIONS ...+",this.getClass());
      Tracing.logAudit("+------------------------------------------+",this.getClass());
      //
      Manager manager = ManagerFactory.getManager();
      RepositoryManager rm = RepositoryManager.getInstance();
      RepositoryEntry myEntry;
      HashMap logmsg = new HashMap();
      VFSContainer qtiTmpDir = new LocalFolderImpl(QTIEditorPackage.getTmpBaseDir());
      VFSContainerFilter foldersOnly = new VFSContainerFilter();
      //folders in ../tmp/qtieditor hold the usernames
      List foldersUsername = qtiTmpDir.getItems(foldersOnly);
      for (Iterator iter = foldersUsername.iterator(); iter.hasNext();) {
        VFSContainer folderOfUser = (VFSContainer) iter.next();
        //the users folders holds folders with ids of OLATResourceable's
        List oResFolders = folderOfUser.getItems(foldersOnly);
        for (Iterator resources = oResFolders.iterator(); resources.hasNext();) {
          VFSContainer folderOfResource = (VFSContainer) resources.next();
          folderOfResource.createChildContainer(QTIEditorPackage.FOLDERNAMEFOR_CHANGELOG);
         
          //these are eiterh surveys or tests
          //try it as testresource then as survey, after this give up
          Long oresId = new Long(folderOfResource.getName());
          FileResource fr = new TestFileResource();
          fr.overrideResourceableId(oresId);
          myEntry = rm.lookupRepositoryEntry(fr,false);
          if(myEntry==null){
            //no qti test found, try the qti survey
            fr = new SurveyFileResource();
            fr.overrideResourceableId(oresId);
            myEntry = rm.lookupRepositoryEntry(fr,false);
          }
          //
          if(myEntry!=null){
            List identites = manager.getVisibleIdentitiesByPowerSearch(folderOfUser.getName(),null,false, null,null,null,null,null);
            if(identites!=null && identites.size()==1){
View Full Code Here

  private File fUnzippedDirRoot;
  private String sUnzippedDirRel;
  private Document doc = null;

  public ImsRepositoryResolver(Long repositoryEntryKey) {
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = rm.lookupRepositoryEntry(repositoryEntryKey);
    if (entry != null) {
      OLATResource ores = entry.getOlatResource();
      init(ores);
    }
  }
View Full Code Here

   
    // add course calendars
    List<String> subscribedCourseCalendarIDs = CourseCalendarSubscription.getSubscribedCourseCalendarIDs(
        ureq.getUserSession().getGuiPreferences());
   
    RepositoryManager repoManager = RepositoryManager.getInstance();
    List<String> calendarIDsToBeRemoved = new ArrayList<String>();
    for (Iterator<String> iter = subscribedCourseCalendarIDs.iterator(); iter.hasNext();) {
      String courseCalendarID = iter.next();
      final long courseResourceableID = Long.parseLong(courseCalendarID);
     
      RepositoryEntry repoEntry = repoManager.lookupRepositoryEntry(new OLATResourceable() {

        public Long getResourceableId() { return new Long(courseResourceableID); }
        public String getResourceableTypeName() { return CourseModule.getCourseTypeName(); }
      }, false);
      if (repoEntry == null) {
View Full Code Here

TOP

Related Classes of org.olat.repository.RepositoryManager

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.