All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bidib.wizard.script.node.WaitCommand Maven / Gradle / Ivy

There is a newer version: 2.0.0-M1
Show newest version
package org.bidib.wizard.script.node;

import java.util.Map;

import org.bidib.wizard.mvc.script.view.NodeScripting;
import org.bidib.wizard.script.AbstractScriptCommand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WaitCommand extends AbstractScriptCommand {
    private static final Logger LOGGER = LoggerFactory.getLogger(WaitCommand.class);

    public static final String KEY = "wait";

    private Long uuid;

    private Integer waitTime;

    protected WaitCommand() {
        super(KEY);
    }

    public WaitCommand(Long uuid, Integer waitTime) {
        super(KEY);
        this.uuid = uuid;
        this.waitTime = waitTime;
    }

    @Override
    public void parse(String commandLine) {
        // TODO Auto-generated method stub
        LOGGER.info("Set the wait time: {}", commandLine);
        // label = commandLine;
    }

    @Override
    public void execute(final NodeScripting scripting, final Map context) {
        LOGGER.info("Wait for {}ms, uuid: {}", waitTime, uuid);

        try {
            Thread.sleep(waitTime);
        }
        catch (InterruptedException ex) {
            LOGGER.warn("The sleep was interrupted.");
        }
    }

    @Override
    protected void internalExecute(NodeScripting scripting, final Map context) {
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy