use of io.lumeer.core.task.Task in project engine by Lumeer.
the class TaskProcessingFacade method runRule.
public void runRule(final LinkType linkType, final String ruleName, final LinkInstance linkInstance, final String actionName) {
if (linkType != null && linkInstance != null) {
Optional<RuleTask> task = createRuleTask(linkType, ruleName, null, linkInstance);
Task t = task.orElse(null);
while (t != null) {
if (t instanceof RuleTask) {
((RuleTask) t).setActionName(actionName);
}
t = t.getParent();
}
task.ifPresent(this::processTasks);
}
}
use of io.lumeer.core.task.Task in project engine by Lumeer.
the class TaskProcessingFacade method onUpdateCollection.
public void onUpdateCollection(@Observes final UpdateResource updateResource) {
if (updateResource.getResource() == null || updateResource.getOriginalResource() == null || !(updateResource.getResource() instanceof Collection)) {
return;
}
List<Task> tasks = new ArrayList<>();
Collection original = (Collection) updateResource.getOriginalResource();
Collection current = (Collection) updateResource.getResource();
AttributesDiff attributesDiff = checkAttributesDiff(original.getAttributes(), current.getAttributes());
attributesDiff.getRemovedIds().forEach(removedAttributeId -> functionFacade.onDeleteCollectionAttribute(original.getId(), removedAttributeId));
attributesDiff.getRemovedFunction().forEach(removedAttributeId -> functionFacade.onDeleteCollectionFunction(original.getId(), removedAttributeId));
attributesDiff.getCreatedFunction().forEach(attribute -> tasks.add(functionFacade.createTaskForCreatedFunction(current, attribute)));
attributesDiff.getUpdatedFunction().forEach(attribute -> tasks.add(functionFacade.createTaskForUpdatedFunction(current, attribute)));
processTasks(tasks.toArray(new Task[0]));
}
Aggregations