Package org.olat.core.id.context

Examples of org.olat.core.id.context.ContextEntry


      }
    }
    if (bcContextEntries_!=null) {
      LinkedList<ContextEntry> bcContextEntriesCopy = new LinkedList<ContextEntry>();
      for (Iterator<ContextEntry> it = bcContextEntries_.iterator(); it.hasNext();) {
        ContextEntry ce = it.next();
        if (!bcContextEntriesCopy.contains(ce)) {
          bcContextEntriesCopy.add(ce);
        }
      }
      for (Iterator<ContextEntry> it = bcContextEntriesCopy.iterator(); it.hasNext();) {
        ContextEntry ce = it.next();
        boolean foundIt = false;
        for (Iterator<ILoggingResourceable> it2 = inputCopy.iterator(); it2.hasNext();) {
          ILoggingResourceable resourceInfo = it2.next();
          if (resourceInfo.correspondsTo(ce)) {
            // perfecto
            result.add(resourceInfo);
            it2.remove();
            foundIt = true;
            break;
          }
        }
        if (!foundIt) {
          String oresourceableOres = "n/a (null)";
          if (ce !=null && ce.getOLATResourceable() !=null) {
              try {
                java.lang.reflect.Method getOlatResource = ce.getOLATResourceable().getClass().getDeclaredMethod("getOlatResource");
                if (getOlatResource!=null) {
                  oresourceableOres = String.valueOf(getOlatResource.invoke(ce.getOLATResourceable()));
                }
              } catch (SecurityException e) {
                log_.error("SecurityException while retrieving getOlatResource() Method from "+ce.getOLATResourceable().getClass());
              } catch (NoSuchMethodException e) {
                log_.info("(OK) ContextEntry's OLATResourceable had no further getOlatResource() method: "+ce.getOLATResourceable().getClass());
              } catch (IllegalArgumentException e) {
                log_.error("IllegalArgumentException while calling getOlatResource() Method from "+ce.getOLATResourceable().getClass(), e);
              } catch (IllegalAccessException e) {
                log_.error("IllegalAccessException while calling getOlatResource() Method from "+ce.getOLATResourceable().getClass(), e);
              } catch (InvocationTargetException e) {
                log_.error("IllegalAccessException while calling getOlatResource() Method from "+ce.getOLATResourceable().getClass(), e);
              }
          }
          log_.info("Could not find any LoggingResourceable corresponding to this ContextEntry: "+ce.toString()+", ce.getOLATResourceable()="+ce.getOLATResourceable()+", ce.getOLATResourceable().getOlatResource()="+oresourceableOres+", dump of resource infos:");
          for (Iterator<ILoggingResourceable> it2 = inputCopy.iterator(); it2.hasNext();) {
            ILoggingResourceable resourceInfo = it2.next();
            log_.info("id: "+resourceInfo.getId()+", name="+resourceInfo.getName()+", type="+resourceInfo.getType()+", toString: "+resourceInfo.toString());
          }
          log_.error("Could not find any LoggingResourceable corresponding to this ContextEntry: "+ce.toString(),
              new Exception("UserActivityLoggerImpl.getCombinedOrderedLoggingResourceables()"));
        }
      }
    }
   
View Full Code Here


    // strip beginning slash
    String startURI = ( (fileName.charAt(0) == '/')? fileName.substring(1) : fileName);

    // jump (e.g. from search) to the path if the business-launch-path says so.
    BusinessControl bc = getWindowControl().getBusinessControl();
    ContextEntry ce = bc.popLauncherContextEntry();
    if ( ce != null ) { // a context path is left for me
      Tracing.logDebug("businesscontrol (for further jumps) would be:"+bc, SinglePageController.class);
      OLATResourceable ores = ce.getOLATResourceable();
      Tracing.logDebug("OLATResourceable=" + ores, SinglePageController.class);
      String typeName = ores.getResourceableTypeName();
      // typeName format: 'path=/test1/test2/readme.txt'
      // First remove prefix 'path='
      String path = typeName.substring("path=".length());
View Full Code Here

    selTree = new SelectionTree("seltree", getTranslator());
    selTree.addListener(this);
    folderContainer.put("seltree", selTree);

    // jump to either the forum or the folder if the business-launch-path says so.
    ContextEntry ce = bc.popLauncherContextEntry();
    if ( ce != null ) { // a context path is left for me           
      if (log.isDebug()) log.debug("businesscontrol (for further jumps) would be:"+bc);
      OLATResourceable ores = ce.getOLATResourceable();     
      if (log.isDebug()) log.debug("OLATResourceable=" + ores);
      String typeName = ores.getResourceableTypeName();
      // typeName format: 'path=/test1/test2/readme.txt'
      // First remove prefix 'path='
      String path = typeName.substring("path=".length());
View Full Code Here

  public String getSupportedTypeName() {
    return SUPPORTED_TYPE_NAME;
  }
 
  public boolean checkAccess(ContextEntry contextEntry, BusinessControl businessControl, Identity identity, Roles roles)  {
    ContextEntry ce = businessControl.popLauncherContextEntry();
    OLATResourceable ores = ce.getOLATResourceable();
    if(log.isDebug()) log.debug("OLATResourceable=" + ores);
    if ( (ores != null) && (ores.getResourceableTypeName().startsWith("path=")) ) {
      // => it is a file element, typeName format: 'path=/test1/test2/readme.txt'
      return true;
    } else if ((ores != null) && ores.getResourceableTypeName().equals( OresHelper.calculateTypeName(Message.class) ) ) {
View Full Code Here

    // jump to either the forum or the folder if the business-launch-path says
    // so.
    boolean showAssessmentTool = false;
   
    BusinessControl bc = getWindowControl().getBusinessControl();
    ContextEntry ce = bc.popLauncherContextEntry();
    if (ce != null) {
      logDebug("businesscontrol (for further jumps) would be:" + bc, null);
      OLATResourceable ores = ce.getOLATResourceable();
      logDebug("OLATResourceable=" + ores, null);
      if (OresHelper.isOfType(ores, CourseNode.class)) {
        // TODO, don't use CourseNode.class, but a lookup using the ClassToId
        // class
        // jump to the coursenode with id
View Full Code Here

      listenTo(bookmarkController);
      contentP.pushContent(bookmarkController.getInitialComponent());
    } else if (cmd.equals(ACTION_CALENDAR)) { // popup calendar
      ControllerCreator ctrlCreator = new ControllerCreator() {
        public Controller createController(UserRequest lureq, WindowControl lwControl) {
          ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(courseRepositoryEntry);
          WindowControl llwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, lwControl);
          CourseCalendarController calendarController = new CourseCalendarController(lureq, llwControl, course);         
          // use a one-column main layout
          LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, llwControl, null, null, calendarController.getInitialComponent(), null);
          layoutCtr.setCustomCSS(CourseFactory.getCustomCourseCss(lureq.getUserSession(), uce.getCourseEnvironment()));
View Full Code Here

  /**
   *
   * @param olatResource
   */
  public void setBusinessControlFor(OLATResourceable olatResource) {
    ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(olatResource);
    myBusinessControl = BusinessControlFactory.getInstance().createBusinessControl(ce,parentBusinessControl);
  }
View Full Code Here

        ForumCallback forumCallback = new WikiForumCallback(ureq.getUserSession().getRoles().isGuestOnly(), isModerator);
       
        // calculate the new businesscontext for the coursenode being called.
        //FIXME:pb:mannheim discussion should not be "this.ores" -> may be the "forum" should go in here.
        //
        ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(forum);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
       
        discussionContent.put("articleforum", ForumUIFactory.getStandardForumController(ureq, bwControl, forum, forumCallback).getInitialComponent());
      }
    } else if (source == wikiEditForm) {
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) {
    //   TODO:chg: check with collabTools if forum is enabled
    ContextEntry ce = businessControl.popLauncherContextEntry();
    Long resourceableId = ce.getOLATResourceable().getResourceableId();
    Message message = ForumManager.getInstance().loadMessage(resourceableId);
    Message threadtop = message.getThreadtop();
    if(threadtop==null) {
      threadtop = message;
    }
View Full Code Here

   * @param roles
   * @return
   */
  public boolean checkAccess(BusinessControl businessControl, Identity identity, Roles roles) {
    if (log.isDebug()) log.debug("checkAccess for businessControl=" + businessControl + "  identity=" + identity + "  roles=" + roles);
    ContextEntry contextEntry = businessControl.popLauncherContextEntry();
    if (contextEntry != null) {
      // there is an other context-entry => go further
      OLATResourceable ores = contextEntry.getOLATResourceable();
      String type = ores.getResourceableTypeName();
      Indexer indexer = this.childIndexers.get(type);
      return indexer.checkAccess(contextEntry, businessControl, identity, roles);
    } else {
      // rearch the end context entry list
View Full Code Here

TOP

Related Classes of org.olat.core.id.context.ContextEntry

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.