Project

General

Profile

Download (1.18 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2021 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.persistence.dto;
10

    
11
import java.io.Serializable;
12
import java.util.Comparator;
13

    
14
/**
15
 * @author k.luther
16
 * @since 30.11.2021
17
 */
18
public class FeatureStateDtoComparator implements Serializable, Comparator<FeatureStateDto> {
19

    
20
    private static final long serialVersionUID = -4808908193485190520L;
21

    
22
    @Override
23
    public int compare(FeatureStateDto o1, FeatureStateDto o2) {
24
        if(o1==null){
25
            return -1;
26
        }
27
        if(o2==null){
28
            return 1;
29
        }
30
        if (o1.getUuid() == null && o2.getUuid() != null){
31
            return -1;
32
        }
33
        if (o2.getUuid() == null && o1.getUuid() != null){
34
            return 1;
35
        }
36
        if (o1.getUuid() != null && o2.getUuid() != null){
37
            return o1.getFeature().getTitleCache().compareTo(o2.getTitleCache());
38
        } else {
39
            return o1.getFeature().getUuid().compareTo(o2.getFeature().getUuid());
40
        }
41

    
42
    }
43

    
44
}
(9-9/30)