Search in sources :

Example 6 with WorkspaceRemovedEvent

use of org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent in project devspaces-images by redhat-developer.

the class JpaWorkspaceDao method remove.

@Override
public Optional<WorkspaceImpl> remove(String id) throws ServerException {
    requireNonNull(id, "Required non-null id");
    Optional<WorkspaceImpl> workspaceOpt;
    try {
        workspaceOpt = doRemove(id);
        workspaceOpt.ifPresent(workspace -> eventService.publish(new WorkspaceRemovedEvent(workspace)));
    } catch (RuntimeException x) {
        throw new ServerException(x.getLocalizedMessage(), x);
    }
    return workspaceOpt;
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) ServerException(org.eclipse.che.api.core.ServerException) BeforeWorkspaceRemovedEvent(org.eclipse.che.api.workspace.server.event.BeforeWorkspaceRemovedEvent) WorkspaceRemovedEvent(org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent)

Example 7 with WorkspaceRemovedEvent

use of org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent in project che-server by eclipse-che.

the class MultiuserJpaWorkspaceDao method remove.

@Override
public Optional<WorkspaceImpl> remove(String id) throws ServerException {
    requireNonNull(id, "Required non-null id");
    Optional<WorkspaceImpl> workspaceOpt;
    try {
        workspaceOpt = doRemove(id);
        workspaceOpt.ifPresent(workspace -> eventService.publish(new WorkspaceRemovedEvent(workspace)));
    } catch (RuntimeException x) {
        throw new ServerException(x.getLocalizedMessage(), x);
    }
    return workspaceOpt;
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) ServerException(org.eclipse.che.api.core.ServerException) BeforeWorkspaceRemovedEvent(org.eclipse.che.api.workspace.server.event.BeforeWorkspaceRemovedEvent) WorkspaceRemovedEvent(org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent)

Example 8 with WorkspaceRemovedEvent

use of org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent in project devspaces-images by redhat-developer.

the class MultiuserJpaWorkspaceDao method remove.

@Override
public Optional<WorkspaceImpl> remove(String id) throws ServerException {
    requireNonNull(id, "Required non-null id");
    Optional<WorkspaceImpl> workspaceOpt;
    try {
        workspaceOpt = doRemove(id);
        workspaceOpt.ifPresent(workspace -> eventService.publish(new WorkspaceRemovedEvent(workspace)));
    } catch (RuntimeException x) {
        throw new ServerException(x.getLocalizedMessage(), x);
    }
    return workspaceOpt;
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) ServerException(org.eclipse.che.api.core.ServerException) BeforeWorkspaceRemovedEvent(org.eclipse.che.api.workspace.server.event.BeforeWorkspaceRemovedEvent) WorkspaceRemovedEvent(org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent)

Aggregations

WorkspaceRemovedEvent (org.eclipse.che.api.workspace.shared.event.WorkspaceRemovedEvent)8 ServerException (org.eclipse.che.api.core.ServerException)4 BeforeWorkspaceRemovedEvent (org.eclipse.che.api.workspace.server.event.BeforeWorkspaceRemovedEvent)4 WorkspaceImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl)4 Test (org.testng.annotations.Test)4