EventType.java

/**
 * TFG 75.678 - TFG Desarrollo web 2020 e-Learning for Schools
 * Copyright (C) 2020  Eduardo Rodriguez Carro
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.uoc.tfg.sel.repository.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Min;
import javax.validation.constraints.Size;

import org.hibernate.annotations.Type;
import org.springframework.lang.NonNull;

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


/**
 * Modelo de tipos de evento.
 *
 * @author Eduardo Rodriguez carro
 */
@JsonInclude(value = Include.NON_NULL)
@Entity
@Table(name = "eventtype")
public class EventType {

	/** The id. */
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "id")
	@Min(0)
	private Integer id;
	
	/** The name. */
	@NonNull
	@Column(name = "name")
	@Size(min = 1,max = 200)
	private String name;
	
	/** The evaluable. */
	@NonNull
	@Type(type = "org.hibernate.type.NumericBooleanType")
	@Column(name = "evaluable",nullable = false, columnDefinition = "TINYINT(1)")
	private boolean evaluable;

	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Checks if is evaluable.
	 *
	 * @return true, if is evaluable
	 */
	public boolean isEvaluable() {
		return evaluable;
	}

	/**
	 * Sets the evaluable.
	 *
	 * @param evaluable the new evaluable
	 */
	public void setEvaluable(boolean evaluable) {
		this.evaluable = evaluable;
	}

	/**
	 * To string.
	 *
	 * @return the string
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("EventType [id=").append(id).append(", name=").append(name).append(", evaluable=")
				.append(evaluable).append("]");
		return builder.toString();
	}
	
}