From 1443725033521236f8fa5d24216c3b25b07d165b Mon Sep 17 00:00:00 2001 From: Maciej Czarnecki Date: Thu, 27 Jun 2024 15:31:20 +0200 Subject: [PATCH] Actility: support custom webhook url --- .../lora/ns/actility/ActilityConnector.java | 10 ++++++++ .../ns/actility/ConnectorWizardStep1.java | 23 ++++++------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/java/lora-ns-actility/src/main/java/lora/ns/actility/ActilityConnector.java b/java/lora-ns-actility/src/main/java/lora/ns/actility/ActilityConnector.java index 8bc29d7ba..5b13d3398 100644 --- a/java/lora-ns-actility/src/main/java/lora/ns/actility/ActilityConnector.java +++ b/java/lora-ns-actility/src/main/java/lora/ns/actility/ActilityConnector.java @@ -1,5 +1,7 @@ package lora.ns.actility; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + import java.math.BigDecimal; import java.security.SecureRandom; import java.security.cert.X509Certificate; @@ -7,6 +9,7 @@ import java.util.Base64; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Properties; import javax.net.ssl.HostnameVerifier; @@ -274,6 +277,13 @@ public void configureRoutings(String url, String tenant, String login, String pa } } + @Override + public Optional getCustomRoutingBaseUrl() { + return isNotBlank(properties.getProperty("webhook-url")) ? + Optional.of(properties.getProperty("webhook-url")) : + super.getCustomRoutingBaseUrl(); + } + @Override public void removeRoutings() { // Don't remove the connections, update them diff --git a/java/lora-ns-actility/src/main/java/lora/ns/actility/ConnectorWizardStep1.java b/java/lora-ns-actility/src/main/java/lora/ns/actility/ConnectorWizardStep1.java index 9665ba614..61bb24259 100644 --- a/java/lora-ns-actility/src/main/java/lora/ns/actility/ConnectorWizardStep1.java +++ b/java/lora-ns-actility/src/main/java/lora/ns/actility/ConnectorWizardStep1.java @@ -1,27 +1,18 @@ package lora.ns.actility; -import java.util.LinkedList; import java.util.List; - import lora.ns.connector.LNSConnectorWizardStep; import lora.ns.connector.PropertyDescription; -import lora.ns.connector.PropertyDescription.PropertyType; public class ConnectorWizardStep1 implements LNSConnectorWizardStep { - protected LinkedList propertyDescriptions = new LinkedList<>(); - { - propertyDescriptions.add(new PropertyDescription("url", "URL", true, null, null, null, null, null, null, null, - PropertyType.TEXT, false)); - propertyDescriptions.add(new PropertyDescription("username", "Username", true, null, null, null, null, null, - null, null, PropertyType.TEXT, false)); - propertyDescriptions.add(new PropertyDescription("password", "Password", true, null, null, null, null, null, - null, null, PropertyType.PASSWORD, true)); - propertyDescriptions.add(new PropertyDescription("domain", "Domain", false, null, null, null, null, null, null, - null, PropertyType.TEXT, false)); - propertyDescriptions.add(new PropertyDescription("group", "Group", false, null, null, null, null, null, null, - null, PropertyType.TEXT, false)); - } + protected List propertyDescriptions = List.of( + PropertyDescription.text("url", "URL", true), + PropertyDescription.text("username", "Username", true), + PropertyDescription.password("password", "Password"), + PropertyDescription.text("domain", "Domain", false), + PropertyDescription.text("group", "Group", false), + PropertyDescription.text("webhook-url", "Webhook URL", false)); @Override public String getName() {