131 lines
3.2 KiB
Java
131 lines
3.2 KiB
Java
package com.agendaestudantil.entidade;
|
|
|
|
import org.springframework.data.annotation.Id;
|
|
import org.springframework.data.mongodb.core.index.CompoundIndex;
|
|
import org.springframework.data.mongodb.core.index.CompoundIndexes;
|
|
import org.springframework.data.mongodb.core.mapping.Document;
|
|
|
|
import java.time.LocalDate;
|
|
import java.util.Objects;
|
|
|
|
@Document(collection = "tarefas")
|
|
@CompoundIndexes({
|
|
@CompoundIndex(name = "estudante_data_entrega_idx", def = "{estudanteId: 1, dataEntrega: 1}"),
|
|
@CompoundIndex(name = "estudante_status_idx", def = "{estudanteId: 1, status: 1}")
|
|
})
|
|
public class Tarefa extends EntidadeAuditoria {
|
|
|
|
@Id
|
|
private String id;
|
|
private String titulo;
|
|
private String descricao;
|
|
private Prioridade prioridade;
|
|
private StatusTarefa status;
|
|
private LocalDate dataEntrega;
|
|
private String disciplinaId;
|
|
private String estudanteId;
|
|
|
|
public Tarefa() {
|
|
}
|
|
|
|
public Tarefa(String id, String titulo, String descricao, Prioridade prioridade, StatusTarefa status,
|
|
LocalDate dataEntrega, String disciplinaId, String estudanteId) {
|
|
this.id = id;
|
|
this.titulo = titulo;
|
|
this.descricao = descricao;
|
|
this.prioridade = prioridade;
|
|
this.status = status;
|
|
this.dataEntrega = dataEntrega;
|
|
this.disciplinaId = disciplinaId;
|
|
this.estudanteId = estudanteId;
|
|
}
|
|
|
|
public String getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(String id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getTitulo() {
|
|
return titulo;
|
|
}
|
|
|
|
public void setTitulo(String titulo) {
|
|
this.titulo = titulo;
|
|
}
|
|
|
|
public String getDescricao() {
|
|
return descricao;
|
|
}
|
|
|
|
public void setDescricao(String descricao) {
|
|
this.descricao = descricao;
|
|
}
|
|
|
|
public Prioridade getPrioridade() {
|
|
return prioridade;
|
|
}
|
|
|
|
public void setPrioridade(Prioridade prioridade) {
|
|
this.prioridade = prioridade;
|
|
}
|
|
|
|
public StatusTarefa getStatus() {
|
|
return status;
|
|
}
|
|
|
|
public void setStatus(StatusTarefa status) {
|
|
this.status = status;
|
|
}
|
|
|
|
public LocalDate getDataEntrega() {
|
|
return dataEntrega;
|
|
}
|
|
|
|
public void setDataEntrega(LocalDate dataEntrega) {
|
|
this.dataEntrega = dataEntrega;
|
|
}
|
|
|
|
public String getDisciplinaId() {
|
|
return disciplinaId;
|
|
}
|
|
|
|
public void setDisciplinaId(String disciplinaId) {
|
|
this.disciplinaId = disciplinaId;
|
|
}
|
|
|
|
public String getEstudanteId() {
|
|
return estudanteId;
|
|
}
|
|
|
|
public void setEstudanteId(String estudanteId) {
|
|
this.estudanteId = estudanteId;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o)
|
|
return true;
|
|
if (o == null || getClass() != o.getClass())
|
|
return false;
|
|
Tarefa tarefa = (Tarefa) o;
|
|
return Objects.equals(id, tarefa.id) &&
|
|
Objects.equals(estudanteId, tarefa.estudanteId) &&
|
|
Objects.equals(titulo, tarefa.titulo);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(id, estudanteId, titulo);
|
|
}
|
|
|
|
public enum Prioridade {
|
|
BAIXA, MEDIA, ALTA, URGENTE
|
|
}
|
|
|
|
public enum StatusTarefa {
|
|
PENDENTE, EM_ANDAMENTO, CONCLUIDA, ATRASADA
|
|
}
|
|
} |