List of usage examples for org.joda.time DateTime withTime
public DateTime withTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
From source file:org.obp.web.log.LogController.java
License:Apache License
@ResponseBody @RequestMapping("/api/log/today") public List<LogDto> todaySystemEntries() { DateTime now = DateTime.now(DateTimeZone.UTC); List<LogEntry> entries = logService.selectEntries(LogService.ORIGIN_SYSTEM, now.withTime(0, 0, 0, 0).getMillis(), now.withTime(23, 59, 59, 999).getMillis()); return repack(entries); }
From source file:org.obp.web.log.LogController.java
License:Apache License
@RequestMapping("/todaySystemLog") public String todaySystemLog(ModelMap model) { DateTime now = DateTime.now(DateTimeZone.UTC); List<LogEntry> entries = logService.selectEntries(LogService.ORIGIN_SYSTEM, now.withTime(0, 0, 0, 0).getMillis(), now.withTime(23, 59, 59, 999).getMillis()); model.addAttribute("logEntries", entries); return "todaySystemLog"; }
From source file:org.openmrs.module.operationtheater.api.impl.OperationTheaterServiceImpl.java
License:Open Source License
@Override public Interval getLocationAvailableTime(Location location, DateTime date) { Date date1 = date.toDate();/*from w w w . jav a 2 s . com*/ List<AppointmentBlock> blocks = appointmentService.getAppointmentBlocks(date.withTime(0, 0, 0, 0).toDate(), date.withTime(0, 0, 0, 0).plusDays(1).toDate(), location.getId() + ",", null, null); // List<AppointmentBlock> blocks = new ArrayList<AppointmentBlock>(); if (blocks.size() == 1) { return new Interval(new DateTime(blocks.get(0).getStartDate()), new DateTime(blocks.get(0).getEndDate())); } else if (blocks.size() > 1) { throw new APIException("There shouldn't be multiple appointment blocks per location and date"); } DateTimeFormatter timeFormatter = OTMetadata.AVAILABLE_TIME_FORMATTER; DateTime availableStart = null; DateTime availableEnd = null; for (LocationAttribute attribute : location.getAttributes()) { if (attribute.getAttributeType().getUuid().equals(OTMetadata.DEFAULT_AVAILABLE_TIME_BEGIN_UUID)) { LocalTime beginTime = LocalTime.parse((String) attribute.getValue(), timeFormatter); availableStart = date.withTime(beginTime.getHourOfDay(), beginTime.getMinuteOfHour(), 0, 0); } else if (attribute.getAttributeType().getUuid().equals(OTMetadata.DEFAULT_AVAILABLE_TIME_END_UUID)) { LocalTime endTime = LocalTime.parse((String) attribute.getValue(), timeFormatter); availableEnd = date.withTime(endTime.getHourOfDay(), endTime.getMinuteOfHour(), 0, 0); } } if (availableStart != null && availableEnd != null) { return new Interval(availableStart, availableEnd); } throw new APIException("Available times not defined. please make sure that the attributes " + "'default available time begin' and 'default available time end' for the location " + location.getName() + " are defined"); }