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

io.zahori.server.model.Retry Maven / Gradle / Ivy

There is a newer version: 0.1.20
Show newest version
package io.zahori.server.model;

/*-
 * #%L
 * zahori-server
 * $Id:$
 * $HeadURL:$
 * %%
 * Copyright (C) 2021 PANEL SISTEMAS INFORMATICOS,S.L
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 * #L%
 */

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonBackReference;

/**
 * The type Retry.
 */
@Entity
@Table(name = "retries")
//@NamedQuery(name = "Retry.findAll", query = "SELECT r FROM Retry r")
public class Retry implements Serializable {

    private static final long serialVersionUID = 4854155657321806908L;

    @Id
    @Column(name = "retry_id")
    private Integer retryId;

    private Boolean active;

    //bi-directional many-to-many association to Client
    @JsonBackReference(value = "client")
    @ManyToMany
    @JoinTable(name = "client_retries", joinColumns = { @JoinColumn(name = "retry_id") }, inverseJoinColumns = { @JoinColumn(name = "client_id") })
    private Set clients;

    //bi-directional many-to-one association to Configuration
    @JsonBackReference(value = "configurations")
    @OneToMany(mappedBy = "retry")
    private Set configurations;

    public Retry() {
    }

    public Integer getRetryId() {
        return this.retryId;
    }

    public void setRetryId(Integer retryId) {
        this.retryId = retryId;
    }

    public Boolean getActive() {
        return this.active;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }

    public Set getClients() {
        return this.clients;
    }

    public void setClients(Set clients) {
        this.clients = clients;
    }

    public Set getConfigurations() {
        return this.configurations;
    }

    public void setConfigurations(Set configurations) {
        this.configurations = configurations;
    }

    public Configuration addConfiguration(Configuration configuration) {
        getConfigurations().add(configuration);
        configuration.setRetry(this);

        return configuration;
    }

    public Configuration removeConfiguration(Configuration configuration) {
        getConfigurations().remove(configuration);
        configuration.setRetry(null);

        return configuration;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy