Search in sources :

Example 1 with NiceNameEntry

use of com.helger.peppol.domain.NiceNameEntry in project peppol-practical by phax.

the class AppCommonUI method createProcessID.

@Nonnull
public static IHCNode createProcessID(@Nonnull final IDocumentTypeIdentifier aDocTypeID, @Nonnull final IProcessIdentifier aProcessID) {
    final String sURI = aProcessID.getURIEncoded();
    final boolean bInDetails = true;
    // Check direct match first
    NiceNameEntry aNN = PROCESS_NAMES.get(sURI);
    if (aNN != null)
        return _createID(sURI, aNN, bInDetails);
    aNN = DOCTYPE_NAMES.get(aDocTypeID.getURIEncoded());
    if (aNN != null) {
        if (aNN.containsProcessID(aProcessID))
            return _createFormattedID(sURI, "Matching Process Identifier", EBootstrapBadgeType.SUCCESS, false, bInDetails);
        return _createFormattedID(sURI, "Unexpected Process Identifier", EBootstrapBadgeType.WARNING, false, bInDetails);
    }
    return _createFormattedID(sURI, null, null, false, bInDetails);
}
Also used : NiceNameEntry(com.helger.peppol.domain.NiceNameEntry) PDTToString(com.helger.commons.datetime.PDTToString) Nonnull(javax.annotation.Nonnull)

Example 2 with NiceNameEntry

use of com.helger.peppol.domain.NiceNameEntry in project peppol-practical by phax.

the class SMPJsonResponseExt method convert.

@Nonnull
public static IJsonObject convert(@Nonnull final ESMPAPIType eSMPAPIType, @Nonnull final IParticipantIdentifier aParticipantID, @Nonnull final Map<String, String> aSGHrefs, @Nonnull final IIdentifierFactory aIF) {
    final IJsonObject aJson = SMPJsonResponse.convert(eSMPAPIType, aParticipantID, aSGHrefs, aIF);
    final IJsonArray aURLsArray = aJson.getAsArray(SMPJsonResponse.JSON_URLS);
    if (aURLsArray != null)
        for (final IJson aEntry : aURLsArray) if (aEntry.isObject()) {
            final IJsonObject aUrlEntry = aEntry.getAsObject();
            final String sDocType = aUrlEntry.getAsString(SMPJsonResponse.JSON_DOCUMENT_TYPE_ID);
            if (sDocType != null) {
                final NiceNameEntry aNN = AppCommonUI.getDocTypeNames().get(sDocType);
                if (aNN != null) {
                    aUrlEntry.add(JSON_NICE_NAME, aNN.getName());
                    aUrlEntry.add(JSON_IS_DEPRECATED, aNN.isDeprecated());
                }
            }
        }
    return aJson;
}
Also used : IJsonObject(com.helger.json.IJsonObject) IJson(com.helger.json.IJson) IJsonArray(com.helger.json.IJsonArray) NiceNameEntry(com.helger.peppol.domain.NiceNameEntry) Nonnull(javax.annotation.Nonnull)

Aggregations

NiceNameEntry (com.helger.peppol.domain.NiceNameEntry)2 Nonnull (javax.annotation.Nonnull)2 PDTToString (com.helger.commons.datetime.PDTToString)1 IJson (com.helger.json.IJson)1 IJsonArray (com.helger.json.IJsonArray)1 IJsonObject (com.helger.json.IJsonObject)1