Search in sources :

Example 1 with RemoveResource

use of io.lumeer.engine.api.event.RemoveResource in project engine by Lumeer.

the class CollectionPurposeChangeDetector method detectChanges.

@Override
public void detectChanges(final ResourceEvent resourceEvent) {
    if (resourceEvent instanceof UpdateResource) {
        final Collection originalCollection = (Collection) ((UpdateResource) resourceEvent).getOriginalResource();
        final Collection updatedCollection = (Collection) resourceEvent.getResource();
        if (originalCollection != null && updatedCollection != null) {
            if (originalCollection.getPurposeType() != updatedCollection.getPurposeType() && originalCollection.getPurposeType() == CollectionPurposeType.Tasks) {
                delayedActionDao.deleteAllScheduledActions(getResourcePath(resourceEvent));
            }
        }
    }
    if (resourceEvent instanceof RemoveResource) {
        delayedActionDao.deleteAllScheduledActions(getResourcePath(resourceEvent));
    }
}
Also used : UpdateResource(io.lumeer.engine.api.event.UpdateResource) Collection(io.lumeer.api.model.Collection) RemoveResource(io.lumeer.engine.api.event.RemoveResource)

Aggregations

Collection (io.lumeer.api.model.Collection)1 RemoveResource (io.lumeer.engine.api.event.RemoveResource)1 UpdateResource (io.lumeer.engine.api.event.UpdateResource)1