Search in sources :

Example 26 with IProcessIdentifier

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;
}
Also used : CommonsLinkedHashMap(com.helger.commons.collection.impl.CommonsLinkedHashMap) SimpleProcessIdentifier(com.helger.peppolid.simple.process.SimpleProcessIdentifier) IMicroElement(com.helger.xml.microdom.IMicroElement) IMicroDocument(com.helger.xml.microdom.IMicroDocument) IProcessIdentifier(com.helger.peppolid.IProcessIdentifier) ReturnsMutableCopy(com.helger.commons.annotation.ReturnsMutableCopy) Nonnull(javax.annotation.Nonnull)

Aggregations

IProcessIdentifier (com.helger.peppolid.IProcessIdentifier)26 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)14 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)12 Test (org.junit.Test)12 SimpleProcessIdentifier (com.helger.peppolid.simple.process.SimpleProcessIdentifier)6 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)6 ISMPProcess (com.helger.phoss.smp.domain.serviceinfo.ISMPProcess)6 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)5 Nonnull (javax.annotation.Nonnull)5 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)4 SimpleDocumentTypeIdentifier (com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier)4 ISMPEndpoint (com.helger.phoss.smp.domain.serviceinfo.ISMPEndpoint)4 EndpointType (com.helger.xsds.peppol.smp1.EndpointType)4 ReturnsMutableCopy (com.helger.commons.annotation.ReturnsMutableCopy)3 CommonsHashSet (com.helger.commons.collection.impl.CommonsHashSet)3 XMLOffsetDateTime (com.helger.commons.datetime.XMLOffsetDateTime)3 CommonsLinkedHashMap (com.helger.commons.collection.impl.CommonsLinkedHashMap)2 PDTFromString (com.helger.commons.datetime.PDTFromString)2 PDTToString (com.helger.commons.datetime.PDTToString)2 ESuccess (com.helger.commons.state.ESuccess)2