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

com.gooddata.md.ScheduledMailWhen Maven / Gradle / Ivy

There is a newer version: 3.12.0+api3
Show newest version
/*
 * Copyright (C) 2007-2015, GoodData(R) Corporation. All rights reserved.
 */
package com.gooddata.md;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.gooddata.util.GDDateDeserializer;
import com.gooddata.util.GDDateSerializer;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.joda.time.LocalDate;

/**
 * Represents the start date and cron-like expression for {@link com.gooddata.md.ScheduledMail} mail schedule.
 */
public class ScheduledMailWhen {

    /**
     * Cron like recurrency pattern. Example: "0:0:0:1*12:0:0".
     * For details, please see this comprehensive documentation.
     */
    private String recurrency;
    private LocalDate startDate;
    private String timeZone;

    @JsonCreator
    protected ScheduledMailWhen(@JsonProperty("recurrency") String recurrency,
                                @JsonProperty("startDate") @JsonDeserialize(using = GDDateDeserializer.class) LocalDate startDate,
                                @JsonProperty("timeZone") String timeZone) {
        this.recurrency = recurrency;
        this.startDate = startDate;
        this.timeZone = timeZone;
    }

    public ScheduledMailWhen() {}

    public String getRecurrency() { return recurrency; }

    @JsonSerialize(using = GDDateSerializer.class)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public LocalDate getStartDate() { return startDate; }

    public String getTimeZone() { return timeZone; }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ScheduledMailWhen scheduledMailWhen = (ScheduledMailWhen) o;

        if (recurrency != null ? !recurrency.equals(scheduledMailWhen.recurrency) : scheduledMailWhen.recurrency != null) return false;
        if (startDate != null ? !startDate.equals(scheduledMailWhen.startDate) : scheduledMailWhen.startDate != null) return false;
        return !(timeZone != null ? !timeZone.equals(scheduledMailWhen.timeZone) : scheduledMailWhen.timeZone != null);

    }

    @Override
    public int hashCode() {
        int result = recurrency != null ? recurrency.hashCode() : 0;
        result = 31 * result + (startDate != null ? startDate.hashCode() : 0);
        result = 31 * result + (timeZone != null ? timeZone.hashCode() : 0);
        return result;
    }

    public void setRecurrency(String recurrency) {
        this.recurrency = recurrency;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }

    public void setTimeZone(String timeZone) {
        this.timeZone = timeZone;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy