Search in sources :

Example 1 with MigrationRecordType

use of com.helger.peppol.smlclient.participant.MigrationRecordType in project peppol-commons by phax.

the class ManageParticipantIdentifierServiceCaller method migrate.

/**
 * Migrates an existing Service Group from another SMP to this SMP. The source
 * SMP must have called the
 * {@link #prepareToMigrate(IParticipantIdentifier, String, String)} method
 * and pass the migration key to the receiving SMP. The receiving SMP must use
 * this method to indicate to the SMK/SML that the new participant is now
 * usable by the new SMP.
 *
 * @param aIdentifier
 *        The participant identifier to migrate. May not be <code>null</code>.
 * @param sMigrationKey
 *        The migration key received by the previous owner. May not be
 *        <code>null</code>. Must have at last 24 characters.
 * @param sSMPID
 *        The publisher id corresponding to the new owner SMP. 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 business identifier was not found.
 * @throws UnauthorizedFault
 *         Is thrown if the user was not authorized.
 */
public void migrate(@Nonnull final IParticipantIdentifier aIdentifier, @Nonnull @Nonempty final String sMigrationKey, @Nonnull @Nonempty final String sSMPID) throws BadRequestFault, InternalErrorFault, NotFoundFault, UnauthorizedFault {
    ValueEnforcer.notNull(aIdentifier, "Identifier");
    ValueEnforcer.notEmpty(sMigrationKey, "MigrationKey");
    ValueEnforcer.notEmpty(sSMPID, "SMPID");
    if (LOGGER.isInfoEnabled())
        LOGGER.info("Finishing migration of participant " + aIdentifier.getURIEncoded() + " to SMP '" + sSMPID + "' using migration key '" + sMigrationKey + "'");
    final MigrationRecordType aMigrationRecord = new MigrationRecordType();
    // Constructor call needed for type conversion
    aMigrationRecord.setParticipantIdentifier(new SimpleParticipantIdentifier(aIdentifier));
    aMigrationRecord.setMigrationKey(sMigrationKey);
    aMigrationRecord.setServiceMetadataPublisherID(sSMPID);
    createWSPort().migrate(aMigrationRecord);
    if (LOGGER.isInfoEnabled())
        LOGGER.info("Successfully called 'migrate'");
}
Also used : MigrationRecordType(com.helger.peppol.smlclient.participant.MigrationRecordType) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)

Example 2 with MigrationRecordType

use of com.helger.peppol.smlclient.participant.MigrationRecordType in project peppol-commons by phax.

the class ManageParticipantIdentifierServiceCaller method prepareToMigrate.

/**
 * Prepares a migrate of the given participant identifier from one SMP to
 * another. This method must be called from the source SMP. This overload
 * takes a migration key that was created outside.
 *
 * @param aIdentifier
 *        The participant identifier.
 * @param sMigrationKey
 *        The migration key to be used. May neither be <code>null</code> nor
 *        empty.
 * @param sSMPID
 *        SMP ID
 * @return The migration key to transfer out-of-band to the other SMP.
 * @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 business identifier was not found.
 * @throws UnauthorizedFault
 *         Is thrown if the user was not authorized.
 * @since 8.1.2
 */
@Nonnull
public String prepareToMigrate(@Nonnull final IParticipantIdentifier aIdentifier, @Nonnull @Nonempty final String sMigrationKey, @Nonnull @Nonempty final String sSMPID) throws BadRequestFault, InternalErrorFault, NotFoundFault, UnauthorizedFault {
    ValueEnforcer.notNull(aIdentifier, "Identifier");
    ValueEnforcer.notEmpty(sSMPID, "SMPID");
    if (LOGGER.isInfoEnabled())
        LOGGER.info("Preparing to migrate participant " + aIdentifier.getURIEncoded() + " from SMP '" + sSMPID + "' using migration key '" + sMigrationKey + "'");
    final MigrationRecordType aMigrationRecord = new MigrationRecordType();
    // Constructor call needed for type conversion
    aMigrationRecord.setParticipantIdentifier(new SimpleParticipantIdentifier(aIdentifier));
    aMigrationRecord.setMigrationKey(sMigrationKey);
    aMigrationRecord.setServiceMetadataPublisherID(sSMPID);
    createWSPort().prepareToMigrate(aMigrationRecord);
    if (LOGGER.isInfoEnabled())
        LOGGER.info("Successfully called 'prepareToMigrate'");
    return sMigrationKey;
}
Also used : MigrationRecordType(com.helger.peppol.smlclient.participant.MigrationRecordType) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) Nonnull(javax.annotation.Nonnull)

Aggregations

MigrationRecordType (com.helger.peppol.smlclient.participant.MigrationRecordType)2 SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)2 Nonnull (javax.annotation.Nonnull)1