Search in sources :

Example 21 with ServiceMetadataType

use of com.helger.xsds.peppol.smp1.ServiceMetadataType in project peppol-commons by phax.

the class SMPDebugHelper method getAsString.

@Nonnull
public static String getAsString(@Nonnull final ServiceMetadataType aServiceMetadata) {
    final StringBuilder aSB = new StringBuilder();
    aSB.append("Service meta data:\n");
    final ServiceInformationType aServiceInformation = aServiceMetadata.getServiceInformation();
    if (aServiceInformation != null) {
        aSB.append("  Service information:\n");
        aSB.append("    Participant: ").append(CIdentifier.getURIEncoded(aServiceInformation.getParticipantIdentifier())).append('\n');
        aSB.append("    Document type: ").append(CIdentifier.getURIEncoded(aServiceInformation.getDocumentIdentifier())).append('\n');
        for (final ProcessType aProcess : aServiceInformation.getProcessList().getProcess()) {
            aSB.append("      Process: ").append(CIdentifier.getURIEncoded(aProcess.getProcessIdentifier())).append('\n');
            for (final EndpointType aEndpoint : aProcess.getServiceEndpointList().getEndpoint()) {
                aSB.append("        Endpoint: ").append(W3CEndpointReferenceHelper.getAddress(aEndpoint.getEndpointReference())).append('\n');
                aSB.append("        Transport profile: ").append(aEndpoint.getTransportProfile()).append('\n');
                aSB.append("        Business level signature: ").append(aEndpoint.isRequireBusinessLevelSignature()).append('\n');
                aSB.append("        Min auth level: ").append(aEndpoint.getMinimumAuthenticationLevel()).append('\n');
                if (aEndpoint.getServiceActivationDate() != null)
                    aSB.append("        Valid from: ").append(aEndpoint.getServiceActivationDate()).append('\n');
                if (aEndpoint.getServiceExpirationDate() != null)
                    aSB.append("        Valid to: ").append(aEndpoint.getServiceExpirationDate()).append('\n');
                aSB.append("        Certficiate string: ").append(aEndpoint.getCertificate()).append('\n');
                aSB.append("        Service description: ").append(aEndpoint.getServiceDescription()).append('\n');
                aSB.append("        Contact URL: ").append(aEndpoint.getTechnicalContactUrl()).append('\n');
                aSB.append("        Info URL: ").append(aEndpoint.getTechnicalInformationUrl()).append('\n');
            }
        }
    }
    final RedirectType aRedirect = aServiceMetadata.getRedirect();
    if (aRedirect != null) {
        aSB.append("  Service redirect:\n");
        aSB.append("    Certificate UID: ").append(aRedirect.getCertificateUID()).append('\n');
        aSB.append("    Href: ").append(aRedirect.getHref()).append('\n');
    }
    return aSB.toString();
}
Also used : ProcessType(com.helger.xsds.peppol.smp1.ProcessType) EndpointType(com.helger.xsds.peppol.smp1.EndpointType) ServiceInformationType(com.helger.xsds.peppol.smp1.ServiceInformationType) RedirectType(com.helger.xsds.peppol.smp1.RedirectType) Nonnull(javax.annotation.Nonnull)

Example 22 with ServiceMetadataType

use of com.helger.xsds.peppol.smp1.ServiceMetadataType in project peppol-commons by phax.

the class BDXRClient method saveServiceInformation.

/**
 * Saves a service information data object.
 *
 * @param aServiceInformation
 *        The service information object to save. May not be
 *        <code>null</code>.
 * @param aCredentials
 *        The user name and password to use as credentials. May not be
 *        <code>null</code>.
 * @throws SMPClientException
 *         in case something goes wrong
 * @throws SMPClientUnauthorizedException
 *         The user name or password was not correct.
 * @throws SMPClientNotFoundException
 *         A HTTP Not Found was received. This can happen if the service was
 *         not found.
 * @throws SMPClientBadRequestException
 *         The request was not well formed.
 * @see #saveServiceRedirect(ParticipantIdentifierType,
 *      DocumentIdentifierType, RedirectType, BasicAuthClientCredentials)
 */
public void saveServiceInformation(@Nonnull final ServiceInformationType aServiceInformation, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
    ValueEnforcer.notNull(aServiceInformation, "ServiceMetadata.ServiceInformation");
    ValueEnforcer.notNull(aServiceInformation.getParticipantIdentifier(), "ServiceMetadata.ServiceInformation.ParticipantIdentifier");
    ValueEnforcer.notNull(aServiceInformation.getDocumentIdentifier(), "ServiceMetadata.ServiceInformation.DocumentIdentifier");
    ValueEnforcer.notNull(aCredentials, "Credentials");
    final ServiceMetadataType aServiceMetadata = new ServiceMetadataType();
    aServiceMetadata.setServiceInformation(aServiceInformation);
    _saveServiceInformation(aServiceInformation.getParticipantIdentifier(), aServiceInformation.getDocumentIdentifier(), aServiceMetadata, aCredentials);
}
Also used : BDXR1MarshallerServiceMetadataType(com.helger.smpclient.bdxr1.marshal.BDXR1MarshallerServiceMetadataType) ServiceMetadataType(com.helger.xsds.bdxr.smp1.ServiceMetadataType)

Example 23 with ServiceMetadataType

use of com.helger.xsds.peppol.smp1.ServiceMetadataType in project peppol-commons by phax.

the class BDXRClient method saveServiceRedirect.

/**
 * Saves a redirect data object.
 *
 * @param aServiceGroupID
 *        The service group ID to use. May not be <code>null</code>.
 * @param aDocumentTypeID
 *        The document type ID to use. May not be <code>null</code>.
 * @param aRedirect
 *        The redirect to be saved. May not be <code>null</code>.
 * @param aCredentials
 *        The user name and password to use as credentials. May not be
 *        <code>null</code>.
 * @throws SMPClientException
 *         in case something goes wrong
 * @throws SMPClientUnauthorizedException
 *         The user name or password was not correct.
 * @throws SMPClientNotFoundException
 *         A HTTP Not Found was received. This can happen if the service was
 *         not found.
 * @throws SMPClientBadRequestException
 *         The request was not well formed.
 * @see #saveServiceInformation(ServiceInformationType,
 *      BasicAuthClientCredentials)
 */
public void saveServiceRedirect(@Nonnull final ParticipantIdentifierType aServiceGroupID, @Nonnull final DocumentIdentifierType aDocumentTypeID, @Nonnull final RedirectType aRedirect, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
    ValueEnforcer.notNull(aServiceGroupID, "ServiceGroupID");
    ValueEnforcer.notNull(aDocumentTypeID, "DocumentTypeID");
    ValueEnforcer.notNull(aRedirect, "Redirect");
    ValueEnforcer.notNull(aCredentials, "Credentials");
    final ServiceMetadataType aServiceMetadata = new ServiceMetadataType();
    aServiceMetadata.setRedirect(aRedirect);
    _saveServiceInformation(aServiceGroupID, aDocumentTypeID, aServiceMetadata, aCredentials);
}
Also used : BDXR1MarshallerServiceMetadataType(com.helger.smpclient.bdxr1.marshal.BDXR1MarshallerServiceMetadataType) ServiceMetadataType(com.helger.xsds.bdxr.smp1.ServiceMetadataType)

Example 24 with ServiceMetadataType

use of com.helger.xsds.peppol.smp1.ServiceMetadataType in project peppol-commons by phax.

the class BDXR2Client method saveServiceEndpoints.

/**
 * Saves a service information data object.
 *
 * @param aServiceGroupID
 *        The service group ID to use. May not be <code>null</code>.
 * @param aDocumentTypeID
 *        The document type ID to use. May not be <code>null</code>.
 * @param aEndpoints
 *        The endpoints to the created or updated. May not be
 *        <code>null</code>.
 * @param aCredentials
 *        The user name and password to use as credentials. May not be
 *        <code>null</code>.
 * @throws SMPClientException
 *         in case something goes wrong
 * @throws SMPClientUnauthorizedException
 *         The user name or password was not correct.
 * @throws SMPClientNotFoundException
 *         A HTTP Not Found was received. This can happen if the service was
 *         not found.
 * @throws SMPClientBadRequestException
 *         The request was not well formed.
 * @see #saveServiceRedirect(ParticipantIDType, IDType, RedirectType,
 *      BasicAuthClientCredentials)
 */
public void saveServiceEndpoints(@Nonnull final ParticipantIDType aServiceGroupID, @Nonnull final IDType aDocumentTypeID, @Nonnull final List<EndpointType> aEndpoints, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
    ValueEnforcer.notNull(aServiceGroupID, "ServiceGroupID");
    ValueEnforcer.notNull(aDocumentTypeID, "DocumentTypeID");
    ValueEnforcer.notNull(aEndpoints, "Endpoints");
    ValueEnforcer.notNull(aCredentials, "Credentials");
    final ServiceMetadataType aServiceMetadata = new ServiceMetadataType();
    aServiceMetadata.setSMPVersionID("2.0");
    aServiceMetadata.setID(aDocumentTypeID);
    aServiceMetadata.setParticipantID(aServiceGroupID);
    final ProcessMetadataType aPM = new ProcessMetadataType();
    aPM.getEndpoint().addAll(aEndpoints);
    aServiceMetadata.addProcessMetadata(aPM);
    _saveServiceInformation(aServiceMetadata, aCredentials);
}
Also used : ServiceMetadataType(com.helger.xsds.bdxr.smp2.ServiceMetadataType) ProcessMetadataType(com.helger.xsds.bdxr.smp2.ac.ProcessMetadataType)

Aggregations

ServiceMetadataType (com.helger.xsds.peppol.smp1.ServiceMetadataType)11 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)9 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)8 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)7 Nonnull (javax.annotation.Nonnull)7 ISMPServiceGroupManager (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager)6 ISMPServiceInformationManager (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformationManager)6 EndpointType (com.helger.xsds.peppol.smp1.EndpointType)6 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)5 SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)5 ISMPRedirectManager (com.helger.phoss.smp.domain.redirect.ISMPRedirectManager)5 ISMPServiceInformation (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation)5 SMPNotFoundException (com.helger.phoss.smp.exception.SMPNotFoundException)5 SMPServerException (com.helger.phoss.smp.exception.SMPServerException)5 ServiceMetadataType (com.helger.xsds.bdxr.smp1.ServiceMetadataType)5 ProcessType (com.helger.xsds.peppol.smp1.ProcessType)5 ServiceInformationType (com.helger.xsds.peppol.smp1.ServiceInformationType)5 Response (javax.ws.rs.core.Response)5 Test (org.junit.Test)5 ProcessListType (com.helger.xsds.peppol.smp1.ProcessListType)4