Package com.anthonyeden.lib.config

Examples of com.anthonyeden.lib.config.MutableConfiguration


  public void exportGroups(BGContext context, File fExportFile) {
    if (context == null) return; // nothing to do... says Florian.
    Dom4jConfiguration root = new Dom4jConfiguration(EXPORT_KEY_ROOT);

    // export areas
    MutableConfiguration confAreas = root.addChild(EXPORT_KEY_AREA_COLLECTION);
    BGAreaManager am = BGAreaManagerImpl.getInstance();
    List areas = am.findBGAreasOfBGContext(context);
    for (Iterator iter = areas.iterator(); iter.hasNext();) {
      BGArea area = (BGArea) iter.next();
      MutableConfiguration newArea = confAreas.addChild(EXPORT_KEY_AREA);
      newArea.addAttribute(EXPORT_ATTR_NAME, area.getName());
      newArea.addChild(EXPORT_KEY_DESCRIPTION, area.getDescription());
    }

    // TODO fg: export group rights

    // export groups
    MutableConfiguration confGroups = root.addChild(EXPORT_KEY_GROUP_COLLECTION);
    BGContextManager cm = BGContextManagerImpl.getInstance();
    List groups = cm.getGroupsOfBGContext(context);
    for (Iterator iter = groups.iterator(); iter.hasNext();) {
      BusinessGroup group = (BusinessGroup) iter.next();
      exportGroup(fExportFile, confGroups, group);
View Full Code Here


    saveGroupConfiguration(fExportFile, root);
  }

  public void exportGroup(BusinessGroup group, File fExportFile) {
    Dom4jConfiguration root = new Dom4jConfiguration(EXPORT_KEY_ROOT);
    MutableConfiguration confGroups = root.addChild(EXPORT_KEY_GROUP_COLLECTION);
    exportGroup(fExportFile, confGroups, group);
    saveGroupConfiguration(fExportFile, root);
  }
View Full Code Here

    exportGroup(fExportFile, confGroups, group);
    saveGroupConfiguration(fExportFile, root);
  }

  private void exportGroup(File fExportFile, MutableConfiguration confGroups, BusinessGroup group) {
    MutableConfiguration newGroup = confGroups.addChild(EXPORT_KEY_GROUP);
    newGroup.addAttribute(EXPORT_ATTR_NAME, group.getName());
    if (group.getMinParticipants() != null) newGroup.addAttribute(EXPORT_ATTR_MIN_PARTICIPATS, group.getMinParticipants());
    if (group.getMaxParticipants() != null) newGroup.addAttribute(EXPORT_ATTR_MAX_PARTICIPATS, group.getMaxParticipants());     
    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);
      newGroupAreaRel.setValue(areaRelation.getName());
    }
    //export properties
    BusinessGroupPropertyManager bgPropertyManager = new BusinessGroupPropertyManager(group);
    boolean showOwners = bgPropertyManager.showOwners();
    boolean showParticipants = bgPropertyManager.showPartips();
View Full Code Here

TOP

Related Classes of com.anthonyeden.lib.config.MutableConfiguration

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.