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

io.deepsense.neptune.clientlibrary.models.impl.job.JobBuilder Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
/**
 * Copyright (c) 2016, CodiLime Inc.
 */

package io.deepsense.neptune.clientlibrary.models.impl.job;

import io.deepsense.neptune.clientlibrary.models.Job;
import io.deepsense.neptune.clientlibrary.models.JobState;
import io.deepsense.neptune.clientlibrary.models.Metric;
import io.deepsense.neptune.clientlibrary.services.apimodelconverter.ApiModelConverter;
import io.deepsense.neptune.clientlibrary.services.apiservice.ApiService;
import io.deepsense.neptune.clientlibrary.services.channelvaluesender.ChannelValueSendingProxy;

import java.net.URI;
import java.util.UUID;

public class JobBuilder {

    private ApiService apiService;

    private ApiModelConverter apiModelConverter;

    private ChannelValueSendingProxy channelValueSendingProxy;

    private long maxChannelValueSize;

    private UUID id;

    private JobState state;

    private URI storageUrl;

    private Metric metric;

    public JobBuilder withApiService(ApiService apiService) {
        this.apiService = apiService;
        return this;
    }

    public JobBuilder withApiModelConverter(ApiModelConverter apiModelConverter) {
        this.apiModelConverter = apiModelConverter;
        return this;
    }

    public JobBuilder withChannelValueSendingProxy(ChannelValueSendingProxy channelValueSendingProxy) {
        this.channelValueSendingProxy = channelValueSendingProxy;
        return this;
    }

    public JobBuilder withMaxChannelValueSize(long maxChannelValueSize) {
        this.maxChannelValueSize = maxChannelValueSize;
        return this;
    }

    public JobBuilder withFieldsFromApi(UUID id, JobState state, URI storageUrl, Metric metric) {
        this.id = id;
        this.state = state;
        this.storageUrl = storageUrl;
        this.metric = metric;
        return this;
    }

    public Job build() {
        return new OnlineJob(
                apiService,
                apiModelConverter,
                channelValueSendingProxy,
                maxChannelValueSize,
                id,
                state,
                metric);
    }

    public UUID getJobId() {
        return id;
    }

    public URI getStorageUrl() {
        return storageUrl;
    }

    public Metric getMetric() {
        return metric;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy