Search in sources :

Example 6 with SimpleDocumentTypeIdentifier

use of com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier in project phoss-directory by phax.

the class PDExtendedBusinessCard method of.

@Nonnull
public static PDExtendedBusinessCard of(@Nonnull final IJsonObject aJson) {
    final PDBusinessCard aBC = PDBusinessCard.of(aJson.getAsObject("businesscard"));
    final ICommonsList<IDocumentTypeIdentifier> aDocTypes = CommonsArrayList.createFiltered(aJson.getAsArray("doctypes"), (Predicate<IJson>) IJson::isObject, x -> new SimpleDocumentTypeIdentifier(x.getAsObject().getAsString("scheme"), x.getAsObject().getAsString("value")));
    return new PDExtendedBusinessCard(aBC, aDocTypes);
}
Also used : PDBusinessCard(com.helger.pd.businesscard.generic.PDBusinessCard) SimpleDocumentTypeIdentifier(com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier) IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) IJson(com.helger.json.IJson) Nonnull(javax.annotation.Nonnull)

Example 7 with SimpleDocumentTypeIdentifier

use of com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier in project phoss-smp by phax.

the class SMPRedirectTest method testBasic.

@Test
public void testBasic() {
    final IParticipantIdentifier aPI = new SimpleParticipantIdentifier(PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME, "0088:dummy");
    final IDocumentTypeIdentifier aDocTypeID = new SimpleDocumentTypeIdentifier(PeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_BUSDOX_DOCID_QNS, "testdoctype");
    final SMPServiceGroup aSG = new SMPServiceGroup(CSecurity.USER_ADMINISTRATOR_ID, aPI, null);
    // Create new one
    final ISMPRedirect aRedirect = new SMPRedirect(aSG, aDocTypeID, "target", "suid", null, "<extredirect/>");
    assertSame(aSG, aRedirect.getServiceGroup());
    assertEquals(aDocTypeID, aRedirect.getDocumentTypeIdentifier());
    assertEquals("target", aRedirect.getTargetHref());
    assertEquals("suid", aRedirect.getSubjectUniqueIdentifier());
    assertNull(aRedirect.getCertificate());
    assertFalse(aRedirect.hasCertificate());
    assertEquals("[{\"Any\":\"<extredirect />\"}]", aRedirect.getExtensionsAsString());
}
Also used : SimpleDocumentTypeIdentifier(com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier) IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) SMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.SMPServiceGroup) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Example 8 with SimpleDocumentTypeIdentifier

use of com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier in project phoss-smp by phax.

the class SMPServiceInformationTest method testMinimal.

@Test
public void testMinimal() {
    final IParticipantIdentifier aPI = new SimpleParticipantIdentifier(PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME, "0088:dummy");
    final ISMPServiceGroup aSG = new SMPServiceGroup(CSecurity.USER_ADMINISTRATOR_ID, aPI, null);
    final SMPEndpoint aEP = new SMPEndpoint("tp", "http://localhost/as2", false, (String) null, (XMLOffsetDateTime) null, (XMLOffsetDateTime) null, "cert", "sd", "tc", (String) null, (String) null);
    assertEquals("tp", aEP.getTransportProfile());
    assertEquals("http://localhost/as2", aEP.getEndpointReference());
    assertFalse(aEP.isRequireBusinessLevelSignature());
    assertNull(aEP.getMinimumAuthenticationLevel());
    assertNull(aEP.getServiceActivationDateTime());
    assertNull(aEP.getServiceExpirationDateTime());
    assertEquals("cert", aEP.getCertificate());
    assertEquals("sd", aEP.getServiceDescription());
    assertEquals("tc", aEP.getTechnicalContactUrl());
    assertNull(aEP.getTechnicalInformationUrl());
    assertNull(aEP.getExtensionsAsString());
    final IProcessIdentifier aProcessID = new SimpleProcessIdentifier(PeppolIdentifierHelper.DEFAULT_PROCESS_SCHEME, "testproc");
    final SMPProcess aProcess = new SMPProcess(aProcessID, CollectionHelper.newList(aEP), (String) null);
    assertEquals(aProcessID, aProcess.getProcessIdentifier());
    assertEquals(1, aProcess.getAllEndpoints().size());
    assertNull(aProcess.getExtensionsAsString());
    final IDocumentTypeIdentifier aDocTypeID = new SimpleDocumentTypeIdentifier(PeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_BUSDOX_DOCID_QNS, "testdoctype");
    final SMPServiceInformation aSI = new SMPServiceInformation(aSG, aDocTypeID, CollectionHelper.newList(aProcess), (String) null);
    assertSame(aSG, aSI.getServiceGroup());
    assertEquals(aDocTypeID, aSI.getDocumentTypeIdentifier());
    assertEquals(1, aSI.getAllProcesses().size());
    assertNull(aSI.getExtensionsAsString());
}
Also used : SimpleDocumentTypeIdentifier(com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier) SimpleProcessIdentifier(com.helger.peppolid.simple.process.SimpleProcessIdentifier) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) SMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.SMPServiceGroup) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) IProcessIdentifier(com.helger.peppolid.IProcessIdentifier) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Example 9 with SimpleDocumentTypeIdentifier

use of com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier in project phoss-smp by phax.

the class SMPRedirectManagerJDBC method getAllSMPRedirects.

@Nonnull
@ReturnsMutableCopy
public ICommonsList<ISMPRedirect> getAllSMPRedirects() {
    final ICommonsList<DBResultRow> aDBResult = newExecutor().queryAll("SELECT businessIdentifierScheme, businessIdentifier, documentIdentifierScheme, documentIdentifier, redirectionUrl, certificateUID, certificate, extension" + " FROM smp_service_metadata_red");
    final ICommonsList<ISMPRedirect> ret = new CommonsArrayList<>();
    if (aDBResult != null)
        for (final DBResultRow aRow : aDBResult) {
            final ISMPServiceGroup aServiceGroup = m_aServiceGroupMgr.getSMPServiceGroupOfID(new SimpleParticipantIdentifier(aRow.getAsString(0), aRow.getAsString(1)));
            final X509Certificate aCertificate = CertificateHelper.convertStringToCertficateOrNull(aRow.getAsString(6));
            ret.add(new SMPRedirect(aServiceGroup, new SimpleDocumentTypeIdentifier(aRow.getAsString(2), aRow.getAsString(3)), aRow.getAsString(4), aRow.getAsString(5), aCertificate, aRow.getAsString(7)));
        }
    return ret;
}
Also used : SimpleDocumentTypeIdentifier(com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier) DBResultRow(com.helger.db.jdbc.executor.DBResultRow) SMPRedirect(com.helger.phoss.smp.domain.redirect.SMPRedirect) ISMPRedirect(com.helger.phoss.smp.domain.redirect.ISMPRedirect) ISMPRedirect(com.helger.phoss.smp.domain.redirect.ISMPRedirect) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) CommonsArrayList(com.helger.commons.collection.impl.CommonsArrayList) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) X509Certificate(java.security.cert.X509Certificate) ReturnsMutableCopy(com.helger.commons.annotation.ReturnsMutableCopy) Nonnull(javax.annotation.Nonnull)

Example 10 with SimpleDocumentTypeIdentifier

use of com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier in project phoss-smp by phax.

the class SMPRedirectManagerJDBC method getAllSMPRedirectsOfServiceGroup.

@Nonnull
@ReturnsMutableCopy
public ICommonsList<ISMPRedirect> getAllSMPRedirectsOfServiceGroup(@Nullable final ISMPServiceGroup aServiceGroup) {
    final ICommonsList<ISMPRedirect> ret = new CommonsArrayList<>();
    if (aServiceGroup != null) {
        final IParticipantIdentifier aParticipantID = aServiceGroup.getParticipantIdentifier();
        final ICommonsList<DBResultRow> aDBResult = newExecutor().queryAll("SELECT documentIdentifierScheme, documentIdentifier, redirectionUrl, certificateUID, certificate, extension" + " FROM smp_service_metadata_red" + " WHERE businessIdentifierScheme=? AND businessIdentifier=?", new ConstantPreparedStatementDataProvider(aParticipantID.getScheme(), aParticipantID.getValue()));
        if (aDBResult != null)
            for (final DBResultRow aRow : aDBResult) {
                final X509Certificate aCertificate = CertificateHelper.convertStringToCertficateOrNull(aRow.getAsString(4));
                ret.add(new SMPRedirect(aServiceGroup, new SimpleDocumentTypeIdentifier(aRow.getAsString(0), aRow.getAsString(1)), aRow.getAsString(2), aRow.getAsString(3), aCertificate, aRow.getAsString(5)));
            }
    }
    return ret;
}
Also used : SimpleDocumentTypeIdentifier(com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier) DBResultRow(com.helger.db.jdbc.executor.DBResultRow) SMPRedirect(com.helger.phoss.smp.domain.redirect.SMPRedirect) ISMPRedirect(com.helger.phoss.smp.domain.redirect.ISMPRedirect) ISMPRedirect(com.helger.phoss.smp.domain.redirect.ISMPRedirect) ConstantPreparedStatementDataProvider(com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider) CommonsArrayList(com.helger.commons.collection.impl.CommonsArrayList) X509Certificate(java.security.cert.X509Certificate) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) ReturnsMutableCopy(com.helger.commons.annotation.ReturnsMutableCopy) Nonnull(javax.annotation.Nonnull)

Aggregations

SimpleDocumentTypeIdentifier (com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier)15 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)10 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)10 SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)9 Nonnull (javax.annotation.Nonnull)8 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)7 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)6 IProcessIdentifier (com.helger.peppolid.IProcessIdentifier)6 SimpleProcessIdentifier (com.helger.peppolid.simple.process.SimpleProcessIdentifier)6 ReturnsMutableCopy (com.helger.commons.annotation.ReturnsMutableCopy)5 DBResultRow (com.helger.db.jdbc.executor.DBResultRow)5 Test (org.junit.Test)5 ConstantPreparedStatementDataProvider (com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider)4 SMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.SMPServiceGroup)4 X509Certificate (java.security.cert.X509Certificate)3 ValueEnforcer (com.helger.commons.ValueEnforcer)2 MustImplementEqualsAndHashcode (com.helger.commons.annotation.MustImplementEqualsAndHashcode)2 ReturnsMutableObject (com.helger.commons.annotation.ReturnsMutableObject)2 CallbackList (com.helger.commons.callback.CallbackList)2 CommonsHashMap (com.helger.commons.collection.impl.CommonsHashMap)2