public void readData(@NotNull Element element) { final Element editor = element.getChild("editor"); if (editor != null) { final Element keyRepeat = editor.getChild("key-repeat"); if (keyRepeat != null) { final String enabled = keyRepeat.getAttributeValue("enabled"); if (enabled != null) { isKeyRepeat = Boolean.valueOf(enabled); } } } }
public void readData(@NotNull Element element) { final Element conflictsElement = element.getChild(SHORTCUT_CONFLICTS_ELEMENT); if (conflictsElement != null) { final java.util.List<Element> conflictElements = conflictsElement.getChildren(SHORTCUT_CONFLICT_ELEMENT); for (Element conflictElement : conflictElements) { final String ownerValue = conflictElement.getAttributeValue(OWNER_ATTRIBUTE); ShortcutOwner owner = ShortcutOwner.UNDEFINED; try { owner = ShortcutOwner.fromString(ownerValue); } catch (IllegalArgumentException ignored) { } final Element textElement = conflictElement.getChild(TEXT_ELEMENT); if (textElement != null) { final String text = StringHelper.getSafeXmlText(textElement); if (text != null) { final KeyStroke keyStroke = KeyStroke.getKeyStroke(text); if (keyStroke != null) { shortcutConflicts.put(keyStroke, owner); } } } } } }
public static SerializerDefinition readSerializer(Element elmt) { String name = elmt.getChild(STORE_SERIALIZATION_TYPE_ELMT).getText(); boolean hasVersion = true; Map<Integer, String> schemaInfosByVersion = new HashMap<Integer, String>(); for(Object schemaInfo: elmt.getChildren(STORE_SERIALIZATION_META_ELMT)) { Element schemaInfoElmt = (Element) schemaInfo; String versionStr = schemaInfoElmt.getAttributeValue(STORE_VERSION_ATTR); int version; if(versionStr == null) { version = Integer.parseInt(versionStr); String info = schemaInfoElmt.getText(); String previous = schemaInfosByVersion.put(version, info); if(previous != null) throw new IllegalArgumentException("Specified multiple schemas AND version=none, which is not permitted."); Element compressionElmt = elmt.getChild(STORE_COMPRESSION_ELMT); Compression compression = null; if(compressionElmt != null) compression = new Compression(compressionElmt.getChildText("type"), compressionElmt.getChildText("options")); return new SerializerDefinition(name, schemaInfosByVersion, hasVersion, compression);
private void readRequiredEmployeeSizes(NurseRoster nurseRoster, Element coverRequirementsElement) { List<Element> coverRequirementElementList = (List<Element>) coverRequirementsElement.getChildren(); for (Element element : coverRequirementElementList) { if (element.getName().equals("DayOfWeekCover")) { Element dayOfWeekElement = element.getChild("Day"); DayOfWeek dayOfWeek = null; for (DayOfWeek possibleDayOfWeek : DayOfWeek.values()) { if (possibleDayOfWeek.name().equalsIgnoreCase(dayOfWeekElement.getText())) { dayOfWeek = possibleDayOfWeek; break; List<Element> coverElementList = (List<Element>) element.getChildren("Cover"); for (Element coverElement : coverElementList) { Element shiftTypeElement = coverElement.getChild("Shift"); ShiftType shiftType = shiftTypeMap.get(shiftTypeElement.getText()); + ") of an entity DayOfWeekCover does not have any shifts."); int requiredEmployeeSize = Integer.parseInt(coverElement.getChild("Preferred").getText()); for (Shift shift : shiftList) { shift.setRequiredEmployeeSize(shift.getRequiredEmployeeSize() + requiredEmployeeSize); Element dateElement = element.getChild("Date"); List<Element> coverElementList = (List<Element>) element.getChildren("Cover"); for (Element coverElement : coverElementList) { Element shiftTypeElement = coverElement.getChild("Shift"); int requiredEmployeeSize = Integer.parseInt(coverElement.getChild("Preferred").getText()); shift.setRequiredEmployeeSize(shift.getRequiredEmployeeSize() + requiredEmployeeSize);
private void readData(@NotNull Element element, String key) { HistoryBlock block = histories.get(key); if (block != null) { return; } block = new HistoryBlock(); histories.put(key, block); final Element root = element.getChild("history-" + key); if (root != null) { //noinspection unchecked List<Element> items = root.getChildren("entry"); for (Element item : items) { final String text = StringHelper.getSafeXmlText(item); if (text != null) { block.addEntry(text); } } } }
private void extractDescriptions(Element element, AbstractBaseBean bean) { Element descrElement = element.getChild("description"); if (null != descrElement) { bean.setDescription(descrElement.getText()); bean.setDescriptionKey(descrElement.getAttributeValue("key")); } Element longdescElement = element.getChild("longdesc"); if (null != longdescElement) { bean.setLongDescription(longdescElement.getText()); bean.setLongDescriptionKey(longdescElement.getAttributeValue("key")); } }
public String getWorkspace() { Element rootLayer = rootElem.getChild("workspace"); if (rootLayer != null) { return rootLayer.getChildText("name"); } else { return null; } }
private static String getTagElement(Element elem, String tagName) { if (elem != null && elem.getChild(tagName, elem.getNamespace("sla")) != null) { return elem.getChild(tagName, elem.getNamespace("sla")).getText() .trim(); } else { return null; } }
/** * Return the sharelib name for the action. * * @return returns <code>streaming</code> if mapreduce-streaming action, <code>NULL</code> otherwise. * @param actionXml */ @Override protected String getDefaultShareLibName(Element actionXml) { Namespace ns = actionXml.getNamespace(); return (actionXml.getChild("streaming", ns) != null) ? "mapreduce-streaming" : null; }
private String findNamedWorkflowInstanceContainerFactory(Element rootElement) { String result=null; Element named = rootElement.getChild("namedcomponents"); if (named!=null) { List<Element> namedComponents = named.getChildren("namedcomponent"); for (Element namedComponent : namedComponents) { String className=namedComponent.getChildTextTrim("classname"); if (className!=null && className.equals("org.embl.ebi.escience.scuflui.WorkflowInstanceContainerFactory")) { result=namedComponent.getChildText("name"); break; } } } return result; }
@SuppressWarnings("unchecked") public Configuration getActionConf(CoordinatorActionBean actionBean) throws JDOMException { Configuration conf = new XConfiguration(); Element eAction = XmlUtils.parseXml(actionBean.getActionXml()); Element configElem = eAction.getChild("action", eAction.getNamespace()) .getChild("workflow", eAction.getNamespace()).getChild("configuration", eAction.getNamespace()); List<Element> elementList = configElem.getChildren("property", eAction.getNamespace()); for (Element element : elementList) { conf.set(((Element) element.getChildren().get(0)).getText(), ((Element) element.getChildren().get(1)).getText()); } return conf; }
private void injectConfigClass(Configuration conf, Element actionXml) { // Inject config-class for launcher to use for action Element e = actionXml.getChild("config-class", actionXml.getNamespace()); if (e != null) { conf.set(LauncherAMUtils.OOZIE_ACTION_CONFIG_CLASS, e.getTextTrim()); } }
protected java.util.List decodeHistory (final org.jdom.Element elt) { java.util.List history = new java.util.ArrayList(7); org.jdom.Element hElt = elt.getChild(HISTORY, elt.getNamespace()); if (hElt == null) return history; java.util.Iterator it = hElt .getChildren(HISTORY_ITEM, elt.getNamespace()) .iterator(); while (it.hasNext()) history.add(decodeHistoryItem((org.jdom.Element)it.next())); return history; }
public static Map loadMapping(String fileName, String nodeName, String keyName, String valueName) { Map map = new HashMap(); FileLocator fileLocator = new FileLocator(); try { String xmlFile = fileLocator.getConfFile(fileName); Debug.logVerbose("[JdonFramework] mapping file:" + xmlFile, module); SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(new File(xmlFile)); Debug.logVerbose("[JdonFramework] got mapping file ", module); // Get the root element Element root = doc.getRootElement(); List mappings = root.getChildren(nodeName); Iterator i = mappings.iterator(); while (i.hasNext()) { Element mapping = (Element) i.next(); String key = mapping.getChild(keyName).getTextTrim(); String value = mapping.getChild(valueName).getTextTrim(); Debug.logVerbose("[JdonFramework] get the " + key + "=" + value, module); map.put(key, value); } Debug.logVerbose("[JdonFramework] read finished", module); } catch (Exception ex) { Debug.logError("[JdonFramework] error: " + ex, module); } return map; }
public void readData(@NotNull Element element) { logger.debug("readData"); Element search = element.getChild("search"); if (search == null) { return; } lastSearch = getSafeChildText(search, "last-search"); lastOffset = getSafeChildText(search, "last-offset"); lastPattern = getSafeChildText(search, "last-pattern"); lastReplace = getSafeChildText(search, "last-replace"); lastSubstitute = getSafeChildText(search, "last-substitute"); Element dir = search.getChild("last-dir"); lastDir = Integer.parseInt(dir.getText()); Element show = search.getChild("show-last"); final ListOption vimInfo = Options.getInstance().getListOption(Options.VIMINFO); final boolean disableHighlight = vimInfo != null && vimInfo.contains("h"); showSearchHighlight = !disableHighlight && Boolean.valueOf(show.getText()); if (logger.isDebugEnabled()) { logger.debug("show=" + show + "(" + show.getText() + ")"); logger.debug("showSearchHighlight=" + showSearchHighlight); } }
private void doChmodOperation(Context context, XConfiguration fsConf, Path nameNodePath, Element commandElement) throws ActionExecutorException { Path path = getPath(commandElement, FS_TAG_PATH); String permissionsTag = commandElement.getAttributeValue(FS_TAG_PERMISSIONS).trim(); String dirFilesTag = commandElement.getAttributeValue(FS_TAG_DIRFILES); boolean dirFiles = (dirFilesTag == null) || Boolean.parseBoolean(dirFilesTag); boolean recursive = commandElement.getChild(FS_TAG_RECURSIVE, commandElement.getNamespace()) != null; chmod(context, fsConf, nameNodePath, path, permissionsTag, dirFiles, recursive); }
private void validateGroundOverlay(String name, Object overlay, Namespace namespace) { Element groundOverlay = (Element) overlay; assertEquals("GroundOverlay", groundOverlay.getName()); assertEquals(3, groundOverlay.getChildren().size()); assertEquals(name, groundOverlay.getChildText("name", namespace)); Element icon = groundOverlay.getChild("Icon", namespace); assertEquals(name + ".png", icon.getChildText("href", namespace)); final Element latLonBox = groundOverlay.getChild("LatLonBox", namespace); assertNotNull(latLonBox); assertEquals("70.0", latLonBox.getChildText("north", namespace)); assertEquals("30.0", latLonBox.getChildText("south", namespace)); assertEquals("20.0", latLonBox.getChildText("east", namespace)); assertEquals("0.0", latLonBox.getChildText("west", namespace)); }
private StoreDefinition readView(Element store, List<StoreDefinition> stores) { String name = store.getChildText(STORE_NAME_ELMT); String targetName = store.getChildText(VIEW_TARGET_ELMT); String description = store.getChildText(STORE_DESCRIPTION_ELMT); String ownerText = store.getChildText(STORE_OWNERS_ELMT); List<String> owners = Lists.newArrayList(); if(store.getChildText(VIEW_SERIALIZER_FACTORY_ELMT) != null) { viewSerializerFactoryName = store.getChild(VIEW_SERIALIZER_FACTORY_ELMT).getText(); if(store.getChild(STORE_VALUE_SERIALIZER_ELMT) != null) valueSerializer = readSerializer(store.getChild(STORE_VALUE_SERIALIZER_ELMT)); if(store.getChild(STORE_TRANSFORM_SERIALIZER_ELMT) != null) transformSerializer = readSerializer(store.getChild(STORE_TRANSFORM_SERIALIZER_ELMT));
private DocAffiliation restoreAffiliation(Element root) { DocAffiliation affiliation = new DocAffiliation(); affiliation.setKey(root.getAttributeValue(MetadataDumpConstants.A_KEY)); Element e = root.getChild(MetadataDumpConstants.E_TEXT); if (e != null) affiliation.setText(e.getTextTrim()); return affiliation; }
shiftOffRequestList = Collections.emptyList(); } else { List<Element> shiftOffElementList = (List<Element>) shiftOffRequestsElement.getChildren(); shiftOffRequestList = new ArrayList<>(shiftOffElementList.size()); long id = 0L; shiftOffRequest.setId(id); Element employeeElement = element.getChild("EmployeeID"); Employee employee = employeeMap.get(employeeElement.getText()); if (employee == null) { throw new IllegalArgumentException("The shift (" + employeeElement.getText() + ") of shiftOffRequest (" + shiftOffRequest + ") does not exist."); Element dateElement = element.getChild("Date"); Element shiftTypeElement = element.getChild("ShiftTypeID"); LocalDate date = LocalDate.parse(dateElement.getText(), DateTimeFormatter.ISO_DATE); Shift shift = dateAndShiftTypeToShiftMap.get(Pair.of(date, shiftTypeElement.getText())); if (shift == null) {