package net.sourceforge.fenixedu.domain; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.Set; import net.sourceforge.fenixedu.domain.degree.DegreeType; import net.sourceforge.fenixedu.domain.degree.degreeCurricularPlan.DegreeCurricularPlanState; import net.sourceforge.fenixedu.domain.elections.YearDelegateElection; import net.sourceforge.fenixedu.domain.exceptions.DomainException; import net.sourceforge.fenixedu.domain.organizationalStructure.FunctionType; import net.sourceforge.fenixedu.domain.organizationalStructure.PersonFunction; import net.sourceforge.fenixedu.domain.student.Student; import net.sourceforge.fenixedu.domain.time.calendarStructure.AcademicPeriod; import net.sourceforge.fenixedu.util.MarkType; import net.sourceforge.fenixedu.util.StringUtils; import pt.utl.ist.fenix.tools.util.i18n.Language; import pt.utl.ist.fenix.tools.util.i18n.MultiLanguageString; import com.linkare.commons.metainfo.Linkare; public class EmptyDegree extends EmptyDegree_Base { private static EmptyDegree instance = null; @Linkare(author = "Paulo Zenida", comments = "Removed validation to check for already existing empty degree") private EmptyDegree() { super(); setRootDomainObject(RootDomainObject.getInstance()); setDegreeType(DegreeType.EMPTY); } @Override public boolean isEmpty() { return true; } public static EmptyDegree getInstance() { if (instance == null) { init(); } return instance; } @Linkare(author = "Paulo Zenida", comments = "Allowed the creation of an empty degree when there's none") private static synchronized void init() { for (final Degree degree : RootDomainObject.getInstance().getDegreesSet()) { if (degree.isEmpty()) { instance = (EmptyDegree) degree; return; } } if (instance == null) { instance = new EmptyDegree(); instance.setNomeOnSuper("Curso de Unidades Isoladas"); } } @Override public void edit(String name, String nameEn, String code, DegreeType degreeType, GradeScale gradeScale, ExecutionYear executionYear) { throw new DomainException("EmptyDegree.not.available"); } @Override public void edit(String name, String nameEn, String acronym, DegreeType degreeType, Double ectsCredits, GradeScale gradeScale, String prevailingScientificArea, ExecutionYear executionYear, AcademicPeriod academicPeriod) { throw new DomainException("EmptyDegree.not.available"); } @Override public Boolean getCanBeDeleted() { return false; } @Override public void delete() { throw new DomainException("EmptyDegree.not.available"); } @Override public DegreeCurricularPlan createPreBolonhaDegreeCurricularPlan(String name, DegreeCurricularPlanState state, Date initialDate, Date endDate, Integer degreeDuration, Integer minimalYearForOptionalCourses, Double neededCredits, MarkType markType, Integer numerusClausus, String anotation, GradeScale gradeScale) { throw new DomainException("EmptyDegree.not.available"); } @Override public DegreeCurricularPlan createBolonhaDegreeCurricularPlan(String name, GradeScale gradeScale, Person creator) { throw new DomainException("EmptyDegree.not.available"); } @Override public void setNome(final String nome) { throw new DomainException("EmptyDegree.not.available"); } @Linkare(author = "Paulo Zenida", comments = "Allowed the creation of an empty degree when there's none") public void setNomeOnSuper(final String nome) { super.setNome(nome); } @Override public void setNameEn(String nameEn) { throw new DomainException("EmptyDegree.not.available"); } @Override public void setCode(String code) { throw new DomainException("EmptyDegree.not.available"); } @Override public String getCode() { return StringUtils.EMPTY; } @Override public void setSigla(final String sigla) { throw new DomainException("EmptyDegree.not.available"); } @Override public String getSigla() { return StringUtils.EMPTY; } @Override public Double getEctsCredits() { return null; } @Override public void setEctsCredits(Double ectsCredits) { throw new DomainException("EmptyDegree.not.available"); } @Override public boolean hasEctsCredits() { return false; } @Override public void setGradeScale(GradeScale gradeScale) { throw new DomainException("EmptyDegree.not.available"); } @Override public GradeScale getGradeScale() { return null; } @Override public GradeScale getGradeScaleChain() { return null; } @Override public void setPrevailingScientificArea(String prevailingScientificArea) { throw new DomainException("EmptyDegree.not.available"); } @Override public void setDegreeType(final DegreeType degreeType) { throw new DomainException("EmptyDegree.not.available"); } @Override public boolean isBolonhaDegree() { return true; } @Override public boolean isDegreeOrBolonhaDegreeOrBolonhaIntegratedMasterDegree() { return false; } @Override public List findDegreeCurricularPlansByState(DegreeCurricularPlanState state) { if (state == DegreeCurricularPlanState.ACTIVE) { return getActiveDegreeCurricularPlans(); } return Collections.emptyList(); } @Override public List getActiveDegreeCurricularPlans() { return Collections.singletonList(getMostRecentDegreeCurricularPlan()); } @Override public List getPastDegreeCurricularPlans() { return Collections.emptyList(); } @Override public List getExecutedCurricularCoursesByExecutionYear(final ExecutionYear executionYear) { return Collections.emptyList(); } @Override public List getExecutedCurricularCoursesByExecutionYearAndYear(final ExecutionYear ey, final Integer cy) { return Collections.emptyList(); } @Override public List getExecutionCourses(String curricularCourseAcronym, ExecutionSemester executionSemester) { return Collections.emptyList(); } @Override @Deprecated final public String getName() { return getPresentationName(); } @Override final public String getPresentationName(ExecutionYear executionYear) { return getNameFor((ExecutionYear) null).getContent(Language.pt); } @Override final public String getFilteredName(final ExecutionYear executionYear, final Locale locale) { return getNameFor(executionYear).getContent(Language.valueOf(locale.getLanguage())); } @Override public DegreeCurricularPlan getMostRecentDegreeCurricularPlan() { return getDegreeCurricularPlans().get(0); } @Override public DegreeCurricularPlan getLastActiveDegreeCurricularPlan() { return getMostRecentDegreeCurricularPlan(); } @Override public MultiLanguageString getQualificationLevel(final ExecutionYear executionYear) { return new MultiLanguageString(); } @Override public MultiLanguageString getProfessionalExits(final ExecutionYear executionYear) { return new MultiLanguageString(); } @Override public DegreeInfo getMostRecentDegreeInfo() { return null; } @Override public DegreeInfo getDegreeInfoFor(ExecutionYear executionYear) { return getMostRecentDegreeInfo(); } @Override public DegreeInfo getMostRecentDegreeInfo(ExecutionYear executionYear) { return getMostRecentDegreeInfo(); } @Override public DegreeInfo createCurrentDegreeInfo() { throw new DomainException("EmptyDegree.not.available"); } @Override public List buildFullCurricularYearList() { return Collections.emptyList(); } @Override final public boolean isCoordinator(final Person person, final ExecutionYear executionYear) { return false; } @Override final public Collection getResponsibleCoordinators(final ExecutionYear executionYear) { return Collections.emptySet(); } @Override final public Collection getCurrentCoordinators() { return Collections.emptySet(); } @Override final public Collection getCurrentResponsibleCoordinators() { return Collections.emptySet(); } @Override final public Collection getResponsibleCoordinatorsTeachers(final ExecutionYear executionYear) { return Collections.emptySet(); } @Override final public Collection getCurrentResponsibleCoordinatorsTeachers() { return Collections.emptySet(); } @Override public String constructSchoolClassPrefix(final Integer curricularYear) { return StringUtils.EMPTY; } @Override public boolean isFirstCycle() { return false; } @Override public boolean isSecondCycle() { return false; } @Override public boolean isAnyPublishedThesisAvailable() { return false; } @Override public boolean isAnyThesisAvailable() { return false; } @Override public List getYearDelegateElectionsGivenExecutionYear(ExecutionYear executionYear) { return Collections.emptyList(); } @Override public List getYearDelegateElectionsGivenExecutionYearAndCurricularYear(ExecutionYear executionYear, CurricularYear curricularYear) { return Collections.emptyList(); } @Override public YearDelegateElection getYearDelegateElectionWithLastCandidacyPeriod(ExecutionYear executionYear, CurricularYear curricularYear) { return null; } @Override public YearDelegateElection getYearDelegateElectionWithLastVotingPeriod(ExecutionYear executionYear, CurricularYear curricularYear) { return null; } @Override public List getAllActiveDelegates() { return Collections.emptyList(); } @Override public List getAllActiveYearDelegates() { return Collections.emptyList(); } @Override public Student getActiveYearDelegateByCurricularYear(CurricularYear curricularYear) { return null; } @Override public List getAllActiveDelegatesByFunctionType(FunctionType functionType, ExecutionYear executionYear) { return Collections.emptyList(); } @Override public boolean hasActiveDelegateFunctionForStudent(Student student, ExecutionYear executionYear, FunctionType delegateFunctionType) { return false; } @Override public boolean hasAnyActiveDelegateFunctionForStudent(Student student) { return false; } @Override public PersonFunction getActiveDelegatePersonFunctionByStudentAndFunctionType(Student student, ExecutionYear executionYear, FunctionType functionType) { return null; } @Override public Student getYearDelegateByExecutionYearAndCurricularYear(ExecutionYear executionYear, CurricularYear curricularYear) { return null; } @Override public List getAllDelegatesByExecutionYearAndFunctionType(ExecutionYear executionYear, FunctionType functionType) { return Collections.emptyList(); } @Override public List getAllDelegatePersonFunctionsByStudentAndFunctionType(Student student, FunctionType functionType) { return Collections.emptyList(); } @Override public List getSecondCycleStudents(ExecutionYear executionYear) { return Collections.emptyList(); } @Override public List getFirstCycleStudents(ExecutionYear executionYear) { return Collections.emptyList(); } @Override public Set getAllCurricularCourses(ExecutionYear executionYear) { return Collections.emptySet(); } @Override public Set getCurricularCoursesFromGivenCurricularYear(int curricularYear, ExecutionYear executionYear) { return Collections.emptySet(); } @Override public Set getFirstCycleCurricularCourses(ExecutionYear executionYear) { return Collections.emptySet(); } @Override public Set getSecondCycleCurricularCourses(ExecutionYear executionYear) { return Collections.emptySet(); } @Override public boolean canCreateGratuityEvent() { return false; } }