Search in sources :

Example 31 with SimpleParticipantIdentifier

use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.

the class ManageParticipantIdentifierServiceCaller method create.

/**
 * Creates a new participant identifier for the SMP given by the ID.
 *
 * @param sSMPID
 *        Identifies the SMP to create the identifier for. Example:
 *        <code>test-smp-0000000001</code>
 * @param aIdentifier
 *        The identifier to be created. May not be <code>null</code>.
 * @throws BadRequestFault
 *         Is thrown if the request sent to the service was not well-formed.
 * @throws InternalErrorFault
 *         Is thrown if an internal error happened on the service.
 * @throws UnauthorizedFault
 *         Is thrown if the user was not authorized.
 * @throws NotFoundFault
 *         Is thrown if the service meta data publisher was not found.
 */
public void create(@Nonnull @Nonempty final String sSMPID, @Nonnull final IParticipantIdentifier aIdentifier) throws BadRequestFault, InternalErrorFault, UnauthorizedFault, NotFoundFault {
    ValueEnforcer.notEmpty(sSMPID, "SMPID");
    ValueEnforcer.notNull(aIdentifier, "Identifier");
    final ServiceMetadataPublisherServiceForParticipantType aSMPParticpantService = new ServiceMetadataPublisherServiceForParticipantType();
    aSMPParticpantService.setServiceMetadataPublisherID(sSMPID);
    // Constructor call needed for type conversion
    aSMPParticpantService.setParticipantIdentifier(new SimpleParticipantIdentifier(aIdentifier));
    create(aSMPParticpantService);
}
Also used : ServiceMetadataPublisherServiceForParticipantType(com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)

Example 32 with SimpleParticipantIdentifier

use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.

the class SMLFuncTest method testManageBusinessIdentifier.

@Test
public void testManageBusinessIdentifier() throws Exception {
    final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
    aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
    final IParticipantIdentifier aBusinessIdentifierCreate = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER1);
    final ServiceMetadataPublisherServiceForParticipantType saSrviceMetadataPublisherServiceForBusiness = new ServiceMetadataPublisherServiceForParticipantType();
    // Explicit constructor call needed for type conversion
    saSrviceMetadataPublisherServiceForBusiness.setParticipantIdentifier(new SimpleParticipantIdentifier(aBusinessIdentifierCreate));
    saSrviceMetadataPublisherServiceForBusiness.setServiceMetadataPublisherID(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
    aPIClient.create(saSrviceMetadataPublisherServiceForBusiness);
    final ParticipantIdentifierPageType aResult = aPIClient.list("", m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
    assertNotNull(aResult);
    final List<ParticipantIdentifierType> aBusinessIdentifiers = aResult.getParticipantIdentifier();
    assertEquals(1, aBusinessIdentifiers.size());
    final ParticipantIdentifierType aBusinessIdentifierRead = aBusinessIdentifiers.get(0);
    assertEquals(aBusinessIdentifierCreate.getScheme(), aBusinessIdentifierRead.getScheme());
    assertEquals(aBusinessIdentifierCreate.getValue(), aBusinessIdentifierRead.getValue());
    aPIClient.deleteList(aBusinessIdentifiers);
    m_aSMClient.delete(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
}
Also used : ParticipantIdentifierPageType(com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType) ServiceMetadataPublisherServiceForParticipantType(com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType) ParticipantIdentifierType(com.helger.xsds.peppol.id1.ParticipantIdentifierType) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Example 33 with SimpleParticipantIdentifier

use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.

the class ManageParticipantIdentifierServiceCaller method delete.

/**
 * Deletes a given participant identifier. <br>
 * This is a workaround for a bug in CIPA SMK 3.0 which requires the SMP ID.
 * Previously it was never needed!
 *
 * @param sSMPID
 *        The id of the service meta data. May neither be <code>null</code>
 *        nor empty.
 * @param aIdentifier
 *        The business identifier to delete. May not be <code>null</code>.
 * @throws BadRequestFault
 *         Is thrown if the request sent to the service was not well-formed.
 * @throws InternalErrorFault
 *         Is thrown if an internal error happened on the service.
 * @throws NotFoundFault
 *         Is thrown if the business identifier could not be found and
 *         therefore deleted.
 * @throws UnauthorizedFault
 *         Is thrown if the user was not authorized.
 */
public void delete(@Nonnull @Nonempty final String sSMPID, @Nonnull final IParticipantIdentifier aIdentifier) throws BadRequestFault, InternalErrorFault, NotFoundFault, UnauthorizedFault {
    ValueEnforcer.notNull(aIdentifier, "Identifier");
    final ServiceMetadataPublisherServiceForParticipantType aSMPParticpantService = new ServiceMetadataPublisherServiceForParticipantType();
    aSMPParticpantService.setServiceMetadataPublisherID(sSMPID);
    // Constructor call needed for type conversion
    aSMPParticpantService.setParticipantIdentifier(new SimpleParticipantIdentifier(aIdentifier));
    delete(aSMPParticpantService);
}
Also used : ServiceMetadataPublisherServiceForParticipantType(com.helger.peppol.smlclient.participant.ServiceMetadataPublisherServiceForParticipantType) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)

Example 34 with SimpleParticipantIdentifier

use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.

the class ManageParticipantIdentifierServiceCaller method createList.

/**
 * Creates a list of participant identifiers.
 *
 * @param aParticipantIdentifiers
 *        The collection of identifiers to create. May neither be
 *        <code>null</code> nor empty nor may it contain <code>null</code>
 *        values.
 * @param sSMPID
 *        The id of the service meta data. May neither be <code>null</code>
 *        nor empty.
 * @throws BadRequestFault
 *         Is thrown if the request sent to the service was not well-formed.
 * @throws InternalErrorFault
 *         Is thrown if an internal error happened on the service.
 * @throws NotFoundFault
 *         If the SMP does not exist
 * @throws UnauthorizedFault
 *         Is thrown if the user was not authorized.
 */
public void createList(@Nonnull @Nonempty final Iterable<? extends IParticipantIdentifier> aParticipantIdentifiers, @Nonnull @Nonempty final String sSMPID) throws BadRequestFault, InternalErrorFault, NotFoundFault, UnauthorizedFault {
    ValueEnforcer.notEmptyNoNullValue(aParticipantIdentifiers, "ParticipantIdentifiers");
    ValueEnforcer.notEmpty(sSMPID, "SMPID");
    if (LOGGER.isInfoEnabled())
        LOGGER.info("Trying to create multiple new participants " + _toString(aParticipantIdentifiers) + " in SMP '" + sSMPID + "'");
    final ParticipantIdentifierPageType aParticipantList = new ParticipantIdentifierPageType();
    for (final IParticipantIdentifier aPI : aParticipantIdentifiers) {
        // Constructor call needed for type conversion
        aParticipantList.addParticipantIdentifier(new SimpleParticipantIdentifier(aPI));
    }
    aParticipantList.setServiceMetadataPublisherID(sSMPID);
    createWSPort().createList(aParticipantList);
}
Also used : ParticipantIdentifierPageType(com.helger.peppol.smlclient.participant.ParticipantIdentifierPageType) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 35 with SimpleParticipantIdentifier

use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.

the class BPCURLProviderSMP2Test method testGetSMPURIOfParticipant.

@Test
@Ignore("Because it may take long to execute")
@IgnoredNaptrTest
public void testGetSMPURIOfParticipant() throws SMPDNSResolutionException {
    final SimpleParticipantIdentifier aPI = new SimpleParticipantIdentifier("urn:oasis:names:tc:ebcore:partyid-type:iso6523:0060", "123456789");
    final URI x = BPCURLProviderSMP2.INSTANCE.getSMPURIOfParticipant(aPI, "bpc02.b2bei.us.");
    assertEquals("https://bpc-smp.bdxhub.com/", x.toString());
}
Also used : URI(java.net.URI) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) Ignore(org.junit.Ignore) IgnoredNaptrTest(com.helger.smpclient.IgnoredNaptrTest) IgnoredNaptrTest(com.helger.smpclient.IgnoredNaptrTest) Test(org.junit.Test)

Aggregations

SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)48 Test (org.junit.Test)26 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)25 ServiceGroupType (com.helger.xsds.peppol.smp1.ServiceGroupType)12 ServiceMetadataReferenceCollectionType (com.helger.xsds.peppol.smp1.ServiceMetadataReferenceCollectionType)12 ISMPServiceGroupManager (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager)11 Nonnull (javax.annotation.Nonnull)11 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)10 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)9 Response (javax.ws.rs.core.Response)9 SimpleDocumentTypeIdentifier (com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier)8 EndpointType (com.helger.xsds.peppol.smp1.EndpointType)7 ProcessListType (com.helger.xsds.peppol.smp1.ProcessListType)7 ProcessType (com.helger.xsds.peppol.smp1.ProcessType)7 ServiceEndpointList (com.helger.xsds.peppol.smp1.ServiceEndpointList)7 ServiceInformationType (com.helger.xsds.peppol.smp1.ServiceInformationType)7 WebTarget (javax.ws.rs.client.WebTarget)7 SMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.SMPServiceGroup)6 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)5 PeppolDocumentTypeIdentifier (com.helger.peppolid.peppol.doctype.PeppolDocumentTypeIdentifier)5