Package org.olat.core.id

Examples of org.olat.core.id.OLATResourceable


   */
  public boolean correspondsTo(ContextEntry ce) {
    if (ce==null) {
      return false;
    }
    OLATResourceable ceResourceable = ce.getOLATResourceable();
    if (ceResourceable==null) {
      return false;
    }
    if (resourceable_!=null) {
      if (ceResourceable.getResourceableTypeName().equals(resourceable_.getResourceableTypeName()) &&
          ceResourceable.getResourceableId().equals(resourceable_.getResourceableId())) {
        return true;
      }
      if (ceResourceable.equals(resourceable_)) {
        return true;
      }
      try{
        // last chance to get a 'true' as the result
       
        //@TODO
        //@TODO-OLAT-4924
        //PREFACE: Notice that this code actually corresponds nicely to the olat3 version of this class!
        //
        // This 'hack' is necessary due to the fact that the GlossaryMainController is in the olatcore and has no
        // access to olat3 code. Hence it has no access to RepositoryEntry or OLATResource etc which makes
        // clean comparison here impossible.
        // What happens here is: the GlossaryMainController is created with an OLATResourceImpl (from olat3)
        // then passes this to the ThreadLocalUserActivityLogger via CoreLoggingResourceable.wrap().
        // Then, when logging the 'LEARNING_RESOURCE_OPEN' action, the UserActivityLoggerImpl fetches the
        // businesspath to go through that list and compares it with what it got in its resourceable list.
        // Now, the businesspath contains a RepositoryEntry which *contains* an OLATResourceImpl representing the
        // glossary.
        // The resourceable list though, contains what was just added before, namely the OLATResourceImpl directly.
        // The RepositoryEntry's OLATResourceImpl is in fact the same (==) as the one in the resourceable list.
        // BUT: We can't find this out easily, i.e. we want to return true in this case but we can't do this
        //      since we are in the core here. So the 'hack' here is to get the 'getOlatResource' method
        //      via reflection (autsch!) - knowing that the ceResourceable here is actually the RepositoryEntry.
        //      that OlatResourceable (can't cast it to OLATResource since that is in the olat3 again..... :( )
        //      and then go compare the two and voila, find out that they are the same and return true.
        java.lang.reflect.Method getOlatResource = ceResourceable.getClass().getDeclaredMethod("getOlatResource");
        if (getOlatResource!=null) {
          Object ceOlatResourceObj = getOlatResource.invoke(ceResourceable);
          if (ceOlatResourceObj!=null && ceOlatResourceObj instanceof OLATResourceable) {
            OLATResourceable ceOlatResource = (OLATResourceable)ceOlatResourceObj;
            if (ceOlatResource.getResourceableTypeName().equals(resourceable_.getResourceableTypeName()) &&
                ceOlatResource.getResourceableId().equals(resourceable_.getResourceableId())) {
              return true;
            }
            if (ceOlatResource.equals(resourceable_)) {
              return true;
            }
          }
        }
      } catch(Exception e) {
View Full Code Here


    eventBus.registerFor(this, null, ORES_THIS);
  }
 
 
  public CacheWrapper getOrCreateCache(Class ownerClass, String name) {
    OLATResourceable ores = OresHelper.createOLATResourceableInstanceWithoutCheck(CacheConfig.getCacheName(ownerClass, name), new Long(0));
    return rootCacheWrapperImpl.getOrCreateChildCacheWrapper(ores);
  }
View Full Code Here

    }
    rootCacheWrapperImpl = new CacheWrapperImpl(this.getClass().getName(), rootConfig)
  }
 
  public CacheWrapper getOrCreateCache(Class ownerClass, String name) {
    OLATResourceable ores = OresHelper.createOLATResourceableInstanceWithoutCheck(CacheConfig.getCacheName(ownerClass, name), new Long(0));
    return rootCacheWrapperImpl.getOrCreateChildCacheWrapper(ores);
  }
View Full Code Here

    WindowControl wc = new StackedBusinessWindowControl(origWControl, bc);
    return wc;
  }
 
  public WindowControl createBusinessWindowControl(final String type, final Long id, WindowControl origWControl) {
    final OLATResourceable ores = new OLATResourceable(){
      public String getResourceableTypeName() {
        return type;
      }

      public Long getResourceableId() {
View Full Code Here

   
    Matcher m = PAT_CE.matcher(businessControlString);
    while (m.find()) {
      String ces = m.group(1);
      int pos = ces.indexOf(':');
      OLATResourceable ores;
      // FIXME:chg: 'path=' define only once, same path in SearchResourceContext
      if ( (ces.startsWith("path="))||(pos == -1) ) {
        ces = ces.replace("|", "/");
        ores = OresHelper.createOLATResourceableTypeWithoutCheck(ces);
      } else {
View Full Code Here

 
  /**
   * @return Returns the olatResourceable.
   */
  public OLATResourceable getOLATResourceable() {
    return new OLATResourceable() {
      @Override
      public Long getResourceableId() {
        return identity.getKey();
      }

View Full Code Here

 
  private String serviceName;
 
  public SingleService( String serviceName) {
    this.serviceName = serviceName;
    final OLATResourceable ores = OresHelper.createOLATResourceableType(SingleService.class.getCanonicalName());
    EventBus eventBus = CoordinatorManager.getCoordinator().getEventBus();
    // first fire event, second register as listener because we want not to receive our 'Started event'
    eventBus.fireEventToListenersOf(new ServiceStartedEvent(serviceName), ores );
    log.debug("fireEventToListenersOf serviceName=" + serviceName + "  ores=" + ores.getResourceableTypeName() + ":" + ores.getResourceableId());
    eventBus.registerFor(this, null, ores);
  }
View Full Code Here

  protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    Locale loc = I18nManager.getInstance().getLocaleOrDefault(getSelectedLanguage());
    MultiUserEvent mue = new LanguageChangedEvent(loc, ureq);
    ureq.getUserSession().setLocale(loc);
    ureq.getUserSession().putEntry("negotiated-locale", loc);
    OLATResourceable wrappedLocale = OresHelper.createOLATResourceableType(Locale.class);
    ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(mue, wrappedLocale);
    // Update in velocity for flag
    this.flc.contextPut("languageCode", loc.toString());
  }
View Full Code Here

      || contextHelpPageVC == null ) return;
   
    CommentAndRatingService commentAndRatingService = (CommentAndRatingService) ServiceFactory.getServiceOrNull(CommentAndRatingService.class);
    if (commentAndRatingService != null) {       
      Roles roles = ureq.getUserSession().getRoles();
      OLATResourceable helpOres = OresHelper.createOLATResourceableType("contexthelp");
      String key = ContextHelpManager.getInstance().calculateCombinedKey(pageTranslator.getLocale(), bundleName, page);
      commentAndRatingService.init(getIdentity(), helpOres, key, roles.isOLATAdmin(), roles.isGuestOnly());
      UserCommentsAndRatingsController commentsAndRatingCtr = commentAndRatingService.createUserCommentsAndRatingControllerExpandable(ureq, getWindowControl());
      listenTo(commentsAndRatingCtr);
      contextHelpWrapperVC.put("commentsAndRatingCtr", commentsAndRatingCtr.getInitialComponent());   
View Full Code Here

    // 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());
      if  (path.length() > 0) {
        Tracing.logDebug("direct navigation to container-path=" + path, SinglePageController.class);
View Full Code Here

TOP

Related Classes of org.olat.core.id.OLATResourceable

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.