Search in sources :

Example 6 with FetchTask

use of com.thoughtworks.go.config.FetchTask in project gocd by gocd.

the class FetchTaskRepresenter method fetchTaskFromJson.

private static AbstractFetchTask fetchTaskFromJson(JsonReader jsonReader) {
    FetchTask fetchTask = new FetchTask();
    if (jsonReader == null) {
        return fetchTask;
    }
    setBaseTask(jsonReader, fetchTask);
    Optional<Boolean> isSourceAFileValue = jsonReader.optBoolean("is_source_a_file");
    Boolean isSourceAFile = isSourceAFileValue.orElse(false);
    if (isSourceAFile) {
        jsonReader.readStringIfPresent("source", fetchTask::setSrcfile);
    } else {
        jsonReader.readStringIfPresent("source", fetchTask::setSrcdir);
    }
    jsonReader.readStringIfPresent("destination", fetchTask::setDest);
    return fetchTask;
}
Also used : AbstractFetchTask(com.thoughtworks.go.config.AbstractFetchTask) FetchTask(com.thoughtworks.go.config.FetchTask)

Aggregations

FetchTask (com.thoughtworks.go.config.FetchTask)6 AbstractFetchTask (com.thoughtworks.go.config.AbstractFetchTask)3 AntTask (com.thoughtworks.go.config.AntTask)3 ExecTask (com.thoughtworks.go.config.ExecTask)3 PluggableViewModel (com.thoughtworks.go.plugins.presentation.PluggableViewModel)3 Test (org.junit.Test)3 ConfigElementImplementationRegistry (com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry)1 PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)1