public Artifact(Element xml) { if ("project".equals(xml.getNodeName())) { Element parent = MXml.getElementByPath(xml, "parent"); if (parent != null) { groupId = MXml.getValue(parent, "groupId", groupId); version = MXml.getValue(parent, "version", version); } } artifactId = MXml.getValue(xml, "artifactId", artifactId); groupId = MXml.getValue(xml, "groupId", groupId); version = MXml.getValue(xml, "version", version); type = MXml.getValue(xml, "packaging", type); if (type == null) type = MXml.getValue(xml, "type", null); if (type.equals("bundle")) type = "jar"; }
@Override public String getProperty(String key) { if (element==null || key==null) return null; if (VALUE.equals(key)) { // special key return MXml.getValue(element, false); } String out = element.getAttribute(key); if ( out == null || out.length() == 0 ) return null; return out; }
public static String getValue(Element root, String path, String def) { Element ele = getElementByPath(root, path); if (ele == null) return def; return getValue(ele, false); }
/** * Returns the text value of a node. * * @param root The element where you need the text value from * @param inner If true all inner elements are parsed and the text appended * @return null if root is null or the text of the element */ public static String getValue(Element root, boolean inner) { if (root == null) return null; NodeList raw = root.getChildNodes(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < raw.getLength(); i++) { if (raw.item(i).getNodeType() == Node.ELEMENT_NODE && inner) sb.append(getValue((Element) raw.item(i), inner)); else if (raw.item(i).getNodeType() == Node.TEXT_NODE) sb.append(raw.item(i).getNodeValue()); else if (raw.item(i).getNodeType() == Node.CDATA_SECTION_NODE) sb.append(raw.item(i).getNodeValue()); } return sb.toString(); }
/** * Returns the text value of a node. The listener manipulates the output for different inner notes. * * @param root * @param listener * @return null if the root is null or the text */ public static String getValue(Element root, ValueListener listener) { if (root == null) return null; NodeList raw = root.getChildNodes(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < raw.getLength(); i++) { if (raw.item(i).getNodeType() == Node.ELEMENT_NODE) { sb.append(listener.valueOf( (Element)raw.item(i), getValue((Element) raw.item(i), listener ) ) ); } else if (raw.item(i).getNodeType() == Node.TEXT_NODE) sb.append(raw.item(i).getNodeValue()); } return sb.toString(); }
void doUpdate(Element xml) { id = xml.getAttribute("id"); name = xml.getAttribute("name"); incoming.clear(); for (Element eIn : MXml.getLocalElementIterator(xml, "bpmn2:incoming")) { String ref = MXml.getValue(eIn, false); if (ref.startsWith(XElement.SEQUENCE_FLOW)) { ref = ref.substring(XElement.SEQUENCE_FLOW.length()); ref = MString.beforeIndex(ref, '_'); } incoming.add(ref); } outgoing.clear(); for (Element eOut : MXml.getLocalElementIterator(xml, "bpmn2:outgoing")) { String ref = MXml.getValue(eOut, false); if (ref.startsWith(XElement.SEQUENCE_FLOW)) { ref = ref.substring(XElement.SEQUENCE_FLOW.length()); ref = MString.afterIndex(ref, '_'); } outgoing.add(ref); } }
public static String getLocalRepositoryLocation() { if (repositoryLocation != null) return repositoryLocation; repositoryLocation = CFG_MAVEN_LOCAL_REPO.value(); if (repositoryLocation == null) { // from settings try { List<Element> list = getConfigElements("localRepository"); if (list.size() > 0) repositoryLocation = MXml.getValue(list.get(0), false); } catch (Throwable t) {} } if (repositoryLocation == null) { // default location repositoryLocation = "${user.home}/.m2/repository"; } if (repositoryLocation != null) { repositoryLocation = replacer.process(repositoryLocation); } return repositoryLocation; }
outgoingRef = MXml.getValue(eOutgoing, false);
String id = MXml.getValue(repo, "id", ""); boolean hasReleases = MCast.toboolean(MXml.getValue(repo, "releases/enabled","true"), false); boolean hasStapshots = MCast.toboolean(MXml.getValue(repo, "snapshots/enabled","true"), false); String url = MXml.getValue(repo, "url", null); if (url == null) continue; String protocol = MString.beforeIndex(url, ':'); String[] rules = MXml.getValue(mirror, "mirrorOf", "").split(","); boolean ok = false; for (String rule : rules) { useMirrorId = MXml.getValue(useMirror, "id", ""); url = MXml.getValue(useMirror, "url", null); protocol = MString.beforeIndex(url, ':'); break; if (!MXml.getValue(proxy, "active", "").equals("true")) continue; if (protocol.equals(MXml.getValue(proxy, "protocol", ""))) { useProxy = proxy; useProxyId = MXml.getValue(useProxy, "host", ""); break; MHttpClientBuilder client = new MHttpClientBuilder(); if (useProxy != null) { client.setProxyHost(MXml.getValue(useProxy, "host", "")); client.setProxyPort(MCast.toint(MXml.getValue(useProxy, "port", "3128"), 3128));
elements.put(eLane.getAttribute("id"), entry); for (Element eRef : MXml.getLocalElementIterator(eLane, "bpmn2:flowNodeRef")) { laneRefs.put(MXml.getValue(eRef, false), entry.getId());