/** * Returns the XML element for this repository * * @param document the document in which to create the element (required) * @param tagName the name of the element to create (required) * @return a non-<code>null</code> element * @since 1.2.0 */ public Element getElement(final Document document, final String tagName) { final Element repositoryElement = new XmlElementBuilder(tagName, document) .addChild(new XmlElementBuilder("id", document).setText(id).build()) .addChild(new XmlElementBuilder("url", document).setText(url).build()).build(); if (name != null) { repositoryElement.appendChild(new XmlElementBuilder("name", document).setText(name).build()); } if (enableSnapshots) { repositoryElement.appendChild(new XmlElementBuilder("snapshots", document).addChild( new XmlElementBuilder("enabled", document).setText("true").build()).build()); } return repositoryElement; }
/** * Set session timeout in web.xml document * * @param timeout * @param document (required) * @param comment (optional) */ public static void setSessionTimeout(final int timeout, final Document document, final String comment) { Validate.notNull(document, "Web XML document required"); Validate.notNull(timeout, "Timeout required"); Element sessionConfigElement = XmlUtils.findFirstElement(WEB_APP_XPATH + "session-config", document.getDocumentElement()); if (sessionConfigElement == null) { sessionConfigElement = document.createElement("session-config"); insertBetween(sessionConfigElement, "servlet-mapping[last()]", "welcome-file-list", document); if (StringUtils.isNotBlank(comment)) { addCommentBefore(sessionConfigElement, comment, document); } } appendChildIfNotPresent(sessionConfigElement, new XmlElementBuilder("session-timeout", document).setText(String.valueOf(timeout)).build()); }
.appendChild(new XmlElementBuilder("div", document) .addAttribute("xmlns:form", "urn:jsptagdir:/WEB-INF/tags/form") .addAttribute("xmlns:field", "urn:jsptagdir:/WEB-INF/tags/form/fields") .addAttribute("xmlns:jsp", "http://java.sun.com/JSP/Page") .addAttribute("version", "2.0") .addChild( new XmlElementBuilder("jsp:directive.page", document).addAttribute("contentType", "text/html;charset=UTF-8").build()) .addChild( new XmlElementBuilder("jsp:output", document) .addAttribute("omit-xml-declaration", "yes").build()).build()); final Element formUpdate = new XmlElementBuilder("form:update", document) .addAttribute( "id", XmlUtils.convertId("fu:" + formBackingType.getFullyQualifiedTypeName())) .addAttribute("modelAttribute", entityName).build();
form.appendChild(new XmlElementBuilder("div", loginJspxDoc) .addChild( loginJspxDoc .createTextNode("<br/><a href =\"/" .concat(contextPath) .concat("/signup?form\">Sign Up</a>"))) .build()); out = mutableLoginJspx.getOutputStream(); XmlUtils.writeXml(out, loginJspxDoc);
Element messageDigestPasswordEncoder = new XmlElementBuilder( "beans:bean", webConfigDoc) .addAttribute("id", "messageDigestPasswordEncoder") .addAttribute( "class", "org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder") .addChild( new XmlElementBuilder("beans:constructor-arg", webConfigDoc).addAttribute("value", "sha-256") .build()).build();
Element insertAttributeBodyElement = XmlUtils.findFirstElement( "/html/body/div/div/insertAttribute[@name='body']", lsHtml); Element messageBox = new XmlElementBuilder("dialog:message-box", defaultJspxXml).build(); divMain.insertBefore(messageBox, insertAttributeBodyElement);
.appendChild(new XmlElementBuilder("div", document) .addAttribute("xmlns:page", "urn:jsptagdir:/WEB-INF/tags/form") .addAttribute("xmlns:field", "urn:jsptagdir:/WEB-INF/tags/form/fields") .addAttribute("xmlns:jsp", "http://java.sun.com/JSP/Page") .addAttribute("version", "2.0") .addChild( new XmlElementBuilder("jsp:directive.page", document).addAttribute("contentType", "text/html;charset=UTF-8").build()) .addChild( new XmlElementBuilder("jsp:output", document) .addAttribute("omit-xml-declaration", "yes").build()).build()); final Element pageShow = new XmlElementBuilder("page:show", document) .addAttribute( "id", XmlUtils.convertId("ps:" + formBackingType.getFullyQualifiedTypeName())) .addAttribute("object", "${" + entityName.toLowerCase() + "}") .addAttribute("path", controllerPath).build(); if (!webScaffoldAnnotationValues.isCreate()) { pageShow.setAttribute("create", "false"); final Element fieldDisplay = new XmlElementBuilder("field:display", document)
/** * Add a welcome file definition to web.xml document * * @param path (required) * @param document (required) * @param comment (optional) */ public static void addWelcomeFile(final String path, final Document document, final String comment) { Validate.notNull(document, "Web XML document required"); Validate.notBlank("Path required"); Element welcomeFileElement = XmlUtils.findFirstElement(WEB_APP_XPATH + "welcome-file-list", document.getDocumentElement()); if (welcomeFileElement == null) { welcomeFileElement = document.createElement("welcome-file-list"); insertBetween(welcomeFileElement, "session-config[last()]", "error-page", document); if (StringUtils.isNotBlank(comment)) { addCommentBefore(welcomeFileElement, comment, document); } } appendChildIfNotPresent(welcomeFileElement, new XmlElementBuilder("welcome-file", document) .setText(path).build()); }
/** * Add listener element to web.xml document * * @param className the fully qualified name of the listener type (required) * @param document (required) * @param comment (optional) */ public static void addListener(final String className, final Document document, final String comment) { Validate.notNull(document, "Web XML document required"); Validate.notBlank(className, "Class name required"); Element listenerElement = XmlUtils.findFirstElement(WEB_APP_XPATH + "listener[listener-class = '" + className + "']", document.getDocumentElement()); if (listenerElement == null) { listenerElement = new XmlElementBuilder("listener", document).addChild( new XmlElementBuilder("listener-class", document).setText(className).build()).build(); insertBetween(listenerElement, "filter-mapping[last()]", "servlet", document); if (StringUtils.isNotBlank(comment)) { addCommentBefore(listenerElement, comment, document); } } }
.appendChild(new XmlElementBuilder("div", document) .addAttribute("xmlns:form", "urn:jsptagdir:/WEB-INF/tags/form") .addAttribute("xmlns:field", "urn:jsptagdir:/WEB-INF/tags/form/fields") .addAttribute("xmlns:jsp", "http://java.sun.com/JSP/Page") .addAttribute("xmlns:c", "http://java.sun.com/jsp/jstl/core") .addAttribute("xmlns:spring", .addChild( new XmlElementBuilder("jsp:directive.page", document).addAttribute("contentType", "text/html;charset=UTF-8").build()) .addChild( new XmlElementBuilder("jsp:output", document) .addAttribute("omit-xml-declaration", "yes").build()).build()); final Element formCreate = new XmlElementBuilder("form:create", document) .addAttribute( "id", XmlUtils.convertId("fc:" + formBackingType.getFullyQualifiedTypeName())) .addAttribute("modelAttribute", entityName) .addAttribute("path", controllerPath) .addAttribute("render", "${empty dependencies}").build();
"/project/build/plugins/plugin[artifactId = 'maven-bundle-plugin']/configuration/instructions", root); config.appendChild(new XmlElementBuilder("Import-Package", pom).setText(osgiImports).build());
/** * Add error code to web.xml document * * @param errorCode (required) * @param location (required) * @param document (required) * @param comment (optional) */ public static void addErrorCode(final Integer errorCode, final String location, final Document document, final String comment) { Validate.notNull(document, "Web XML document required"); Validate.notNull(errorCode, "Error code required"); Validate.notBlank(location, "Location required"); Element errorPageElement = XmlUtils.findFirstElement( WEB_APP_XPATH + "error-page[error-code = '" + errorCode.toString() + "']", document.getDocumentElement()); if (errorPageElement == null) { errorPageElement = new XmlElementBuilder("error-page", document).addChild( new XmlElementBuilder("error-code", document).setText(errorCode.toString()).build()) .build(); insertBetween(errorPageElement, "welcome-file-list[last()]", "the-end", document); if (StringUtils.isNotBlank(comment)) { addCommentBefore(errorPageElement, comment, document); } } appendChildIfNotPresent(errorPageElement, new XmlElementBuilder("location", document).setText(location).build()); }
categoryName.toLowerCase()).concat("_label"); category = (Element) rootElement.appendChild(new XmlElementBuilder( MENU_ITEM, document) .addAttribute("id", categoryId.toString()) .addAttribute("name", categoryName) .addAttribute(LABEL_CODE, categoryLabelCode).build()); Element menuItem = new XmlElementBuilder(MENU_ITEM, document) .addAttribute("id", idPrefix.concat(itemId.toString())) .addAttribute(LABEL_CODE, itemLabelCode) .addAttribute( MESSAGE_CODE, StringUtils.isNotBlank(globalMessageCode) ? globalMessageCode : "") .addAttribute(URL, StringUtils.isNotBlank(link) ? link : "") .addAttribute(HIDDEN, Boolean.toString(hide)) .addAttribute("roles", StringUtils.isNotBlank(roles) ? roles : "").build();
if (scopeElement == null) { if (dependencyScope != null) { dependencyElement.appendChild(new XmlElementBuilder("scope", document).setText( dependencyScope.name().toLowerCase()).build()); descriptionOfChange = highlight(ADDED + " scope") + " " + dependencyScope.name().toLowerCase()
/** * Add exception type to web.xml document * * @param exceptionType fully qualified exception type name (required) * @param location (required) * @param document (required) * @param comment (optional) */ public static void addExceptionType(final String exceptionType, final String location, final Document document, final String comment) { Validate.notNull(document, "Web XML document required"); Validate.notBlank(exceptionType, "Fully qualified exception type name required"); Validate.notBlank(location, "location required"); Element errorPageElement = XmlUtils.findFirstElement(WEB_APP_XPATH + "error-page[exception-type = '" + exceptionType + "']", document.getDocumentElement()); if (errorPageElement == null) { errorPageElement = new XmlElementBuilder("error-page", document).addChild( new XmlElementBuilder("exception-type", document).setText(exceptionType).build()) .build(); insertBetween(errorPageElement, "welcome-file-list[last()]", "the-end", document); if (StringUtils.isNotBlank(comment)) { addCommentBefore(errorPageElement, comment, document); } } appendChildIfNotPresent(errorPageElement, new XmlElementBuilder("location", document).setText(location).build()); }
document.getFirstChild()); if (rootElement == null) { final Element rootMenu = new XmlElementBuilder("menu:menu", document).addAttribute("id", "_menu").build(); rootMenu.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(rootMenu)); category = (Element) rootElement.appendChild(new XmlElementBuilder( "menu:category", document).addAttribute("id", "c_" + lcMenuCategoryName).build()); category.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(category)); + menuItemId.getSymbolName().toLowerCase() + "']", rootElement); if (menuItem == null) { menuItem = new XmlElementBuilder("menu:item", document) .addAttribute( "id", idPrefix + lcMenuCategoryName + "_" + menuItemId.getSymbolName().toLowerCase()) .addAttribute("messageCode", globalMessageCode) .addAttribute("url", link).build(); menuItem.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(menuItem));
/** * Add a context param to the web.xml document * * @param contextParam (required) * @param document the web.xml document (required) * @param comment (optional) */ public static void addContextParam(final WebXmlParam contextParam, final Document document, final String comment) { Validate.notNull(document, "Web XML document required"); Validate.notNull(contextParam, "Context param required"); Element contextParamElement = XmlUtils.findFirstElement( WEB_APP_XPATH + "context-param[param-name = '" + contextParam.getName() + "']", document.getDocumentElement()); if (contextParamElement == null) { contextParamElement = new XmlElementBuilder("context-param", document) .addChild( new XmlElementBuilder("param-name", document).setText(contextParam.getName()) .build()).build(); insertBetween(contextParamElement, "description[last()]", "filter", document); if (StringUtils.isNotBlank(comment)) { addCommentBefore(contextParamElement, comment, document); } } appendChildIfNotPresent(contextParamElement, new XmlElementBuilder("param-value", document) .setText(contextParam.getValue()).build()); }
.findFirstElement("/beans/view-controller", document.getDocumentElement()); final Element view = new XmlElementBuilder( "mvc:view-controller", document).addAttribute("path", prefixedUrl).build(); if (sibling != null) { sibling.getParentNode().insertBefore(view, sibling);
if (servletElement == null) { servletElement = new XmlElementBuilder("servlet", document).addChild( new XmlElementBuilder("servlet-name", document).setText(servletName).build()).build(); insertBetween(servletElement, "listener[last()]", "servlet-mapping", document); if (comment != null && comment.length() > 0) { appendChildIfNotPresent(servletElement, new XmlElementBuilder("servlet-class", document) .setText(className).build()); for (final WebXmlParam initParam : initParams) { appendChildIfNotPresent( servletElement, new XmlElementBuilder("init-param", document) .addChild( new XmlElementBuilder("param-name", document).setText(initParam.getName()) .build()) .addChild( new XmlElementBuilder("param-value", document).setText(initParam.getValue()) .build()).build()); appendChildIfNotPresent(servletElement, new XmlElementBuilder("load-on-startup", document) .setText(loadOnStartup.toString()).build()); if (servletMappingElement == null) { servletMappingElement = new XmlElementBuilder("servlet-mapping", document).addChild( new XmlElementBuilder("servlet-name", document).setText(servletName).build()).build(); insertBetween(servletMappingElement, "servlet[last()]", "session-config", document);
.appendChild(new XmlElementBuilder("div", document) .addAttribute("xmlns:form", "urn:jsptagdir:/WEB-INF/tags/form") .addAttribute("xmlns:field", "urn:jsptagdir:/WEB-INF/tags/form/fields") .addAttribute("xmlns:jsp", "http://java.sun.com/JSP/Page") .addAttribute("version", "2.0") .addChild( new XmlElementBuilder("jsp:directive.page", document).addAttribute("contentType", "text/html;charset=UTF-8").build()) .addChild( new XmlElementBuilder("jsp:output", document) .addAttribute("omit-xml-declaration", "yes").build()).build()); final Element formFind = new XmlElementBuilder("form:find", document) .addAttribute( "id", XmlUtils.convertId("ff:" + formBackingType.getFullyQualifiedTypeName())) .addAttribute("path", controllerPath) .addAttribute( "finderName", finderMetadataDetails .getPersistenceDetails(); if (typePersistenceMetadataHolder != null) {