package eu.dnetlib.workflow;

import com.googlecode.sarasvati.Arc;
import com.googlecode.sarasvati.Engine;
import com.googlecode.sarasvati.NodeToken;
import com.googlecode.sarasvati.mem.MemNode;

/**
 * The success node sets the "isCompletedSuccessfully" env var.
 * @author marko
 *
 */
public class SuccessNode extends MemNode {

	/**
	 * is completed successfully.
	 */
	public static final String COMPLETED = "isCompletedSuccessfully";

	/**
	 * {@inheritDoc}
	 * @see com.googlecode.sarasvati.mem.MemNode#execute(com.googlecode.sarasvati.Engine, com.googlecode.sarasvati.NodeToken)
	 */
	@Override
	public void execute(final Engine engine, final NodeToken token) {
		token.getProcess().getEnv().setBooleanAttribute(COMPLETED, true);
		engine.completeExecution(token, Arc.DEFAULT_ARC);
	}

}
