use of edu.stanford.bmir.protege.web.shared.webhook.ProjectWebhook in project webprotege by protegeproject.
the class ProjectDetailsManagerImpl method setProjectSettings.
@Override
public void setProjectSettings(ProjectSettings projectSettings) {
ProjectId projectId = projectSettings.getProjectId();
Optional<ProjectDetails> record = repository.findOne(projectId);
if (!record.isPresent()) {
return;
}
ProjectDetails updatedRecord = record.get().builder().setDisplayName(projectSettings.getProjectDisplayName()).setDescription(projectSettings.getProjectDescription()).build();
repository.save(updatedRecord);
slackWebhookRepository.clearWebhooks(projectId);
String payloadUrl = projectSettings.getSlackIntegrationSettings().getPayloadUrl();
if (!payloadUrl.isEmpty()) {
slackWebhookRepository.addWebhooks(Collections.singletonList(new SlackWebhook(projectId, payloadUrl)));
}
webhookRepository.clearProjectWebhooks(projectId);
List<ProjectWebhook> projectWebhooks = projectSettings.getWebhookSettings().getWebhookSettings().stream().map(s -> new ProjectWebhook(projectId, s.getPayloadUrl(), new ArrayList<ProjectWebhookEventType>(s.getEventTypes()))).collect(toList());
webhookRepository.addProjectWebhooks(projectWebhooks);
}
use of edu.stanford.bmir.protege.web.shared.webhook.ProjectWebhook in project webprotege by protegeproject.
the class WebhookRepositoryImpl_IT method setUp.
@Before
public void setUp() throws Exception {
client = MongoTestUtils.createMongoClient();
Morphia morphia = MongoTestUtils.createMorphia();
datastore = morphia.createDatastore(client, MongoTestUtils.getTestDbName());
repository = new WebhookRepositoryImpl(datastore);
projectId = ProjectId.get(UUID.randomUUID().toString());
subscribedToEvents = Collections.singletonList(PROJECT_CHANGED);
webhook = new ProjectWebhook(projectId, PAYLOAD_URL, subscribedToEvents);
repository.addProjectWebhooks(Collections.singletonList(webhook));
}
Aggregations