Java Code Examples for org.dom4j.Node#valueOf()

The following examples show how to use org.dom4j.Node#valueOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImportServiceImpl.java    From studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * create files from a list
 *
 * @param site
 * @param importedPaths
 * @param importedFullPaths
 * @param nodes
 * @param fileRoot
 * @param targetRoot
 *            the target location root
 * @param parentPath
 *            the target location to import to
 * @param overWrite
 * @param user
 */
protected void createFiles(String site, Set<String> importedPaths, List<String> importedFullPaths,
                           List<Node> nodes, String fileRoot, String targetRoot, String parentPath,
                           boolean overWrite, String user) {
    logger.info("[IMPORT] createFiles: fileRoot [" + fileRoot + "] parentFullPath [" + parentPath
                + "] overwrite[" + overWrite + "]");
    if (nodes != null) {
        for (Node node : nodes) {
            String name = node.valueOf("@name");
            String value = node.valueOf("@over-write");
            boolean fileOverwrite = (StringUtils.isEmpty(value)) ? overWrite : ContentFormatUtils
                    .getBooleanValue(value);
            if (!StringUtils.isEmpty(name)) {
                writeContentInTransaction(site, importedPaths, importedFullPaths, fileRoot, targetRoot,
                        parentPath, name, fileOverwrite, user);
            }
        }
    }
}
 
Example 2
Source File: SecurityServiceImpl.java    From studio with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
protected void loadPermissions(String siteId, Element root, PermissionsConfigTO config) {
    if (root.getName().equals(StudioXmlConstants.DOCUMENT_PERMISSIONS)) {
        Map<String, Map<String, List<Node>>> permissionsMap = new HashMap<String, Map<String, List<Node>>>();

        //backwards compatibility for nested <site>
        Element permissionsRoot = root;
        Element siteNode = (Element) permissionsRoot.selectSingleNode(StudioXmlConstants.DOCUMENT_ELM_SITE);
        if(siteNode != null) {
            permissionsRoot = siteNode;
        }

        List<Node> roleNodes = permissionsRoot.selectNodes(StudioXmlConstants.DOCUMENT_ELM_PERMISSION_ROLE);
        Map<String, List<Node>> rules = new HashMap<String, List<Node>>();
        for (Node roleNode : roleNodes) {
            String roleName = roleNode.valueOf(StudioXmlConstants.DOCUMENT_ATTR_PERMISSIONS_NAME);
            List<Node> ruleNodes = roleNode.selectNodes(StudioXmlConstants.DOCUMENT_ELM_PERMISSION_RULE);
            rules.put(roleName, ruleNodes);
        }
        permissionsMap.put(siteId, rules);

        config.setPermissions(permissionsMap);
    }
}
 
Example 3
Source File: CalculatedFieldsDAOFileImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
private ModelCalculatedField.Slot.MappedValuesRangeDescriptor loadRangeDescriptor(Node mappedValuesNode) {
	ModelCalculatedField.Slot.MappedValuesRangeDescriptor rangeDescriptor = null;

	Node fomrNode = mappedValuesNode.selectSingleNode(FROM_TAG);
	String fromValue = fomrNode.valueOf("@value");
	Node toNode = mappedValuesNode.selectSingleNode(TO_TAG);
	String toValue = toNode.valueOf("@value");
	rangeDescriptor = new ModelCalculatedField.Slot.MappedValuesRangeDescriptor(fromValue, toValue);
	String includeValue = null;
	includeValue = fomrNode.valueOf("@include");
	if (includeValue != null && (includeValue.equalsIgnoreCase("TRUE") || includeValue.equalsIgnoreCase("FALSE"))) {
		rangeDescriptor.setIncludeMinValue(Boolean.parseBoolean(includeValue));
	}
	includeValue = toNode.valueOf("@include");
	if (includeValue != null && (includeValue.equalsIgnoreCase("TRUE") || includeValue.equalsIgnoreCase("FALSE"))) {
		rangeDescriptor.setIncludeMaxValue(Boolean.parseBoolean(includeValue));
	}

	return rangeDescriptor;
}
 
Example 4
Source File: LilithDataStore.java    From CardFantasy with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static LilithDataStore loadDefault() {
    LilithDataStore store = new LilithDataStore();

    URL url = LilithDataStore.class.getClassLoader().getResource("cfvbaibai/cardfantasy/game/LilithData.xml");
    SAXReader reader = new SAXReader();
    try {
        Document doc = reader.read(url);
        @SuppressWarnings("unchecked")
        List<Node> lilithNodes = doc.selectNodes("/Liliths/Lilith");
        for (Node lilithNode : lilithNodes) {
            int adjAT = Integer.parseInt(lilithNode.valueOf("@adjAT"));
            int adjHP = Integer.parseInt(lilithNode.valueOf("@adjHP"));
            String id = lilithNode.valueOf("@id");
            String deckDescs = lilithNode.getText();
            LilithStartupInfo lsi = new LilithStartupInfo(id, deckDescs, adjAT, adjHP);
            store.add(lsi);
        }
        return store;
    } catch (DocumentException e) {
        throw new CardFantasyRuntimeException("Cannot load card info XML.", e);
    }
}
 
Example 5
Source File: TestSummaryCreatorTask.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the value of the specified attribute of the node determined by the given xpath.
 * 
 * @param doc      The XML document
 * @param xpath    The xpath selecting the node whose attribute we want
 * @param attrName The name of the attribute
 * @return The attribute value
 */
private String getAttrValue(Document doc, String xpath, String attrName)
{
	Node node = doc.selectSingleNode(xpath);

	if (node instanceof Attribute)
	{
		// we ignore the attribute name then
		return ((Attribute)node).getValue();
	}
	else if (node != null)
	{
		return node.valueOf("@" + attrName);
	}
    else
    {
        return null;
    }
}
 
Example 6
Source File: ConfigurationServiceImpl.java    From studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Map<String, List<String>> geRoleMappings(String siteId) throws ConfigurationException {
    // TODO: Refactor this to use Apache's Commons Configuration
    Map<String, List<String>> roleMappings = new HashMap<>();
    String roleMappingsConfigPath = getSiteRoleMappingsConfigPath(siteId);
    Document document;

    try {
        document = contentService.getContentAsDocument(siteId, roleMappingsConfigPath);
        if (document != null) {
            Element root = document.getRootElement();
            if (root.getName().equals(DOCUMENT_ROLE_MAPPINGS)) {
                List<Node> groupNodes = root.selectNodes(DOCUMENT_ELM_GROUPS_NODE);
                for (Node node : groupNodes) {
                    String name = node.valueOf(DOCUMENT_ATTR_PERMISSIONS_NAME);
                    if (StringUtils.isNotEmpty(name)) {
                        List<Node> roleNodes = node.selectNodes(DOCUMENT_ELM_PERMISSION_ROLE);
                        List<String> roles = new ArrayList<>();

                        for (Node roleNode : roleNodes) {
                            roles.add(roleNode.getText());
                        }

                        roleMappings.put(name, roles);
                    }
                }
            }
        }
    } catch (DocumentException e) {
        throw new ConfigurationException("Error while reading role mappings file for site " + siteId + " @ " +
                                         roleMappingsConfigPath);
    }

    return roleMappings;
}
 
Example 7
Source File: SecurityServiceImpl.java    From studio with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected Map<String, List<String>> getRoles(List<Node> nodes, Map<String, List<String>> rolesMap) {
    for (Node node : nodes) {
        String name = node.valueOf(StudioXmlConstants.DOCUMENT_ATTR_PERMISSIONS_NAME);
        if (!StringUtils.isEmpty(name)) {
            List<Node> roleNodes = node.selectNodes(StudioXmlConstants.DOCUMENT_ELM_PERMISSION_ROLE);
            List<String> roles = new ArrayList<String>();
            for (Node roleNode : roleNodes) {
                roles.add(roleNode.getText());
            }
            rolesMap.put(name, roles);
        }
    }
    return rolesMap;
}
 
Example 8
Source File: MapStages.java    From CardFantasy with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public MapStages() {
    this.mapStages = new HashMap<String, MapInfo>();
    URL url = CardDataStore.class.getClassLoader().getResource("cfvbaibai/cardfantasy/data/MapStages.xml");
    SAXReader reader = new SAXReader();
    String currentId = "";
    try {
        Document doc = reader.read(url);
        List<Node> mapNodes = doc.selectNodes("/Maps/Map");
        for (Node mapNode : mapNodes) {
            String id = mapNode.valueOf("@id");
            currentId = id;
            int heroHP = Integer.parseInt(mapNode.valueOf("@heroHP"));
            String descText = mapNode.getText();
            String[] descs = descText.split(",");
            DeckStartupInfo deck = DeckBuilder.build(descs);
            MapEnemyHero hero = new MapEnemyHero(id, heroHP, deck.getRunes(), deck.getCards());
            String victoryText = mapNode.valueOf("@victory");
            VictoryCondition victory = VictoryCondition.parse(victoryText);
            String deckInfo = mapNode.getText();
            MapInfo mapInfo = new MapInfo(hero, victory, deckInfo);
            this.mapStages.put(id, mapInfo);
        }
    } catch (Exception e) {
        throw new CardFantasyRuntimeException("Cannot load card map info XML due to error at " + currentId, e);
    }
}
 
Example 9
Source File: DungeonsStages.java    From CardFantasy with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public DungeonsStages() {
    this.dungeonsStages = new HashMap<String, MapInfo>();
    URL url = CardDataStore.class.getClassLoader().getResource("cfvbaibai/cardfantasy/data/DungeonsStages.xml");
    SAXReader reader = new SAXReader();
    String currentId = "";
    try {
        Document doc = reader.read(url);
        List<Node> mapNodes = doc.selectNodes("/Maps/Map");
        for (Node mapNode : mapNodes) {
            String id = mapNode.valueOf("@id");
            currentId = id;
            int heroHP = Integer.parseInt(mapNode.valueOf("@heroHP"));
            String descText = mapNode.getText();
            String[] descs = descText.split(",");
            DeckStartupInfo deck = DeckBuilder.build(descs);
            MapEnemyHero hero = new MapEnemyHero(id, heroHP, deck.getRunes(), deck.getCards());
            String victoryText = mapNode.valueOf("@victory");
            VictoryCondition victory = VictoryCondition.parse(victoryText);
            String deckInfo = mapNode.getText();
            MapInfo mapInfo = new MapInfo(hero, victory, deckInfo);
            this.dungeonsStages.put(id, mapInfo);
        }
    } catch (Exception e) {
        throw new CardFantasyRuntimeException("Cannot load card map info XML due to error at " + currentId, e);
    }
}
 
Example 10
Source File: ServicesConfigImpl.java    From studio with GNU General Public License v3.0 5 votes vote down vote up
protected void loadSiteUrlsConfiguration(SiteConfigTO siteConfig, Node configNode) {
    if (Objects.nonNull(configNode)) {
        String authoringUrlValue = configNode.valueOf(SITE_CONFIG_ELEMENT_AUTHORING_URL);
        siteConfig.setAuthoringUrl(authoringUrlValue);

        String stagingUrlValue = configNode.valueOf(SITE_CONFIG_ELEMENT_STAGING_URL);
        siteConfig.setStagingUrl(stagingUrlValue);

        String liveUrlValue = configNode.valueOf(SITE_CONFIG_ELEMENT_LIVE_URL);
        siteConfig.setLiveUrl(liveUrlValue);
    }
}
 
Example 11
Source File: JobDeploymentDescriptor.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Load.
 * 
 * @param is the is
 * 
 * @throws DocumentException the document exception
 */
public void load(InputStream is) throws DocumentException{
	SAXReader reader = new org.dom4j.io.SAXReader();
    Document document = null;
    
   	document = reader.read(is);		
    
    Node job = document.selectSingleNode("//etl/job");
    if (job != null) {
    	this.project = job.valueOf("@project");
    	this.language = job.valueOf("@language");
    }
}
 
Example 12
Source File: Dom4JParserUnitTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void getElementByIdTest() {
    parser = new Dom4JParser(new File(fileName));
    Node element = parser.getNodeById("03");

    String type = element.valueOf("@type");
    assertEquals("android", type);
}
 
Example 13
Source File: CalculatedFieldsDAOFileImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private ModelCalculatedField.Slot.IMappedValuesDescriptor loadDescriptor(Node mappedValuesNode) {
	ModelCalculatedField.Slot.IMappedValuesDescriptor descriptor = null;

	String descriptorType = mappedValuesNode.valueOf("@type");
	if (descriptorType.equalsIgnoreCase("range")) {
		descriptor = loadRangeDescriptor(mappedValuesNode);
	} else if (descriptorType.equalsIgnoreCase("punctual")) {
		descriptor = loadPunctualDescriptor(mappedValuesNode);
	}

	return descriptor;
}
 
Example 14
Source File: CalculatedFieldsDAOFileImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private ModelCalculatedField.Slot loadSlot(Node slotNode) {
	ModelCalculatedField.Slot slot;

	String slotValue = slotNode.valueOf("@value");
	slot = new ModelCalculatedField.Slot(slotValue);

	List<Node> mappedValues = slotNode.selectNodes(VALUESET_TAG);
	for (Node mappedValuesNode : mappedValues) {
		ModelCalculatedField.Slot.IMappedValuesDescriptor descriptor = loadDescriptor(mappedValuesNode);
		slot.addMappedValuesDescriptors(descriptor);
	}

	return slot;
}
 
Example 15
Source File: CalculatedFieldsDAOFileImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private String loadDefaultSlotValue(Node calculatedFieldNode) {

		String defaultSlotValue = null;

		Node slotBlock = calculatedFieldNode.selectSingleNode(SLOTS_TAG);
		if (slotBlock != null) {
			defaultSlotValue = slotBlock.valueOf("@defaultSlotValue");
		}

		return defaultSlotValue;
	}
 
Example 16
Source File: JobDeploymentDescriptor.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Load.
 * 
 * @param is the is
 * 
 * @throws DocumentException the document exception
 */
public void load(InputStream is) throws DocumentException{
	SAXReader reader = new org.dom4j.io.SAXReader();
    Document document = null;
    
   	document = reader.read(is);		
    
    Node job = document.selectSingleNode("//etl/job");
    if (job != null) {
    	this.project = job.valueOf("@project");
    	this.language = job.valueOf("@language");
    }
}
 
Example 17
Source File: SecurityServiceImpl.java    From studio with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
protected Set<String> populateUserGlobalPermissions(String path, Set<String> roles,
                                              PermissionsConfigTO permissionsConfig) {
    Set<String> permissions = new HashSet<String>();
    if (roles != null && !roles.isEmpty()) {
        for (String role : roles) {
            Map<String, Map<String, List<Node>>> permissionsMap = permissionsConfig.getPermissions();
            Map<String, List<Node>> siteRoles = permissionsMap.get("###GLOBAL###");
            if (siteRoles == null || siteRoles.isEmpty()) {
                siteRoles = permissionsMap.get("*");
            }
            if (siteRoles != null && !siteRoles.isEmpty()) {
                List<Node> ruleNodes = siteRoles.get(role);
                if (ruleNodes == null || ruleNodes.isEmpty()) {
                    ruleNodes = siteRoles.get("*");
                }
                if (ruleNodes != null && !ruleNodes.isEmpty()) {
                    for (Node ruleNode : ruleNodes) {
                        String regex = ruleNode.valueOf(StudioXmlConstants.DOCUMENT_ATTR_REGEX);
                        if (path.matches(regex)) {
                            logger.debug("Global permissions found by matching " + regex + " for " + role);

                            List<Node> permissionNodes =
                                    ruleNode.selectNodes(StudioXmlConstants.DOCUMENT_ELM_ALLOWED_PERMISSIONS);
                            for (Node permissionNode : permissionNodes) {
                                String permission = permissionNode.getText().toLowerCase();
                                logger.debug("adding global permissions " + permission + " to " + path
                                        + " for " + role);
                                permissions.add(permission);
                            }
                        }
                    }
                } else {
                    logger.debug("No default role is set. adding default permission: "
                            + StudioConstants.PERMISSION_VALUE_READ);
                    // If no default role is set
                    permissions.add(StudioConstants.PERMISSION_VALUE_READ);
                }
            } else {
                logger.debug("No default site is set. adding default permission: "
                        + StudioConstants.PERMISSION_VALUE_READ);
                // If no default site is set
                permissions.add(StudioConstants.PERMISSION_VALUE_READ);
            }
        }
    } else {
        logger.debug("No user or group matching found. adding default permission: "
                + StudioConstants.PERMISSION_VALUE_READ);
        // If user or group did not match the roles-mapping file
        permissions.add(StudioConstants.PERMISSION_VALUE_READ);
    }
    return permissions;
}
 
Example 18
Source File: SecurityServiceImpl.java    From studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * populate user permissions
 *
 * @param site
 * @param path
 * @param roles
 * @param permissionsConfig
 */
@SuppressWarnings("unchecked")
protected Set<String> populateUserPermissions(String site, String path, Set<String> roles,
                                              PermissionsConfigTO permissionsConfig) {
    Set<String> permissions = new HashSet<String>();
    if (roles != null && !roles.isEmpty()) {
        for (String role : roles) {
            Map<String, Map<String, List<Node>>> permissionsMap = permissionsConfig.getPermissions();
            Map<String, List<Node>> siteRoles = permissionsMap.get(site);
            if (siteRoles == null || siteRoles.isEmpty()) {
                siteRoles = permissionsMap.get("*");
            }
            if (siteRoles != null && !siteRoles.isEmpty()) {
                List<Node> ruleNodes = siteRoles.get(role);
                if (ruleNodes == null || ruleNodes.isEmpty()) {
                    ruleNodes = siteRoles.get("*");
                }
                if (ruleNodes != null && !ruleNodes.isEmpty()) {
                    for (Node ruleNode : ruleNodes) {
                        String regex = ruleNode.valueOf(StudioXmlConstants.DOCUMENT_ATTR_REGEX);
                        if (path.matches(regex)) {
                            logger.debug("Permissions found by matching " + regex + " for " + role
                                    + " in " + site);

                            List<Node> permissionNodes = ruleNode.selectNodes(
                                    StudioXmlConstants.DOCUMENT_ELM_ALLOWED_PERMISSIONS);
                            for (Node permissionNode : permissionNodes) {
                                String permission = permissionNode.getText().toLowerCase();
                                logger.debug("adding permissions " + permission + " to " + path + " for "
                                        + role + " in " + site);
                                permissions.add(permission);
                            }
                        }
                    }
                } else {
                    logger.debug("No default role is set. adding default permission: "
                            + StudioConstants.PERMISSION_VALUE_READ);
                    // If no default role is set
                    permissions.add(StudioConstants.PERMISSION_VALUE_READ);
                }
            } else {
                logger.debug("No default site is set. adding default permission: "
                        + StudioConstants.PERMISSION_VALUE_READ);
                // If no default site is set
                permissions.add(StudioConstants.PERMISSION_VALUE_READ);
            }
        }
    } else {
        logger.debug("No user or group matching found. adding default permission: "
                + StudioConstants.PERMISSION_VALUE_READ);
        // If user or group did not match the roles-mapping file
        permissions.add(StudioConstants.PERMISSION_VALUE_READ);
    }
    return permissions;
}
 
Example 19
Source File: ImportServiceImpl.java    From studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * create folders
 *
 * @param site
 *            site name
 * @param importedPaths
 *            a list of imported files
 * @param importedFullPaths
 * @param nodes
 *            nodes representing folders
 * @param fileRoot
 *            the root location of files/folders being imported
 * @param targetRoot
 *            the target location root
 * @param parentPath
 *            the target location to import to
 * @param overWrite
 *            overwrite contents?
 * @param user
 *
 */
@SuppressWarnings("unchecked")
private void createFolders(String site, Set<String> importedPaths, List<String> importedFullPaths,
                           List<Node> nodes, String fileRoot, String targetRoot, String parentPath,
                           boolean overWrite, String user) throws SiteNotFoundException {
    logger.info("[IMPORT] createFolders : site[" + site + "] " + "] fileRoot [" + fileRoot + "] targetRoot [ "
            + targetRoot + "] parentPath [" + parentPath + "] overwrite[" + overWrite + "]");

    if (nodes != null) {
        for (Node node : nodes) {
            String name = node.valueOf("@name");
            String value = node.valueOf("@over-write");
            boolean folderOverWrite = (StringUtils.isEmpty(value)) ? overWrite : ContentFormatUtils
                    .getBooleanValue(value);
            if (!StringUtils.isEmpty(name)) {
                String currentFilePath = fileRoot + FILE_SEPARATOR + name;
                String currentPath = parentPath + FILE_SEPARATOR + name;
                // check if the parent node exists and create the folder if
                // not
                boolean folderExists = contentService.contentExists(site, currentPath);
                if (!folderExists) {
                    contentService.createFolder(site, parentPath, name);
                }
                boolean importAll = ContentFormatUtils.getBooleanValue(node.valueOf("@import-all"));
                if (importAll) {
                    importRootFileList(site, importedPaths, importedFullPaths, fileRoot + FILE_SEPARATOR + name,
                            targetRoot, currentPath, folderOverWrite, user);

                } else {
                    // create child folders
                    List<Node> childFolders = node.selectNodes("folder");
                    createFolders(site, importedPaths, importedFullPaths, childFolders, currentFilePath,
                            targetRoot, currentPath, folderOverWrite, user);
                    // create child fiimportedPathsles
                    List<Node> childFiles = node.selectNodes("file");
                    createFiles(site, importedPaths, importedFullPaths, childFiles, currentFilePath,
                            targetRoot, currentPath, folderOverWrite, user);
                }
            }
        }
    }
}
 
Example 20
Source File: ServicesConfigImpl.java    From studio with GNU General Public License v3.0 4 votes vote down vote up
/**
* load services configuration
*
*/
   protected SiteConfigTO loadConfiguration(String site) {
       Document document = null;
       SiteConfigTO siteConfig = null;
       try {
           document = configurationService.getConfigurationAsDocument(site, MODULE_STUDIO, getConfigFileName(),
                   studioConfiguration.getProperty(CONFIGURATION_ENVIRONMENT_ACTIVE));
       } catch (DocumentException | IOException e) {
           LOGGER.error("Error while loading configuration for " + site + " at " + getConfigFileName(), e);
       }
       if (document != null) {
           Element root = document.getRootElement();
           Node configNode = root.selectSingleNode("/site-config");
           String name = configNode.valueOf("display-name");
           siteConfig = new SiteConfigTO();
           siteConfig.setName(name);
           siteConfig.setWemProject(configNode.valueOf("wem-project"));
           siteConfig.setTimezone(configNode.valueOf("default-timezone"));
           String sandboxBranch = configNode.valueOf(SITE_CONFIG_ELEMENT_SANDBOX_BRANCH);
           if (StringUtils.isEmpty(sandboxBranch)) {
               sandboxBranch = studioConfiguration.getProperty(REPO_SANDBOX_BRANCH);
           }
           siteConfig.setSandboxBranch(sandboxBranch);
           String stagingEnvironmentEnabledValue =
                   configNode.valueOf(SITE_CONFIG_XML_ELEMENT_PUBLISHED_REPOSITORY +
                   "/" + SITE_CONFIG_XML_ELEMENT_ENABLE_STAGING_ENVIRONMENT);
           if (StringUtils.isEmpty(stagingEnvironmentEnabledValue)) {
               siteConfig.setStagingEnvironmentEnabled(false);
           } else {
               siteConfig.setStagingEnvironmentEnabled(Boolean.valueOf(stagingEnvironmentEnabledValue));
           }

           String stagingEnvironment = configNode.valueOf(SITE_CONFIG_XML_ELEMENT_PUBLISHED_REPOSITORY + "/" +
                   SITE_CONFIG_XML_ELEMENT_STAGING_ENVIRONMENT);
           if (StringUtils.isEmpty(stagingEnvironment)) {
               stagingEnvironment = studioConfiguration.getProperty(REPO_PUBLISHED_STAGING);
           }
           siteConfig.setStagingEnvironment(stagingEnvironment);
           String liveEnvironment = configNode.valueOf(SITE_CONFIG_XML_ELEMENT_PUBLISHED_REPOSITORY + "/" +
                   SITE_CONFIG_XML_ELEMENT_LIVE_ENVIRONMENT);
           if (StringUtils.isEmpty(liveEnvironment)) {
               liveEnvironment = studioConfiguration.getProperty(REPO_PUBLISHED_LIVE);
           }
           siteConfig.setLiveEnvironment(liveEnvironment);

           loadSiteUrlsConfiguration(siteConfig, configNode.selectSingleNode(SITE_CONFIG_ELEMENT_SITE_URLS));

           String adminEmailAddressValue = configNode.valueOf(SITE_CONFIG_ELEMENT_ADMIN_EMAIL_ADDRESS);
           siteConfig.setAdminEmailAddress(adminEmailAddressValue);

           loadSiteRepositoryConfiguration(siteConfig, configNode.selectSingleNode("repository"));
           // set the last updated date
           siteConfig.setLastUpdated(ZonedDateTime.now(ZoneOffset.UTC));

           loadFacetConfiguration(configNode, siteConfig);

           siteConfig.setPluginFolderPattern(configNode.valueOf(SITE_CONFIG_ELEMENT_PLUGIN_FOLDER_PATTERN));
       } else {
           LOGGER.error("No site configuration found for " + site + " at " + getConfigFileName());
       }
       return siteConfig;
   }