List of usage examples for org.w3c.dom Element getTagName
public String getTagName();
From source file:org.sakaiproject.archive.impl.BasicArchiveService.java
/** * Merge the the permission-roles settings into the site * @param element The XML DOM tree of messages to merge. * @param siteId The id of the site getting imported into. *///from ww w .j a v a 2s . c o m protected void mergeSiteRoles(Element el, String siteId, HashMap useIdTrans) throws PermissionException { // heck security (throws if not permitted) unlock(SiteService.SECURE_UPDATE_SITE, SiteService.siteReference(siteId)); String source = ""; // el: <roles> node Node parent0 = el.getParentNode(); // parent0: <site> node Node parent1 = parent0.getParentNode(); // parent1: <service> node Node parent = parent1.getParentNode(); // parent: <archive> node containing "system" if (parent.getNodeType() == Node.ELEMENT_NODE) { Element parentEl = (Element) parent; source = parentEl.getAttribute("system"); } List roles = new Vector(); // to add this user with this role inito this realm String realmId = "/site/" + siteId; try { //AuthzGroup realmEdit = AuthzGroupService.getRealm(realmId); AuthzGroup realm = AuthzGroupService.getAuthzGroup(realmId); //roles.addAll(realmEdit.getRoles()); roles.addAll(realm.getRoles()); NodeList children = el.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element element2 = (Element) child; if (source.equalsIgnoreCase(FROM_WT)) { // from WT, merge the users with roles into the new site NodeList children2 = element2.getChildNodes(); final int length2 = children2.getLength(); for (int i2 = 0; i2 < length2; i2++) { Node child2 = children2.item(i2); if (child2.getNodeType() != Node.ELEMENT_NODE) continue; Element element3 = (Element) child2; if (!element3.getTagName().equals("ability")) continue; String userId = element3.getAttribute("userId"); // under 2 conditions the userIdTrans would be empty // 1st is, even from WT, no user id has been processed // 2nd is, this user is not from WT. userIdTrans is always empty if (!userIdTrans.isEmpty()) { // user the new id if the old one from WT has been replaced String newId = (String) useIdTrans.get(userId); if (newId != null) userId = newId; } try { User user = UserDirectoryService.getUser(userId); String roleId = element3.getAttribute("roleId"); //Role role = realmEdit.getRole(roleId); Role role = realm.getRole(roleId); if (role != null) { AuthzGroup realmEdit = AuthzGroupService.getAuthzGroup(realmId); realmEdit.addMember(user.getId(), role.getId(), true, false); AuthzGroupService.save(realmEdit); } } catch (UserNotDefinedException e) { M_log.warn("UserNotDefined in mergeSiteRoles: " + userId); } catch (AuthzPermissionException e) { M_log.warn("AuthzPermissionException in mergeSiteRoles", e); } } } else { // for both CT classic and Sakai CTools // check is this roleId is a qualified one if (!checkSystemRole(source, element2.getTagName())) continue; NodeList children2 = element2.getChildNodes(); final int length2 = children2.getLength(); for (int i2 = 0; i2 < length2; i2++) { Node child2 = children2.item(i2); if (child2.getNodeType() != Node.ELEMENT_NODE) continue; Element element3 = (Element) child2; if (!element3.getTagName().equals("ability")) continue; String userId = element3.getAttribute("userId"); // this user has a qualified role, his/her resource will be imported usersListAllowImport.add(userId); } } // if - elseif - elseif } // for } catch (GroupNotDefinedException err) { M_log.warn("()mergeSiteRoles realm edit exception caught GroupNotDefinedException " + realmId); } return; }
From source file:org.sakaiproject.archive.impl.BasicArchiveService.java
/** * Merge the user list into the the system. * Translate the id to the siteId./*from ww w . ja v a2s . c o m*/ * @param element The XML DOM tree of messages to merge. */ protected String mergeUsers(Element element, HashMap useIdTrans) throws IdInvalidException, IdUsedException, PermissionException { String msg = ""; int count = 0; // The flag showing from WT boolean fromWT = false; boolean fromCTclassic = false; boolean fromCTools = false; String source = ""; Node parent = element.getParentNode(); if (parent.getNodeType() == Node.ELEMENT_NODE) { Element parentEl = (Element) parent; source = parentEl.getAttribute("system"); } if (source != null) { if (source.equalsIgnoreCase(FROM_CT)) fromCTclassic = true; else if (source.equalsIgnoreCase(FROM_WT)) fromWT = true; else fromCTools = true; } else fromCTools = true; NodeList children = element.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element element2 = (Element) child; if (!element2.getTagName().equals("user")) continue; //for WorkTools if (fromWT) { // Worktools use email address as Id String wtId = element2.getAttribute("id"); // check if this is an umich address if (wtId.endsWith("umich.edu")) { // if this id is a UM unique name // trim the first part of the email as the id String userId = wtId.substring(0, wtId.indexOf("@")); // change the id to be the first part of wtId element2.setAttribute("id", userId); // add the entry (wtEmail <-> userId) into map useIdTrans.put(wtId, userId); try { User user = UserDirectoryService.getUser(userId); // if this user id exists, do nothing. } catch (UserNotDefinedException e) { // this umich id does not exit, merging will create a new user with this id try { UserEdit userEdit = UserDirectoryService.mergeUser(element2); UserDirectoryService.commitEdit(userEdit); count++; // because it is an UM id, report it in the merge log. msg = msg.concat("The user id " + userId + "(" + wtId + ") doesn't exist, and was just created. \n"); } catch (UserIdInvalidException error) { msg = msg.concat("This user with id -" + wtId + ", can't be merged because of the invalid email address.\n"); } catch (UserAlreadyDefinedException error) { } catch (UserPermissionException error) { } } } else { // for non-UM email, process as a friend account id try { // test if it is a friend account id User user = UserDirectoryService.getUser(wtId); // if the user exists, do nothing. } catch (UserNotDefinedException e) { try { // if this isn't such a friend email address, // create a new friend account for it UserEdit userEdit = UserDirectoryService.mergeUser(element2); UserDirectoryService.commitEdit(userEdit); count++; } catch (UserIdInvalidException error) { msg = msg.concat("This user with id -" + wtId + ", can't be merged because of the invalid email address.\n"); } catch (UserAlreadyDefinedException error) { } catch (UserPermissionException error) { } } } } // not allowing merging users form CT classic or CTools. /* else if (fromCTclassic) { String ctId = element2.getAttribute("id"); try { User user = UserDirectoryService.getUser(ctId); } catch(IdUnusedException e) { // if this umich id does not exit, report it in importing log. msg.concat("The user id " + ctId + " doesn't exist, and was just created. \n"); } try { // override the old one or create a new user with this id UserEdit userEdit = UserDirectoryService.mergeUser(element2); UserDirectoryService.commitEdit(userEdit); count++; } catch(IdInvalidException error) { msg.concat("This user with id -" + ctId + ", can't be merged because of the invalid email address.\n"); } catch(IdUsedException error) { } catch(PermissionException error) { } } else if (fromCTools) { try { UserEdit userEdit = UserDirectoryService.mergeUser(element2); UserDirectoryService.commitEdit(userEdit); count++; } catch(IdInvalidException error) { msg.concat("This user with id -" + element2.getAttribute("id") + ", can't be merged because of the invalid email address.\n"); } catch(IdUsedException error) { } catch(PermissionException error) { } } */ } msg = msg + "merging user" + "(" + count + ") users\n"; return msg; }
From source file:org.sakaiproject.archive.impl.BasicArchiveService.java
/** * Merge the site definition from the site part of the archive file into the site service. * Translate the id to the siteId.// w w w . j a v a 2 s. c o m * @param siteId The id of the site getting imported into. * @param fromSiteId The id of the site the archive was made from. * @param element The XML DOM tree of messages to merge. * @param creatorId The creator id */ protected void mergeSite(String siteId, String fromSiteId, Element element, HashMap useIdTrans, String creatorId) { NodeList children = element.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element element2 = (Element) child; if (!element2.getTagName().equals("site")) continue; NodeList toolChildren = element2.getElementsByTagName("tool"); final int tLength = toolChildren.getLength(); for (int i2 = 0; i2 < tLength; i2++) { Element element3 = (Element) toolChildren.item(i2); String toolId = element3.getAttribute("toolId"); if (toolId != null) { toolId = toolId.replaceAll(old_toolId_prefix, new_toolId_prefix); for (int j = 0; j < old_toolIds.length; j++) { toolId = toolId.replaceAll(old_toolIds[i], new_toolIds[i]); } } element3.setAttribute("toolId", toolId); } // merge the site info first try { SiteService.merge(siteId, element2, creatorId); mergeSiteInfo(element2, siteId); } catch (Exception any) { } Site site = null; try { site = SiteService.getSite(siteId); } catch (IdUnusedException e) { M_log.warn(this + "The site with id " + siteId + " doesn't exit"); return; } if (site != null) { NodeList children2 = element2.getChildNodes(); final int length2 = children2.getLength(); for (int i2 = 0; i2 < length2; i2++) { Node child2 = children2.item(i2); if (child2.getNodeType() != Node.ELEMENT_NODE) continue; Element element3 = (Element) child2; if (!element3.getTagName().equals("roles")) continue; // only merge roles when from Worktools //if (source.equalsIgnoreCase(FROM_WT)) //{ // merge the permission-roles // mergeSiteRoles will merge users from WT into the new site // it also creates a set for the users from CT or CTools having a certain role try { mergeSiteRoles(element3, siteId, useIdTrans); } catch (PermissionException e1) { //} } } } } }
From source file:org.sakaiproject.archive.impl.ImportMetadataServiceImpl.java
public List getImportMetadataElements(Document doc) { if (LOG.isDebugEnabled()) { LOG.debug("getImportMetadataElements(Document" + doc + ")"); }//from ww w. java2 s. c o m if (doc == null) { throw new IllegalArgumentException("Illegal document argument!"); } else { this.document = doc; //TODO: Validate the Doc against DTD Element root = doc.getDocumentElement(); if (root.getTagName().equals(ROOT)) { NodeList rootNodeList = root.getChildNodes(); final int length = rootNodeList.getLength(); for (int i = 0; i < length; i++) { Node mapping = rootNodeList.item(i); if (mapping.getNodeType() != Node.ELEMENT_NODE) { continue; } Element mappingElement = (Element) mapping; if (mappingElement.getTagName().equals(MAPPINGS)) { List maps = new ArrayList(); NodeList mapNode = mappingElement.getChildNodes(); final int mapLength = mapNode.getLength(); for (int j = 0; j < mapLength; j++) { Node mapNodes = mapNode.item(j); if (mapNodes.getNodeType() != Node.ELEMENT_NODE) { continue; } Element mapElement = (Element) mapNodes; if (mapElement.getTagName().equals(MAP)) { ImportMetadataImpl importMetadataMap = new ImportMetadataImpl(); importMetadataMap.setId(mapElement.getAttribute(ID)); importMetadataMap.setFileName(mapElement.getAttribute(FILE_NAME)); importMetadataMap.setLegacyTool(mapElement.getAttribute(LEGACY_TOOL)); importMetadataMap.setSakaiTool(mapElement.getAttribute(SAKAI_TOOL)); importMetadataMap.setSakaiServiceName(mapElement.getAttribute(SERVICE_NAME)); if (mapElement.getAttribute(MANDATORY) != null && mapElement.getAttribute(MANDATORY).length() > 0 && mapElement.getAttribute(MANDATORY).endsWith("true")) { importMetadataMap.setMandatory(true); } maps.add(importMetadataMap); } } // import_mapping shall contain only one mapping element, after the // first one is done return return maps; } } } } return null; }
From source file:org.sakaiproject.archive.impl.ImportMetadataServiceImpl.java
public ImportMetadata getImportMapById(String id) { if (LOG.isDebugEnabled()) { LOG.debug("getImportMapById(String" + id + ")"); }// w ww . java 2s . co m if (id == null || id.length() < 1) { throw new IllegalArgumentException("Illegal id argument!"); } if (this.document == null) { LOG.error("No valid document found"); return null; } Element root = document.getDocumentElement(); if (root.getTagName().equals(ROOT)) { NodeList rootNodeList = root.getChildNodes(); final int length = rootNodeList.getLength(); for (int i = 0; i < length; i++) { Node mapping = rootNodeList.item(i); if (mapping.getNodeType() != Node.ELEMENT_NODE) { continue; } Element mappingElement = (Element) mapping; if (mappingElement.getTagName().equals(MAPPINGS)) { NodeList mapNode = mappingElement.getChildNodes(); final int mapLength = mapNode.getLength(); for (int j = 0; j < mapLength; j++) { Node mapNodes = mapNode.item(j); if (mapNodes.getNodeType() != Node.ELEMENT_NODE) { continue; } Element mapElement = (Element) mapNodes; if (mapElement.getTagName().equals(MAP) && mapElement.getAttribute(ID) != null && mapElement.getAttribute(ID).equals(id)) { ImportMetadataImpl importMetadataMap = new ImportMetadataImpl(); importMetadataMap.setId(mapElement.getAttribute(ID)); importMetadataMap.setFileName(mapElement.getAttribute(FILE_NAME)); importMetadataMap.setLegacyTool(mapElement.getAttribute(LEGACY_TOOL)); importMetadataMap.setSakaiTool(mapElement.getAttribute(SAKAI_TOOL)); importMetadataMap.setSakaiServiceName(mapElement.getAttribute(SERVICE_NAME)); if (mapElement.getAttribute(MANDATORY) != null && mapElement.getAttribute(MANDATORY).length() > 0 && mapElement.getAttribute(MANDATORY).endsWith("true")) { importMetadataMap.setMandatory(true); } return importMetadataMap; } } } } } return null; }
From source file:org.sakaiproject.archive.impl.ImportMetadataServiceImpl.java
public boolean hasMaintainRole(String username, Document siteDoc) { if (LOG.isDebugEnabled()) { LOG.debug("hasMaintainRole(Document" + siteDoc + ")"); }//from ww w.j a v a2s . c om if (username == null || username.length() < 1) { throw new IllegalArgumentException("Illegal username argument!"); } if (siteDoc == null) { throw new IllegalArgumentException("Illegal document argument!"); } else { //TODO: Validate the Doc against Site DTD Element root = siteDoc.getDocumentElement(); if (root.getTagName().equals(SITE_ROOT)) { NodeList rootNodeList = root.getChildNodes(); final int length = rootNodeList.getLength(); for (int i = 0; i < length; i++) { Node service = rootNodeList.item(i); if (service.getNodeType() != Node.ELEMENT_NODE) { continue; } Element serviceElement = (Element) service; if (serviceElement.getTagName().equals(SITE_SERVICE) || serviceElement.getTagName().equals(SITE_APPLICATION_ID)) { NodeList siteNodes = serviceElement.getChildNodes(); final int siteNodeLength = siteNodes.getLength(); for (int j = 0; j < siteNodeLength; j++) { Node siteNode = siteNodes.item(j); if (siteNode.getNodeType() != Node.ELEMENT_NODE) { continue; } Element siteElement = (Element) siteNode; if (siteElement.getTagName().equals(SITE)) { NodeList rolesNodes = siteElement.getChildNodes(); final int rolesNodeLength = rolesNodes.getLength(); for (int k = 0; k < rolesNodeLength; k++) { Node rolesNode = rolesNodes.item(k); if (rolesNode.getNodeType() != Node.ELEMENT_NODE) { continue; } Element roleElement = (Element) rolesNode; if (roleElement.getTagName().equals(SITE_ROLES)) { NodeList mtNodes = roleElement.getChildNodes(); final int mtLength = mtNodes.getLength(); for (int l = 0; l < mtLength; l++) { Node mtNode = mtNodes.item(l); if (mtNode.getNodeType() != Node.ELEMENT_NODE) { continue; } Element mtElement = (Element) mtNode; if (mtElement.getTagName().equals(SITE_ROLE_MAINTAIN)) { NodeList abNodes = mtElement.getChildNodes(); final int abLength = abNodes.getLength(); for (int m = 0; m < abLength; m++) { Node abNode = abNodes.item(m); if (abNode.getNodeType() != Node.ELEMENT_NODE) { continue; } Element abElement = (Element) abNode; if (abElement.getTagName().equals(SITE_ROLE_ABILITY)) { String siteUserID = abElement .getAttribute(SITE_ROLE_MAINTAIN_USERID); String userRole = abElement.getAttribute(SITE_ROLE_ID); if (siteUserID != null && siteUserID.trim().length() > 0 && siteUserID.equals(username) && userRole.equals(SITE_ROLE_MAINTAIN)) { return true; } } } } } } } } } } } } } return false; }
From source file:org.sakaiproject.archive.impl.SiteMerger.java
/** * Read in an archive file and merge the entries into the specified site. * @param fileName The site name (for the archive file) to read from. * @param siteId The id of the site to merge the content into. * @param results A buffer to accumulate result messages. * @param attachmentNames A map of old to new attachment names. * @param useIdTrans A map of old WorkTools id to new Ctools id * @param creatorId The creator id/* ww w. jav a 2s.c o m*/ */ protected void processMerge(String fileName, String siteId, StringBuilder results, Map attachmentNames, String creatorId, boolean filterSakaiService, String[] filteredSakaiService, boolean filterSakaiRoles, String[] filteredSakaiRoles) { // correct for windows backslashes fileName = fileName.replace('\\', '/'); if (M_log.isDebugEnabled()) M_log.debug("merge(): processing file: " + fileName); Site theSite = null; try { theSite = m_siteService.getSite(siteId); } catch (IdUnusedException ignore) { M_log.info("Site not found for id:" + siteId + ". New site will be created."); } // read the whole file into a DOM Document doc = Xml.readDocument(fileName); if (doc == null) { results.append("Error reading xml from: " + fileName + "\n"); return; } // verify the root element Element root = doc.getDocumentElement(); if (!root.getTagName().equals("archive")) { results.append("File: " + fileName + " does not contain archive xml. Found this root tag: " + root.getTagName() + "\n"); return; } // get the from site id String fromSite = root.getAttribute("source"); String system = root.getAttribute("system"); // the children NodeList children = root.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element) child; // look for site stuff if (element.getTagName().equals(SiteService.APPLICATION_ID)) { //if the xml file is from WT site, merge it with the translated user ids //if (system.equalsIgnoreCase(ArchiveService.FROM_WT)) // mergeSite(siteId, fromSite, element, userIdTrans, creatorId); //else mergeSite(siteId, fromSite, element, new HashMap()/*empty userIdMap */, creatorId, filterSakaiRoles, filteredSakaiRoles); } else if (element.getTagName().equals(UserDirectoryService.APPLICATION_ID)) { ; // Apparently, users have only been merged in they are from WorkTools... // Is this every going to be wanted in Sakai? // String msg = mergeUsers(element, userIdTrans); // results.append(msg); } else { // we need a site now if (theSite == null) { results.append("Site: " + siteId + " not found.\n"); return; } String serviceName; //Support for attachment.xml created prior to SAK-29456 if (element.getTagName().equals(ContentHostingService.APPLICATION_ID)) { serviceName = "org.sakaiproject.content.api.ContentHostingService"; } else { // get the service name serviceName = translateServiceName(element.getTagName()); } // get the service try { EntityProducer service = (EntityProducer) ComponentManager.get(serviceName); if (service == null) { // find the service using the EntityManager List<EntityProducer> entityProducers = m_entityManager.getEntityProducers(); for (EntityProducer entityProducer : entityProducers) { if (serviceName.equals(entityProducer.getClass().getName()) || serviceName.equals(entityProducer.getLabel())) { service = entityProducer; break; } } } try { String msg = ""; if (service != null) { if ((system.equalsIgnoreCase(ArchiveService.FROM_SAKAI) || system.equalsIgnoreCase(ArchiveService.FROM_SAKAI_2_8))) { if (checkSakaiService(filterSakaiService, filteredSakaiService, serviceName)) { // checks passed so now we attempt to do the merge if (M_log.isDebugEnabled()) M_log.debug("Merging archive data for " + serviceName + " (" + fileName + ") to site " + siteId); msg = service.merge(siteId, element, fileName, fromSite, attachmentNames, new HashMap() /* empty userIdTran map */, usersListAllowImport); } else { M_log.warn("Skipping merge archive data for " + serviceName + " (" + fileName + ") to site " + siteId + ", checked filter failed (filtersOn=" + filterSakaiService + ", filters=" + Arrays.toString(filteredSakaiService) + ")"); } } else { M_log.warn("Skipping archive data for for " + serviceName + " (" + fileName + ") to site " + siteId + ", this does not appear to be a sakai archive"); } } else { M_log.warn("Skipping archive data for for " + serviceName + " (" + fileName + ") to site " + siteId + ", no service (EntityProducer) could be found to deal with this data"); } results.append(msg); } catch (Throwable t) { results.append("Error merging: " + serviceName + " in file: " + fileName + " : " + t.toString() + "\n"); M_log.warn("Error merging: " + serviceName + " in file: " + fileName + " : " + t.toString(), t); } } catch (Throwable t) { results.append("Did not recognize the resource service: " + serviceName + " in file: " + fileName + "\n"); M_log.warn("Did not recognize the resource service: " + serviceName + " in file: " + fileName, t); } } } }
From source file:org.sakaiproject.archive.impl.SiteMerger.java
/** * Merge the site definition from the site part of the archive file into the site service. * Translate the id to the siteId./*from w ww . ja va2 s.c om*/ * @param siteId The id of the site getting imported into. * @param fromSiteId The id of the site the archive was made from. * @param element The XML DOM tree of messages to merge. * @param creatorId The creator id */ protected void mergeSite(String siteId, String fromSiteId, Element element, HashMap useIdTrans, String creatorId, boolean filterSakaiRoles, String[] filteredSakaiRoles) { String source = ""; Node parent = element.getParentNode(); if (parent.getNodeType() == Node.ELEMENT_NODE) { Element parentEl = (Element) parent; source = parentEl.getAttribute("system"); } NodeList children = element.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element element2 = (Element) child; if (!element2.getTagName().equals("site")) continue; NodeList toolChildren = element2.getElementsByTagName("tool"); final int tLength = toolChildren.getLength(); for (int i2 = 0; i2 < tLength; i2++) { Element element3 = (Element) toolChildren.item(i2); String toolId = element3.getAttribute("toolId"); if (toolId != null) { toolId = toolId.replaceAll(old_toolId_prefix, new_toolId_prefix); for (int j = 0; j < old_toolIds.length; j++) { toolId = toolId.replaceAll(old_toolIds[i], new_toolIds[i]); } } element3.setAttribute("toolId", toolId); } // merge the site info first try { m_siteService.merge(siteId, element2, creatorId); mergeSiteInfo(element2, siteId); } catch (Exception any) { M_log.warn(any, any); } Site site = null; try { site = m_siteService.getSite(siteId); } catch (IdUnusedException e) { M_log.warn(this + "The site with id " + siteId + " doesn't exit", e); return; } if (site != null) { NodeList children2 = element2.getChildNodes(); final int length2 = children2.getLength(); for (int i2 = 0; i2 < length2; i2++) { Node child2 = children2.item(i2); if (child2.getNodeType() != Node.ELEMENT_NODE) continue; Element element3 = (Element) child2; if (!element3.getTagName().equals("roles")) continue; try { mergeSiteRoles(element3, siteId, useIdTrans, filterSakaiRoles, filteredSakaiRoles); } catch (PermissionException e1) { M_log.warn(e1, e1); } } } } }
From source file:org.sakaiproject.archive.impl.SiteMerger.java
/** * Merge the the permission-roles settings into the site * @param element The XML DOM tree of messages to merge. * @param siteId The id of the site getting imported into. *///from w w w .j a v a 2 s .c o m protected void mergeSiteRoles(Element el, String siteId, HashMap useIdTrans, boolean filterSakaiRoles, String[] filteredSakaiRoles) throws PermissionException { // heck security (throws if not permitted) unlock(SiteService.SECURE_UPDATE_SITE, m_siteService.siteReference(siteId)); String source = ""; // el: <roles> node Node parent0 = el.getParentNode(); // parent0: <site> node Node parent1 = parent0.getParentNode(); // parent1: <service> node Node parent = parent1.getParentNode(); // parent: <archive> node containing "system" if (parent.getNodeType() == Node.ELEMENT_NODE) { Element parentEl = (Element) parent; source = parentEl.getAttribute("system"); } List roles = new Vector(); //List maintainUsers = new Vector(); //List accessUsers = new Vector(); // to add this user with this role inito this realm String realmId = m_siteService.siteReference(siteId); //SWG "/site/" + siteId; try { AuthzGroup realm = m_authzGroupService.getAuthzGroup(realmId); roles.addAll(realm.getRoles()); NodeList children = el.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element element2 = (Element) child; String roleId = null; if (ArchiveService.FROM_SAKAI_2_8.equals(source)) { if (!"role".equals(element2.getTagName())) continue; roleId = element2.getAttribute("roleId"); } else { roleId = element2.getTagName(); } //SWG Getting rid of WT part above, this was previously the else branch labeled "for both CT classic and Sakai CTools" // check is this roleId is a qualified one if (!checkSystemRole(source, roleId, filterSakaiRoles, filteredSakaiRoles)) continue; NodeList children2 = element2.getChildNodes(); final int length2 = children2.getLength(); for (int i2 = 0; i2 < length2; i2++) { Node child2 = children2.item(i2); if (child2.getNodeType() != Node.ELEMENT_NODE) continue; Element element3 = (Element) child2; if (!element3.getTagName().equals("ability")) continue; String userId = element3.getAttribute("userId"); // this user has a qualified role, his/her resource will be imported usersListAllowImport.add(userId); } } // for } catch (Exception err) { M_log.warn("()mergeSiteRoles realm edit exception caught" + realmId, err); } return; }