package at.gv.egiz.moazs.scheme; import at.gv.zustellung.app2mzs.xsd.Mzs2AppPortType; import at.gv.zustellung.msg.xsd.DeliveryAnswerType; import javax.xml.bind.JAXBElement; import java.util.Optional; import java.util.concurrent.CompletableFuture; /** * Represents responses to DeliveryRequests that were received from the msg service. * @param The type of the response. */ public abstract class MsgResponse { protected String id; protected MsgResponse(){ this.id = ""; } public static String createResponseId(String appDeliveryID, String idSuffix) { return appDeliveryID + idSuffix; } public String getResponseID() { return id; } public abstract T getResponse(); public abstract JAXBElement getResponseAsJAXBElement(); public abstract String getAppDeliveryID(); public abstract String getZSDeliveryID(); public abstract DeliveryAnswerType getAnswer(); /** * Create an error response that is based on the current response. * @param text describes the error. * @param code contains an error code. * @return Deep Copy of response but of "error" type */ public abstract MsgResponse generateError(String text, String code); public abstract CompletableFuture sendToMzsClient(Msg2MzsConverter converter, Optional signedStatus, Mzs2AppPortType client); }