Search in sources :

Example 1 with BDXR1ParticipantIdentifier

use of com.helger.peppolid.bdxr.smp1.participant.BDXR1ParticipantIdentifier in project peppol-commons by phax.

the class BDXRClient method saveServiceGroup.

/**
 * Saves a service group. The meta data references should not be set and are
 * not used.
 *
 * @param aParticipantID
 *        The participant identifier for which the service group is to save.
 * @param aCredentials
 *        The user name and password to use as credentials.
 * @return The created {@link ServiceGroupType} object.
 * @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.
 */
@Nonnull
public ServiceGroupType saveServiceGroup(@Nonnull final IParticipantIdentifier aParticipantID, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
    ValueEnforcer.notNull(aParticipantID, "ParticipantID");
    ValueEnforcer.notNull(aCredentials, "Credentials");
    final ServiceGroupType aServiceGroup = new ServiceGroupType();
    // Explicit constructor call is needed here!
    aServiceGroup.setParticipantIdentifier(new BDXR1ParticipantIdentifier(aParticipantID));
    // Mandatory element, but can be empty
    aServiceGroup.setServiceMetadataReferenceCollection(new ServiceMetadataReferenceCollectionType());
    saveServiceGroup(aServiceGroup, aCredentials);
    return aServiceGroup;
}
Also used : ServiceMetadataReferenceCollectionType(com.helger.xsds.bdxr.smp1.ServiceMetadataReferenceCollectionType) BDXR1ParticipantIdentifier(com.helger.peppolid.bdxr.smp1.participant.BDXR1ParticipantIdentifier) ServiceGroupType(com.helger.xsds.bdxr.smp1.ServiceGroupType) BDXR1MarshallerServiceGroupType(com.helger.smpclient.bdxr1.marshal.BDXR1MarshallerServiceGroupType) Nonnull(javax.annotation.Nonnull)

Example 2 with BDXR1ParticipantIdentifier

use of com.helger.peppolid.bdxr.smp1.participant.BDXR1ParticipantIdentifier in project phoss-smp by phax.

the class SMPServiceInformation method getAsJAXBObjectBDXR1.

@Nullable
public com.helger.xsds.bdxr.smp1.ServiceMetadataType getAsJAXBObjectBDXR1() {
    if (m_aProcesses.isEmpty()) {
        // "ProcessList" is mandatory and MUST contain at least 1 value
        return null;
    }
    final com.helger.xsds.bdxr.smp1.ServiceInformationType aSI = new com.helger.xsds.bdxr.smp1.ServiceInformationType();
    // Explicit constructor call is needed here!
    aSI.setParticipantIdentifier(new BDXR1ParticipantIdentifier(m_aServiceGroup.getParticipantIdentifier()));
    aSI.setDocumentIdentifier(new BDXR1DocumentTypeIdentifier(m_aDocumentTypeIdentifier));
    final com.helger.xsds.bdxr.smp1.ProcessListType aProcesses = new com.helger.xsds.bdxr.smp1.ProcessListType();
    for (final ISMPProcess aProcess : m_aProcesses.values()) {
        final com.helger.xsds.bdxr.smp1.ProcessType aJAXBProcess = aProcess.getAsJAXBObjectBDXR1();
        if (aJAXBProcess != null)
            aProcesses.addProcess(aJAXBProcess);
    }
    if (aProcesses.hasNoProcessEntries()) {
        // "ProcessList" is mandatory and MUST contain at least 1 value
        return null;
    }
    aSI.setProcessList(aProcesses);
    aSI.setExtension(getAsBDXRExtension());
    final com.helger.xsds.bdxr.smp1.ServiceMetadataType ret = new com.helger.xsds.bdxr.smp1.ServiceMetadataType();
    ret.setServiceInformation(aSI);
    return ret;
}
Also used : BDXR1ParticipantIdentifier(com.helger.peppolid.bdxr.smp1.participant.BDXR1ParticipantIdentifier) BDXR1DocumentTypeIdentifier(com.helger.peppolid.bdxr.smp1.doctype.BDXR1DocumentTypeIdentifier) Nullable(javax.annotation.Nullable)

Example 3 with BDXR1ParticipantIdentifier

use of com.helger.peppolid.bdxr.smp1.participant.BDXR1ParticipantIdentifier in project phoss-smp by phax.

the class SMPServiceGroup method getAsJAXBObjectBDXR1.

@Nonnull
public com.helger.xsds.bdxr.smp1.ServiceGroupType getAsJAXBObjectBDXR1() {
    final com.helger.xsds.bdxr.smp1.ServiceGroupType ret = new com.helger.xsds.bdxr.smp1.ServiceGroupType();
    // Explicit constructor call is needed here!
    ret.setParticipantIdentifier(new BDXR1ParticipantIdentifier(m_aParticipantIdentifier));
    if (false) {
        // This is set by the REST server
        ret.setServiceMetadataReferenceCollection(null);
    }
    ret.setExtension(getAsBDXRExtension());
    return ret;
}
Also used : BDXR1ParticipantIdentifier(com.helger.peppolid.bdxr.smp1.participant.BDXR1ParticipantIdentifier) Nonnull(javax.annotation.Nonnull)

Example 4 with BDXR1ParticipantIdentifier

use of com.helger.peppolid.bdxr.smp1.participant.BDXR1ParticipantIdentifier in project peppol-commons by phax.

the class BDXR1IdentifierFactory method createParticipantIdentifier.

@Nullable
public BDXR1ParticipantIdentifier createParticipantIdentifier(@Nullable final String sScheme, @Nullable final String sValue) {
    final String sRealScheme = nullNotEmpty(sScheme);
    final String sRealValue = nullNotEmpty(isParticipantIdentifierCaseInsensitive(sRealScheme) ? getUnifiedValue(sValue) : sValue);
    if (isParticipantIdentifierSchemeValid(sRealScheme) && isParticipantIdentifierValueValid(sRealValue))
        return new BDXR1ParticipantIdentifier(sRealScheme, sRealValue);
    return null;
}
Also used : BDXR1ParticipantIdentifier(com.helger.peppolid.bdxr.smp1.participant.BDXR1ParticipantIdentifier) Nullable(javax.annotation.Nullable)

Aggregations

BDXR1ParticipantIdentifier (com.helger.peppolid.bdxr.smp1.participant.BDXR1ParticipantIdentifier)4 Nonnull (javax.annotation.Nonnull)2 Nullable (javax.annotation.Nullable)2 BDXR1DocumentTypeIdentifier (com.helger.peppolid.bdxr.smp1.doctype.BDXR1DocumentTypeIdentifier)1 BDXR1MarshallerServiceGroupType (com.helger.smpclient.bdxr1.marshal.BDXR1MarshallerServiceGroupType)1 ServiceGroupType (com.helger.xsds.bdxr.smp1.ServiceGroupType)1 ServiceMetadataReferenceCollectionType (com.helger.xsds.bdxr.smp1.ServiceMetadataReferenceCollectionType)1