Example usage for org.apache.commons.beanutils Person equals

List of usage examples for org.apache.commons.beanutils Person equals

Introduction

In this page you can find the example usage for org.apache.commons.beanutils Person equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.fenixedu.academic.domain.Professorship.java

@Atomic
public static Professorship create(Boolean responsibleFor, ExecutionCourse executionCourse, Person person) {

    Objects.requireNonNull(responsibleFor);
    Objects.requireNonNull(executionCourse);
    Objects.requireNonNull(person);

    if (executionCourse.getProfessorshipsSet().stream().anyMatch(p -> person.equals(p.getPerson()))) {
        throw new DomainException("error.teacher.already.associated.to.professorship");
    }// w  ww  . j  a  v a  2  s  .  c  o  m

    Professorship professorShip = new Professorship();
    professorShip.setExecutionCourse(executionCourse);
    professorShip.setPerson(person);
    professorShip.setCreator(Authenticate.getUser().getPerson());

    professorShip.setResponsibleFor(responsibleFor);

    if (person.getTeacher() != null) {
        executionCourse.moveSummariesFromTeacherToProfessorship(person.getTeacher(), professorShip);
    }

    ProfessorshipManagementLog.createLog(professorShip.getExecutionCourse(), Bundle.MESSAGING,
            "log.executionCourse.professorship.added", professorShip.getPerson().getPresentationName(),
            professorShip.getExecutionCourse().getNome(),
            professorShip.getExecutionCourse().getDegreePresentationString());
    return professorShip;
}