Skip to content

Commit

Permalink
feat: Add videoconferencing space settings - EXO-68457 (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlhemEssaadi committed Mar 4, 2024
1 parent f823f39 commit f8d796f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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
Expand All @@ -67,4 +75,13 @@ public String[] getSupportedTypes() {
public UserInfo.IMInfo getIMInfo(String imId) throws CallProviderException {
return null;
}

@Override
public List<ActiveCallProvider> getActiveProvidersForSpace(String spaceId) {
List<ExternalVisioConnector> externalVisioConnectors = externalVisioConnectorService.getActiveExternalVisioConnectorsForSpace();

return externalVisioConnectors.stream().map(externalVisioConnector -> {
return new ActiveCallProvider(externalVisioConnector.getName(), null, false);
}).toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,16 @@ public List<ExternalVisioConnectorEntity> getExternalVisioConnectors(boolean ena
return Collections.emptyList();
}
}

public List<ExternalVisioConnectorEntity> getActiveExternalVisioConnectorsForSpace() {
TypedQuery<ExternalVisioConnectorEntity> query =
getEntityManager().createNamedQuery("ExternalVisioConnector.getActiveExternalVisioConnectorsForSpaces",
ExternalVisioConnectorEntity.class);
try {
return query.getResultList();
} catch (NoResultException e) {
return Collections.emptyList();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ public interface ExternalVisioConnectorService {
void saveExternalVisioConnectors(ExternalVisioConnectors externalVisioConnectors);

ExternalVisioConnector updateExternalVisioConnector(ExternalVisioConnectorEntity externalVisioConnectorEntity) throws ObjectNotFoundException;

List<ExternalVisioConnector> getActiveExternalVisioConnectorsForSpace();
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,10 @@ public ExternalVisioConnector updateExternalVisioConnector(ExternalVisioConnecto
}
return EntityBuilder.fromEntity(externalVisioConnectorDAO.update(externalVisioConnectorEntity));
}

@Override
public List<ExternalVisioConnector> getActiveExternalVisioConnectorsForSpace() {
List<ExternalVisioConnectorEntity> activeVisioConnectorEntityList = externalVisioConnectorDAO.getActiveExternalVisioConnectorsForSpace();
return activeVisioConnectorEntityList.stream().map(EntityBuilder::fromEntity).toList();
}
}

0 comments on commit f8d796f

Please sign in to comment.