Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add videoconferencing space settings - EXO-68457 #12

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing is missing here :
for each externalVisioConnector, you need to get the associated setting for the current space

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();
}
}
Loading