Search in sources :

Example 11 with SMLInfo

use of com.helger.peppol.sml.SMLInfo in project phoss-smp by phax.

the class SMLInfoManagerXML method updateSMLInfo.

@Nonnull
public EChange updateSMLInfo(@Nullable final String sSMLInfoID, @Nonnull @Nonempty final String sDisplayName, @Nonnull @Nonempty final String sDNSZone, @Nonnull @Nonempty final String sManagementServiceURL, final boolean bClientCertificateRequired) {
    final SMLInfo aSMLInfo = getOfID(sSMLInfoID);
    if (aSMLInfo == null) {
        AuditHelper.onAuditModifyFailure(SMLInfo.OT, "set-all", sSMLInfoID, "no-such-id");
        return EChange.UNCHANGED;
    }
    m_aRWLock.writeLock().lock();
    try {
        EChange eChange = EChange.UNCHANGED;
        eChange = eChange.or(aSMLInfo.setDisplayName(sDisplayName));
        eChange = eChange.or(aSMLInfo.setDNSZone(sDNSZone));
        eChange = eChange.or(aSMLInfo.setManagementServiceURL(sManagementServiceURL));
        eChange = eChange.or(aSMLInfo.setClientCertificateRequired(bClientCertificateRequired));
        if (eChange.isUnchanged())
            return EChange.UNCHANGED;
        internalUpdateItem(aSMLInfo);
    } finally {
        m_aRWLock.writeLock().unlock();
    }
    AuditHelper.onAuditModifySuccess(SMLInfo.OT, "set-all", sSMLInfoID, sDisplayName, sDNSZone, sManagementServiceURL, Boolean.valueOf(bClientCertificateRequired));
    return EChange.CHANGED;
}
Also used : SMLInfo(com.helger.peppol.sml.SMLInfo) ISMLInfo(com.helger.peppol.sml.ISMLInfo) EChange(com.helger.commons.state.EChange) Nonnull(javax.annotation.Nonnull)

Example 12 with SMLInfo

use of com.helger.peppol.sml.SMLInfo in project phoss-smp by phax.

the class SMLInfoManagerXML method deleteSMLInfo.

@Nullable
public EChange deleteSMLInfo(@Nullable final String sSMLInfoID) {
    if (StringHelper.hasNoText(sSMLInfoID))
        return EChange.UNCHANGED;
    m_aRWLock.writeLock().lock();
    try {
        final SMLInfo aSMLInfo = internalDeleteItem(sSMLInfoID);
        if (aSMLInfo == null) {
            AuditHelper.onAuditDeleteFailure(SMLInfo.OT, sSMLInfoID, "no-such-id");
            return EChange.UNCHANGED;
        }
    } finally {
        m_aRWLock.writeLock().unlock();
    }
    AuditHelper.onAuditDeleteSuccess(SMLInfo.OT, sSMLInfoID);
    return EChange.CHANGED;
}
Also used : SMLInfo(com.helger.peppol.sml.SMLInfo) ISMLInfo(com.helger.peppol.sml.ISMLInfo) Nullable(javax.annotation.Nullable)

Example 13 with SMLInfo

use of com.helger.peppol.sml.SMLInfo in project phoss-smp by phax.

the class SMLInfoManagerXML method createSMLInfo.

@Nonnull
public ISMLInfo createSMLInfo(@Nonnull @Nonempty final String sDisplayName, @Nonnull @Nonempty final String sDNSZone, @Nonnull @Nonempty final String sManagementServiceURL, final boolean bClientCertificateRequired) {
    final SMLInfo aSMLInfo = new SMLInfo(sDisplayName, sDNSZone, sManagementServiceURL, bClientCertificateRequired);
    m_aRWLock.writeLocked(() -> {
        internalCreateItem(aSMLInfo);
    });
    AuditHelper.onAuditCreateSuccess(SMLInfo.OT, aSMLInfo.getID(), sDisplayName, sDNSZone, sManagementServiceURL, Boolean.valueOf(bClientCertificateRequired));
    return aSMLInfo;
}
Also used : SMLInfo(com.helger.peppol.sml.SMLInfo) ISMLInfo(com.helger.peppol.sml.ISMLInfo) Nonnull(javax.annotation.Nonnull)

Example 14 with SMLInfo

use of com.helger.peppol.sml.SMLInfo in project peppol-practical by phax.

the class SMLConfigurationManager method createSMLInfo.

@Nonnull
public ISMLConfiguration createSMLInfo(@Nonnull @Nonempty final String sSMLInfoID, @Nonnull @Nonempty final String sDisplayName, @Nonnull @Nonempty final String sDNSZone, @Nonnull @Nonempty final String sManagementServiceURL, final boolean bClientCertificateRequired, @Nonnull final ESMPAPIType eSMPAPIType, @Nonnull final ESMPIdentifierType eSMPIdentifierType, final boolean bProduction) {
    final SMLInfo aSMLInfo = new SMLInfo(sSMLInfoID, sDisplayName, sDNSZone, sManagementServiceURL, bClientCertificateRequired);
    final SMLConfiguration aExtSMLInfo = new SMLConfiguration(aSMLInfo, eSMPAPIType, eSMPIdentifierType, bProduction);
    m_aRWLock.writeLocked(() -> {
        internalCreateItem(aExtSMLInfo);
    });
    AuditHelper.onAuditCreateSuccess(SMLInfo.OT, sSMLInfoID, sDisplayName, sDNSZone, sManagementServiceURL, Boolean.valueOf(bClientCertificateRequired), eSMPAPIType, eSMPIdentifierType, Boolean.valueOf(bProduction));
    return aExtSMLInfo;
}
Also used : SMLConfiguration(com.helger.peppol.domain.SMLConfiguration) ISMLConfiguration(com.helger.peppol.domain.ISMLConfiguration) SMLInfo(com.helger.peppol.sml.SMLInfo) Nonnull(javax.annotation.Nonnull)

Aggregations

SMLInfo (com.helger.peppol.sml.SMLInfo)14 ISMLInfo (com.helger.peppol.sml.ISMLInfo)11 Nonnull (javax.annotation.Nonnull)8 Test (org.junit.Test)4 EChange (com.helger.commons.state.EChange)3 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)3 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)3 IgnoredNaptrTest (com.helger.smpclient.IgnoredNaptrTest)3 SignedServiceMetadataType (com.helger.xsds.bdxr.smp1.SignedServiceMetadataType)3 Ignore (org.junit.Ignore)3 ISMLConfiguration (com.helger.peppol.domain.ISMLConfiguration)2 SMLConfiguration (com.helger.peppol.domain.SMLConfiguration)2 Nullable (javax.annotation.Nullable)2 ESMPAPIType (com.helger.peppol.sml.ESMPAPIType)1 ESMPIdentifierType (com.helger.peppolid.factory.ESMPIdentifierType)1 IMicroElement (com.helger.xml.microdom.IMicroElement)1 KeyStore (java.security.KeyStore)1 Document (org.bson.Document)1