/******************************************************************************* *******************************************************************************/ package at.gv.egiz.eaaf.core.impl.idp.process.model; import java.io.Serializable; import org.apache.commons.collections4.CollectionUtils; import at.gv.egiz.eaaf.core.api.idp.process.Task; /** * Represents information about a single task to be performed upon process execution. * @author tknall * */ public class TaskInfo extends ProcessNode implements Serializable { private static final long serialVersionUID = 1L; private static final boolean DEFAULT_ASYNC = false; private String taskImplementingClass; private boolean async = DEFAULT_ASYNC; /** * Determines if the task is marked asynchronous ({@code true}) or synchronous ({@code false}). * @return A flag indicating if the task should be executed asynchronously or synchronously. (Default: {@code false}) */ public boolean isAsync() { return async; } /** * Marks a task to executed asynchronously ({@code true}) or synchronously ({@code false}). * @param async The flag. */ public void setAsync(boolean async) { this.async = async; } /** * Returns the class that implements the actual task (must implement {@link Task}). * @return The task implementing class. */ public String getTaskImplementingClass() { return taskImplementingClass; } /** * Sets the class that implements the actual task (must implement {@link Task}). * @param taskImplementingClass The task implementing class. */ public void setTaskImplementingClass(String taskImplementingClass) { this.taskImplementingClass = taskImplementingClass; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (getId() != null) { builder.append("id="); builder.append(getId()); } if (async != DEFAULT_ASYNC) { if (builder.length() > 0) { builder.append(", "); } builder.append("async="); builder.append(async); } if (taskImplementingClass != null) { if (builder.length() > 0) { builder.append(", "); } builder.append("taskImplementingClass="); builder.append(taskImplementingClass); } if (CollectionUtils.isNotEmpty(getIncomingTransitions())) { if (builder.length() > 0) { builder.append(", "); } builder.append("incomingTransitions="); builder.append(getIncomingTransitions()); } if (CollectionUtils.isNotEmpty(getOutgoingTransitions())) { if (builder.length() > 0) { builder.append(", "); } builder.append("outgoingTransitions="); builder.append(getOutgoingTransitions()); } builder.insert(0, "TaskInfo ["); builder.append("]"); return builder.toString(); } }