From 952585a6aee0cfaec1da42e82ff90d5801f787b1 Mon Sep 17 00:00:00 2001 From: Oliver Reifferscheidt Date: Tue, 23 Jul 2024 12:40:59 +0200 Subject: [PATCH] added action and service as parameter to createBDEWPMode --- .../helger/phase4/profile/bdew/BDEWPMode.java | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/phase4-profile-bdew/src/main/java/com/helger/phase4/profile/bdew/BDEWPMode.java b/phase4-profile-bdew/src/main/java/com/helger/phase4/profile/bdew/BDEWPMode.java index d4ff4ef15..87fbd2f57 100644 --- a/phase4-profile-bdew/src/main/java/com/helger/phase4/profile/bdew/BDEWPMode.java +++ b/phase4-profile-bdew/src/main/java/com/helger/phase4/profile/bdew/BDEWPMode.java @@ -107,6 +107,14 @@ public static PModeLegBusinessInformation generatePModeLegBusinessInformation () return PModeLegBusinessInformation.create (sService, sAction, nPayloadProfileMaxKB, sMPCID); } + @Nonnull + public static PModeLegBusinessInformation generatePModeLegBusinessInformation (final String sService, final String sAction) + { + final Long nPayloadProfileMaxKB = null; + final String sMPCID = CAS4.DEFAULT_MPC_ID; + return PModeLegBusinessInformation.create (sService, sAction, nPayloadProfileMaxKB, sMPCID); + } + @Nonnull public static PModeLegErrorHandling generatePModeLegErrorHandling () { @@ -153,6 +161,16 @@ public static PModeLeg generatePModeLeg (@Nullable final String sResponderAddres generatePModeLegSecurity ()); } + @Nonnull + public static PModeLeg generatePModeLeg (@Nullable final String sResponderAddress, final String sService, final String sAction) + { + return new PModeLeg (generatePModeLegProtocol (sResponderAddress), + generatePModeLegBusinessInformation (sService, sAction), + generatePModeLegErrorHandling (), + null, + generatePModeLegSecurity ()); + } + @Nonnull public static PModePayloadService generatePModePayloadSevice () { @@ -226,6 +244,40 @@ public static PMode createBDEWPMode (@Nonnull @Nonempty final String sInitiatorI } return aPMode; } + @Nonnull + public static PMode createBDEWPMode (@Nonnull @Nonempty final String sInitiatorID, + @Nonnull @Nonempty final String sInitiatorType, + @Nonnull @Nonempty final String sResponderID, + @Nonnull @Nonempty final String sResponderType, + @Nonnull @Nonempty final String sService, + @Nonnull @Nonempty final String sAction, + @Nullable final String sResponderAddress, + @Nonnull final IPModeIDProvider aPModeIDProvider, + final boolean bPersist) + { + final PModeParty aInitiator = new PModeParty (sInitiatorType, sInitiatorID, CAS4.DEFAULT_INITIATOR_URL, null, null); + final PModeParty aResponder = new PModeParty (sResponderType, sResponderID, CAS4.DEFAULT_RESPONDER_URL, null, null); + + final PMode aPMode = new PMode (aPModeIDProvider.getPModeID (aInitiator, aResponder), + aInitiator, + aResponder, + DEFAULT_AGREEMENT_ID, + EMEP.ONE_WAY, + EMEPBinding.PUSH, + generatePModeLeg (sResponderAddress, sService, sAction), + null, + generatePModePayloadSevice (), + generatePModeReceptionAwareness ()); + + // Leg 2 stays null, because we only use one-way + + if (bPersist) + { + // Ensure it is stored + MetaAS4Manager.getPModeMgr ().createOrUpdatePMode (aPMode); + } + return aPMode; + } public static boolean containsService (@Nonnull final String sService) {