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

com.harrys.hyppo.source.api.model.DataIngestionTask Maven / Gradle / Ivy

There is a newer version: 0.6.4
Show newest version
package com.harrys.hyppo.source.api.model;

import com.typesafe.config.Config;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import java.io.Serializable;
import java.util.UUID;

/**
 * Created by jpetty on 7/6/15.
 */
public final class DataIngestionTask implements Serializable {
    private static final long serialVersionUID = 1L;

    @JsonProperty("ingestionJob")
    private final DataIngestionJob ingestionJob;

    @JsonProperty("taskNumber")
    private final int taskNumber;

    @JsonSerialize(using = ConfigToJson.Serializer.class)
    @JsonDeserialize(using = ConfigToJson.Deserializer.class)
    @JsonProperty("taskArguments")
    private final Config taskArguments;

    @JsonCreator
    public DataIngestionTask(
            @JsonProperty("ingestionJob")   final DataIngestionJob ingestionJob,
            @JsonProperty("taskNumber")     final int taskNumber,
            @JsonProperty("taskArguments")  final Config taskArguments
    ){
        this.ingestionJob = ingestionJob;
        this.taskNumber = taskNumber;
        this.taskArguments = taskArguments;
    }


    public final DataIngestionJob getIngestionJob() {
        return ingestionJob;
    }

    @JsonIgnore
    public final UUID getIngestionJobId(){
        return this.getIngestionJob().getId();
    }

    public final int getTaskNumber() {
        return taskNumber;
    }

    public final Config getTaskArguments() {
        return taskArguments;
    }


    @Override
    public final boolean equals(Object check){
        if (check instanceof DataIngestionTask){
            final DataIngestionTask other = (DataIngestionTask)check;
            return (ingestionJob.equals(other.getIngestionJob())
                    && taskNumber == other.getTaskNumber()
                    && taskArguments.equals(other.getTaskArguments())
            );
        } else {
            return super.equals(check);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy