Search in sources :

Example 16 with ESuccess

use of com.helger.commons.state.ESuccess in project phoss-smp by phax.

the class APIExecutorBusinessCardPut method invokeAPI.

public void invokeAPI(@Nonnull final IAPIDescriptor aAPIDescriptor, @Nonnull @Nonempty final String sPath, @Nonnull final Map<String, String> aPathVariables, @Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final UnifiedResponse aUnifiedResponse) throws Exception {
    final String sServiceGroupID = aPathVariables.get(SMPRestFilter.PARAM_SERVICE_GROUP_ID);
    final ISMPServerAPIDataProvider aDataProvider = new SMPRestDataProvider(aRequestScope, sServiceGroupID);
    // Is the writable API disabled?
    if (SMPMetaManager.getSettings().isRESTWritableAPIDisabled()) {
        throw new SMPPreconditionFailedException("The writable REST API is disabled. saveBusinessCard will not be executed", aDataProvider.getCurrentURI());
    }
    if (!SMPMetaManager.getSettings().isDirectoryIntegrationEnabled()) {
        // PD integration is disabled
        throw new SMPPreconditionFailedException("The " + SMPWebAppConfiguration.getDirectoryName() + " integration is disabled. saveBusinessCard will not be executed", aDataProvider.getCurrentURI());
    }
    // Parse main payload
    final byte[] aPayload = StreamHelper.getAllBytes(aRequestScope.getRequest().getInputStream());
    final PDBusinessCard aBC = PDBusinessCardHelper.parseBusinessCard(aPayload, (Charset) null);
    if (aBC == null) {
        // Cannot parse
        throw new SMPBadRequestException("Failed to parse XML payload as BusinessCard.", aDataProvider.getCurrentURI());
    }
    final BasicAuthClientCredentials aBasicAuth = getMandatoryAuth(aRequestScope.headers());
    final ESuccess eSuccess = new BusinessCardServerAPI(aDataProvider).createBusinessCard(sServiceGroupID, aBC, aBasicAuth);
    if (eSuccess.isFailure())
        aUnifiedResponse.setStatus(CHttp.HTTP_INTERNAL_SERVER_ERROR);
    else
        aUnifiedResponse.setStatus(CHttp.HTTP_OK);
}
Also used : ESuccess(com.helger.commons.state.ESuccess) SMPPreconditionFailedException(com.helger.phoss.smp.exception.SMPPreconditionFailedException) PDBusinessCard(com.helger.pd.businesscard.generic.PDBusinessCard) SMPBadRequestException(com.helger.phoss.smp.exception.SMPBadRequestException) BasicAuthClientCredentials(com.helger.http.basicauth.BasicAuthClientCredentials) BusinessCardServerAPI(com.helger.phoss.smp.restapi.BusinessCardServerAPI) ISMPServerAPIDataProvider(com.helger.phoss.smp.restapi.ISMPServerAPIDataProvider)

Example 17 with ESuccess

use of com.helger.commons.state.ESuccess in project phoss-smp by phax.

the class SMPRedirectManagerJDBC method createOrUpdateSMPRedirect.

@Nullable
public ISMPRedirect createOrUpdateSMPRedirect(@Nonnull final ISMPServiceGroup aServiceGroup, @Nonnull final IDocumentTypeIdentifier aDocTypeID, @Nonnull @Nonempty final String sRedirectUrl, @Nonnull @Nonempty final String sSubjectUniqueIdentifier, @Nullable final X509Certificate aCertificate, @Nullable final String sExtension) {
    ValueEnforcer.notNull(aServiceGroup, "ServiceGroup");
    ValueEnforcer.notNull(aDocTypeID, "DocumentTypeIdentifier");
    final MutableBoolean aCreatedNew = new MutableBoolean(true);
    final DBExecutor aExecutor = newExecutor();
    final ESuccess eSuccess = aExecutor.performInTransaction(() -> {
        final ISMPRedirect aDBRedirect = getSMPRedirectOfServiceGroupAndDocumentType(aServiceGroup, aDocTypeID);
        final IParticipantIdentifier aParticipantID = aServiceGroup.getParticipantIdentifier();
        final String sCertificate = aCertificate == null ? null : CertificateHelper.getPEMEncodedCertificate(aCertificate);
        if (aDBRedirect == null) {
            // Create new
            final long nCreated = aExecutor.insertOrUpdateOrDelete("INSERT INTO smp_service_metadata_red (businessIdentifierScheme, businessIdentifier, documentIdentifierScheme, documentIdentifier, redirectionUrl, certificateUID, certificate, extension) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", new ConstantPreparedStatementDataProvider(aParticipantID.getScheme(), aParticipantID.getValue(), aDocTypeID.getScheme(), aDocTypeID.getValue(), sRedirectUrl, sSubjectUniqueIdentifier, sCertificate, sExtension));
            if (nCreated != 1)
                throw new IllegalStateException("Failed to create new DB entry (" + nCreated + ")");
            aCreatedNew.set(true);
        } else {
            // Update existing
            final long nUpdated = aExecutor.insertOrUpdateOrDelete("UPDATE smp_service_metadata_red" + " SET redirectionUrl=?, certificateUID=?, certificate=?, extension=?" + " WHERE businessIdentifierScheme=? AND businessIdentifier=? AND documentIdentifierScheme=? AND documentIdentifier=?", new ConstantPreparedStatementDataProvider(sRedirectUrl, sSubjectUniqueIdentifier, sCertificate, sExtension, aParticipantID.getScheme(), aParticipantID.getValue(), aDocTypeID.getScheme(), aDocTypeID.getValue()));
            if (nUpdated != 1)
                throw new IllegalStateException("Failed to update existing DB entry (" + nUpdated + ")");
            aCreatedNew.set(false);
        }
    });
    if (eSuccess.isFailure()) {
        return null;
    }
    final SMPRedirect aSMPRedirect = new SMPRedirect(aServiceGroup, aDocTypeID, sRedirectUrl, sSubjectUniqueIdentifier, aCertificate, sExtension);
    if (aCreatedNew.booleanValue()) {
        AuditHelper.onAuditCreateSuccess(SMPRedirect.OT, aSMPRedirect.getID(), aSMPRedirect.getServiceGroupID(), aSMPRedirect.getDocumentTypeIdentifier().getURIEncoded(), aSMPRedirect.getTargetHref(), aSMPRedirect.getSubjectUniqueIdentifier(), aSMPRedirect.getCertificate(), aSMPRedirect.getExtensionsAsString());
        m_aCallbacks.forEach(x -> x.onSMPRedirectCreated(aSMPRedirect));
    } else {
        AuditHelper.onAuditModifySuccess(SMPRedirect.OT, "set-all", aSMPRedirect.getID(), aSMPRedirect.getServiceGroupID(), aSMPRedirect.getDocumentTypeIdentifier().getURIEncoded(), aSMPRedirect.getTargetHref(), aSMPRedirect.getSubjectUniqueIdentifier(), aSMPRedirect.getCertificate(), aSMPRedirect.getExtensionsAsString());
        m_aCallbacks.forEach(x -> x.onSMPRedirectUpdated(aSMPRedirect));
    }
    return aSMPRedirect;
}
Also used : ESuccess(com.helger.commons.state.ESuccess) SMPRedirect(com.helger.phoss.smp.domain.redirect.SMPRedirect) ISMPRedirect(com.helger.phoss.smp.domain.redirect.ISMPRedirect) DBExecutor(com.helger.db.jdbc.executor.DBExecutor) ISMPRedirect(com.helger.phoss.smp.domain.redirect.ISMPRedirect) MutableBoolean(com.helger.commons.mutable.MutableBoolean) ConstantPreparedStatementDataProvider(com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Nullable(javax.annotation.Nullable)

Example 18 with ESuccess

use of com.helger.commons.state.ESuccess in project phoss-smp by phax.

the class SMPServiceGroupManagerJDBC method updateSMPServiceGroup.

@Nonnull
public EChange updateSMPServiceGroup(@Nonnull final IParticipantIdentifier aParticipantID, @Nonnull @Nonempty final String sNewOwnerID, @Nullable final String sNewExtension) throws SMPServerException {
    ValueEnforcer.notNull(aParticipantID, "ParticipantID");
    ValueEnforcer.notEmpty(sNewOwnerID, "NewOwnerID");
    if (LOGGER.isDebugEnabled())
        LOGGER.debug("updateSMPServiceGroup (" + aParticipantID.getURIEncoded() + ", " + sNewOwnerID + ", " + (StringHelper.hasText(sNewExtension) ? "with extension" : "without extension") + ")");
    final Wrapper<EChange> aWrappedChange = new Wrapper<>(EChange.UNCHANGED);
    final Wrapper<Exception> aCaughtException = new Wrapper<>();
    final DBExecutor aExecutor = newExecutor();
    final ESuccess eSuccess = aExecutor.performInTransaction(() -> {
        // Check if the passed service group ID is already in use
        final SMPServiceGroup aDBServiceGroup = getSMPServiceGroupOfID(aParticipantID);
        if (aDBServiceGroup == null)
            throw new SMPNotFoundException("The service group with ID " + aParticipantID.getURIEncoded() + " does not exist!");
        if (!EqualsHelper.equals(sNewOwnerID, aDBServiceGroup.getOwnerID())) {
            // Update ownership
            final long nCount = aExecutor.insertOrUpdateOrDelete("UPDATE smp_ownership SET username=? WHERE businessIdentifierScheme=? AND businessIdentifier=?", new ConstantPreparedStatementDataProvider(sNewOwnerID, aDBServiceGroup.getParticipantIdentifier().getScheme(), aDBServiceGroup.getParticipantIdentifier().getValue()));
            if (nCount != 1)
                throw new IllegalStateException("Failed to update the ownership username to '" + sNewOwnerID + "'");
            aWrappedChange.set(EChange.CHANGED);
        }
        if (!EqualsHelper.equals(sNewExtension, aDBServiceGroup.getExtensionsAsString())) {
            // Update extension
            final long nCount = aExecutor.insertOrUpdateOrDelete("UPDATE smp_service_group SET extension=? WHERE businessIdentifierScheme=? AND businessIdentifier=?", new ConstantPreparedStatementDataProvider(sNewExtension, aDBServiceGroup.getParticipantIdentifier().getScheme(), aDBServiceGroup.getParticipantIdentifier().getValue()));
            if (nCount != 1)
                throw new IllegalStateException("Failed to update the service_group extension to '" + sNewExtension + "'");
            aWrappedChange.set(EChange.CHANGED);
        }
    }, aCaughtException::set);
    if (eSuccess.isFailure() || aCaughtException.isSet()) {
        AuditHelper.onAuditModifyFailure(SMPServiceGroup.OT, "set-all", aParticipantID.getURIEncoded(), sNewOwnerID, sNewExtension);
        final Exception ex = aCaughtException.get();
        if (ex instanceof SMPServerException)
            throw (SMPServerException) ex;
        throw new SMPInternalErrorException("Failed to update ServiceGroup '" + aParticipantID.getURIEncoded() + "'", ex);
    }
    final EChange eChange = aWrappedChange.get();
    if (LOGGER.isDebugEnabled())
        LOGGER.debug("updateSMPServiceGroup succeeded. Change=" + eChange.isChanged());
    AuditHelper.onAuditModifySuccess(SMPServiceGroup.OT, "set-all", aParticipantID.getURIEncoded(), sNewOwnerID, sNewExtension);
    // Callback only if something changed
    if (eChange.isChanged())
        m_aCBs.forEach(x -> x.onSMPServiceGroupUpdated(aParticipantID));
    return eChange;
}
Also used : ESuccess(com.helger.commons.state.ESuccess) ESuccess(com.helger.commons.state.ESuccess) SMPInternalErrorException(com.helger.phoss.smp.exception.SMPInternalErrorException) Nonnegative(javax.annotation.Nonnegative) ICommonsSet(com.helger.commons.collection.impl.ICommonsSet) CIdentifier(com.helger.peppolid.CIdentifier) LoggerFactory(org.slf4j.LoggerFactory) SMPSMLException(com.helger.phoss.smp.exception.SMPSMLException) EChange(com.helger.commons.state.EChange) CheckForSigned(javax.annotation.CheckForSigned) Supplier(java.util.function.Supplier) CallbackList(com.helger.commons.callback.CallbackList) AbstractJDBCEnabledManager(com.helger.db.jdbc.mgr.AbstractJDBCEnabledManager) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) MutableBoolean(com.helger.commons.mutable.MutableBoolean) SMPServerException(com.helger.phoss.smp.exception.SMPServerException) Nonempty(com.helger.commons.annotation.Nonempty) RegistrationHookException(com.helger.phoss.smp.smlhook.RegistrationHookException) DBExecutor(com.helger.db.jdbc.executor.DBExecutor) ReturnsMutableCopy(com.helger.commons.annotation.ReturnsMutableCopy) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) RegistrationHookFactory(com.helger.phoss.smp.smlhook.RegistrationHookFactory) Logger(org.slf4j.Logger) CommonsArrayList(com.helger.commons.collection.impl.CommonsArrayList) ConstantPreparedStatementDataProvider(com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider) StringHelper(com.helger.commons.string.StringHelper) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) ISMPServiceGroupCallback(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupCallback) ExpiringMap(net.jodah.expiringmap.ExpiringMap) EqualsHelper(com.helger.commons.equals.EqualsHelper) ValueEnforcer(com.helger.commons.ValueEnforcer) DBResultRow(com.helger.db.jdbc.executor.DBResultRow) TimeUnit(java.util.concurrent.TimeUnit) SMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.SMPServiceGroup) IRegistrationHook(com.helger.phoss.smp.smlhook.IRegistrationHook) AuditHelper(com.helger.photon.audit.AuditHelper) SMPNotFoundException(com.helger.phoss.smp.exception.SMPNotFoundException) CommonsHashSet(com.helger.commons.collection.impl.CommonsHashSet) ICommonsList(com.helger.commons.collection.impl.ICommonsList) Wrapper(com.helger.commons.wrapper.Wrapper) ReturnsMutableObject(com.helger.commons.annotation.ReturnsMutableObject) ExpirationPolicy(net.jodah.expiringmap.ExpirationPolicy) ISMPServiceGroupManager(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager) Wrapper(com.helger.commons.wrapper.Wrapper) SMPInternalErrorException(com.helger.phoss.smp.exception.SMPInternalErrorException) SMPSMLException(com.helger.phoss.smp.exception.SMPSMLException) SMPServerException(com.helger.phoss.smp.exception.SMPServerException) RegistrationHookException(com.helger.phoss.smp.smlhook.RegistrationHookException) SMPNotFoundException(com.helger.phoss.smp.exception.SMPNotFoundException) SMPNotFoundException(com.helger.phoss.smp.exception.SMPNotFoundException) SMPInternalErrorException(com.helger.phoss.smp.exception.SMPInternalErrorException) DBExecutor(com.helger.db.jdbc.executor.DBExecutor) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) SMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.SMPServiceGroup) ConstantPreparedStatementDataProvider(com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider) EChange(com.helger.commons.state.EChange) SMPServerException(com.helger.phoss.smp.exception.SMPServerException) Nonnull(javax.annotation.Nonnull)

Example 19 with ESuccess

use of com.helger.commons.state.ESuccess in project phoss-smp by phax.

the class SMPServiceGroupManagerJDBC method deleteSMPServiceGroup.

@Nonnull
public EChange deleteSMPServiceGroup(@Nonnull final IParticipantIdentifier aParticipantID, final boolean bDeleteInSML) throws SMPServerException {
    ValueEnforcer.notNull(aParticipantID, "ParticipantID");
    if (LOGGER.isDebugEnabled())
        LOGGER.debug("deleteSMPServiceGroup (" + aParticipantID.getURIEncoded() + ")");
    final IRegistrationHook aHook = RegistrationHookFactory.getInstance();
    final MutableBoolean aDeletedServiceGroupInSML = new MutableBoolean(false);
    final Wrapper<EChange> aWrappedChange = new Wrapper<>(EChange.UNCHANGED);
    final Wrapper<Exception> aCaughtException = new Wrapper<>();
    final DBExecutor aExecutor = newExecutor();
    final ESuccess eSuccess = aExecutor.performInTransaction(() -> {
        // Check if the passed service group ID is already in use
        final SMPServiceGroup aDBServiceGroup = getSMPServiceGroupOfID(aParticipantID);
        if (aDBServiceGroup == null)
            throw new SMPNotFoundException("The service group with ID " + aParticipantID.getURIEncoded() + " does not exist!");
        if (bDeleteInSML) {
            // Delete in SML - and remember that
            // throws exception in case of error
            aHook.deleteServiceGroup(aParticipantID);
            aDeletedServiceGroupInSML.set(true);
        }
        final long nCount = aExecutor.insertOrUpdateOrDelete("DELETE FROM smp_service_group" + " WHERE businessIdentifierScheme=? AND businessIdentifier=?", new ConstantPreparedStatementDataProvider(aParticipantID.getScheme(), aParticipantID.getValue()));
        if (nCount != 1)
            throw new IllegalStateException("Failed to delete service group");
        aWrappedChange.set(EChange.CHANGED);
    }, aCaughtException::set);
    if (eSuccess.isFailure()) {
        // Error writing to the DB
        if (bDeleteInSML && aDeletedServiceGroupInSML.booleanValue()) {
            // Undo deletion in SML!
            try {
                aHook.undoDeleteServiceGroup(aParticipantID);
            } catch (final RegistrationHookException ex) {
                LOGGER.error("Failed to undoDeleteServiceGroup (" + aParticipantID.getURIEncoded() + ")", ex);
            }
        }
    }
    if (aCaughtException.isSet()) {
        AuditHelper.onAuditDeleteFailure(SMPServiceGroup.OT, aParticipantID.getURIEncoded(), "database-error");
        final Exception ex = aCaughtException.get();
        if (ex instanceof SMPServerException)
            throw (SMPServerException) ex;
        if (ex instanceof RegistrationHookException)
            throw new SMPSMLException("Failed to delete '" + aParticipantID.getURIEncoded() + "' in SML", ex);
        throw new SMPInternalErrorException("Failed to delete ServiceGroup '" + aParticipantID.getURIEncoded() + "'", ex);
    }
    final EChange eChange = aWrappedChange.get();
    if (LOGGER.isDebugEnabled())
        LOGGER.debug("deleteSMPServiceGroup succeeded. Change=" + eChange.isChanged());
    if (eChange.isChanged()) {
        AuditHelper.onAuditDeleteSuccess(SMPServiceGroup.OT, aParticipantID.getURIEncoded());
        if (m_aCache != null)
            m_aCache.remove(aParticipantID.getURIEncoded());
        m_aCBs.forEach(x -> x.onSMPServiceGroupDeleted(aParticipantID, bDeleteInSML));
    }
    return eChange;
}
Also used : ESuccess(com.helger.commons.state.ESuccess) Wrapper(com.helger.commons.wrapper.Wrapper) RegistrationHookException(com.helger.phoss.smp.smlhook.RegistrationHookException) MutableBoolean(com.helger.commons.mutable.MutableBoolean) SMPInternalErrorException(com.helger.phoss.smp.exception.SMPInternalErrorException) SMPSMLException(com.helger.phoss.smp.exception.SMPSMLException) SMPServerException(com.helger.phoss.smp.exception.SMPServerException) RegistrationHookException(com.helger.phoss.smp.smlhook.RegistrationHookException) SMPNotFoundException(com.helger.phoss.smp.exception.SMPNotFoundException) SMPSMLException(com.helger.phoss.smp.exception.SMPSMLException) IRegistrationHook(com.helger.phoss.smp.smlhook.IRegistrationHook) SMPNotFoundException(com.helger.phoss.smp.exception.SMPNotFoundException) SMPInternalErrorException(com.helger.phoss.smp.exception.SMPInternalErrorException) DBExecutor(com.helger.db.jdbc.executor.DBExecutor) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) SMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.SMPServiceGroup) ConstantPreparedStatementDataProvider(com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider) EChange(com.helger.commons.state.EChange) SMPServerException(com.helger.phoss.smp.exception.SMPServerException) Nonnull(javax.annotation.Nonnull)

Example 20 with ESuccess

use of com.helger.commons.state.ESuccess in project phoss-smp by phax.

the class SMPServiceInformationManagerJDBC method mergeSMPServiceInformation.

@Nonnull
public ESuccess mergeSMPServiceInformation(@Nonnull final ISMPServiceInformation aSMPServiceInformation) {
    ValueEnforcer.notNull(aSMPServiceInformation, "ServiceInformation");
    final MutableBoolean aUpdated = new MutableBoolean(false);
    final DBExecutor aExecutor = newExecutor();
    final ESuccess eSuccess = aExecutor.performInTransaction(() -> {
        // Simply delete the old one
        final EChange eDeleted = _deleteSMPServiceInformationNoCallback(aSMPServiceInformation);
        aUpdated.set(eDeleted.isChanged());
        // Insert new processes
        final IParticipantIdentifier aPID = aSMPServiceInformation.getServiceGroup().getParticipantIdentifier();
        final IDocumentTypeIdentifier aDocTypeID = aSMPServiceInformation.getDocumentTypeIdentifier();
        aExecutor.insertOrUpdateOrDelete("INSERT INTO smp_service_metadata (businessIdentifierScheme, businessIdentifier, documentIdentifierScheme, documentIdentifier, extension) VALUES (?, ?, ?, ?, ?)", new ConstantPreparedStatementDataProvider(aPID.getScheme(), aPID.getValue(), aDocTypeID.getScheme(), aDocTypeID.getValue(), aSMPServiceInformation.getExtensionsAsString()));
        for (final ISMPProcess aProcess : aSMPServiceInformation.getAllProcesses()) {
            final IProcessIdentifier aProcessID = aProcess.getProcessIdentifier();
            aExecutor.insertOrUpdateOrDelete("INSERT INTO smp_process (businessIdentifierScheme, businessIdentifier, documentIdentifierScheme, documentIdentifier, processIdentifierType, processIdentifier, extension) VALUES (?, ?, ?, ?, ?, ?, ?)", new ConstantPreparedStatementDataProvider(aPID.getScheme(), aPID.getValue(), aDocTypeID.getScheme(), aDocTypeID.getValue(), aProcessID.getScheme(), aProcessID.getValue(), aProcess.getExtensionsAsString()));
            // Insert new endpoints
            for (final ISMPEndpoint aEndpoint : aProcess.getAllEndpoints()) {
                aExecutor.insertOrUpdateOrDelete("INSERT INTO smp_endpoint (businessIdentifierScheme, businessIdentifier, documentIdentifierScheme, documentIdentifier, processIdentifierType, processIdentifier," + " certificate, endpointReference, minimumAuthenticationLevel, requireBusinessLevelSignature, serviceActivationDate, serviceDescription, serviceExpirationDate, technicalContactUrl, technicalInformationUrl, transportProfile," + " extension) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new ConstantPreparedStatementDataProvider(aPID.getScheme(), aPID.getValue(), aDocTypeID.getScheme(), aDocTypeID.getValue(), aProcessID.getScheme(), aProcessID.getValue(), aEndpoint.getCertificate(), aEndpoint.getEndpointReference(), aEndpoint.getMinimumAuthenticationLevel(), Boolean.valueOf(aEndpoint.isRequireBusinessLevelSignature()), DBValueHelper.toTimestamp(aEndpoint.getServiceActivationDateTime()), aEndpoint.getServiceDescription(), DBValueHelper.toTimestamp(aEndpoint.getServiceExpirationDateTime()), aEndpoint.getTechnicalContactUrl(), aEndpoint.getTechnicalInformationUrl(), aEndpoint.getTransportProfile(), aEndpoint.getExtensionsAsString()));
            }
        }
    });
    if (eSuccess.isFailure())
        return ESuccess.FAILURE;
    // Callback outside of transaction
    if (aUpdated.booleanValue()) {
        AuditHelper.onAuditModifySuccess(SMPServiceInformation.OT, "set-all", aSMPServiceInformation.getID(), aSMPServiceInformation.getServiceGroupID(), aSMPServiceInformation.getDocumentTypeIdentifier().getURIEncoded(), aSMPServiceInformation.getAllProcesses(), aSMPServiceInformation.getExtensionsAsString());
        m_aCBs.forEach(x -> x.onSMPServiceInformationUpdated(aSMPServiceInformation));
    } else {
        AuditHelper.onAuditCreateSuccess(SMPServiceInformation.OT, aSMPServiceInformation.getID(), aSMPServiceInformation.getServiceGroupID(), aSMPServiceInformation.getDocumentTypeIdentifier().getURIEncoded(), aSMPServiceInformation.getAllProcesses(), aSMPServiceInformation.getExtensionsAsString());
        m_aCBs.forEach(x -> x.onSMPServiceInformationCreated(aSMPServiceInformation));
    }
    return ESuccess.SUCCESS;
}
Also used : ESuccess(com.helger.commons.state.ESuccess) DBExecutor(com.helger.db.jdbc.executor.DBExecutor) MutableBoolean(com.helger.commons.mutable.MutableBoolean) IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) ConstantPreparedStatementDataProvider(com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider) ISMPEndpoint(com.helger.phoss.smp.domain.serviceinfo.ISMPEndpoint) EChange(com.helger.commons.state.EChange) ISMPProcess(com.helger.phoss.smp.domain.serviceinfo.ISMPProcess) IProcessIdentifier(com.helger.peppolid.IProcessIdentifier) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Nonnull(javax.annotation.Nonnull)

Aggregations

ESuccess (com.helger.commons.state.ESuccess)27 Nonnull (javax.annotation.Nonnull)15 ConstantPreparedStatementDataProvider (com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider)13 DBExecutor (com.helger.db.jdbc.executor.DBExecutor)13 Nullable (javax.annotation.Nullable)9 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)8 MutableBoolean (com.helger.commons.mutable.MutableBoolean)7 Wrapper (com.helger.commons.wrapper.Wrapper)7 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)6 EChange (com.helger.commons.state.EChange)6 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)6 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)6 ValueEnforcer (com.helger.commons.ValueEnforcer)5 ReturnsMutableCopy (com.helger.commons.annotation.ReturnsMutableCopy)5 ICommonsList (com.helger.commons.collection.impl.ICommonsList)5 StringHelper (com.helger.commons.string.StringHelper)5 IProcessIdentifier (com.helger.peppolid.IProcessIdentifier)5 Document (org.w3c.dom.Document)5 ReturnsMutableObject (com.helger.commons.annotation.ReturnsMutableObject)4 CallbackList (com.helger.commons.callback.CallbackList)4