Package org.projectforge.xml.stream

Examples of org.projectforge.xml.stream.XmlObjectReader


  public static LdapUserValues readLdapUserValues(final String ldapValuesAsXml)
  {
    if (StringUtils.isBlank(ldapValuesAsXml) == true) {
      return null;
    }
    final XmlObjectReader reader = new XmlObjectReader();
    reader.initialize(LdapUserValues.class);
    final LdapUserValues values = (LdapUserValues) reader.read(ldapValuesAsXml);
    return values;
  }
View Full Code Here


   * Exports the LDAP values such as posix account properties of the given ldapUser as xml string.
   * @param ldapUser
   */
  public static String getLdapValuesAsXml(final LdapUserValues values)
  {
    final XmlObjectReader reader = new XmlObjectReader();
    reader.initialize(LdapUserValues.class);
    final String xml = XmlObjectWriter.writeAsXml(values);
    return xml;
  }
View Full Code Here

    final File configFile = new File(CONFIG_FILE);
    if (configFile.canRead() == false) {
      return null;
    }
    log.info("Reading LDAP configuration file for test cases: " + configFile.getPath());
    final XmlObjectReader reader = new XmlObjectReader();
    final AliasMap aliasMap = new AliasMap();
    aliasMap.put(LdapConfig.class, "ldapConfig");
    reader.setAliasMap(aliasMap);
    AccountingConfig.registerXmlObjects(reader, aliasMap);
    String xml = null;
    try {
      xml = FileUtils.readFileToString(configFile, "UTF-8");
    } catch (final IOException ex) {
      log.error(ex.getMessage(), ex);
      throw new IllegalArgumentException("Cannot read config file '" + CONFIG_FILE + "' properly : " + ex.getMessage(), ex);
    }
    if (xml == null) {
      throw new IllegalArgumentException("Cannot read from config file: '" + CONFIG_FILE + "'.");
    }
    try {
      final LdapConfig cfg = (LdapConfig) reader.read(xml);
      final String warnings = reader.getWarnings();
      if (StringUtils.isNotBlank(warnings) == true) {
        log.error(warnings);
      }
      return cfg;
    } catch (final Throwable ex) {
View Full Code Here

  static BusinessAssessmentConfig getBusinessAssessmentConfig()
  {
    final AliasMap aliasMap = new AliasMap();
    aliasMap.put(BusinessAssessmentRowConfig.class, "row");
    final XmlObjectReader reader = new XmlObjectReader();
    reader.setAliasMap(aliasMap);
    reader.initialize(BusinessAssessmentConfig.class);
    final BusinessAssessmentConfig bwa = (BusinessAssessmentConfig) reader.read(xml);
    return bwa;
  }
View Full Code Here

      + "</menu-entry>\n");

  @Test
  public void testTranslations()
  {
    final XmlObjectReader reader = new XmlObjectReader();
    reader.initialize(MenuEntryConfig.class);
    final MenuEntryConfig root = (MenuEntryConfig) reader.read(xml);
    MenuEntryConfig menu0 = root.getChildren().get(0);
    assertFalse(menu0.isVisible());
    assertEquals(MenuItemDefId.IMAGE_CROPPER.getId(), menu0.getMenuItemId());
    MenuEntryConfig menu1 = root.getChildren().get(1);
    assertTrue(menu1.isVisible());
View Full Code Here

TOP

Related Classes of org.projectforge.xml.stream.XmlObjectReader

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.