/**
* Copyright © 2002 Instituto Superior Técnico
*
* This file is part of FenixEdu Academic.
*
* FenixEdu Academic is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FenixEdu Academic 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FenixEdu Academic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.fenixedu.academic.domain.serviceRequests;
import org.fenixedu.academic.domain.accounting.EventType;
import org.fenixedu.academic.domain.serviceRequests.documentRequests.AcademicServiceRequestType;
import org.fenixedu.academic.domain.student.StatuteType;
import org.fenixedu.academic.domain.student.Student;
import org.fenixedu.academic.domain.student.StudentStatute;
import org.fenixedu.academic.dto.serviceRequests.AcademicServiceRequestBean;
import org.fenixedu.academic.dto.serviceRequests.RegistrationAcademicServiceRequestCreateBean;
import org.fenixedu.academic.util.Bundle;
import org.fenixedu.bennu.core.i18n.BundleUtil;
import pt.ist.fenixframework.Atomic;
public class SpecialSeasonRequest extends SpecialSeasonRequest_Base {
public SpecialSeasonRequest() {
super();
}
public SpecialSeasonRequest(final RegistrationAcademicServiceRequestCreateBean bean) {
this();
super.init(bean);
super.setBeginExecutionPeriod(bean.getExecutionYear().getFirstExecutionPeriod());
super.setEndExecutionPeriod(bean.getExecutionYear().getLastExecutionPeriod());
}
@Override
protected void createAcademicServiceRequestSituations(AcademicServiceRequestBean academicServiceRequestBean) {
super.createAcademicServiceRequestSituations(academicServiceRequestBean);
if (academicServiceRequestBean.isNew()) {
AcademicServiceRequestSituation.create(this, new AcademicServiceRequestBean(
AcademicServiceRequestSituationType.PROCESSING, academicServiceRequestBean.getResponsible()));
}
if (academicServiceRequestBean.isToConclude()) {
AcademicServiceRequestSituation.create(this, new AcademicServiceRequestBean(
AcademicServiceRequestSituationType.DELIVERED, academicServiceRequestBean.getResponsible()));
}
}
@Override
protected void internalChangeState(AcademicServiceRequestBean academicServiceRequestBean) {
super.internalChangeState(academicServiceRequestBean);
if (academicServiceRequestBean.isToConclude()) {
Student student = getRegistration().getStudent();
if (getDeferred() != null && getDeferred() == true) {
new StudentStatute(student, StatuteType.findSpecialSeasonGrantedByRequestStatuteType().orElse(null),
getBeginExecutionPeriod(), getEndExecutionPeriod());
}
}
}
public String getDefermentDescription() {
if (getDeferred() == null) {
return "-";
}
final String key = getDeferred() == true ? "request.granted" : "request.declined";
return BundleUtil.getString(Bundle.ACADEMIC, key);
}
@Atomic
public void setDeferment(Boolean deferred) {
this.setDeferred(deferred);
}
@Override
public boolean isAvailableForTransitedRegistrations() {
return false;
}
@Override
public AcademicServiceRequestType getAcademicServiceRequestType() {
return AcademicServiceRequestType.SPECIAL_SEASON_REQUEST;
}
@Override
public EventType getEventType() {
return null;
}
@Override
public boolean hasPersonalInfo() {
return false;
}
@Override
public boolean isPayedUponCreation() {
return false;
}
@Override
public boolean isPossibleToSendToOtherEntity() {
return false;
}
@Override
public boolean isManagedWithRectorateSubmissionBatch() {
return false;
}
@Override
public boolean isToPrint() {
return false;
}
}