List of usage examples for org.joda.time YearMonthDay toLocalDate
public LocalDate toLocalDate()
From source file:net.sourceforge.fenixedu.domain.accessControl.StudentsConcludedInExecutionYearGroup.java
License:Open Source License
private LocalDate getConclusionDate(Degree degree, Registration registration) { for (StudentCurricularPlan scp : registration.getStudentCurricularPlansByDegree(degree)) { if (registration.isBolonha()) { if (scp.getLastConcludedCycleCurriculumGroup() != null) { YearMonthDay conclusionDate = registration .getConclusionDate(scp.getLastConcludedCycleCurriculumGroup().getCycleType()); if (conclusionDate != null) { return conclusionDate.toLocalDate(); }/* w w w.j a va 2 s.c om*/ } return null; } else { return registration.getConclusionDate() != null ? registration.getConclusionDate().toLocalDate() : null; } } return null; }
From source file:net.sourceforge.fenixedu.domain.accounting.AccountingTransaction.java
License:Open Source License
public boolean isInsidePeriod(final YearMonthDay startDate, final YearMonthDay endDate) { return isInsidePeriod(startDate.toLocalDate(), endDate.toLocalDate()); }
From source file:net.sourceforge.fenixedu.domain.accounting.SibsPaymentFileProcessReport.java
License:Open Source License
static public List<SibsPaymentFileProcessReport> readAllBetween(final YearMonthDay startDate, final YearMonthDay endDate) { return readAllBetween(startDate.toLocalDate(), endDate.toLocalDate()); }
From source file:net.sourceforge.fenixedu.domain.Lesson.java
License:Open Source License
private SortedSet<YearMonthDay> getAllLessonInstancesDatesToCreate(YearMonthDay startDate, YearMonthDay endDate, Boolean createLessonInstances) { if (startDate != null && endDate != null && !startDate.isAfter(endDate) && createLessonInstances) { SortedSet<YearMonthDay> possibleLessonDates = getAllValidLessonDatesWithoutInstancesDates(startDate, endDate);//from ww w.j a v a 2 s .c om List<LessonInstance> allLessonInstancesUntil = getAllLessonInstancesUntil(endDate.toLocalDate()); for (LessonInstance lessonInstance : allLessonInstancesUntil) { possibleLessonDates.remove(lessonInstance.getDay()); } return possibleLessonDates; } return new TreeSet<YearMonthDay>(); }
From source file:net.sourceforge.fenixedu.domain.Lesson.java
License:Open Source License
private boolean isHoliday(YearMonthDay day, Space lessonCampus) { return Holiday.isHoliday(day.toLocalDate(), lessonCampus); }
From source file:net.sourceforge.fenixedu.domain.Lesson.java
License:Open Source License
public Set<Interval> getAllLessonIntervals() { Set<Interval> intervals = new HashSet<Interval>(); for (LessonInstance instance : getLessonInstancesSet()) { intervals.add(new Interval(instance.getBeginDateTime(), instance.getEndDateTime())); }/*from w w w .j a v a2s . c o m*/ if (!wasFinished()) { YearMonthDay startDateToSearch = getLessonStartDay(); YearMonthDay endDateToSearch = getLessonEndDay(); for (YearMonthDay day : getAllValidLessonDatesWithoutInstancesDates(startDateToSearch, endDateToSearch)) { intervals.add(new Interval( day.toLocalDate() .toDateTime(new LocalTime(getBeginHourMinuteSecond().getHour(), getBeginHourMinuteSecond().getMinuteOfHour(), getBeginHourMinuteSecond().getSecondOfMinute())), day.toLocalDate() .toDateTime(new LocalTime(getEndHourMinuteSecond().getHour(), getEndHourMinuteSecond().getMinuteOfHour(), getEndHourMinuteSecond().getSecondOfMinute())))); } } return intervals; }
From source file:net.sourceforge.fenixedu.domain.organizationalStructure.Invitation.java
License:Open Source License
public void setInvitationInterval(YearMonthDay beginDate, YearMonthDay endDate) { migrateIntervals();/*w w w . j a va2 s .c o m*/ checkInvitationDatesIntersection(getInvitedPerson(), beginDate, endDate); if (getBeginDate() == null) { // When editing from the constructor new UserLoginPeriod(getInvitedPerson().getUser(), beginDate.toLocalDate(), endDate.toLocalDate()); } else { // When editing from the functionality editLoginPeriod(beginDate.toLocalDate(), endDate.toLocalDate()); } super.setBeginDate(beginDate); super.setEndDate(endDate); }
From source file:net.sourceforge.fenixedu.domain.organizationalStructure.Unit.java
License:Open Source License
public List<Teacher> getAllTeachers(YearMonthDay begin, YearMonthDay end) { List<Teacher> teachers = new ArrayList<Teacher>(); List<Employee> employees = getAllWorkingEmployees(begin, end); for (Employee employee : employees) { Teacher teacher = employee.getPerson().getTeacher(); if (teacher != null && teacher.hasAnyTeacherContractSituation(begin.toLocalDate(), end.toLocalDate())) { teachers.add(teacher);/* w w w . j av a 2 s . c om*/ } } return teachers; }
From source file:net.sourceforge.fenixedu.domain.reports.TeacherCreditsReportFile.java
License:Open Source License
private int getDaysIn(Contract contract, ExecutionSemester executionSemester) { YearMonthDay begin = contract.getBeginDate().isBefore(executionSemester.getBeginDateYearMonthDay()) ? executionSemester.getBeginDateYearMonthDay() : contract.getBeginDate();//from w w w . ja v a2s.c o m YearMonthDay end = contract.getEndDate() == null || contract.getEndDate().isAfter(executionSemester.getEndDateYearMonthDay()) ? executionSemester.getEndDateYearMonthDay() : contract.getEndDate(); return new Interval(begin.toLocalDate().toDateTimeAtStartOfDay(), end.toLocalDate().toDateTimeAtStartOfDay()).toPeriod(PeriodType.days()).getDays() + 1; }
From source file:net.sourceforge.fenixedu.domain.student.curriculum.ConclusionProcessVersion.java
License:Open Source License
protected ConclusionProcessVersion(final RegistrationConclusionBean bean) { super();/*from ww w . j av a2s. c o m*/ super.setRootDomainObject(Bennu.getInstance()); super.setCreationDateTime(new DateTime()); super.setResponsible(AccessControl.getPerson()); final YearMonthDay conclusion = bean.calculateConclusionDate(); final Integer finalAverage = bean.calculateFinalAverage(); final BigDecimal average = bean.calculateAverage(); final Double ectsCredits = bean.calculateCredits(); final ExecutionYear ingressionYear = bean.calculateIngressionYear(); final ExecutionYear conclusionYear = bean.calculateConclusionYear(); String[] args = {}; if (finalAverage == null) { throw new DomainException("error.ConclusionProcessVersion.argument.must.not.be.null", args); } String[] args1 = {}; if (average == null) { throw new DomainException("error.ConclusionProcessVersion.argument.must.not.be.null", args1); } String[] args2 = {}; if (ectsCredits == null) { throw new DomainException("error.ConclusionProcessVersion.argument.must.not.be.null", args2); } String[] args3 = {}; if (ingressionYear == null) { throw new DomainException("error.ConclusionProcessVersion.argument.must.not.be.null", args3); } String[] args4 = {}; if (conclusionYear == null) { throw new DomainException("error.ConclusionProcessVersion.argument.must.not.be.null", args4); } super.setConclusionDate(conclusion.toLocalDate()); super.setFinalAverage(finalAverage); super.setAverage(average); super.setCredits(BigDecimal.valueOf(ectsCredits)); super.setCurriculum(bean.getCurriculumForConclusion().toString()); super.setIngressionYear(ingressionYear); super.setConclusionYear(conclusionYear); }