
uk.co.mruoc.camunda.client.task.TasksResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of camunda-rest-client Show documentation
Show all versions of camunda-rest-client Show documentation
Template repo to speed up creating new library projects
The newest version!
package uk.co.mruoc.camunda.client.task;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import lombok.Builder;
import lombok.Data;
@Builder
@Data
@JsonDeserialize(using = TasksResponseDeserializer.class)
@JsonSerialize(using = TasksResponseSerializer.class)
public class TasksResponse {
private final Collection tasks;
public TasksResponse(Task... tasks) {
this(List.of(tasks));
}
public TasksResponse(Collection tasks) {
this.tasks = tasks;
}
public int getNumberOfTasks() {
return tasks.size();
}
public Collection getTaskIds() {
return tasks.stream().map(Task::getId).collect(Collectors.toList());
}
public Optional getFirstTask() {
return tasks.stream().findFirst();
}
public Task forceGetFirstTask() {
return getFirstTask().orElseThrow(NoTasksPresentException::new);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy