Package org.olat.repository

Examples of org.olat.repository.RepositoryEntry


    this.childTabsCntrllr = childTabsController;   
    this.listenTo(childTabsCntrllr);
   
    // description and metadata component   
    descriptionVc = this.createVelocityContainer("nodeedit");
    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(course, true);
   
    StringBuilder extLink = new StringBuilder();
    extLink.append(Settings.getServerContextPathURI())
      .append("/url/RepositoryEntry/").append(re.getKey())
      .append("/CourseNode/").append(luNode.getIdent());
    StringBuilder intLink = new StringBuilder();
    intLink.append("javascript:parent.gotonode(").append(luNode.getIdent()).append(")");
   
    descriptionVc.contextPut("extLink", extLink.toString());
View Full Code Here


   */
  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());
    resourceContext.setParentContextType(TYPE);
    resourceContext.setParentContextName(repositoryEntry.getDisplayname());
    doIndex(resourceContext, indexWriter, cpRoot);
  }
View Full Code Here

      String[] splitted = token.split("[:]");
      if(splitted != null && splitted.length == 2) {
        String tokenType = splitted[0];
        String tokenKey = splitted[1];
        if ("RepositoryEntry".equals(tokenType)) {
          RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(Long.parseLong(tokenKey));
          return re.getDisplayname();
        }
        if ("CourseNode".equals(tokenType)) {
          String repoKey = allTokens.get(0).split("[:]")[1];
          RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(Long.parseLong(repoKey));
          ICourse course = CourseFactory.loadCourse(re.getOlatResource());
          CourseNode courseNode = course.getRunStructure().getNode(tokenKey);
          return courseNode.getShortTitle();
        }
        if ("Identity".equals(tokenType)) {
          Identity identity  = ManagerFactory.getManager().loadIdentityByKey(Long.parseLong(tokenKey));
View Full Code Here

    boolean hasAccess = false;
    if (allowsGuestAccess(feed)) {
      hasAccess = true;
    } else if (identity != null) {
      RepositoryManager resMgr = RepositoryManager.getInstance();
      RepositoryEntry repoEntry = resMgr.lookupRepositoryEntry(feed, false);
      Roles roles = ManagerFactory.getManager().getRoles(identity);
      boolean isAllowedToLaunch = resMgr.isAllowedToLaunch(identity, roles, repoEntry);
      if (isAllowedToLaunch && validAuthentication(identity, token)) {
        hasAccess = true;
      }
View Full Code Here

   * @return true if the feed allows guest access.
   */
  private boolean allowsGuestAccess(OLATResourceable res) {
    boolean guestsAllowed = false;
    RepositoryManager resMgr = RepositoryManager.getInstance();
    RepositoryEntry repoEntry = resMgr.lookupRepositoryEntry(res, false);
    if (repoEntry.getAccess() == RepositoryEntry.ACC_USERS_GUESTS) {
      guestsAllowed = true;
    }
    return guestsAllowed;
  }
View Full Code Here

    int counter = 0;
    List repositoryList = repositoryManager.genericANDQueryWithRolesRestriction(null,null,null,null,roles, null);
    if (Tracing.isDebugEnabled(RepositoryIndexer.class)) Tracing.logDebug("RepositoryIndexer repositoryList.size=" + repositoryList.size(), RepositoryIndexer.class);
    // loop over all repository-entries
    Iterator iter = repositoryList.iterator();
    RepositoryEntry repositoryEntry = null;
    while(iter.hasNext()) {
      try {
        repositoryEntry = (RepositoryEntry)iter.next();
        if (Tracing.isDebugEnabled(RepositoryIndexer.class)) Tracing.logDebug("Index repositoryEntry=" + repositoryEntry + "  counter=" + counter++ + " with ResourceableId=" + repositoryEntry.getOlatResource().getResourceableId(), RepositoryIndexer.class);
        if (!isOnBlacklist(repositoryEntry.getOlatResource().getResourceableId().toString()) ) {
          SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
          searchResourceContext.setBusinessControlFor(repositoryEntry);
          Document document = RepositoryEntryDocument.createDocument(searchResourceContext, repositoryEntry);
          indexWriter.addDocument(document);
          // Pass created-date & modified-date in context to child indexer because the child have no dates
          // TODO:chg: Check ob courseNode keine Daten hat
          searchResourceContext.setLastModified(repositoryEntry.getLastModified());
          searchResourceContext.setCreatedDate(repositoryEntry.getCreationDate());
          // go further with resource
          Indexer repositoryEntryIndexer = RepositoryEntryIndexerFactory.getInstance().getRepositoryEntryIndexer(repositoryEntry);
          if (repositoryEntryIndexer != null) {
            repositoryEntryIndexer.doIndex(searchResourceContext, repositoryEntry, indexWriter);
          } else {
            if (Tracing.isDebugEnabled(RepositoryIndexer.class)) Tracing.logDebug("No RepositoryEntryIndexer for " + repositoryEntry.getOlatResource(),RepositoryIndexer.class); // e.g. RepositoryEntry       
          }
        } else {
          Tracing.logWarn("RepositoryEntry is on black-list and excluded from search-index, repositoryEntry=" + repositoryEntry, RepositoryIndexer.class);
        }
      } catch (Throwable ex) {
        // create meaninfull debugging output to find repo entry that is somehow broken
        String entryDebug = "NULL";
        if (repositoryEntry != null) {
          entryDebug = "resId::" + repositoryEntry.getResourceableId() + " resTypeName::" + repositoryEntry.getResourceableTypeName() + " resName::" + repositoryEntry.getResourcename();
        }
        Tracing.logWarn("Exception=" + ex.getMessage() + " for repo entry " + entryDebug, ex, RepositoryIndexer.class);
      }
    }
    if (Tracing.isDebugEnabled(RepositoryIndexer.class)) Tracing.logDebug("RepositoryIndexer finished.  counter=" + counter, RepositoryIndexer.class);
View Full Code Here

   * @see org.olat.search.service.indexer.Indexer#checkAccess(org.olat.core.id.context.ContextEntry, org.olat.core.id.context.BusinessControl, org.olat.core.id.Identity, org.olat.core.id.Roles)
   */
  public boolean checkAccess(ContextEntry contextEntry, BusinessControl businessControl, Identity identity, Roles roles) {
    if (Tracing.isDebugEnabled(RepositoryIndexer.class)) Tracing.logDebug("checkAccess for businessControl=" + businessControl + "  identity=" + identity + "  roles=" + roles, RepositoryIndexer.class);
    Long repositoryKey = contextEntry.getOLATResourceable().getResourceableId();
    RepositoryEntry repositoryEntry = repositoryManager.lookupRepositoryEntry(repositoryKey);
    if (repositoryEntry != null) {
      boolean isOwner = repositoryManager.isOwnerOfRepositoryEntry(identity,repositoryEntry);
      boolean isAllowedToLaunch = false;
      if (!isOwner) {
        if (repositoryEntry.getOwnerGroup() == null) {
          // FIXME:chg: Inconsistent RepositoryEntry without owner-group, should not exit => Workaround no access
          return false;
        }
        isAllowedToLaunch = repositoryManager.isAllowedToLaunch(identity, roles, repositoryEntry);
      }
View Full Code Here

        authentication = manager.createAndPersistAuthentication(identity, TOKEN_PROVIDER, idKey, token);
      }
      // If the repository entry allows guest access it is public, thus not
      // private.
      boolean isPrivate = true;
      RepositoryEntry entry = RepositoryManager.getInstance().lookupRepositoryEntry(feed, false);
      if (entry != null && entry.getAccess() == RepositoryEntry.ACC_USERS_GUESTS) {
        isPrivate = false;
      }

      if (isPrivate) {
        // identity key
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 = ScormEditController.getScormCPReference(config, true);
      if (re == null) throw new AssertException("configurationkey 'CONFIG_KEY_REPOSITORY_SOFTKEY' of BB CP was missing");
      cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
      addLoggingResourceable(LoggingResourceable.wrapScormRepositoryEntry(re));
      // 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)

    String courseId;
View Full Code Here

    changeCPButton = LinkFactory.createButtonSmall("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 = getScormCPReference(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(NLS_NO_CP_CHOSEN));
      } else {
        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 {
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.