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();
}
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");
}
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);
}
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;
}
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;
}
Aggregations