Search in sources :

Example 1 with AbstractFetchTask

use of com.thoughtworks.go.config.AbstractFetchTask 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)

Example 2 with AbstractFetchTask

use of com.thoughtworks.go.config.AbstractFetchTask 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)

Example 3 with AbstractFetchTask

use of com.thoughtworks.go.config.AbstractFetchTask 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

AbstractFetchTask (com.thoughtworks.go.config.AbstractFetchTask)3 FetchTask (com.thoughtworks.go.config.FetchTask)3