List of usage examples for org.joda.time DateTime toString
public String toString(String pattern)
From source file:com.linkedin.pinot.common.utils.LLCSegmentName.java
License:Apache License
public LLCSegmentName(String tableName, int partitionId, int sequenceNumber, long msSinceEpoch) { if (!isValidComponentName(tableName)) { throw new RuntimeException("Invalid table name " + tableName); }//from w w w. j a v a 2 s . c om _tableName = tableName; _partitionId = partitionId; _sequenceNumber = sequenceNumber; // ISO8601 date: 20160120T1234Z DateTime dateTime = new DateTime(msSinceEpoch, DateTimeZone.UTC); _creationTime = dateTime.toString("yyyyMMdd'T'HHmm'Z'"); _segmentName = tableName + SEPARATOR + partitionId + SEPARATOR + sequenceNumber + SEPARATOR + _creationTime; }
From source file:com.lostrealm.lembretes.DownloadJob.java
License:Open Source License
static void scheduleExact() { DateTime time = DateTime.now(); if (time.getHourOfDay() > 20) time.plusDays(1);/*from w w w . ja v a2 s . c o m*/ if (time.getDayOfWeek() == DateTimeConstants.SATURDAY) time.plusDays(2); else if (time.getDayOfWeek() == DateTimeConstants.SUNDAY) time.plusDays(1); scheduleExact(time.toString("yyyy-MM?dd")); }
From source file:com.marand.thinkmed.medications.pharmacist.impl.PharmacistTaskCreatorImpl.java
License:Open Source License
private NewTaskRequestDto createPharmacistReminderTaskRequest(final String patientId, final String pharmacistReviewCompositionUid, final DateTime reminderDate, final String reminderNote, final Locale locale) { return new NewTaskRequestDto(PharmacistReminderTaskDef.INSTANCE, PharmacistReminderTaskDef.getTaskTypeEnum().buildKey(String.valueOf(patientId)), "Pharmacist reminder " + reminderDate.toString(DateTimeFormatters.shortDate(locale)), "Pharmacist reminder " + reminderDate.toString(DateTimeFormatters.shortDate(locale)), TherapyAssigneeEnum.PHARMACIST.name(), reminderDate, null, Pair.of(MedsTaskDef.PATIENT_ID, patientId), Pair.of(PharmacistReminderTaskDef.PHARMACIST_REVIEW_ID, pharmacistReviewCompositionUid), Pair.of(PharmacistReminderTaskDef.COMMENT, reminderNote)); }
From source file:com.marand.thinkmed.medications.pharmacist.impl.PharmacistTaskProviderImpl.java
License:Open Source License
private Map<String, PerfusionSyringeLabelDto> getOriginalTherapyIdPerfusionSyringeLabelDtoMap( final Map<String, TherapyDayDto> originalCompositionUidAndLatestTherapyDayDtoMap, final Map<String, PatientDisplayWithLocationDto> patientIdAndPatientDisplayDataMap, final Map<String, DateTime> originalTherapyIdAndPreparationStartedDateTimeMap, final Map<String, String> originalTherapyIdAndPatientIdMap, final Locale locale) { final Map<String, PerfusionSyringeLabelDto> originalTherapyIdPerfusionSyringeLabelDtoMap = new HashMap<>(); final String userName = RequestContextHolder.getContext().getUserMetadata().map(UserMetadata::getFullName) .get();//from w w w . j ava 2 s . co m for (final String originalTherapyId : originalTherapyIdAndPatientIdMap.keySet()) { final String patientId = originalTherapyIdAndPatientIdMap.get(originalTherapyId); final PatientDisplayWithLocationDto patientWithLocationDto = patientIdAndPatientDisplayDataMap .get(patientId); final PerfusionSyringeLabelDto perfusionSyringeLabelDto = new PerfusionSyringeLabelDto(); final DateTime startedDateTime = originalTherapyIdAndPreparationStartedDateTimeMap .get(originalTherapyId); perfusionSyringeLabelDto.setPreparationStartedTime( startedDateTime != null ? startedDateTime.toString(DateTimeFormatters.shortDateTime(locale)) : null); perfusionSyringeLabelDto.setBarCode(TherapyIdUtils.createTherapyId(originalTherapyId)); perfusionSyringeLabelDto .setPreparedBy(labelDisplayValuesProvider.getPreparedByString(userName, locale)); perfusionSyringeLabelDto.setPatientCareProvider(patientWithLocationDto.getCareProviderName()); final String roomAndBed = patientWithLocationDto.getRoomAndBed(); perfusionSyringeLabelDto.setPatientRoomAndBed(roomAndBed != null ? roomAndBed : "/"); final PatientDisplayDto patientDisplayDto = patientWithLocationDto.getPatientDisplayDto(); final String patientBirthDate = patientDisplayDto.getBirthDate() .toString(DateTimeFormatters.shortDate(locale)); perfusionSyringeLabelDto.setPatientBirthDate(patientBirthDate); perfusionSyringeLabelDto.setPatientName(patientDisplayDto.getName()); final TherapyDayDto therapyDayDto = originalCompositionUidAndLatestTherapyDayDtoMap .get(originalTherapyId); if (therapyDayDto != null) { perfusionSyringeLabelDto.setPrescribedBy(labelDisplayValuesProvider .getPrescribedByString(therapyDayDto.getTherapy().getComposerName(), locale)); perfusionSyringeLabelDto.setTherapyDisplayValue(labelDisplayValuesProvider .getTherapyDisplayValueForPerfusionSyringeLabel(therapyDayDto.getTherapy(), locale)); } originalTherapyIdPerfusionSyringeLabelDtoMap.put(originalTherapyId, perfusionSyringeLabelDto); } return originalTherapyIdPerfusionSyringeLabelDtoMap; }
From source file:com.marand.thinkmed.medications.therapy.impl.TherapyUpdaterImpl.java
License:Open Source License
private void createReminders(final TherapyDto therapyDto, final String therapyId, final Integer reviewReminderDays, final String patientId, final Locale locale) { final Long mainMedicationId = therapyDto.getMainMedicationId(); final MedicationHolderDto medicationHolderDto = medicationsValueHolder.getValue().get(mainMedicationId); final DateTime therapyStart = therapyDto.getStart(); if (medicationHolderDto != null && medicationHolderDto.isSuggestSwitchToOral()) { if (therapyDto.getRoutes().size() == 1 && therapyDto.getRoutes().get(0).getType() == MedicationRouteTypeEnum.IV) { final DateTime dueDate = therapyStart.withTimeAtStartOfDay().plusDays(2); //TODO TMC-7170 antibiotic - from preference (care provider) final NewTaskRequestDto taskRequest = new NewTaskRequestDto(SwitchToOralTaskDef.INSTANCE, SwitchToOralTaskDef.getTaskTypeEnum().buildKey(String.valueOf(patientId)), "Switch to oral medication " + dueDate.toString(DateTimeFormatters.shortDate(locale)), "Switch to oral medication " + dueDate.toString(DateTimeFormatters.shortDate(locale)), TherapyAssigneeEnum.DOCTOR.name(), dueDate, null, Pair.of(MedsTaskDef.PATIENT_ID, patientId), Pair.of(TherapyTaskDef.ORIGINAL_THERAPY_ID, therapyId)); processService.createTasks(taskRequest); }/* ww w. j a va 2 s.com*/ } if (reviewReminderDays != null) { final DateTime dueDate = therapyStart.withTimeAtStartOfDay().plusDays(reviewReminderDays); final NewTaskRequestDto taskRequest = new NewTaskRequestDto(DoctorReviewTaskDef.INSTANCE, DoctorReviewTaskDef.getTaskTypeEnum().buildKey(String.valueOf(patientId)), "Doctor review task " + dueDate.toString(DateTimeFormatters.shortDate(locale)), "Doctor review task " + dueDate.toString(DateTimeFormatters.shortDate(locale)), TherapyAssigneeEnum.DOCTOR.name(), dueDate, null, Pair.of(MedsTaskDef.PATIENT_ID, patientId), Pair.of(TherapyTaskDef.ORIGINAL_THERAPY_ID, therapyId)); processService.createTasks(taskRequest); } }
From source file:com.mattc.argus2.gui.InstallerGUI.java
License:Open Source License
public void writeLine(String msg) { final DateTime date = new DateTime(); final String time = date.toString(dtFormat); final String text = String.format("%s - [%-5s]: %s%n", time, "CODE", msg); this.statusLog.addLine(text); }
From source file:com.mattc.argus2.gui.InstallerGUI.java
License:Open Source License
/** * Add's a line to the Status Log./*w ww.java 2 s .c o m*/ * * @param msg * - Actual Message * @param archiveType * - Archive Type Identifier like ZIP or TAR or BZIP */ public void writeLine(String msg, DecompressProcess process) { final DateTime date = new DateTime(); final String time = date.toString(dtFormat); final String text = String.format("%s - [%-5s]: %s%n", time, Files.getFileExtension(process.getArchiveName()).toUpperCase(), msg); this.statusLog.addLine(text); }
From source file:com.metabroadcast.common.social.auth.ictomorrow.ICTomorrowApiHelper.java
public int recordConsumerActivity(int consumerId, int offerId, int trialId, String activityType, DateTime transactionDate, String contentKey, String contentHandle, Integer incrementValue, Integer integerValue, String freeText) throws ICTomorrowApiException { try {/*from w w w. j av a2s .co m*/ String transactionDateString = transactionDate.toString("yyyy-MM-dd'T'HH:mm:ssZZ"); FormEncodedPayload data = new FormEncodedPayload() .withField("consumer_id", Integer.toString(consumerId)) .withField("offer_id", Integer.toString(offerId)).withField("application_key", applicationKey) .withField("trial_id", Integer.toString(trialId)).withField("activity_type", activityType) .withField("transaction_date", transactionDateString); addOptionalParameter(data, "content_handle", contentHandle); addOptionalParameter(data, "content_key", contentKey); addOptionalParameter(data, "increment_value", incrementValue); addOptionalParameter(data, "integer_value", integerValue); addOptionalParameter(data, "free_text", freeText); HttpResponse res = client.post(RECORD_CONSUMER_ACTIVITY_URL, data); Element resultElement = getResultElement(res); return Integer.valueOf(resultElement.getFirstChildElement("transaction") .getFirstChildElement("TransactionID").getValue().trim()); } catch (HttpException e) { throw new ICTomorrowApiException("Exception while recording consumer activity", e); } }
From source file:com.microsoft.exchange.utils.TimeZoneHelper.java
License:Open Source License
private static SerializableTimeZoneTime toSerializableTimeZoneTime(DateTimeZone zone, long transition) { int standardOffset = zone.getStandardOffset(transition); long offset = zone.getOffset(transition); int bias = toBias(offset - standardOffset); DateTime time = new DateTime(transition, zone); short month = (short) time.getMonthOfYear(); short day = (short) time.getDayOfMonth(); DayOfWeekType dayOfWeek = toDayOfWeek(time.getDayOfWeek()); return new SerializableTimeZoneTime(bias, time.toString("HH:mm:ss"), day, month, dayOfWeek, time.toString("yyyy")); }
From source file:com.microsoft.rest.serializer.DateTimeSerializer.java
License:Open Source License
@Override public void serialize(DateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException { if (provider.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) { jgen.writeNumber(value.getMillis()); } else {// ww w . ja v a 2s. com value = value.withZone(DateTimeZone.UTC); jgen.writeString(value.toString(ISODateTimeFormat.dateTime())); } }