String unit = flddesc.getUnit();
if (unit != null) {
field.setUnit(unit);
}
if (flddesc.getRank() != null) {
ParsedRankOrder ro = parse(dir, "ro-" + fldid + ".html", "rankorder", lastupdate, ParsedRankOrder.class);
if (!ro.getName().equals(fldname) ||
!ro.getId().equals(fld.getId()))
throw new RuntimeException(ro.getId() + "//" + ro.getName());
for (ParsedRankOrder.Rank r : ro.getRank()) {
Factbook.Category.Field.Rank rank = obf.createFactbookCategoryFieldRank();
rank.setCountry(countryids.get(r.getCountry()));
if (r.getDateEarliest() != null)
rank.setDateEarliest(XMLGregorianCalendarImpl.parse(r.getDateEarliest()));
if (r.getDateLatest() != null)
rank.setDateLatest(XMLGregorianCalendarImpl.parse(r.getDateLatest()));
rank.setDateText(r.getDate());
rank.setDateEstimated(r.isDateEstimated());
String vl = r.getValue();
if (vl.startsWith("$ ")) {
vl = vl.substring(2);
field.setDollars(true);
}
rank.setNumber(new BigDecimal(vl));
field.getRank().add(rank);
}
field.setRankorder(ro.getReversed() != null ? -1 : 1);
}
category.getField().add(field);
}
}
ParsedRegions regions = parse(dir, "regions.html", "regions", lastupdate, ParsedRegions.class);