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));
}
}
Aggregations