Package com.anthonyeden.lib.config

Examples of com.anthonyeden.lib.config.Dom4jConfiguration


   * @see org.olat.group.BusinessGroupManager#exportGroups(org.olat.group.context.BGContext,
   *      java.io.File)
   */
  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

   * Export metadata of a repository entry to a file.
   * Only one repository entry's metadata may be exported into a directory. The
   * file name of the properties file will be the same for all repository entries!
   */
  public void exportDoExportProperties() {
    Dom4jConfiguration root = new Dom4jConfiguration(PROP_ROOT);
   
    root.addChild(PROP_SOFTKEY, re.getSoftkey());
    root.addChild(PROP_RESOURCENAME, re.getResourcename());
    root.addChild(PROP_DISPLAYNAME, re.getDisplayname());
    root.addChild(PROP_DECRIPTION, re.getDescription());
    root.addChild(PROP_INITIALAUTHOR, re.getInitialAuthor());

    // save repository entry properties
    FileOutputStream fOut = null;
    try {
      fOut = new FileOutputStream(new File(baseDirectory, PROPERTIES_FILE));
      root.save(fOut);
    } catch (IOException ioe) {
      throw new OLATRuntimeException("Error writing repo properties.", ioe);
    } catch (ConfigurationException cfe) {
      throw new OLATRuntimeException("Error writing repo properties.", cfe);
    } finally {
View Full Code Here

TOP

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

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.