Examples of NarrowedPropertyManager


Examples of org.olat.properties.NarrowedPropertyManager

  public void doIndex(SearchResourceContext parentResourceContext, Object businessObj, OlatFullIndexer indexWriter) throws IOException,InterruptedException {
    if (!(businessObj instanceof BusinessGroup) )
      throw new AssertException("businessObj must be BusinessGroup");
    BusinessGroup businessGroup = (BusinessGroup)businessObj;
   
    NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(businessGroup);
    ForumManager fom = ForumManager.getInstance();

    Property forumKeyProperty = npm.findProperty(null, null, CollaborationTools.PROP_CAT_BG_COLLABTOOLS, CollaborationTools.KEY_FORUM);
    // Check if forum-property exist
    if (forumKeyProperty != null) {
      Long forumKey = forumKeyProperty.getLongValue();
      Forum forum = fom.loadForum(forumKey);
      SearchResourceContext forumSearchResourceContext = new SearchResourceContext(parentResourceContext);
View Full Code Here

Examples of org.olat.properties.NarrowedPropertyManager

  private static String createIcalAuthToken(OLATResourceable resourceable, Identity identity) {
    // generate the random alpha numeric token
    String token = RandomStringUtils.randomAlphanumeric(6);
   
    // save token as a property of resourceable
    NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(resourceable);
    Property tokenProperty = npm.createPropertyInstance(identity, null,
        PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN, null, null, token, null );
    npm.saveProperty(tokenProperty);
   
    //return the token generated
    return token;
  }
View Full Code Here

Examples of org.olat.properties.NarrowedPropertyManager

    return token;
  }
 
  private static String getIcalAuthToken(OLATResourceable resourceable, Identity identity, boolean create) {
    // find the property for the resourceable
    NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(resourceable);
    Property tokenProperty = npm.findProperty(identity, null,
        PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN);
   
    String token; 
    if (tokenProperty == null && create) {
      token = createIcalAuthToken(resourceable, identity);
View Full Code Here

Examples of org.olat.properties.NarrowedPropertyManager

    return token;
  }
 
  private static String regenerateIcalAuthToken(OLATResourceable resourceable, Identity identity) {
    // find the property for the resourceable
    NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(resourceable);
    Property tokenProperty = npm.findProperty(identity, null,
        PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN);
   
    //genearate the new token
    String authToken = RandomStringUtils.randomAlphanumeric(6);
   
    //set new auth token as the string value of the property
    tokenProperty.setStringValue(authToken);
   
    // update the property
    npm.updateProperty(tokenProperty);
   
    //return the new token
    return authToken;
  }
View Full Code Here

Examples of org.olat.properties.NarrowedPropertyManager

 
  public static void destroyIcalAuthToken(String calendarType, String calendarID, Identity identity) {
    if (!calendarType.equals(ICalFileCalendarManager.TYPE_USER)) {
      // find the property for the resourceable
      OLATResourceable resourceable = getResourceable(calendarType, calendarID);
      NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(resourceable);
      Property tokenProperty = npm.findProperty(identity, null,
          PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN);
      if (tokenProperty != null) {
        npm.deleteProperty(tokenProperty);
      }
    } else {
      PropertyManager pm = PropertyManager.getInstance();
      Property tokenProperty = pm.findProperty(identity, null, null,
          PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN);
View Full Code Here

Examples of org.olat.properties.NarrowedPropertyManager

  public static boolean existIcalFeedLink(String calendarType, String calendarID, Identity identity) {
    Property tokenProperty = null;
    if (!calendarType.equals(ICalFileCalendarManager.TYPE_USER)) {
      // find the property for the resourceable
      OLATResourceable resourceable = getResourceable(calendarType, calendarID);
      NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(resourceable);
      tokenProperty = npm.findProperty(identity, null, PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN);
    } else {
      PropertyManager pm = PropertyManager.getInstance();
      tokenProperty = pm.findProperty(identity, null, null, PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN);
    }
    return tokenProperty != null;
View Full Code Here

Examples of org.olat.properties.NarrowedPropertyManager

      final SubscriptionContext subsContext) {
    Codepoint.codepoint(CollaborationTools.class, "createForumController-init");
    final boolean isAdm = isAdmin;
    final boolean isGuest = isGuestOnly;
    final ForumManager fom = ForumManager.getInstance();
    final NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
   
    // TODO: is there a nicer solution without setting an instance variable
    //final List<Forum> forumHolder = new ArrayList<Forum>();
   
    Codepoint.codepoint(CollaborationTools.class, "pre_sync_enter");

    Forum forum = CoordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerCallback<Forum>(){
      public Forum execute() {
       
        Codepoint.codepoint(CollaborationTools.class, "sync_enter");
       
        //was: synchronized (CollaborationTools.class) {
        Forum aforum;
        Long forumKey;
        Property forumKeyProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
        if (forumKeyProperty == null) {
          // First call of forum, create new forum and save
          aforum = fom.addAForum();
          forumKey = aforum.getKey();
          if (log.isDebug()) {
            log.debug("created new forum in collab tools: foid::" + forumKey.longValue() + " for ores::"
                + ores.getResourceableTypeName() + "/" + ores.getResourceableId());
          }
          forumKeyProperty = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM, null, forumKey, null, null);
          npm.saveProperty(forumKeyProperty);
        } else {
          // Forum does already exist, load forum with key from properties
          forumKey = forumKeyProperty.getLongValue();
          aforum = fom.loadForum(forumKey);
          if (aforum == null) { throw new AssertException("Unable to load forum with key " + forumKey.longValue() + " for ores "
View Full Code Here

Examples of org.olat.properties.NarrowedPropertyManager

  /**
   * delete all CollaborationTools stuff from the database, which is related to
   * the calling OLATResourceable.
   */
  public void deleteTools(BusinessGroup businessGroupTodelete) {
    NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
    /*
     * delete the forum, if existing
     */
    ForumManager fom = ForumManager.getInstance();
    Property forumKeyProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
    if (forumKeyProperty != null) {
      // if there was a forum, delete it
      Long forumKey = forumKeyProperty.getLongValue();
      if (forumKey == null) throw new AssertException("property had no longValue, prop:" + forumKeyProperty);
      fom.deleteForum(forumKey);
    }
    /*
     * delete the folder, if existing
     */
    OlatRootFolderImpl vfsContainer = new OlatRootFolderImpl(getFolderRelPath(), null);
    File fFolderRoot = vfsContainer.getBasefile();
    if (fFolderRoot.exists()) {
      FileUtils.deleteDirsAndFiles(fFolderRoot, true, true);
    }
   
    /*
     * delete the wiki if existing
     */
    VFSContainer rootContainer = WikiManager.getInstance().getWikiRootContainer(ores);
    if(rootContainer != null) rootContainer.delete();
   
    /*
     * Delete calendar if exists
     */
    if (businessGroupTodelete != null) {
      CalendarManager calManager = CalendarManagerFactory.getInstance().getCalendarManager();
      calManager.deleteGroupCalendar(businessGroupTodelete);
    }
   
    /*
     * delete chatRoom
     */
    // no cleanup needed, automatically done when last user exits the room
    /*
     * delete all Properties defining enabled/disabled CollabTool XY and the
     * news content
     */
    npm.deleteProperties(null, null, PROP_CAT_BG_COLLABTOOLS, null);

    /*
     * and last but not least the cache is reseted
     */
    cacheToolStates.clear();
 
View Full Code Here

Examples of org.olat.properties.NarrowedPropertyManager

  /**
   * @return the news; if there is no news yet: return null;
   */
  public String lookupNews() {
    NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
    Property property = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_NEWS);
    if (property == null) { // no entry
      return null;
    }
    // read the text value of the existing property
    String text = property.getTextValue();
View Full Code Here

Examples of org.olat.properties.NarrowedPropertyManager

  /**
   * @param news
   */
  public void saveNews(String news) {
    NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
    Property property = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_NEWS);
    if (property == null) { // create a new one
      Property nP = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_NEWS, null, null, null, news);
      npm.saveProperty(nP);
    } else { // modify the existing one
      property.setTextValue(news);
      npm.updateProperty(property);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.