use of io.lumeer.core.task.Task in project engine by Lumeer.
the class TaskProcessingFacade method onCreateLink.
public void onCreateLink(@Observes final CreateLinkInstance createLinkEvent) {
List<Task> tasks = linkCreatedTasks(new LinkInstance(createLinkEvent.getLinkInstance()));
processTasks(tasks.toArray(new Task[0]));
}
use of io.lumeer.core.task.Task in project engine by Lumeer.
the class TaskProcessingFacade method setParentForLatestTask.
private void setParentForLatestTask(Task task, Task newParent) {
Task currentTask = task;
while (currentTask.getParent() != null) {
currentTask = currentTask.getParent();
}
currentTask.setParent(newParent);
}
use of io.lumeer.core.task.Task in project engine by Lumeer.
the class TaskProcessingFacade method onUpdateLinkType.
public void onUpdateLinkType(@Observes final UpdateLinkType updateLinkType) {
if (updateLinkType.getOriginalLinkType() == null || updateLinkType.getLinkType() == null) {
return;
}
List<Task> tasks = new ArrayList<>();
AttributesDiff attributesDiff = checkAttributesDiff(updateLinkType.getOriginalLinkType().getAttributes(), updateLinkType.getLinkType().getAttributes());
String linkTypeId = updateLinkType.getOriginalLinkType().getId();
attributesDiff.getRemovedIds().forEach(removedAttributeId -> functionFacade.onDeleteLinkAttribute(linkTypeId, removedAttributeId));
attributesDiff.getRemovedFunction().forEach(removedAttributeId -> functionFacade.onDeleteLinkTypeFunction(linkTypeId, removedAttributeId));
attributesDiff.getCreatedFunction().forEach(attribute -> tasks.add(functionFacade.createTaskForCreatedLinkFunction(updateLinkType.getLinkType(), attribute)));
attributesDiff.getUpdatedFunction().forEach(attribute -> tasks.add(functionFacade.createTaskForUpdatedLinkFunction(updateLinkType.getLinkType(), attribute)));
processTasks(tasks.toArray(new Task[0]));
}
use of io.lumeer.core.task.Task in project engine by Lumeer.
the class TaskProcessingFacade method runRule.
public void runRule(final Collection collection, final String ruleName, final Document document, final String actionName) {
if (collection != null && document != null) {
Optional<RuleTask> task = createRuleTask(collection, ruleName, null, document);
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 onCreateDocument.
public void onCreateDocument(@Observes final CreateDocument createDocument) {
List<Task> tasks = documentCreatedTasks(new Document(createDocument.getDocument()));
processTasks(tasks.toArray(new Task[0]));
}
Aggregations