Package org.olat.resource

Examples of org.olat.resource.OLATResource


  public void doIndex(SearchResourceContext resourceContext, Object parentObject, OlatFullIndexer indexWriter)
  throws IOException,InterruptedException  {
    if (log.isDebug()) log.debug("Index Scorm package...");
   
    RepositoryEntry repositoryEntry = (RepositoryEntry) parentObject;
    OLATResource ores = repositoryEntry.getOlatResource();
    File cpRoot = FileResourceManager.getInstance().unzipFileResource(ores);

    resourceContext.setDocumentType(TYPE);
    resourceContext.setTitle(repositoryEntry.getDisplayname());
    resourceContext.setDescription(repositoryEntry.getDescription());
View Full Code Here


   */
  public FileResource createWiki() {
    FileResource resource = new WikiResource();
    createFolders(resource);
    OLATResourceManager rm = OLATResourceManager.getInstance();
    OLATResource ores = rm.createOLATResourceInstance(resource);
    rm.saveOLATResource(ores);
    return resource;
  }
View Full Code Here

    CoordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new OLATResourceableJustBeforeDeletedEvent(res), res);
    //archiving is done within readyToDelete   
    CourseFactory.deleteCourse(res);
    // delete resourceable
    OLATResourceManager rm = OLATResourceManager.getInstance();
    OLATResource ores = rm.findResourceable(res);
    rm.deleteOLATResource(ores);
    return true;
  }
View Full Code Here

    Tracing.logDebug("deleteRepositoryEntry start entry=" + entry, this.getClass());
    entry = (RepositoryEntry) DBFactory.getInstance().loadObject(entry,true);
    Tracing.logDebug("deleteRepositoryEntry after load entry=" + entry, this.getClass());
    Tracing.logDebug("deleteRepositoryEntry after load entry.getOwnerGroup()=" + entry.getOwnerGroup(), this.getClass());
    RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(entry);
    OLATResource ores = entry.getOlatResource();
    if (!handler.readyToDelete(ores, ureq, wControl)) return false;

    // start transaction
    // delete entry picture
    File uploadDir = new File(FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome());
View Full Code Here

   * @param strict true: throws exception if not found, false: returns null if not found
   * @return the RepositorEntry or null if strict=false
   * @throws AssertException if the softkey could not be found (strict=true)
   */
  public RepositoryEntry lookupRepositoryEntry(OLATResourceable resourceable, boolean strict) {
    OLATResource ores = OLATResourceManager.getInstance().findResourceable(resourceable);
    if (ores == null) {
      if (!strict) return null;
      throw new AssertException("Unable to fetch OLATResource for resourceable: " + resourceable.getResourceableTypeName() + ", " + resourceable.getResourceableId());
    }
   
    String query = "select v from org.olat.repository.RepositoryEntry v"+
      " inner join fetch v.olatResource as ores"+
      " where ores.key = :oreskey";
    DBQuery dbQuery = DBFactory.getInstance().createQuery(query);
    dbQuery.setLong("oreskey", ores.getKey().longValue());
    dbQuery.setCacheable(true);
   
    List result = dbQuery.list();
    int size = result.size();
    if (strict) {
View Full Code Here

    // Add static fields
    uifactory.addStaticTextElement("cif.id", entry.getResourceableId() == null ? "-" : entry.getResourceableId().toString(), formLayout);
    uifactory.addStaticTextElement("cif.initialAuthor", entry.getInitialAuthor() == null ? "-" : entry.getInitialAuthor().toString(), formLayout);
    // Add resource type
    String typeName = null;
    OLATResource res = entry.getOlatResource();
    if (res != null) typeName = res.getResourceableTypeName();
    StringBuilder typeDisplayText = new StringBuilder(100);
    if (typeName != null) { // add image and typename code
      RepositoryEntryIconRenderer reir = new RepositoryEntryIconRenderer(ureq.getLocale());
      typeDisplayText.append("<span class=\"b_with_small_icon_left ");
      typeDisplayText.append(reir.getIconCssClass(entry));
View Full Code Here

    }
    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 {
      return new LoggingResourceable(olatResourceable, type, olatResourceable.getResourceableTypeName(),
          String.valueOf(olatResourceable.getResourceableId()), "");     
    }
  }
View Full Code Here

        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

  public SharedFolderFileResource createSharedFolder() {
    SharedFolderFileResource resource = new SharedFolderFileResource();
    VFSContainer rootContainer = FileResourceManager.getInstance().getFileResourceRootImpl(resource);
    if (rootContainer.createChildContainer(FOLDER_NAME) == null) return null;
    OLATResourceManager rm = OLATResourceManager.getInstance();
    OLATResource ores = rm.createOLATResourceInstance(resource);
    rm.saveOLATResource(ores);
    return resource;
  }
View Full Code Here

   *
   * @param exportedCourseZIPFile
   */
  public static RepositoryEntry deployCourseFromZIP(File exportedCourseZIPFile, int access) {
    // create the course instance
    OLATResource newCourseResource = OLATResourceManager.getInstance().createOLATResourceInstance(CourseModule.class);
    ICourse course = CourseFactory.importCourseFromZip(newCourseResource, exportedCourseZIPFile);
    // course is now also in course cache!
    if (course == null) {
      Tracing.logError("Error deploying course from ZIP: " + exportedCourseZIPFile.getAbsolutePath(), CourseFactory.class);
      return null;
View Full Code Here

TOP

Related Classes of org.olat.resource.OLATResource

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.