Project

General

Profile

Download (3.94 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.ext.geo;
10

    
11
import java.io.Serializable;
12
import java.util.ArrayList;
13
import java.util.Arrays;
14
import java.util.HashSet;
15
import java.util.List;
16
import java.util.Set;
17
import java.util.UUID;
18

    
19
import eu.etaxonomy.cdm.common.UTF8;
20
import eu.etaxonomy.cdm.compare.common.OrderType;
21
import eu.etaxonomy.cdm.ext.geo.CondensedDistributionComposer.SymbolUsage;
22
import eu.etaxonomy.cdm.model.common.MarkerType;
23
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
24

    
25
/**
26
 * @author a.mueller
27
 * @since 17.02.2021
28
 */
29
public class CondensedDistributionConfiguration implements Serializable {
30

    
31
    private static final long serialVersionUID = -4753899114349109805L;
32

    
33
    //if true, all areas are shown in bold, no matter which status they have
34
    public boolean areasBold = false;  //true for Cuba
35

    
36
    //if true the area of scope (e.g. EM) area label is shown, otherwise only
37
    //the status symbol (usually an endemism information is shown, if at all)
38
    public boolean showAreaOfScopeLabel = false;   //true for Cuba
39

    
40
    //the separator before the list of outOfScope areas
41
    public String outOfScopeAreasSeperator = " " + UTF8.EN_DASH.toString() + " ";   //not needed for E+M
42

    
43
    public boolean splitNativeAndIntroduced = true;  //false for Cuba
44

    
45
    public String introducedBracketStart = "[";
46

    
47
    public String introducedBracketEnd = "]";
48

    
49
    //if true a subarea Az(F) will be shortened to F if it is shown in brackets after the parent area
50
    public boolean shortenSubAreaLabelsIfPossible = true;  //not relevant for Cuba
51

    
52
    public boolean showStatusOnParentAreaIfAllSame = true;  //false for Cuba
53

    
54
    public List<String> areaOfScopeSubAreaBracketStart = Arrays.asList(new String[]{" ","("});  // "(","(" for Cuba
55

    
56
    public List<String> areaOfScopeSubAreaBracketEnd = Arrays.asList(new String[]{"",")"});    // ")",")" for Cuba
57

    
58
    public List<UUID> statusForBoldAreas = Arrays.asList(new UUID[]{PresenceAbsenceTerm.uuidNative});  //empty for Cuba as for Cuba all areas are bold
59

    
60
    public SymbolUsage areaSymbolField = SymbolUsage.IdInVoc;   //currently IdInVoc for both, but may change in future
61

    
62
    public SymbolUsage statusSymbolField = SymbolUsage.Symbol2;   //currently Symbol1 for Cuba, but may change in future
63

    
64
    public OrderType orderType = OrderType.ALPHABETIC;
65

    
66
    //if true, any non-empty symbol is taken from symbol2, symbol1, idInVoc and abbrevLabel according to the given order
67
    public boolean showAnyStatusSmbol = false;   //usually does not make sense to mix symbol fields
68

    
69
    public Set<UUID> hiddenAndFallbackAreaMarkers = new HashSet<>(Arrays.asList(MarkerType.uuidFallbackArea)); //TODO shouldn't we add the hiddenAreaMarker here, too?
70

    
71
//************************** FACTORY ***************************************/
72

    
73
    public static CondensedDistributionConfiguration NewDefaultInstance() {
74
        CondensedDistributionConfiguration result = new CondensedDistributionConfiguration();
75
        result.hiddenAndFallbackAreaMarkers.add(MarkerType.uuidFallbackArea);
76
        return result;
77
    }
78

    
79
    public static CondensedDistributionConfiguration NewCubaInstance() {
80
        CondensedDistributionConfiguration result = new CondensedDistributionConfiguration();
81
        result.areasBold = true;
82
        result.showAreaOfScopeLabel = true;
83
        result.splitNativeAndIntroduced = false;
84
        result.shortenSubAreaLabelsIfPossible = false;
85
        result.showStatusOnParentAreaIfAllSame = false;
86
        result.areaOfScopeSubAreaBracketStart.set(0, "(");
87
        result.areaOfScopeSubAreaBracketEnd.set(0, ")");
88
        result.statusForBoldAreas = new ArrayList<>();
89
        result.statusSymbolField = SymbolUsage.Symbol1;
90
        result.orderType = OrderType.NATURAL;
91
        return result;
92
    }
93
}
(2-2/11)