MunicipioComplexoRegulador Model

MunicipioComplexoRegulador Model
mail@pastecode.io avatar
unknown
java
a year ago
1.8 kB
4
Indexable
Never
package br.gov.go.saude.regnet.model;

import static br.gov.go.saude.arquitetura.helper.Functions.list;
import static br.gov.go.saude.arquitetura.helper.Functions.mapx;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Id;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

import br.gov.go.saude.arquitetura.model.Model;
import br.gov.go.saude.arquitetura.model.annotation.Label;
import br.gov.go.saude.corp.model.Municipio;
import br.gov.go.saude.regnet.model.ComplexoRegulador;

@Entity
@Table(schema = "regnet", name = "municipios_complexo_regulador")
@JsonInclude(value = Include.NON_NULL)
@Label("Municipio Complexo Regulador")
public class MunicipioComplexoRegulador extends Model<MunicipioComplexoRegulador> implements Serializable {

    private static final long serialVersionUID = 747678218841376692L;

	@Id
	@Label("Id")
	@Column(name = "mcr_id")
	public Long id;
    
	@Label("Municipio Id")
	@Column(name = "mcr_municipio_id")
	public Long municipioId;
	
    @ManyToOne
	@JoinColumn(name = "mcr_municipio_id")
	public Municipio municipio;

	@Label("Complexo Regulador")
	@Column(name = "mcr_compexo_regulador_id")
	public Long idComplexoRegulador;
	
	@ManyToOne
	@JoinColumn(name = "mcr_compexo_regulador_id")
	public ComplexoRegulador complexoRegulador;

	
    
    @Override
    public List<Map<String, Object>> rules() {
        return list(
			mapx(list("municipioId", "idComplexoRegulador"), "required")
		);
    }
}