Package org.olat.collaboration

Examples of org.olat.collaboration.CollaborationTools


    if (group.getWaitingListEnabled() != null) newGroup.addAttribute(EXPORT_ATTR_WAITING_LIST, group.getWaitingListEnabled());
    if (group.getAutoCloseRanksEnabled() != null) newGroup.addAttribute(EXPORT_ATTR_AUTO_CLOSE_RANKS, group.getAutoCloseRanksEnabled());
    newGroup.addChild(EXPORT_KEY_DESCRIPTION, group.getDescription());
    // collab tools
    MutableConfiguration toolsConfig = newGroup.addChild(EXPORT_KEY_COLLABTOOLS);
    CollaborationTools ct = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(group);
    for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
      toolsConfig.addAttribute(CollaborationTools.TOOLS[i], ct.isToolEnabled(CollaborationTools.TOOLS[i]) ? "true" : "false");
    }
    Long calendarAccess = ct.lookupCalendarAccess();
    if (calendarAccess != null) {
      newGroup.addAttribute(EXPORT_KEY_CALENDAR_ACCESS,calendarAccess);     
    }
    String info = ct.lookupNews();
    if(info!=null && !info.trim().equals("")) {
      newGroup.addAttribute(EXPORT_KEY_NEWS,info.trim());     
    }   
   
    Tracing.logDebug("fExportFile.getParent()=" + fExportFile.getParent(), this.getClass());
    ct.archive(fExportFile.getParent());
    // export membership
    List bgAreas = BGAreaManagerImpl.getInstance().findBGAreasOfBusinessGroup(group);
    for (Iterator iterator = bgAreas.iterator(); iterator.hasNext();) {
      BGArea areaRelation = (BGArea) iterator.next();
      MutableConfiguration newGroupAreaRel = newGroup.addChild(EXPORT_KEY_AREA_RELATION);
View Full Code Here


        BusinessGroup newGroup = gm.createAndPersistBusinessGroup(context.getGroupType(), null, groupName, groupDesc, groupMinParticipants,
            groupMaxParticipants, waitingList, enableAutoCloseRanks, context);

        // get tools config
        Configuration toolsConfig = group.getChild(EXPORT_KEY_COLLABTOOLS);
        CollaborationTools ct = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(newGroup);
        for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
          String sTool = toolsConfig.getAttribute(CollaborationTools.TOOLS[i]);
          if (sTool != null) ct.setToolEnabled(CollaborationTools.TOOLS[i], sTool.equals("true") ? true : false);
        }
        if(group.getAttribute(EXPORT_KEY_CALENDAR_ACCESS)!=null) {
          Long calendarAccess = Long.valueOf(group.getAttribute(EXPORT_KEY_CALENDAR_ACCESS));
          ct.saveCalendarAccess(calendarAccess);         
        }
        if(group.getAttribute(EXPORT_KEY_NEWS)!=null) {
          String info = group.getAttribute(EXPORT_KEY_NEWS);
          ct.saveNews(info);        
        }

        // get memberships
        List memberships = group.getChildren(EXPORT_KEY_AREA_RELATION);
        for (Iterator iterator = memberships.iterator(); iterator.hasNext();) {
View Full Code Here

    List<Long> addedGroupKeys = new ArrayList<Long>();
    List<String> addedGroupNames = new ArrayList<String>();
    for (BusinessGroup group : groups) {
      if (addedGroupKeys.contains(group.getKey())) continue; // check for duplicate groups
      CollaborationTools tools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(group);
      if (tools.isToolEnabled(CollaborationTools.TOOL_FOLDER)) {
        String name = group.getName();
        if (addedGroupNames.contains(name)) {
          // attach a serial to the group name to avoid duplicate mount points...
          int serial = 1;
          int serialMax = 100;
          while (addedGroupNames.contains(name + serial) && serial < serialMax) {
            serial++;
          }
          if (serial == serialMax) continue; // continue without adding mount point
          name = name + serial;
        }
       
        // create container and set quota
        OlatRootFolderImpl localImpl = new OlatRootFolderImpl(tools.getFolderRelPath(), cfRoot);
        localImpl.getBasefile().mkdirs(); // lazy initialize dirs
        NamedContainerImpl grpContainer = new NamedContainerImpl(Formatter.makeStringFilesystemSave(name), localImpl);
        Quota q = qm.getCustomQuota(tools.getFolderRelPath());
        if (q == null) {
          Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS);
          q = QuotaManager.getInstance().createQuota(tools.getFolderRelPath(), defQuota.getQuotaKB(), defQuota.getUlLimitKB());
        }
        FullAccessWithQuotaCallback secCallback = new FullAccessWithQuotaCallback(q);
        grpContainer.setLocalSecurityCallback(secCallback);
       
        // add container
View Full Code Here

  private void addCalendars(UserRequest ureq, List groups, boolean isOwner, LinkProvider linkProvider, List calendars) {
    CollaborationToolsFactory collabFactory = CollaborationToolsFactory.getInstance();
    CalendarManager calendarManager = CalendarManagerFactory.getInstance().getCalendarManager();
    for (Iterator iter = groups.iterator(); iter.hasNext();) {
      BusinessGroup bGroup = (BusinessGroup) iter.next();
      CollaborationTools collabTools = collabFactory.getOrCreateCollaborationTools(bGroup);
      if (!collabTools.isToolEnabled(CollaborationTools.TOOL_CALENDAR)) continue;
      KalendarRenderWrapper groupCalendarWrapper = calendarManager.getGroupCalendar(bGroup);
      // set calendar access
      int iCalAccess = CollaborationTools.CALENDAR_ACCESS_OWNERS;
      Long lCalAccess = collabTools.lookupCalendarAccess();
      if (lCalAccess != null) iCalAccess = lCalAccess.intValue();
      if (iCalAccess == CollaborationTools.CALENDAR_ACCESS_OWNERS && !isOwner) {
        groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
      } else {
        groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
View Full Code Here

  private static void addCalendars(UserRequest ureq, List<BusinessGroup> groups, boolean isOwner, List<KalendarRenderWrapper> calendars) {
    CollaborationToolsFactory collabFactory = CollaborationToolsFactory.getInstance();
    CalendarManager calendarManager = CalendarManagerFactory.getInstance().getCalendarManager();
    for (Iterator<BusinessGroup> iter = groups.iterator(); iter.hasNext();) {
      BusinessGroup bGroup = iter.next();
      CollaborationTools collabTools = collabFactory.getOrCreateCollaborationTools(bGroup);
      if (!collabTools.isToolEnabled(CollaborationTools.TOOL_CALENDAR)) continue;
      KalendarRenderWrapper groupCalendarWrapper = calendarManager.getGroupCalendar(bGroup);
      // set calendar access
      int iCalAccess = CollaborationTools.CALENDAR_ACCESS_OWNERS;
      Long lCalAccess = collabTools.lookupCalendarAccess();
      if (lCalAccess != null) iCalAccess = lCalAccess.intValue();
      if (iCalAccess == CollaborationTools.CALENDAR_ACCESS_OWNERS && !isOwner) {
        groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
      } else {
        groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
View Full Code Here

     */
    BusinessGroupManager myManager = BusinessGroupManagerImpl.getInstance();

    sqlRes = myManager.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id2, null);
    found = (BusinessGroup) sqlRes.get(0);
    CollaborationTools myCTSMngr = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(found);
    for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
      String msg = "Tool " + CollaborationTools.TOOLS[i] + " is enabled";
      boolean enabled = myCTSMngr.isToolEnabled(CollaborationTools.TOOLS[i]);
      // all tools are disabled by default exept the news tool
      assertTrue(msg, !enabled);

    }
    //
    for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
      myCTSMngr.setToolEnabled(CollaborationTools.TOOLS[i], true);
    }
    //
    for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
      String msg = "Tool " + CollaborationTools.TOOLS[i] + " is enabled";
      boolean enabled = myCTSMngr.isToolEnabled(CollaborationTools.TOOLS[i]);
      assertTrue(msg, enabled);

    }
    //
    for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
      myCTSMngr.setToolEnabled(CollaborationTools.TOOLS[i], false);
    }
    //
    for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
      String msg = "Tool " + CollaborationTools.TOOLS[i] + " is disabled";
      boolean enabled = myCTSMngr.isToolEnabled(CollaborationTools.TOOLS[i]);
      assertTrue(msg, !enabled);

    }
    /*
     *
 
View Full Code Here

     */
    BusinessGroupManager myManager = BusinessGroupManagerImpl.getInstance();
    sqlRes = myManager.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id2, null);
    assertTrue("1 BuddyGroup owned by id2", sqlRes.size() == 1);
    found = (BusinessGroup) sqlRes.get(0);
    CollaborationTools myCTSMngr = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(found);
    //
    for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
      myCTSMngr.setToolEnabled(CollaborationTools.TOOLS[i], true);
    }
    /*
     *
     */
    myManager.deleteBusinessGroup(found);
 
View Full Code Here

TOP

Related Classes of org.olat.collaboration.CollaborationTools

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.