Added sortByDate
FEA: ItEr74S04BugFixing
This commit is contained in:
parent
9185277138
commit
cd9cb77e4a
1 changed files with 19 additions and 1 deletions
|
|
@ -22,6 +22,9 @@
|
|||
package org.navalplanner.business.planner.entities;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.joda.time.LocalDate;
|
||||
|
|
@ -43,6 +46,21 @@ public class Stretch {
|
|||
return create(stretch.date, stretch.lengthPercentage, stretch.amountWorkPercentage);
|
||||
}
|
||||
|
||||
public static Stretch buildFromConsolidatedProgress(ResourceAllocation<? extends DayAssignment> resourceAllocation) {
|
||||
return ConsolidatedStretch.fromConsolidatedProgress(resourceAllocation);
|
||||
}
|
||||
|
||||
public static List<Stretch> sortByDate(
|
||||
List<Stretch> stretches) {
|
||||
Collections.sort(stretches, new Comparator<Stretch>() {
|
||||
@Override
|
||||
public int compare(Stretch o1, Stretch o2) {
|
||||
return o1.getDate().compareTo(o2.getDate());
|
||||
}
|
||||
});
|
||||
return stretches;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private LocalDate date = new LocalDate();
|
||||
|
||||
|
|
@ -125,4 +143,4 @@ public class Stretch {
|
|||
readOnly = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue