@Transactional(rollbackOn = {RuntimeException.class, ServerException.class}) protected Optional<WorkspaceImpl> doRemove(String id) throws ServerException { final WorkspaceImpl workspace = managerProvider.get().find(WorkspaceImpl.class, id); if (workspace == null) { return Optional.empty(); } final EntityManager manager = managerProvider.get(); eventService .publish(new BeforeWorkspaceRemovedEvent(new WorkspaceImpl(workspace))) .propagateException(); manager.remove(workspace); manager.flush(); return Optional.of(workspace); }
@Override public void onCascadeEvent(BeforeWorkspaceRemovedEvent event) throws Exception { signatureKeyDao.remove(event.getWorkspace().getId()); } }
@Override public void onCascadeEvent(BeforeWorkspaceRemovedEvent event) throws Exception { removeWorkers(event.getWorkspace().getId(), PAGE_SIZE); }
@Transactional(rollbackOn = {RuntimeException.class, ServerException.class}) protected Optional<WorkspaceImpl> doRemove(String id) throws ServerException { final WorkspaceImpl workspace = managerProvider.get().find(WorkspaceImpl.class, id); if (workspace == null) { return Optional.empty(); } final EntityManager manager = managerProvider.get(); eventService .publish(new BeforeWorkspaceRemovedEvent(new WorkspaceImpl(workspace))) .propagateException(); manager.remove(workspace); manager.flush(); return Optional.of(workspace); }