From b686a93c9831f287faa50c322fabae6b2984969b Mon Sep 17 00:00:00 2001 From: IlhemEssaadi <93516534+IlhemEssaadi@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:43:19 +0100 Subject: [PATCH] feat: Add videoconferencing space settings - EXO-68457 (#12) --- .../externalvisio/ExternalVisioProvider.java | 19 ++++++++++++++++++- .../dao/ExternalVisioConnectorDAO.java | 12 ++++++++++++ .../entity/ExternalVisioConnectorEntity.java | 1 + .../ExternalVisioConnectorService.java | 2 ++ .../ExternalVisioConnectorServiceImpl.java | 6 ++++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/ExternalVisioProvider.java b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/ExternalVisioProvider.java index e8c2379..c3450d5 100644 --- a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/ExternalVisioProvider.java +++ b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/ExternalVisioProvider.java @@ -16,10 +16,15 @@ */ package org.exoplatform.webconferencing.externalvisio; +import org.exoplatform.webconferencing.ActiveCallProvider; import org.exoplatform.webconferencing.CallProvider; import org.exoplatform.webconferencing.CallProviderException; import org.exoplatform.webconferencing.UserInfo; import org.exoplatform.container.configuration.ConfigurationException; +import org.exoplatform.webconferencing.externalvisio.rest.model.ExternalVisioConnector; +import org.exoplatform.webconferencing.externalvisio.service.ExternalVisioConnectorService; + +import java.util.List; public class ExternalVisioProvider extends CallProvider { @@ -33,14 +38,17 @@ public class ExternalVisioProvider extends CallProvider { */ public static final String EXTERNAL_VISIO_TITLE = "ExternalVisio"; + private ExternalVisioConnectorService externalVisioConnectorService; + /** * Instantiates a new web conferencing provider. * * @param params the params * @throws ConfigurationException the configuration exception */ - public ExternalVisioProvider(org.exoplatform.container.xml.InitParams params) throws ConfigurationException { + public ExternalVisioProvider(org.exoplatform.container.xml.InitParams params, ExternalVisioConnectorService externalVisioConnectorService) throws ConfigurationException { super(params); + this.externalVisioConnectorService = externalVisioConnectorService; } @Override @@ -67,4 +75,13 @@ public String[] getSupportedTypes() { public UserInfo.IMInfo getIMInfo(String imId) throws CallProviderException { return null; } + + @Override + public List getActiveProvidersForSpace(String spaceId) { + List externalVisioConnectors = externalVisioConnectorService.getActiveExternalVisioConnectorsForSpace(); + + return externalVisioConnectors.stream().map(externalVisioConnector -> { + return new ActiveCallProvider(externalVisioConnector.getName(), null, false); + }).toList(); + } } diff --git a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/dao/ExternalVisioConnectorDAO.java b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/dao/ExternalVisioConnectorDAO.java index b6353a5..409c2c1 100644 --- a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/dao/ExternalVisioConnectorDAO.java +++ b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/dao/ExternalVisioConnectorDAO.java @@ -38,4 +38,16 @@ public List getExternalVisioConnectors(boolean ena return Collections.emptyList(); } } + + public List getActiveExternalVisioConnectorsForSpace() { + TypedQuery query = + getEntityManager().createNamedQuery("ExternalVisioConnector.getActiveExternalVisioConnectorsForSpaces", + ExternalVisioConnectorEntity.class); + try { + return query.getResultList(); + } catch (NoResultException e) { + return Collections.emptyList(); + } + + } } diff --git a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/entity/ExternalVisioConnectorEntity.java b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/entity/ExternalVisioConnectorEntity.java index 53d0a9e..c0aed0f 100644 --- a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/entity/ExternalVisioConnectorEntity.java +++ b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/entity/ExternalVisioConnectorEntity.java @@ -28,6 +28,7 @@ @ExoEntity @Table(name = "EXTERNAL_VISIO_CONNECTOR") @NamedQuery(name = "ExternalVisioConnector.getExternalVisioConnectors", query = "SELECT connector FROM ExternalVisioConnector connector WHERE connector.enabled = :enabled ORDER BY connector.order ASC") +@NamedQuery(name = "ExternalVisioConnector.getActiveExternalVisioConnectorsForSpaces", query = "SELECT connector FROM ExternalVisioConnector connector WHERE connector.activeForSpaces = true ORDER BY connector.order ASC") @AllArgsConstructor @NoArgsConstructor @Data diff --git a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/ExternalVisioConnectorService.java b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/ExternalVisioConnectorService.java index 5112dfd..ec44e40 100644 --- a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/ExternalVisioConnectorService.java +++ b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/ExternalVisioConnectorService.java @@ -32,4 +32,6 @@ public interface ExternalVisioConnectorService { void saveExternalVisioConnectors(ExternalVisioConnectors externalVisioConnectors); ExternalVisioConnector updateExternalVisioConnector(ExternalVisioConnectorEntity externalVisioConnectorEntity) throws ObjectNotFoundException; + + List getActiveExternalVisioConnectorsForSpace(); } diff --git a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/impl/ExternalVisioConnectorServiceImpl.java b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/impl/ExternalVisioConnectorServiceImpl.java index 7ba8553..3bda608 100644 --- a/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/impl/ExternalVisioConnectorServiceImpl.java +++ b/services/src/main/java/org/exoplatform/webconferencing/externalvisio/service/impl/ExternalVisioConnectorServiceImpl.java @@ -91,4 +91,10 @@ public ExternalVisioConnector updateExternalVisioConnector(ExternalVisioConnecto } return EntityBuilder.fromEntity(externalVisioConnectorDAO.update(externalVisioConnectorEntity)); } + + @Override + public List getActiveExternalVisioConnectorsForSpace() { + List activeVisioConnectorEntityList = externalVisioConnectorDAO.getActiveExternalVisioConnectorsForSpace(); + return activeVisioConnectorEntityList.stream().map(EntityBuilder::fromEntity).toList(); + } }