Search in sources :

Example 1 with AppReceiptType

use of no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType in project efm-integrasjonspunkt by felleslosninger.

the class PayloadUtil method getAppReceiptType.

static AppReceiptType getAppReceiptType(Object payload) throws JAXBException {
    final String payloadAsString = payloadAsString(payload);
    ByteArrayInputStream bis = new ByteArrayInputStream(payloadAsString.getBytes(StandardCharsets.UTF_8));
    JAXBContext jaxbContext = JAXBContext.newInstance("no.difi.meldingsutveksling.noarkexchange.schema");
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    JAXBElement<AppReceiptType> r = unmarshaller.unmarshal(new StreamSource(bis), AppReceiptType.class);
    return r.getValue();
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) StreamSource(javax.xml.transform.stream.StreamSource) JAXBContext(javax.xml.bind.JAXBContext) AppReceiptType(no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 2 with AppReceiptType

use of no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType in project efm-integrasjonspunkt by felleslosninger.

the class PayloadUtilTest method appReceiptMedFeilmeldingIsNotOkType.

@Test
public void appReceiptMedFeilmeldingIsNotOkType() throws JAXBException, XMLStreamException {
    PutMessageRequestType value = testData.loadFromClasspath("p360/PutMessageAppReceiptFeilmelding.xml");
    final AppReceiptType appReceiptType = PayloadUtil.getAppReceiptType(value.getPayload());
    assertNotEquals(appReceiptType.getType(), "OK");
}
Also used : PutMessageRequestType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageRequestType) AppReceiptType(no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType) Test(org.junit.jupiter.api.Test)

Example 3 with AppReceiptType

use of no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType in project efm-integrasjonspunkt by felleslosninger.

the class NextMoveAdapter method convertAppReceipt.

private NextMoveOutMessage convertAppReceipt(PutMessageRequestWrapper message) {
    AppReceiptType appReceiptType = BestEduConverter.payloadAsAppReceipt(message.getPayload());
    ArkivmeldingKvitteringMessage receipt = new ArkivmeldingKvitteringMessage(appReceiptType.getType(), message.getConversationId(), Sets.newHashSet());
    appReceiptType.getMessage().forEach(sm -> receipt.getMessages().add(new KvitteringStatusMessage(sm.getCode(), sm.getText())));
    StandardBusinessDocument sbd = createSBD.createNextMoveSBD(Organisasjonsnummer.from(message.getSenderPartynumber()), Organisasjonsnummer.from(message.getReceiverPartyNumber()), message.getConversationId(), uuidGenerator.generate(), properties.getArkivmelding().getReceiptProcess(), properties.getArkivmelding().getReceiptDocumentType(), receipt);
    return nextMoveMessageService.createMessage(sbd);
}
Also used : ArkivmeldingKvitteringMessage(no.difi.meldingsutveksling.nextmove.ArkivmeldingKvitteringMessage) StandardBusinessDocument(no.difi.meldingsutveksling.domain.sbdh.StandardBusinessDocument) KvitteringStatusMessage(no.difi.meldingsutveksling.nextmove.KvitteringStatusMessage) AppReceiptType(no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType)

Example 4 with AppReceiptType

use of no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType in project efm-integrasjonspunkt by felleslosninger.

the class PutMessageResponseFactory method createErrorResponse.

public static PutMessageResponseType createErrorResponse(String errorMsg) {
    PutMessageResponseType response = new PutMessageResponseType();
    AppReceiptType receipt = new AppReceiptType();
    receipt.setType("ERROR");
    StatusMessageType statusMessageType = new StatusMessageType();
    statusMessageType.setText(errorMsg);
    statusMessageType.setCode("Unknown");
    receipt.getMessage().add(statusMessageType);
    response.setResult(receipt);
    return response;
}
Also used : PutMessageResponseType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType) StatusMessageType(no.difi.meldingsutveksling.noarkexchange.schema.StatusMessageType) AppReceiptType(no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType)

Example 5 with AppReceiptType

use of no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType in project efm-integrasjonspunkt by felleslosninger.

the class AppReceiptFactory method from.

public AppReceiptType from(ArkivmeldingKvitteringMessage receipt) {
    AppReceiptType appReceipt = new AppReceiptType();
    appReceipt.setType(receipt.getReceiptType());
    if (receipt.getMessages() != null) {
        receipt.getMessages().forEach(sm -> {
            StatusMessageType statusMessageType = new StatusMessageType();
            statusMessageType.setText(sm.getText());
            statusMessageType.setCode(sm.getCode());
            appReceipt.getMessage().add(statusMessageType);
        });
    }
    return appReceipt;
}
Also used : StatusMessageType(no.difi.meldingsutveksling.noarkexchange.schema.StatusMessageType) AppReceiptType(no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType)

Aggregations

AppReceiptType (no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType)13 PutMessageRequestType (no.difi.meldingsutveksling.noarkexchange.schema.PutMessageRequestType)5 PutMessageResponseType (no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType)4 StatusMessageType (no.difi.meldingsutveksling.noarkexchange.schema.StatusMessageType)4 IOException (java.io.IOException)2 ArkivmeldingKvitteringMessage (no.difi.meldingsutveksling.nextmove.ArkivmeldingKvitteringMessage)2 Test (org.junit.jupiter.api.Test)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 JAXBContext (javax.xml.bind.JAXBContext)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 StreamSource (javax.xml.transform.stream.StreamSource)1 Arkivmelding (no.arkivverket.standarder.noark5.arkivmelding.Arkivmelding)1 Decryptor (no.difi.meldingsutveksling.Decryptor)1 StandardBusinessDocument (no.difi.meldingsutveksling.domain.sbdh.StandardBusinessDocument)1 MailClient (no.difi.meldingsutveksling.mail.MailClient)1 KvitteringStatusMessage (no.difi.meldingsutveksling.nextmove.KvitteringStatusMessage)1 NextMoveRuntimeException (no.difi.meldingsutveksling.nextmove.NextMoveRuntimeException)1 MeldingType (no.difi.meldingsutveksling.noarkexchange.schema.core.MeldingType)1