Commit 69ff38ff authored by michael.simon's avatar michael.simon
Browse files

Enable service event for ssh pub keys deployment for regs

parent f1a038b0
......@@ -10,6 +10,7 @@
******************************************************************************/
package edu.kit.scc.webreg.service.ssh;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -19,8 +20,10 @@ import javax.inject.Inject;
import org.slf4j.Logger;
import edu.kit.scc.webreg.dao.BaseDao;
import edu.kit.scc.webreg.dao.ServiceEventDao;
import edu.kit.scc.webreg.dao.SshPubKeyRegistryDao;
import edu.kit.scc.webreg.dao.UserDao;
import edu.kit.scc.webreg.entity.EventEntity;
import edu.kit.scc.webreg.entity.EventType;
import edu.kit.scc.webreg.entity.SshPubKeyRegistryEntity;
import edu.kit.scc.webreg.entity.SshPubKeyRegistryStatus;
......@@ -43,6 +46,9 @@ public class SshPubKeyRegistryServiceImpl extends BaseServiceImpl<SshPubKeyRegis
@Inject
private UserDao userDao;
@Inject
private ServiceEventDao serviceEventDao;
@Inject
private EventSubmitter eventSubmitter;
......@@ -69,9 +75,15 @@ public class SshPubKeyRegistryServiceImpl extends BaseServiceImpl<SshPubKeyRegis
try {
if (entity.getKeyStatus().equals(SshPubKeyRegistryStatus.PENDING)) {
eventSubmitter.submit(event, EventType.SSH_KEY_REGISTRY_APPROVAL, executor);
List<EventEntity> eventList = new ArrayList<EventEntity>(serviceEventDao.findAllByService(entity.getRegistry().getService()));
eventSubmitter.submit(event, eventList, EventType.SSH_KEY_REGISTRY_APPROVAL, executor);
}
else {
eventSubmitter.submit(event, EventType.SSH_KEY_REGISTRY_DEPLOYED, executor);
List<EventEntity> eventList = new ArrayList<EventEntity>(serviceEventDao.findAllByService(entity.getRegistry().getService()));
eventSubmitter.submit(event, eventList, EventType.SSH_KEY_REGISTRY_DEPLOYED, executor);
}
} catch (EventSubmitException e) {
logger.warn("Could not submit event", e);
......@@ -89,6 +101,9 @@ public class SshPubKeyRegistryServiceImpl extends BaseServiceImpl<SshPubKeyRegis
SshPubKeyRegistryEvent event = new SshPubKeyRegistryEvent(entity);
try {
eventSubmitter.submit(event, EventType.SSH_KEY_REGISTRY_DEPLOYED, "user-" + approverId);
List<EventEntity> eventList = new ArrayList<EventEntity>(serviceEventDao.findAllByService(entity.getRegistry().getService()));
eventSubmitter.submit(event, eventList, EventType.SSH_KEY_REGISTRY_DEPLOYED, "user-" + approverId);
} catch (EventSubmitException e) {
logger.warn("Could not submit event", e);
}
......@@ -105,6 +120,9 @@ public class SshPubKeyRegistryServiceImpl extends BaseServiceImpl<SshPubKeyRegis
SshPubKeyRegistryEvent event = new SshPubKeyRegistryEvent(entity);
try {
eventSubmitter.submit(event, EventType.SSH_KEY_REGISTRY_DENIED, "user-" + approverId);
List<EventEntity> eventList = new ArrayList<EventEntity>(serviceEventDao.findAllByService(entity.getRegistry().getService()));
eventSubmitter.submit(event, eventList, EventType.SSH_KEY_REGISTRY_DENIED, "user-" + approverId);
} catch (EventSubmitException e) {
logger.warn("Could not submit event", e);
}
......@@ -119,6 +137,9 @@ public class SshPubKeyRegistryServiceImpl extends BaseServiceImpl<SshPubKeyRegis
SshPubKeyRegistryEvent event = new SshPubKeyRegistryEvent(entity);
try {
eventSubmitter.submit(event, EventType.SSH_KEY_REGISTRY_DELETED, executor);
List<EventEntity> eventList = new ArrayList<EventEntity>(serviceEventDao.findAllByService(entity.getRegistry().getService()));
eventSubmitter.submit(event, eventList, EventType.SSH_KEY_REGISTRY_DELETED, executor);
} catch (EventSubmitException e) {
logger.warn("Could not submit event", e);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment