Search in sources :

Example 1 with BeforeDevfileRemovedEvent

use of org.eclipse.che.api.devfile.server.event.BeforeDevfileRemovedEvent in project che-server by eclipse-che.

the class JpaUserDevfileDao method doRemove.

@Transactional(rollbackOn = { RuntimeException.class, ServerException.class })
protected void doRemove(String id) throws ServerException {
    final EntityManager manager = managerProvider.get();
    final UserDevfileImpl devfile = manager.find(UserDevfileImpl.class, id);
    if (devfile != null) {
        eventService.publish(new BeforeDevfileRemovedEvent(new UserDevfileImpl(devfile))).propagateException();
        manager.remove(devfile);
        manager.flush();
    }
}
Also used : EntityManager(javax.persistence.EntityManager) BeforeDevfileRemovedEvent(org.eclipse.che.api.devfile.server.event.BeforeDevfileRemovedEvent) UserDevfileImpl(org.eclipse.che.api.devfile.server.model.impl.UserDevfileImpl) Transactional(com.google.inject.persist.Transactional)

Example 2 with BeforeDevfileRemovedEvent

use of org.eclipse.che.api.devfile.server.event.BeforeDevfileRemovedEvent in project devspaces-images by redhat-developer.

the class JpaUserDevfileDao method doRemove.

@Transactional(rollbackOn = { RuntimeException.class, ServerException.class })
protected void doRemove(String id) throws ServerException {
    final EntityManager manager = managerProvider.get();
    final UserDevfileImpl devfile = manager.find(UserDevfileImpl.class, id);
    if (devfile != null) {
        eventService.publish(new BeforeDevfileRemovedEvent(new UserDevfileImpl(devfile))).propagateException();
        manager.remove(devfile);
        manager.flush();
    }
}
Also used : EntityManager(javax.persistence.EntityManager) BeforeDevfileRemovedEvent(org.eclipse.che.api.devfile.server.event.BeforeDevfileRemovedEvent) UserDevfileImpl(org.eclipse.che.api.devfile.server.model.impl.UserDevfileImpl) Transactional(com.google.inject.persist.Transactional)

Aggregations

Transactional (com.google.inject.persist.Transactional)2 EntityManager (javax.persistence.EntityManager)2 BeforeDevfileRemovedEvent (org.eclipse.che.api.devfile.server.event.BeforeDevfileRemovedEvent)2 UserDevfileImpl (org.eclipse.che.api.devfile.server.model.impl.UserDevfileImpl)2