List of usage examples for org.joda.time DateTime getMinuteOfHour
public int getMinuteOfHour()
From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java
License:Open Source License
public void setStartOfProposalPeriodDateTime(final DateTime dateTime) { setStartOfProposalPeriodDateYearMonthDay(dateTime.toYearMonthDay()); setStartOfProposalPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(), dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute())); }
From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java
License:Open Source License
public void setEndOfProposalPeriodDateTime(final DateTime dateTime) { setEndOfProposalPeriodDateYearMonthDay(dateTime.toYearMonthDay()); setEndOfProposalPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(), dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute())); }
From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java
License:Open Source License
public void setStartOfCandidacyPeriodDateTime(final DateTime dateTime) { setStartOfCandidacyPeriodDateYearMonthDay(dateTime.toYearMonthDay()); setStartOfCandidacyPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(), dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute())); }
From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java
License:Open Source License
public void setEndOfCandidacyPeriodDateTime(final DateTime dateTime) { setEndOfCandidacyPeriodDateYearMonthDay(dateTime.toYearMonthDay()); setEndOfCandidacyPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(), dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute())); }
From source file:net.sourceforge.fenixedu.domain.onlineTests.StudentTestLog.java
License:Open Source License
public static String getChecksum(DistributedTest distributedTest, Registration student, DateTime dateTime) { StringBuilder checksumCode = new StringBuilder(); checksumCode.append(student.getNumber()); checksumCode.append(distributedTest.getExternalId()); final DateTime thisDateTime = new DateTime(dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), dateTime.getHourOfDay(), dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute(), 0); checksumCode.append(thisDateTime.getMillis()); checksumCode.append(Bennu.getInstance().getTestChecksumsSet().iterator().next().getChecksumCode()); return (Hashing.sha1().hashString(checksumCode.toString(), Charsets.UTF_8)).toString(); }
From source file:net.sourceforge.fenixedu.domain.vigilancy.UnavailablePeriod.java
License:Open Source License
public String getUnavailableAsString() { DateTime begin = this.getBeginDate(); DateTime end = this.getEndDate(); return String.format("%02d/%02d/%d (%02d:%02d) - %02d/%02d/%d (%02d:%02d): %s", begin.getDayOfMonth(), begin.getMonthOfYear(), begin.getYear(), begin.getHourOfDay(), begin.getMinuteOfHour(), end.getDayOfMonth(), end.getMonthOfYear(), end.getYear(), end.getHourOfDay(), end.getMinuteOfHour(), this.getJustification()); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.vigilancy.ConvokeManagement.java
License:Open Source License
public ActionForward confirmConvokes(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Boolean havingVigilantsThatAreTeachers = false; ConvokeBean beanWithTeachers = null; if (RenderUtils.getViewState("selectVigilantsThatAreTeachers") != null) { beanWithTeachers = (ConvokeBean) RenderUtils.getViewState("selectVigilantsThatAreTeachers") .getMetaObject().getObject(); }// ww w. j a va 2s . co m ConvokeBean beanWithVigilants = (ConvokeBean) RenderUtils.getViewState("selectVigilants").getMetaObject() .getObject(); ConvokeBean beanWithUnavailables = (ConvokeBean) RenderUtils .getViewState("selectVigilantsThatAreUnavailable").getMetaObject().getObject(); List<VigilantWrapper> teachers = null; List<VigilantWrapper> vigilants, unavailables; if (RenderUtils.getViewState("selectVigilantsThatAreTeachers") != null) { teachers = beanWithTeachers.getSelectedTeachers(); } vigilants = beanWithVigilants.getVigilants(); unavailables = beanWithUnavailables.getSelectedUnavailableVigilants(); String convokedVigilants = beanWithVigilants.getTeachersAsString(); String teachersVigilancies = null; if (RenderUtils.getViewState("selectVigilantsThatAreTeachers") != null) { teachersVigilancies = beanWithTeachers.getVigilantsAsString(); vigilants.addAll(teachers); } else { teachersVigilancies = RenderUtils.getResourceString("VIGILANCY_RESOURCES", "label.vigilancy.noone"); } vigilants.addAll(unavailables); beanWithVigilants.setVigilants(vigilants); String email = RenderUtils.getResourceString("VIGILANCY_RESOURCES", "label.vigilancy.emailConvoke"); MessageFormat format = new MessageFormat(email); WrittenEvaluation evaluation = beanWithVigilants.getWrittenEvaluation(); DateTime beginDate = evaluation.getBeginningDateTime(); String date = beginDate.getDayOfMonth() + "/" + beginDate.getMonthOfYear() + "/" + beginDate.getYear(); String minutes = String.format("%02d", new Object[] { beginDate.getMinuteOfHour() }); Object[] args = { evaluation.getFullName(), date, beginDate.getHourOfDay(), minutes, beanWithVigilants.getRoomsAsString(), teachersVigilancies, convokedVigilants, beanWithVigilants.getSelectedVigilantGroup().getRulesLink() }; beanWithVigilants.setEmailMessage(format.format(args)); request.setAttribute("bean", beanWithVigilants); return mapping.findForward("confirmConvokes"); }
From source file:net.sourceforge.fenixedu.presentationTier.TagLib.GanttDiagramTagLib.java
License:Open Source License
private int calculateTimeOfDay(DateTime time) { int hourOfDay = time.getHourOfDay(); int minuteOfHour = time.getMinuteOfHour(); switch (getViewTypeEnum()) { case WEEKLY://from w w w. j ava 2 s . com // unit = 15 minutes int result = (hourOfDay + 1) * 2; if (minuteOfHour <= 30) { return result - 1; } else { return result; } case DAILY: // unit = 5 minutes for (int i = 1, j = 0; j < 60; j += 5, i++) { if (minuteOfHour < j + 5) { return i + (12 * hourOfDay); } } case MONTHLY: // unit = hour of day return hourOfDay; case YEAR_DAILY: // unit = hour of day return hourOfDay; default: return 0; } }
From source file:net.stickycode.scheduled.aligned.AlignedPeriodicSchedule.java
License:Open Source License
/** * The delay in seconds to wait before the initial execution to align the schedule as specified. * <b>An alignment of 0 means there is no delay</b> * <p>//from ww w. j a v a2 s.c om * e.g. * <ul> * <li>if the user configured a schedule as 'every hour at 15 minutes past'</li> * <li>and the service started at 10 minutes past</li> * <li>then the period would be 60 * 60 seconds</li> * <li>and the delay would be 5 * 60 seconds such that the first execution is 15 minutes past</li> * </ul> * </p> */ @Override public long getInitialDelay() { if (alignment == 0) return 0; DateTime time = new DateTime(); switch (alignmentUnit) { case HOURS: return calculateDelay(time.getHourOfDay(), alignment, 24); case MINUTES: return calculateDelay(time.getMinuteOfHour(), alignment, 60); case SECONDS: return calculateDelay(time.getSecondOfMinute(), alignment, 60); case MILLISECONDS: return calculateDelay(time.getMillisOfSecond(), alignment, 1000); default: throw new AlignmentNotSupportedException(alignmentUnit); } }
From source file:net.tourbook.database.TourDatabase.java
License:Open Source License
/** * Persist {@link TourData} in the database and updates the tour data cache with the persisted * tour<br>//from w ww . j a va 2 s. co m * <br> * When a tour has no person the tour will not be saved, a person must be set first before the * tour can be saved * * @param tourData * @return persisted {@link TourData} or <code>null</code> when saving fails */ public static TourData saveTour(final TourData tourData) { /* * prevent saving a tour which was deleted before */ if (tourData.isTourDeleted) { return null; } /* * prevent saving a tour when a person is not set, this check is for internal use that all * data are valid */ if (tourData.getTourPerson() == null) { StatusUtil.log("Cannot save a tour without a person: " + tourData); //$NON-NLS-1$ return null; } /* * check size of varcar fields */ if (tourData.isValidForSave() == false) { return null; } final DateTime dtNow = new DateTime(); final long dtSaved = (dtNow.getYear() * 10000000000L) + (dtNow.getMonthOfYear() * 100000000L) + (dtNow.getDayOfMonth() * 1000000L) + (dtNow.getHourOfDay() * 10000L) + (dtNow.getMinuteOfHour() * 100L) + dtNow.getSecondOfMinute(); EntityManager em = TourDatabase.getInstance().getEntityManager(); TourData persistedEntity = null; if (em != null) { final EntityTransaction ts = em.getTransaction(); try { tourData.onPrePersist(); ts.begin(); { final TourData tourDataEntity = em.find(TourData.class, tourData.getTourId()); if (tourDataEntity == null) { // tour is not yet persisted tourData.setDateTimeCreated(dtSaved); em.persist(tourData); persistedEntity = tourData; } else { tourData.setDateTimeModified(dtSaved); persistedEntity = em.merge(tourData); } } ts.commit(); } catch (final Exception e) { StatusUtil.showStatus(Messages.Tour_Database_TourSaveError, e); } finally { if (ts.isActive()) { ts.rollback(); } em.close(); } } if (persistedEntity != null) { em = TourDatabase.getInstance().getEntityManager(); try { persistedEntity = em.find(TourData.class, tourData.getTourId()); } catch (final Exception e) { StatusUtil.log(e); } em.close(); TourManager.getInstance().updateTourInCache(persistedEntity); } return persistedEntity; }