XmlUtils.findFirstElement("//*[@id='" + originalId + "']", proposed); if (null == proposedElement && (originalElement.getAttribute("z").equals(calculateUniqueKeyFor(originalElement)) || originalElement .getAttribute("z").equals("?"))) {
|| originalElementHashCode.equals(calculateUniqueKeyFor(originalElement))) { originalElement.setAttribute("z", calculateUniqueKeyFor(proposedElement)); originalDocumentChanged = true;
private boolean isNotUserManaged(final Element element) { return "?".equals(element.getAttribute("z")) || XmlRoundTripUtils.calculateUniqueKeyFor(element).equals( element.getAttribute("z")); }
/** * This method updates tocElement if necessary with correct configuration * * * @param mapElement * @param mapId */ private void updateTocElement(Element tocElement, String zTocValue, String mapId) { String validZTocValue = XmlRoundTripUtils .calculateUniqueKeyFor((Element) tocElement); // Regenerating id if is different String validId = String.format("%s_toc", mapId); if (!tocElement.getAttribute("id").equals(validId)) { tocElement.setAttribute("id", validId); } // Regenerating zValue if is blank if (StringUtils.isBlank(zTocValue)) { tocElement.setAttribute("z", validZTocValue); } }
/** * This method obtains map element from document or create new one if not * exists * * * @param docRoot * @param docXml * @return */ private Element getOrCreateMapElement(Element docRoot, Document docXml, String mapId) { // Getting geo:map element NodeList mapElements = docRoot.getElementsByTagName("geo:map"); Element mapElement = (Element) mapElements.item(0); // If map element not exists, generate new one if (mapElement == null) { mapElement = docXml.createElement("geo:map"); mapElement.setAttribute("id", mapId); mapElement.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(mapElement)); docRoot.appendChild(mapElement); } return mapElement; }
/** * This method updates mapElement if necessary with correct configuration * * * @param mapElement * @param mapId */ private void updateMapElement(Element mapElement, String zValue, String mapId, String projection) { // Getting correct z value String validZValue = XmlRoundTripUtils .calculateUniqueKeyFor((Element) mapElement); // Regenerating zValue if is blank if (StringUtils.isBlank(zValue)) { mapElement.setAttribute("z", validZValue); } // Regenerating id if is different if (!mapElement.getAttribute("id").equals(mapId)) { mapElement.setAttribute("id", mapId); } // Regenerating projection mapElement.setAttribute("projection", projection); }
/** * This method obtains toolbar element from document or create new one if * not exists and append to map parent * * @param docRoot * @param docXml * @param mapElement * @param mapId * @return */ private Element getOrCreateToolbarElement(Element docRoot, Document docXml, Element mapElement, String mapId) { NodeList toolbarElements = docRoot.getElementsByTagName("geo:toolbar"); Element toolbarElement = (Element) toolbarElements.item(0); // If not exists, create new toolbar element if (toolbarElement == null) { toolbarElement = docXml.createElement("geo:toolbar"); toolbarElement.setAttribute("id", String.format("%s_toolbar", mapId)); toolbarElement.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(toolbarElement)); mapElement.appendChild(toolbarElement); } return toolbarElement; }
/** * * This method updates toolbarElement if necessary with correct * configuration * * @param toolbarElement * @param zToolbarValue * @param mapId */ private void updateToolbarElement(Element toolbarElement, String zToolbarValue, String mapId) { String idToolbarValue = toolbarElement.getAttribute("id"); // Regenerating id if necessary if (!idToolbarValue.equals(String.format("%s_toolbar", mapId))) { toolbarElement.setAttribute("id", String.format("%s_toolbar", mapId)); } // Regenerating z value if necessary if (StringUtils.isBlank(zToolbarValue)) { toolbarElement.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(toolbarElement)); } }
/** * This method obtains toc element from document or create new one if not * exists and append to map parent * * @param docRoot * @param docXml * @param mapId * @return */ private Element getOrCreateTocElement(Element docRoot, Document docXml, Element mapElement, String mapId) { NodeList tocElements = docRoot.getElementsByTagName("geo:toc"); Element tocElement = (Element) tocElements.item(0); // If toc element not exists, generate new one if (tocElement == null) { tocElement = docXml.createElement("geo:toc"); tocElement.setAttribute("id", String.format("%s_toc", mapId)); tocElement.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(tocElement)); mapElement.appendChild(tocElement); } return tocElement; }
tileElement.setAttribute("allowDisable", "false"); tileElement.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(tileElement)); tocElement.appendChild(tileElement);
XmlRoundTripUtils.calculateUniqueKeyFor(tool));
XmlRoundTripUtils.calculateUniqueKeyFor(baseLayer));
String.format("%s_MiniMap", mapId)); overViewElement.setAttribute("z", XmlRoundTripUtils .calculateUniqueKeyFor(overViewElement));
map.setAttribute("projection", projection != null ? projection.toString() : "EPSG3857"); map.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(map)); toc.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(toc)); map.appendChild(toc); toolbar.setAttribute("id", String.format("%s_toolbar", mapId)); toolbar.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(toolbar)); map.appendChild(toolbar);
document).addAttribute("id", "_menu").build(); rootMenu.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(rootMenu)); rootElement = (Element) document.getDocumentElement().appendChild( rootMenu); "c_" + lcMenuCategoryName).build()); category.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(category)); properties.put("menu_category_" + lcMenuCategoryName + "_label", menuCategoryName.getReadableSymbolName()); .addAttribute("url", link).build(); menuItem.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(menuItem)); category.appendChild(menuItem);
entityLayer.setAttribute("pk", entityPK); entityLayer.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(entityLayer));
XmlRoundTripUtils.calculateUniqueKeyFor(formUpdate)); div.appendChild(formUpdate);
XmlRoundTripUtils.calculateUniqueKeyFor(pageShow)); XmlRoundTripUtils.calculateUniqueKeyFor(fieldDisplay));
XmlRoundTripUtils.calculateUniqueKeyFor(formCreate)); .addAttribute("dependencies", "${dependencies}").build(); dependency.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(dependency));
XmlRoundTripUtils.calculateUniqueKeyFor(fieldTable)); XmlRoundTripUtils.calculateUniqueKeyFor(columnElement)); fieldTable.appendChild(columnElement); .addChild(fieldTable).build(); pageList.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(pageList)); div.appendChild(pageList);