parent
b6e27c07fc
commit
ed16e9b1ad
7 changed files with 33 additions and 14 deletions
|
|
@ -39,7 +39,7 @@ import org.navalplanner.business.orders.entities.OrderElement;
|
|||
* @author Diego Pino Garcia<dpino@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class Label extends IntegrationEntity {
|
||||
public class Label extends IntegrationEntity implements Comparable<Label> {
|
||||
|
||||
@NotEmpty(message = "name not specified")
|
||||
private String name;
|
||||
|
|
@ -122,4 +122,14 @@ public class Label extends IntegrationEntity {
|
|||
public Boolean isCodeAutogenerated() {
|
||||
return getType() != null ? getType().isCodeAutogenerated() : false;
|
||||
}
|
||||
|
||||
private String getTypeAndName() {
|
||||
return String.format("%s :: %s", type.getName(), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Label o) {
|
||||
return getTypeAndName().compareToIgnoreCase(o.getTypeAndName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ import org.navalplanner.business.resources.daos.ICriterionDAO;
|
|||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
* @author Fernando Bellas Permuy <fbellas@udc.es>
|
||||
*/
|
||||
public class Criterion extends IntegrationEntity implements ICriterion {
|
||||
public class Criterion extends IntegrationEntity implements ICriterion,
|
||||
Comparable<Criterion> {
|
||||
|
||||
public static Criterion createUnvalidated(String code, String name,
|
||||
CriterionType type, Criterion parent, Boolean active) {
|
||||
|
|
@ -465,4 +466,9 @@ public class Criterion extends IntegrationEntity implements ICriterion {
|
|||
return String.format("%s :: %s", type, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Criterion o) {
|
||||
return toString().compareToIgnoreCase(o.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ import org.navalplanner.business.workingday.IntraDayDate.PartialDay;
|
|||
* @author Jacobo Aragunde Perez <jaragunde@igalia.com>
|
||||
*/
|
||||
public abstract class Resource extends IntegrationEntity implements
|
||||
IHumanIdentifiable {
|
||||
IHumanIdentifiable, Comparable<Resource> {
|
||||
|
||||
public static class AllResourceAssignments implements IAssignmentsOnResourceCalculator {
|
||||
|
||||
|
|
@ -1186,4 +1186,10 @@ public abstract class Resource extends IntegrationEntity implements
|
|||
this.limitingResourceQueue = limitingResourceQueue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Resource resource) {
|
||||
return this.getShortDescription().compareToIgnoreCase(
|
||||
resource.getShortDescription());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
|||
* @author Fernando Bellas Permuy <fbellas@udc.es>
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
public class Worker extends Resource implements Comparable {
|
||||
public class Worker extends Resource {
|
||||
|
||||
public static Worker create() {
|
||||
return create(new Worker());
|
||||
|
|
@ -191,15 +191,6 @@ public class Worker extends Resource implements Comparable {
|
|||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object arg0) {
|
||||
if (!(arg0 instanceof Worker)) {
|
||||
return -1;
|
||||
}
|
||||
Worker worker = (Worker) arg0;
|
||||
return worker.getShortDescription().compareTo(getShortDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHumanId() {
|
||||
if (firstName == null) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
package org.navalplanner.web.common.components.finders;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.navalplanner.business.resources.daos.IResourceDAO;
|
||||
|
|
@ -41,7 +42,9 @@ public class ResourceFinder extends Finder implements IFinder {
|
|||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Resource> getAll() {
|
||||
return resourceDAO.getResources();
|
||||
List<Resource> resources = resourceDAO.getResources();
|
||||
Collections.sort(resources);
|
||||
return resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import static org.navalplanner.web.I18nHelper._;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ public class HoursWorkedPerWorkerModel implements IHoursWorkedPerWorkerModel {
|
|||
for (Label label : allLabels) {
|
||||
label.getType().getName();
|
||||
}
|
||||
Collections.sort(allLabels);
|
||||
return allLabels;
|
||||
}
|
||||
|
||||
|
|
@ -183,6 +184,7 @@ public class HoursWorkedPerWorkerModel implements IHoursWorkedPerWorkerModel {
|
|||
|
||||
@Override
|
||||
public List<Criterion> getCriterions() {
|
||||
Collections.sort(allCriterions);
|
||||
return this.allCriterions;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue