use of com.helger.phase4.model.pmode.PModeReceptionAwareness in project phase4 by phax.
the class ENTSOGPMode method generatePModeReceptionAwareness.
@Nonnull
public static PModeReceptionAwareness generatePModeReceptionAwareness() {
final ETriState eReceptionAwareness = ETriState.TRUE;
final ETriState eRetry = ETriState.TRUE;
final int nMaxRetries = 1;
final int nRetryIntervalMS = 10_000;
final ETriState eDuplicateDetection = ETriState.TRUE;
return new PModeReceptionAwareness(eReceptionAwareness, eRetry, nMaxRetries, nRetryIntervalMS, eDuplicateDetection);
}
use of com.helger.phase4.model.pmode.PModeReceptionAwareness in project phase4 by phax.
the class PModeJsonConverter method convertToNative.
@Nonnull
public static PMode convertToNative(@Nonnull final IJsonObject aElement) {
final IJsonObject aInit = aElement.getAsObject(ELEMENT_INITIATOR);
final PModeParty aInitiator = aInit == null ? null : PModePartyJsonConverter.convertToNative(aInit);
final IJsonObject aResp = aElement.getAsObject(ELEMENT_RESPONDER);
final PModeParty aResponder = aResp == null ? null : PModePartyJsonConverter.convertToNative(aResp);
final String sAgreement = aElement.getAsString(ATTR_AGREEMENT);
final String sMEP = aElement.getAsString(ATTR_MEP);
final EMEP eMEP = EMEP.getFromIDOrNull(sMEP);
if (eMEP == null)
throw new IllegalStateException("Failed to resolve MEP '" + sMEP + "'");
final String sMEPBinding = aElement.getAsString(ATTR_MEP_BINDING);
final EMEPBinding eMEPBinding = EMEPBinding.getFromIDOrNull(sMEPBinding);
if (eMEPBinding == null)
throw new IllegalStateException("Failed to resolve MEPBinding '" + sMEPBinding + "'");
final IJsonObject aL1 = aElement.getAsObject(ELEMENT_LEG1);
final PModeLeg aLeg1 = aL1 == null ? null : PModeLegJsonConverter.convertToNative(aL1);
final IJsonObject aL2 = aElement.getAsObject(ELEMENT_LEG2);
final PModeLeg aLeg2 = aL2 == null ? null : PModeLegJsonConverter.convertToNative(aL2);
final IJsonObject aPS = aElement.getAsObject(ELEMENT_PAYLOADSERVICE);
final PModePayloadService aPayloadService = aPS == null ? null : PModePayloadServiceJsonConverter.convertToNative(aPS);
final IJsonObject aRA = aElement.getAsObject(ELEMENT_RECEPETIONAWARENESS);
final PModeReceptionAwareness aReceptionAwareness = aRA == null ? null : PModeReceptionAwarenessJsonConverter.convertToNative(aRA);
return new PMode(getStubObject(aElement), aInitiator, aResponder, sAgreement, eMEP, eMEPBinding, aLeg1, aLeg2, aPayloadService, aReceptionAwareness);
}
use of com.helger.phase4.model.pmode.PModeReceptionAwareness in project phase4 by phax.
the class PModeMicroTypeConverter method convertToNative.
@Nonnull
public PMode convertToNative(@Nonnull final IMicroElement aElement) {
final PModeParty aInitiator = MicroTypeConverter.convertToNative(aElement.getFirstChildElement(ELEMENT_INITIATOR), PModeParty.class);
final PModeParty aResponder = MicroTypeConverter.convertToNative(aElement.getFirstChildElement(ELEMENT_RESPONDER), PModeParty.class);
final String sAgreement = aElement.getAttributeValue(ATTR_AGREEMENT);
final String sMEP = aElement.getAttributeValue(ATTR_MEP);
final EMEP eMEP = EMEP.getFromIDOrNull(sMEP);
if (eMEP == null)
throw new IllegalStateException("Failed to resolve MEP '" + sMEP + "'");
final String sMEPBinding = aElement.getAttributeValue(ATTR_MEP_BINDING);
final EMEPBinding eMEPBinding = EMEPBinding.getFromIDOrNull(sMEPBinding);
if (eMEPBinding == null)
throw new IllegalStateException("Failed to resolve MEPBinding '" + sMEPBinding + "'");
final PModeLeg aLeg1 = MicroTypeConverter.convertToNative(aElement.getFirstChildElement(ELEMENT_LEG1), PModeLeg.class);
final PModeLeg aLeg2 = MicroTypeConverter.convertToNative(aElement.getFirstChildElement(ELEMENT_LEG2), PModeLeg.class);
final PModePayloadService aPayloadService = MicroTypeConverter.convertToNative(aElement.getFirstChildElement(ELEMENT_PAYLOADSERVICE), PModePayloadService.class);
final PModeReceptionAwareness aReceptionAwareness = MicroTypeConverter.convertToNative(aElement.getFirstChildElement(ELEMENT_RECEPETIONAWARENESS), PModeReceptionAwareness.class);
return new PMode(getStubObject(aElement), aInitiator, aResponder, sAgreement, eMEP, eMEPBinding, aLeg1, aLeg2, aPayloadService, aReceptionAwareness);
}
use of com.helger.phase4.model.pmode.PModeReceptionAwareness in project phase4 by phax.
the class AbstractAS4Client method setValuesFromPMode.
public final void setValuesFromPMode(@Nullable final IPMode aPMode, @Nullable final PModeLeg aLeg) {
if (aPMode != null) {
final PModeReceptionAwareness aRA = aPMode.getReceptionAwareness();
if (aRA != null && aRA.isRetryDefined()) {
m_aHttpRetrySettings.setMaxRetries(aRA.getMaxRetries());
m_aHttpRetrySettings.setDurationBeforeRetry(Duration.ofMillis(aRA.getRetryIntervalMS()));
} else {
// 0 means "no retries"
m_aHttpRetrySettings.setMaxRetries(0);
}
}
if (aLeg != null) {
signingParams().setFromPMode(aLeg.getSecurity());
cryptParams().setFromPMode(aLeg.getSecurity());
}
}
use of com.helger.phase4.model.pmode.PModeReceptionAwareness in project phase4 by phax.
the class PeppolPMode method generatePModeReceptionAwareness.
@Nonnull
public static PModeReceptionAwareness generatePModeReceptionAwareness() {
final ETriState eReceptionAwareness = ETriState.TRUE;
final ETriState eRetry = ETriState.TRUE;
final int nMaxRetries = 1;
final int nRetryIntervalMS = 10_000;
final ETriState eDuplicateDetection = ETriState.TRUE;
return new PModeReceptionAwareness(eReceptionAwareness, eRetry, nMaxRetries, nRetryIntervalMS, eDuplicateDetection);
}
Aggregations