com.harrys.hyppo.source.api.model.TaskAssociations Maven / Gradle / Ivy
package com.harrys.hyppo.source.api.model;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created by jpetty on 11/9/15.
*/
public final class TaskAssociations {
public static final List resetJobReferences(final DataIngestionJob job, final List tasks) {
if (job == null){
return stripJobReferences(tasks);
} else {
return tasks.stream().map(t -> job.equals(t.getIngestionJob()) ? t : t.cloneWithJob(job)).collect(Collectors.toList());
}
}
public static final List stripJobReferences(final List tasks) {
return tasks.stream().map(t -> (t.getIngestionJob() == null) ? t : t.cloneWithJob(null)).collect(Collectors.toList());
}
}