Project

General

Profile

« Previous | Next » 

Revision 482d17ed

Added by Andreas Müller over 3 years ago

cleanup

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/location/NamedArea.java
89 89
    private static final long serialVersionUID = 6248434369557403036L;
90 90
    private static final Logger logger = Logger.getLogger(NamedArea.class);
91 91

  
92

  
93 92
	//Continent UUIDs
94 93
    private static final UUID uuidEurope = UUID.fromString("3b69f979-408c-4080-b573-0ad78a315610");
95 94
	private static final UUID uuidAfrica = UUID.fromString("c204c529-d8d2-458f-b939-96f0ebd2cbe8");
......
101 100
	private static final UUID uuidPacific = UUID.fromString("c57adcff-5213-45f0-a5f0-97a9f5c0f1fe");
102 101
	private static final UUID uuidAntarctica = UUID.fromString("71fd9ab7-9b07-4eb6-8e54-c519aff56728");
103 102

  
104

  
105 103
    public static final UUID uuidTdwgAreaVocabulary = UUID.fromString("1fb40504-d1d7-44b0-9731-374fbe6cac77");
106 104
    public static final UUID uuidContinentVocabulary = UUID.fromString("e72cbcb6-58f8-4201-9774-15d0c6abc128");
107 105
    public static final UUID uuidWaterbodyVocabulary = UUID.fromString("35a62b25-f541-4f12-a7c7-17d90dec3e03");
108 106

  
109

  
110 107
	private static final UUID uuidArcticOcean = UUID.fromString("af4271e5-8897-4e6f-9db7-54ea4f28cfc0");
111 108
	private static final UUID uuidAtlanticOcean = UUID.fromString("77e79804-1b17-4c99-873b-933fe216e3da");
112 109
	private static final UUID uuidPacificOcean = UUID.fromString("3d68a327-104c-49d5-a2d8-c71c6600181b");
......
118 115
	private static final UUID uuidRedSea = UUID.fromString("ee69385e-6c80-405c-be6e-974e9fd1e297");
119 116
	private static final UUID uuidPersianGulf = UUID.fromString("8dc16e70-74b8-4143-95cf-a659a319a854");
120 117

  
121

  
122

  
123 118
    private static Map<String, UUID> tdwgAbbrevMap = null;
124 119
    private static Map<String, UUID> tdwgLabelMap = null;
125 120

  
......
127 122
    private static Map<UUID, NamedArea> continentMap = null;
128 123
    private static Map<UUID, NamedArea> waterbodyMap = null;
129 124

  
130

  
131 125
    private static Map<UUID, NamedArea> termMap = null;
132 126

  
133 127
	public static final NamedArea ARCTICOCEAN () { return waterbodyMap.get(uuidArcticOcean );}
......
160 154
        return new NamedArea(description, label, labelAbbrev);
161 155
    }
162 156

  
163

  
164 157
//**************************** VARIABLES *******************************/
165 158

  
166 159
    //description of time valid context of this area. e.g. year range
......
368 361
		return 7;
369 362
	}
370 363

  
371

  
372 364
    @Override
373 365
    public void resetTerms(){
374 366
        termMap = null;
......
488 480
		return getContinentByUuid(uuidPacific);
489 481
	}
490 482

  
491

  
492 483
	protected void setDefaultContinentTerms(TermVocabulary<NamedArea> termVocabulary) {
493 484
		continentMap = new HashMap<>();
494 485
		for (NamedArea term : termVocabulary.getTerms()){
......
509 500
            tdwgTermMap.put(term.getUuid(), term);  //TODO casting
510 501
            addTdwgArea(term);
511 502
        }
512

  
513 503
	}
514 504

  
515 505
   protected static void addTdwgArea(NamedArea area){
......
556 546
    	tdwgAbbrevMap = new HashMap<>();
557 547
    }
558 548

  
559

  
560

  
561 549
    @Override
562 550
    protected void setDefaultTerms(TermVocabulary<NamedArea> termVocabulary) {
563 551
        if (termVocabulary.getUuid().equals(NamedArea.uuidTdwgAreaVocabulary)){
......
598 586
        return result;
599 587
    }
600 588

  
601

  
602 589
    public static class LevelNode {
603 590
        NamedAreaLevel level;
604 591
        List<NamedAreaNode> areaList = new ArrayList<>();
......
608 595
            node.area = area;
609 596
            areaList.add(node);
610 597
            return node;
611

  
612 598
        }
613 599

  
614 600
        public NamedAreaNode getNamedAreaNode(NamedArea area) {
......
646 632
                }
647 633
                if (areaSize > 0){
648 634
                    result += "]";
649

  
650 635
                }
651 636
                return result;
652 637
            }
653 638
        }
654

  
655 639
    }
656 640

  
657 641
    public static class NamedAreaNode {
......
674 658
            } else {
675 659
                return node.areaList;
676 660
            }
677
        };
661
        }
678 662

  
679 663
        public boolean contains(NamedAreaLevel level) {
680 664
            if (getList(level).size() > 0) {
......
748 732
        }
749 733
        List<NamedArea> newList = areaHierarchie.subList(1, areaHierarchie.size());
750 734
        mergeIntoResult(namedAreaNode, newList);
751

  
752 735
    }
753 736

  
754 737
    @Transient
......
782 765
        return result;
783 766
    }
784 767

  
785

  
786

  
787 768
    /**
788 769
     * Returns the label of the named area together with the area level label and the abbreviated label.
789 770
     * This is kind of a formatter method which may be moved to a better place in future.
......
820 801
        return title.toString();
821 802
    }
822 803

  
823
    /**
824
     * @param definedTerm
825
     * @param representation
826
     * @return
827
     */
828 804
    private static String getPreferredAreaLabel(DefinedTermBase<?> definedTerm, Representation representation) {
829 805
        String areaString = null;
830 806
        if (representation != null){
......
862 838
        //no changes to level, pointApproximation, shape, type, validPeriod and countries
863 839
        return result;
864 840
    }
865

  
866

  
867 841
}

Also available in: Unified diff