List of usage examples for org.joda.time LocalDate getYear
public int getYear()
From source file:net.sourceforge.fenixedu.dataTransferObject.phd.YearMonth.java
License:Open Source License
public YearMonth(LocalDate date) { super(); setYear(date.getYear()); setMonth(Month.values()[date.getMonthOfYear() - 1]); }
From source file:net.sourceforge.fenixedu.domain.accessControl.StudentsConcludedInExecutionYearGroup.java
License:Open Source License
@Override public Set<User> getMembers() { Set<User> users = new HashSet<User>(); for (Registration registration : degree.getRegistrationsSet()) { if (registration.hasConcluded()) { LocalDate conclusionDate = getConclusionDate(degree, registration); if (conclusionDate != null && (conclusionDate.getYear() == conclusionYear.getEndCivilYear() || conclusionDate.getYear() == conclusionYear.getBeginCivilYear())) { User user = registration.getPerson().getUser(); if (user != null) { users.add(user);//from w w w . ja v a 2 s .c o m } } } } return users; }
From source file:net.sourceforge.fenixedu.domain.accessControl.StudentsConcludedInExecutionYearGroup.java
License:Open Source License
@Override public boolean isMember(User user) { if (user == null || user.getPerson().getStudent() == null) { return false; }/*from ww w . ja va 2s .com*/ for (final Registration registration : user.getPerson().getStudent().getRegistrationsSet()) { if (registration.isConcluded() && registration.getDegree().equals(degree)) { LocalDate conclusionDate = getConclusionDate(registration.getDegree(), registration); if (conclusionDate != null && (conclusionDate.getYear() == conclusionYear.getEndCivilYear() || conclusionDate.getYear() == conclusionYear.getBeginCivilYear())) { return true; } return false; } } return false; }
From source file:net.sourceforge.fenixedu.domain.accounting.events.gratuity.StandaloneEnrolmentGratuityEvent.java
License:Open Source License
private YearMonthDay calculatePaymentCodeEndDate() { final LocalDate nextMonth = new LocalDate().plusMonths(1); return new YearMonthDay(nextMonth.getYear(), nextMonth.getMonthOfYear(), 1).minusDays(1); }
From source file:net.sourceforge.fenixedu.domain.candidacy.PersonalInformationBean.java
License:Open Source License
public Set<String> validate() { final Set<String> result = new HashSet<String>(); if (getConclusionGrade() == null || getConclusionYear() == null || getCountryOfResidence() == null || getGrantOwnerType() == null || getDislocatedFromPermanentResidence() == null || !isSchoolLevelValid() || !isHighSchoolLevelValid() || !isMaritalStatusValid() || !isProfessionalConditionValid() || !isProfessionTypeValid() || !isMotherSchoolLevelValid() || !isMotherProfessionTypeValid() || !isMotherProfessionalConditionValid() || !isFatherProfessionalConditionValid() || !isFatherProfessionTypeValid() || !isFatherSchoolLevelValid() || getCountryWhereFinishedPreviousCompleteDegree() == null || !isCountryWhereFinishedHighSchoolValid() || (getDegreeDesignation() == null && !isUnitFromRaidesListMandatory()) || (getInstitution() == null && StringUtils.isEmpty(getInstitutionName()))) { result.add("error.CandidacyInformationBean.required.information.must.be.filled"); }//from w w w . j a v a 2 s. c o m LocalDate now = new LocalDate(); if (getConclusionYear() != null && now.getYear() < getConclusionYear()) { result.add("error.personalInformation.year.after.current"); } int birthYear = getStudent().getPerson().getDateOfBirthYearMonthDay().getYear(); if (getConclusionYear() != null && getConclusionYear() < birthYear) { result.add("error.personalInformation.year.before.birthday"); } if (getSchoolLevel() != null && !getSchoolLevel().isSchoolLevelBasicCycle() && !getSchoolLevel().isOther() && getConclusionYear() != null && getConclusionYear() < birthYear + 15) { result.add("error.personalInformation.year.before.fifteen.years.old"); } if (isUnitFromRaidesListMandatory()) { if (getInstitution() == null) { result.add("error.personalInformation.required.institution"); } if (getDegreeDesignation() == null) { result.add("error.personalInformation.required.degreeDesignation"); } } if (getCountryOfResidence() != null) { if (getCountryOfResidence().isDefaultCountry() && getDistrictSubdivisionOfResidence() == null) { result.add( "error.CandidacyInformationBean.districtSubdivisionOfResidence.is.required.for.default.country"); } if (!getCountryOfResidence().isDefaultCountry() && (getDislocatedFromPermanentResidence() == null || !getDislocatedFromPermanentResidence())) { result.add("error.CandidacyInformationBean.foreign.students.must.select.dislocated.option"); } } if (getDislocatedFromPermanentResidence() != null && getDislocatedFromPermanentResidence() && getSchoolTimeDistrictSubdivisionOfResidence() == null) { result.add( "error.CandidacyInformationBean.schoolTimeDistrictSubdivisionOfResidence.is.required.for.dislocated.students"); } if (getSchoolLevel() != null && getSchoolLevel() == SchoolLevelType.OTHER && StringUtils.isEmpty(getOtherSchoolLevel())) { result.add("error.CandidacyInformationBean.other.school.level.description.is.required"); } if (isUnitFromRaidesListMandatory() && hasRaidesDegreeDesignation() && !getRaidesDegreeDesignation().getInstitutionUnitSet().contains(getInstitution())) { result.add("error.CandidacyInformationBean.designation.must.match.institution"); } if (getGrantOwnerType() != null && getGrantOwnerType() == GrantOwnerType.OTHER_INSTITUTION_GRANT_OWNER && getGrantOwnerProvider() == null) { result.add( "error.CandidacyInformationBean.grantOwnerProviderInstitutionUnitName.is.required.for.other.institution.grant.ownership"); } return result; }
From source file:net.sourceforge.fenixedu.domain.candidacy.workflow.form.OriginInformationForm.java
License:Open Source License
@Override public List<LabelFormatter> validate() { if (schoolLevel == SchoolLevelType.OTHER && StringUtils.isEmpty(otherSchoolLevel)) { return Collections.singletonList(new LabelFormatter().appendLabel( "error.candidacy.workflow.OriginInformationForm.otherSchoolLevel.must.be.filled", "candidate")); }//from w ww . j av a 2s . c om LocalDate now = new LocalDate(); if (now.getYear() < conclusionYear) { return Collections.singletonList( new LabelFormatter().appendLabel("error.personalInformation.year.after.current", "candidate")); } if (conclusionYear < getBirthYear()) { return Collections.singletonList(new LabelFormatter() .appendLabel("error.personalInformation.year.before.birthday", "candidate")); } return Collections.emptyList(); }
From source file:net.sourceforge.fenixedu.domain.candidacyProcess.InstitutionPrecedentDegreeInformation.java
License:Open Source License
@Override protected Integer getConclusionYear() { final LocalDate localDate = getConclusionDate(); return localDate != null ? localDate.getYear() : null; }
From source file:net.sourceforge.fenixedu.domain.credits.util.AnnualTeachingCreditsBean.java
License:Open Source License
public List<InternalPhdParticipant> getPhdDegreeTheses() { ArrayList<InternalPhdParticipant> participants = new ArrayList<InternalPhdParticipant>(); if (!executionYear.getYear().equals("2011/2012")) { for (InternalPhdParticipant internalPhdParticipant : teacher.getPerson().getInternalParticipantsSet()) { LocalDate conclusionDate = internalPhdParticipant.getIndividualProcess().getConclusionDate(); if (conclusionDate != null && conclusionDate.getYear() == executionYear.getBeginCivilYear() && (internalPhdParticipant.getProcessForGuiding() != null || internalPhdParticipant.getProcessForAssistantGuiding() != null)) { participants.add(internalPhdParticipant); }// ww w . jav a 2s . co m } } return participants; }
From source file:net.sourceforge.fenixedu.domain.phd.debts.PhdGratuityPaymentPeriod.java
License:Open Source License
public boolean contains(LocalDate date) { LocalDate start = new LocalDate(date.getYear(), getMonthStart(), getDayStart()); LocalDate end = new LocalDate(date.getYear(), getMonthEnd(), getDayEnd()); if ((date.equals(start) || date.isAfter(start)) && (date.equals(end) || date.isBefore(end))) { return true; } else {//from w w w . ja va 2 s. co m return false; } }
From source file:net.sourceforge.fenixedu.domain.phd.PhdIndividualProgramProcess.java
License:Open Source License
public ExecutionYear getConclusionYear() { LocalDate conclusionDate = getConclusionDate(); if (conclusionDate == null) { return null; }/*from w ww .j av a2 s . c om*/ int year = conclusionDate.getYear(); String executionYearName = String.format("%s/%s", year - 1, year); return ExecutionYear.readExecutionYearByName(executionYearName); }