List of usage examples for org.joda.time Period ZERO
Period ZERO
To view the source code for org.joda.time Period ZERO.
Click Source Link
From source file:org.jevis.application.unit.SampleRateNode.java
License:Open Source License
private void setPeriod(TextField field) { Period newPeriod = Period.ZERO; if (sliderMinutes.getValue() != 0) { newPeriod = newPeriod.plusMinutes((int) sliderMinutes.getValue()); }// w ww . ja v a2 s . c om if (sliderSecounds.getValue() != 0) { newPeriod = newPeriod.plusSeconds((int) sliderSecounds.getValue()); } if (sliderHours.getValue() != 0) { newPeriod = newPeriod.plusHours((int) sliderHours.getValue()); } if (sliderMonth.getValue() != 0) { newPeriod = newPeriod.plusMonths((int) sliderMonth.getValue()); } if (sliderWeek.getValue() != 0) { newPeriod = newPeriod.plusWeeks((int) sliderWeek.getValue()); } field.setText(newPeriod.toString()); _returnPeriod = newPeriod; }
From source file:org.openvpms.web.jobs.pharmacy.PharmacyOrderDiscontinuationJob.java
License:Open Source License
/** * Determines the time prior to which POSTED invoices should be processed. * * @return the time//w w w . ja v a2 s. c o m */ private Date discontinueBefore() { Period period = practiceService.getPharmacyOrderDiscontinuePeriod(); if (period == null) { period = Period.ZERO; } return new DateTime().minus(period).toDate(); }
From source file:org.phenotips.data.Medication.java
License:Open Source License
/** * Serialize as JSON, in the following format. * * <pre>// www. j av a 2 s. c o m * { * "name": "Nurofen", * "genericName: "ibuprofen", * "dose": "200mg", * "frequency": "8h", * "duration": "2Y6M", * "effect": "slightImprovement", * "notes": "Makes the patient's headaches a lot more bearable" * } * </pre> * * @return a JSON object with all the specified fields; any missing/empty field is not set at all in the output */ public JSONObject toJSON() { JSONObject result = new JSONObject(); if (StringUtils.isNotBlank(this.name)) { result.put(NAME, this.name); } if (StringUtils.isNotBlank(this.genericName)) { result.put(GENERIC_NAME, this.genericName); } if (StringUtils.isNotBlank(this.dose)) { result.put(DOSE, this.dose); } if (StringUtils.isNotBlank(this.frequency)) { result.put(FREQUENCY, this.frequency); } if (this.duration != null && !Period.ZERO.equals(this.duration)) { result.put(DURATION, this.duration.toString().substring(1)); } if (this.effect != null) { result.put(EFFECT, this.effect.toString()); } if (StringUtils.isNotBlank(this.notes)) { result.put(NOTES, this.notes); } return result; }