Search in sources :

Example 1 with WebhookSettings

use of edu.stanford.bmir.protege.web.shared.projectsettings.WebhookSettings in project webprotege by protegeproject.

the class ProjectDetailsManagerImpl method getProjectSettings.

@Override
public ProjectSettings getProjectSettings(ProjectId projectId) throws UnknownProjectException {
    List<SlackWebhook> projectWebhooks = slackWebhookRepository.getWebhooks(projectId);
    String slackPayloadUrl = projectWebhooks.stream().findFirst().map(SlackWebhook::getPayloadUrl).orElse("");
    List<WebhookSetting> webhookSettings = webhookRepository.getProjectWebhooks(projectId).stream().map(wh -> new WebhookSetting(wh.getPayloadUrl(), new LinkedHashSet<ProjectWebhookEventType>(wh.getSubscribedToEvents()))).collect(toList());
    ProjectDetails projectDetails = getProjectDetails(projectId);
    return new ProjectSettings(projectId, projectDetails.getDisplayName(), projectDetails.getDescription(), new SlackIntegrationSettings(slackPayloadUrl), new WebhookSettings(webhookSettings));
}
Also used : UnknownProjectException(edu.stanford.bmir.protege.web.shared.project.UnknownProjectException) WebhookRepository(edu.stanford.bmir.protege.web.server.webhook.WebhookRepository) java.util(java.util) ProjectWebhook(edu.stanford.bmir.protege.web.shared.webhook.ProjectWebhook) SlackIntegrationSettings(edu.stanford.bmir.protege.web.shared.projectsettings.SlackIntegrationSettings) ProjectDetails(edu.stanford.bmir.protege.web.shared.project.ProjectDetails) WebhookSettings(edu.stanford.bmir.protege.web.shared.projectsettings.WebhookSettings) ProjectWebhookEventType(edu.stanford.bmir.protege.web.shared.webhook.ProjectWebhookEventType) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) SlackWebhookRepository(edu.stanford.bmir.protege.web.server.webhook.SlackWebhookRepository) Inject(javax.inject.Inject) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) Collectors.toList(java.util.stream.Collectors.toList) NewProjectSettings(edu.stanford.bmir.protege.web.shared.project.NewProjectSettings) SlackWebhook(edu.stanford.bmir.protege.web.shared.webhook.SlackWebhook) WebhookSetting(edu.stanford.bmir.protege.web.shared.projectsettings.WebhookSetting) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) ProjectSettings(edu.stanford.bmir.protege.web.shared.projectsettings.ProjectSettings) ProjectWebhookEventType(edu.stanford.bmir.protege.web.shared.webhook.ProjectWebhookEventType) ProjectDetails(edu.stanford.bmir.protege.web.shared.project.ProjectDetails) WebhookSettings(edu.stanford.bmir.protege.web.shared.projectsettings.WebhookSettings) SlackWebhook(edu.stanford.bmir.protege.web.shared.webhook.SlackWebhook) WebhookSetting(edu.stanford.bmir.protege.web.shared.projectsettings.WebhookSetting) SlackIntegrationSettings(edu.stanford.bmir.protege.web.shared.projectsettings.SlackIntegrationSettings) NewProjectSettings(edu.stanford.bmir.protege.web.shared.project.NewProjectSettings) ProjectSettings(edu.stanford.bmir.protege.web.shared.projectsettings.ProjectSettings)

Aggregations

Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 SlackWebhookRepository (edu.stanford.bmir.protege.web.server.webhook.SlackWebhookRepository)1 WebhookRepository (edu.stanford.bmir.protege.web.server.webhook.WebhookRepository)1 NewProjectSettings (edu.stanford.bmir.protege.web.shared.project.NewProjectSettings)1 ProjectDetails (edu.stanford.bmir.protege.web.shared.project.ProjectDetails)1 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)1 UnknownProjectException (edu.stanford.bmir.protege.web.shared.project.UnknownProjectException)1 ProjectSettings (edu.stanford.bmir.protege.web.shared.projectsettings.ProjectSettings)1 SlackIntegrationSettings (edu.stanford.bmir.protege.web.shared.projectsettings.SlackIntegrationSettings)1 WebhookSetting (edu.stanford.bmir.protege.web.shared.projectsettings.WebhookSetting)1 WebhookSettings (edu.stanford.bmir.protege.web.shared.projectsettings.WebhookSettings)1 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)1 ProjectWebhook (edu.stanford.bmir.protege.web.shared.webhook.ProjectWebhook)1 ProjectWebhookEventType (edu.stanford.bmir.protege.web.shared.webhook.ProjectWebhookEventType)1 SlackWebhook (edu.stanford.bmir.protege.web.shared.webhook.SlackWebhook)1 java.util (java.util)1 Collectors.toList (java.util.stream.Collectors.toList)1 Inject (javax.inject.Inject)1