List of usage examples for org.joda.time LocalDate toDateTimeAtStartOfDay
public DateTime toDateTimeAtStartOfDay()
From source file:au.com.scds.chats.dom.activity.Activities.java
License:Apache License
@Action(semantics = SemanticsOf.SAFE) @ActionLayout(bookmarking = BookmarkPolicy.NEVER) @MemberOrder(sequence = "7") public List<ActivityEvent> listActivitiesInPeriod( @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "Start Period") LocalDate start, @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "End Period") LocalDate end) { return container .allMatches(new QueryDefault<>(ActivityEvent.class, "findActivitiesInPeriod", "startDateTime", start.toDateTimeAtStartOfDay(), "endDateTime", end.toDateTime(new LocalTime(23, 59)))); }
From source file:au.com.scds.chats.dom.attendance.AttendanceLists.java
License:Apache License
@Action(semantics = SemanticsOf.SAFE) @ActionLayout(bookmarking = BookmarkPolicy.NEVER) @MemberOrder(sequence = "1.0") public List<AttendanceList> listAttendanceListsInPeriod( @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "Start Period") LocalDate start, @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "End Period") LocalDate end) { return container .allMatches(new QueryDefault<>(AttendanceList.class, "findAttendanceListsInPeriod", "startDateTime", start.toDateTimeAtStartOfDay(), "endDateTime", end.toDateTime(new LocalTime(23, 59)))); }
From source file:au.com.scds.chats.dom.attendance.AttendanceLists.java
License:Apache License
@Action(semantics = SemanticsOf.SAFE) @ActionLayout(bookmarking = BookmarkPolicy.NEVER, named = "List Attendances In Period") @MemberOrder(sequence = "3.0") public List<Attend> listAttendsInPeriod( @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "Start Period") LocalDate start, @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "End Period") LocalDate end) { return container.allMatches(new QueryDefault<>(Attend.class, "findAttendsInPeriod", "startDateTime", start.toDateTimeAtStartOfDay(), "endDateTime", end.toDateTime(new LocalTime(23, 59)))); }
From source file:cl.usach.managedbeans.TrabajoSemanalManagedBean.java
public List<Semana> buscarSemanas(Date datei, Date datef) { DateTime fechai = new DateTime(datei); DateTime fechaf = new DateTime(datef); LocalDate lunesI = fechai.toLocalDate().withDayOfWeek(DateTimeConstants.MONDAY); LocalDate domingoF = fechaf.toLocalDate().withDayOfWeek(DateTimeConstants.SUNDAY); List<Semana> semanas = new ArrayList<>(); DateTime i = lunesI.toDateTimeAtStartOfDay(); while (i.isBefore(domingoF.toDateTimeAtStartOfDay())) { DateTime domingoi = i.toLocalDate().withDayOfWeek(DateTimeConstants.SUNDAY).toDateTimeAtStartOfDay(); domingoi = domingoi.plusHours(23).plusMinutes(59).plusSeconds(59); semanas.add(new Semana(i.toDate(), domingoi.toDate())); i = i.plusWeeks(1);//from ww w . jav a2 s .co m } return semanas; }
From source file:com.axelor.apps.stock.service.InventoryService.java
License:Open Source License
public Inventory createInventory(LocalDate date, String description, Location location, boolean excludeOutOfStock, boolean includeObsolete, ProductFamily productFamily, ProductCategory productCategory) throws AxelorException { if (location == null) { throw new AxelorException(I18n.get(IExceptionMessage.INVENTORY_1), IException.CONFIGURATION_ERROR); }// w ww . j ava 2 s. c o m Inventory inventory = new Inventory(); inventory.setInventorySeq(this.getInventorySequence(location.getCompany())); inventory.setDateT(date.toDateTimeAtStartOfDay()); inventory.setDescription(description); inventory.setFormatSelect(IAdministration.PDF); inventory.setLocation(location); inventory.setExcludeOutOfStock(excludeOutOfStock); inventory.setIncludeObsolete(includeObsolete); inventory.setProductCategory(productCategory); inventory.setProductFamily(productFamily); inventory.setStatusSelect(InventoryRepository.STATUS_DRAFT); return inventory; }
From source file:com.example.weatherforecast.utils.DateUtils.java
License:Open Source License
public static long toEpochMillis(LocalDate date) { return date.toDateTimeAtStartOfDay().getMillis(); }
From source file:com.gst.accounting.journalentry.service.JournalEntryWritePlatformServiceJpaRepositoryImpl.java
License:Apache License
private void validateBusinessRulesForJournalEntries(final JournalEntryCommand command) { /** check if date of Journal entry is valid ***/ final LocalDate entryLocalDate = command.getTransactionDate(); final Date transactionDate = entryLocalDate.toDateTimeAtStartOfDay().toDate(); // shouldn't be in the future final Date todaysDate = new Date(); if (transactionDate.after(todaysDate)) { throw new JournalEntryInvalidException(GL_JOURNAL_ENTRY_INVALID_REASON.FUTURE_DATE, transactionDate, null, null);/*from ww w. jav a 2 s . co m*/ } // shouldn't be before an accounting closure final GLClosure latestGLClosure = this.glClosureRepository .getLatestGLClosureByBranch(command.getOfficeId()); if (latestGLClosure != null) { if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().equals(transactionDate)) { throw new JournalEntryInvalidException(GL_JOURNAL_ENTRY_INVALID_REASON.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(), null, null); } } /*** check if credits and debits are valid **/ final SingleDebitOrCreditEntryCommand[] credits = command.getCredits(); final SingleDebitOrCreditEntryCommand[] debits = command.getDebits(); // atleast one debit or credit must be present if (credits == null || credits.length <= 0 || debits == null || debits.length <= 0) { throw new JournalEntryInvalidException(GL_JOURNAL_ENTRY_INVALID_REASON.NO_DEBITS_OR_CREDITS, null, null, null); } checkDebitAndCreditAmounts(credits, debits); }
From source file:com.gst.infrastructure.core.api.JsonCommand.java
License:Apache License
public Date DateValueOfParameterNamed(final String parameterName) { final LocalDate localDate = this.fromApiJsonHelper.extractLocalDateNamed(parameterName, this.parsedCommand); if (localDate == null) { return null; }/*from w w w .jav a 2 s . c o m*/ return localDate.toDateTimeAtStartOfDay().toDate(); }
From source file:com.gst.organisation.office.domain.Office.java
License:Apache License
private Office(final Office parent, final String name, final LocalDate openingDate, final String externalId) { this.parent = parent; this.openingDate = openingDate.toDateTimeAtStartOfDay().toDate(); if (parent != null) { this.parent.addChild(this); }//from w w w. j av a 2 s . c o m if (StringUtils.isNotBlank(name)) { this.name = name.trim(); } else { this.name = null; } if (StringUtils.isNotBlank(externalId)) { this.externalId = externalId.trim(); } else { this.externalId = null; } }
From source file:com.gst.organisation.staff.domain.Staff.java
License:Apache License
private Staff(final Office staffOffice, final String firstname, final String lastname, final String externalId, final String mobileNo, final boolean isLoanOfficer, final Boolean isActive, final LocalDate joiningDate) { this.office = staffOffice; this.firstname = StringUtils.defaultIfEmpty(firstname, null); this.lastname = StringUtils.defaultIfEmpty(lastname, null); this.externalId = StringUtils.defaultIfEmpty(externalId, null); this.mobileNo = StringUtils.defaultIfEmpty(mobileNo, null); this.loanOfficer = isLoanOfficer; this.active = (isActive == null) ? true : isActive; deriveDisplayName(firstname);//from ww w. j a v a 2 s . com if (joiningDate != null) { this.joiningDate = joiningDate.toDateTimeAtStartOfDay().toDate(); } }