Refine search
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>(); 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)
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; throw new IllegalArgumentException("The dayOfWeek (" + dayOfWeekElement.getText() + ") of an entity DayOfWeekCover does not exist."); Element shiftTypeElement = coverElement.getChild("Shift"); ShiftType shiftType = shiftTypeMap.get(shiftTypeElement.getText()); if (shiftType == null) { if (shiftTypeElement.getText().equals("Any")) { throw new IllegalStateException("The shiftType Any is not supported on DayOfWeekCover."); } else if (shiftTypeElement.getText().equals("None")) { throw new IllegalStateException("The shiftType None is not supported on DayOfWeekCover."); } else { throw new IllegalArgumentException("The shiftType (" + shiftTypeElement.getText() + ") of an entity DayOfWeekCover does not exist."); List<Shift> shiftList = dayOfWeekAndShiftTypeToShiftListMap.get(key); if (shiftList == null) { throw new IllegalArgumentException("The dayOfWeek (" + dayOfWeekElement.getText() + ") with the shiftType (" + shiftTypeElement.getText() + ") of an entity DayOfWeekCover does not have any shifts.");
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); } }
/** * Loads {@link UserTemplate} objects from the {@link Element}. * * @param element source * @return {@link UserTemplate} list */ @NotNull public static List<UserTemplate> loadTemplates(@NotNull Element element) { final String key = KEY.USER_TEMPLATES.toString(); final List<UserTemplate> list = ContainerUtil.newArrayList(); if (!key.equals(element.getName())) { element = element.getChild(key); } for (Element template : element.getChildren()) { list.add(new UserTemplate( template.getAttributeValue(KEY.USER_TEMPLATES_NAME.toString()), template.getText() )); } return list; }
Element zoneReplicationFactorNode = store.getChild(STORE_ZONE_REPLICATION_FACTOR_ELMT); if(zoneReplicationFactorNode != null) { zoneReplicationFactor = new HashMap<Integer, Integer>(); for(Element node: (List<Element>) zoneReplicationFactorNode.getChildren(STORE_REPLICATION_FACTOR_ELMT)) { int zone = Integer.parseInt(node.getAttribute(STORE_ZONE_ID_ELMT).getValue()); int repFactor = Integer.parseInt(node.getText()); zoneReplicationFactor.put(zone, repFactor); Integer retentionFreqDays = null; if(retention != null) { int retentionDays = Integer.parseInt(retention.getText()); if(retentionDays > 0) { retentionPolicyDays = retentionDays; Element throttleRate = store.getChild(STORE_RETENTION_SCAN_THROTTLE_RATE_ELMT); if(throttleRate != null) retentionThrottleRate = Integer.parseInt(throttleRate.getText()); Element retentionFreqDaysElement = store.getChild(STORE_RETENTION_FREQ_ELMT); if(retentionFreqDaysElement != null) retentionFreqDays = Integer.parseInt(retentionFreqDaysElement.getText()); } else { logger.error("Invalid retention policy days set. Should be greater than zero. ignoring value "
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) { throw new IllegalArgumentException("The date (" + dateElement.getText() + ") or the shiftType (" + shiftTypeElement.getText() + ") of shiftOffRequest (" + shiftOffRequest + ") does not exist.");
@SuppressWarnings("unchecked") private static Context parseLanguages(Context src, Element languages){ src.enableMultiLanguageSupport(); Element supportedLanguages = languages.getChild("supported"); List<Element> supLangs = supportedLanguages.getChildren("language"); for (Element e: supLangs){ src.addLanguage(e.getText()); } String defLang = languages.getChild("default").getChildText("language"); src.setDefaultLanguage(defLang); return src; }
shiftOnRequest.setId(id); Element employeeElement = element.getChild("EmployeeID"); Employee employee = employeeMap.get(employeeElement.getText()); if (employee == null) { throw new IllegalArgumentException("The shift (" + employeeElement.getText() + ") of shiftOnRequest (" + shiftOnRequest + ") 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) { throw new IllegalArgumentException("The date (" + dateElement.getText() + ") or the shiftType (" + shiftTypeElement.getText() + ") of shiftOnRequest (" + shiftOnRequest + ") does not exist.");
dayOnRequest.setId(id); Element employeeElement = element.getChild("EmployeeID"); Employee employee = employeeMap.get(employeeElement.getText()); if (employee == null) { throw new IllegalArgumentException("The shiftDate (" + employeeElement.getText() + ") of dayOnRequest (" + dayOnRequest + ") does not exist."); Element dateElement = element.getChild("Date"); ShiftDate shiftDate = shiftDateMap.get(LocalDate.parse(dateElement.getText(), DateTimeFormatter.ISO_DATE)); if (shiftDate == null) { throw new IllegalArgumentException("The date (" + dateElement.getText() + ") of dayOnRequest (" + dayOnRequest + ") does not exist.");
dayOffRequest.setId(id); Element employeeElement = element.getChild("EmployeeID"); Employee employee = employeeMap.get(employeeElement.getText()); if (employee == null) { throw new IllegalArgumentException("The shiftDate (" + employeeElement.getText() + ") of dayOffRequest (" + dayOffRequest + ") does not exist."); Element dateElement = element.getChild("Date"); ShiftDate shiftDate = shiftDateMap.get(LocalDate.parse(dateElement.getText(), DateTimeFormatter.ISO_DATE)); if (shiftDate == null) { throw new IllegalArgumentException("The date (" + dateElement.getText() + ") of dayOffRequest (" + dayOffRequest + ") does not exist.");
employee.setId(id); employee.setCode(element.getAttribute("ID").getValue()); employee.setName(element.getChild("Name").getText()); Element contractElement = element.getChild("ContractID"); Contract contract = contractMap.get(contractElement.getText()); if (contract == null) { throw new IllegalArgumentException("The contract (" + contractElement.getText() + ") of employee (" + employee.getCode() + ") does not exist."); employee.setShiftOnRequestMap(new HashMap<>(estimatedRequestSize)); Element skillsElement = element.getChild("Skills"); if (skillsElement != null) { List<Element> skillElementList = (List<Element>) skillsElement.getChildren(); for (Element skillElement : skillElementList) { assertElementName(skillElement, "Skill"); Skill skill = skillMap.get(skillElement.getText()); if (skill == null) { throw new IllegalArgumentException("The skill (" + skillElement.getText() + ") of employee (" + employee.getCode() + ") does not exist.");
shiftType.setCode(element.getAttribute("ID").getValue()); shiftType.setIndex(index); String startTimeString = element.getChild("StartTime").getText(); shiftType.setStartTimeString(startTimeString); String endTimeString = element.getChild("EndTime").getText(); shiftType.setEndTimeString(endTimeString); shiftType.setNight(startTimeString.compareTo(endTimeString) > 0); shiftType.setDescription(element.getChild("Description").getText()); Element skillsElement = element.getChild("Skills"); shiftTypeSkillRequirement.setId(shiftTypeSkillRequirementId); shiftTypeSkillRequirement.setShiftType(shiftType); Skill skill = skillMap.get(skillElement.getText()); if (skill == null) { throw new IllegalArgumentException("The skill (" + skillElement.getText() + ") of shiftType (" + shiftType.getCode() + ") does not exist.");