use of com.helger.peppolid.IProcessIdentifier in project phoss-directory by phax.
the class NiceNameHandler method readEntries.
@Nonnull
@ReturnsMutableCopy
public static ICommonsOrderedMap<String, NiceNameEntry> readEntries(@Nonnull final IReadableResource aRes, final boolean bReadProcIDs) {
if (LOGGER.isInfoEnabled())
LOGGER.info("Trying to read nice name entries from " + aRes.getPath());
final ICommonsOrderedMap<String, NiceNameEntry> ret = new CommonsLinkedHashMap<>();
final IMicroDocument aDoc = MicroReader.readMicroXML(aRes);
if (aDoc != null && aDoc.getDocumentElement() != null) {
for (final IMicroElement eChild : aDoc.getDocumentElement().getAllChildElements("item")) {
final String sID = eChild.getAttributeValue("id");
final String sName = eChild.getAttributeValue("name");
final boolean bDeprecated = eChild.getAttributeValueAsBool("deprecated", false);
ICommonsList<IProcessIdentifier> aProcIDs = null;
if (bReadProcIDs) {
aProcIDs = new CommonsArrayList<>();
for (final IMicroElement eItem : eChild.getAllChildElements("procid")) aProcIDs.add(new SimpleProcessIdentifier(eItem.getAttributeValue("scheme"), eItem.getAttributeValue("value")));
}
ret.put(sID, new NiceNameEntry(sName, bDeprecated, aProcIDs));
}
}
return ret;
}
Aggregations