All Downloads are FREE. Search and download functionalities are using the official Maven repository.

network.oxalis.as4.util.TransmissionRequestUtil Maven / Gradle / Ivy

There is a newer version: 6.7.0
Show newest version
package network.oxalis.as4.util;

import lombok.experimental.UtilityClass;
import network.oxalis.as4.common.As4MessageProperty;
import network.oxalis.vefa.peppol.common.model.DocumentTypeIdentifier;
import network.oxalis.vefa.peppol.common.model.ParticipantIdentifier;

@UtilityClass
public class TransmissionRequestUtil {

    public static String translateDocumentTypeToAction(DocumentTypeIdentifier documentTypeIdentifier) {
        return documentTypeIdentifier.getScheme() == null ||
                documentTypeIdentifier.getScheme().getIdentifier() == null ||
                documentTypeIdentifier.getScheme().getIdentifier().trim().isEmpty() ?

                documentTypeIdentifier.getIdentifier() :
                documentTypeIdentifier.toString();
    }

    public static As4MessageProperty toAs4MessageProperty(String name, ParticipantIdentifier documentTypeIdentifier) {
        return documentTypeIdentifier.getScheme() == null ||
                documentTypeIdentifier.getScheme().getIdentifier() == null ||
                documentTypeIdentifier.getScheme().getIdentifier().trim().isEmpty()
                ? new As4MessageProperty(name, documentTypeIdentifier.getIdentifier())
                : new As4MessageProperty(name, documentTypeIdentifier.getScheme().getIdentifier(), documentTypeIdentifier.getIdentifier());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy