use of io.lumeer.core.task.executor.FunctionTaskExecutor in project engine by Lumeer.
the class FunctionTask method process.
@Override
public void process(final TaskExecutor taskExecutor, final ChangesTracker changesTracker) {
if (daoContextSnapshot.getSelectedWorkspace() != null && daoContextSnapshot.getSelectedWorkspace().getOrganization().isPresent() && daoContextSnapshot.getSelectedWorkspace().getProject().isPresent()) {
log.info(String.format("Running function task on %s/%s > Resource '%s', Attribute '%s'.", daoContextSnapshot.getSelectedWorkspace().getOrganization().get().getCode(), daoContextSnapshot.getSelectedWorkspace().getProject().get().getCode(), collection != null ? collection.getName() : linkType.getName(), attribute.getName()));
}
if (documents != null && collection != null) {
getDocumentsWithData(collection, documents).forEach(document -> {
originalDocuments.put(document.getId(), new Document(document));
final FunctionTaskExecutor executor = new FunctionTaskExecutor(this, collection, document);
changesTracker.merge(executor.execute(taskExecutor));
});
} else if (linkType != null && linkInstances != null) {
getLinkInstancesWithData(linkType, linkInstances).forEach(linkInstance -> {
originalLinkInstances.put(linkInstance.getId(), new LinkInstance(linkInstance));
final FunctionTaskExecutor executor = new FunctionTaskExecutor(this, linkType, linkInstance);
changesTracker.merge(executor.execute(taskExecutor));
});
}
if (parent != null) {
parent.process(taskExecutor, changesTracker);
}
}
Aggregations