protected static void setOrdered(IdMap idmap, ArrayList idmapOrdered) { ArrayList Ordered = new ArrayList(); for (Iterator iter_ordered = idmapOrdered.iterator(); iter_ordered.hasNext(); ) { Mapping mapping = new Mapping(); String signature = (String) iter_ordered.next(); int end_of_signature = signature.lastIndexOf(SIGN_SEPARATOR, signature.length() - 2); if (end_of_signature < XMLStructureCreator.ROOT_ID.length() + 1) mapping.setSignature(""); // $NON-NLS-1$ else mapping.setSignature( signature.substring(XMLStructureCreator.ROOT_ID.length() + 1, end_of_signature)); mapping.setElement(signature.substring(end_of_signature + 1, signature.length() - 1)); Ordered.add(mapping); } idmap.setOrdered(Ordered); }
private void fillIdMaps(boolean internal) { HashMap IdMaps = (internal) ? fIdMapsInternal : fIdMaps; HashMap OrderedElements = (internal) ? fOrderedElementsInternal : fOrderedElements; Set IdMapKeys = IdMaps.keySet(); for (Iterator iter_internal = IdMapKeys.iterator(); iter_internal.hasNext(); ) { String IdMapName = (String) iter_internal.next(); Vector Mappings = new Vector(); IdMap idmap = new IdMap(IdMapName, internal, Mappings); // create mappings of internal idmaps HashMap idmapHM = (HashMap) IdMaps.get(IdMapName); Set idmapKeys = idmapHM.keySet(); for (Iterator iter_idmap = idmapKeys.iterator(); iter_idmap.hasNext(); ) { Mapping mapping = new Mapping(); String signature = (String) iter_idmap.next(); int end_of_signature = signature.lastIndexOf(SIGN_SEPARATOR, signature.length() - 2); if (end_of_signature < XMLStructureCreator.ROOT_ID.length() + 1) mapping.setSignature(""); // $NON-NLS-1$ else mapping.setSignature( signature.substring(XMLStructureCreator.ROOT_ID.length() + 1, end_of_signature)); mapping.setElement(signature.substring(end_of_signature + 1, signature.length() - 1)); mapping.setIdAttribute((String) idmapHM.get(signature)); Mappings.add(mapping); } // create ordered mappings ArrayList idmapOrdered = (ArrayList) OrderedElements.get(IdMapName); if (idmapOrdered != null) { setOrdered(idmap, idmapOrdered); } // set extension if (fIdExtensionToName.containsValue(IdMapName)) { Set keySet = fIdExtensionToName.keySet(); String extension = new String(); for (Iterator iter = keySet.iterator(); iter.hasNext(); ) { extension = (String) iter.next(); if (((String) fIdExtensionToName.get(extension)).equals(IdMapName)) break; } idmap.setExtension(extension); } newIdMapsTableItem(idmap, false); } }