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.libreplan.web.planner.consolidations.AdvanceConsolidationModel.java
License:Open Source License
private ConsolidatedValue createNewConsolidatedValue(AdvanceConsolidationDTO dto) { if (consolidation != null && task != null) { if (consolidation.isCalculated()) { return CalculatedConsolidatedValue.create(LocalDate.fromDateFields(dto.getDate()), dto.getPercentage(), task.getIntraDayEndDate()); } else {/* w w w . j a v a 2s.com*/ AdvanceMeasurement measure = dto.getAdvanceMeasurement(); NonCalculatedConsolidatedValue consolidatedValue = NonCalculatedConsolidatedValue.create( LocalDate.fromDateFields(dto.getDate()), dto.getPercentage(), measure, task.getIntraDayEndDate()); measure.getNonCalculatedConsolidatedValues().add(consolidatedValue); return consolidatedValue; } } return null; }
From source file:org.libreplan.web.planner.order.OrderPlanningModel.java
License:Open Source License
private Constraint dateMustBeInsideVisualizationArea(final OrderEarnedValueChartFiller earnedValueChartFiller) { return (comp, valueObject) -> { Date value = (Date) valueObject; if (value != null && !EarnedValueChartFiller.includes(earnedValueChartFiller.getIndicatorsDefinitionInterval(), LocalDate.fromDateFields(value))) { throw new WrongValueException(comp, _("Date must be inside visualization area")); }//from w ww . ja va 2s. co m }; }
From source file:org.libreplan.web.planner.order.OrderPlanningModel.java
License:Open Source License
private void dateInFutureMessage(Datebox datebox) { Date value = datebox.getValue(); Date today = LocalDate.fromDateFields(new Date()).toDateTimeAtStartOfDay().toDate(); if (value != null && (value.compareTo(today) > 0)) { throw new WrongValueException(datebox, _("date in the future")); }//w w w . ja va 2 s. c om }
From source file:org.libreplan.web.planner.order.SubcontractModel.java
License:Open Source License
@Override public void setEndDate(Date endDate) { this.endDate = IntraDayDate.startOfDay(LocalDate.fromDateFields(endDate)); }
From source file:org.libreplan.web.planner.reassign.ReassignController.java
License:Open Source License
public void confirm() { if (currentType.needsAssociatedDate()) { Date value = associatedDate.getValue(); if (value == null) { throw new WrongValueException(associatedDate, _("cannot be empty")); }//from w ww . ja va 2 s .c o m } window.setVisible(false); final LocalDate associatedDate = this.associatedDate.getValue() != null ? LocalDate.fromDateFields(this.associatedDate.getValue()) : null; configurationResult.result(ReassignConfiguration.create(currentType, associatedDate)); }
From source file:org.libreplan.web.planner.taskedition.TaskPropertiesController.java
License:Open Source License
private boolean saveConstraintChanges() { TaskPositionConstraint taskConstraint = currentTaskElementAsTaskLeafConstraint().getPositionConstraint(); PositionConstraintType type = startConstraintTypes.getSelectedItem().getValue(); IntraDayDate inputDate = type.isAssociatedDateRequired() ? IntraDayDate.startOfDay(LocalDate.fromDateFields(startConstraintDate.getValue())) : null;//from ww w . ja v a2 s . com if (taskConstraint.isValid(type, inputDate)) { taskConstraint.update(type, inputDate); /* * At this point we could call currentContext.recalculatePosition(currentTaskElement) * to trigger the scheduling algorithm, but we don't do it because * the ResourceAllocationController, which is attached to the other * tab of the same window, will do it anyway. */ return true; } else { return false; } }
From source file:org.libreplan.web.resourceload.ResourceLoadModel.java
License:Open Source License
public static LocalDate toLocal(Date date) { return date == null ? null : LocalDate.fromDateFields(date); }
From source file:org.libreplan.web.resources.machine.MachineCRUDController.java
License:Open Source License
private ResourcePredicate createPredicate() { List listFilters = bdFilters.getSelectedElements(); String personalFilter = txtfilter.getValue(); // Get the dates filter LocalDate startDate = null;/*from w w w. j ava2 s. c o m*/ LocalDate finishDate = null; if (filterStartDate.getValue() != null) { startDate = LocalDate.fromDateFields(filterStartDate.getValue()); } if (filterFinishDate.getValue() != null) { finishDate = LocalDate.fromDateFields(filterFinishDate.getValue()); } final Listitem item = filterLimitingResource.getSelectedItem(); Boolean isLimitingResource = (item != null) ? LimitingResourceEnum.valueOf((LimitingResourceEnum) item.getValue()) : null; if (listFilters.isEmpty() && (personalFilter == null || personalFilter.isEmpty()) && startDate == null && finishDate == null && isLimitingResource == null) { return null; } return new ResourcePredicate(listFilters, personalFilter, startDate, finishDate, isLimitingResource); }
From source file:org.libreplan.web.resources.search.NewAllocationSelectorController.java
License:Open Source License
private List<ResourceWithItsLoadRatios> addLoadRatiosCalculations(List<? extends Resource> listResources) { List<ResourceWithItsLoadRatios> result = new ArrayList<>(); for (Resource each : listResources) { ILoadRatiosDataType t = resourceLoadRatiosCalculator.calculateLoadRatios(each, LocalDate.fromDateFields(startDateLoadRatiosDatebox.getValue()), LocalDate.fromDateFields(endDateLoadRatiosDatebox.getValue()), scenarioManager.getCurrent()); result.add(new ResourceWithItsLoadRatios(each, t)); }/*from w w w .j av a 2s. c om*/ return result; }
From source file:org.libreplan.web.resources.worker.CriterionSatisfactionDTO.java
License:Open Source License
private LocalDate asLocalDate(Date value) { if (value == null) { return null; } return LocalDate.fromDateFields(value); }