List of usage examples for org.joda.time LocalDate fromDateFields
@SuppressWarnings("deprecation") public static LocalDate fromDateFields(Date date)
java.util.Date
using exactly the same field values. From source file:org.egov.tl.service.PenaltyRatesService.java
License:Open Source License
public Date getPenaltyDate(LicenseAppType licenseAppType, Installment installment) { Optional<PenaltyRates> penaltyRates = getPenaltyRatesByLicenseAppType(licenseAppType).stream() .filter(penaltyRate -> penaltyRate.getRate().doubleValue() <= ZERO.doubleValue()).findFirst(); return LocalDate.fromDateFields(installment.getFromDate()) .plusDays(penaltyRates.isPresent() ? penaltyRates.get().getToRange().intValue() : ZERO.intValue()) .toDate();/*from w w w. j a v a 2 s .c om*/ }
From source file:org.jahap.business.base.Hotelbean.java
License:Open Source License
public void incrementOperationdate() { LocalDate hotelday = LocalDate.fromDateFields(allrecordlist.get(currentRecordNumber).getOperationdate()); allrecordlist.get(currentRecordNumber).setOperationdate(hotelday.plusDays(1).toDate()); this.saveRecord(); }
From source file:org.jahap.gui.MainGuiFx.java
License:Open Source License
public void initialize(URL url, ResourceBundle rb) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy"); CurrentUser cu = CurrentUser.getCurrentUser(); Hotelbean hbean = new Hotelbean(); LocalDate hdate = LocalDate.fromDateFields(hbean.getOperationdate()); this.hotelday.setText(hdate.toString("dd.MM.yy")); System.out.print(cu.isIsAdmin()); System.out.print(com.sun.javafx.runtime.VersionInfo.getVersion()); }
From source file:org.jtotus.gui.graph.GraphSender.java
License:Open Source License
public void addForSending(Date date, Double value) { StockUnit unit = new StockUnit(); unit.date = LocalDate.fromDateFields(date); unit.value = value;/*from ww w . ja v a 2 s . co m*/ listOfValues.add(unit); }
From source file:org.jtotus.gui.graph.GraphSender.java
License:Open Source License
public void addForSending(Date date, Double value, String annotation) { StockUnit unit = new StockUnit(); unit.date = LocalDate.fromDateFields(date); unit.value = value;//w w w. ja v a2 s .c o m unit.annotation = annotation; listOfValues.add(unit); }
From source file:org.jw.service.entity.Contact.java
@Transient public String getAge() { if (this.birthdate == null) return "<No Birthdate>"; LocalDate dob = LocalDate.fromDateFields(birthdate); LocalDate now = LocalDate.now(); Period period = new Period(dob, now, PeriodType.yearMonthDay()); return String.format("%d years & %d months", period.getYears(), period.getMonths()); }
From source file:org.kuali.coeus.common.budget.impl.rate.TrainingStipendRateServiceImpl.java
License:Open Source License
@Override public TrainingStipendRateContract findClosestMatchTrainingStipendRate(Date effectiveDate, String careerLevel, int experienceLevel) { if (effectiveDate == null) { throw new IllegalArgumentException("effectiveDate is null"); }//from ww w . j av a 2 s . c o m if (StringUtils.isBlank(careerLevel)) { throw new IllegalArgumentException("careerLevel is null"); } final Map<String, Object> criteria = new HashMap<>(); criteria.put("careerLevel", careerLevel); criteria.put("experienceLevel", experienceLevel); final Collection<TrainingStipendRate> rates = CollectionUtils.emptyIfNull(businessObjectService .findMatchingOrderBy(TrainingStipendRate.class, criteria, "effectiveDate", false)); for (TrainingStipendRate rate : rates) { if (rate.getEffectiveDate() != null) { final LocalDate limit = LocalDate.fromDateFields(effectiveDate); final LocalDate rateDate = LocalDate.fromDateFields(rate.getEffectiveDate()); if (rateDate.isBefore(limit) || rateDate.isEqual(limit)) { return rate; } } } return null; }
From source file:org.kuali.kpme.core.bo.HrBusinessObject.java
License:Educational Community License
public LocalDate getEffectiveLocalDate() { return effectiveDate != null ? LocalDate.fromDateFields(effectiveDate) : null; }
From source file:org.kuali.kpme.core.bo.HrKeyedSetBusinessObjectMaintainableImpl.java
License:Educational Community License
@Override protected boolean performAddLineValidation(ViewModel viewModel, Object newLine, String collectionId, String collectionPath) {/*ww w. j a v a 2s .co m*/ boolean retVal = super.performAddLineValidation(viewModel, newLine, collectionId, collectionPath); if (retVal && EFFECTIVE_KEY_LIST.equals(collectionId) && (newLine instanceof HrBusinessObjectKey)) { HrBusinessObjectKey<?, ?> addedKeyBo = (HrBusinessObjectKey<?, ?>) newLine; if (viewModel instanceof MaintenanceDocumentForm) { MaintenanceDocumentForm maintenanceForm = (MaintenanceDocumentForm) viewModel; MaintenanceDocument document = maintenanceForm.getDocument(); if (document.getNewMaintainableObject().getDataObject() instanceof HrKeyedSetBusinessObject) { HrKeyedSetBusinessObject<?, ?> keyOwnerObj = (HrKeyedSetBusinessObject<?, ?>) document .getNewMaintainableObject().getDataObject(); LocalDate asOfDate = LocalDate.fromDateFields(keyOwnerObj.getRelativeEffectiveDate()); String groupKeyCode = addedKeyBo.getGroupKeyCode(); // validate the existence of the added grp key code for the given date if (!ValidationUtils.validateGroupKey(groupKeyCode, asOfDate)) { GlobalVariables.getMessageMap().putError(ADDED_KEY_PROPERTY_PATH, ERROR_EXISTENCE_KEY, "Group Key '" + groupKeyCode + "'"); retVal = false; } // validate that duplicates not entered if (retVal && keyOwnerObj.getGroupKeyCodeSet().contains(groupKeyCode)) { GlobalVariables.getMessageMap().putError(ADDED_KEY_PROPERTY_PATH, DUPLICATE_GROUP_KEY_CODE_ERROR_KEY, groupKeyCode); retVal = false; } } } } return retVal; }
From source file:org.kuali.kpme.core.bo.validation.HrKeyedSetBusinessObjectValidation.java
License:Educational Community License
private boolean checkThatAllGroupKeysExist(HrKeyedSetBusinessObject<O, K> keyOwnerObj) { boolean retVal = true; LocalDate asOfDate = LocalDate.fromDateFields(keyOwnerObj.getRelativeEffectiveDate()); if (CollectionUtils.isNotEmpty(keyOwnerObj.getEffectiveKeyList())) { for (ListIterator<K> iterator = keyOwnerObj.getEffectiveKeyList().listIterator(); iterator.hasNext();) { int index = iterator.nextIndex(); K key = iterator.next();//from w ww . jav a 2s. c o m if (!ValidationUtils.validateGroupKey(key.getGroupKeyCode(), asOfDate)) { // put error message this.putFieldError(String.format(EFFECTIVE_KEY_LIST_PROPERTY_PATH, index), ERROR_EXISTENCE_KEY, "Group Key '" + key.getGroupKeyCode() + "'"); retVal = false; } } } return retVal; }