Java Code Examples for org.joda.time.YearMonthDay#getMonthOfYear()
The following examples show how to use
org.joda.time.YearMonthDay#getMonthOfYear() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewEventSpaceOccupationsBean.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
public ViewEventSpaceOccupationsBean(YearMonthDay day, Space allocatableSpace) { setAllocatableSpace(allocatableSpace); if (day != null) { setYear(new Partial(DateTimeFieldType.year(), day.getYear())); setMonth(new Partial(DateTimeFieldType.monthOfYear(), day.getMonthOfYear())); YearMonthDay monday = day.toDateTimeAtMidnight().withDayOfWeek(MONDAY_IN_JODA_TIME).toYearMonthDay(); if ((monday.getMonthOfYear() < day.getMonthOfYear()) || (monday.getYear() < day.getYear())) { monday = monday.plusDays(Lesson.NUMBER_OF_DAYS_IN_WEEK); } setDay(monday); } }
Example 2
Source File: PostingRulesManager.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
@Atomic public static void createDEAStandaloneGratuityPostingRule(StandaloneInstallmentBean bean, DegreeCurricularPlan degreeCurricularPlan) { DegreeCurricularPlanServiceAgreementTemplate dcpSAT = degreeCurricularPlan.getServiceAgreementTemplate(); if (dcpSAT != null) { YearMonthDay startDate = bean.getStartDate(); LocalDate startLocalDate = new LocalDate(startDate.getYear(), startDate.getMonthOfYear(), startDate.getDayOfMonth()); BigDecimal ectsForYear = bean.getEctsForYear(); BigDecimal gratuityFactor = bean.getGratuityFactor(); BigDecimal ectsFactor = bean.getEctsFactor(); new StandaloneEnrolmentGratuityPR(startLocalDate.toDateTimeAtStartOfDay(), null, dcpSAT, ectsForYear, gratuityFactor, ectsFactor); } else { throw new DomainException("StandaloneEnrolmentGratuityPR.DegreeCurricularPlanServiceAgreementTemplate.cannot.be.null"); } }
Example 3
Source File: GratuitySituation.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
private double calculatePenalty(final double remainingValue) { if (hasPenalty() && getGratuityValues().isPenaltyApplicable()) { int monthsToChargePenalty = 0; final YearMonthDay now = new YearMonthDay(); if (getEndPaymentDate().getMonthOfYear() == now.getMonthOfYear()) { monthsToChargePenalty += 1; } else { monthsToChargePenalty = calculateMonthsToChargePenalty(calculateCloseDate()); } return new Money(remainingValue).multiply(PENALTY_PERCENTAGE).multiply(new BigDecimal(monthsToChargePenalty)) .getAmount().doubleValue(); } return 0; }
Example 4
Source File: MonthMondayDaysProvider.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Object provide(Object source, Object currentValue) { List<YearMonthDay> result = new ArrayList<YearMonthDay>(); ViewEventSpaceOccupationsBean bean = (ViewEventSpaceOccupationsBean) source; Partial year = bean.getYear(); Partial month = bean.getMonth(); if (month != null && year != null) { int monthNumber = month.get(DateTimeFieldType.monthOfYear()); int yearNumber = year.get(DateTimeFieldType.year()); YearMonthDay firstDayOfMonth = new YearMonthDay(yearNumber, monthNumber, 1); YearMonthDay monday = firstDayOfMonth.toDateTimeAtMidnight().withDayOfWeek(MONDAY_IN_JODA_TIME).toYearMonthDay(); if ((monday.getMonthOfYear() < monthNumber) || (monday.getYear() < yearNumber)) { monday = monday.plusDays(Lesson.NUMBER_OF_DAYS_IN_WEEK); } while (monday.getMonthOfYear() == monthNumber) { result.add(monday); monday = monday.plusDays(Lesson.NUMBER_OF_DAYS_IN_WEEK); } } return result; }
Example 5
Source File: WrittenEvaluation.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 5 votes |
public DateTime getBeginningDateTime() { HourMinuteSecond begin = this.getBeginningDateHourMinuteSecond(); YearMonthDay yearMonthDay = this.getDayDateYearMonthDay(); return new DateTime(yearMonthDay.getYear(), yearMonthDay.getMonthOfYear(), yearMonthDay.getDayOfMonth(), begin.getHour(), begin.getMinuteOfHour(), 0, 0); }
Example 6
Source File: WrittenEvaluation.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 5 votes |
public DateTime getEndDateTime() { HourMinuteSecond end = this.getEndDateHourMinuteSecond(); YearMonthDay yearMonthDay = this.getDayDateYearMonthDay(); return new DateTime(yearMonthDay.getYear(), yearMonthDay.getMonthOfYear(), yearMonthDay.getDayOfMonth(), end.getHour(), end.getMinuteOfHour(), 0, 0); }
Example 7
Source File: WrittenEvaluation.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 5 votes |
private DateTime toDateTime(final YearMonthDay yearMonthDay, final HourMinuteSecond hourMinuteSecond) { if (yearMonthDay == null || hourMinuteSecond == null) { return null; } return new DateTime(yearMonthDay.getYear(), yearMonthDay.getMonthOfYear(), yearMonthDay.getDayOfMonth(), hourMinuteSecond.getHour(), hourMinuteSecond.getMinuteOfHour(), hourMinuteSecond.getSecondOfMinute(), 0); }
Example 8
Source File: LessonInstance.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 5 votes |
public LessonInstance(Lesson lesson, YearMonthDay day) { // check(this, ResourceAllocationRolePredicates.checkPermissionsToManageLessonInstancesWithTeacherCheck); super(); if (day == null) { throw new DomainException("error.LessonInstance.empty.day"); } if (lesson == null) { throw new DomainException("error.LessonInstance.empty.Lesson"); } LessonInstance lessonInstance = lesson.getLessonInstanceFor(day); if (lessonInstance != null) { throw new DomainException("error.lessonInstance.already.exist"); } Space room = lesson.getSala(); HourMinuteSecond beginTime = lesson.getBeginHourMinuteSecond(); HourMinuteSecond endTime = lesson.getEndHourMinuteSecond(); DateTime beginDateTime = new DateTime(day.getYear(), day.getMonthOfYear(), day.getDayOfMonth(), beginTime.getHour(), beginTime.getMinuteOfHour(), beginTime.getSecondOfMinute(), 0); DateTime endDateTime = new DateTime(day.getYear(), day.getMonthOfYear(), day.getDayOfMonth(), endTime.getHour(), endTime.getMinuteOfHour(), endTime.getSecondOfMinute(), 0); setRootDomainObject(Bennu.getInstance()); setBeginDateTime(beginDateTime); setEndDateTime(endDateTime); setLesson(lesson); lessonInstanceSpaceOccupationManagement(room); }
Example 9
Source File: CalendarEntryBean.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 4 votes |
public static Partial getPartialFromYearMonthDay(YearMonthDay day) { return new Partial(new DateTimeFieldType[] { DateTimeFieldType.year(), DateTimeFieldType.monthOfYear() }, new int[] { day.getYear(), day.getMonthOfYear() }); }
Example 10
Source File: Lesson.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 4 votes |
private static DateTime toDateTime(final YearMonthDay ymd, final HourMinuteSecond hms) { return new DateTime(ymd.getYear(), ymd.getMonthOfYear(), ymd.getDayOfMonth(), hms.getHour(), hms.getMinuteOfHour(), hms.getSecondOfMinute(), 0); }
Example 11
Source File: WrittenEvaluation.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 4 votes |
private DateTime convertTimes(YearMonthDay yearMonthDay, HourMinuteSecond hourMinuteSecond) { return new DateTime(yearMonthDay.getYear(), yearMonthDay.getMonthOfYear(), yearMonthDay.getDayOfMonth(), hourMinuteSecond.getHour(), hourMinuteSecond.getMinuteOfHour(), hourMinuteSecond.getSecondOfMinute(), 0); }
Example 12
Source File: LessonInstance.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 4 votes |
public LessonInstance(Summary summary, Lesson lesson) { // check(this, ResourceAllocationRolePredicates.checkPermissionsToManageLessonInstancesWithTeacherCheck); super(); if (summary == null) { throw new DomainException("error.LessonInstance.empty.summary"); } if (lesson == null) { throw new DomainException("error.LessonInstance.empty.lesson"); } YearMonthDay day = summary.getSummaryDateYearMonthDay(); LessonInstance lessonInstance = lesson.getLessonInstanceFor(day); if (lessonInstance != null) { throw new DomainException("error.lessonInstance.already.exist"); } Space room = lesson.getSala(); HourMinuteSecond beginTime = lesson.getBeginHourMinuteSecond(); HourMinuteSecond endTime = lesson.getEndHourMinuteSecond(); DateTime beginDateTime = new DateTime(day.getYear(), day.getMonthOfYear(), day.getDayOfMonth(), beginTime.getHour(), beginTime.getMinuteOfHour(), beginTime.getSecondOfMinute(), 0); DateTime endDateTime = new DateTime(day.getYear(), day.getMonthOfYear(), day.getDayOfMonth(), endTime.getHour(), endTime.getMinuteOfHour(), endTime.getSecondOfMinute(), 0); setRootDomainObject(Bennu.getInstance()); setBeginDateTime(beginDateTime); setEndDateTime(endDateTime); YearMonthDay nextPossibleDay = findNextPossibleDateAfter(day, lesson); setLesson(lesson); summaryAndCourseLoadManagement(summary, lesson); lesson.refreshPeriodAndInstancesInSummaryCreation(nextPossibleDay); lessonInstanceSpaceOccupationManagement(room); }