Java Code Examples for org.dom4j.Node#selectNodes()
The following examples show how to use
org.dom4j.Node#selectNodes() .
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: SecurityServiceImpl.java From studio with GNU General Public License v3.0 | 6 votes |
@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 2
Source File: HierarchiesDAOFileImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
private Hierarchy loadHierarchy(Node hierarchyNode) { String name = hierarchyNode.valueOf("@name"); Boolean isDefault = Boolean.valueOf(hierarchyNode.valueOf("@default")); Hierarchy hierarchy = new Hierarchy(name, isDefault); List<?> levelNodes = hierarchyNode.selectNodes(LEVEL_TAG); LinkedList<HierarchyLevel> levels = new LinkedList<HierarchyLevel>(); for (Object levelObj : levelNodes) { Node levelNode = (Node) levelObj; String levelName = levelNode.valueOf("@name"); String levelColumn = levelNode.valueOf("@column"); String levelType = levelNode.valueOf("@type"); HierarchyLevel level = new HierarchyLevel(levelName, levelColumn, levelType); levels.add(level); } hierarchy.setLevels(levels); return hierarchy; }
Example 3
Source File: CalculatedFieldsDAOFileImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
private List<ModelCalculatedField.Slot> loadSlots(Node calculatedFieldNode) { List<ModelCalculatedField.Slot> slots = new ArrayList<ModelCalculatedField.Slot>(); Node slotBlock = calculatedFieldNode.selectSingleNode(SLOTS_TAG); if (slotBlock != null) { List<Node> slotNodes = slotBlock.selectNodes(SLOT_TAG); for (Node slotNode : slotNodes) { ModelCalculatedField.Slot slot = loadSlot(slotNode); slots.add(slot); } } return slots; }
Example 4
Source File: TextHandler.java From zealot with Apache License 2.0 | 5 votes |
/** * 构建'<text></text>'标签中sqlInfo中的SQL文本信息,如果有非文本节点则抛出异常. * 即text节点中的内容不能包含其他标签 * @param node xml标签节点 */ @SuppressWarnings("unchecked") private void concatSqlText(Node node, SqlInfo sqlInfo) { // 获取所有子节点,并分别将其使用StringBuilder拼接起来 List<Node> nodes = node.selectNodes(ZealotConst.ATTR_CHILD); for (Node n: nodes) { if (ZealotConst.NODETYPE_TEXT.equals(n.getNodeTypeName())) { // 如果子节点node 是文本节点,则直接获取其文本 sqlInfo.getJoin().append(n.getText()); } else { throw new ContainXmlTagException("<text></text>标签中不能包含其他xml标签,只能是文本元素!"); } } }
Example 5
Source File: PluginCacheConfigurator.java From Openfire with Apache License 2.0 | 5 votes |
private Map<String, String> readInitParams(Node configData) { Map<String, String> paramMap = new HashMap<>(); List<Node> params = configData.selectNodes("init-params/init-param"); for (Node param : params) { String paramName = param.selectSingleNode("param-name").getStringValue(); String paramValue = param.selectSingleNode("param-value").getStringValue(); paramMap.put(paramName, paramValue); } return paramMap; }
Example 6
Source File: Parser.java From ParsePDM with Apache License 2.0 | 5 votes |
public ArrayList<PDMReference> pdmReferenceParser(Node node) throws Exception { ArrayList<PDMReference> referenceList = new ArrayList<PDMReference>(); for (Object reference : node.selectNodes("c:References/o:Reference")) { Node referenceNode = (Node) reference; PDMReference pdmReference = new PDMReference(); pdmReference.setId(((Element) referenceNode).attributeValue("Id")); pdmReference.setName(referenceNode.selectSingleNode("a:Name").getText()); pdmReference.setCode(referenceNode.selectSingleNode("a:Code").getText()); pdmReference.setConstraintName(selectSingleNodeStringText(referenceNode, "ForeignKeyConstraintName")); pdmReference.setUpdateConstraint(selectSingleNodeIntText(referenceNode, "UpdateConstraint")); pdmReference.setDeleteConstraint(selectSingleNodeIntText(referenceNode, "DeleteConstraint")); pdmReference.setImplementationType(selectSingleNodeStringText(referenceNode, "ImplementationType")); // 添加ParentTable String parentTableId = ((Element) referenceNode.selectSingleNode("c:ParentTable/o:Table")).attributeValue("Ref"); pdmReference.setParentTable(pdm.getPDMTable(parentTableId)); // 添加ChildTable String childTableId = ((Element) referenceNode.selectSingleNode("c:ChildTable/o:Table")).attributeValue("Ref"); pdmReference.setChildTable(pdm.getPDMTable(childTableId)); // 添加Joins for (Object jion : referenceNode.selectNodes("c:Joins/o:ReferenceJoin")) { Node referenceJoinNode = (Node) jion; PDMReferenceJoin pdmReferenceJoin = new PDMReferenceJoin(); pdmReferenceJoin.setId(((Element) referenceJoinNode).attributeValue("Id")); String id = ((Element) referenceJoinNode.selectSingleNode("c:Object1/o:Column")).attributeValue("Ref"); pdmReferenceJoin.setParentTable_Col(pdmReference.getParentTable().getPDMColumn(id)); Element element = (Element) referenceJoinNode.selectSingleNode("c:Object2/o:Column"); if (element == null) { continue; } id = element.attributeValue("Ref"); pdmReferenceJoin.setChildTable_Col(pdmReference.getChildTable().getPDMColumn(id)); pdmReference.addReferenceJoin(pdmReferenceJoin); } referenceList.add(pdmReference); } return referenceList; }
Example 7
Source File: Parser.java From ParsePDM with Apache License 2.0 | 5 votes |
public ArrayList<PDMUser> pdmUserParser(Node node) { ArrayList<PDMUser> userList = new ArrayList<PDMUser>(); for (Object o : node.selectNodes("c:Users/o:User")) { Node userNode = (Node) o; PDMUser pdmUser = new PDMUser(); pdmUser.setId(((Element) userNode).attributeValue("Id")); pdmUser.setName(userNode.selectSingleNode("a:Name").getText()); pdmUser.setCode(userNode.selectSingleNode("a:Code").getText()); userList.add(pdmUser); } return userList; }
Example 8
Source File: Parser.java From ParsePDM with Apache License 2.0 | 5 votes |
public ArrayList<PDMColumn> pdmColumnParser(Node node) { ArrayList<PDMColumn> columnList = new ArrayList<PDMColumn>(); try { for (Object o : node.selectNodes("c:Columns/o:Column")) { Node columnNode = (Node) o; if (columnNode == null) { break; } PDMColumn pdmColumn = new PDMColumn(); pdmColumn.setId(((Element) columnNode).attributeValue("Id")); pdmColumn.setName(columnNode.selectSingleNode("a:Name") == null ? "" : columnNode.selectSingleNode("a:Name").getText()); pdmColumn.setCode(columnNode.selectSingleNode("a:Code") == null ? "" : columnNode.selectSingleNode("a:Code").getText()); pdmColumn.setDataType(columnNode.selectSingleNode("a:DataType") == null ? "" : columnNode.selectSingleNode("a:DataType").getText()); pdmColumn.setLength(selectSingleNodeIntText(columnNode, "a:Length")); pdmColumn.setPrecision(selectSingleNodeIntText(columnNode, "a:Precision")); pdmColumn.setMandatory(selectSingleNodeIntText(columnNode, "a:Mandatory")); pdmColumn.setDefaultValue(selectSingleNodeStringText(columnNode, "a:DefaultValue")); pdmColumn.setLowValue(selectSingleNodeStringText(columnNode, "a:LowValue")); pdmColumn.setHighValue(selectSingleNodeStringText(columnNode, "a:HighValue")); pdmColumn.setComment(selectSingleNodeStringText(columnNode, "a:Comment")); columnList.add(pdmColumn); } } catch (Exception e) { e.printStackTrace(); System.out.println("error:" + e.getMessage()); } return columnList; }
Example 9
Source File: ServicesConfigImpl.java From studio with GNU General Public License v3.0 | 5 votes |
/** * Loads the search facets configurations * @param root configuration to read * @param config configuration to update */ @SuppressWarnings("unchecked") protected void loadFacetConfiguration(Node root, SiteConfigTO config) { List<Node> facetsConfig = root.selectNodes("search/facets/facet"); if(CollectionUtils.isNotEmpty(facetsConfig)) { Map<String, FacetTO> facets = facetsConfig.stream() .map(facetConfig -> { FacetTO facet = new FacetTO(); facet.setName(XmlUtils.selectSingleNodeValue(facetConfig, "name/text()")); facet.setField(XmlUtils.selectSingleNodeValue(facetConfig, "field/text()")); facet.setDate(Boolean.parseBoolean( XmlUtils.selectSingleNodeValue(facetConfig, "date/text()"))); facet.setMultiple(Boolean.parseBoolean( XmlUtils.selectSingleNodeValue(facetConfig, "multiple/text()"))); List<Node> rangesConfig = facetConfig.selectNodes("ranges/range"); if(CollectionUtils.isNotEmpty(rangesConfig)) { List<FacetRangeTO> ranges = rangesConfig.stream() .map(rangeConfig -> { FacetRangeTO range = new FacetRangeTO(); range.setLabel(XmlUtils.selectSingleNodeValue(rangeConfig, "label/text()")); String from =XmlUtils.selectSingleNodeValue(rangeConfig, "from/text()"); if(StringUtils.isNotEmpty(from)) { range.setFrom(from); } String to = XmlUtils.selectSingleNodeValue(rangeConfig, "to/text()"); if(StringUtils.isNotEmpty(to)) { range.setTo(to); } return range; }) .collect(Collectors.toList()); facet.setRanges(ranges); } return facet; }) .collect(Collectors.toMap(FacetTO::getName, Function.identity())); config.setFacets(facets); } }
Example 10
Source File: MavenCoordinate.java From fasten with Apache License 2.0 | 5 votes |
/** * Return a list of dependencies in given profile node or of the entire project if profiles * were not present in pom.xml. * * @param node Dependencies node from profile or entire project * @param properties A map containing properties from pom.xml * @return List of dependencies */ private List<RevisionCallGraph.Dependency> resolveLocalDependencies( final Node node, Map<String, String> properties) { final var depList = new ArrayList<RevisionCallGraph.Dependency>(); for (final var depNode : node.selectNodes("./*[local-name() = 'dependency']")) { final var groupId = depNode .selectSingleNode("./*[local-name() = 'groupId']").getStringValue(); final var artifactId = depNode .selectSingleNode("./*[local-name() = 'artifactId']").getStringValue(); final var versionSpec = depNode .selectSingleNode("./*[local-name() = 'version']"); final String version; if (versionSpec != null) { version = versionSpec.getStringValue().startsWith("$") ? properties.get(versionSpec.getStringValue() .substring(2, versionSpec.getStringValue().length() - 1)) : versionSpec.getStringValue(); } else { version = "*"; } final var dependency = new RevisionCallGraph.Dependency( "mvn", groupId + ":" + artifactId, Collections.singletonList(new RevisionCallGraph .Constraint(version, version))); depList.add(dependency); } return depList; }
Example 11
Source File: ImportServiceImpl.java From studio with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") private void importFromConfigNode(final String site, String publishChannelGroup, final Node node, final String fileRoot, final String targetRoot, boolean publish, int chunkSize, int delayInterval, int delayLength) throws SiteNotFoundException { if (!inProgress) { inProgress = true; if (delayInterval > 0) pauseEanbeld = true; this.currentDelayInterval = delayInterval * 1000; this.currentDelayLength = delayLength * 1000; final Set<String> importedPaths = new HashSet<String>(); final List<String> importedFullPaths = new ArrayList<String>(); logger.info("[IMPORT] started importing in " + site + ", pause enabled: " + pauseEanbeld + ", delay interval: " + this.currentDelayInterval + ", delay length: " + this.currentDelayLength); boolean overWrite = ContentFormatUtils.getBooleanValue(node.valueOf("@over-write")); final List<Node> folderNodes = node.selectNodes("folder"); if (publish) { String user = securityService.getCurrentUser(); logger.debug("[IMPORT] publishing user: " + user); this.nextStop = System.currentTimeMillis() + this.currentDelayInterval; createFolders(site, importedPaths, importedFullPaths, folderNodes, fileRoot, targetRoot, "", overWrite, user); logger.info("Starting Publish of Imported Files (Total " + importedFullPaths.size() + " On chunkSize of " + chunkSize + " )"); publish(site, publishChannelGroup, targetRoot, importedFullPaths, chunkSize); } else { this.nextStop = System.currentTimeMillis() + this.currentDelayInterval; createFolders(site, importedPaths, importedFullPaths, folderNodes, fileRoot, targetRoot, "", overWrite, null); } inProgress = false; } else { logger.info("[IMPORT] an import process is currently running."); } }
Example 12
Source File: CalculatedFieldsDAOFileImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
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 13
Source File: HierarchiesDAOFileImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
private List<Hierarchy> loadHierarchies(Node dimensionNode) { List<Hierarchy> hierarchies = new ArrayList<Hierarchy>(); Node hierarchiesBlock = dimensionNode.selectSingleNode(HIERARCHIES_TAG); if (hierarchiesBlock != null) { List<?> hierarchyNodes = hierarchiesBlock.selectNodes(HIERARCHY_TAG); for (Object hierarchyNode : hierarchyNodes) { Hierarchy hierarchy = loadHierarchy((Node) hierarchyNode); hierarchies.add(hierarchy); } } return hierarchies; }
Example 14
Source File: UnittypeXML.java From freeacs with MIT License | 5 votes |
@SuppressWarnings("rawtypes") public void load(Node node, Enums enums) throws Exception { List parameter_nodes = node.selectNodes("parameter"); for (Object parameter_node : parameter_nodes) { Parameter parameter = new Parameter(); parameter.load((Node) parameter_node, enums); list.add(parameter); } }
Example 15
Source File: UnittypeXML.java From freeacs with MIT License | 5 votes |
@SuppressWarnings("rawtypes") public void load(Node node) throws Exception { List enum_nodes = node.selectNodes("enum"); for (Object enum_node : enum_nodes) { Enum enum_ = new Enum(); enum_.load((Node) enum_node); list.add(enum_); } }
Example 16
Source File: XMLUtil.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
@SuppressWarnings("unchecked") public static <T> List<T> selectNodes(Node node, String arg0) { return (List<T>) node.selectNodes(arg0); }
Example 17
Source File: ImportServiceImpl.java From studio with GNU General Public License v3.0 | 4 votes |
/** * 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 18
Source File: Parser.java From ParsePDM with Apache License 2.0 | 4 votes |
public ArrayList<PDMTable> pdmTableParser(Node node) throws Exception { ArrayList<PDMTable> tableList = new ArrayList<PDMTable>(); ArrayList l = new ArrayList(); List ll = node.selectNodes("c:Packages/o:Package/c:Tables/o:Table"); if (!ll.isEmpty()) { l.addAll((ArrayList) node.selectNodes("c:Packages/o:Package/c:Tables/o:Table")); } List lll = node.selectNodes("c:Tables/o:Table"); if (!lll.isEmpty()) { l.addAll(node.selectNodes("c:Tables/o:Table")); } // List l = node.selectNodes("c:Packages/o:Package/c:Tables/o:Table"); for (Object o : l) { Node tableNode = (Node) o; PDMTable pdmTable = new PDMTable(); pdmTable.setId(((Element) tableNode).attributeValue("Id")); pdmTable.setName(tableNode.selectSingleNode("a:Name").getText()); pdmTable.setCode(tableNode.selectSingleNode("a:Code").getText()); // 添加Columns pdmTable.setColumns(pdmColumnParser(tableNode)); // 添加key for (Object key : tableNode.selectNodes("c:Keys/o:Key")) { Node keyNode = (Node) key; PDMKey pdmKey = new PDMKey(); pdmKey.setId(((Element) keyNode).attributeValue("Id")); pdmKey.setName(keyNode.selectSingleNode("a:Name").getText()); pdmKey.setCode(keyNode.selectSingleNode("a:Code").getText()); for (Object column : keyNode.selectNodes("c:Key.Columns/o:Column")) { String id = ((Element) column).attributeValue("Ref"); pdmKey.addColumn(pdmTable.getPDMColumn(id)); } pdmTable.addKey(pdmKey); } // 添加PrimaryKey if (null != tableNode.selectSingleNode("c:PrimaryKey/o:Key")) { String keyId = ((Element) tableNode.selectSingleNode("c:PrimaryKey/o:Key")).attributeValue("Ref"); pdmTable.setPrimaryKey(pdmTable.getPDMKey(keyId)); } // 添加Indexes for (Object index : tableNode.selectNodes("c:Indexes/o:Index")) { Node indexNode = (Node) index; PDMIndex pdmIndex = new PDMIndex(); pdmIndex.setId(((Element) indexNode).attributeValue("Id")); pdmIndex.setName(indexNode.selectSingleNode("a:Name").getText()); pdmIndex.setCode(indexNode.selectSingleNode("a:Code").getText()); /* for (Object column : indexNode.selectNodes("//c:Column/o:Column")) { String id = ((Element) column).attributeValue("Ref"); pdmIndex.addColumn(pdmTable.getPDMColumn(id)); } */ pdmTable.addIndex(pdmIndex); } // 添加User Element userElement = (Element) tableNode.selectSingleNode("c:Owner/o:User"); if (userElement != null) { String userId = userElement.attributeValue("Ref"); pdmTable.setUser(pdm.getPDMUser(userId)); } tableList.add(pdmTable); } return tableList; }
Example 19
Source File: SecurityServiceImpl.java From studio with GNU General Public License v3.0 | 4 votes |
@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 20
Source File: SecurityServiceImpl.java From studio with GNU General Public License v3.0 | 4 votes |
/** * 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; }