Event.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 java.util.Date;

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

import org.springframework.lang.NonNull;

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

/**
 * Modelo de eventos publicados.
 *
 * @author Eduardo Rodriguez carro
 */
@JsonInclude(value = Include.NON_NULL)
@Entity
@Table(name = "event")
public class Event {
	
	/** The id. */
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "id")
	private Integer id;
	
	/** The subjectclass. */
	@ManyToOne
	@NonNull
	@JoinColumn(name="subjectclass_id")
	private SubjectClass subjectclass;
	
	/** The title. */
	@NonNull
	@Size(min = 1,max = 200)
	private String title;
	
	/** The content. */
	@NonNull
	@Size(min = 1,max = 65534)
	@Column(name = "content")
	private String content;

	/** The date. */
	@NonNull
	private Date date;
	
	/** The type. */
	@ManyToOne
	@NonNull
	@JoinColumn(name="type_id")
	private EventType type;

	/**
	 * 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 subjectclass.
	 *
	 * @return the subjectclass
	 */
	public SubjectClass getSubjectclass() {
		return subjectclass;
	}

	/**
	 * Sets the subjectclass.
	 *
	 * @param subjectclass the new subjectclass
	 */
	public void setSubjectclass(SubjectClass subjectclass) {
		this.subjectclass = subjectclass;
	}

	/**
	 * Gets the title.
	 *
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

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

	/**
	 * Gets the content.
	 *
	 * @return the content
	 */
	public String getContent() {
		return content;
	}

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

	/**
	 * Gets the date.
	 *
	 * @return the date
	 */
	public Date getDate() {
		return date;
	}

	/**
	 * Sets the date.
	 *
	 * @param date the new date
	 */
	public void setDate(Date date) {
		this.date = date;
	}

	/**
	 * Gets the type.
	 *
	 * @return the type
	 */
	public EventType getType() {
		return type;
	}

	/**
	 * Sets the type.
	 *
	 * @param type the new type
	 */
	public void setType(EventType type) {
		this.type = type;
	}
	
	
}